From 6590c96b5cd22ce09e92740061b36718ee55d37d Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 7 Oct 2010 07:32:20 +0000 Subject: [PATCH] 0020980: EDF 1226 GEOM: Detect the Resulting Type by default --- src/GEOM_SWIG/geompyDC.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 954896f5e..a3dc47c0e 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -84,7 +84,7 @@ import math ## Enumeration ShapeType as a dictionary # @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 ## @ingroup l1_geompy_auxiliary @@ -2441,6 +2441,8 @@ class geompyDC(GEOM._objref_GEOM_Gen): # in order to avoid possible intersection between shapes from # this compound. # @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 # target type (equal to Limit) are kept in the result, # else standalone shapes of lower dimension @@ -2462,9 +2464,15 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref tui_partition "Example" def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], + Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[], KeepNonlimitShapes=0): # 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, ListKeepInside, ListRemoveInside, Limit, RemoveWebs, ListMaterials, @@ -2487,8 +2495,14 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref swig_todo "Example" def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, + Limit=ShapeType["AUTO"], RemoveWebs=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, ListKeepInside, ListRemoveInside, Limit, RemoveWebs, ListMaterials, @@ -2501,7 +2515,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_partition "Example 1" # \n @ref swig_Partition "Example 2" def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], - Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[], + Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[], KeepNonlimitShapes=0): # Example: see GEOM_TestOthers.py anObj = self.MakePartition(ListShapes, ListTools, -- 2.39.2