(filename, shape)
Static method to save a `topoDS_Shape` object to a file.
    	Supported extensions are: ".iges", ".step".
    	
    	:param str filename: the name of the file where the shape will be saved.
    	
    	Example:
    	   
    	   >>> from pygem.cad import CADDeformation as CAD
    	   >>> CAD.read_shape('example.step', my_shape)
Static method to save a `topoDS_Shape` object to a file.
    	Supported extensions are: ".iges", ".step".
    	
    	:param str filename: the name of the file where the shape will be saved.
    	
    	Example:
    	   
    	   >>> from pygem.cad import CADDeformation as CAD
    	   >>> CAD.read_shape('example.step', my_shape)
Static method to save a topoDS_Shape object to a file . Supported extensions are : . iges . step . : param str filename : the name of the file where the shape will be saved . Example : >>> from pygem . cad import CADDeformation as CAD >>> CAD . read_shape ( example . step my_shape )
def write_shape(filename, shape):
        """
    	Static method to save a `topoDS_Shape` object to a file.
    	Supported extensions are: ".iges", ".step".
    	
    	:param str filename: the name of the file where the shape will be saved.
    	
    	Example:
    	   
    	   >>> from pygem.cad import CADDeformation as CAD
    	   >>> CAD.read_shape('example.step', my_shape)
    	"""
        def write_iges(filename, shape):
            """ IGES writer """
            IGESControl_Controller_Init()
            writer = IGESControl_Writer()
            writer.AddShape(shape)
            writer.Write(filename)

        def write_step(filename, shape):
            """ STEP writer """
            step_writer = STEPControl_Writer()
            # Changes write schema to STEP standard AP203
            # It is considered the most secure standard for STEP.
            # *According to PythonOCC documentation (http://www.pythonocc.org/)
            Interface_Static_SetCVal("write.step.schema", "AP203")
            Interface_Static_SetCVal('write.surfacecurve.mode','0')
            step_writer.Transfer(shape, STEPControl_AsIs)
            step_writer.Write(filename)

        file_extension = os.path.splitext(filename)[1]

        av_writers = {
            '.step': write_step,
            '.iges': write_iges,
        }

        writer = av_writers.get(file_extension)
        if writer is None:
            raise ValueError('Unable to open the output file')
        writer(filename, shape)
def write_shape ( filename , shape ) : def write_iges ( filename , shape ) : """ IGES writer """ IGESControl_Controller_Init ( ) writer = IGESControl_Writer ( ) writer . AddShape ( shape ) writer . Write ( filename ) def write_step ( filename , shape ) : """ STEP writer """ step_writer = STEPControl_Writer ( ) # Changes write schema to STEP standard AP203 # It is considered the most secure standard for STEP. # *According to PythonOCC documentation (http://www.pythonocc.org/) Interface_Static_SetCVal ( "write.step.schema" , "AP203" ) Interface_Static_SetCVal ( 'write.surfacecurve.mode' , '0' ) step_writer . Transfer ( shape , STEPControl_AsIs ) step_writer . Write ( filename ) file_extension = os . path . splitext ( filename ) [ 1 ] av_writers = { '.step' : write_step , '.iges' : write_iges , } writer = av_writers . get ( file_extension ) if writer is None : raise ValueError ( 'Unable to open the output file' ) writer ( filename , shape )