# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# 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
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"
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
## @}
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
## @}
# Example: see GEOM_TestAll.py
theLength, Parameters = ParseParameters(theLength)
anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
- RaiseIfFailed("MakeEdgeOnCurveByLength", self.BasicOp)
+ RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp)
anObj.SetParameters(Parameters)
return anObj
# @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
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 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
## @}
# 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
## @}
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
# -----------------------------------------------------------------------------
# @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"
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.
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