Version: 8.3.0
Home
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Importing/exporting geometrical objects

Functions

def ImportFile
 Import a shape from the BREP, IGES, STEP or other file (depends on given format) with given name. More...
 
def Import
 Deprecated analog of ImportFile() More...
 
def RestoreShape
 Read a shape from the binary stream, containing its bounding representation (BRep). More...
 
def Export
 Export the given shape into a file with given name. More...
 
def ExportSTL
 Export the given shape into a file with given name in STL format. More...
 
def ImportSTL
 Import a shape from the STL file. More...
 
def ExportBREP
 Export the given shape into a file with given name in BREP format. More...
 
def ImportBREP
 Import a shape from the BREP file. More...
 
def ExportSTEP
 Export the given shape into a file with given name in STEP format. More...
 
def GetSTEPUnit
 Return length unit from given STEP file. More...
 
def ImportSTEP
 Import a shape from the STEP file with given name. More...
 
def ExportIGES
 Export the given shape into a file with given name in IGES format. More...
 
def GetIGESUnit
 Return length unit from given IGES file. More...
 
def ImportIGES
 Import a shape from the IGES file with given name. More...
 
def ExportXAO
 Export a shape to XAO format. More...
 
def ImportXAO
 Import a shape from XAO format. More...
 
def ExportVTK
 Export the given shape into a file with given name in VTK format. More...
 

Detailed Description

Function Documentation

def ImportFile (   self,
  theFileName,
  theFormatName,
  theName = None 
)

Import a shape from the BREP, IGES, STEP or other file (depends on given format) with given name.

Note: this function is deprecated, it is kept for backward compatibility only Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.

Parameters
theFileNameThe file, containing the shape.
theFormatNameSpecify format for the file reading. Available formats can be obtained with InsertOp.ImportTranslators() method. If format 'IGES_SCALE' is used instead of 'IGES' or format 'STEP_SCALE' is used instead of 'STEP', length unit will be set to 'meter' and result model will be scaled.
theNameObject name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name.
Returns
New GEOM.GEOM_Object, containing the imported shape. If material names are imported it returns the list of objects. The first one is the imported object followed by material groups.
Note
Auto publishing is allowed for the shape itself. Imported material groups are not automatically published.

Example

References geomBuilder._autoPublish(), geomBuilder.InsertOp, and geomBuilder.RaiseIfFailed().

def Import (   self,
  theFileName,
  theFormatName,
  theName = None 
)
def RestoreShape (   self,
  theStream,
  theName = None 
)

Read a shape from the binary stream, containing its bounding representation (BRep).

Note
As the byte-stream representing the shape data can be quite large, this method is not automatically dumped to the Python script with the DumpStudy functionality; so please use this method carefully, only for strong reasons.
GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's data stream.
Parameters
theStreamThe BRep binary stream.
theNameObject name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name.
Returns
New GEOM_Object, containing the shape, read from theStream.

Example

References geomBuilder._autoPublish(), geomBuilder.InsertOp, geomBuilder.ManageTransactions(), and geomBuilder.RaiseIfFailed().

def Export (   self,
  theObject,
  theFileName,
  theFormatName 
)

Export the given shape into a file with given name.

Note: this function is deprecated, it is kept for backward compatibility only Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.

Parameters
theObjectShape to be stored in the file.
theFileNameName of the file to store the given shape in.
theFormatNameSpecify format for the shape storage. Available formats can be obtained with geompy.InsertOp.ExportTranslators()[0] method.

Example

References geomBuilder.ManageTransactions().

def ExportSTL (   self,
  theObject,
  theFileName,
  theIsASCII = True,
  theDeflection = 0.001,
  theIsRelative = True 
)

Export the given shape into a file with given name in STL format.

Parameters
theObjectShape to be stored in the file.
theFileNameName of the file to store the given shape in.
theIsASCIIThe format of the exported file (ASCII or Binary)
theDeflectionDeflection of the given shape.
theIsRelativeIf True (default value), the deflection is calculated relatively to the size of the shape; if False, the user defined deflection is used.

References geomBuilder.GetSTLPluginOperations().

def ImportSTL (   self,
  theFileName,
  theName = None 
)

Import a shape from the STL file.

Parameters
theFileNameThe file, containing the shape.
theNameObject name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name.
Returns
New GEOM.GEOM_Object, containing the imported shape. If material names are imported it returns the list of objects. The first one is the imported object followed by material groups.
Note
Auto publishing is allowed for the shape itself. Imported material groups are not automatically published.

References geomBuilder._autoPublish(), geomBuilder.GetSTLPluginOperations(), and geomBuilder.RaiseIfFailed().

def ExportBREP (   self,
  theObject,
  theFileName 
)

Export the given shape into a file with given name in BREP format.

Parameters
theObjectShape to be stored in the file.
theFileNameName of the file to store the given shape in.

References geomBuilder.GetBREPPluginOperations().

