return ""
return aShape.GetStudyEntry()
+# -----------------------------------------------------------------------------
+# Raise an Error if Operation is Failed
+# -----------------------------------------------------------------------------
+def RaiseIfFailed (method_name, operation):
+ if operation.IsDone() == 0:
+ raise RuntimeError, method_name + " : " + operation.GetErrorCode()
+
# -----------------------------------------------------------------------------
# enumeration ShapeType as a dictionary
# -----------------------------------------------------------------------------
# Example: see GEOM_TestAll.py
def MakeVertex(theX, theY, theZ):
anObj = BasicOp.MakePointXYZ(theX, theY, theZ)
- if BasicOp.IsDone() == 0:
- print "MakePointXYZ : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakePointXYZ", BasicOp)
return anObj
## Create a point, distant from the referenced point
# Example: see GEOM_TestAll.py
def MakeVertexWithRef(theReference, theX, theY, theZ):
anObj = BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
- if BasicOp.IsDone() == 0:
- print "MakePointWithReference : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakePointWithReference", BasicOp)
return anObj
## Create a point, corresponding to the given parameter on the given curve.
# Example: see GEOM_TestAll.py
def MakeVertexOnCurve(theRefCurve, theParameter):
anObj = BasicOp.MakePointOnCurve(theRefCurve, theParameter)
- if BasicOp.IsDone() == 0:
- print "MakePointOnCurve : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakePointOnCurve", BasicOp)
return anObj
## Create a tangent, corresponding to the given parameter on the given curve.
# @return New GEOM_Object, containing the created tangent.
def MakeTangentOnCurve(theRefCurve, theParameter):
anObj = BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
- if BasicOp.IsDone() == 0:
- print "MakeTangentOnCurve : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakeTangentOnCurve", BasicOp)
return anObj
## Create a vector with the given components.
# Example: see GEOM_TestAll.py
def MakeVectorDXDYDZ(theDX, theDY, theDZ):
anObj = BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
- if BasicOp.IsDone() == 0:
- print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakeVectorDXDYDZ", BasicOp)
return anObj
## Create a vector between two points.
# Example: see GEOM_TestAll.py
def MakeVector(thePnt1, thePnt2):
anObj = BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
- if BasicOp.IsDone() == 0:
- print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakeVectorTwoPnt", BasicOp)
return anObj
## Create a line, passing through the given point
# Example: see GEOM_TestAll.py
def MakeLine(thePnt, theDir):
anObj = BasicOp.MakeLine(thePnt, theDir)
- if BasicOp.IsDone() == 0:
- print "MakeLine : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakeLine", BasicOp)
return anObj
## Create a line, passing through the given points
# Example: see GEOM_TestAll.py
def MakeLineTwoPnt(thePnt1, thePnt2):
anObj = BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
- if BasicOp.IsDone() == 0:
- print "MakeLineTwoPnt : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakeLineTwoPnt", BasicOp)
return anObj
## Create a plane, passing through the given point
# Example: see GEOM_TestAll.py
def MakePlane(thePnt, theVec, theTrimSize):
anObj = BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
- if BasicOp.IsDone() == 0:
- print "MakePlanePntVec : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakePlanePntVec", BasicOp)
return anObj
## Create a plane, passing through the three given points
# Example: see GEOM_TestAll.py
def MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize):
anObj = BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
- if BasicOp.IsDone() == 0:
- print "MakePlaneThreePnt : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakePlaneThreePnt", BasicOp)
return anObj
## Create a plane, similar to the existing one, but with another size of representing face.
# Example: see GEOM_TestAll.py
def MakePlaneFace(theFace, theTrimSize):
anObj = BasicOp.MakePlaneFace(theFace, theTrimSize)
- if BasicOp.IsDone() == 0:
- print "MakePlaneFace : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakePlaneFace", BasicOp)
return anObj
## Create a local coordinate system.
# Example: see GEOM_TestAll.py
def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
- if BasicOp.IsDone() == 0:
- print "MakeMarker : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakeMarker", BasicOp)
return anObj
## Create a local coordinate system.
anObj = BasicOp.MakeMarker( O[0], O[1], O[2],
OXOY[0], OXOY[1], OXOY[2],
OXOY[3], OXOY[4], OXOY[5], )
- if BasicOp.IsDone() == 0:
- print "MakeMarker : ", BasicOp.GetErrorCode()
+ RaiseIfFailed("MakeMarker", BasicOp)
return anObj
# -----------------------------------------------------------------------------
# Example: see GEOM_TestAll.py
def MakeArc(thePnt1, thePnt2, thePnt3):
anObj = CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
- if CurvesOp.IsDone() == 0:
- print "MakeArc : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeArc", CurvesOp)
return anObj
## Create an arc of circle from a center and 2 points.
# Example: see GEOM_TestAll.py
def MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense):
anObj = CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense)
- if CurvesOp.IsDone() == 0:
- print "MakeArcCenter : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeArcCenter", CurvesOp)
return anObj
## Create a circle with given center, normal vector and radius.
# Example: see GEOM_TestAll.py
def MakeCircle(thePnt, theVec, theR):
anObj = CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
- if CurvesOp.IsDone() == 0:
- print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeCirclePntVecR", CurvesOp)
return anObj
## Create a circle, passing through three given points
# Example: see GEOM_TestAll.py
def MakeCircleThreePnt(thePnt1, thePnt2, thePnt3):
anObj = CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
- if CurvesOp.IsDone() == 0:
- print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeCircleThreePnt", CurvesOp)
return anObj
## Create a circle, with given point1 as center,
# Example: see GEOM_example6.py
def MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3):
anObj = CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
- if CurvesOp.IsDone() == 0:
- print "MakeCircleCenter2Pnt : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeCircleCenter2Pnt", CurvesOp)
return anObj
## Create an ellipse with given center, normal vector and radiuses.
# Example: see GEOM_TestAll.py
def MakeEllipse(thePnt, theVec, theRMajor, theRMinor):
anObj = CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
- if CurvesOp.IsDone() == 0:
- print "MakeEllipse : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeEllipse", CurvesOp)
return anObj
## Create a polyline on the set of points.
# Example: see GEOM_TestAll.py
def MakePolyline(thePoints):
anObj = CurvesOp.MakePolyline(thePoints)
- if CurvesOp.IsDone() == 0:
- print "MakePolyline : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakePolyline", CurvesOp)
return anObj
## Create bezier curve on the set of points.
# Example: see GEOM_TestAll.py
def MakeBezier(thePoints):
anObj = CurvesOp.MakeSplineBezier(thePoints)
- if CurvesOp.IsDone() == 0:
- print "MakeSplineBezier : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeSplineBezier", CurvesOp)
return anObj
## Create B-Spline curve on the set of points.
# Example: see GEOM_TestAll.py
def MakeInterpol(thePoints):
anObj = CurvesOp.MakeSplineInterpolation(thePoints)
- if CurvesOp.IsDone() == 0:
- print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeSplineInterpolation", CurvesOp)
return anObj
## Create a sketcher (wire or face), following the textual description,
# Example: see GEOM_TestAll.py
def MakeSketcher(theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
anObj = CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
- if CurvesOp.IsDone() == 0:
- print "MakeSketcher : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeSketcher", CurvesOp)
return anObj
## Create a sketcher (wire or face), following the textual description,
# @return New GEOM_Object, containing the created wire.
def MakeSketcherOnPlane(theCommand, theWorkingPlane):
anObj = CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
- if CurvesOp.IsDone() == 0:
- print "MakeSketcher : ", CurvesOp.GetErrorCode()
+ RaiseIfFailed("MakeSketcher", CurvesOp)
return anObj
# -----------------------------------------------------------------------------
# Example: see GEOM_TestAll.py
def MakeBoxDXDYDZ(theDX, theDY, theDZ):
anObj = PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
- if PrimOp.IsDone() == 0:
- print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeBoxDXDYDZ", PrimOp)
return anObj
## Create a box with two specified opposite vertices,
# Example: see GEOM_TestAll.py
def MakeBoxTwoPnt(thePnt1, thePnt2):
anObj = PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
- if PrimOp.IsDone() == 0:
- print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeBoxTwoPnt", PrimOp)
return anObj
## Create a cylinder with given base point, axis, radius and height.
# Example: see GEOM_TestAll.py
def MakeCylinder(thePnt, theAxis, theR, theH):
anObj = PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
- if PrimOp.IsDone() == 0:
- print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeCylinderPntVecRH", PrimOp)
return anObj
## Create a cylinder with given radius and height at
# Example: see GEOM_TestAll.py
def MakeCylinderRH(theR, theH):
anObj = PrimOp.MakeCylinderRH(theR, theH)
- if PrimOp.IsDone() == 0:
- print "MakeCylinderRH : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeCylinderRH", PrimOp)
return anObj
## Create a sphere with given center and radius.
# Example: see GEOM_TestAll.py
def MakeSpherePntR(thePnt, theR):
anObj = PrimOp.MakeSpherePntR(thePnt, theR)
- if PrimOp.IsDone() == 0:
- print "MakeSpherePntR : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeSpherePntR", PrimOp)
return anObj
## Create a sphere with given center and radius.
# Example: see GEOM_TestAll.py
def MakeSphereR(theR):
anObj = PrimOp.MakeSphereR(theR)
- if PrimOp.IsDone() == 0:
- print "MakeSphereR : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeSphreR", PrimOp)
return anObj
## Create a cone with given base point, axis, height and radiuses.
# Example: see GEOM_TestAll.py
def MakeCone(thePnt, theAxis, theR1, theR2, theH):
anObj = PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
- if PrimOp.IsDone() == 0:
- print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeConePntVecR1R2H", PrimOp)
return anObj
## Create a cone with given height and radiuses at
# Example: see GEOM_TestAll.py
def MakeConeR1R2H(theR1, theR2, theH):
anObj = PrimOp.MakeConeR1R2H(theR1, theR2, theH)
- if PrimOp.IsDone() == 0:
- print "MakeConeR1R2H : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeConeR1R2H", PrimOp)
return anObj
## Create a torus with given center, normal vector and radiuses.
# Example: see GEOM_TestAll.py
def MakeTorus(thePnt, theVec, theRMajor, theRMinor):
anObj = PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
- if PrimOp.IsDone() == 0:
- print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeTourusPntVecRR", PrimOp)
return anObj
## Create a torus with given radiuses at the origin of coordinate system.
# Example: see GEOM_TestAll.py
def MakeTorusRR(theRMajor, theRMinor):
anObj = PrimOp.MakeTorusRR(theRMajor, theRMinor)
- if PrimOp.IsDone() == 0:
- print "MakeTorusRR : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeTourusRR", PrimOp)
return anObj
## Create a shape by extrusion of the base shape along a vector, defined by two points.
# Example: see GEOM_TestAll.py
def MakePrism(theBase, thePoint1, thePoint2):
anObj = PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
- if PrimOp.IsDone() == 0:
- print "MakePrismTwoPnt : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakePrismTwoPnt", PrimOp)
return anObj
## Create a shape by extrusion of the base shape along the vector,
# Example: see GEOM_TestAll.py
def MakePrismVecH(theBase, theVec, theH):
anObj = PrimOp.MakePrismVecH(theBase, theVec, theH)
- if PrimOp.IsDone() == 0:
- print "MakePrismVecH : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakePrismVecH", PrimOp)
return anObj
## Create a shape by extrusion of the base shape along
# Example: see GEOM_TestAll.py
def MakePipe(theBase, thePath):
anObj = PrimOp.MakePipe(theBase, thePath)
- if PrimOp.IsDone() == 0:
- print "MakePipe : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakePipe", PrimOp)
return anObj
## Create a shape by revolution of the base shape around the axis
# Example: see GEOM_TestAll.py
def MakeRevolution(theBase, theAxis, theAngle):
anObj = PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
- if PrimOp.IsDone() == 0:
- print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeRevolutionAxisAngle", PrimOp)
return anObj
## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
# Example: see GEOM_TestAll.py
def MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled):
anObj = PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
- if PrimOp.IsDone() == 0:
- print "MakeThruSections : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeThruSections", PrimOp)
return anObj
## Create a shape by extrusion of the profile shape along
#
def MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithContact,theWithCorrection):
anObj = PrimOp.MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithContact,theWithCorrection)
- if PrimOp.IsDone() == 0:
- print "MakePipeWithDifferentSections : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakePipeWithDifferentSections", PrimOp)
return anObj
## Create a shape by extrusion of the profile shape along
anObj = PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
theLocations, thePath,
theWithContact, theWithCorrection)
- if PrimOp.IsDone() == 0:
- print "MakePipeWithShellSections : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakePipeWithShellSections", PrimOp)
return anObj
def MakePipeWithShellSectionsBySteps(theSeqBases, theSeqSubBases,
theWithContact, theWithCorrection)
if PrimOp.IsDone() == 0:
print "Problems with pipe creation between ",i," and ",i+1," sections"
- print "MakePipeWithShellSections : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakePipeWithShellSections", PrimOp)
break
else:
print "Pipe between ",i," and ",i+1," sections is OK"
#
def MakePipeShellsWithoutPath(theSeqBases, theLocations):
anObj = PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
- if PrimOp.IsDone() == 0:
- print "MakePipeShellsWithoutPath : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakePipeShellsWithoutPath", PrimOp)
return anObj
# Example: see GEOM_TestAll.py
def MakeEdge(thePnt1, thePnt2):
anObj = ShapesOp.MakeEdge(thePnt1, thePnt2)
- if ShapesOp.IsDone() == 0:
- print "MakeEdge : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeEdge", ShapesOp)
return anObj
## Create a wire from the set of edges and wires.
# Example: see GEOM_TestAll.py
def MakeWire(theEdgesAndWires):
anObj = ShapesOp.MakeWire(theEdgesAndWires)
- if ShapesOp.IsDone() == 0:
- print "MakeWire : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeWire", ShapesOp)
return anObj
## Create a face on the given wire.
# Example: see GEOM_TestAll.py
def MakeFace(theWire, isPlanarWanted):
anObj = ShapesOp.MakeFace(theWire, isPlanarWanted)
- if ShapesOp.IsDone() == 0:
- print "MakeFace : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeFace", ShapesOp)
return anObj
## Create a face on the given wires set.
# Example: see GEOM_TestAll.py
def MakeFaceWires(theWires, isPlanarWanted):
anObj = ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
- if ShapesOp.IsDone() == 0:
- print "MakeFaceWires : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeFaceWires", ShapesOp)
return anObj
## Shortcut to MakeFaceWires()
# Example: see GEOM_TestOthers.py
def MakeFaces(theWires, isPlanarWanted):
anObj = MakeFaceWires(theWires, isPlanarWanted)
+ RaiseIfFailed("MakeFaceWires", ShapesOp)
return anObj
## Create a shell from the set of faces and shells.
# Example: see GEOM_TestAll.py
def MakeShell(theFacesAndShells):
anObj = ShapesOp.MakeShell(theFacesAndShells)
- if ShapesOp.IsDone() == 0:
- print "MakeShell : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeShell", ShapesOp)
return anObj
## Create a solid, bounded by the given shells.
# Example: see GEOM_TestAll.py
def MakeSolid(theShells):
anObj = ShapesOp.MakeSolidShells(theShells)
- if ShapesOp.IsDone() == 0:
- print "MakeSolid : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeSolid", ShapesOp)
return anObj
## Create a compound of the given shapes.
# Example: see GEOM_TestAll.py
def MakeCompound(theShapes):
anObj = ShapesOp.MakeCompound(theShapes)
- if ShapesOp.IsDone() == 0:
- print "MakeCompound : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeCompound", ShapesOp)
return anObj
## Gives quantity of faces in the given shape.
# Example: see GEOM_TestOthers.py
def NumberOfFaces(theShape):
nb_faces = ShapesOp.NumberOfFaces(theShape)
- if ShapesOp.IsDone() == 0:
- print "NumberOfFaces : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("NumberOfFace", ShapesOp)
return nb_faces
## Gives quantity of edges in the given shape.
# Example: see GEOM_TestOthers.py
def NumberOfEdges(theShape):
nb_edges = ShapesOp.NumberOfEdges(theShape)
- if ShapesOp.IsDone() == 0:
- print "NumberOfEdges : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("NumberOfEdges", ShapesOp)
return nb_edges
## Reverses an orientation the given shape.
# Example: see GEOM_TestAll.py
def ChangeOrientation(theShape):
anObj = ShapesOp.ChangeOrientation(theShape)
- if ShapesOp.IsDone() == 0:
- print "ChangeOrientation : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("ChangeOrientation", ShapesOp)
return anObj
## Shortcut to ChangeOrientation()
# Example: see GEOM_TestOthers.py
def GetFreeFacesIDs(theShape):
anIDs = ShapesOp.GetFreeFacesIDs(theShape)
- if ShapesOp.IsDone() == 0:
- print "GetFreeFacesIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetFreeFacesIDs", ShapesOp)
return anIDs
## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
# Example: see GEOM_TestOthers.py
def GetSharedShapes(theShape1, theShape2, theShapeType):
aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
- if ShapesOp.IsDone() == 0:
- print "GetSharedShapes : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetSharedShapes", ShapesOp)
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# Example: see GEOM_TestOthers.py
def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShaepsOnPlane", ShapesOp)
return aList
## Works like the above method, but returns list of sub-shapes indices
# Example: see GEOM_TestOthers.py
def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState):
aList = ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnPlaneIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnPlaneIDs", ShapesOp)
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# Example: see GEOM_TestOthers.py
def GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState):
aList = ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnPlaneWithLocation : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnPlaneWithLocation", ShapesOp)
return aList
## Works like the above method, but returns list of sub-shapes indices
# Example: see GEOM_TestOthers.py
def GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState):
aList = ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnPlaneWithLocationIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", ShapesOp)
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# Example: see GEOM_TestOthers.py
def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnCylinder", ShapesOp)
return aList
## Works like the above method, but returns list of sub-shapes indices
# Example: see GEOM_TestOthers.py
def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState):
aList = ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnCylinderIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnCylinderIDs", ShapesOp)
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# Example: see GEOM_TestOthers.py
def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnSphere", ShapesOp)
return aList
## Works like the above method, but returns list of sub-shapes indices
# Example: see GEOM_TestOthers.py
def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState):
aList = ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnSphereIDs", ShapesOp)
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# Example: see GEOM_TestOthers.py
def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
aList = ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnQuadrangle : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnQuadrangle", ShapesOp)
return aList
## Works like the above method, but returns list of sub-shapes indices
# Example: see GEOM_TestOthers.py
def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnQuadrangleIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnQuadrangleIDs", ShapesOp)
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
#
def GetShapesOnBox(theBox, theShape, theShapeType, theState):
aList = ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnBox : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnBox", ShapesOp)
return aList
## Works like the above method, but returns list of sub-shapes indices
#
def GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState):
aList = ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
- if ShapesOp.IsDone() == 0:
- print "GetShapesOnBoxIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetShapesOnBoxIDs", ShapesOp)
return aList
## Get sub-shape(s) of theShapeWhere, which are
# Example: see GEOM_TestOthers.py
def GetInPlace(theShapeWhere, theShapeWhat):
anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
- if ShapesOp.IsDone() == 0:
- print "GetInPlace : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetInPlace", ShapesOp)
return anObj
## Get sub-shape(s) of \a theShapeWhere, which are
# Example: see GEOM_TestOthers.py
def GetInPlaceByHistory(theShapeWhere, theShapeWhat):
anObj = ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
- if ShapesOp.IsDone() == 0:
- print "GetInPlace : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetInPlace", ShapesOp)
return anObj
## Get sub-shape of theShapeWhere, which is
#
def GetSame(theShapeWhere, theShapeWhat):
anObj = ShapesOp.GetSame(theShapeWhere, theShapeWhat)
- if ShapesOp.IsDone() == 0:
- print "GetSame : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetSame", ShapesOp)
return anObj
# -----------------------------------------------------------------------------
# Example: see GEOM_TestAll.py
def GetSubShapeID(aShape, aSubShape):
anID = LocalOp.GetSubShapeIndex(aShape, aSubShape)
- if LocalOp.IsDone() == 0:
- print "GetSubShapeIndex : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("GetSubShapeIndex", LocalOp)
return anID
# -----------------------------------------------------------------------------
# Example: see GEOM_TestAll.py
def SubShapeAll(aShape, aType):
ListObj = ShapesOp.MakeExplode(aShape,aType,0)
- if ShapesOp.IsDone() == 0:
- print "MakeExplode : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeExplode", ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type.
# @return List of IDs of sub-shapes.
def SubShapeAllIDs(aShape, aType):
ListObj = ShapesOp.SubShapeAllIDs(aShape,aType,0)
- if ShapesOp.IsDone() == 0:
- print "SubShapeAllIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("SubShapeAllIDs", ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type.
# Example: see GEOM_TestAll.py
def SubShapeAllSorted(aShape, aType):
ListObj = ShapesOp.MakeExplode(aShape,aType,1)
- if ShapesOp.IsDone() == 0:
- print "MakeExplode : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("MakeExplode", ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type.
# @return List of IDs of sub-shapes.
def SubShapeAllSortedIDs(aShape, aType):
ListIDs = ShapesOp.SubShapeAllIDs(aShape,aType,1)
- if ShapesOp.IsDone() == 0:
- print "SubShapeAllSortedIDs : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("SubShapeAllSortedIDs", ShapesOp)
return ListIDs
## Obtain a compound of sub-shapes of <aShape>,
# Example: see GEOM_TestHealing.py
def ProcessShape(theShape, theOperators, theParameters, theValues):
anObj = HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
- if HealOp.IsDone() == 0:
- print "ProcessShape : ", HealOp.GetErrorCode()
+ RaiseIfFailed("ProcessShape", HealOp)
return anObj
## Remove faces from the given object (shape).
# Example: see GEOM_TestHealing.py
def SuppressFaces(theObject, theFaces):
anObj = HealOp.SuppressFaces(theObject, theFaces)
- if HealOp.IsDone() == 0:
- print "SuppressFaces : ", HealOp.GetErrorCode()
+ RaiseIfFailed("SuppressFaces", HealOp)
return anObj
## Sewing of some shapes into single shape.
# Example: see MakeSewing() above
def Sew(theObject, theTolerance):
anObj = HealOp.Sew(theObject, theTolerance)
- if HealOp.IsDone() == 0:
- print "Sew : ", HealOp.GetErrorCode()
+ RaiseIfFailed("Sew", HealOp)
return anObj
## Remove internal wires and edges from the given object (face).
# Example: see GEOM_TestHealing.py
def SuppressInternalWires(theObject, theWires):
anObj = HealOp.RemoveIntWires(theObject, theWires)
- if HealOp.IsDone() == 0:
- print "SuppressInternalWires : ", HealOp.GetErrorCode()
+ RaiseIfFailed("SuppressInternalWires", HealOp)
return anObj
## Remove internal closed contours (holes) from the given object.
# Example: see GEOM_TestHealing.py
def SuppressHoles(theObject, theWires):
anObj = HealOp.FillHoles(theObject, theWires)
- if HealOp.IsDone() == 0:
- print "SuppressHoles : ", HealOp.GetErrorCode()
+ RaiseIfFailed("SuppressHoles", HealOp)
return anObj
## Close an open wire.
# Example: see GEOM_TestHealing.py
def CloseContour(theObject, theWires, isCommonVertex):
anObj = HealOp.CloseContour(theObject, theWires, isCommonVertex)
- if HealOp.IsDone() == 0:
- print "CloseContour : ", HealOp.GetErrorCode()
+ RaiseIfFailed("CloseContour", HealOp)
return anObj
## Addition of a point to a given edge object.
# Example: see GEOM_TestHealing.py
def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter):
anObj = HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
- if HealOp.IsDone() == 0:
- print "DivideEdge : ", HealOp.GetErrorCode()
+ RaiseIfFailed("DivideEdge", HealOp)
return anObj
## Change orientation of the given object.
# @update given shape
def ChangeOrientationShell(theObject):
theObject = HealOp.ChangeOrientation(theObject)
- if HealOp.IsDone() == 0:
- print "ChangeOrientation : ", HealOp.GetErrorCode()
+ RaiseIfFailed("ChangeOrientation", HealOp)
## Change orientation of the given object.
# @param theObject Shape to be processed.
# @return New GEOM_Object, containing processed shape.
def ChangeOrientationShellCopy(theObject):
anObj = HealOp.ChangeOrientationCopy(theObject)
- if HealOp.IsDone() == 0:
- print "ChangeOrientation : ", HealOp.GetErrorCode()
+ RaiseIfFailed("ChangeOrientation", HealOp)
return anObj
## Get a list of wires (wrapped in GEOM_Object-s),
# Example: see GEOM_TestHealing.py
def GetFreeBoundary(theObject):
anObj = HealOp.GetFreeBoundary(theObject)
- if HealOp.IsDone() == 0:
- print "GetFreeBoundaries : ", HealOp.GetErrorCode()
+ RaiseIfFailed("GetFreeBoundaries", HealOp)
return anObj
# -----------------------------------------------------------------------------
# Example: see GEOM_TestAll.py
def MakeCopy(theOriginal):
anObj = InsertOp.MakeCopy(theOriginal)
- if InsertOp.IsDone() == 0:
- print "MakeCopy : ", InsertOp.GetErrorCode()
+ RaiseIfFailed("MakeCopy", InsertOp)
return anObj
## Create a filling from the given compound of contours.
# Example: see GEOM_TestAll.py
def MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter):
anObj = PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
- if PrimOp.IsDone() == 0:
- print "MakeFilling : ", PrimOp.GetErrorCode()
+ RaiseIfFailed("MakeFilling", PrimOp)
return anObj
## Replace coincident faces in theShape by one face.
# Example: see GEOM_Spanner.py
def MakeGlueFaces(theShape, theTolerance, doKeepNonSolids=True):
anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
- if ShapesOp.IsDone() == 0:
- print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
+ if anObj is None:
+ raise RuntimeError, "MakeGlueFaces : " + ShapesOp.GetErrorCode()
return anObj
# Example: see GEOM_Spanner.py
def GetGlueFaces(theShape, theTolerance):
anObj = ShapesOp.GetGlueFaces(theShape, theTolerance)
- if ShapesOp.IsDone() == 0:
- print "GetGlueFaces : ", ShapesOp.GetErrorCode()
+ RaiseIfFailed("GetGlueFaces", ShapesOp)
return anObj
# Example: see GEOM_Spanner.py
def MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids=True):
anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
- if ShapesOp.IsDone() == 0:
- print "MakeGlueFacesByList : ", ShapesOp.GetErrorCode()
+ if anObj is None:
+ raise RuntimeError, "MakeGlueFacesByList : " + ShapesOp.GetErrorCode()
return anObj
# Example: see GEOM_TestAll.py
def MakeBoolean(theShape1, theShape2, theOperation):
anObj = BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
- if BoolOp.IsDone() == 0:
- print "MakeBoolean : ", BoolOp.GetErrorCode()
+ RaiseIfFailed("MakeBoolean", BoolOp)
return anObj
## Shortcut to MakeBoolean(s1, s2, 1)
ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes);
- if BoolOp.IsDone() == 0:
- print "MakePartition : ", BoolOp.GetErrorCode()
+ RaiseIfFailed("MakePartition", BoolOp)
return anObj
## Perform partition operation.
ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes);
- if BoolOp.IsDone() == 0:
- print "MakePartitionNonSelfIntersectedShape : ", BoolOp.GetErrorCode()
+ RaiseIfFailed("MakePartitionNonSelfIntersectedShape", BoolOp)
return anObj
## Shortcut to MakePartition()
# Example: see GEOM_TestAll.py
def MakeHalfPartition(theShape, thePlane):
anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
- if BoolOp.IsDone() == 0:
- print "MakeHalfPartition : ", BoolOp.GetErrorCode()
+ RaiseIfFailed("MakeHalfPartition", BoolOp)
return anObj
# -----------------------------------------------------------------------------
# Example: see GEOM_TestAll.py
def MakeTranslationTwoPoints(theObject, thePoint1, thePoint2):
anObj = TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
- if TrsfOp.IsDone() == 0:
- print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("TranslateTwoPointsCopy", TrsfOp)
return anObj
## Translate the given object along the vector, specified
# Example: see GEOM_TestAll.py
def MakeTranslation(theObject, theDX, theDY, theDZ):
anObj = TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
- if TrsfOp.IsDone() == 0:
- print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("TranslateDXDYDZCopy", TrsfOp)
return anObj
## Translate the given object along the given vector,
# Example: see GEOM_TestAll.py
def MakeTranslationVector(theObject, theVector):
anObj = TrsfOp.TranslateVectorCopy(theObject, theVector)
- if TrsfOp.IsDone() == 0:
- print "TranslateVectorCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("TranslateVectorCopy", TrsfOp)
return anObj
## Rotate the given object around the given axis
# Example: see GEOM_TestAll.py
def MakeRotation(theObject, theAxis, theAngle):
anObj = TrsfOp.RotateCopy(theObject, theAxis, theAngle)
- if TrsfOp.IsDone() == 0:
- print "RotateCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("RotateCopy", TrsfOp)
return anObj
## Rotate given object around vector perpendicular to plane
# Example: see GEOM_TestAll.py
def MakeRotationThreePoints(theObject, theCentPoint, thePoint1, thePoint2):
anObj = TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
- if TrsfOp.IsDone() == 0:
- print "RotateThreePointsCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("RotateThreePointsCopy", TrsfOp)
return anObj
## Scale the given object by the factor, creating its copy before the scaling.
# Example: see GEOM_TestAll.py
def MakeScaleTransform(theObject, thePoint, theFactor):
anObj = TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
- if TrsfOp.IsDone() == 0:
- print "ScaleShapeCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("ScaleShapeCopy", TrsfOp)
return anObj
## Create an object, symmetrical
# Example: see GEOM_TestAll.py
def MakeMirrorByPlane(theObject, thePlane):
anObj = TrsfOp.MirrorPlaneCopy(theObject, thePlane)
- if TrsfOp.IsDone() == 0:
- print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("MirrorPlaneCopy", TrsfOp)
return anObj
## Create an object, symmetrical
# Example: see GEOM_TestAll.py
def MakeMirrorByAxis(theObject, theAxis):
anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis)
- if TrsfOp.IsDone() == 0:
- print "MirrorAxisCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("MirrorAxisCopy", TrsfOp)
return anObj
## Create an object, symmetrical
# Example: see GEOM_TestAll.py
def MakeMirrorByPoint(theObject, thePoint):
anObj = TrsfOp.MirrorPointCopy(theObject, thePoint)
- if TrsfOp.IsDone() == 0:
- print "MirrorPointCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("MirrorPointCopy", TrsfOp)
return anObj
## Modify the Location of the given object by LCS,
# Example: see GEOM_TestAll.py
def MakePosition(theObject, theStartLCS, theEndLCS):
anObj = TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
- if TrsfOp.IsDone() == 0:
- print "PositionShapeCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("PositionShapeCopy", TrsfOp)
return anObj
## Create new object as offset of the given one.
# Example: see GEOM_TestAll.py
def MakeOffset(theObject, theOffset):
anObj = TrsfOp.OffsetShapeCopy(theObject, theOffset)
- if TrsfOp.IsDone() == 0:
- print "OffsetShapeCopy : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("OffsetShapeCopy", TrsfOp)
return anObj
# -----------------------------------------------------------------------------
# Example: see GEOM_TestAll.py
def MakeMultiTranslation1D(theObject, theVector, theStep, theNbTimes):
anObj = TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
- if TrsfOp.IsDone() == 0:
- print "MultiTranslate1D : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("Multitranslate1D", TrsfOp)
return anObj
## Conseqently apply two specified translations to theObject specified number of times.
theVector2, theStep2, theNbTimes2):
anObj = TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
theVector2, theStep2, theNbTimes2)
- if TrsfOp.IsDone() == 0:
- print "MultiTranslate2D : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("Multitranslate2D", TrsfOp)
return anObj
## Rotate the given object around the given axis a given number times.
# Example: see GEOM_TestAll.py
def MultiRotate1D(theObject, theAxis, theNbTimes):
anObj = TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
- if TrsfOp.IsDone() == 0:
- print "MultiRotate1D : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("MultiRotate1D", TrsfOp)
return anObj
## Rotate the given object around the
# Example: see GEOM_TestAll.py
def MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
anObj = TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
- if TrsfOp.IsDone() == 0:
- print "MultiRotate2D : ", TrsfOp.GetErrorCode()
+ RaiseIfFailed("MultiRotate2D", TrsfOp)
return anObj
## The same, as MultiRotate1D(), but axis is given by direction and point
# Example: see GEOM_TestOthers.py
def MakeFilletAll(theShape, theR):
anObj = LocalOp.MakeFilletAll(theShape, theR)
- if LocalOp.IsDone() == 0:
- print "MakeFilletAll : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeFilletAll", LocalOp)
return anObj
## Perform a fillet on the specified edges/faces of the given shape
anObj = LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
else:
anObj = LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
- if LocalOp.IsDone() == 0:
- print "MakeFillet : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeFillet", LocalOp)
return anObj
+
## The same but with two Fillet Radius R1 and R2
def MakeFilletR1R2(theShape, theR1, theR2, theShapeType, theListShapes):
anObj = None
anObj = LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
else:
anObj = LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
- if LocalOp.IsDone() == 0:
- print "MakeFilletR1R2 : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeFilletR1R2", LocalOp)
return anObj
## Perform a symmetric chamfer on all edges of the given shape.
# Example: see GEOM_TestOthers.py
def MakeChamferAll(theShape, theD):
anObj = LocalOp.MakeChamferAll(theShape, theD)
- if LocalOp.IsDone() == 0:
- print "MakeChamferAll : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeChamferAll", LocalOp)
return anObj
## Perform a chamfer on edges, common to the specified faces,
# Example: see GEOM_TestAll.py
def MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2):
anObj = LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
- if LocalOp.IsDone() == 0:
- print "MakeChamferEdge : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeChamferEdge", LocalOp)
return anObj
+
## The Same chamfer but with params theD is chamfer lenght and
# theAngle is Angle of chamfer (angle in radians)
def MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2):
anObj = LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
- if LocalOp.IsDone() == 0:
- print "MakeChamferEdgeAD : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeChamferEdgeAD", LocalOp)
return anObj
## Perform a chamfer on all edges of the specified faces,
# Example: see GEOM_TestAll.py
def MakeChamferFaces(theShape, theD1, theD2, theFaces):
anObj = LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
- if LocalOp.IsDone() == 0:
- print "MakeChamferFaces : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeChamferFaces", LocalOp)
return anObj
+
## The Same chamfer but with params theD is chamfer lenght and
# theAngle is Angle of chamfer (angle in radians)
def MakeChamferFacesAD(theShape, theD, theAngle, theFaces):
anObj = LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
- if LocalOp.IsDone() == 0:
- print "MakeChamferFacesAD : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeChamferFacesAD", LocalOp)
return anObj
## Perform a chamfer on edges,
# Example:
def MakeChamferEdges(theShape, theD1, theD2, theEdges):
anObj = LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
- if LocalOp.IsDone() == 0:
- print "MakeChamferEdges : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeChamferEdges", LocalOp)
return anObj
+
## The Same chamfer but with params theD is chamfer lenght and
# theAngle is Angle of chamfer (angle in radians)
def MakeChamferEdgesAD(theShape, theD, theAngle, theEdges):
anObj = LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
- if LocalOp.IsDone() == 0:
- print "MakeChamferEdgesAD : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeChamferEdgesAD", LocalOp)
return anObj
## Shortcut to MakeChamferEdge() and MakeChamferFaces()
# Example: see GEOM_TestAll.py
def Archimede(theShape, theWeight, theWaterDensity, theMeshDeflection):
anObj = LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
- if LocalOp.IsDone() == 0:
- print "MakeArchimede : ", LocalOp.GetErrorCode()
+ RaiseIfFailed("MakeArchimede", LocalOp)
return anObj
# -----------------------------------------------------------------------------
# Example: see GEOM_TestMeasures.py
def PointCoordinates(Point):
aTuple = MeasuOp.PointCoordinates(Point)
- if MeasuOp.IsDone() == 0:
- print "PointCoordinates : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("PointCoordinates", MeasuOp)
return aTuple
## Get summarized length of all wires,
# Example: see GEOM_TestMeasures.py
def BasicProperties(theShape):
aTuple = MeasuOp.GetBasicProperties(theShape)
- if MeasuOp.IsDone() == 0:
- print "BasicProperties : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("BasicProperties", MeasuOp)
return aTuple
## Get parameters of bounding box of the given shape
# Example: see GEOM_TestMeasures.py
def BoundingBox(theShape):
aTuple = MeasuOp.GetBoundingBox(theShape)
- if MeasuOp.IsDone() == 0:
- print "BoundingBox : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("BoundingBox", MeasuOp)
return aTuple
## Get inertia matrix and moments of inertia of theShape.
# Example: see GEOM_TestMeasures.py
def Inertia(theShape):
aTuple = MeasuOp.GetInertia(theShape)
- if MeasuOp.IsDone() == 0:
- print "Inertia : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("Inertia", MeasuOp)
return aTuple
## Get minimal distance between the given shapes.
# Example: see GEOM_TestMeasures.py
def MinDistance(theShape1, theShape2):
aTuple = MeasuOp.GetMinDistance(theShape1, theShape2)
- if MeasuOp.IsDone() == 0:
- print "MinDistance : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("GetMinDistance", MeasuOp)
return aTuple[0]
## Get minimal distance between the given shapes.
# Example: see GEOM_TestMeasures.py
def MinDistanceComponents(theShape1, theShape2):
aTuple = MeasuOp.GetMinDistance(theShape1, theShape2)
- if MeasuOp.IsDone() == 0:
- print "MinDistanceComponents : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("MinDistanceComponents", MeasuOp)
aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
return aRes
# Example: see GEOM_TestMeasures.py
def GetAngle(theShape1, theShape2):
anAngle = MeasuOp.GetAngle(theShape1, theShape2)
- if MeasuOp.IsDone() == 0:
- print "GetAngle : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("GetAngle", MeasuOp)
return anAngle
## Get min and max tolerances of sub-shapes of theShape
# Example: see GEOM_TestMeasures.py
def Tolerance(theShape):
aTuple = MeasuOp.GetTolerance(theShape)
- if MeasuOp.IsDone() == 0:
- print "Tolerance : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("Tolerance", MeasuOp)
return aTuple
## Obtain description of the given shape (number of sub-shapes of each type)
# Example: see GEOM_TestMeasures.py
def WhatIs(theShape):
aDescr = MeasuOp.WhatIs(theShape)
- if MeasuOp.IsDone() == 0:
- print "WhatIs : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("WhatIs", MeasuOp)
return aDescr
## Get a point, situated at the centre of mass of theShape.
# Example: see GEOM_TestMeasures.py
def MakeCDG(theShape):
anObj = MeasuOp.GetCentreOfMass(theShape)
- if MeasuOp.IsDone() == 0:
- print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("GetCentreOfMass", MeasuOp)
return anObj
## Get a normale to the given face. If the point is not given,
# Example: see GEOM_TestMeasures.py
def GetNormal(theFace, theOptionalPoint = None):
anObj = MeasuOp.GetNormal(theFace, theOptionalPoint)
- if MeasuOp.IsDone() == 0:
- print "GetNormal : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("GetNormal", MeasuOp)
return anObj
## Check a topology of the given shape.
(IsValid, Status) = MeasuOp.CheckShape(theShape)
if MeasuOp.IsDone() == 0:
- print "CheckShape : ", MeasuOp.GetErrorCode()
+ raise RuntimeError, "CheckShape : " + MeasuOp.GetErrorCode()
else:
if IsValid == 0:
print Status
# Example: see GEOM_TestMeasures.py
def GetPosition(theShape):
aTuple = MeasuOp.GetPosition(theShape)
- if MeasuOp.IsDone() == 0:
- print "GetPosition : ", MeasuOp.GetErrorCode()
+ RaiseIfFailed("GetPosition", MeasuOp)
return aTuple
## Get kind of theShape.
def KindOfShape(theShape):
aRoughTuple = MeasuOp.KindOfShape(theShape)
if MeasuOp.IsDone() == 0:
- print "KindOfShape : ", MeasuOp.GetErrorCode()
+ raise RuntimerError, "KindOfShape : " + MeasuOp.GetErrorCode()
return []
aKind = aRoughTuple[0]
# Example: see GEOM_TestOthers.py
def Import(theFileName, theFormatName):
anObj = InsertOp.Import(theFileName, theFormatName)
- if InsertOp.IsDone() == 0:
- print "Import : ", InsertOp.GetErrorCode()
+ RaiseIfFailed("Import", InsertOp)
return anObj
## Shortcut to Import() for BREP format
# Example: see GEOM_TestOthers.py
def Export(theObject, theFileName, theFormatName):
InsertOp.Export(theObject, theFileName, theFormatName)
- if InsertOp.IsDone() == 0:
- print "Export : ", InsertOp.GetErrorCode()
+ RaiseIfFailed("Export :", InsertOp)
## Shortcut to Export() for BREP format
#
# Example: see GEOM_Spanner.py
def MakeQuad(E1, E2, E3, E4):
anObj = BlocksOp.MakeQuad(E1, E2, E3, E4)
- if BlocksOp.IsDone() == 0:
- print "MakeQuad : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("MakeQuad", BlocksOp)
return anObj
## Create a quadrangle face on two edges.
# Example: see GEOM_Spanner.py
def MakeQuad2Edges(E1, E2):
anObj = BlocksOp.MakeQuad2Edges(E1, E2)
- if BlocksOp.IsDone() == 0:
- print "MakeQuad2Edges : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("MakeQuad2Edges", BlocksOp)
return anObj
## Create a quadrangle face with specified corners.
# Example: see GEOM_Spanner.py
def MakeQuad4Vertices(V1, V2, V3, V4):
anObj = BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
- if BlocksOp.IsDone() == 0:
- print "MakeQuad4Vertices : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("MakeQuad4Vertices", BlocksOp)
return anObj
## Create a hexahedral solid, bounded by the six given faces. Order of
# Example: see GEOM_Spanner.py
def MakeHexa(F1, F2, F3, F4, F5, F6):
anObj = BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
- if BlocksOp.IsDone() == 0:
- print "MakeHexa : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("MakeHexa", BlocksOp)
return anObj
## Create a hexahedral solid between two given faces.
# Example: see GEOM_Spanner.py
def MakeHexa2Faces(F1, F2):
anObj = BlocksOp.MakeHexa2Faces(F1, F2)
- if BlocksOp.IsDone() == 0:
- print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("MakeHexa2Faces", BlocksOp)
return anObj
## Get a vertex, found in the given shape by its coordinates.
# Example: see GEOM_TestOthers.py
def GetPoint(theShape, theX, theY, theZ, theEpsilon):
anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
- if BlocksOp.IsDone() == 0:
- print "GetPoint : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetPoint", BlocksOp)
return anObj
## Get an edge, found in the given shape by two given vertices.
# Example: see GEOM_Spanner.py
def GetEdge(theShape, thePoint1, thePoint2):
anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
- if BlocksOp.IsDone() == 0:
- print "GetEdge : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetEdge", BlocksOp)
return anObj
## Find an edge of the given shape, which has minimal distance to the given point.
# Example: see GEOM_TestOthers.py
def GetEdgeNearPoint(theShape, thePoint):
anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint)
- if BlocksOp.IsDone() == 0:
- print "GetEdgeNearPoint : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetEdgeNearPoint", BlocksOp)
return anObj
## Returns a face, found in the given shape by four given corner vertices.
# Example: see GEOM_Spanner.py
def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
- if BlocksOp.IsDone() == 0:
- print "GetFaceByPoints : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetFaceByPoints", BlocksOp)
return anObj
## Get a face of block, found in the given shape by two given edges.
# Example: see GEOM_Spanner.py
def GetFaceByEdges(theShape, theEdge1, theEdge2):
anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
- if BlocksOp.IsDone() == 0:
- print "GetFaceByEdges : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetFaceByEdges", BlocksOp)
return anObj
## Find a face, opposite to the given one in the given block.
# Example: see GEOM_Spanner.py
def GetOppositeFace(theBlock, theFace):
anObj = BlocksOp.GetOppositeFace(theBlock, theFace)
- if BlocksOp.IsDone() == 0:
- print "GetOppositeFace : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetOppositeFace", BlocksOp)
return anObj
## Find a face of the given shape, which has minimal distance to the given point.
# Example: see GEOM_Spanner.py
def GetFaceNearPoint(theShape, thePoint):
anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint)
- if BlocksOp.IsDone() == 0:
- print "GetFaceNearPoint : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetFaceNearPoint", BlocksOp)
return anObj
## Find a face of block, whose outside normale has minimal angle with the given vector.
# Example: see GEOM_Spanner.py
def GetFaceByNormale(theBlock, theVector):
anObj = BlocksOp.GetFaceByNormale(theBlock, theVector)
- if BlocksOp.IsDone() == 0:
- print "GetFaceByNormale : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetFaceByNormale", BlocksOp)
return anObj
## Check, if the compound of blocks is given.
def CheckCompoundOfBlocks(theCompound):
(IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound)
if BlocksOp.IsDone() == 0:
- print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode()
+ raise RuntimeError, "CheckCompoundOfBlocks : " + BlocksOp.GetErrorCode()
else:
if IsValid == 0:
Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors)
# Example: see GEOM_TestOthers.py
def RemoveExtraEdges(theShape):
anObj = BlocksOp.RemoveExtraEdges(theShape)
- if BlocksOp.IsDone() == 0:
- print "RemoveExtraEdges : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("RemoveExtraEdges", BlocksOp)
return anObj
## Check, if the given shape is a blocks compound.
# Example: see GEOM_TestOthers.py
def CheckAndImprove(theShape):
anObj = BlocksOp.CheckAndImprove(theShape)
- if BlocksOp.IsDone() == 0:
- print "CheckAndImprove : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("CheckAndImprove", BlocksOp)
return anObj
## Get all the blocks, contained in the given compound.
# Example: see GEOM_TestOthers.py
def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
aList = BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
- if BlocksOp.IsDone() == 0:
- print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("MakeBlockExplode", BlocksOp)
return aList
## Find block, containing the given point inside its volume or on boundary.
# Example: see GEOM_Spanner.py
def GetBlockNearPoint(theCompound, thePoint):
anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
- if BlocksOp.IsDone() == 0:
- print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetBlockNearPoint", BlocksOp)
return anObj
## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
# Example: see GEOM_TestOthers.py
def GetBlockByParts(theCompound, theParts):
anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
- if BlocksOp.IsDone() == 0:
- print "GetBlockByParts : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetBlockByParts", BlocksOp)
return anObj
## Return all blocks, containing all the elements, passed as the parts.
# Example: see GEOM_Spanner.py
def GetBlocksByParts(theCompound, theParts):
aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
- if BlocksOp.IsDone() == 0:
- print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("GetBlocksByParts", BlocksOp)
return aList
## Multi-transformate block and glue the result.
# Example: see GEOM_Spanner.py
def MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes):
anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
- if BlocksOp.IsDone() == 0:
- print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("MakeMultiTransformation1D", BlocksOp)
return anObj
## Multi-transformate block and glue the result.
DirFace1V, DirFace2V, NbTimesV):
anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
DirFace1V, DirFace2V, NbTimesV)
- if BlocksOp.IsDone() == 0:
- print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("MakeMultiTransformation2D", BlocksOp)
return anObj
## Build all possible propagation groups.
# Example: see GEOM_TestOthers.py
def Propagate(theShape):
listChains = BlocksOp.Propagate(theShape)
- if BlocksOp.IsDone() == 0:
- print "Propagate : ", BlocksOp.GetErrorCode()
+ RaiseIfFailed("Propagate", BlocksOp)
return listChains
# -----------------------------------------------------------------------------
# Example: see GEOM_TestOthers.py
def CreateGroup(theMainShape, theShapeType):
anObj = GroupOp.CreateGroup(theMainShape, theShapeType)
- if GroupOp.IsDone() == 0:
- print "CreateGroup : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("CreateGroup", GroupOp)
return anObj
## Adds a sub object with ID theSubShapeId to the group
# Example: see GEOM_TestOthers.py
def AddObject(theGroup, theSubShapeID):
GroupOp.AddObject(theGroup, theSubShapeID)
- if GroupOp.IsDone() == 0:
- print "AddObject : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("AddObject", GroupOp)
## Removes a sub object with ID \a theSubShapeId from the group
# @param theGroup is a GEOM group from which the new sub shape is removed
# Example: see GEOM_TestOthers.py
def RemoveObject(theGroup, theSubShapeID):
GroupOp.RemoveObject(theGroup, theSubShapeID)
- if GroupOp.IsDone() == 0:
- print "RemoveObject : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("RemoveObject", GroupOp)
## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
# @param theGroup is a GEOM group to which the new sub shapes are added.
# Example: see GEOM_TestOthers.py
def UnionList (theGroup, theSubShapes):
GroupOp.UnionList(theGroup, theSubShapes)
- if GroupOp.IsDone() == 0:
- print "UnionList : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("UnionList", GroupOp)
## Works like the above method, but argument
# theSubShapes here is a list of sub-shapes indices
# Example: see GEOM_TestOthers.py
def UnionIDs(theGroup, theSubShapes):
GroupOp.UnionIDs(theGroup, theSubShapes)
- if GroupOp.IsDone() == 0:
- print "UnionIDs : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("UnionIDs", GroupOp)
## Removes from the group all the given shapes. No errors, if some shapes are not included.
# @param theGroup is a GEOM group from which the sub-shapes are removed.
# Example: see GEOM_TestOthers.py
def DifferenceList (theGroup, theSubShapes):
GroupOp.DifferenceList(theGroup, theSubShapes)
- if GroupOp.IsDone() == 0:
- print "DifferenceList : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("DifferenceList", GroupOp)
## Works like the above method, but argument
# theSubShapes here is a list of sub-shapes indices
# Example: see GEOM_TestOthers.py
def DifferenceIDs(theGroup, theSubShapes):
GroupOp.DifferenceIDs(theGroup, theSubShapes)
- if GroupOp.IsDone() == 0:
- print "DifferenceIDs : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("DifferenceIDs", GroupOp)
## Returns a list of sub objects ID stored in the group
# @param theGroup is a GEOM group for which a list of IDs is requested
# Example: see GEOM_TestOthers.py
def GetObjectIDs(theGroup):
ListIDs = GroupOp.GetObjects(theGroup)
- if GroupOp.IsDone() == 0:
- print "GetObjectIDs : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("GetObjectIDs", GroupOp)
return ListIDs
## Returns a type of sub objects stored in the group
# Example: see GEOM_TestOthers.py
def GetType(theGroup):
aType = GroupOp.GetType(theGroup)
- if GroupOp.IsDone() == 0:
- print "GetType : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("GetType", GroupOp)
return aType
## Returns a main shape associated with the group
# Example: see GEOM_TestOthers.py
def GetMainShape(theGroup):
anObj = GroupOp.GetMainShape(theGroup)
- if GroupOp.IsDone() == 0:
- print "GetMainShape : ", GroupOp.GetErrorCode()
+ RaiseIfFailed("GetMainShape", GroupOp)
return anObj
## Create group of edges of theShape, whose length is in range [min_length, max_length].