X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM_SWIG%2FgeompyDC.py;h=f425d9434f4e502169a5f5dc061b9b6344576136;hb=a6b86fc40dddf212f4e71821d6156f298939c7ca;hp=5853af96666764107117bf8f5701a78a189606c0;hpb=239f8109c64fa0c5a2e1d87a420bad5529b57f48;p=modules%2Fgeom.git diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 5853af966..f425d9434 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -123,29 +123,68 @@ class geompyDC(GEOM._objref_GEOM_Gen): index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj) name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index) return name - + ## Publish in study aShape with name aName # + # \param aShape the shape to be published + # \param aName the name for the shape + # \param doRestoreSubShapes if True, finds and publishes also + # sub-shapes of \a aShape, corresponding to its arguments + # and published sub-shapes of arguments + # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for + # these arguments description + # \return study entry of the published shape in form of string + # # Example: see GEOM_TestAll.py - def addToStudy(self,aShape, aName): + def addToStudy(self, aShape, aName, doRestoreSubShapes=False, + theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False): try: aSObject = self.AddInStudy(self.myStudy, aShape, aName, None) + if doRestoreSubShapes: + self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs, + theFindMethod, theInheritFirstArg) except: print "addToStudy() failed" return "" return aShape.GetStudyEntry() - + ## Publish in study aShape with name aName as sub-object of previously published aFather # # Example: see GEOM_TestAll.py - def addToStudyInFather(self,aFather, aShape, aName): + def addToStudyInFather(self, aFather, aShape, aName): try: aSObject = self.AddInStudy(myStudy, aShape, aName, aFather) except: print "addToStudyInFather() failed" return "" return aShape.GetStudyEntry() - + + ## 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 theStudy the study, in which theObject is published already, + # and in which the arguments will be published + # \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 \a theObject. + # 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. + # \return True in case of success, False otherwise. + # + # Example: see GEOM_TestAll.py + def RestoreSubShapes (self, theObject, theArgs=[], + theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False): + return self.RestoreSubShapesO(self.myStudy, theObject, theArgs, + theFindMethod, theInheritFirstArg) + # ----------------------------------------------------------------------------- # Basic primitives # ----------------------------------------------------------------------------- @@ -187,6 +226,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakePointOnCurve", self.BasicOp) return anObj + ## Create a point, corresponding to the given parameters on the + # given surface. + # @param theRefSurf The referenced surface. + # @param theUParameter Value of U-parameter on the referenced surface. + # @param theVParameter Value of V-parameter on the referenced surface. + # @return New GEOM_Object, containing the created point. + # + # Example: see GEOM_TestAll.py + def MakeVertexOnSurface(self,theRefSurf, theUParameter, theVParameter): + anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter) + RaiseIfFailed("MakePointOnSurface", self.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. @@ -1107,6 +1159,38 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp) return aList + ## 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 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 + # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. + # @return List of all found sub-shapes. + # + def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState): + aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape, + theShapeType, theState) + RaiseIfFailed("GetShapesOnShape", self.ShapesOp) + return aList + + ## Works like the above method, but returns result as compound + # + def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState): + anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape, + theShapeType, theState) + RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp) + return anObj + + ## Works like the above method, but returns list of sub-shapes indices + # + def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState): + aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape, + theShapeType, theState) + RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp) + return aList + ## Get sub-shape(s) of theShapeWhere, which are # coincident with \a theShapeWhat or could be a part of it. # @param theShapeWhere Shape to find sub-shapes of. @@ -1615,6 +1699,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("TranslateVectorCopy", self.TrsfOp) return anObj + ## Translate the given object along the given vector on given distance, + # creating its copy before the translation. + # @param theObject The object to be translated. + # @param theVector The translation vector. + # @param theDistance The translation distance. + # @return New GEOM_Object, containing the translated object. + # + # Example: see GEOM_TestAll.py + def MakeTranslationVectorDistance(self,theObject, theVector, theDistance): + anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1) + RaiseIfFailed("TranslateVectorDistance", self.TrsfOp) + return anObj + ## Rotate the given object around the given axis # on the given angle, creating its copy before the rotatation. # @param theObject The object to be rotated. @@ -2036,6 +2133,40 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("GetAngle", self.MeasuOp) return anAngle + ## Methods for recieving radius of curvature of curves + # in the given point + # + # Example: see GEOM_TestMeasures.py + def CurveCurvatureByParam(self, theCurve, theParam): + aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam) + RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp) + return aCurv + def CurveCurvatureByPoint(self, theCurve, thePoint): + aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint) + RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp) + return aCurv + + ## Methods for recieving max and min radius of curvature of surfaces + # in the given point + # + # Example: see GEOM_TestMeasures.py + def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam): + aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam) + RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp) + return aSurf + def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint): + aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint) + RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp) + return aSurf + def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam): + aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam) + RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp) + return aSurf + def MinSurfaceCurvatureByPoint(self, theSurf, thePoint): + aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint) + RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp) + return aSurf + ## Get min and max tolerances of sub-shapes of theShape # @param theShape Shape, to get tolerances of. # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]