From: dmv Date: Thu, 1 Nov 2007 13:38:41 +0000 (+0000) Subject: Correct Errors NPAL17000 X-Git-Tag: V3_2_9rc1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e6968badf4ce0cec97d7087fa9ab05de8cf82cda;p=modules%2Fgeom.git Correct Errors NPAL17000 --- diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 145f962fb..8ea2a03bc 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -155,6 +155,12 @@ def MakeVertexOnCurve(curve,par): print "MakePointOnCurve : ", BasicOp.GetErrorCode() return anObj +def MakeVertexOnLinesIntersection(line1,line2): + anObj = BasicOp.MakePointOnLinesIntersection(line1,line2) + if BasicOp.IsDone() == 0: + print "MakePointOnLinesIntersection : ", BasicOp.GetErrorCode() + return anObj + def MakeVectorDXDYDZ(dx,dy,dz): anObj = BasicOp.MakeVectorDXDYDZ(dx,dy,dz) if BasicOp.IsDone() == 0: @@ -179,6 +185,12 @@ def MakeLineTwoPnt(p1, p2): print "MakeLineTwoPnt : ", BasicOp.GetErrorCode() return anObj +def MakeLineTwoFaces(f1, f2): + anObj = BasicOp.MakeLineTwoFaces(f1,f2) + if BasicOp.IsDone() == 0: + print "MakeLineTwoFaces : ", BasicOp.GetErrorCode() + return anObj + def MakePlane(p1,v1,trimsize): anObj = BasicOp.MakePlanePntVec(p1,v1,trimsize) if BasicOp.IsDone() == 0: diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 33900108d..7099489f1 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -202,6 +202,16 @@ def MakeVertexOnCurve(theRefCurve, theParameter): RaiseIfFailed("MakePointOnCurve", BasicOp) return anObj +## Create a point on intersection of two lines. +# @param theRefLine1, theRefLine2 The referenced lines. +# @return New GEOM_Object, containing the created point. +# +# Example: see GEOM_TestAll.py +def MakeVertexOnLinesIntersection(theRefLine1, theRefLine2): + anObj = BasicOp.MakePointOnCurve(theRefLine1, theRefLine2) + RaiseIfFailed("MakePointOnLinesIntersection", BasicOp) + return anObj + ## Create a tangent, corresponding to the given parameter on the given curve. # @param theRefCurve The referenced curve. # @param theParameter Value of parameter on the referenced curve. @@ -257,6 +267,17 @@ def MakeLineTwoPnt(thePnt1, thePnt2): RaiseIfFailed("MakeLineTwoPnt", BasicOp) return anObj +## Create a line on two faces intersection. +# @param theFace1 First of two faces, defining the line. +# @param theFace2 Second of two faces, defining the line. +# @return New GEOM_Object, containing the created line. +# +# Example: see GEOM_TestAll.py +def MakeLineTwoFaces(theFace1, theFace2): + anObj = BasicOp.MakeLineTwoFaces(theFace1, theFace2) + RaiseIfFailed("MakeLineTwoFaces", BasicOp) + return anObj + ## Create a plane, passing through the given point # and normal to the given vector. # @param thePnt Point, the plane has to pass through. @@ -480,7 +501,7 @@ def MakeSketcher(theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]): # @return New GEOM_Object, containing the created wire. def MakeSketcherOnPlane(theCommand, theWorkingPlane): anObj = CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane) - RaiseIfFailed("MakeSketcher", CurvesOp) + RaiseIfFailed("MakeSketcherOnPlane", CurvesOp) return anObj # ----------------------------------------------------------------------------- @@ -576,7 +597,7 @@ def MakeSphere(x, y, z, theR): # Example: see GEOM_TestAll.py def MakeSphereR(theR): anObj = PrimOp.MakeSphereR(theR) - RaiseIfFailed("MakeSphreR", PrimOp) + RaiseIfFailed("MakeSphereR", PrimOp) return anObj ## Create a cone with given base point, axis, height and radiuses. @@ -861,7 +882,7 @@ def MakeShell(theFacesAndShells): # Example: see GEOM_TestAll.py def MakeSolid(theShells): anObj = ShapesOp.MakeSolidShells(theShells) - RaiseIfFailed("MakeSolid", ShapesOp) + RaiseIfFailed("MakeSolidShells", ShapesOp) return anObj ## Create a compound of the given shapes. @@ -881,7 +902,7 @@ def MakeCompound(theShapes): # Example: see GEOM_TestOthers.py def NumberOfFaces(theShape): nb_faces = ShapesOp.NumberOfFaces(theShape) - RaiseIfFailed("NumberOfFace", ShapesOp) + RaiseIfFailed("NumberOfFaces", ShapesOp) return nb_faces ## Gives quantity of edges in the given shape. @@ -947,7 +968,7 @@ def GetSharedShapes(theShape1, theShape2, theShapeType): # Example: see GEOM_TestOthers.py def GetShapesOnPlane(theShape, theShapeType, theAx1, theState): aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState) - RaiseIfFailed("GetShaepsOnPlane", ShapesOp) + RaiseIfFailed("GetShapesOnPlane", ShapesOp) return aList ## Works like the above method, but returns list of sub-shapes indices @@ -1275,7 +1296,7 @@ def Sew(theObject, theTolerance): # Example: see GEOM_TestHealing.py def SuppressInternalWires(theObject, theWires): anObj = HealOp.RemoveIntWires(theObject, theWires) - RaiseIfFailed("SuppressIntWires", HealOp) + RaiseIfFailed("RemoveIntWires", HealOp) return anObj ## Remove internal closed contours (holes) from the given object. @@ -2140,9 +2161,7 @@ def GetPosition(theShape): # Example: see GEOM_TestMeasures.py def KindOfShape(theShape): aRoughTuple = MeasuOp.KindOfShape(theShape) - if MeasuOp.IsDone() == 0: - raise RuntimerError, "KindOfShape : " + MeasuOp.GetErrorCode() - return [] + RaiseIfFailed("KindOfShape", MeasuOp) aKind = aRoughTuple[0] anInts = aRoughTuple[1] @@ -2386,10 +2405,8 @@ def GetFaceByNormale(theBlock, theVector): # Example: see GEOM_Spanner.py def CheckCompoundOfBlocks(theCompound): (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound) - if BlocksOp.IsDone() == 0: - raise RuntimeError, "CheckCompoundOfBlocks : " + BlocksOp.GetErrorCode() - else: - if IsValid == 0: + RaiseIfFailed("CheckCompoundOfBlocks", BlocksOp) + if IsValid == 0: Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors) print Descr return IsValid @@ -2583,7 +2600,7 @@ def DifferenceIDs(theGroup, theSubShapes): # Example: see GEOM_TestOthers.py def GetObjectIDs(theGroup): ListIDs = GroupOp.GetObjects(theGroup) - RaiseIfFailed("GetObject", GroupOp) + RaiseIfFailed("GetObjects", GroupOp) return ListIDs ## Returns a type of sub objects stored in the group