# @param theSeqSubBases - list of corresponding subshapes of section shapes.
# @param theLocations - list of locations on the path corresponding
# specified list of the Bases shapes. Number of locations
-# should be equal to number of bases or list of locations can be empty.
+# should be equal to number of bases. First and last
+# locations must be coincided with first and last vertexes
+# of path correspondingly.
# @param thePath - Path shape to extrude the base shape along it.
# @param theWithContact - the mode defining that the section is translated to be in
# contact with the spine.
print "MakePipeWithShellSections : ", PrimOp.GetErrorCode()
return anObj
+def MakePipeWithShellSectionsBySteps(theSeqBases, theSeqSubBases,
+ theLocations, thePath,
+ theWithContact, theWithCorrection):
+ res = []
+ nbsect = len(theSeqBases)
+ nbsubsect = len(theSeqSubBases)
+ #print "nbsect = ",nbsect
+ for i in range(1,nbsect):
+ #print " i = ",i
+ tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
+ tmpLocations = [ theLocations[i-1], theLocations[i] ]
+ tmpSeqSubBases = []
+ if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
+ anObj = PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
+ tmpLocations, thePath,
+ theWithContact, theWithCorrection)
+ if PrimOp.IsDone() == 0:
+ print "Problems with pipe creation between ",i," and ",i+1," sections"
+ print "MakePipeWithShellSections : ", PrimOp.GetErrorCode()
+ break
+ else:
+ print "Pipe between ",i," and ",i+1," sections is OK"
+ res.append(anObj)
+ pass
+ pass
+
+ resc = MakeCompound(res)
+ #resc = MakeSewing(res, 0.001)
+ #print "resc: ",resc
+ return resc
+
+
+## Create solids between given sections
+# @param theSeqBases - list of sections (shell or face).
+# @param theLocations - list of corresponding vertexes
+# @return New GEOM_Object, containing the created solids.
+#
+# Example: see GEOM_TestAll.py
+def MakePipeShellsWithoutPath(theSeqBases, theLocations):
+ anObj = PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
+ if PrimOp.IsDone() == 0:
+ print "MakePipeShellsWithoutPath : ", PrimOp.GetErrorCode()
+ return anObj
+
+
# -----------------------------------------------------------------------------
# Create base shapes
# -----------------------------------------------------------------------------
## Get sub-shape(s) of theShapeWhere, which are
# coincident with \a theShapeWhat or could be a part of it.
# @param theShapeWhere Shape to find sub-shapes of.
-# @param theShapeWhat Shape, specifying what to find.
+# @param theShapeWhat Shape, specifying what to find (must be in the
+# building history of the ShapeWhere).
# @return Group of all found sub-shapes or a single found sub-shape.
#
# Example: see GEOM_TestOthers.py
print "GetInPlace : ", ShapesOp.GetErrorCode()
return anObj
+## Get sub-shape(s) of \a theShapeWhere, which are
+# coincident with \a theShapeWhat or could be a part of it.
+#
+# Implementation of this method is based on a saved history of an operation,
+# produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
+# arguments (an argument shape or a sub-shape of an argument shape).
+# The operation could be the Partition or one of boolean operations,
+# performed on simple shapes (not on compounds).
+#
+# @param theShapeWhere Shape to find sub-shapes of.
+# @param theShapeWhat Shape, specifying what to find (must be in the
+# building history of the ShapeWhere).
+# @return Group of all found sub-shapes or a single found sub-shape.
+#
+# Example: see GEOM_TestOthers.py
+def GetInPlaceByHistory(theShapeWhere, theShapeWhat):
+ anObj = ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
+ if ShapesOp.IsDone() == 0:
+ print "GetInPlace : ", ShapesOp.GetErrorCode()
+ return anObj
+
## Get sub-shape of theShapeWhere, which is
# equal to \a theShapeWhat.
# @param theShapeWhere Shape to find sub-shape of.
-# @param theShapeWhat Shape, specifying what to find.
+# @param theShapeWhat Shape, specifying what to find
+# (must be usual shape).
# @return New GEOM_Object for found sub-shape.
#
def GetSame(theShapeWhere, theShapeWhat):
## Replace coincident faces in theShape by one face.
# @param theShape Initial shape.
# @param theTolerance Maximum distance between faces, which can be considered as coincident.
+# @param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
# @return New GEOM_Object, containing a copy of theShape without coincident faces.
#
# Example: see GEOM_Spanner.py
-def MakeGlueFaces(theShape, theTolerance):
- anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance)
+def MakeGlueFaces(theShape, theTolerance, doKeepNonSolids=True):
+ anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
if ShapesOp.IsDone() == 0:
print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
return anObj
+
+## Find coincident faces in theShape for possible gluing.
+# @param theShape Initial shape.
+# @param theTolerance Maximum distance between faces,
+# which can be considered as coincident.
+# @return ListOfGO.
+#
+# Example: see GEOM_Spanner.py
+def GetGlueFaces(theShape, theTolerance):
+ anObj = ShapesOp.GetGlueFaces(theShape, theTolerance)
+ if ShapesOp.IsDone() == 0:
+ print "GetGlueFaces : ", ShapesOp.GetErrorCode()
+ return anObj
+
+
+## Replace coincident faces in theShape by one face
+# in compliance with given list of faces
+# @param theShape Initial shape.
+# @param theTolerance Maximum distance between faces,
+# which can be considered as coincident.
+# @param theFaces List of faces for gluing.
+# @param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
+# @return New GEOM_Object, containing a copy of theShape
+# without some faces.
+#
+# Example: see GEOM_Spanner.py
+def MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids=True):
+ anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
+ if ShapesOp.IsDone() == 0:
+ print "MakeGlueFacesByList : ", ShapesOp.GetErrorCode()
+ return anObj
+
+
# -----------------------------------------------------------------------------
# Boolean (Common, Cut, Fuse, Section)
# -----------------------------------------------------------------------------
# in order to avoid possible intersection between shapes from
# this compound.
# @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
+# @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
+# type <= Limit are kept in the result,
+# else - shapes with type > Limit are kept
+# also (if they exist)
#
# After implementation new version of PartitionAlgo (October 2006)
# other parameters are ignored by current functionality. They are kept
#
# Example: see GEOM_TestAll.py
def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
- Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+ Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
+ KeepNonlimitShapes=0):
anObj = BoolOp.MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
- Limit, RemoveWebs, ListMaterials);
+ Limit, RemoveWebs, ListMaterials,
+ KeepNonlimitShapes);
if BoolOp.IsDone() == 0:
print "MakePartition : ", BoolOp.GetErrorCode()
return anObj
#
# @return New GEOM_Object, containing the result shapes.
#
-def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
- Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[],
+ ListKeepInside=[], ListRemoveInside=[],
+ Limit=ShapeType["SHAPE"], RemoveWebs=0,
+ ListMaterials=[], KeepNonlimitShapes=0):
anObj = BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
- Limit, RemoveWebs, ListMaterials);
+ Limit, RemoveWebs, ListMaterials,
+ KeepNonlimitShapes);
if BoolOp.IsDone() == 0:
print "MakePartitionNonSelfIntersectedShape : ", BoolOp.GetErrorCode()
return anObj
#
# Example: see GEOM_TestOthers.py
def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
- Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+ Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
+ KeepNonlimitShapes=0):
anObj = MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
- Limit, RemoveWebs, ListMaterials);
+ Limit, RemoveWebs, ListMaterials,
+ KeepNonlimitShapes);
return anObj
## Perform partition of the Shape with the Plane