(filename)
Static method to load the `topoDS_Shape` from a file.
    	Supported extensions are: ".iges", ".step".
    	
    	:param str filename: the name of the file containing the geometry.
    	
    	Example:
    	   
    	   >>> from pygem.cad import CADDeformation as CAD
    	   >>> shape = CAD.read_shape('example.iges')
Static method to load the `topoDS_Shape` from a file.
    	Supported extensions are: ".iges", ".step".
    	
    	:param str filename: the name of the file containing the geometry.
    	
    	Example:
    	   
    	   >>> from pygem.cad import CADDeformation as CAD
    	   >>> shape = CAD.read_shape('example.iges')
Static method to load the topoDS_Shape from a file . Supported extensions are : . iges . step . : param str filename : the name of the file containing the geometry . Example : >>> from pygem . cad import CADDeformation as CAD >>> shape = CAD . read_shape ( example . iges )
def read_shape(filename):
        """
    	Static method to load the `topoDS_Shape` from a file.
    	Supported extensions are: ".iges", ".step".
    	
    	:param str filename: the name of the file containing the geometry.
    	
    	Example:
    	   
    	   >>> from pygem.cad import CADDeformation as CAD
    	   >>> shape = CAD.read_shape('example.iges')
    	"""

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

        av_readers = {
            '.step': STEPControl_Reader,
            '.iges': IGESControl_Reader,
        }

        reader_class = av_readers.get(file_extension)
        if reader_class is None:
            raise ValueError('Unable to open the input file')
        reader = reader_class()

        return_reader = reader.ReadFile(filename)
        # check status
        if return_reader == IFSelect_RetDone:
            return_transfer = reader.TransferRoots()
            if return_transfer:
                # load all shapes in one
                shape = reader.OneShape()
                return shape
            else:
                raise RuntimeError("Shapes not loaded.")
        else:
            raise RuntimeError("Cannot read the file.")
def read_shape ( filename ) : file_extension = os . path . splitext ( filename ) [ 1 ] av_readers = { '.step' : STEPControl_Reader , '.iges' : IGESControl_Reader , } reader_class = av_readers . get ( file_extension ) if reader_class is None : raise ValueError ( 'Unable to open the input file' ) reader = reader_class ( ) return_reader = reader . ReadFile ( filename ) # check status if return_reader == IFSelect_RetDone : return_transfer = reader . TransferRoots ( ) if return_transfer : # load all shapes in one shape = reader . OneShape ( ) return shape else : raise RuntimeError ( "Shapes not loaded." ) else : raise RuntimeError ( "Cannot read the file." )