## Raise an Error, containing the Method_name, if Operation is Failed
## @ingroup l1_geomBuilder_auxiliary
def RaiseIfFailed (Method_name, Operation):
- if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
+ if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
## Return list of variables value from salome notebook
# - EDGE: [nb_vertices]
#
# - VERTEX: [x y z]
+ #
+ # - LCS: [x y z xx xy xz yx yy yz zx zy zz]
# @ingroup l1_geomBuilder_auxiliary
kind = GEOM.GEOM_IKindOfShape
## Create a point, corresponding to the given parameter on the given curve.
# @param theRefCurve The referenced curve.
# @param theParameter Value of parameter on the referenced curve.
+ # @param takeOrientationIntoAccount flag that tells if it is necessary
+ # to take the curve's orientation into account for the
+ # operation. I.e. if this flag is set, the results for the same
+ # parameters (except the value 0.5) is different for forward
+ # and reversed curves. If it is not set the result is the same.
# @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.
#
# @ref tui_creation_point "Example"
@ManageTransactions("BasicOp")
- def MakeVertexOnCurve(self, theRefCurve, theParameter, theName=None):
+ def MakeVertexOnCurve(self, theRefCurve, theParameter,
+ takeOrientationIntoAccount=False, theName=None):
"""
Create a point, corresponding to the given parameter on the given curve.
Parameters:
theRefCurve The referenced curve.
theParameter Value of parameter on the referenced curve.
+ takeOrientationIntoAccount flag that tells if it is necessary
+ to take the curve's orientation into account for the
+ operation. I.e. if this flag is set, the results for
+ the same parameters (except the value 0.5) is different
+ for forward and reversed curves. If it is not set
+ the result is the same.
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.
p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
"""
# Example: see GEOM_TestAll.py
- theParameter, Parameters = ParseParameters(theParameter)
- anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
+ theParameter, takeOrientationIntoAccount, Parameters = ParseParameters(
+ theParameter, takeOrientationIntoAccount)
+ anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter,
+ takeOrientationIntoAccount)
RaiseIfFailed("MakePointOnCurve", self.BasicOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "vertex")
anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
else:
anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
- RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
+ RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "curve")
return anObj
theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
if flag:
theA = theA*math.pi/180.
- anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
- RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
- anObj.SetParameters(Parameters)
- self._autoPublish(anObj, theName, "cylinder")
+ if theA<=0. or theA>=2*math.pi:
+ raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
+ anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
+ RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "cylinder")
return anObj
## Create a cylinder with given radius and height at
theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
if flag:
theA = theA*math.pi/180.
+ if theA<=0. or theA>=2*math.pi:
+ raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along
- # the path shape. The path shape can be a wire or an edge.
+ # the path shape. The path shape can be a wire or an edge. It is
+ # 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,
+ # the following groups are returned:
+ # - If \a theBase is unclosed edge or wire: "Down", "Up", "Side1",
+ # "Side2";
+ # - If \a theBase is closed edge or wire, face or shell: "Down", "Up",
+ # "Other".
+ # .
+ # "Down" and "Up" groups contain:
+ # - Edges if \a theBase is edge or wire;
+ # - Faces if \a theBase is face or shell.<BR>
+ # .
+ # "Side1" and "Side2" groups contain edges generated from the first
+ # and last vertices of \a theBase. The first and last vertices are
+ # determined taking into account edge/wire orientation.<BR>
+ # "Other" group represents faces generated from the bounding edges of
+ # \a theBase.
+ #
# @param theBase Base shape to be extruded.
# @param thePath Path shape to extrude the base shape along it.
+ # @param IsGenerateGroups flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @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 created pipe.
+ # @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
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe "Example"
@ManageTransactions("PrimOp")
- def MakePipe(self, theBase, thePath, theName=None):
+ def MakePipe(self, theBase, thePath,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the base shape along
- the path shape. The path shape can be a wire or an edge.
+ the path shape. The path shape can be a wire or an edge. It is
+ 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,
+ the following groups are returned:
+ - If theBase is unclosed edge or wire: "Down", "Up", "Side1",
+ "Side2";
+ - If theBase is closed edge or wire, face or shell: "Down", "Up",
+ "Other".
+ "Down" and "Up" groups contain:
+ - Edges if theBase is edge or wire;
+ - Faces if theBase is face or shell.
+ "Side1" and "Side2" groups contain edges generated from the first
+ and last vertices of theBase. The first and last vertices are
+ determined taking into account edge/wire orientation.
+ "Other" group represents faces generated from the bounding edges of
+ theBase.
Parameters:
theBase Base shape to be extruded.
thePath Path shape to extrude the base shape along it.
+ IsGenerateGroups flag that tells if it is necessary to
+ create groups. It is equal to False by default.
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 created pipe.
+ 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
+ remaining ones are created groups.
"""
# Example: see GEOM_TestAll.py
- anObj = self.PrimOp.MakePipe(theBase, thePath)
+ aList = self.PrimOp.MakePipe(theBase, thePath, IsGenerateGroups)
RaiseIfFailed("MakePipe", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Create a shape by extrusion of the profile shape along
# the path shape. The path shape can be a wire or an edge.
# the several profiles can be specified in the several locations of path.
+ # It is possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups. For detailed information on
+ # groups that can be created please see the method MakePipe().
# @param theSeqBases - list of Bases shape to be extruded.
# @param theLocations - list of locations on the path corresponding
# specified list of the Bases shapes. Number of locations
# contact with the spine.
# @param theWithCorrection - defining that the section is rotated to be
# orthogonal to the spine tangent in the correspondent point
+ # @param IsGenerateGroups - flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @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 created pipe.
+ # @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
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe_with_diff_sec "Example"
@ManageTransactions("PrimOp")
def MakePipeWithDifferentSections(self, theSeqBases,
theLocations, thePath,
- theWithContact, theWithCorrection, theName=None):
+ theWithContact, theWithCorrection,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the profile shape along
the path shape. The path shape can be a wire or an edge.
the several profiles can be specified in the several locations of path.
+ It is possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups. For detailed information on
+ groups that can be created please see the method geompy.MakePipe().
Parameters:
theSeqBases - list of Bases shape to be extruded.
contact with the spine(0/1)
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point (0/1)
+ IsGenerateGroups - flag that tells if it is necessary to
+ create groups. It is equal to False by default.
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 created pipe.
+ 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
+ remaining ones are created groups.
"""
- anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
+ aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
theLocations, thePath,
- theWithContact, theWithCorrection)
+ theWithContact, theWithCorrection,
+ False, IsGenerateGroups)
RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
+
+ ## Create a shape by extrusion of the profile shape along
+ # the path shape. This function is a version of
+ # MakePipeWithDifferentSections() with the same parameters, except
+ # eliminated theWithContact and theWithCorrection. So it is
+ # possible to find the description of all parameters is in this
+ # method. The difference is that this method performs the operation
+ # step by step, i.e. it creates pipes between each pair of neighbor
+ # sections and fuses them into a single shape.
+ #
+ # @ref tui_creation_pipe_with_diff_sec "Example"
+ @ManageTransactions("PrimOp")
+ def MakePipeWithDifferentSectionsBySteps(self, theSeqBases,
+ theLocations, thePath,
+ IsGenerateGroups=False, theName=None):
+ """
+ Create a shape by extrusion of the profile shape along
+ the path shape. This function is a version of
+ MakePipeWithDifferentSections() with the same parameters, except
+ eliminated theWithContact and theWithCorrection. So it is
+ possible to find the description of all parameters is in this
+ method. The difference is that this method performs the operation
+ step by step, i.e. it creates pipes between each pair of neighbor
+ sections and fuses them into a single shape.
+ """
+ aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
+ theLocations, thePath,
+ False, False,
+ True, IsGenerateGroups)
+ RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp)
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Create a shape by extrusion of the profile shape along
- # the path shape. The path shape can be a wire or a edge.
+ # the path shape. The path shape can be a wire or an edge.
# the several profiles can be specified in the several locations of path.
+ # It is possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups. For detailed information on
+ # groups that can be created please see the method MakePipe().
# @param theSeqBases - list of Bases shape to be extruded. Base shape must be
# shell or face. If number of faces in neighbour sections
# aren't coincided result solid between such sections will
# contact with the spine.
# @param theWithCorrection - defining that the section is rotated to be
# orthogonal to the spine tangent in the correspondent point
+ # @param IsGenerateGroups - flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @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 created solids.
+ # @return New GEOM.GEOM_Object, containing the created solids if
+ # \a IsGenerateGroups is not set. Otherwise it returns new
+ # GEOM.ListOfGO. Its first element is the created solids, the
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe_with_shell_sec "Example"
@ManageTransactions("PrimOp")
def MakePipeWithShellSections(self, theSeqBases, theSeqSubBases,
theLocations, thePath,
- theWithContact, theWithCorrection, theName=None):
+ theWithContact, theWithCorrection,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the profile shape along
- the path shape. The path shape can be a wire or a edge.
+ the path shape. The path shape can be a wire or an edge.
the several profiles can be specified in the several locations of path.
+ It is possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups. For detailed information on
+ groups that can be created please see the method geompy.MakePipe().
Parameters:
theSeqBases - list of Bases shape to be extruded. Base shape must be
contact with the spine (0/1)
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point (0/1)
+ IsGenerateGroups - flag that tells if it is necessary to
+ create groups. It is equal to False by default.
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 created solids.
+ New GEOM.GEOM_Object, containing the created solids if
+ IsGenerateGroups is not set. Otherwise it returns new
+ GEOM.ListOfGO. Its first element is the created solids, the
+ remaining ones are created groups.
"""
- anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
+ aList = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
theLocations, thePath,
- theWithContact, theWithCorrection)
+ theWithContact, theWithCorrection,
+ IsGenerateGroups)
RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Create a shape by extrusion of the profile shape along
# the path shape. This function is used only for debug pipe
@ManageTransactions("PrimOp")
def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
theLocations, thePath,
- theWithContact, theWithCorrection, theName=None):
+ theWithContact, theWithCorrection,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the profile shape along
the path shape. This function is used only for debug pipe
tmpLocations = [ theLocations[i-1], theLocations[i] ]
tmpSeqSubBases = []
if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
- anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
+ aList = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
tmpLocations, thePath,
- theWithContact, theWithCorrection)
+ theWithContact, theWithCorrection,
+ IsGenerateGroups)
if self.PrimOp.IsDone() == 0:
print "Problems with pipe creation between ",i," and ",i+1," sections"
RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
break
else:
print "Pipe between ",i," and ",i+1," sections is OK"
- res.append(anObj)
+ res.append(aList[0])
pass
pass
self._autoPublish(resc, theName, "pipe")
return resc
- ## Create solids between given sections
+ ## Create solids between given sections.
+ # It is possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups. For detailed information on
+ # groups that can be created please see the method MakePipe().
# @param theSeqBases - list of sections (shell or face).
# @param theLocations - list of corresponding vertexes
+ # @param IsGenerateGroups - flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @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 created solids.
+ # @return New GEOM.GEOM_Object, containing the created solids if
+ # \a IsGenerateGroups is not set. Otherwise it returns new
+ # GEOM.ListOfGO. Its first element is the created solids, the
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe_without_path "Example"
@ManageTransactions("PrimOp")
- def MakePipeShellsWithoutPath(self, theSeqBases, theLocations, theName=None):
+ def MakePipeShellsWithoutPath(self, theSeqBases, theLocations,
+ IsGenerateGroups=False, theName=None):
"""
- Create solids between given sections
+ Create solids between given sections.
+ It is possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups. For detailed information on
+ groups that can be created please see the method geompy.MakePipe().
Parameters:
theSeqBases - list of sections (shell or face).
theLocations - list of corresponding vertexes
+ IsGenerateGroups - flag that tells if it is necessary to
+ create groups. It is equal to False by default.
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 created solids.
+ New GEOM.GEOM_Object, containing the created solids if
+ IsGenerateGroups is not set. Otherwise it returns new
+ GEOM.ListOfGO. Its first element is the created solids, the
+ remaining ones are created groups.
"""
- anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
+ aList = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations,
+ IsGenerateGroups)
RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Create a shape by extrusion of the base shape along
# the path shape with constant bi-normal direction along the given vector.
# The path shape can be a wire or an edge.
+ # It is possible to generate groups along with the result by means of
+ # setting the flag \a IsGenerateGroups. For detailed information on
+ # groups that can be created please see the method MakePipe().
# @param theBase Base shape to be extruded.
# @param thePath Path shape to extrude the base shape along it.
# @param theVec Vector defines a constant binormal direction to keep the
# same angle beetween the direction and the sections
# along the sweep surface.
+ # @param IsGenerateGroups flag that tells if it is necessary to
+ # create groups. It is equal to False by default.
# @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 created pipe.
+ # @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
+ # remaining ones are created groups.
#
# @ref tui_creation_pipe "Example"
@ManageTransactions("PrimOp")
- def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec, theName=None):
+ def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec,
+ IsGenerateGroups=False, theName=None):
"""
Create a shape by extrusion of the base shape along
the path shape with constant bi-normal direction along the given vector.
The path shape can be a wire or an edge.
+ It is possible to generate groups along with the result by means of
+ setting the flag IsGenerateGroups. For detailed information on
+ groups that can be created please see the method geompy.MakePipe().
Parameters:
theBase Base shape to be extruded.
theVec Vector defines a constant binormal direction to keep the
same angle beetween the direction and the sections
along the sweep surface.
+ IsGenerateGroups flag that tells if it is necessary to
+ create groups. It is equal to False by default.
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 created pipe.
+ 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
+ remaining ones are created groups.
"""
# Example: see GEOM_TestAll.py
- anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
+ aList = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath,
+ theVec, IsGenerateGroups)
RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
- self._autoPublish(anObj, theName, "pipe")
- return anObj
+
+ if IsGenerateGroups:
+ self._autoPublish(aList, theName, "pipe")
+ return aList
+
+ self._autoPublish(aList[0], theName, "pipe")
+ return aList[0]
## Makes a thick solid from a shape. If the input is a surface shape
# (face or shell) the result is a thick solid. If an input shape is
# @param theFacesIDs the list of face IDs to be removed from the
# result. It is ignored if \a theShape is a face or a shell.
# It is empty by default.
+ # @param theInside If true the thickness is applied towards inside
# @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.
# @ref tui_creation_thickness "Example"
@ManageTransactions("PrimOp")
def MakeThickSolid(self, theShape, theThickness,
- theFacesIDs=[], theName=None):
+ theFacesIDs=[], theInside=False, theName=None):
"""
Make a thick solid from a shape. If the input is a surface shape
(face or shell) the result is a thick solid. If an input shape is
theFacesIDs the list of face IDs to be removed from the
result. It is ignored if theShape is a face or a
shell. It is empty by default.
+ theInside If true the thickness is applied towards inside
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.
New GEOM.GEOM_Object, containing the created solid
"""
# Example: see GEOM_TestAll.py
+ theThickness,Parameters = ParseParameters(theThickness)
anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
- theThickness, True)
+ theThickness, True, theInside)
RaiseIfFailed("MakeThickSolid", self.PrimOp)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "thickSolid")
return anObj
# @param theFacesIDs the list of face IDs to be removed from the
# result. It is ignored if \a theShape is a face or a shell.
# It is empty by default.
+ # @param theInside If true the thickness is applied towards inside
#
# @return The modified shape
#
# @ref tui_creation_thickness "Example"
@ManageTransactions("PrimOp")
- def Thicken(self, theShape, theThickness, theFacesIDs=[]):
+ def Thicken(self, theShape, theThickness, theFacesIDs=[], theInside=False):
"""
Modifies a shape to make it a thick solid. If the input is a
surface shape (face or shell) the result is a thick solid. If
theFacesIDs the list of face IDs to be removed from the
result. It is ignored if \a theShape is a face or
a shell. It is empty by default.
+ theInside If true the thickness is applied towards inside
Returns:
The modified shape
"""
# Example: see GEOM_TestAll.py
+ theThickness,Parameters = ParseParameters(theThickness)
anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
- theThickness, False)
+ theThickness, False, theInside)
RaiseIfFailed("Thicken", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Build a middle path of a pipe-like shape.
# end of l3_complex
## @}
- ## @addtogroup l3_advanced
+ ## @addtogroup l3_basic_go
## @{
## Create a linear edge with specified ends.
# 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 created face.
+ # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
#
# @ref tui_creation_face "Example"
@ManageTransactions("ShapesOp")
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created face.
+ New GEOM.GEOM_Object, containing the created face (compound of faces).
"""
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
# 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 created face.
+ # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
#
# @ref tui_creation_face "Example"
@ManageTransactions("ShapesOp")
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created face.
+ New GEOM.GEOM_Object, containing the created face (compound of faces).
"""
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
# 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 created shell.
+ # @return New GEOM.GEOM_Object, containing the created shell (compound of shells).
#
# @ref tui_creation_shell "Example"
@ManageTransactions("ShapesOp")
publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created shell.
+ New GEOM.GEOM_Object, containing the created shell (compound of shells).
"""
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells ))
self._autoPublish(anObj, theName, "solid")
return anObj
- # end of l3_advanced
+ # end of l3_basic_go
## @}
## @addtogroup l2_measure
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return Group of all found sub-shapes or a single found sub-shape.
+ # @return Compound which includes all found sub-shapes if they have different types;
+ # or group of all found shapes of the equal type; or a single found sub-shape.
#
# @note This function has a restriction on argument shapes.
# If \a theShapeWhere has curved parts with significantly
publication is switched on, default value is used for result name.
Returns:
- Group of all found sub-shapes or a single found sub-shape.
+ Compound which includes all found sub-shapes if they have different types;
+ or group of all found shapes of the equal type; or a single found sub-shape.
Note:
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
- # @return Group of all found sub-shapes or a single found sub-shape.
+ # @return Compound which includes all found sub-shapes if they have different types;
+ # or group of all found shapes of the equal type; or a single found sub-shape.
#
# @ref swig_GetInPlace "Example"
@ManageTransactions("ShapesOp")
publication is switched on, default value is used for result name.
Returns:
- Group of all found sub-shapes or a single found sub-shape.
+ Compound which includes all found sub-shapes if they have different types;
+ or group of all found shapes of the equal type; or a single found sub-shape.
"""
# Example: see GEOM_TestOthers.py
anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
Returns:
New GEOM.GEOM_Object, containing the created edge.
"""
+ theMin, theMax, Parameters = ParseParameters(theMin, theMax)
anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax)
RaiseIfFailed("ExtendEdge", self.ShapesOp)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "edge")
return anObj
Returns:
New GEOM.GEOM_Object, containing the created face.
"""
+ theUMin, theUMax, theVMin, theVMax, Parameters = ParseParameters(theUMin, theUMax, theVMin, theVMax)
anObj = self.ShapesOp.ExtendFace(theFace, theUMin, theUMax,
theVMin, theVMax)
RaiseIfFailed("ExtendFace", self.ShapesOp)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "face")
return anObj
self._autoPublish(ListObj, theName, "SortedEdges")
return ListObj
+ ##
+ # Return the list of subshapes that satisfies a certain tolerance
+ # criterion. The user defines the type of shapes to be returned, the
+ # condition and the tolerance value. The operation is defined for
+ # faces, edges and vertices only. E.g. for theShapeType FACE,
+ # theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
+ # all faces of theShape that have tolerances greater then 1.e7.
+ #
+ # @param theShape the shape to be exploded
+ # @param theShapeType the type of sub-shapes to be returned (see
+ # ShapeType()). Can have the values FACE, EDGE and VERTEX only.
+ # @param theCondition the condition type (see GEOM::comparison_condition).
+ # @param theTolerance the tolerance filter.
+ # @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 the list of shapes that satisfy the conditions.
+ #
+ # @ref swig_GetSubShapesWithTolerance "Example"
+ @ManageTransactions("ShapesOp")
+ def GetSubShapesWithTolerance(self, theShape, theShapeType,
+ theCondition, theTolerance, theName=None):
+ """
+ Return the list of subshapes that satisfies a certain tolerance
+ criterion. The user defines the type of shapes to be returned, the
+ condition and the tolerance value. The operation is defined for
+ faces, edges and vertices only. E.g. for theShapeType FACE,
+ theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
+ all faces of theShape that have tolerances greater then 1.e7.
+
+ Parameters:
+ theShape the shape to be exploded
+ theShapeType the type of sub-shapes to be returned (see
+ ShapeType()). Can have the values FACE,
+ EDGE and VERTEX only.
+ theCondition the condition type (see GEOM::comparison_condition).
+ theTolerance the tolerance filter.
+ 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:
+ The list of shapes that satisfy the conditions.
+ """
+ # Example: see GEOM_TestAll.py
+ ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
+ theCondition, theTolerance)
+ RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
+ return ListObj
+
## Check if the object is a sub-object of another GEOM object.
# @param aSubObject Checked sub-object (or its parent object, in case if
# \a theSubObjectIndex is non-zero).
Returns:
New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
"""
- anObj = self.ShapesOp.MakeGlueFacesByList(ToList(theShapes), theTolerance, theFaces,
+ anObj = self.ShapesOp.MakeGlueFacesByList(ToList(theShapes), theTolerance, ToList(theFaces),
doKeepNonSolids, doGlueAllEdges)
if anObj is None:
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
self._autoPublish(anObj, theName, "projection")
return anObj
- ## Create a projection projection of the given point on a wire or an edge.
+ ## Create a projection of the given point on a wire or an edge.
# If there are no solutions or there are 2 or more solutions It throws an
# exception.
# @param thePoint the point to be projected.
@ManageTransactions("TrsfOp")
def MakeProjectionOnWire(self, thePoint, theWire, theName=None):
"""
- Create a projection projection of the given point on a wire or an edge.
+ Create a projection of the given point on a wire or an edge.
If there are no solutions or there are 2 or more solutions It throws an
exception.
# The angle in which to project the total length of the wire.
# If it is negative the projection is not scaled and natural
# wire length is kept for the projection.
+ # @param theAngleRotation The desired angle in radians between
+ # the tangent vector to the first curve at the first point of
+ # the theObject's projection in 2D space and U-direction of
+ # cylinder's 2D space.
# @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.
# @ref tui_projection "Example"
def MakeProjectionOnCylinder (self, theObject, theRadius,
theStartAngle=0.0, theAngleLength=-1.0,
+ theAngleRotation=0.0,
theName=None):
"""
Compute a wire or a face that represents a projection of the source
to project the total length of the wire. If it is negative the
projection is not scaled and natural wire length is kept for
the projection.
+ theAngleRotation The desired angle in radians between
+ the tangent vector to the first curve at the first
+ point of the theObject's projection in 2D space and
+ U-direction of cylinder's 2D space.
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.
the source shape onto a cylinder.
"""
# Example: see GEOM_TestAll.py
- theRadius, theStartAngle, theAngleLength, Parameters = ParseParameters(
- theRadius, theStartAngle, theAngleLength)
+ flagStartAngle = False
+ if isinstance(theStartAngle,str):
+ flagStartAngle = True
+ flagAngleLength = False
+ if isinstance(theAngleLength,str):
+ flagAngleLength = True
+ flagAngleRotation = False
+ if isinstance(theAngleRotation,str):
+ flagAngleRotation = True
+ theRadius, theStartAngle, theAngleLength, theAngleRotation, Parameters = ParseParameters(
+ theRadius, theStartAngle, theAngleLength, theAngleRotation)
+ if flagStartAngle:
+ theStartAngle = theStartAngle*math.pi/180.
+ if flagAngleLength:
+ theAngleLength = theAngleLength*math.pi/180.
+ if flagAngleRotation:
+ theAngleRotation = theAngleRotation*math.pi/180.
anObj = self.TrsfOp.MakeProjectionOnCylinder(theObject, theRadius,
- theStartAngle, theAngleLength)
+ theStartAngle, theAngleLength, theAngleRotation)
RaiseIfFailed("MakeProjectionOnCylinder", self.TrsfOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "projection")
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
+ # @param theInvert If true material changes the direction
# @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.
#
# @ref tui_creation_prism "Example"
@ManageTransactions("PrimOp")
- def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theName=None):
+ def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
"""
Add material to a solid by extrusion of the base shape on the given distance.
theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees.
+ theInvert If true material changes the direction.
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.
New GEOM.GEOM_Object, containing the initial shape with removed material.
"""
# Example: see GEOM_TestAll.py
- #theH,Parameters = ParseParameters(theH)
- anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False)
+ theH,theAngle,Parameters = ParseParameters(theH,theAngle)
+ anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False, theInvert)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
- #anObj.SetParameters(Parameters)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "extrudedCut")
return anObj
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
+ # @param theInvert If true material changes the direction
# @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.
#
# @ref tui_creation_prism "Example"
@ManageTransactions("PrimOp")
- def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theName=None):
+ def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
"""
Add material to a solid by extrusion of the base shape on the given distance.
theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees.
+ theInvert If true material changes the direction.
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.
New GEOM.GEOM_Object, containing the initial shape with added material.
"""
# Example: see GEOM_TestAll.py
- #theH,Parameters = ParseParameters(theH)
- anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True)
+ theH,theAngle,Parameters = ParseParameters(theH,theAngle)
+ anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True, theInvert)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
- #anObj.SetParameters(Parameters)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "extrudedBoss")
return anObj
return aDict
def GetCreationInformation(self, theShape):
- info = theShape.GetCreationInformation()
- # operationName
- opName = info.operationName
- if not opName: opName = "no info available"
- res = "Operation: " + opName
- # parameters
- for parVal in info.params:
- res += " \n %s = %s" % ( parVal.name, parVal.value )
+ res = ''
+ infos = theShape.GetCreationInformation()
+ for info in infos:
+ # operationName
+ opName = info.operationName
+ if not opName: opName = "no info available"
+ if res: res += "\n"
+ res += "Operation: " + opName
+ # parameters
+ for parVal in info.params:
+ res += "\n \t%s = %s" % ( parVal.name, parVal.value )
return res
## Get a point, situated at the centre of mass of theShape.
RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
return IsValid
+ ## Detect self-intersections of the given shape with algorithm based on mesh intersections.
+ # @param theShape Shape to check.
+ # @param theDeflection Linear deflection coefficient that specifies quality of tesselation:
+ # - if \a theDeflection <= 0, default deflection 0.001 is used
+ # @param theTolerance Specifies a distance between sub-shapes used for detecting gaps:
+ # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
+ # - if \a theTolerance > 0, algorithm detects gaps
+ # @return TRUE, if the shape contains no self-intersections.
+ #
+ # @ref tui_check_self_intersections_fast_page "Example"
+ @ManageTransactions("MeasuOp")
+ def CheckSelfIntersectionsFast(self, theShape, theDeflection = 0.001, theTolerance = 0.0):
+ """
+ Detect self-intersections of the given shape with algorithm based on mesh intersections.
+
+ Parameters:
+ theShape Shape to check.
+ theDeflection Linear deflection coefficient that specifies quality of tesselation:
+ - if theDeflection <= 0, default deflection 0.001 is used
+ theTolerance Specifies a distance between shapes used for detecting gaps:
+ - if theTolerance <= 0, algorithm detects intersections (default behavior)
+ - if theTolerance > 0, algorithm detects gaps
+
+ Returns:
+ TRUE, if the shape contains no self-intersections.
+ """
+ # Example: see GEOM_TestMeasures.py
+ (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance)
+ RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
+ return IsValid
+
## Detect intersections of the given shapes with algorithm based on mesh intersections.
# @param theShape1 First source object
# @param theShape2 Second source object