def ImportBREP (   self,
  theFileName,
  theName = None 
)

Import a shape from the BREP file.

Parameters
theFileNameThe file, containing the shape.
theNameObject name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name.
Returns
New GEOM.GEOM_Object, containing the imported shape. If material names are imported it returns the list of objects. The first one is the imported object followed by material groups.
Note
Auto publishing is allowed for the shape itself. Imported material groups are not automatically published.

References geomBuilder._autoPublish(), geomBuilder.GetBREPPluginOperations(), and geomBuilder.RaiseIfFailed().

def ExportSTEP (   self,
  theObject,
  theFileName,
  theUnit = GEOM.LU_METER 
)

Export the given shape into a file with given name in STEP format.

Parameters
theObjectShape to be stored in the file.
theFileNameName of the file to store the given shape in.
theUnitthe length unit (see GEOM::length_unit). In meters by default.

References geomBuilder.GetSTEPPluginOperations().

def GetSTEPUnit (   self,
  theFileName 
)

Return length unit from given STEP file.

Parameters
theFileNameThe file, containing the shape.
Returns
String, containing the units name.

Example

References geomBuilder.GetSTEPPluginOperations(), and geomBuilder.ImportSTEP().

def ImportSTEP (   self,
  theFileName,
  theIsIgnoreUnits = False,
  IsCreateAssemblies = False,
  theName = None 
)

Import a shape from the STEP file with given name.

Parameters
theFileNameThe file, containing the shape.
theIsIgnoreUnitsIf True, file length units will be ignored (set to 'meter') and result model will be scaled, if its units are not meters. If False (default), file length units will be taken into account.
IsCreateAssembliesIf True, for each assembly compound is created in the result. If False Compounds that contain a single shape are eliminated from the result.
theNameObject name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name.
Returns
New GEOM.GEOM_Object, containing the imported shape. If material names are imported it returns the list of objects. The first one is the imported object followed by material groups.
Note
Auto publishing is allowed for the shape itself. Imported material groups are not automatically published.

Example

References geomBuilder._autoPublish(), geomBuilder.GetSTEPPluginOperations(), and geomBuilder.RaiseIfFailed().

def ExportIGES (   self,
  theObject,
  theFileName,
  theVersion = "5.1" 
)

Export the given shape into a file with given name in IGES format.

Parameters
theObjectShape to be stored in the file.
theFileNameName of the file to store the given shape in.
theVersionVersion of IGES format which defines, whether to write only faces (5.1 IGES format) or shells and solids also (5.3 IGES format).

References geomBuilder.GetIGESPluginOperations().

def GetIGESUnit (   self,
  theFileName 
)

Return length unit from given IGES file.

Parameters
theFileNameThe file, containing the shape.
Returns
String, containing the units name.

Example

References geomBuilder.GetIGESPluginOperations().

def ImportIGES (   self,
  theFileName,
  theIsIgnoreUnits = False,
  theName = None 
)

Import a shape from the IGES file with given name.

Parameters
theFileNameThe file, containing the shape.
theIsIgnoreUnitsIf True, file length units will be ignored (set to 'meter') and result model will be scaled, if its units are not meters. If False (default), file length units will be taken into account.
theNameObject name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name.
Returns
New GEOM.GEOM_Object, containing the imported shape. If material names are imported it returns the list of objects. The first one is the imported object followed by material groups.
Note
Auto publishing is allowed for the shape itself. Imported material groups are not automatically published.

Example

References geomBuilder._autoPublish(), geomBuilder.GetIGESPluginOperations(), and geomBuilder.RaiseIfFailed().

def ExportXAO (   self,
  shape,
  groups,
  fields,
  author,
  fileName,
  shapeFileName = "" 
)

Export a shape to XAO format.

Parameters
shapeThe shape to export
groupsThe list of groups to export
fieldsThe list of fields to export
authorThe author of the file
fileNameThe name of the file to export
shapeFileNameThe name of the BRep file to export
Returns
True if operation is successful or False otherwise

References geomBuilder.GetXAOPluginOperations(), and geomBuilder.RaiseIfFailed().

def ImportXAO (   self,
  fileName,
  theName = None 
)

Import a shape from XAO format.

Parameters
fileNameThe name of the file to import
theNameObject name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name.
Returns
tuple (res, shape, subShapes, groups, fields) res Flag indicating if the import was successful shape The imported shape subShapes The list of imported subShapes groups The list of imported groups fields The list of imported fields

References geomBuilder._autoPublish(), geomBuilder.GetXAOPluginOperations(), and geomBuilder.RaiseIfFailed().

def ExportVTK (   self,
  theObject,
  theFileName,
  theDeflection = 0.001 
)

Export the given shape into a file with given name in VTK format.

Parameters
theObjectShape to be stored in the file.
theFileNameName of the file to store the given shape in.
theDeflectionDeflection of the given shape.

References geomBuilder.GetVTKPluginOperations().