-# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# GEOM GEOM_SWIG : binding of C++ omplementaion with Python
# File : geompy.py
# Author : Paul RASCLE, EDF
# Module : GEOM
## @defgroup l3_advanced Creating Advanced Geometrical Objects
## @{
## @defgroup l4_decompose Decompose objects
+## @defgroup l4_decompose_d Decompose objects deprecated methods
## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
## @defgroup l4_obtain Access to subshapes by a criteria
+## @defgroup l4_advanced Advanced objects creation functions
## @}
## 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
def RaiseIfFailed (Method_name, Operation):
if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
-
+
## Return list of variables value from salome notebook
-## @ingroup l1_geompy_auxiliary
+## @ingroup l1_geompy_auxiliary
def ParseParameters(*parameters):
Result = []
- StringResult = ""
+ StringResult = []
for parameter in parameters:
- if isinstance(parameter,str):
- if notebook.isVariable(parameter):
- Result.append(notebook.get(parameter))
- else:
- raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
+ if isinstance(parameter, list):
+ lResults = ParseParameters(*parameter)
+ if len(lResults) > 0:
+ Result.append(lResults[:-1])
+ StringResult += lResults[-1].split(":")
+ pass
+ pass
else:
- Result.append(parameter)
+ if isinstance(parameter,str):
+ if notebook.isVariable(parameter):
+ Result.append(notebook.get(parameter))
+ else:
+ raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
+ pass
+ else:
+ Result.append(parameter)
+ pass
+ StringResult.append(str(parameter))
pass
-
- StringResult = StringResult + str(parameter)
- StringResult = StringResult + ":"
pass
- StringResult = StringResult[:len(StringResult)-1]
- Result.append(StringResult)
+ if Result:
+ Result.append(":".join(StringResult))
+ else:
+ Result = ":".join(StringResult)
return Result
-
+
## Return list of variables value from salome notebook
-## @ingroup l1_geompy_auxiliary
+## @ingroup l1_geompy_auxiliary
def ParseList(list):
Result = []
StringResult = ""
else:
Result.append(str(parameter))
pass
-
+
StringResult = StringResult + str(parameter)
StringResult = StringResult + ":"
pass
StringResult = StringResult[:len(StringResult)-1]
return Result, StringResult
-
+
## Return list of variables value from salome notebook
-## @ingroup l1_geompy_auxiliary
+## @ingroup l1_geompy_auxiliary
def ParseSketcherCommand(command):
Result = ""
StringResult = ""
Result = Result[:len(Result)-1]
return Result, StringResult
+## Helper function which can be used to pack the passed string to the byte data.
+## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
+## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
+## For example,
+## \code
+## val = PackData("10001110") # val = 0xAE
+## val = PackData("1") # val = 0x80
+## \endcode
+## @param data unpacked data - a string containing '1' and '0' symbols
+## @return data packed to the byte stream
+## @ingroup l1_geompy_auxiliary
+def PackData(data):
+ bytes = len(data)/8
+ if len(data)%8: bytes += 1
+ res = ""
+ for b in range(bytes):
+ d = data[b*8:(b+1)*8]
+ val = 0
+ for i in range(8):
+ val *= 2
+ if i < len(d):
+ if d[i] == "1": val += 1
+ elif d[i] != "0":
+ raise "Invalid symbol %s" % d[i]
+ pass
+ pass
+ res += chr(val)
+ pass
+ return res
+
+## Read bitmap texture from the text file.
+## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
+## A zero symbol ('0') represents transparent pixel of the texture bitmap.
+## The function returns width and height of the pixmap in pixels and byte stream representing
+## texture bitmap itself.
+##
+## This function can be used to read the texture to the byte stream in order to pass it to
+## the AddTexture() function of geompy class.
+## For example,
+## \code
+## import geompy
+## geompy.init_geom(salome.myStudy)
+## texture = geompy.readtexture('mytexture.dat')
+## texture = geompy.AddTexture(*texture)
+## obj.SetMarkerTexture(texture)
+## \endcode
+## @param fname texture file name
+## @return sequence of tree values: texture's width, height in pixels and its byte stream
+## @ingroup l1_geompy_auxiliary
+def ReadTexture(fname):
+ try:
+ f = open(fname)
+ lines = [ l.strip() for l in f.readlines()]
+ f.close()
+ maxlen = 0
+ if lines: maxlen = max([len(x) for x in lines])
+ lenbytes = maxlen/8
+ if maxlen%8: lenbytes += 1
+ bytedata=""
+ for line in lines:
+ if len(line)%8:
+ lenline = (len(line)/8+1)*8
+ pass
+ else:
+ lenline = (len(line)/8)*8
+ pass
+ for i in range(lenline/8):
+ byte=""
+ for j in range(8):
+ if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
+ else: byte += "0"
+ pass
+ bytedata += PackData(byte)
+ pass
+ for i in range(lenline/8, lenbytes):
+ bytedata += PackData("0")
+ pass
+ return lenbytes*8, len(lines), bytedata
+ except:
+ pass
+ return 0, 0, ""
+
+## Returns a long value from enumeration type
+# Can be used for CORBA enumerator types like GEOM.shape_type
+# @ingroup l1_geompy_auxiliary
+def EnumToLong(theItem):
+ ret = theItem
+ if hasattr(theItem, "_v"): ret = theItem._v
+ return ret
+
## Kinds of shape enumeration
# @ingroup l1_geompy_auxiliary
kind = GEOM.GEOM_IKindOfShape
CLOSED = 1
UNCLOSED = 2
-
class geompyDC(GEOM._objref_GEOM_Gen):
def __init__(self):
self.MeasuOp = None
self.BlocksOp = None
self.GroupOp = None
+ self.AdvOp = None
pass
## @addtogroup l1_geompy_auxiliary
self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
self.GroupOp = self.GetIGroupOperations (self.myStudyId)
+ self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
pass
+ ## Dump component to the Python script
+ # This method overrides IDL function to allow default values for the parameters.
+ def DumpPython(self, theStudy, theIsPublished=True, theIsMultiFile=True):
+ return GEOM._objref_GEOM_Gen.DumpPython(self, theStudy, theIsPublished, theIsMultiFile)
+
## Get name for sub-shape aSubObj of shape aMainObj
#
# @ref swig_SubShapeAllSorted "Example"
aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
if doRestoreSubShapes:
self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
- theFindMethod, theInheritFirstArg)
+ theFindMethod, theInheritFirstArg, True )
except:
print "addToStudy() failed"
return ""
return ""
return aShape.GetStudyEntry()
+ ## Unpublish object in study
+ #
+ def hideInStudy(self, obj):
+ ior = salome.orb.object_to_string(obj)
+ aSObject = self.myStudy.FindObjectIOR(ior)
+ if aSObject is not None:
+ genericAttribute = self.myBuilder.FindOrCreateAttribute(aSObject, "AttributeDrawable")
+ drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
+ drwAttribute.SetDrawable(False)
+ pass
+
# end of l1_geompy_auxiliary
## @}
# 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.
+ # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
+ # and prefix "from_subshapes_of_" to names of partially restored subshapes.
# \return list of published sub-shapes
#
# @ref tui_restore_prs_params "Example"
- def RestoreSubShapes (self, theObject, theArgs=[],
- theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
+ def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
+ theInheritFirstArg=False, theAddPrefix=True):
# Example: see GEOM_TestAll.py
return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
- theFindMethod, theInheritFirstArg)
+ theFindMethod, theInheritFirstArg, theAddPrefix)
+
+ ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
+ # To be used from python scripts out of geompy.addToStudy (non-default usage)
+ # \param theObject published GEOM object, arguments of which will be published
+ # \param theArgs list of GEOM_Object, operation arguments to be published.
+ # If this list is empty, all operation arguments will be published
+ # \param theFindMethod method to search subshapes, corresponding to arguments and
+ # their subshapes. Value from enumeration GEOM::find_shape_method.
+ # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
+ # Do not publish subshapes in place of arguments, but only
+ # in place of subshapes 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
+ # 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.
+ # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
+ # and prefix "from_subshapes_of_" to names of partially restored subshapes.
+ # \return list of published sub-shapes
+ #
+ # @ref tui_restore_prs_params "Example"
+ def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
+ theInheritFirstArg=False, theAddPrefix=True):
+ # Example: see GEOM_TestAll.py
+ return self.RestoreGivenSubShapesO(self.myStudy, theObject, theArgs,
+ theFindMethod, theInheritFirstArg, theAddPrefix)
# end of l3_restore_ss
## @}
# @return New GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertex(self,theX, theY, theZ):
+ def MakeVertex(self, theX, theY, theZ):
# Example: see GEOM_TestAll.py
theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
anObj.SetParameters(Parameters)
return anObj
+ ## Create a point by projection give coordinates on the given curve
+ # @param theRefCurve The referenced curve.
+ # @param theX X-coordinate in 3D space
+ # @param theY Y-coordinate in 3D space
+ # @param theZ Z-coordinate in 3D space
+ # @return New GEOM_Object, containing the created point.
+ #
+ # @ref tui_creation_point "Example"
+ def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ):
+ # Example: see GEOM_TestAll.py
+ theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
+ anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
+ RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
+ anObj.SetParameters(Parameters)
+ return anObj
+
+ ## Create a point, corresponding to the given length on the given curve.
+ # @param theRefCurve The referenced curve.
+ # @param theLength Length on the referenced curve. It can be negative.
+ # @param theStartPoint Point allowing to choose the direction for the calculation
+ # of the length. If None, start from the first point of theRefCurve.
+ # @return New GEOM_Object, containing the created point.
+ #
+ # @ref tui_creation_point "Example"
+ def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
+ # Example: see GEOM_TestAll.py
+ theLength, Parameters = ParseParameters(theLength)
+ anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
+ RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
+ anObj.SetParameters(Parameters)
+ return anObj
+
## Create a point, corresponding to the given parameters on the
# given surface.
# @param theRefSurf The referenced surface.
anObj.SetParameters(Parameters);
return anObj
+ ## Create a point by projection give coordinates on the given surface
+ # @param theRefSurf The referenced surface.
+ # @param theX X-coordinate in 3D space
+ # @param theY Y-coordinate in 3D space
+ # @param theZ Z-coordinate in 3D space
+ # @return New GEOM_Object, containing the created point.
+ #
+ # @ref swig_MakeVertexOnSurfaceByCoord "Example"
+ def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ):
+ theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
+ # Example: see GEOM_TestAll.py
+ anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
+ RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
+ anObj.SetParameters(Parameters);
+ return anObj
+
## Create a point on intersection of two lines.
# @param theRefLine1, theRefLine2 The referenced lines.
# @return New GEOM_Object, containing the created point.
anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
return anObj
-
+
## Create a tangent plane, corresponding to the given parameter on the given face.
# @param theFace The face for which tangent plane should be built.
# @param theParameterV vertical value of the center point (0.0 - 1.0).
# @param theParameterU horisontal value of the center point (0.0 - 1.0).
- # @param theTrimSize the size of plane.
+ # @param theTrimSize the size of plane.
# @return New GEOM_Object, containing the created tangent.
#
# @ref swig_MakeTangentPlaneOnFace "Example"
- def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize):
- anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
- RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
+ def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize):
+ anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
+ RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
return anObj
## Create a vector with the given components.
RaiseIfFailed("MakePlaneFace", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
-
- ## Create a plane, passing through the 2 vectors
+
+ ## Create a plane, passing through the 2 vectors
# with center in a start point of the first vector.
# @param theVec1 Vector, defining center point and plane direction.
# @param theVec2 Vector, defining the plane normal direction.
RaiseIfFailed("MakePlane2Vec", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
-
- ## Create a plane, based on a Local coordinate system.
+
+ ## Create a plane, based on a Local coordinate system.
# @param theLCS coordinate system, defining plane.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
- # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
+ # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
# @return New GEOM_Object, containing the created plane.
#
# @ref tui_creation_plane "Example"
# @ref swig_MakeMarker "Example"
def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
# Example: see GEOM_TestAll.py
- OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
+ OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
RaiseIfFailed("MakeMarker", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
- ## Create a local coordinate system.
+ ## Create a local coordinate system from shape.
+ # @param theShape The initial shape to detect the coordinate system.
+ # @return New GEOM_Object, containing the created coordinate system.
+ #
+ # @ref tui_creation_lcs "Example"
+ def MakeMarkerFromShape(self, theShape):
+ anObj = self.BasicOp.MakeMarkerFromShape(theShape)
+ RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
+ return anObj
+
+ ## Create a local coordinate system from point and two vectors.
# @param theOrigin Point of coordinate system origin.
# @param theXVec Vector of X direction
# @param theYVec Vector of Y direction
# @return New GEOM_Object, containing the created coordinate system.
#
- # @ref swig_MakeMarker "Example"
+ # @ref tui_creation_lcs "Example"
def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
- O = self.PointCoordinates( theOrigin )
- OXOY = []
- for vec in [ theXVec, theYVec ]:
- v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] )
- p1 = self.PointCoordinates( v1 )
- p2 = self.PointCoordinates( v2 )
- for i in range( 0, 3 ):
- OXOY.append( p2[i] - p1[i] )
- #
- anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2],
- OXOY[0], OXOY[1], OXOY[2],
- OXOY[3], OXOY[4], OXOY[5], )
- RaiseIfFailed("MakeMarker", self.BasicOp)
+ anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
+ RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
return anObj
# end of l3_basic_go
anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
RaiseIfFailed("MakeArcCenter", self.CurvesOp)
return anObj
-
+
## Create an arc of ellipse, of center and two points.
# @param theCenter Center of the arc.
# @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
## Create a polyline on the set of points.
# @param thePoints Sequence of points for the polyline.
+ # @param theIsClosed If True, build a closed wire.
# @return New GEOM_Object, containing the created polyline.
#
# @ref tui_creation_curve "Example"
- def MakePolyline(self,thePoints):
+ def MakePolyline(self, thePoints, theIsClosed=False):
# Example: see GEOM_TestAll.py
- anObj = self.CurvesOp.MakePolyline(thePoints)
+ anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
RaiseIfFailed("MakePolyline", self.CurvesOp)
return anObj
## Create bezier curve on the set of points.
# @param thePoints Sequence of points for the bezier curve.
+ # @param theIsClosed If True, build a closed curve.
# @return New GEOM_Object, containing the created bezier curve.
#
# @ref tui_creation_curve "Example"
- def MakeBezier(self,thePoints):
+ def MakeBezier(self, thePoints, theIsClosed=False):
# Example: see GEOM_TestAll.py
- anObj = self.CurvesOp.MakeSplineBezier(thePoints)
+ anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
return anObj
## Create B-Spline curve on the set of points.
# @param thePoints Sequence of points for the B-Spline curve.
+ # @param theIsClosed If True, build a closed curve.
+ # @param theDoReordering If TRUE, the algo does not follow the order of
+ # \a thePoints but searches for the closest vertex.
# @return New GEOM_Object, containing the created B-Spline curve.
#
# @ref tui_creation_curve "Example"
- def MakeInterpol(self,thePoints):
+ def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False):
# Example: see GEOM_TestAll.py
- anObj = self.CurvesOp.MakeSplineInterpolation(thePoints)
+ anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
+ RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
+ return anObj
+
+
+ ## Creates a curve using the parametric definition of the basic points.
+ # @param thexExpr parametric equation of the coordinates X.
+ # @param theyExpr parametric equation of the coordinates Y.
+ # @param thezExpr parametric equation of the coordinates Z.
+ # @param theParamMin the minimal value of the parameter.
+ # @param theParamMax the maximum value of the parameter.
+ # @param theParamStep the step of the parameter.
+ # @param theCurveType the type of the curve.
+ # @return New GEOM_Object, containing the created curve.
+ #
+ # @ref tui_creation_curve "Example"
+ def MakeCurveParametric(self, thexExpr, theyExpr, thezExpr,
+ theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False ):
+ theParamMin,theParamMax,theParamStep,Parameters = ParseParameters(theParamMin,theParamMax,theParamStep)
+ if theNewMethod:
+ 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)
+ anObj.SetParameters(Parameters)
return anObj
+
+
# end of l4_curves
## @}
# .
# \n
# - "C radius length" : Create arc by direction, radius and length(in degree)
+ # - "AA x y": Create arc by point at X & Y
+ # - "A dx dy" : Create arc by point with DX & DY
+ # - "A dx dy" : Create arc by point with DX & DY
+ # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
+ # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
+ # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
+ # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
# .
# \n
# - "WW" : Close Wire (to finish)
# - "WF" : Close Wire and build face (to finish)
+ # .
+ # \n
+ # - Flag1 (= reverse) is 0 or 2 ...
+ # - if 0 the drawn arc is the one of lower angle (< Pi)
+ # - if 2 the drawn arc ius the one of greater angle (> Pi)
+ # .
+ # \n
+ # - Flag2 (= control tolerance) is 0 or 1 ...
+ # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
+ # - if 1 the wire is built only if the end point is on the arc
+ # with a tolerance of 10^-7 on the distance else the creation fails
#
# @param theCommand String, defining the sketcher in local
# coordinates of the working plane.
anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
return anObj
-
- ## Create a sketcher wire, following the numerical description,
+
+ ## Create a sketcher wire, following the numerical description,
# passed through <VAR>theCoordinates</VAR> argument. \n
- # @param theCoordinates double values, defining points to create a wire,
+ # @param theCoordinates double values, defining points to create a wire,
# passing from it.
# @return New GEOM_Object, containing the created wire.
#
# @ref tui_sketcher_page "Example"
def Make3DSketcher(self, theCoordinates):
+ theCoordinates,Parameters = ParseParameters(theCoordinates)
anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
RaiseIfFailed("Make3DSketcher", self.CurvesOp)
+ anObj.SetParameters(Parameters)
return anObj
# end of l3_sketcher
anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
return anObj
-
+
## Create a face with specified dimensions along OX-OY coordinate axes,
# with edges, parallel to this coordinate axes.
# @param theH height of Face.
# @param theW width of Face.
- # @param theOrientation orientation belong axis OXY OYZ OZX
+ # @param theOrientation orientation belong axis OXY OYZ OZX
# @return New GEOM_Object, containing the created face.
#
# @ref tui_creation_face "Example"
## Create a face from another plane and two sizes,
# vertical size and horisontal size.
# @param theObj Normale vector to the creating face or
- # the face object.
+ # the face object.
# @param theH Height (vertical size).
# @param theW Width (horisontal size).
# @return New GEOM_Object, containing the created face.
## Create a disk with specified dimensions along OX-OY coordinate axes.
# @param theR Radius of Face.
- # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
+ # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
# @return New GEOM_Object, containing the created disk.
#
# @ref tui_creation_face "Example"
# @param theBase Base shape to be extruded.
# @param thePoint1 First end of extrusion vector.
# @param thePoint2 Second end of extrusion vector.
+ # @param theScaleFactor Use it to make prism with scaled second base.
+ # Nagative value means not scaled second base.
# @return New GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrism(self, theBase, thePoint1, thePoint2):
+ def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0):
# Example: see GEOM_TestAll.py
- anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
+ anObj = None
+ Parameters = ""
+ if theScaleFactor > 0:
+ theScaleFactor,Parameters = ParseParameters(theScaleFactor)
+ anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor)
+ else:
+ anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
+ RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
+ anObj.SetParameters(Parameters)
+ return anObj
+
+ ## Create a shape by extrusion of the base shape along a
+ # vector, defined by two points, in 2 Ways (forward/backward).
+ # @param theBase Base shape to be extruded.
+ # @param thePoint1 First end of extrusion vector.
+ # @param thePoint2 Second end of extrusion vector.
+ # @return New GEOM_Object, containing the created prism.
+ #
+ # @ref tui_creation_prism "Example"
+ def MakePrism2Ways(self, theBase, thePoint1, thePoint2):
+ # Example: see GEOM_TestAll.py
+ anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
return anObj
# @param theBase Base shape to be extruded.
# @param theVec Direction of extrusion.
# @param theH Prism dimension along theVec.
+ # @param theScaleFactor Use it to make prism with scaled second base.
+ # Nagative value means not scaled second base.
# @return New GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrismVecH(self, theBase, theVec, theH):
+ def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0):
# Example: see GEOM_TestAll.py
- theH,Parameters = ParseParameters(theH)
- anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
+ anObj = None
+ Parameters = ""
+ if theScaleFactor > 0:
+ theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor)
+ anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor)
+ else:
+ theH,Parameters = ParseParameters(theH)
+ anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
RaiseIfFailed("MakePrismVecH", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along the vector,
# i.e. all the space, transfixed by the base shape during its translation
- # along the vector on the given distance in 2 Ways (forward/backward) .
+ # along the vector on the given distance in 2 Ways (forward/backward).
# @param theBase Base shape to be extruded.
# @param theVec Direction of extrusion.
# @param theH Prism dimension along theVec in forward direction.
RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
-
- ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
+
+ ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
# @param theBase Base shape to be extruded.
# @param theDX, theDY, theDZ Directions of extrusion.
+ # @param theScaleFactor Use it to make prism with scaled second base.
+ # Nagative value means not scaled second base.
# @return New GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ):
+ def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0):
# Example: see GEOM_TestAll.py
- theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
- anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
+ anObj = None
+ Parameters = ""
+ if theScaleFactor > 0:
+ theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor)
+ anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor)
+ else:
+ theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
+ anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
-
- ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
+
+ ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
# i.e. all the space, transfixed by the base shape during its translation
- # along the vector on the given distance in 2 Ways (forward/backward) .
+ # along the vector on the given distance in 2 Ways (forward/backward).
# @param theBase Base shape to be extruded.
# @param theDX, theDY, theDZ Directions of extrusion.
# @return New GEOM_Object, containing the created prism.
# @param theTol2D a 2d tolerance to be reached
# @param theTol3D a 3d tolerance to be reached
# @param theNbIter a number of iteration of approximation algorithm
+ # @param theMethod Kind of method to perform filling operation:
+ # GEOM.FOM_Default - Default - standard behaviour
+ # /GEOM.FOM_UseOri - Use edges orientation - orientation of edges is
+ # used: if the edge is reversed, the curve from this edge
+ # is reversed before using it in the filling algorithm.
+ # /GEOM.FOM_AutoCorrect - Auto-correct orientation - changes the orientation
+ # of the curves using minimization of sum of distances
+ # between the end points of the edges.
# @param isApprox if True, BSpline curves are generated in the process
# of surface construction. By default it is False, that means
# the surface is created using Besier curves. The usage of
# @return New GEOM_Object, containing the created filling surface.
#
# @ref tui_creation_filling "Example"
- def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
+ def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D,
+ theTol3D, theNbIter, theMethod=GEOM.FOM_Default, isApprox=0):
# Example: see GEOM_TestAll.py
- theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg,
- theTol2D, theTol3D, theNbIter)
+ theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
- theTol2D, theTol3D, theNbIter, isApprox)
+ theTol2D, theTol3D, theNbIter,
+ theMethod, isApprox)
RaiseIfFailed("MakeFilling", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## 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.
+ # the several profiles can be specified in the several locations of path.
# @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
## Create a shape by extrusion of the profile shape along
# the path shape. The path shape can be a wire or a edge.
- # the several profiles can be specified in the several locations of path.
+ # the several profiles can be specified in the several locations of path.
# @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
RaiseIfFailed("MakeEdge", self.ShapesOp)
return anObj
+ ## Create a new edge, corresponding to the given length on the given curve.
+ # @param theRefCurve The referenced curve (edge).
+ # @param theLength Length on the referenced curve. It can be negative.
+ # @param theStartPoint Any point can be selected for it, the new edge will begin
+ # at the end of \a theRefCurve, close to the selected point.
+ # If None, start from the first point of \a theRefCurve.
+ # @return New GEOM_Object, containing the created edge.
+ #
+ # @ref tui_creation_edge "Example"
+ def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
+ # Example: see GEOM_TestAll.py
+ theLength, Parameters = ParseParameters(theLength)
+ anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
+ RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp)
+ anObj.SetParameters(Parameters)
+ return anObj
+
+ ## Create an edge from specified wire.
+ # @param theWire source Wire.
+ # @param theLinearTolerance linear tolerance value.
+ # @param theAngularTolerance angular tolerance value.
+ # @return New GEOM_Object, containing the created edge.
+ #
+ # @ref tui_creation_edge "Example"
+ def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12):
+ # Example: see GEOM_TestAll.py
+ anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
+ RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
+ return anObj
+
## Create a wire from the set of edges and wires.
# @param theEdgesAndWires List of edges and/or wires.
# @param theTolerance Maximum distance between vertices, that will be merged.
RaiseIfFailed("GetSharedShapes", self.ShapesOp)
return aList
+ ## Get all sub-shapes, shared by all shapes in the list <VAR>theShapes</VAR>.
+ # @param theShapes Shapes to find common sub-shapes of.
+ # @param theShapeType Type of sub-shapes to be retrieved.
+ # @return List of objects, that are sub-shapes of all given shapes.
+ #
+ # @ref swig_GetSharedShapes "Example"
+ def GetSharedShapesMulti(self, theShapes, theShapeType):
+ # Example: see GEOM_TestOthers.py
+ aList = self.ShapesOp.GetSharedShapesMulti(theShapes, theShapeType)
+ RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
+ return aList
+
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# situated relatively the specified plane by the certain way,
# defined through <VAR>theState</VAR> parameter.
RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
return aList
+ ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+ # the specified cylinder by the certain way, defined through \a theState parameter.
+ # @param theShape Shape to find sub-shapes of.
+ # @param theShapeType Type of sub-shapes to be retrieved.
+ # @param theAxis Vector (or line, or linear edge), specifying
+ # axis of the cylinder to find shapes on.
+ # @param thePnt Point specifying location of the bottom of the cylinder.
+ # @param theRadius Radius of the cylinder to find shapes on.
+ # @param theState The state of the subshapes to find. It can be one of
+ # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
+ # @return List of all found sub-shapes.
+ #
+ # @ref swig_GetShapesOnCylinderWithLocation "Example"
+ def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
+ # Example: see GEOM_TestOthers.py
+ aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
+ RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
+ return aList
+
+ ## Works like the above method, but returns list of sub-shapes indices
+ #
+ # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
+ def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
+ # Example: see GEOM_TestOthers.py
+ aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
+ RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
+ return aList
+
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified sphere by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
## Find in \a theShape all sub-shapes of type \a theShapeType,
# situated relatively the specified \a theCheckShape by the
# certain way, defined through \a theState parameter.
- # @param theCheckShape Shape for relative comparing.
+ # @param theCheckShape Shape for relative comparing. It must be a solid.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved.
# @param theState The state of the subshapes to find. It can be one of
# @param theShapeWhat Shape, specifying what to find.
# @return Group of all found sub-shapes or a single found sub-shape.
#
+ # @note This function has a restriction on argument shapes.
+ # If \a theShapeWhere has curved parts with significantly
+ # outstanding centres (i.e. the mass centre of a part is closer to
+ # \a theShapeWhat than to the part), such parts will not be found.
+ # @image html get_in_place_lost_part.png
+ #
# @ref swig_GetInPlace "Example"
- def GetInPlace(self,theShapeWhere, theShapeWhat):
+ def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False):
# Example: see GEOM_TestOthers.py
- anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
+ anObj = None
+ if isNewImplementation:
+ anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
+ else:
+ anObj = self.ShapesOp.GetInPlaceOld(theShapeWhere, theShapeWhat)
+ pass
RaiseIfFailed("GetInPlace", self.ShapesOp)
return anObj
## @addtogroup l4_decompose
## @{
+ ## Get all sub-shapes and groups of \a theShape,
+ # that were created already by any other methods.
+ # @param theShape Any shape.
+ # @param theGroupsOnly If this parameter is TRUE, only groups will be
+ # returned, else all found sub-shapes and groups.
+ # @return List of existing sub-objects of \a theShape.
+ #
+ # @ref swig_all_decompose "Example"
+ def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
+ # Example: see GEOM_TestAll.py
+ ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
+ RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
+ return ListObj
+
+ ## Get all groups of \a theShape,
+ # that were created already by any other methods.
+ # @param theShape Any shape.
+ # @return List of existing groups of \a theShape.
+ #
+ # @ref swig_all_decompose "Example"
+ def GetGroups(self, theShape):
+ # Example: see GEOM_TestAll.py
+ ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
+ RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
+ return ListObj
+
## Explode a shape on subshapes of a given type.
+ # 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.
# @return List of sub-shapes of type theShapeType, contained in theShape.
# @ref swig_all_decompose "Example"
def SubShapeAll(self, aShape, aType):
# Example: see GEOM_TestAll.py
- ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
- RaiseIfFailed("MakeExplode", self.ShapesOp)
+ ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, False)
+ RaiseIfFailed("SubShapeAll", self.ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type.
#
# @ref swig_all_decompose "Example"
def SubShapeAllIDs(self, aShape, aType):
- ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
+ ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, False)
RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
return ListObj
+ ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
+ # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
+ # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
+ #
+ # @ref swig_all_decompose "Example"
+ def SubShape(self, aShape, aType, ListOfInd):
+ # Example: see GEOM_TestAll.py
+ ListOfIDs = []
+ AllShapeIDsList = self.SubShapeAllIDs(aShape, aType)
+ for ind in ListOfInd:
+ ListOfIDs.append(AllShapeIDsList[ind - 1])
+ anObj = self.GetSubShape(aShape, ListOfIDs)
+ return anObj
+
## Explode a shape on subshapes of a given type.
# Sub-shapes will be sorted by coordinates of their gravity centers.
+ # 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.
# @return List of sub-shapes of type theShapeType, contained in theShape.
#
# @ref swig_SubShapeAllSorted "Example"
- def SubShapeAllSorted(self, aShape, aType):
+ def SubShapeAllSortedCentres(self, aShape, aType):
# Example: see GEOM_TestAll.py
- ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
- RaiseIfFailed("MakeExplode", self.ShapesOp)
+ ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, True)
+ RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type.
# @return List of IDs of sub-shapes.
#
# @ref swig_all_decompose "Example"
- def SubShapeAllSortedIDs(self, aShape, aType):
- ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
+ def SubShapeAllSortedCentresIDs(self, aShape, aType):
+ ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, True)
RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
return ListIDs
## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
- # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
+ # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
# Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
#
# @ref swig_all_decompose "Example"
- def SubShape(self, aShape, aType, ListOfInd):
+ def SubShapeSortedCentres(self, aShape, aType, ListOfInd):
# Example: see GEOM_TestAll.py
ListOfIDs = []
- AllShapeList = self.SubShapeAll(aShape, aType)
+ AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, aType)
for ind in ListOfInd:
- ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
+ ListOfIDs.append(AllShapeIDsList[ind - 1])
anObj = self.GetSubShape(aShape, ListOfIDs)
return anObj
- ## 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>.
- # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
+ ## Extract shapes (excluding the main shape) of given type.
+ # @param aShape The shape.
+ # @param aType The shape type.
+ # @param isSorted Boolean flag to switch sorting on/off.
+ # @return List of sub-shapes of type aType, contained in aShape.
+ #
+ # @ref swig_FilletChamfer "Example"
+ def ExtractShapes(self, aShape, aType, isSorted = False):
+ # Example: see GEOM_TestAll.py
+ ListObj = self.ShapesOp.ExtractSubShapes(aShape, aType, isSorted)
+ RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
+ return ListObj
+
+ ## Get a set of sub shapes defined by their unique IDs inside <VAR>theMainShape</VAR>
+ # @param theMainShape Main shape.
+ # @param theIndices List of unique IDs of sub shapes inside <VAR>theMainShape</VAR>.
+ # @return List of GEOM_Objects, corresponding to found sub shapes.
#
# @ref swig_all_decompose "Example"
- def SubShapeSorted(self,aShape, aType, ListOfInd):
+ def SubShapes(self, aShape, anIDs):
# Example: see GEOM_TestAll.py
+ ListObj = self.ShapesOp.MakeSubShapes(aShape, anIDs)
+ RaiseIfFailed("SubShapes", self.ShapesOp)
+ return ListObj
+
+ # end of l4_decompose
+ ## @}
+
+ ## @addtogroup l4_decompose_d
+ ## @{
+
+ ## Deprecated method
+ # It works like SubShapeAllSortedCentres, but wrongly
+ # defines centres of faces, shells and solids.
+ def SubShapeAllSorted(self, aShape, aType):
+ ListObj = self.ShapesOp.MakeExplode(aShape, aType, True)
+ RaiseIfFailed("MakeExplode", self.ShapesOp)
+ return ListObj
+
+ ## Deprecated method
+ # It works like SubShapeAllSortedCentresIDs, but wrongly
+ # defines centres of faces, shells and solids.
+ def SubShapeAllSortedIDs(self, aShape, aType):
+ ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, aType, True)
+ RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
+ return ListIDs
+
+ ## Deprecated method
+ # It works like SubShapeSortedCentres, but has a bug
+ # (wrongly defines centres of faces, shells and solids).
+ def SubShapeSorted(self, aShape, aType, ListOfInd):
ListOfIDs = []
- AllShapeList = self.SubShapeAllSorted(aShape, aType)
+ AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, aType)
for ind in ListOfInd:
- ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
+ ListOfIDs.append(AllShapeIDsList[ind - 1])
anObj = self.GetSubShape(aShape, ListOfIDs)
return anObj
- # end of l4_decompose
+ # end of l4_decompose_d
## @}
## @addtogroup l3_healing
# @return New GEOM_Object, containing processed shape.
#
# @ref tui_shape_processing "Example"
- def ProcessShape(self,theShape, theOperators, theParameters, theValues):
+ def ProcessShape(self, theShape, theOperators, theParameters, theValues):
# Example: see GEOM_TestHealing.py
theValues,Parameters = ParseList(theValues)
anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
+ # To avoid script failure in case of good argument shape
+ if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
+ return theShape
RaiseIfFailed("ProcessShape", self.HealOp)
for string in (theOperators + theParameters):
Parameters = ":" + Parameters
## Close an open wire.
# @param theObject Shape to be processed.
# @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
- # if -1, then <VAR>theObject</VAR> itself is a wire.
- # @param isCommonVertex If TRUE : closure by creation of a common vertex,
- # If FALS : closure by creation of an edge between ends.
+ # if [ ], then <VAR>theObject</VAR> itself is a wire.
+ # @param isCommonVertex If True : closure by creation of a common vertex,
+ # If False : closure by creation of an edge between ends.
# @return New GEOM_Object, containing processed shape.
#
# @ref tui_close_contour "Example"
# @return New GEOM_Object, containing processed shape.
#
# @ref swig_todo "Example"
- def ChangeOrientationShellCopy(self,theObject):
+ def ChangeOrientationShellCopy(self, theObject):
anObj = self.HealOp.ChangeOrientationCopy(theObject)
RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
return anObj
+ ## Try to limit tolerance of the given object by value \a theTolerance.
+ # @param theObject Shape to be processed.
+ # @param theTolerance Required tolerance value.
+ # @return New GEOM_Object, containing processed shape.
+ #
+ # @ref tui_limit_tolerance "Example"
+ def LimitTolerance(self, theObject, theTolerance = 1e-07):
+ anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
+ RaiseIfFailed("LimitTolerance", self.HealOp)
+ return anObj
+
## Get a list of wires (wrapped in GEOM_Object-s),
# that constitute a free boundary of the given shape.
# @param theObject Shape to get free boundary of.
# theOpenWires: Open wires on the free boundary of the given shape.
#
# @ref tui_measurement_tools_page "Example"
- def GetFreeBoundary(self,theObject):
+ def GetFreeBoundary(self, theObject):
# Example: see GEOM_TestHealing.py
anObj = self.HealOp.GetFreeBoundary(theObject)
RaiseIfFailed("GetFreeBoundary", self.HealOp)
# which can be considered as coincident.
# @return ListOfGO.
#
- # @ref swig_todo "Example"
+ # @ref tui_glue_faces "Example"
def GetGlueFaces(self, theShape, theTolerance):
- # Example: see GEOM_Spanner.py
anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
RaiseIfFailed("GetGlueFaces", self.ShapesOp)
return anObj
# @param theFaces List of faces for gluing.
# @param doKeepNonSolids If FALSE, only solids will present in the result,
# otherwise all initial shapes.
+ # @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
+ # will be glued, otherwise only the edges,
+ # belonging to <VAR>theFaces</VAR>.
# @return New GEOM_Object, containing a copy of theShape
# without some faces.
#
- # @ref swig_todo "Example"
- def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
- # Example: see GEOM_Spanner.py
- anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
+ # @ref tui_glue_faces "Example"
+ def MakeGlueFacesByList(self, theShape, theTolerance, theFaces,
+ doKeepNonSolids=True, doGlueAllEdges=True):
+ anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces,
+ doKeepNonSolids, doGlueAllEdges)
if anObj is None:
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
return anObj
+ ## Replace coincident edges in theShape by one edge.
+ # @param theShape Initial shape.
+ # @param theTolerance Maximum distance between edges, which can be considered as coincident.
+ # @return New GEOM_Object, containing a copy of theShape without coincident edges.
+ #
+ # @ref tui_glue_edges "Example"
+ def MakeGlueEdges(self, theShape, theTolerance):
+ theTolerance,Parameters = ParseParameters(theTolerance)
+ anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance)
+ if anObj is None:
+ raise RuntimeError, "MakeGlueEdges : " + self.ShapesOp.GetErrorCode()
+ anObj.SetParameters(Parameters)
+ return anObj
+
+ ## Find coincident edges in theShape for possible gluing.
+ # @param theShape Initial shape.
+ # @param theTolerance Maximum distance between edges,
+ # which can be considered as coincident.
+ # @return ListOfGO.
+ #
+ # @ref tui_glue_edges "Example"
+ def GetGlueEdges(self, theShape, theTolerance):
+ anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
+ RaiseIfFailed("GetGlueEdges", self.ShapesOp)
+ return anObj
+
+ ## Replace coincident edges in theShape by one edge
+ # in compliance with given list of edges
+ # @param theShape Initial shape.
+ # @param theTolerance Maximum distance between edges,
+ # which can be considered as coincident.
+ # @param theFaces List of edges for gluing.
+ # @return New GEOM_Object, containing a copy of theShape
+ # without some edges.
+ #
+ # @ref tui_glue_edges "Example"
+ def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges):
+ anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
+ if anObj is None:
+ raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()
+ return anObj
+
# end of l3_healing
## @}
# 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)
+ # 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
+ # are kept also (if they exist).
#
# After implementation new version of PartitionAlgo (October 2006)
# other parameters are ignored by current functionality. They are kept
#
# @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.SHAPE
+ for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
+ Limit = EnumToLong(lim)
+ pass
anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials,
# @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.SHAPE
+ for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
+ Limit = EnumToLong(lim)
+ pass
anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials,
# @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,
## Modify the Location of the given object by Path,
# @param theObject The object to be displaced.
# @param thePath Wire or Edge along that the object will be translated.
- # @param theDistance progress of Path (0 = start location, 1 = end of path location).
- # @param theCopy is to create a copy objects if true.
- # @param theReverse - 0 for usual direction, 1 to reverse path direction.
+ # @param theDistance progress of Path (0 = start location, 1 = end of path location).
+ # @param theCopy is to create a copy objects if true.
+ # @param theReverse - 0 for usual direction, 1 to reverse path direction.
# @return New GEOM_Object, containing the displaced shape.
#
# @ref tui_modify_location "Example"
anObj.SetParameters(Parameters)
return anObj
+ ## Create new object as projection of the given one on a 2D surface.
+ # @param theSource The source object for the projection. It can be a point, edge or wire.
+ # @param theTarget The target object. It can be planar or cylindrical face.
+ # @return New GEOM_Object, containing the projection.
+ #
+ # @ref tui_projection "Example"
+ def MakeProjection(self, theSource, theTarget):
+ # Example: see GEOM_TestAll.py
+ anObj = self.TrsfOp.ProjectShapeCopy(theSource, theTarget)
+ RaiseIfFailed("ProjectShapeCopy", self.TrsfOp)
+ return anObj
+
# -----------------------------------------------------------------------------
# Patterns
# -----------------------------------------------------------------------------
RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
-
+
+ ## Perform a fillet on the specified edges of the given shape
+ # @param theShape - Wire Shape to perform fillet on.
+ # @param theR - Fillet radius.
+ # @param theListOfVertexes Global indices of vertexes to perform fillet on.
+ # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
+ # \note The list of vertices could be empty,
+ # in this case fillet will done done at all vertices in wire
+ # @return New GEOM_Object, containing the result shape.
+ #
+ # @ref tui_fillet2d "Example"
+ def MakeFillet1D(self,theShape, theR, theListOfVertexes):
+ # Example: see GEOM_TestAll.py
+ theR,Parameters = ParseParameters(theR)
+ anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes)
+ RaiseIfFailed("MakeFillet1D", self.LocalOp)
+ anObj.SetParameters(Parameters)
+ return anObj
+
## Perform a fillet on the specified edges/faces of the given shape
# @param theShape - Face Shape to perform fillet on.
# @param theR - Fillet radius.
# @ref tui_fillet2d "Example"
def MakeFillet2D(self,theShape, theR, theListOfVertexes):
# Example: see GEOM_TestAll.py
+ theR,Parameters = ParseParameters(theR)
anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
RaiseIfFailed("MakeFillet2D", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## Perform a symmetric chamfer on all edges of the given shape.
RaiseIfFailed("GetInertia", self.MeasuOp)
return aTuple
+ ## Get if coords are included in the shape (ST_IN or ST_ON)
+ # @param theShape Shape
+ # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
+ # @param tolerance to be used (default is 1.0e-7)
+ # @return list_of_boolean = [res1, res2, ...]
+ def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
+ return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
+
## Get minimal distance between the given shapes.
# @param theShape1,theShape2 Shapes to find minimal distance between.
# @return Value of the minimal distance between the given shapes.
RaiseIfFailed("WhatIs", self.MeasuOp)
return aDescr
+ ## Obtain quantity of shapes of the given type in \a theShape.
+ # If \a theShape is of type \a theType, it is also counted.
+ # @param theShape Shape to be described.
+ # @return Quantity of shapes of type \a theType in \a theShape.
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def NbShapes (self, theShape, theType):
+ # Example: see GEOM_TestMeasures.py
+ listSh = self.SubShapeAllIDs(theShape, theType)
+ Nb = len(listSh)
+ t = EnumToLong(theShape.GetShapeType())
+ theType = EnumToLong(theType)
+ if t == theType:
+ Nb = Nb + 1
+ pass
+ return Nb
+
+ ## Obtain quantity of shapes of each type in \a theShape.
+ # The \a theShape is also counted.
+ # @param theShape Shape to be described.
+ # @return Dictionary of shape types with bound quantities of shapes.
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def ShapeInfo (self, theShape):
+ # Example: see GEOM_TestMeasures.py
+ aDict = {}
+ for typeSh in ShapeType:
+ if typeSh in ( "AUTO", "SHAPE" ): continue
+ listSh = self.SubShapeAllIDs(theShape, ShapeType[typeSh])
+ Nb = len(listSh)
+ if EnumToLong(theShape.GetShapeType()) == ShapeType[typeSh]:
+ Nb = Nb + 1
+ pass
+ aDict[typeSh] = Nb
+ pass
+ return aDict
+
## Get a point, situated at the centre of mass of theShape.
# @param theShape Shape to define centre of mass of.
# @return New GEOM_Object, containing the created point.
RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
return anObj
+ ## Get a vertex subshape by index depended with orientation.
+ # @param theShape Shape to find subshape.
+ # @param theIndex Index to find vertex by this index.
+ # @return New GEOM_Object, containing the created vertex.
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def GetVertexByIndex(self,theShape, theIndex):
+ # Example: see GEOM_TestMeasures.py
+ anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex)
+ RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
+ return anObj
+
+ ## Get the first vertex of wire/edge depended orientation.
+ # @param theShape Shape to find first vertex.
+ # @return New GEOM_Object, containing the created vertex.
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def GetFirstVertex(self,theShape):
+ # Example: see GEOM_TestMeasures.py
+ anObj = self.GetVertexByIndex(theShape, 0)
+ RaiseIfFailed("GetFirstVertex", self.MeasuOp)
+ return anObj
+
+ ## Get the last vertex of wire/edge depended orientation.
+ # @param theShape Shape to find last vertex.
+ # @return New GEOM_Object, containing the created vertex.
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def GetLastVertex(self,theShape):
+ # Example: see GEOM_TestMeasures.py
+ nb_vert = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["VERTEX"])
+ anObj = self.GetVertexByIndex(theShape, (nb_vert-1))
+ RaiseIfFailed("GetLastVertex", self.MeasuOp)
+ return anObj
+
## Get a normale to the given face. If the point is not given,
# the normale is calculated at the center of mass.
# @param theFace Face to define normale of.
# @return New GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def Import(self,theFileName, theFormatName):
+ def ImportFile(self,theFileName, theFormatName):
# Example: see GEOM_TestOthers.py
- anObj = self.InsertOp.Import(theFileName, theFormatName)
+ anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
RaiseIfFailed("Import", self.InsertOp)
return anObj
- ## Shortcut to Import() for BREP format
+ ## Deprecated analog of ImportFile
+ def Import(self,theFileName, theFormatName):
+ print "WARNING: Function Import is deprecated, use ImportFile instead"
+ anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
+ RaiseIfFailed("Import", self.InsertOp)
+ return anObj
+
+ ## Shortcut to ImportFile() for BREP format
#
# @ref swig_Import_Export "Example"
def ImportBREP(self,theFileName):
# Example: see GEOM_TestOthers.py
- return self.Import(theFileName, "BREP")
+ return self.ImportFile(theFileName, "BREP")
- ## Shortcut to Import() for IGES format
+ ## Shortcut to ImportFile() for IGES format
#
# @ref swig_Import_Export "Example"
def ImportIGES(self,theFileName):
# Example: see GEOM_TestOthers.py
- return self.Import(theFileName, "IGES")
+ return self.ImportFile(theFileName, "IGES")
## Return length unit from given IGES file
#
# @ref swig_Import_Export "Example"
def GetIGESUnit(self,theFileName):
# Example: see GEOM_TestOthers.py
- anObj = self.InsertOp.Import(theFileName, "IGES_UNIT")
+ anObj = self.InsertOp.ImportFile(theFileName, "IGES_UNIT")
#RaiseIfFailed("Import", self.InsertOp)
# recieve name using returned vertex
UnitName = "M"
- vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
+ if anObj.GetShapeType() == GEOM.VERTEX:
+ vertices = [anObj]
+ else:
+ vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
if len(vertices)>0:
p = self.PointCoordinates(vertices[0])
if abs(p[0]-0.01) < 1.e-6:
UnitName = "MM"
return UnitName
- ## Shortcut to Import() for STEP format
+ ## Shortcut to ImportFile() for STEP format
#
# @ref swig_Import_Export "Example"
def ImportSTEP(self,theFileName):
# Example: see GEOM_TestOthers.py
- return self.Import(theFileName, "STEP")
+ return self.ImportFile(theFileName, "STEP")
## Export the given shape into a file with given name.
# @param theObject Shape to be stored in the file.
# @return New GEOM_Object, containing the found vertex.
#
# @ref swig_GetPoint "Example"
- def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
+ def GetPoint(self, theShape, theX, theY, theZ, theEpsilon):
# Example: see GEOM_TestOthers.py
anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
RaiseIfFailed("GetPoint", self.BlocksOp)
return anObj
+ ## Find a vertex of the given shape, which has minimal distance to the given point.
+ # @param theShape Any shape.
+ # @param thePoint Point, close to the desired vertex.
+ # @return New GEOM_Object, containing the found vertex.
+ #
+ # @ref swig_GetVertexNearPoint "Example"
+ def GetVertexNearPoint(self, theShape, thePoint):
+ # Example: see GEOM_TestOthers.py
+ anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
+ RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
+ return anObj
+
## Get an edge, found in the given shape by two given vertices.
# @param theShape Block or a compound of blocks.
# @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
# @return New GEOM_Object, containing the found edge.
#
- # @ref swig_todo "Example"
- def GetEdge(self,theShape, thePoint1, thePoint2):
+ # @ref swig_GetEdge "Example"
+ def GetEdge(self, theShape, thePoint1, thePoint2):
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
RaiseIfFailed("GetEdge", self.BlocksOp)
# @return New GEOM_Object, containing the found edge.
#
# @ref swig_GetEdgeNearPoint "Example"
- def GetEdgeNearPoint(self,theShape, thePoint):
+ def GetEdgeNearPoint(self, theShape, thePoint):
# Example: see GEOM_TestOthers.py
anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
# @return New GEOM_Object, containing the found face.
#
# @ref swig_GetFaceNearPoint "Example"
- def GetFaceNearPoint(self,theShape, thePoint):
+ def GetFaceNearPoint(self, theShape, thePoint):
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
return anObj
+ ## Find all subshapes of type \a theShapeType of the given shape,
+ # which have minimal distance to the given point.
+ # @param theShape Any shape.
+ # @param thePoint Point, close to the desired shape.
+ # @param theShapeType Defines what kind of subshapes is searched.
+ # @param theTolerance The tolerance for distances comparison. All shapes
+ # with distances to the given point in interval
+ # [minimal_distance, minimal_distance + theTolerance] will be gathered.
+ # @return New GEOM_Object, containing a group of all found shapes.
+ #
+ # @ref swig_GetShapesNearPoint "Example"
+ def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07):
+ # Example: see GEOM_TestOthers.py
+ anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
+ RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
+ return anObj
+
# end of l3_blocks_op
## @}
# Unite faces and edges, sharing one surface. It means that
# this faces must have references to one C++ surface object (handle).
# @param theShape The compound or single solid to remove irregular edges from.
- # @param theOptimumNbFaces If more than zero, unite faces only for those solids,
- # that have more than theOptimumNbFaces faces. If zero, unite faces always,
- # regardsless their quantity in the solid. If negative (the default value),
- # do not unite faces at all. For blocks repairing recommended value is 6.
+ # @param doUnionFaces If True, then unite faces. If False (the default value),
+ # do not unite faces.
# @return Improved shape.
#
# @ref swig_RemoveExtraEdges "Example"
- def RemoveExtraEdges(self,theShape,theOptimumNbFaces=-1):
+ def RemoveExtraEdges(self, theShape, doUnionFaces=False):
# Example: see GEOM_TestOthers.py
- anObj = self.BlocksOp.RemoveExtraEdges(theShape,theOptimumNbFaces)
+ nbFacesOptimum = -1 # -1 means do not unite faces
+ if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
+ anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
return anObj
def AddObject(self,theGroup, theSubShapeID):
# Example: see GEOM_TestOthers.py
self.GroupOp.AddObject(theGroup, theSubShapeID)
- RaiseIfFailed("AddObject", self.GroupOp)
+ if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT":
+ RaiseIfFailed("AddObject", self.GroupOp)
+ pass
pass
## Removes a sub object with ID \a theSubShapeId from the group
RaiseIfFailed("GetType", self.GroupOp)
return aType
+ ## Convert a type of geom object from id to string value
+ # @param theId is a GEOM obect type id.
+ #
+ # @ref swig_GetType "Example"
+ def ShapeIdToType(self, theId):
+ if theId == 0:
+ return "COPY"
+ if theId == 1:
+ return "IMPORT"
+ if theId == 2:
+ return "POINT"
+ if theId == 3:
+ return "VECTOR"
+ if theId == 4:
+ return "PLANE"
+ if theId == 5:
+ return "LINE"
+ if theId == 6:
+ return "TORUS"
+ if theId == 7:
+ return "BOX"
+ if theId == 8:
+ return "CYLINDER"
+ if theId == 9:
+ return "CONE"
+ if theId == 10:
+ return "SPHERE"
+ if theId == 11:
+ return "PRISM"
+ if theId == 12:
+ return "REVOLUTION"
+ if theId == 13:
+ return "BOOLEAN"
+ if theId == 14:
+ return "PARTITION"
+ if theId == 15:
+ return "POLYLINE"
+ if theId == 16:
+ return "CIRCLE"
+ if theId == 17:
+ return "SPLINE"
+ if theId == 18:
+ return "ELLIPSE"
+ if theId == 19:
+ return "CIRC_ARC"
+ if theId == 20:
+ return "FILLET"
+ if theId == 21:
+ return "CHAMFER"
+ if theId == 22:
+ return "EDGE"
+ if theId == 23:
+ return "WIRE"
+ if theId == 24:
+ return "FACE"
+ if theId == 25:
+ return "SHELL"
+ if theId == 26:
+ return "SOLID"
+ if theId == 27:
+ return "COMPOUND"
+ if theId == 28:
+ return "SUBSHAPE"
+ if theId == 29:
+ return "PIPE"
+ if theId == 30:
+ return "ARCHIMEDE"
+ if theId == 31:
+ return "FILLING"
+ if theId == 32:
+ return "EXPLODE"
+ if theId == 33:
+ return "GLUED"
+ if theId == 34:
+ return "SKETCHER"
+ if theId == 35:
+ return "CDG"
+ if theId == 36:
+ return "FREE_BOUNDS"
+ if theId == 37:
+ return "GROUP"
+ if theId == 38:
+ return "BLOCK"
+ if theId == 39:
+ return "MARKER"
+ if theId == 40:
+ return "THRUSECTIONS"
+ if theId == 41:
+ return "COMPOUNDFILTER"
+ if theId == 42:
+ return "SHAPES_ON_SHAPE"
+ if theId == 43:
+ return "ELLIPSE_ARC"
+ if theId == 44:
+ return "3DSKETCHER"
+ if theId == 45:
+ return "FILLET_2D"
+ if theId == 46:
+ return "FILLET_1D"
+ return "Shape Id not exist."
+
## Returns a main shape associated with the group
# @param theGroup is a GEOM group for which a main shape object is requested
# @return a GEOM object which is a main shape for theGroup
# end of l3_groups
## @}
+ ## @addtogroup l4_advanced
+ ## @{
+
+ ## Create a T-shape object with specified caracteristics for the main
+ # and the incident pipes (radius, width, half-length).
+ # The extremities of the main pipe are located on junctions points P1 and P2.
+ # The extremity of the incident pipe is located on junction point P3.
+ # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
+ # the main plane of the T-shape is XOY.
+ # @param theR1 Internal radius of main pipe
+ # @param theW1 Width of main pipe
+ # @param theL1 Half-length of main pipe
+ # @param theR2 Internal radius of incident pipe (R2 < R1)
+ # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ # @param theL2 Half-length of incident pipe
+ # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
+ # @param theP1 1st junction point of main pipe
+ # @param theP2 2nd junction point of main pipe
+ # @param theP3 Junction point of incident pipe
+ # @return List of GEOM_Objects, containing the created shape and propagation groups.
+ #
+ # @ref tui_creation_pipetshape "Example"
+ def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+ theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
+ if (theP1 and theP2 and theP3):
+ anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3)
+ else:
+ anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh)
+ RaiseIfFailed("MakePipeTShape", self.AdvOp)
+ if Parameters: anObj[0].SetParameters(Parameters)
+ return anObj
+
+ ## Create a T-shape object with chamfer and with specified caracteristics for the main
+ # and the incident pipes (radius, width, half-length). The chamfer is
+ # created on the junction of the pipes.
+ # The extremities of the main pipe are located on junctions points P1 and P2.
+ # The extremity of the incident pipe is located on junction point P3.
+ # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
+ # the main plane of the T-shape is XOY.
+ # @param theR1 Internal radius of main pipe
+ # @param theW1 Width of main pipe
+ # @param theL1 Half-length of main pipe
+ # @param theR2 Internal radius of incident pipe (R2 < R1)
+ # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ # @param theL2 Half-length of incident pipe
+ # @param theH Height of the chamfer.
+ # @param theW Width of the chamfer.
+ # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
+ # @param theP1 1st junction point of main pipe
+ # @param theP2 2nd junction point of main pipe
+ # @param theP3 Junction point of incident pipe
+ # @return List of GEOM_Objects, containing the created shape and propagation groups.
+ #
+ # @ref tui_creation_pipetshape "Example"
+ def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+ theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW)
+ if (theP1 and theP2 and theP3):
+ anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3)
+ else:
+ anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh)
+ RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp)
+ if Parameters: anObj[0].SetParameters(Parameters)
+ return anObj
+
+ ## Create a T-shape object with fillet and with specified caracteristics for the main
+ # and the incident pipes (radius, width, half-length). The fillet is
+ # created on the junction of the pipes.
+ # The extremities of the main pipe are located on junctions points P1 and P2.
+ # The extremity of the incident pipe is located on junction point P3.
+ # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
+ # the main plane of the T-shape is XOY.
+ # @param theR1 Internal radius of main pipe
+ # @param theW1 Width of main pipe
+ # @param theL1 Half-length of main pipe
+ # @param theR2 Internal radius of incident pipe (R2 < R1)
+ # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ # @param theL2 Half-length of incident pipe
+ # @param theRF Radius of curvature of fillet.
+ # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
+ # @param theP1 1st junction point of main pipe
+ # @param theP2 2nd junction point of main pipe
+ # @param theP3 Junction point of incident pipe
+ # @return List of GEOM_Objects, containing the created shape and propagation groups.
+ #
+ # @ref tui_creation_pipetshape "Example"
+ def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+ theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF)
+ if (theP1 and theP2 and theP3):
+ anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3)
+ else:
+ anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh)
+ RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp)
+ if Parameters: anObj[0].SetParameters(Parameters)
+ return anObj
+
+ #@@ insert new functions before this line @@ do not remove this line @@#
+
+ # end of l4_advanced
+ ## @}
+
## Create a copy of the given object
# @ingroup l1_geompy_auxiliary
#
def addPath(self,Path):
if (sys.path.count(Path) < 1):
sys.path.append(Path)
+ pass
+ pass
+
+ ## Load marker texture from the file
+ # @param Path a path to the texture file
+ # @return unique texture identifier
+ # @ingroup l1_geompy_auxiliary
+ def LoadTexture(self, Path):
+ # Example: see GEOM_TestAll.py
+ ID = self.InsertOp.LoadTexture(Path)
+ RaiseIfFailed("LoadTexture", self.InsertOp)
+ return ID
+
+ ## Get entry of the object
+ # @param obj geometry object
+ # @return unique object identifier
+ # @ingroup l1_geompy_auxiliary
+ def getObjectID(self, obj):
+ ID = ""
+ entry = salome.ObjectToID(obj)
+ if entry is not None:
+ lst = entry.split(":")
+ if len(lst) > 0:
+ ID = lst[-1] # -1 means last item in the list
+ return "GEOM_" + ID
+ return ID
+
+
+
+ ## Add marker texture. @a Width and @a Height parameters
+ # specify width and height of the texture in pixels.
+ # If @a RowData is @c True, @a Texture parameter should represent texture data
+ # packed into the byte array. If @a RowData is @c False (default), @a Texture
+ # parameter should be unpacked string, in which '1' symbols represent opaque
+ # pixels and '0' represent transparent pixels of the texture bitmap.
+ #
+ # @param Width texture width in pixels
+ # @param Height texture height in pixels
+ # @param Texture texture data
+ # @param RowData if @c True, @a Texture data are packed in the byte stream
+ # @ingroup l1_geompy_auxiliary
+ def AddTexture(self, Width, Height, Texture, RowData=False):
+ # Example: see GEOM_TestAll.py
+ if not RowData: Texture = PackData(Texture)
+ ID = self.InsertOp.AddTexture(Width, Height, Texture)
+ RaiseIfFailed("AddTexture", self.InsertOp)
+ return ID
import omniORB
#Register the new proxy for GEOM_Gen