Version: 9.12.0
Home

Functions

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. More...
 
def Import (self, theFileName, theFormatName, theName=None)
 Deprecated analog of ImportFile() More...
 
def RestoreShape (self, theStream, theName=None)
 Read a shape from the binary stream, containing its bounding representation (BRep). More...
 
def Export (self, theObject, theFileName, theFormatName)
 Export the given shape into a file with given name. More...
 
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. More...
 
def ImportSTL (self, theFileName, theName=None)
 Import a shape from the STL file. More...
 
def ExportBREP (self, theObject, theFileName)
 Export the given shape into a file with given name in BREP format. More...
 
def ImportBREP (self, theFileName, theName=None)
 Import a shape from the BREP file. More...
 
def ExportSTEP (self, theObject, theFileName, theUnit=GEOM.LU_METER)
 Export the given shape into a file with given name in STEP format. More...
 
def GetSTEPUnit (self, theFileName)
 Return length unit from given STEP file. More...
 
def ImportSTEP (self, theFileName, theIsIgnoreUnits=False, IsCreateAssemblies=False, theName=None)
 Import a shape from the STEP file with given name. More...
 
def ExportIGES (self, theObject, theFileName, theVersion="5.1")
 Export the given shape into a file with given name in IGES format. More...
 
def GetIGESUnit (self, theFileName)
 Return length unit from given IGES file. More...
 
def ImportIGES (self, theFileName, theIsIgnoreUnits=False, theName=None)
 Import a shape from the IGES file with given name. More...
 
def ExportXAO (self, shape, groups, fields, author, fileName, shapeFileName="")
 Export a shape to XAO format. More...
 
def ExportXAOMem (self, shape, groups, fields, author)
 Export a shape to XAO format in byte array. More...
 
def ImportXAO (self, fileName, theName=None)
 Import a shape from XAO format. More...
 
def ImportXAOMem (self, byteArray, theName=None)
 Import a shape from XAO format byte array. More...
 
def ExportVTK (self, theObject, theFileName, theDeflection=0.001)
 Export the given shape into a file with given name in VTK format. More...
 

Detailed Description

Function Documentation

◆ ImportFile()

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().

◆ Import()

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

◆ RestoreShape()

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, and geomBuilder.RaiseIfFailed().

◆ Export()

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.InsertOp.

◆ ExportSTL()

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().

◆ ImportSTL()

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().

◆ ExportBREP()

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().

◆ ImportBREP()

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().

◆ ExportSTEP()

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().

◆ GetSTEPUnit()

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().

◆ 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().

◆ ExportIGES()

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().

◆ GetIGESUnit()

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().

◆ ImportIGES()

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().

◆ ExportXAO()

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().

◆ ExportXAOMem()

def ExportXAOMem (   self,
  shape,
  groups,
  fields,
  author 
)

Export a shape to XAO format in byte array.

Parameters
shapeThe shape to export
groupsThe list of groups to export
fieldsThe list of fields to export
authorThe author of the file
Returns
Byte array with exported data

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

◆ ImportXAO()

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.addToStudyInFather(), geomBuilder.GetXAOPluginOperations(), geomBuilder.myMaxNbSubShapesAllowed, and geomBuilder.RaiseIfFailed().

◆ ImportXAOMem()

def ImportXAOMem (   self,
  byteArray,
  theName = None 
)

Import a shape from XAO format byte array.

Parameters
byteArraybyte array with XAO data
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.addToStudyInFather(), geomBuilder.GetXAOPluginOperations(), geomBuilder.myMaxNbSubShapesAllowed, and geomBuilder.RaiseIfFailed().

◆ ExportVTK()

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().