0020980: EDF 1226 GEOM: Detect the Resulting Type by default

This commit is contained in:
vsr 2010-10-07 07:32:20 +00:00
parent 1b2fda6acc
commit 6590c96b5c

View File

@ -84,7 +84,7 @@ import math
## Enumeration ShapeType as a dictionary ## Enumeration ShapeType as a dictionary
# @ingroup l1_geompy_auxiliary # @ingroup l1_geompy_auxiliary
ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
## Raise an Error, containing the Method_name, if Operation is Failed ## Raise an Error, containing the Method_name, if Operation is Failed
## @ingroup l1_geompy_auxiliary ## @ingroup l1_geompy_auxiliary
@ -2441,6 +2441,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# in order to avoid possible intersection between shapes from # in order to avoid possible intersection between shapes from
# this compound. # this compound.
# @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum). # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
# If this parameter is set to -1 ("Auto"), most appropriate shape limit
# type will be detected automatically.
# @param KeepNonlimitShapes: if this parameter == 0, then only shapes of # @param KeepNonlimitShapes: if this parameter == 0, then only shapes of
# target type (equal to Limit) are kept in the result, # target type (equal to Limit) are kept in the result,
# else standalone shapes of lower dimension # else standalone shapes of lower dimension
@ -2462,9 +2464,15 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# #
# @ref tui_partition "Example" # @ref tui_partition "Example"
def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
KeepNonlimitShapes=0): KeepNonlimitShapes=0):
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
if Limit == ShapeType["AUTO"]:
# automatic detection of the most appropriate shape limit type
lim = GEOM.SOLID
for s in ListShapes: lim = max( lim, s.GetMinShapeType() )
Limit = lim._v
pass
anObj = self.BoolOp.MakePartition(ListShapes, ListTools, anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials, Limit, RemoveWebs, ListMaterials,
@ -2487,8 +2495,14 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref swig_todo "Example" # @ref swig_todo "Example"
def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[], def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
ListKeepInside=[], ListRemoveInside=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["SHAPE"], RemoveWebs=0, Limit=ShapeType["AUTO"], RemoveWebs=0,
ListMaterials=[], KeepNonlimitShapes=0): ListMaterials=[], KeepNonlimitShapes=0):
if Limit == ShapeType["AUTO"]:
# automatic detection of the most appropriate shape limit type
lim = GEOM.SOLID
for s in ListShapes: lim = max( lim, s.GetMinShapeType() )
Limit = lim._v
pass
anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools, anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials, Limit, RemoveWebs, ListMaterials,
@ -2501,7 +2515,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_partition "Example 1" # @ref tui_partition "Example 1"
# \n @ref swig_Partition "Example 2" # \n @ref swig_Partition "Example 2"
def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
KeepNonlimitShapes=0): KeepNonlimitShapes=0):
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.MakePartition(ListShapes, ListTools, anObj = self.MakePartition(ListShapes, ListTools,