## vertices = geompy.SubShapeAll(box, geomBuilder.ShapeType['VERTEX'])
## # only 5 first vertices will be published, with default names
## print len(vertices)
-## # note, that result value still containes all 8 vertices
+## # note, that result value still contains all 8 vertices
## geompy.addToStudyAuto(-1) # disable automatic publication
## @endcode
##
# in place of sub-shapes of the first argument,
# because the whole shape corresponds to the first argument.
# Mainly to be used after transformations, but it also can be
- # usefull after partition with one object shape, and some other
+ # useful after partition with one object shape, and some other
# operations, where only the first argument has to be considered.
# If theObject has only one argument shape, this flag is automatically
# considered as True, not regarding really passed value.
in place of sub-shapes of the first argument,
because the whole shape corresponds to the first argument.
Mainly to be used after transformations, but it also can be
- usefull after partition with one object shape, and some other
+ useful after partition with one object shape, and some other
operations, where only the first argument has to be considered.
If theObject has only one argument shape, this flag is automatically
considered as True, not regarding really passed value.
# in place of sub-shapes of the first argument,
# because the whole shape corresponds to the first argument.
# Mainly to be used after transformations, but it also can be
- # usefull after partition with one object shape, and some other
+ # useful after partition with one object shape, and some other
# operations, where only the first argument has to be considered.
# If theObject has only one argument shape, this flag is automatically
# considered as True, not regarding really passed value.
in place of sub-shapes of the first argument,
because the whole shape corresponds to the first argument.
Mainly to be used after transformations, but it also can be
- usefull after partition with one object shape, and some other
+ useful after partition with one object shape, and some other
operations, where only the first argument has to be considered.
If theObject has only one argument shape, this flag is automatically
considered as True, not regarding really passed value.
return anObj
## Create a line, passing through the given point
- # and parrallel to the given direction
+ # and parallel to the given direction
# @param thePnt Point. The resulting line will pass through it.
# @param theDir Direction. The resulting line will be parallel to it.
# @param theName Object name; when specified, this parameter is used
def MakeLine(self, thePnt, theDir, theName=None):
"""
Create a line, passing through the given point
- and parrallel to the given direction
+ and parallel to the given direction
Parameters:
thePnt Point. The resulting line will pass through it.
# possible to generate groups along with the result by means of
# setting the flag \a IsGenerateGroups.<BR>
# If \a thePath is a closed edge or wire and \a IsGenerateGroups is
- # set, an error is occured. If \a thePath is not closed edge/wire,
+ # set, an error is occurred. If \a thePath is not closed edge/wire,
# the following groups are returned:
# - If \a theBase is unclosed edge or wire: "Down", "Up", "Side1",
# "Side2";
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created pipe if
- # \a IsGenerateGroups is not set. Otherwise it returns new
- # GEOM.ListOfGO. Its first element is the created pipe, the
+ # \a IsGenerateGroups is not set. Otherwise it returns a
+ # list of GEOM.GEOM_Object. Its first element is the created pipe, the
# remaining ones are created groups.
#
# @ref tui_creation_pipe "Example"
possible to generate groups along with the result by means of
setting the flag IsGenerateGroups.
If thePath is a closed edge or wire and IsGenerateGroups is
- set, an error is occured. If thePath is not closed edge/wire,
+ set, an error is occurred. If thePath is not closed edge/wire,
the following groups are returned:
- If theBase is unclosed edge or wire: "Down", "Up", "Side1",
"Side2";
Returns:
New GEOM.GEOM_Object, containing the created pipe if
- IsGenerateGroups is not set. Otherwise it returns new
- GEOM.ListOfGO. Its first element is the created pipe, the
+ IsGenerateGroups is not set. Otherwise it returns a
+ list of GEOM.GEOM_Object. Its first element is the created pipe, the
remaining ones are created groups.
"""
# Example: see GEOM_TestAll.py
## Create a shape by extrusion of the profile shape along
# the path shape. This function is used only for debug pipe
# functionality - it is a version of function MakePipeWithShellSections()
- # which give a possibility to recieve information about
+ # which give a possibility to receive information about
# creating pipe between each pair of sections step by step.
@ManageTransactions("PrimOp")
def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
the path shape. This function is used only for debug pipe
functionality - it is a version of previous function
geompy.MakePipeWithShellSections() which give a possibility to
- recieve information about creating pipe between each pair of
+ receive information about creating pipe between each pair of
sections step by step.
"""
res = []
## Explode a shape on sub-shapes of a given type.
# Sub-shapes will be sorted taking into account their gravity centers,
- # to provide stable order of sub-shapes.
+ # to provide stable order of sub-shapes. Please see
+ # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
# If the shape itself matches the type, it is also returned.
# @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
## Explode a shape on sub-shapes of a given type.
# Sub-shapes will be sorted taking into account their gravity centers,
- # to provide stable order of sub-shapes.
+ # to provide stable order of sub-shapes. Please see
+ # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
# @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
# @return List of IDs of sub-shapes.
## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
# selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
+ # Please see @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
# Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
# @param aShape Shape to get sub-shape of.
# @param ListOfInd List of sub-shapes indices.
## Extract shapes (excluding the main shape) of given type.
# @param aShape The shape.
# @param aType The shape type (see ShapeType())
- # @param isSorted Boolean flag to switch sorting on/off.
+ # @param isSorted Boolean flag to switch sorting on/off. Please see
+ # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
# @param theName Object 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.
# publication is switched on, default value is used for result name.
#
# @return [\a status, \a theClosedWires, \a theOpenWires]
- # \n \a status: FALSE, if an error(s) occured during the method execution.
+ # \n \a status: FALSE, if an error(s) occurred during the method execution.
# \n \a theClosedWires: Closed wires on the free boundary of the given shape.
# \n \a theOpenWires: Open wires on the free boundary of the given shape.
#
Returns:
[status, theClosedWires, theOpenWires]
- status: FALSE, if an error(s) occured during the method execution.
+ status: FALSE, if an error(s) occurred during the method execution.
theClosedWires: Closed wires on the free boundary of the given shape.
theOpenWires: Open wires on the free boundary of the given shape.
"""
# @param ListRemoveInside Shapes, inside which the results will be deleted.
# Each shape from theRemoveInside must belong to theShapes also.
# @param RemoveWebs If TRUE, perform Glue 3D algorithm.
- # @param ListMaterials Material indices for each shape. Make sence,
+ # @param ListMaterials Material indices for each shape. Make sense,
# only if theRemoveWebs is TRUE.
#
# @return New GEOM.GEOM_Object, containing the result shapes.
ListRemoveInside Shapes, inside which the results will be deleted.
Each shape from theRemoveInside must belong to theShapes also.
RemoveWebs If TRUE, perform Glue 3D algorithm.
- ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
+ ListMaterials Material indices for each shape. Make sense, only if theRemoveWebs is TRUE.
Returns:
New GEOM.GEOM_Object, containing the result shapes.
"""
theOffset, Parameters = ParseParameters(theOffset)
if theCopy:
- anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
+ anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset, True)
else:
- anObj = self.TrsfOp.OffsetShape(theObject, theOffset)
+ anObj = self.TrsfOp.OffsetShape(theObject, theOffset, True)
RaiseIfFailed("Offset", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
- ## Create new object as offset of the given one.
+ ## Create new object as offset of the given one. Gap between two adjacent
+ # offset surfaces is filled by a pipe.
# @param theObject The base object for the offset.
# @param theOffset Offset value.
# @param theName Object name; when specified, this parameter is used
#
# @return New GEOM.GEOM_Object, containing the offset object.
#
+ # @sa MakeOffsetIntersectionJoin
# @ref tui_offset "Example"
@ManageTransactions("TrsfOp")
def MakeOffset(self, theObject, theOffset, theName=None):
"""
- Create new object as offset of the given one.
+ Create new object as offset of the given one. Gap between adjacent
+ offset surfaces is filled by a pipe.
Parameters:
theObject The base object for the offset.
"""
# Example: see GEOM_TestAll.py
theOffset, Parameters = ParseParameters(theOffset)
- anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
+ anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, True )
+ RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "offset")
+ return anObj
+
+ ## Create new object as offset of the given one. Gap between adjacent
+ # offset surfaces is filled by extending and intersecting them.
+ # @param theObject The base object for the offset.
+ # @param theOffset Offset value.
+ # @param theName Object 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.
+ #
+ # @return New GEOM.GEOM_Object, containing the offset object.
+ #
+ # @sa MakeOffset
+ # @ref tui_offset "Example"
+ @ManageTransactions("TrsfOp")
+ def MakeOffsetIntersectionJoin(self, theObject, theOffset, theName=None):
+ """
+ Create new object as offset of the given one. Gap between adjacent
+ offset surfaces is filled by extending and intersecting them.
+
+ Parameters:
+ theObject The base object for the offset.
+ theOffset Offset value.
+ theName Object 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 offset object.
+
+ Example of usage:
+ box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
+ # create a new box extended by 70
+ offset = geompy.MakeOffsetIntersectionJoin(box, 70.)
+ """
+ # Example: see GEOM_TestAll.py
+ theOffset, Parameters = ParseParameters( theOffset )
+ anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, False )
RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "offset")
self._autoPublish(anObj, theName, "chamfer")
return anObj
- ## The Same that MakeChamferFaces() but with params theD is chamfer lenght and
+ ## The Same that MakeChamferFaces() but with params theD is chamfer length and
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
#
# @ref swig_FilletChamfer "Example"
@ManageTransactions("LocalOp")
def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces, theName=None):
"""
- The Same that geompy.MakeChamferFaces but with params theD is chamfer lenght and
+ The Same that geompy.MakeChamferFaces but with params theD is chamfer length and
theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
"""
flag = False
self._autoPublish(anObj, theName, "chamfer")
return anObj
- ## The Same that MakeChamferEdges() but with params theD is chamfer lenght and
+ ## The Same that MakeChamferEdges() but with params theD is chamfer length and
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
@ManageTransactions("LocalOp")
def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges, theName=None):
"""
- The Same that geompy.MakeChamferEdges but with params theD is chamfer lenght and
+ The Same that geompy.MakeChamferEdges but with params theD is chamfer length and
theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
"""
flag = False
## Get summarized length of all wires,
# area of surface and volume of the given shape.
# @param theShape Shape to define properties of.
+ # @param theTolerance maximal relative error of area
+ # and volume computation.
# @return [theLength, theSurfArea, theVolume]\n
# theLength: Summarized length of all wires of the given shape.\n
# theSurfArea: Area of surface of the given shape.\n
#
# @ref tui_basic_properties_page "Example"
@ManageTransactions("MeasuOp")
- def BasicProperties(self,theShape):
+ def BasicProperties(self,theShape, theTolerance=1.e-6):
"""
Get summarized length of all wires,
area of surface and volume of the given shape.
Parameters:
theShape Shape to define properties of.
+ theTolerance maximal relative error of area
+ and volume computation.
Returns:
[theLength, theSurfArea, theVolume]
theVolume: Volume of the given shape.
"""
# Example: see GEOM_TestMeasures.py
- aTuple = self.MeasuOp.GetBasicProperties(theShape)
+ aTuple = self.MeasuOp.GetBasicProperties(theShape, theTolerance)
RaiseIfFailed("GetBasicProperties", self.MeasuOp)
return aTuple
RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
return IsValid
+ ## Check boolean and partition operations agruments.
+ # @param theShape the agrument of an operation to be checked
+ # @return TRUE if the agrument is valid for a boolean or partition
+ # operation; FALSE otherwise.
+ @ManageTransactions("MeasuOp")
+ def CheckBOPArguments(self, theShape):
+ """
+ Check boolean and partition operations agruments.
+
+ Parameters:
+ theShape the agrument of an operation to be checked
+
+ Returns:
+ TRUE if the agrument is valid for a boolean or partition
+ operation; FALSE otherwise.
+ """
+ return self.MeasuOp.CheckBOPArguments(theShape)
+
## Detect intersections of the given shapes with algorithm based on mesh intersections.
# @param theShape1 First source object
# @param theShape2 Second source object
return self.ImportFile(theFileName, theFormatName, theName)
## Read a shape from the binary stream, containing its bounding representation (BRep).
- # @note This method will not be dumped to the python script by DumpStudy functionality.
- # @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's BRep stream.
+ #
+ # @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.
+ #
+ # @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's
+ # data stream.
+ #
# @param theStream The BRep binary stream.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
New GEOM_Object, containing the shape, read from theStream.
"""
# Example: see GEOM_TestOthers.py
+ if not theStream:
+ # this is the workaround to ignore invalid case when data stream is empty
+ if int(os.getenv("GEOM_IGNORE_RESTORE_SHAPE", "0")) > 0:
+ print "WARNING: Result of RestoreShape is a NULL shape!"
+ return None
anObj = self.InsertOp.RestoreShape(theStream)
RaiseIfFailed("RestoreShape", self.InsertOp)
self._autoPublish(anObj, theName, "restored")
## Build all possible propagation groups.
# Propagation group is a set of all edges, opposite to one (main)
# edge of this group directly or through other opposite edges.
- # Notion of Opposite Edge make sence only on quadrangle face.
+ # Notion of Opposite Edge make sense only on quadrangle face.
# @param theShape Shape to build propagation groups on.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
Build all possible propagation groups.
Propagation group is a set of all edges, opposite to one (main)
edge of this group directly or through other opposite edges.
- Notion of Opposite Edge make sence only on quadrangle face.
+ Notion of Opposite Edge make sense only on quadrangle face.
Parameters:
theShape Shape to build propagation groups on.
return aType
## Convert a type of geom object from id to string value
- # @param theId is a GEOM obect type id.
+ # @param theId is a GEOM object type id.
# @return type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
# @ref swig_GetType "Example"
def ShapeIdToType(self, theId):
Convert a type of geom object from id to string value
Parameters:
- theId is a GEOM obect type id.
+ theId is a GEOM object type id.
Returns:
type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
+ left_str + "length" + right_str + `max_length`)
- sg.updateObjBrowser(1)
+ sg.updateObjBrowser(True)
return group_edges