1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
24 # Author : Paul RASCLE, EDF
32 ## @defgroup l1_geompy_auxiliary Auxiliary data structures and methods
34 ## @defgroup l1_geompy_purpose All package methods, grouped by their purpose
36 ## @defgroup l2_import_export Importing/exporting geometrical objects
37 ## @defgroup l2_creating Creating geometrical objects
39 ## @defgroup l3_basic_go Creating Basic Geometric Objects
41 ## @defgroup l4_curves Creating Curves
44 ## @defgroup l3_3d_primitives Creating 3D Primitives
45 ## @defgroup l3_complex Creating Complex Objects
46 ## @defgroup l3_groups Working with groups
47 ## @defgroup l3_blocks Building by blocks
49 ## @defgroup l4_blocks_measure Check and Improve
52 ## @defgroup l3_sketcher Sketcher
53 ## @defgroup l3_advanced Creating Advanced Geometrical Objects
55 ## @defgroup l4_decompose Decompose objects
56 ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
57 ## @defgroup l4_obtain Access to subshapes by a criteria
62 ## @defgroup l2_transforming Transforming geometrical objects
64 ## @defgroup l3_basic_op Basic Operations
65 ## @defgroup l3_boolean Boolean Operations
66 ## @defgroup l3_transform Transformation Operations
67 ## @defgroup l3_local Local Operations (Fillet and Chamfer)
68 ## @defgroup l3_blocks_op Blocks Operations
69 ## @defgroup l3_healing Repairing Operations
70 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of subshapes
73 ## @defgroup l2_measure Using measurement tools
81 from salome_notebook import *
86 ## Enumeration ShapeType as a dictionary
87 # @ingroup l1_geompy_auxiliary
88 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
90 ## Raise an Error, containing the Method_name, if Operation is Failed
91 ## @ingroup l1_geompy_auxiliary
92 def RaiseIfFailed (Method_name, Operation):
93 if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
94 raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
96 ## Return list of variables value from salome notebook
97 ## @ingroup l1_geompy_auxiliary
98 def ParseParameters(*parameters):
101 for parameter in parameters:
102 if isinstance(parameter,str):
103 if notebook.isVariable(parameter):
104 Result.append(notebook.get(parameter))
106 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
108 Result.append(parameter)
111 StringResult = StringResult + str(parameter)
112 StringResult = StringResult + ":"
114 StringResult = StringResult[:len(StringResult)-1]
115 Result.append(StringResult)
118 ## Return list of variables value from salome notebook
119 ## @ingroup l1_geompy_auxiliary
123 for parameter in list:
124 if isinstance(parameter,str) and notebook.isVariable(parameter):
125 Result.append(str(notebook.get(parameter)))
128 Result.append(str(parameter))
131 StringResult = StringResult + str(parameter)
132 StringResult = StringResult + ":"
134 StringResult = StringResult[:len(StringResult)-1]
135 return Result, StringResult
137 ## Return list of variables value from salome notebook
138 ## @ingroup l1_geompy_auxiliary
139 def ParseSketcherCommand(command):
142 sections = command.split(":")
143 for section in sections:
144 parameters = section.split(" ")
146 for parameter in parameters:
147 if paramIndex > 1 and parameter.find("'") != -1:
148 parameter = parameter.replace("'","")
149 if notebook.isVariable(parameter):
150 Result = Result + str(notebook.get(parameter)) + " "
153 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
157 Result = Result + str(parameter) + " "
160 StringResult = StringResult + parameter
161 StringResult = StringResult + ":"
163 paramIndex = paramIndex + 1
165 Result = Result[:len(Result)-1] + ":"
167 Result = Result[:len(Result)-1]
168 return Result, StringResult
170 ## Kinds of shape enumeration
171 # @ingroup l1_geompy_auxiliary
172 kind = GEOM.GEOM_IKindOfShape
174 ## Information about closed/unclosed state of shell or wire
175 # @ingroup l1_geompy_auxiliary
182 class geompyDC(GEOM._objref_GEOM_Gen):
185 GEOM._objref_GEOM_Gen.__init__(self)
186 self.myBuilder = None
204 ## @addtogroup l1_geompy_auxiliary
206 def init_geom(self,theStudy):
207 self.myStudy = theStudy
208 self.myStudyId = self.myStudy._get_StudyId()
209 self.myBuilder = self.myStudy.NewBuilder()
210 self.father = self.myStudy.FindComponent("GEOM")
211 if self.father is None:
212 self.father = self.myBuilder.NewComponent("GEOM")
213 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
214 FName = A1._narrow(SALOMEDS.AttributeName)
215 FName.SetValue("Geometry")
216 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
217 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
218 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
219 self.myBuilder.DefineComponentInstance(self.father,self)
221 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
222 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
223 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
224 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
225 self.HealOp = self.GetIHealingOperations (self.myStudyId)
226 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
227 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
228 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
229 self.LocalOp = self.GetILocalOperations (self.myStudyId)
230 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
231 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
232 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
235 ## Get name for sub-shape aSubObj of shape aMainObj
237 # @ref swig_SubShapeAllSorted "Example"
238 def SubShapeName(self,aSubObj, aMainObj):
239 # Example: see GEOM_TestAll.py
241 #aSubId = orb.object_to_string(aSubObj)
242 #aMainId = orb.object_to_string(aMainObj)
243 #index = gg.getIndexTopology(aSubId, aMainId)
244 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
245 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
246 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
249 ## Publish in study aShape with name aName
251 # \param aShape the shape to be published
252 # \param aName the name for the shape
253 # \param doRestoreSubShapes if True, finds and publishes also
254 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
255 # and published sub-shapes of arguments
256 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
257 # these arguments description
258 # \return study entry of the published shape in form of string
260 # @ref swig_MakeQuad4Vertices "Example"
261 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
262 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
263 # Example: see GEOM_TestAll.py
265 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
266 if doRestoreSubShapes:
267 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
268 theFindMethod, theInheritFirstArg)
270 print "addToStudy() failed"
272 return aShape.GetStudyEntry()
274 ## Publish in study aShape with name aName as sub-object of previously published aFather
276 # @ref swig_SubShapeAllSorted "Example"
277 def addToStudyInFather(self, aFather, aShape, aName):
278 # Example: see GEOM_TestAll.py
280 aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather)
282 print "addToStudyInFather() failed"
284 return aShape.GetStudyEntry()
286 # end of l1_geompy_auxiliary
289 ## @addtogroup l3_restore_ss
292 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
293 # To be used from python scripts out of geompy.addToStudy (non-default usage)
294 # \param theObject published GEOM object, arguments of which will be published
295 # \param theArgs list of GEOM_Object, operation arguments to be published.
296 # If this list is empty, all operation arguments will be published
297 # \param theFindMethod method to search subshapes, corresponding to arguments and
298 # their subshapes. Value from enumeration GEOM::find_shape_method.
299 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
300 # Do not publish subshapes in place of arguments, but only
301 # in place of subshapes of the first argument,
302 # because the whole shape corresponds to the first argument.
303 # Mainly to be used after transformations, but it also can be
304 # usefull after partition with one object shape, and some other
305 # operations, where only the first argument has to be considered.
306 # If theObject has only one argument shape, this flag is automatically
307 # considered as True, not regarding really passed value.
308 # \return True in case of success, False otherwise.
310 # @ref tui_restore_prs_params "Example"
311 def RestoreSubShapes (self, theObject, theArgs=[],
312 theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
313 # Example: see GEOM_TestAll.py
314 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
315 theFindMethod, theInheritFirstArg)
317 # end of l3_restore_ss
320 ## @addtogroup l3_basic_go
323 ## Create point by three coordinates.
324 # @param theX The X coordinate of the point.
325 # @param theY The Y coordinate of the point.
326 # @param theZ The Z coordinate of the point.
327 # @return New GEOM_Object, containing the created point.
329 # @ref tui_creation_point "Example"
330 def MakeVertex(self,theX, theY, theZ):
331 # Example: see GEOM_TestAll.py
332 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
333 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
334 RaiseIfFailed("MakePointXYZ", self.BasicOp)
335 anObj.SetParameters(Parameters)
338 ## Create a point, distant from the referenced point
339 # on the given distances along the coordinate axes.
340 # @param theReference The referenced point.
341 # @param theX Displacement from the referenced point along OX axis.
342 # @param theY Displacement from the referenced point along OY axis.
343 # @param theZ Displacement from the referenced point along OZ axis.
344 # @return New GEOM_Object, containing the created point.
346 # @ref tui_creation_point "Example"
347 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
348 # Example: see GEOM_TestAll.py
349 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
350 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
351 RaiseIfFailed("MakePointWithReference", self.BasicOp)
352 anObj.SetParameters(Parameters)
355 ## Create a point, corresponding to the given parameter on the given curve.
356 # @param theRefCurve The referenced curve.
357 # @param theParameter Value of parameter on the referenced curve.
358 # @return New GEOM_Object, containing the created point.
360 # @ref tui_creation_point "Example"
361 def MakeVertexOnCurve(self,theRefCurve, theParameter):
362 # Example: see GEOM_TestAll.py
363 theParameter, Parameters = ParseParameters(theParameter)
364 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
365 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
366 anObj.SetParameters(Parameters)
369 ## Create a point, corresponding to the given parameters on the
371 # @param theRefSurf The referenced surface.
372 # @param theUParameter Value of U-parameter on the referenced surface.
373 # @param theVParameter Value of V-parameter on the referenced surface.
374 # @return New GEOM_Object, containing the created point.
376 # @ref swig_MakeVertexOnSurface "Example"
377 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
378 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
379 # Example: see GEOM_TestAll.py
380 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
381 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
382 anObj.SetParameters(Parameters);
385 ## Create a point on intersection of two lines.
386 # @param theRefLine1, theRefLine2 The referenced lines.
387 # @return New GEOM_Object, containing the created point.
389 # @ref swig_MakeVertexOnLinesIntersection "Example"
390 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
391 # Example: see GEOM_TestAll.py
392 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
393 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
396 ## Create a tangent, corresponding to the given parameter on the given curve.
397 # @param theRefCurve The referenced curve.
398 # @param theParameter Value of parameter on the referenced curve.
399 # @return New GEOM_Object, containing the created tangent.
401 # @ref swig_MakeTangentOnCurve "Example"
402 def MakeTangentOnCurve(self, theRefCurve, theParameter):
403 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
404 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
407 ## Create a tangent plane to specified face in the point with specified parameters.
408 # @param theFace - face for which tangent plane shuold be built.
409 # @param theParameterU - value of parameter by U
410 # @param theParameterV - value of parameter Vthe
411 # @param theTrimSize - defines sizes of created face
412 # Values of parameters should be between 0. and 1.0
413 # return New GEOM_Object, containing the face built on tangent plane.
414 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize):
415 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
416 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
419 ## Create a vector with the given components.
420 # @param theDX X component of the vector.
421 # @param theDY Y component of the vector.
422 # @param theDZ Z component of the vector.
423 # @return New GEOM_Object, containing the created vector.
425 # @ref tui_creation_vector "Example"
426 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
427 # Example: see GEOM_TestAll.py
428 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
429 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
430 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
431 anObj.SetParameters(Parameters)
434 ## Create a vector between two points.
435 # @param thePnt1 Start point for the vector.
436 # @param thePnt2 End point for the vector.
437 # @return New GEOM_Object, containing the created vector.
439 # @ref tui_creation_vector "Example"
440 def MakeVector(self,thePnt1, thePnt2):
441 # Example: see GEOM_TestAll.py
442 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
443 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
446 ## Create a line, passing through the given point
447 # and parrallel to the given direction
448 # @param thePnt Point. The resulting line will pass through it.
449 # @param theDir Direction. The resulting line will be parallel to it.
450 # @return New GEOM_Object, containing the created line.
452 # @ref tui_creation_line "Example"
453 def MakeLine(self,thePnt, theDir):
454 # Example: see GEOM_TestAll.py
455 anObj = self.BasicOp.MakeLine(thePnt, theDir)
456 RaiseIfFailed("MakeLine", self.BasicOp)
459 ## Create a line, passing through the given points
460 # @param thePnt1 First of two points, defining the line.
461 # @param thePnt2 Second of two points, defining the line.
462 # @return New GEOM_Object, containing the created line.
464 # @ref tui_creation_line "Example"
465 def MakeLineTwoPnt(self,thePnt1, thePnt2):
466 # Example: see GEOM_TestAll.py
467 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
468 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
471 ## Create a line on two faces intersection.
472 # @param theFace1 First of two faces, defining the line.
473 # @param theFace2 Second of two faces, defining the line.
474 # @return New GEOM_Object, containing the created line.
476 # @ref swig_MakeLineTwoFaces "Example"
477 def MakeLineTwoFaces(self, theFace1, theFace2):
478 # Example: see GEOM_TestAll.py
479 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
480 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
483 ## Create a plane, passing through the given point
484 # and normal to the given vector.
485 # @param thePnt Point, the plane has to pass through.
486 # @param theVec Vector, defining the plane normal direction.
487 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
488 # @return New GEOM_Object, containing the created plane.
490 # @ref tui_creation_plane "Example"
491 def MakePlane(self,thePnt, theVec, theTrimSize):
492 # Example: see GEOM_TestAll.py
493 theTrimSize, Parameters = ParseParameters(theTrimSize);
494 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
495 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
496 anObj.SetParameters(Parameters)
499 ## Create a plane, passing through the three given points
500 # @param thePnt1 First of three points, defining the plane.
501 # @param thePnt2 Second of three points, defining the plane.
502 # @param thePnt3 Fird of three points, defining the plane.
503 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
504 # @return New GEOM_Object, containing the created plane.
506 # @ref tui_creation_plane "Example"
507 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
508 # Example: see GEOM_TestAll.py
509 theTrimSize, Parameters = ParseParameters(theTrimSize);
510 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
511 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
512 anObj.SetParameters(Parameters)
515 ## Create a plane, similar to the existing one, but with another size of representing face.
516 # @param theFace Referenced plane or LCS(Marker).
517 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
518 # @return New GEOM_Object, containing the created plane.
520 # @ref tui_creation_plane "Example"
521 def MakePlaneFace(self,theFace, theTrimSize):
522 # Example: see GEOM_TestAll.py
523 theTrimSize, Parameters = ParseParameters(theTrimSize);
524 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
525 RaiseIfFailed("MakePlaneFace", self.BasicOp)
526 anObj.SetParameters(Parameters)
529 ## Create a local coordinate system.
530 # @param OX,OY,OZ Three coordinates of coordinate system origin.
531 # @param XDX,XDY,XDZ Three components of OX direction
532 # @param YDX,YDY,YDZ Three components of OY direction
533 # @return New GEOM_Object, containing the created coordinate system.
535 # @ref swig_MakeMarker "Example"
536 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
537 # Example: see GEOM_TestAll.py
538 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
539 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
540 RaiseIfFailed("MakeMarker", self.BasicOp)
541 anObj.SetParameters(Parameters)
544 ## Create a local coordinate system.
545 # @param theOrigin Point of coordinate system origin.
546 # @param theXVec Vector of X direction
547 # @param theYVec Vector of Y direction
548 # @return New GEOM_Object, containing the created coordinate system.
550 # @ref swig_MakeMarker "Example"
551 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
552 O = self.PointCoordinates( theOrigin )
554 for vec in [ theXVec, theYVec ]:
555 v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] )
556 p1 = self.PointCoordinates( v1 )
557 p2 = self.PointCoordinates( v2 )
558 for i in range( 0, 3 ):
559 OXOY.append( p2[i] - p1[i] )
561 anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2],
562 OXOY[0], OXOY[1], OXOY[2],
563 OXOY[3], OXOY[4], OXOY[5], )
564 RaiseIfFailed("MakeMarker", self.BasicOp)
570 ## @addtogroup l4_curves
573 ## Create an arc of circle, passing through three given points.
574 # @param thePnt1 Start point of the arc.
575 # @param thePnt2 Middle point of the arc.
576 # @param thePnt3 End point of the arc.
577 # @return New GEOM_Object, containing the created arc.
579 # @ref swig_MakeArc "Example"
580 def MakeArc(self,thePnt1, thePnt2, thePnt3):
581 # Example: see GEOM_TestAll.py
582 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
583 RaiseIfFailed("MakeArc", self.CurvesOp)
586 ## Create an arc of circle from a center and 2 points.
587 # @param thePnt1 Center of the arc
588 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
589 # @param thePnt3 End point of the arc (Gives also a direction)
590 # @param theSense Orientation of the arc
591 # @return New GEOM_Object, containing the created arc.
593 # @ref swig_MakeArc "Example"
594 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
595 # Example: see GEOM_TestAll.py
596 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
597 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
600 ## Create an arc of ellipse, of center and two points.
601 # @param theCenter Center of the arc.
602 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
603 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
604 # @return New GEOM_Object, containing the created arc.
606 # @ref swig_MakeArc "Example"
607 def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2):
608 # Example: see GEOM_TestAll.py
609 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
610 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
613 ## Create a circle with given center, normal vector and radius.
614 # @param thePnt Circle center.
615 # @param theVec Vector, normal to the plane of the circle.
616 # @param theR Circle radius.
617 # @return New GEOM_Object, containing the created circle.
619 # @ref tui_creation_circle "Example"
620 def MakeCircle(self, thePnt, theVec, theR):
621 # Example: see GEOM_TestAll.py
622 theR, Parameters = ParseParameters(theR)
623 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
624 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
625 anObj.SetParameters(Parameters)
628 ## Create a circle with given radius.
629 # Center of the circle will be in the origin of global
630 # coordinate system and normal vector will be codirected with Z axis
631 # @param theR Circle radius.
632 # @return New GEOM_Object, containing the created circle.
633 def MakeCircleR(self, theR):
634 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
635 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
638 ## Create a circle, passing through three given points
639 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
640 # @return New GEOM_Object, containing the created circle.
642 # @ref tui_creation_circle "Example"
643 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
644 # Example: see GEOM_TestAll.py
645 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
646 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
649 ## Create a circle, with given point1 as center,
650 # passing through the point2 as radius and laying in the plane,
651 # defined by all three given points.
652 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
653 # @return New GEOM_Object, containing the created circle.
655 # @ref swig_MakeCircle "Example"
656 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
657 # Example: see GEOM_example6.py
658 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
659 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
662 ## Create an ellipse with given center, normal vector and radiuses.
663 # @param thePnt Ellipse center.
664 # @param theVec Vector, normal to the plane of the ellipse.
665 # @param theRMajor Major ellipse radius.
666 # @param theRMinor Minor ellipse radius.
667 # @param theVecMaj Vector, direction of the ellipse's main axis.
668 # @return New GEOM_Object, containing the created ellipse.
670 # @ref tui_creation_ellipse "Example"
671 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None):
672 # Example: see GEOM_TestAll.py
673 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
674 if theVecMaj is not None:
675 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
677 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
679 RaiseIfFailed("MakeEllipse", self.CurvesOp)
680 anObj.SetParameters(Parameters)
683 ## Create an ellipse with given radiuses.
684 # Center of the ellipse will be in the origin of global
685 # coordinate system and normal vector will be codirected with Z axis
686 # @param theRMajor Major ellipse radius.
687 # @param theRMinor Minor ellipse radius.
688 # @return New GEOM_Object, containing the created ellipse.
689 def MakeEllipseRR(self, theRMajor, theRMinor):
690 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
691 RaiseIfFailed("MakeEllipse", self.CurvesOp)
694 ## Create a polyline on the set of points.
695 # @param thePoints Sequence of points for the polyline.
696 # @return New GEOM_Object, containing the created polyline.
698 # @ref tui_creation_curve "Example"
699 def MakePolyline(self,thePoints):
700 # Example: see GEOM_TestAll.py
701 anObj = self.CurvesOp.MakePolyline(thePoints)
702 RaiseIfFailed("MakePolyline", self.CurvesOp)
705 ## Create bezier curve on the set of points.
706 # @param thePoints Sequence of points for the bezier curve.
707 # @return New GEOM_Object, containing the created bezier curve.
709 # @ref tui_creation_curve "Example"
710 def MakeBezier(self,thePoints):
711 # Example: see GEOM_TestAll.py
712 anObj = self.CurvesOp.MakeSplineBezier(thePoints)
713 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
716 ## Create B-Spline curve on the set of points.
717 # @param thePoints Sequence of points for the B-Spline curve.
718 # @return New GEOM_Object, containing the created B-Spline curve.
720 # @ref tui_creation_curve "Example"
721 def MakeInterpol(self,thePoints):
722 # Example: see GEOM_TestAll.py
723 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints)
724 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
730 ## @addtogroup l3_sketcher
733 ## Create a sketcher (wire or face), following the textual description,
734 # passed through <VAR>theCommand</VAR> argument. \n
735 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
736 # Format of the description string have to be the following:
738 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
741 # - x1, y1 are coordinates of the first sketcher point (zero by default),
743 # - "R angle" : Set the direction by angle
744 # - "D dx dy" : Set the direction by DX & DY
747 # - "TT x y" : Create segment by point at X & Y
748 # - "T dx dy" : Create segment by point with DX & DY
749 # - "L length" : Create segment by direction & Length
750 # - "IX x" : Create segment by direction & Intersect. X
751 # - "IY y" : Create segment by direction & Intersect. Y
754 # - "C radius length" : Create arc by direction, radius and length(in degree)
757 # - "WW" : Close Wire (to finish)
758 # - "WF" : Close Wire and build face (to finish)
760 # @param theCommand String, defining the sketcher in local
761 # coordinates of the working plane.
762 # @param theWorkingPlane Nine double values, defining origin,
763 # OZ and OX directions of the working plane.
764 # @return New GEOM_Object, containing the created wire.
766 # @ref tui_sketcher_page "Example"
767 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
768 # Example: see GEOM_TestAll.py
769 theCommand,Parameters = ParseSketcherCommand(theCommand)
770 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
771 RaiseIfFailed("MakeSketcher", self.CurvesOp)
772 anObj.SetParameters(Parameters)
775 ## Create a sketcher (wire or face), following the textual description,
776 # passed through <VAR>theCommand</VAR> argument. \n
777 # For format of the description string see the previous method.\n
778 # @param theCommand String, defining the sketcher in local
779 # coordinates of the working plane.
780 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
781 # @return New GEOM_Object, containing the created wire.
783 # @ref tui_sketcher_page "Example"
784 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
785 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
786 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
789 ## Create a sketcher wire, following the numerical description,
790 # passed through <VAR>theCoordinates</VAR> argument. \n
791 # @param theCoordinates double values, defining points to create a wire,
793 # @return New GEOM_Object, containing the created wire.
795 # @ref tui_sketcher_page "Example"
796 def Make3DSketcher(self, theCoordinates):
797 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
798 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
804 ## @addtogroup l3_3d_primitives
807 ## Create a box by coordinates of two opposite vertices.
809 # @ref tui_creation_box "Example"
810 def MakeBox(self,x1,y1,z1,x2,y2,z2):
811 # Example: see GEOM_TestAll.py
812 pnt1 = self.MakeVertex(x1,y1,z1)
813 pnt2 = self.MakeVertex(x2,y2,z2)
814 return self.MakeBoxTwoPnt(pnt1,pnt2)
816 ## Create a box with specified dimensions along the coordinate axes
817 # and with edges, parallel to the coordinate axes.
818 # Center of the box will be at point (DX/2, DY/2, DZ/2).
819 # @param theDX Length of Box edges, parallel to OX axis.
820 # @param theDY Length of Box edges, parallel to OY axis.
821 # @param theDZ Length of Box edges, parallel to OZ axis.
822 # @return New GEOM_Object, containing the created box.
824 # @ref tui_creation_box "Example"
825 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
826 # Example: see GEOM_TestAll.py
827 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
828 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
829 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
830 anObj.SetParameters(Parameters)
833 ## Create a box with two specified opposite vertices,
834 # and with edges, parallel to the coordinate axes
835 # @param thePnt1 First of two opposite vertices.
836 # @param thePnt2 Second of two opposite vertices.
837 # @return New GEOM_Object, containing the created box.
839 # @ref tui_creation_box "Example"
840 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
841 # Example: see GEOM_TestAll.py
842 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
843 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
846 ## Create a face with specified dimensions along OX-OY coordinate axes,
847 # with edges, parallel to this coordinate axes.
848 # @param theH height of Face.
849 # @param theW width of Face.
850 # @param theOrientation orientation belong axis OXY OYZ OZX
851 # @return New GEOM_Object, containing the created face.
853 # @ref tui_creation_face "Example"
854 def MakeFaceHW(self,theH, theW, theOrientation):
855 # Example: see GEOM_TestAll.py
856 theH,theW,Parameters = ParseParameters(theH, theW)
857 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
858 RaiseIfFailed("MakeFaceHW", self.PrimOp)
859 anObj.SetParameters(Parameters)
862 ## Create a face from another plane and two sizes,
863 # vertical size and horisontal size.
864 # @param theObj Normale vector to the creating face or
866 # @param theH Height (vertical size).
867 # @param theW Width (horisontal size).
868 # @return New GEOM_Object, containing the created face.
870 # @ref tui_creation_face "Example"
871 def MakeFaceObjHW(self, theObj, theH, theW):
872 # Example: see GEOM_TestAll.py
873 theH,theW,Parameters = ParseParameters(theH, theW)
874 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
875 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
876 anObj.SetParameters(Parameters)
879 ## Create a disk with given center, normal vector and radius.
880 # @param thePnt Disk center.
881 # @param theVec Vector, normal to the plane of the disk.
882 # @param theR Disk radius.
883 # @return New GEOM_Object, containing the created disk.
885 # @ref tui_creation_disk "Example"
886 def MakeDiskPntVecR(self,thePnt, theVec, theR):
887 # Example: see GEOM_TestAll.py
888 theR,Parameters = ParseParameters(theR)
889 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
890 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
891 anObj.SetParameters(Parameters)
894 ## Create a disk, passing through three given points
895 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
896 # @return New GEOM_Object, containing the created disk.
898 # @ref tui_creation_disk "Example"
899 def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3):
900 # Example: see GEOM_TestAll.py
901 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
902 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
905 ## Create a disk with specified dimensions along OX-OY coordinate axes.
906 # @param theR Radius of Face.
907 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
908 # @return New GEOM_Object, containing the created disk.
910 # @ref tui_creation_face "Example"
911 def MakeDiskR(self,theR, theOrientation):
912 # Example: see GEOM_TestAll.py
913 theR,Parameters = ParseParameters(theR)
914 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
915 RaiseIfFailed("MakeDiskR", self.PrimOp)
916 anObj.SetParameters(Parameters)
919 ## Create a cylinder with given base point, axis, radius and height.
920 # @param thePnt Central point of cylinder base.
921 # @param theAxis Cylinder axis.
922 # @param theR Cylinder radius.
923 # @param theH Cylinder height.
924 # @return New GEOM_Object, containing the created cylinder.
926 # @ref tui_creation_cylinder "Example"
927 def MakeCylinder(self,thePnt, theAxis, theR, theH):
928 # Example: see GEOM_TestAll.py
929 theR,theH,Parameters = ParseParameters(theR, theH)
930 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
931 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
932 anObj.SetParameters(Parameters)
935 ## Create a cylinder with given radius and height at
936 # the origin of coordinate system. Axis of the cylinder
937 # will be collinear to the OZ axis of the coordinate system.
938 # @param theR Cylinder radius.
939 # @param theH Cylinder height.
940 # @return New GEOM_Object, containing the created cylinder.
942 # @ref tui_creation_cylinder "Example"
943 def MakeCylinderRH(self,theR, theH):
944 # Example: see GEOM_TestAll.py
945 theR,theH,Parameters = ParseParameters(theR, theH)
946 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
947 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
948 anObj.SetParameters(Parameters)
951 ## Create a sphere with given center and radius.
952 # @param thePnt Sphere center.
953 # @param theR Sphere radius.
954 # @return New GEOM_Object, containing the created sphere.
956 # @ref tui_creation_sphere "Example"
957 def MakeSpherePntR(self, thePnt, theR):
958 # Example: see GEOM_TestAll.py
959 theR,Parameters = ParseParameters(theR)
960 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
961 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
962 anObj.SetParameters(Parameters)
965 ## Create a sphere with given center and radius.
966 # @param x,y,z Coordinates of sphere center.
967 # @param theR Sphere radius.
968 # @return New GEOM_Object, containing the created sphere.
970 # @ref tui_creation_sphere "Example"
971 def MakeSphere(self, x, y, z, theR):
972 # Example: see GEOM_TestAll.py
973 point = self.MakeVertex(x, y, z)
974 anObj = self.MakeSpherePntR(point, theR)
977 ## Create a sphere with given radius at the origin of coordinate system.
978 # @param theR Sphere radius.
979 # @return New GEOM_Object, containing the created sphere.
981 # @ref tui_creation_sphere "Example"
982 def MakeSphereR(self, theR):
983 # Example: see GEOM_TestAll.py
984 theR,Parameters = ParseParameters(theR)
985 anObj = self.PrimOp.MakeSphereR(theR)
986 RaiseIfFailed("MakeSphereR", self.PrimOp)
987 anObj.SetParameters(Parameters)
990 ## Create a cone with given base point, axis, height and radiuses.
991 # @param thePnt Central point of the first cone base.
992 # @param theAxis Cone axis.
993 # @param theR1 Radius of the first cone base.
994 # @param theR2 Radius of the second cone base.
995 # \note If both radiuses are non-zero, the cone will be truncated.
996 # \note If the radiuses are equal, a cylinder will be created instead.
997 # @param theH Cone height.
998 # @return New GEOM_Object, containing the created cone.
1000 # @ref tui_creation_cone "Example"
1001 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
1002 # Example: see GEOM_TestAll.py
1003 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1004 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
1005 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
1006 anObj.SetParameters(Parameters)
1009 ## Create a cone with given height and radiuses at
1010 # the origin of coordinate system. Axis of the cone will
1011 # be collinear to the OZ axis of the coordinate system.
1012 # @param theR1 Radius of the first cone base.
1013 # @param theR2 Radius of the second cone base.
1014 # \note If both radiuses are non-zero, the cone will be truncated.
1015 # \note If the radiuses are equal, a cylinder will be created instead.
1016 # @param theH Cone height.
1017 # @return New GEOM_Object, containing the created cone.
1019 # @ref tui_creation_cone "Example"
1020 def MakeConeR1R2H(self,theR1, theR2, theH):
1021 # Example: see GEOM_TestAll.py
1022 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1023 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
1024 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
1025 anObj.SetParameters(Parameters)
1028 ## Create a torus with given center, normal vector and radiuses.
1029 # @param thePnt Torus central point.
1030 # @param theVec Torus axis of symmetry.
1031 # @param theRMajor Torus major radius.
1032 # @param theRMinor Torus minor radius.
1033 # @return New GEOM_Object, containing the created torus.
1035 # @ref tui_creation_torus "Example"
1036 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
1037 # Example: see GEOM_TestAll.py
1038 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1039 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
1040 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
1041 anObj.SetParameters(Parameters)
1044 ## Create a torus with given radiuses at the origin of coordinate system.
1045 # @param theRMajor Torus major radius.
1046 # @param theRMinor Torus minor radius.
1047 # @return New GEOM_Object, containing the created torus.
1049 # @ref tui_creation_torus "Example"
1050 def MakeTorusRR(self, theRMajor, theRMinor):
1051 # Example: see GEOM_TestAll.py
1052 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1053 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
1054 RaiseIfFailed("MakeTorusRR", self.PrimOp)
1055 anObj.SetParameters(Parameters)
1058 # end of l3_3d_primitives
1061 ## @addtogroup l3_complex
1064 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
1065 # @param theBase Base shape to be extruded.
1066 # @param thePoint1 First end of extrusion vector.
1067 # @param thePoint2 Second end of extrusion vector.
1068 # @return New GEOM_Object, containing the created prism.
1070 # @ref tui_creation_prism "Example"
1071 def MakePrism(self, theBase, thePoint1, thePoint2):
1072 # Example: see GEOM_TestAll.py
1073 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
1074 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1077 ## Create a shape by extrusion of the base shape along the vector,
1078 # i.e. all the space, transfixed by the base shape during its translation
1079 # along the vector on the given distance.
1080 # @param theBase Base shape to be extruded.
1081 # @param theVec Direction of extrusion.
1082 # @param theH Prism dimension along theVec.
1083 # @return New GEOM_Object, containing the created prism.
1085 # @ref tui_creation_prism "Example"
1086 def MakePrismVecH(self, theBase, theVec, theH):
1087 # Example: see GEOM_TestAll.py
1088 theH,Parameters = ParseParameters(theH)
1089 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
1090 RaiseIfFailed("MakePrismVecH", self.PrimOp)
1091 anObj.SetParameters(Parameters)
1094 ## Create a shape by extrusion of the base shape along the vector,
1095 # i.e. all the space, transfixed by the base shape during its translation
1096 # along the vector on the given distance in 2 Ways (forward/backward) .
1097 # @param theBase Base shape to be extruded.
1098 # @param theVec Direction of extrusion.
1099 # @param theH Prism dimension along theVec in forward direction.
1100 # @return New GEOM_Object, containing the created prism.
1102 # @ref tui_creation_prism "Example"
1103 def MakePrismVecH2Ways(self, theBase, theVec, theH):
1104 # Example: see GEOM_TestAll.py
1105 theH,Parameters = ParseParameters(theH)
1106 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
1107 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
1108 anObj.SetParameters(Parameters)
1111 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1112 # @param theBase Base shape to be extruded.
1113 # @param theDX, theDY, theDZ Directions of extrusion.
1114 # @return New GEOM_Object, containing the created prism.
1116 # @ref tui_creation_prism "Example"
1117 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ):
1118 # Example: see GEOM_TestAll.py
1119 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1120 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
1121 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
1122 anObj.SetParameters(Parameters)
1125 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1126 # i.e. all the space, transfixed by the base shape during its translation
1127 # along the vector on the given distance in 2 Ways (forward/backward) .
1128 # @param theBase Base shape to be extruded.
1129 # @param theDX, theDY, theDZ Directions of extrusion.
1130 # @return New GEOM_Object, containing the created prism.
1132 # @ref tui_creation_prism "Example"
1133 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
1134 # Example: see GEOM_TestAll.py
1135 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1136 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
1137 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
1138 anObj.SetParameters(Parameters)
1141 ## Create a shape by revolution of the base shape around the axis
1142 # on the given angle, i.e. all the space, transfixed by the base
1143 # shape during its rotation around the axis on the given angle.
1144 # @param theBase Base shape to be rotated.
1145 # @param theAxis Rotation axis.
1146 # @param theAngle Rotation angle in radians.
1147 # @return New GEOM_Object, containing the created revolution.
1149 # @ref tui_creation_revolution "Example"
1150 def MakeRevolution(self, theBase, theAxis, theAngle):
1151 # Example: see GEOM_TestAll.py
1152 theAngle,Parameters = ParseParameters(theAngle)
1153 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
1154 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
1155 anObj.SetParameters(Parameters)
1158 ## The Same Revolution but in both ways forward&backward.
1159 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
1160 theAngle,Parameters = ParseParameters(theAngle)
1161 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
1162 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
1163 anObj.SetParameters(Parameters)
1166 ## Create a filling from the given compound of contours.
1167 # @param theShape the compound of contours
1168 # @param theMinDeg a minimal degree of BSpline surface to create
1169 # @param theMaxDeg a maximal degree of BSpline surface to create
1170 # @param theTol2D a 2d tolerance to be reached
1171 # @param theTol3D a 3d tolerance to be reached
1172 # @param theNbIter a number of iteration of approximation algorithm
1173 # @param isApprox if True, BSpline curves are generated in the process
1174 # of surface construction. By default it is False, that means
1175 # the surface is created using Besier curves. The usage of
1176 # Approximation makes the algorithm work slower, but allows
1177 # building the surface for rather complex cases
1178 # @return New GEOM_Object, containing the created filling surface.
1180 # @ref tui_creation_filling "Example"
1181 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
1182 # Example: see GEOM_TestAll.py
1183 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg,
1184 theTol2D, theTol3D, theNbIter)
1185 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
1186 theTol2D, theTol3D, theNbIter, isApprox)
1187 RaiseIfFailed("MakeFilling", self.PrimOp)
1188 anObj.SetParameters(Parameters)
1191 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
1192 # @param theSeqSections - set of specified sections.
1193 # @param theModeSolid - mode defining building solid or shell
1194 # @param thePreci - precision 3D used for smoothing by default 1.e-6
1195 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
1196 # @return New GEOM_Object, containing the created shell or solid.
1198 # @ref swig_todo "Example"
1199 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
1200 # Example: see GEOM_TestAll.py
1201 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
1202 RaiseIfFailed("MakeThruSections", self.PrimOp)
1205 ## Create a shape by extrusion of the base shape along
1206 # the path shape. The path shape can be a wire or an edge.
1207 # @param theBase Base shape to be extruded.
1208 # @param thePath Path shape to extrude the base shape along it.
1209 # @return New GEOM_Object, containing the created pipe.
1211 # @ref tui_creation_pipe "Example"
1212 def MakePipe(self,theBase, thePath):
1213 # Example: see GEOM_TestAll.py
1214 anObj = self.PrimOp.MakePipe(theBase, thePath)
1215 RaiseIfFailed("MakePipe", self.PrimOp)
1218 ## Create a shape by extrusion of the profile shape along
1219 # the path shape. The path shape can be a wire or an edge.
1220 # the several profiles can be specified in the several locations of path.
1221 # @param theSeqBases - list of Bases shape to be extruded.
1222 # @param theLocations - list of locations on the path corresponding
1223 # specified list of the Bases shapes. Number of locations
1224 # should be equal to number of bases or list of locations can be empty.
1225 # @param thePath - Path shape to extrude the base shape along it.
1226 # @param theWithContact - the mode defining that the section is translated to be in
1227 # contact with the spine.
1228 # @param theWithCorrection - defining that the section is rotated to be
1229 # orthogonal to the spine tangent in the correspondent point
1230 # @return New GEOM_Object, containing the created pipe.
1232 # @ref tui_creation_pipe_with_diff_sec "Example"
1233 def MakePipeWithDifferentSections(self, theSeqBases,
1234 theLocations, thePath,
1235 theWithContact, theWithCorrection):
1236 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
1237 theLocations, thePath,
1238 theWithContact, theWithCorrection)
1239 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
1242 ## Create a shape by extrusion of the profile shape along
1243 # the path shape. The path shape can be a wire or a edge.
1244 # the several profiles can be specified in the several locations of path.
1245 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
1246 # shell or face. If number of faces in neighbour sections
1247 # aren't coincided result solid between such sections will
1248 # be created using external boundaries of this shells.
1249 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
1250 # This list is used for searching correspondences between
1251 # faces in the sections. Size of this list must be equal
1252 # to size of list of base shapes.
1253 # @param theLocations - list of locations on the path corresponding
1254 # specified list of the Bases shapes. Number of locations
1255 # should be equal to number of bases. First and last
1256 # locations must be coincided with first and last vertexes
1257 # of path correspondingly.
1258 # @param thePath - Path shape to extrude the base shape along it.
1259 # @param theWithContact - the mode defining that the section is translated to be in
1260 # contact with the spine.
1261 # @param theWithCorrection - defining that the section is rotated to be
1262 # orthogonal to the spine tangent in the correspondent point
1263 # @return New GEOM_Object, containing the created solids.
1265 # @ref tui_creation_pipe_with_shell_sec "Example"
1266 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
1267 theLocations, thePath,
1268 theWithContact, theWithCorrection):
1269 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
1270 theLocations, thePath,
1271 theWithContact, theWithCorrection)
1272 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1275 ## Create a shape by extrusion of the profile shape along
1276 # the path shape. This function is used only for debug pipe
1277 # functionality - it is a version of previous function
1278 # (MakePipeWithShellSections(...)) which give a possibility to
1279 # recieve information about creating pipe between each pair of
1280 # sections step by step.
1281 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
1282 theLocations, thePath,
1283 theWithContact, theWithCorrection):
1285 nbsect = len(theSeqBases)
1286 nbsubsect = len(theSeqSubBases)
1287 #print "nbsect = ",nbsect
1288 for i in range(1,nbsect):
1290 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
1291 tmpLocations = [ theLocations[i-1], theLocations[i] ]
1293 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
1294 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
1295 tmpLocations, thePath,
1296 theWithContact, theWithCorrection)
1297 if self.PrimOp.IsDone() == 0:
1298 print "Problems with pipe creation between ",i," and ",i+1," sections"
1299 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1302 print "Pipe between ",i," and ",i+1," sections is OK"
1307 resc = self.MakeCompound(res)
1308 #resc = self.MakeSewing(res, 0.001)
1309 #print "resc: ",resc
1312 ## Create solids between given sections
1313 # @param theSeqBases - list of sections (shell or face).
1314 # @param theLocations - list of corresponding vertexes
1315 # @return New GEOM_Object, containing the created solids.
1317 # @ref tui_creation_pipe_without_path "Example"
1318 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1319 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1320 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1323 ## Create a shape by extrusion of the base shape along
1324 # the path shape with constant bi-normal direction along the given vector.
1325 # The path shape can be a wire or an edge.
1326 # @param theBase Base shape to be extruded.
1327 # @param thePath Path shape to extrude the base shape along it.
1328 # @param theVec Vector defines a constant binormal direction to keep the
1329 # same angle beetween the direction and the sections
1330 # along the sweep surface.
1331 # @return New GEOM_Object, containing the created pipe.
1333 # @ref tui_creation_pipe "Example"
1334 def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
1335 # Example: see GEOM_TestAll.py
1336 anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
1337 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
1343 ## @addtogroup l3_advanced
1346 ## Create a linear edge with specified ends.
1347 # @param thePnt1 Point for the first end of edge.
1348 # @param thePnt2 Point for the second end of edge.
1349 # @return New GEOM_Object, containing the created edge.
1351 # @ref tui_creation_edge "Example"
1352 def MakeEdge(self,thePnt1, thePnt2):
1353 # Example: see GEOM_TestAll.py
1354 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1355 RaiseIfFailed("MakeEdge", self.ShapesOp)
1358 ## Create a wire from the set of edges and wires.
1359 # @param theEdgesAndWires List of edges and/or wires.
1360 # @return New GEOM_Object, containing the created wire.
1362 # @ref tui_creation_wire "Example"
1363 def MakeWire(self,theEdgesAndWires):
1364 # Example: see GEOM_TestAll.py
1365 anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
1366 RaiseIfFailed("MakeWire", self.ShapesOp)
1369 ## Create a face on the given wire.
1370 # @param theWire closed Wire or Edge to build the face on.
1371 # @param isPlanarWanted If TRUE, only planar face will be built.
1372 # If impossible, NULL object will be returned.
1373 # @return New GEOM_Object, containing the created face.
1375 # @ref tui_creation_face "Example"
1376 def MakeFace(self,theWire, isPlanarWanted):
1377 # Example: see GEOM_TestAll.py
1378 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1379 RaiseIfFailed("MakeFace", self.ShapesOp)
1382 ## Create a face on the given wires set.
1383 # @param theWires List of closed wires or edges to build the face on.
1384 # @param isPlanarWanted If TRUE, only planar face will be built.
1385 # If impossible, NULL object will be returned.
1386 # @return New GEOM_Object, containing the created face.
1388 # @ref tui_creation_face "Example"
1389 def MakeFaceWires(self,theWires, isPlanarWanted):
1390 # Example: see GEOM_TestAll.py
1391 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1392 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1395 ## Shortcut to MakeFaceWires()
1397 # @ref tui_creation_face "Example 1"
1398 # \n @ref swig_MakeFaces "Example 2"
1399 def MakeFaces(self,theWires, isPlanarWanted):
1400 # Example: see GEOM_TestOthers.py
1401 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1404 ## Create a shell from the set of faces and shells.
1405 # @param theFacesAndShells List of faces and/or shells.
1406 # @return New GEOM_Object, containing the created shell.
1408 # @ref tui_creation_shell "Example"
1409 def MakeShell(self,theFacesAndShells):
1410 # Example: see GEOM_TestAll.py
1411 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1412 RaiseIfFailed("MakeShell", self.ShapesOp)
1415 ## Create a solid, bounded by the given shells.
1416 # @param theShells Sequence of bounding shells.
1417 # @return New GEOM_Object, containing the created solid.
1419 # @ref tui_creation_solid "Example"
1420 def MakeSolid(self,theShells):
1421 # Example: see GEOM_TestAll.py
1422 anObj = self.ShapesOp.MakeSolidShells(theShells)
1423 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1426 ## Create a compound of the given shapes.
1427 # @param theShapes List of shapes to put in compound.
1428 # @return New GEOM_Object, containing the created compound.
1430 # @ref tui_creation_compound "Example"
1431 def MakeCompound(self,theShapes):
1432 # Example: see GEOM_TestAll.py
1433 anObj = self.ShapesOp.MakeCompound(theShapes)
1434 RaiseIfFailed("MakeCompound", self.ShapesOp)
1437 # end of l3_advanced
1440 ## @addtogroup l2_measure
1443 ## Gives quantity of faces in the given shape.
1444 # @param theShape Shape to count faces of.
1445 # @return Quantity of faces.
1447 # @ref swig_NumberOfFaces "Example"
1448 def NumberOfFaces(self,theShape):
1449 # Example: see GEOM_TestOthers.py
1450 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1451 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1454 ## Gives quantity of edges in the given shape.
1455 # @param theShape Shape to count edges of.
1456 # @return Quantity of edges.
1458 # @ref swig_NumberOfEdges "Example"
1459 def NumberOfEdges(self,theShape):
1460 # Example: see GEOM_TestOthers.py
1461 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1462 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1468 ## @addtogroup l3_healing
1471 ## Reverses an orientation the given shape.
1472 # @param theShape Shape to be reversed.
1473 # @return The reversed copy of theShape.
1475 # @ref swig_ChangeOrientation "Example"
1476 def ChangeOrientation(self,theShape):
1477 # Example: see GEOM_TestAll.py
1478 anObj = self.ShapesOp.ChangeOrientation(theShape)
1479 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1482 ## Shortcut to ChangeOrientation()
1484 # @ref swig_OrientationChange "Example"
1485 def OrientationChange(self,theShape):
1486 # Example: see GEOM_TestOthers.py
1487 anObj = self.ChangeOrientation(theShape)
1493 ## @addtogroup l4_obtain
1496 ## Retrieve all free faces from the given shape.
1497 # Free face is a face, which is not shared between two shells of the shape.
1498 # @param theShape Shape to find free faces in.
1499 # @return List of IDs of all free faces, contained in theShape.
1501 # @ref tui_measurement_tools_page "Example"
1502 def GetFreeFacesIDs(self,theShape):
1503 # Example: see GEOM_TestOthers.py
1504 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1505 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1508 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1509 # @param theShape1 Shape to find sub-shapes in.
1510 # @param theShape2 Shape to find shared sub-shapes with.
1511 # @param theShapeType Type of sub-shapes to be retrieved.
1512 # @return List of sub-shapes of theShape1, shared with theShape2.
1514 # @ref swig_GetSharedShapes "Example"
1515 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1516 # Example: see GEOM_TestOthers.py
1517 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1518 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1521 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1522 # situated relatively the specified plane by the certain way,
1523 # defined through <VAR>theState</VAR> parameter.
1524 # @param theShape Shape to find sub-shapes of.
1525 # @param theShapeType Type of sub-shapes to be retrieved.
1526 # @param theAx1 Vector (or line, or linear edge), specifying normal
1527 # direction and location of the plane to find shapes on.
1528 # @param theState The state of the subshapes to find. It can be one of
1529 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1530 # @return List of all found sub-shapes.
1532 # @ref swig_GetShapesOnPlane "Example"
1533 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1534 # Example: see GEOM_TestOthers.py
1535 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1536 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1539 ## Works like the above method, but returns list of sub-shapes indices
1541 # @ref swig_GetShapesOnPlaneIDs "Example"
1542 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1543 # Example: see GEOM_TestOthers.py
1544 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1545 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1548 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1549 # situated relatively the specified plane by the certain way,
1550 # defined through <VAR>theState</VAR> parameter.
1551 # @param theShape Shape to find sub-shapes of.
1552 # @param theShapeType Type of sub-shapes to be retrieved.
1553 # @param theAx1 Vector (or line, or linear edge), specifying normal
1554 # direction of the plane to find shapes on.
1555 # @param thePnt Point specifying location of the plane to find shapes on.
1556 # @param theState The state of the subshapes to find. It can be one of
1557 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1558 # @return List of all found sub-shapes.
1560 # @ref swig_GetShapesOnPlaneWithLocation "Example"
1561 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1562 # Example: see GEOM_TestOthers.py
1563 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1564 theAx1, thePnt, theState)
1565 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1568 ## Works like the above method, but returns list of sub-shapes indices
1570 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
1571 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1572 # Example: see GEOM_TestOthers.py
1573 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1574 theAx1, thePnt, theState)
1575 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1578 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1579 # the specified cylinder by the certain way, defined through \a theState parameter.
1580 # @param theShape Shape to find sub-shapes of.
1581 # @param theShapeType Type of sub-shapes to be retrieved.
1582 # @param theAxis Vector (or line, or linear edge), specifying
1583 # axis of the cylinder to find shapes on.
1584 # @param theRadius Radius of the cylinder to find shapes on.
1585 # @param theState The state of the subshapes to find. It can be one of
1586 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1587 # @return List of all found sub-shapes.
1589 # @ref swig_GetShapesOnCylinder "Example"
1590 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1591 # Example: see GEOM_TestOthers.py
1592 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1593 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1596 ## Works like the above method, but returns list of sub-shapes indices
1598 # @ref swig_GetShapesOnCylinderIDs "Example"
1599 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1600 # Example: see GEOM_TestOthers.py
1601 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1602 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1605 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1606 # the specified sphere by the certain way, defined through \a theState parameter.
1607 # @param theShape Shape to find sub-shapes of.
1608 # @param theShapeType Type of sub-shapes to be retrieved.
1609 # @param theCenter Point, specifying center of the sphere to find shapes on.
1610 # @param theRadius Radius of the sphere to find shapes on.
1611 # @param theState The state of the subshapes to find. It can be one of
1612 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1613 # @return List of all found sub-shapes.
1615 # @ref swig_GetShapesOnSphere "Example"
1616 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1617 # Example: see GEOM_TestOthers.py
1618 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1619 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1622 ## Works like the above method, but returns list of sub-shapes indices
1624 # @ref swig_GetShapesOnSphereIDs "Example"
1625 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1626 # Example: see GEOM_TestOthers.py
1627 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1628 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1631 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1632 # the specified quadrangle by the certain way, defined through \a theState parameter.
1633 # @param theShape Shape to find sub-shapes of.
1634 # @param theShapeType Type of sub-shapes to be retrieved.
1635 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1636 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1637 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1638 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1639 # @param theState The state of the subshapes to find. It can be one of
1640 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1641 # @return List of all found sub-shapes.
1643 # @ref swig_GetShapesOnQuadrangle "Example"
1644 def GetShapesOnQuadrangle(self, theShape, theShapeType,
1645 theTopLeftPoint, theTopRigthPoint,
1646 theBottomLeftPoint, theBottomRigthPoint, theState):
1647 # Example: see GEOM_TestOthers.py
1648 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
1649 theTopLeftPoint, theTopRigthPoint,
1650 theBottomLeftPoint, theBottomRigthPoint, theState)
1651 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
1654 ## Works like the above method, but returns list of sub-shapes indices
1656 # @ref swig_GetShapesOnQuadrangleIDs "Example"
1657 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
1658 theTopLeftPoint, theTopRigthPoint,
1659 theBottomLeftPoint, theBottomRigthPoint, theState):
1660 # Example: see GEOM_TestOthers.py
1661 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
1662 theTopLeftPoint, theTopRigthPoint,
1663 theBottomLeftPoint, theBottomRigthPoint, theState)
1664 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
1667 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1668 # the specified \a theBox by the certain way, defined through \a theState parameter.
1669 # @param theBox Shape for relative comparing.
1670 # @param theShape Shape to find sub-shapes of.
1671 # @param theShapeType Type of sub-shapes to be retrieved.
1672 # @param theState The state of the subshapes to find. It can be one of
1673 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1674 # @return List of all found sub-shapes.
1676 # @ref swig_GetShapesOnBox "Example"
1677 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
1678 # Example: see GEOM_TestOthers.py
1679 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
1680 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
1683 ## Works like the above method, but returns list of sub-shapes indices
1685 # @ref swig_GetShapesOnBoxIDs "Example"
1686 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
1687 # Example: see GEOM_TestOthers.py
1688 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
1689 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
1692 ## Find in \a theShape all sub-shapes of type \a theShapeType,
1693 # situated relatively the specified \a theCheckShape by the
1694 # certain way, defined through \a theState parameter.
1695 # @param theCheckShape Shape for relative comparing.
1696 # @param theShape Shape to find sub-shapes of.
1697 # @param theShapeType Type of sub-shapes to be retrieved.
1698 # @param theState The state of the subshapes to find. It can be one of
1699 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1700 # @return List of all found sub-shapes.
1702 # @ref swig_GetShapesOnShape "Example"
1703 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
1704 # Example: see GEOM_TestOthers.py
1705 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
1706 theShapeType, theState)
1707 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
1710 ## Works like the above method, but returns result as compound
1712 # @ref swig_GetShapesOnShapeAsCompound "Example"
1713 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
1714 # Example: see GEOM_TestOthers.py
1715 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
1716 theShapeType, theState)
1717 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
1720 ## Works like the above method, but returns list of sub-shapes indices
1722 # @ref swig_GetShapesOnShapeIDs "Example"
1723 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
1724 # Example: see GEOM_TestOthers.py
1725 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
1726 theShapeType, theState)
1727 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
1730 ## Get sub-shape(s) of theShapeWhere, which are
1731 # coincident with \a theShapeWhat or could be a part of it.
1732 # @param theShapeWhere Shape to find sub-shapes of.
1733 # @param theShapeWhat Shape, specifying what to find.
1734 # @return Group of all found sub-shapes or a single found sub-shape.
1736 # @ref swig_GetInPlace "Example"
1737 def GetInPlace(self,theShapeWhere, theShapeWhat):
1738 # Example: see GEOM_TestOthers.py
1739 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
1740 RaiseIfFailed("GetInPlace", self.ShapesOp)
1743 ## Get sub-shape(s) of \a theShapeWhere, which are
1744 # coincident with \a theShapeWhat or could be a part of it.
1746 # Implementation of this method is based on a saved history of an operation,
1747 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
1748 # arguments (an argument shape or a sub-shape of an argument shape).
1749 # The operation could be the Partition or one of boolean operations,
1750 # performed on simple shapes (not on compounds).
1752 # @param theShapeWhere Shape to find sub-shapes of.
1753 # @param theShapeWhat Shape, specifying what to find (must be in the
1754 # building history of the ShapeWhere).
1755 # @return Group of all found sub-shapes or a single found sub-shape.
1757 # @ref swig_GetInPlace "Example"
1758 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
1759 # Example: see GEOM_TestOthers.py
1760 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
1761 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
1764 ## Get sub-shape of theShapeWhere, which is
1765 # equal to \a theShapeWhat.
1766 # @param theShapeWhere Shape to find sub-shape of.
1767 # @param theShapeWhat Shape, specifying what to find.
1768 # @return New GEOM_Object for found sub-shape.
1770 # @ref swig_GetSame "Example"
1771 def GetSame(self,theShapeWhere, theShapeWhat):
1772 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
1773 RaiseIfFailed("GetSame", self.ShapesOp)
1779 ## @addtogroup l4_access
1782 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
1783 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
1785 # @ref swig_all_decompose "Example"
1786 def GetSubShape(self, aShape, ListOfID):
1787 # Example: see GEOM_TestAll.py
1788 anObj = self.AddSubShape(aShape,ListOfID)
1791 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
1793 # @ref swig_all_decompose "Example"
1794 def GetSubShapeID(self, aShape, aSubShape):
1795 # Example: see GEOM_TestAll.py
1796 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
1797 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
1803 ## @addtogroup l4_decompose
1806 ## Explode a shape on subshapes of a given type.
1807 # @param aShape Shape to be exploded.
1808 # @param aType Type of sub-shapes to be retrieved.
1809 # @return List of sub-shapes of type theShapeType, contained in theShape.
1811 # @ref swig_all_decompose "Example"
1812 def SubShapeAll(self, aShape, aType):
1813 # Example: see GEOM_TestAll.py
1814 ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
1815 RaiseIfFailed("MakeExplode", self.ShapesOp)
1818 ## Explode a shape on subshapes of a given type.
1819 # @param aShape Shape to be exploded.
1820 # @param aType Type of sub-shapes to be retrieved.
1821 # @return List of IDs of sub-shapes.
1823 # @ref swig_all_decompose "Example"
1824 def SubShapeAllIDs(self, aShape, aType):
1825 ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
1826 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1829 ## Explode a shape on subshapes of a given type.
1830 # Sub-shapes will be sorted by coordinates of their gravity centers.
1831 # @param aShape Shape to be exploded.
1832 # @param aType Type of sub-shapes to be retrieved.
1833 # @return List of sub-shapes of type theShapeType, contained in theShape.
1835 # @ref swig_SubShapeAllSorted "Example"
1836 def SubShapeAllSorted(self, aShape, aType):
1837 # Example: see GEOM_TestAll.py
1838 ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
1839 RaiseIfFailed("MakeExplode", self.ShapesOp)
1842 ## Explode a shape on subshapes of a given type.
1843 # Sub-shapes will be sorted by coordinates of their gravity centers.
1844 # @param aShape Shape to be exploded.
1845 # @param aType Type of sub-shapes to be retrieved.
1846 # @return List of IDs of sub-shapes.
1848 # @ref swig_all_decompose "Example"
1849 def SubShapeAllSortedIDs(self, aShape, aType):
1850 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
1851 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1854 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1855 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
1856 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1858 # @ref swig_all_decompose "Example"
1859 def SubShape(self, aShape, aType, ListOfInd):
1860 # Example: see GEOM_TestAll.py
1862 AllShapeList = self.SubShapeAll(aShape, aType)
1863 for ind in ListOfInd:
1864 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1865 anObj = self.GetSubShape(aShape, ListOfIDs)
1868 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1869 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
1870 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1872 # @ref swig_all_decompose "Example"
1873 def SubShapeSorted(self,aShape, aType, ListOfInd):
1874 # Example: see GEOM_TestAll.py
1876 AllShapeList = self.SubShapeAllSorted(aShape, aType)
1877 for ind in ListOfInd:
1878 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1879 anObj = self.GetSubShape(aShape, ListOfIDs)
1882 # end of l4_decompose
1885 ## @addtogroup l3_healing
1888 ## Apply a sequence of Shape Healing operators to the given object.
1889 # @param theShape Shape to be processed.
1890 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1891 # @param theParameters List of names of parameters
1892 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1893 # @param theValues List of values of parameters, in the same order
1894 # as parameters are listed in <VAR>theParameters</VAR> list.
1895 # @return New GEOM_Object, containing processed shape.
1897 # @ref tui_shape_processing "Example"
1898 def ProcessShape(self,theShape, theOperators, theParameters, theValues):
1899 # Example: see GEOM_TestHealing.py
1900 theValues,Parameters = ParseList(theValues)
1901 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1902 RaiseIfFailed("ProcessShape", self.HealOp)
1903 for string in (theOperators + theParameters):
1904 Parameters = ":" + Parameters
1906 anObj.SetParameters(Parameters)
1909 ## Remove faces from the given object (shape).
1910 # @param theObject Shape to be processed.
1911 # @param theFaces Indices of faces to be removed, if EMPTY then the method
1912 # removes ALL faces of the given object.
1913 # @return New GEOM_Object, containing processed shape.
1915 # @ref tui_suppress_faces "Example"
1916 def SuppressFaces(self,theObject, theFaces):
1917 # Example: see GEOM_TestHealing.py
1918 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
1919 RaiseIfFailed("SuppressFaces", self.HealOp)
1922 ## Sewing of some shapes into single shape.
1924 # @ref tui_sewing "Example"
1925 def MakeSewing(self, ListShape, theTolerance):
1926 # Example: see GEOM_TestHealing.py
1927 comp = self.MakeCompound(ListShape)
1928 anObj = self.Sew(comp, theTolerance)
1931 ## Sewing of the given object.
1932 # @param theObject Shape to be processed.
1933 # @param theTolerance Required tolerance value.
1934 # @return New GEOM_Object, containing processed shape.
1935 def Sew(self, theObject, theTolerance):
1936 # Example: see MakeSewing() above
1937 theTolerance,Parameters = ParseParameters(theTolerance)
1938 anObj = self.HealOp.Sew(theObject, theTolerance)
1939 RaiseIfFailed("Sew", self.HealOp)
1940 anObj.SetParameters(Parameters)
1943 ## Remove internal wires and edges from the given object (face).
1944 # @param theObject Shape to be processed.
1945 # @param theWires Indices of wires to be removed, if EMPTY then the method
1946 # removes ALL internal wires of the given object.
1947 # @return New GEOM_Object, containing processed shape.
1949 # @ref tui_suppress_internal_wires "Example"
1950 def SuppressInternalWires(self,theObject, theWires):
1951 # Example: see GEOM_TestHealing.py
1952 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
1953 RaiseIfFailed("RemoveIntWires", self.HealOp)
1956 ## Remove internal closed contours (holes) from the given object.
1957 # @param theObject Shape to be processed.
1958 # @param theWires Indices of wires to be removed, if EMPTY then the method
1959 # removes ALL internal holes of the given object
1960 # @return New GEOM_Object, containing processed shape.
1962 # @ref tui_suppress_holes "Example"
1963 def SuppressHoles(self,theObject, theWires):
1964 # Example: see GEOM_TestHealing.py
1965 anObj = self.HealOp.FillHoles(theObject, theWires)
1966 RaiseIfFailed("FillHoles", self.HealOp)
1969 ## Close an open wire.
1970 # @param theObject Shape to be processed.
1971 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1972 # if -1, then <VAR>theObject</VAR> itself is a wire.
1973 # @param isCommonVertex If TRUE : closure by creation of a common vertex,
1974 # If FALS : closure by creation of an edge between ends.
1975 # @return New GEOM_Object, containing processed shape.
1977 # @ref tui_close_contour "Example"
1978 def CloseContour(self,theObject, theWires, isCommonVertex):
1979 # Example: see GEOM_TestHealing.py
1980 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
1981 RaiseIfFailed("CloseContour", self.HealOp)
1984 ## Addition of a point to a given edge object.
1985 # @param theObject Shape to be processed.
1986 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
1987 # if -1, then theObject itself is the edge.
1988 # @param theValue Value of parameter on edge or length parameter,
1989 # depending on \a isByParameter.
1990 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1991 # if FALSE : \a theValue is treated as a length parameter [0..1]
1992 # @return New GEOM_Object, containing processed shape.
1994 # @ref tui_add_point_on_edge "Example"
1995 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
1996 # Example: see GEOM_TestHealing.py
1997 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
1998 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1999 RaiseIfFailed("DivideEdge", self.HealOp)
2000 anObj.SetParameters(Parameters)
2003 ## Change orientation of the given object. Updates given shape.
2004 # @param theObject Shape to be processed.
2006 # @ref swig_todo "Example"
2007 def ChangeOrientationShell(self,theObject):
2008 theObject = self.HealOp.ChangeOrientation(theObject)
2009 RaiseIfFailed("ChangeOrientation", self.HealOp)
2012 ## Change orientation of the given object.
2013 # @param theObject Shape to be processed.
2014 # @return New GEOM_Object, containing processed shape.
2016 # @ref swig_todo "Example"
2017 def ChangeOrientationShellCopy(self,theObject):
2018 anObj = self.HealOp.ChangeOrientationCopy(theObject)
2019 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
2022 ## Get a list of wires (wrapped in GEOM_Object-s),
2023 # that constitute a free boundary of the given shape.
2024 # @param theObject Shape to get free boundary of.
2025 # @return [status, theClosedWires, theOpenWires]
2026 # status: FALSE, if an error(s) occured during the method execution.
2027 # theClosedWires: Closed wires on the free boundary of the given shape.
2028 # theOpenWires: Open wires on the free boundary of the given shape.
2030 # @ref tui_measurement_tools_page "Example"
2031 def GetFreeBoundary(self,theObject):
2032 # Example: see GEOM_TestHealing.py
2033 anObj = self.HealOp.GetFreeBoundary(theObject)
2034 RaiseIfFailed("GetFreeBoundary", self.HealOp)
2037 ## Replace coincident faces in theShape by one face.
2038 # @param theShape Initial shape.
2039 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
2040 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2041 # otherwise all initial shapes.
2042 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
2044 # @ref tui_glue_faces "Example"
2045 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
2046 # Example: see GEOM_Spanner.py
2047 theTolerance,Parameters = ParseParameters(theTolerance)
2048 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
2050 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
2051 anObj.SetParameters(Parameters)
2054 ## Find coincident faces in theShape for possible gluing.
2055 # @param theShape Initial shape.
2056 # @param theTolerance Maximum distance between faces,
2057 # which can be considered as coincident.
2060 # @ref swig_todo "Example"
2061 def GetGlueFaces(self, theShape, theTolerance):
2062 # Example: see GEOM_Spanner.py
2063 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
2064 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
2067 ## Replace coincident faces in theShape by one face
2068 # in compliance with given list of faces
2069 # @param theShape Initial shape.
2070 # @param theTolerance Maximum distance between faces,
2071 # which can be considered as coincident.
2072 # @param theFaces List of faces for gluing.
2073 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2074 # otherwise all initial shapes.
2075 # @return New GEOM_Object, containing a copy of theShape
2076 # without some faces.
2078 # @ref swig_todo "Example"
2079 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
2080 # Example: see GEOM_Spanner.py
2081 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
2083 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
2089 ## @addtogroup l3_boolean Boolean Operations
2092 # -----------------------------------------------------------------------------
2093 # Boolean (Common, Cut, Fuse, Section)
2094 # -----------------------------------------------------------------------------
2096 ## Perform one of boolean operations on two given shapes.
2097 # @param theShape1 First argument for boolean operation.
2098 # @param theShape2 Second argument for boolean operation.
2099 # @param theOperation Indicates the operation to be done:
2100 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
2101 # @return New GEOM_Object, containing the result shape.
2103 # @ref tui_fuse "Example"
2104 def MakeBoolean(self,theShape1, theShape2, theOperation):
2105 # Example: see GEOM_TestAll.py
2106 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
2107 RaiseIfFailed("MakeBoolean", self.BoolOp)
2110 ## Shortcut to MakeBoolean(s1, s2, 1)
2112 # @ref tui_common "Example 1"
2113 # \n @ref swig_MakeCommon "Example 2"
2114 def MakeCommon(self, s1, s2):
2115 # Example: see GEOM_TestOthers.py
2116 return self.MakeBoolean(s1, s2, 1)
2118 ## Shortcut to MakeBoolean(s1, s2, 2)
2120 # @ref tui_cut "Example 1"
2121 # \n @ref swig_MakeCommon "Example 2"
2122 def MakeCut(self, s1, s2):
2123 # Example: see GEOM_TestOthers.py
2124 return self.MakeBoolean(s1, s2, 2)
2126 ## Shortcut to MakeBoolean(s1, s2, 3)
2128 # @ref tui_fuse "Example 1"
2129 # \n @ref swig_MakeCommon "Example 2"
2130 def MakeFuse(self, s1, s2):
2131 # Example: see GEOM_TestOthers.py
2132 return self.MakeBoolean(s1, s2, 3)
2134 ## Shortcut to MakeBoolean(s1, s2, 4)
2136 # @ref tui_section "Example 1"
2137 # \n @ref swig_MakeCommon "Example 2"
2138 def MakeSection(self, s1, s2):
2139 # Example: see GEOM_TestOthers.py
2140 return self.MakeBoolean(s1, s2, 4)
2145 ## @addtogroup l3_basic_op
2148 ## Perform partition operation.
2149 # @param ListShapes Shapes to be intersected.
2150 # @param ListTools Shapes to intersect theShapes.
2151 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
2152 # in order to avoid possible intersection between shapes from
2154 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
2155 # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
2156 # type <= Limit are kept in the result,
2157 # else - shapes with type > Limit are kept
2158 # also (if they exist)
2160 # After implementation new version of PartitionAlgo (October 2006)
2161 # other parameters are ignored by current functionality. They are kept
2162 # in this function only for support old versions.
2163 # Ignored parameters:
2164 # @param ListKeepInside Shapes, outside which the results will be deleted.
2165 # Each shape from theKeepInside must belong to theShapes also.
2166 # @param ListRemoveInside Shapes, inside which the results will be deleted.
2167 # Each shape from theRemoveInside must belong to theShapes also.
2168 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
2169 # @param ListMaterials Material indices for each shape. Make sence,
2170 # only if theRemoveWebs is TRUE.
2172 # @return New GEOM_Object, containing the result shapes.
2174 # @ref tui_partition "Example"
2175 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2176 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
2177 KeepNonlimitShapes=0):
2178 # Example: see GEOM_TestAll.py
2179 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
2180 ListKeepInside, ListRemoveInside,
2181 Limit, RemoveWebs, ListMaterials,
2182 KeepNonlimitShapes);
2183 RaiseIfFailed("MakePartition", self.BoolOp)
2186 ## Perform partition operation.
2187 # This method may be useful if it is needed to make a partition for
2188 # compound contains nonintersected shapes. Performance will be better
2189 # since intersection between shapes from compound is not performed.
2191 # Description of all parameters as in previous method MakePartition()
2193 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
2194 # have to consist of nonintersecting shapes.
2196 # @return New GEOM_Object, containing the result shapes.
2198 # @ref swig_todo "Example"
2199 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
2200 ListKeepInside=[], ListRemoveInside=[],
2201 Limit=ShapeType["SHAPE"], RemoveWebs=0,
2202 ListMaterials=[], KeepNonlimitShapes=0):
2203 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
2204 ListKeepInside, ListRemoveInside,
2205 Limit, RemoveWebs, ListMaterials,
2206 KeepNonlimitShapes);
2207 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
2210 ## Shortcut to MakePartition()
2212 # @ref tui_partition "Example 1"
2213 # \n @ref swig_Partition "Example 2"
2214 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2215 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
2216 KeepNonlimitShapes=0):
2217 # Example: see GEOM_TestOthers.py
2218 anObj = self.MakePartition(ListShapes, ListTools,
2219 ListKeepInside, ListRemoveInside,
2220 Limit, RemoveWebs, ListMaterials,
2221 KeepNonlimitShapes);
2224 ## Perform partition of the Shape with the Plane
2225 # @param theShape Shape to be intersected.
2226 # @param thePlane Tool shape, to intersect theShape.
2227 # @return New GEOM_Object, containing the result shape.
2229 # @ref tui_partition "Example"
2230 def MakeHalfPartition(self,theShape, thePlane):
2231 # Example: see GEOM_TestAll.py
2232 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
2233 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
2236 # end of l3_basic_op
2239 ## @addtogroup l3_transform
2242 ## Translate the given object along the vector, specified
2243 # by its end points, creating its copy before the translation.
2244 # @param theObject The object to be translated.
2245 # @param thePoint1 Start point of translation vector.
2246 # @param thePoint2 End point of translation vector.
2247 # @return New GEOM_Object, containing the translated object.
2249 # @ref tui_translation "Example 1"
2250 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
2251 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
2252 # Example: see GEOM_TestAll.py
2253 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
2254 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
2257 ## Translate the given object along the vector, specified by its components.
2258 # @param theObject The object to be translated.
2259 # @param theDX,theDY,theDZ Components of translation vector.
2260 # @return Translated GEOM_Object.
2262 # @ref tui_translation "Example"
2263 def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ):
2264 # Example: see GEOM_TestAll.py
2265 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2266 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
2267 anObj.SetParameters(Parameters)
2268 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2271 ## Translate the given object along the vector, specified
2272 # by its components, creating its copy before the translation.
2273 # @param theObject The object to be translated.
2274 # @param theDX,theDY,theDZ Components of translation vector.
2275 # @return New GEOM_Object, containing the translated object.
2277 # @ref tui_translation "Example"
2278 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
2279 # Example: see GEOM_TestAll.py
2280 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2281 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
2282 anObj.SetParameters(Parameters)
2283 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2286 ## Translate the given object along the given vector,
2287 # creating its copy before the translation.
2288 # @param theObject The object to be translated.
2289 # @param theVector The translation vector.
2290 # @return New GEOM_Object, containing the translated object.
2292 # @ref tui_translation "Example"
2293 def MakeTranslationVector(self,theObject, theVector):
2294 # Example: see GEOM_TestAll.py
2295 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
2296 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
2299 ## Translate the given object along the given vector on given distance.
2300 # @param theObject The object to be translated.
2301 # @param theVector The translation vector.
2302 # @param theDistance The translation distance.
2303 # @param theCopy Flag used to translate object itself or create a copy.
2304 # @return Translated GEOM_Object.
2306 # @ref tui_translation "Example"
2307 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy):
2308 # Example: see GEOM_TestAll.py
2309 theDistance,Parameters = ParseParameters(theDistance)
2310 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
2311 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2312 anObj.SetParameters(Parameters)
2315 ## Translate the given object along the given vector on given distance,
2316 # creating its copy before the translation.
2317 # @param theObject The object to be translated.
2318 # @param theVector The translation vector.
2319 # @param theDistance The translation distance.
2320 # @return New GEOM_Object, containing the translated object.
2322 # @ref tui_translation "Example"
2323 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
2324 # Example: see GEOM_TestAll.py
2325 theDistance,Parameters = ParseParameters(theDistance)
2326 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
2327 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2328 anObj.SetParameters(Parameters)
2331 ## Rotate the given object around the given axis on the given angle.
2332 # @param theObject The object to be rotated.
2333 # @param theAxis Rotation axis.
2334 # @param theAngle Rotation angle in radians.
2335 # @return Rotated GEOM_Object.
2337 # @ref tui_rotation "Example"
2338 def Rotate(self,theObject, theAxis, theAngle):
2339 # Example: see GEOM_TestAll.py
2341 if isinstance(theAngle,str):
2343 theAngle, Parameters = ParseParameters(theAngle)
2345 theAngle = theAngle*math.pi/180.0
2346 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
2347 RaiseIfFailed("RotateCopy", self.TrsfOp)
2348 anObj.SetParameters(Parameters)
2351 ## Rotate the given object around the given axis
2352 # on the given angle, creating its copy before the rotatation.
2353 # @param theObject The object to be rotated.
2354 # @param theAxis Rotation axis.
2355 # @param theAngle Rotation angle in radians.
2356 # @return New GEOM_Object, containing the rotated object.
2358 # @ref tui_rotation "Example"
2359 def MakeRotation(self,theObject, theAxis, theAngle):
2360 # Example: see GEOM_TestAll.py
2362 if isinstance(theAngle,str):
2364 theAngle, Parameters = ParseParameters(theAngle)
2366 theAngle = theAngle*math.pi/180.0
2367 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
2368 RaiseIfFailed("RotateCopy", self.TrsfOp)
2369 anObj.SetParameters(Parameters)
2372 ## Rotate given object around vector perpendicular to plane
2373 # containing three points, creating its copy before the rotatation.
2374 # @param theObject The object to be rotated.
2375 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
2376 # containing the three points.
2377 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
2378 # @return New GEOM_Object, containing the rotated object.
2380 # @ref tui_rotation "Example"
2381 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
2382 # Example: see GEOM_TestAll.py
2383 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
2384 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
2387 ## Scale the given object by the factor, creating its copy before the scaling.
2388 # @param theObject The object to be scaled.
2389 # @param thePoint Center point for scaling.
2390 # Passing None for it means scaling relatively the origin of global CS.
2391 # @param theFactor Scaling factor value.
2392 # @return New GEOM_Object, containing the scaled shape.
2394 # @ref tui_scale "Example"
2395 def MakeScaleTransform(self, theObject, thePoint, theFactor):
2396 # Example: see GEOM_TestAll.py
2397 theFactor, Parameters = ParseParameters(theFactor)
2398 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
2399 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
2400 anObj.SetParameters(Parameters)
2403 ## Scale the given object by different factors along coordinate axes,
2404 # creating its copy before the scaling.
2405 # @param theObject The object to be scaled.
2406 # @param thePoint Center point for scaling.
2407 # Passing None for it means scaling relatively the origin of global CS.
2408 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
2409 # @return New GEOM_Object, containing the scaled shape.
2411 # @ref swig_scale "Example"
2412 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
2413 # Example: see GEOM_TestAll.py
2414 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
2415 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
2416 theFactorX, theFactorY, theFactorZ)
2417 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
2418 anObj.SetParameters(Parameters)
2421 ## Create an object, symmetrical
2422 # to the given one relatively the given plane.
2423 # @param theObject The object to be mirrored.
2424 # @param thePlane Plane of symmetry.
2425 # @return New GEOM_Object, containing the mirrored shape.
2427 # @ref tui_mirror "Example"
2428 def MakeMirrorByPlane(self,theObject, thePlane):
2429 # Example: see GEOM_TestAll.py
2430 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
2431 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
2434 ## Create an object, symmetrical
2435 # to the given one relatively the given axis.
2436 # @param theObject The object to be mirrored.
2437 # @param theAxis Axis of symmetry.
2438 # @return New GEOM_Object, containing the mirrored shape.
2440 # @ref tui_mirror "Example"
2441 def MakeMirrorByAxis(self,theObject, theAxis):
2442 # Example: see GEOM_TestAll.py
2443 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
2444 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
2447 ## Create an object, symmetrical
2448 # to the given one relatively the given point.
2449 # @param theObject The object to be mirrored.
2450 # @param thePoint Point of symmetry.
2451 # @return New GEOM_Object, containing the mirrored shape.
2453 # @ref tui_mirror "Example"
2454 def MakeMirrorByPoint(self,theObject, thePoint):
2455 # Example: see GEOM_TestAll.py
2456 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
2457 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
2460 ## Modify the Location of the given object by LCS,
2461 # creating its copy before the setting.
2462 # @param theObject The object to be displaced.
2463 # @param theStartLCS Coordinate system to perform displacement from it.
2464 # If \a theStartLCS is NULL, displacement
2465 # will be performed from global CS.
2466 # If \a theObject itself is used as \a theStartLCS,
2467 # its location will be changed to \a theEndLCS.
2468 # @param theEndLCS Coordinate system to perform displacement to it.
2469 # @return New GEOM_Object, containing the displaced shape.
2471 # @ref tui_modify_location "Example"
2472 def MakePosition(self,theObject, theStartLCS, theEndLCS):
2473 # Example: see GEOM_TestAll.py
2474 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
2475 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
2478 ## Modify the Location of the given object by Path,
2479 # @param theObject The object to be displaced.
2480 # @param thePath Wire or Edge along that the object will be translated.
2481 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
2482 # @param theCopy is to create a copy objects if true.
2483 # @param theReverse - 0 for usual direction, 1 to reverse path direction.
2484 # @return New GEOM_Object, containing the displaced shape.
2486 # @ref tui_modify_location "Example"
2487 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
2488 # Example: see GEOM_TestAll.py
2489 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
2490 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
2493 ## Create new object as offset of the given one.
2494 # @param theObject The base object for the offset.
2495 # @param theOffset Offset value.
2496 # @return New GEOM_Object, containing the offset object.
2498 # @ref tui_offset "Example"
2499 def MakeOffset(self,theObject, theOffset):
2500 # Example: see GEOM_TestAll.py
2501 theOffset, Parameters = ParseParameters(theOffset)
2502 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
2503 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
2504 anObj.SetParameters(Parameters)
2507 # -----------------------------------------------------------------------------
2509 # -----------------------------------------------------------------------------
2511 ## Translate the given object along the given vector a given number times
2512 # @param theObject The object to be translated.
2513 # @param theVector Direction of the translation.
2514 # @param theStep Distance to translate on.
2515 # @param theNbTimes Quantity of translations to be done.
2516 # @return New GEOM_Object, containing compound of all
2517 # the shapes, obtained after each translation.
2519 # @ref tui_multi_translation "Example"
2520 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
2521 # Example: see GEOM_TestAll.py
2522 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
2523 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
2524 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
2525 anObj.SetParameters(Parameters)
2528 ## Conseqently apply two specified translations to theObject specified number of times.
2529 # @param theObject The object to be translated.
2530 # @param theVector1 Direction of the first translation.
2531 # @param theStep1 Step of the first translation.
2532 # @param theNbTimes1 Quantity of translations to be done along theVector1.
2533 # @param theVector2 Direction of the second translation.
2534 # @param theStep2 Step of the second translation.
2535 # @param theNbTimes2 Quantity of translations to be done along theVector2.
2536 # @return New GEOM_Object, containing compound of all
2537 # the shapes, obtained after each translation.
2539 # @ref tui_multi_translation "Example"
2540 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
2541 theVector2, theStep2, theNbTimes2):
2542 # Example: see GEOM_TestAll.py
2543 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
2544 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
2545 theVector2, theStep2, theNbTimes2)
2546 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
2547 anObj.SetParameters(Parameters)
2550 ## Rotate the given object around the given axis a given number times.
2551 # Rotation angle will be 2*PI/theNbTimes.
2552 # @param theObject The object to be rotated.
2553 # @param theAxis The rotation axis.
2554 # @param theNbTimes Quantity of rotations to be done.
2555 # @return New GEOM_Object, containing compound of all the
2556 # shapes, obtained after each rotation.
2558 # @ref tui_multi_rotation "Example"
2559 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
2560 # Example: see GEOM_TestAll.py
2561 theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
2562 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
2563 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
2564 anObj.SetParameters(Parameters)
2567 ## Rotate the given object around the
2568 # given axis on the given angle a given number
2569 # times and multi-translate each rotation result.
2570 # Translation direction passes through center of gravity
2571 # of rotated shape and its projection on the rotation axis.
2572 # @param theObject The object to be rotated.
2573 # @param theAxis Rotation axis.
2574 # @param theAngle Rotation angle in graduces.
2575 # @param theNbTimes1 Quantity of rotations to be done.
2576 # @param theStep Translation distance.
2577 # @param theNbTimes2 Quantity of translations to be done.
2578 # @return New GEOM_Object, containing compound of all the
2579 # shapes, obtained after each transformation.
2581 # @ref tui_multi_rotation "Example"
2582 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
2583 # Example: see GEOM_TestAll.py
2584 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
2585 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
2586 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
2587 anObj.SetParameters(Parameters)
2590 ## The same, as MultiRotate1D(), but axis is given by direction and point
2591 # @ref swig_MakeMultiRotation "Example"
2592 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
2593 # Example: see GEOM_TestOthers.py
2594 aVec = self.MakeLine(aPoint,aDir)
2595 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
2598 ## The same, as MultiRotate2D(), but axis is given by direction and point
2599 # @ref swig_MakeMultiRotation "Example"
2600 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
2601 # Example: see GEOM_TestOthers.py
2602 aVec = self.MakeLine(aPoint,aDir)
2603 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
2606 # end of l3_transform
2609 ## @addtogroup l3_local
2612 ## Perform a fillet on all edges of the given shape.
2613 # @param theShape Shape, to perform fillet on.
2614 # @param theR Fillet radius.
2615 # @return New GEOM_Object, containing the result shape.
2617 # @ref tui_fillet "Example 1"
2618 # \n @ref swig_MakeFilletAll "Example 2"
2619 def MakeFilletAll(self,theShape, theR):
2620 # Example: see GEOM_TestOthers.py
2621 theR,Parameters = ParseParameters(theR)
2622 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
2623 RaiseIfFailed("MakeFilletAll", self.LocalOp)
2624 anObj.SetParameters(Parameters)
2627 ## Perform a fillet on the specified edges/faces of the given shape
2628 # @param theShape Shape, to perform fillet on.
2629 # @param theR Fillet radius.
2630 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
2631 # @param theListShapes Global indices of edges/faces to perform fillet on.
2632 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2633 # @return New GEOM_Object, containing the result shape.
2635 # @ref tui_fillet "Example"
2636 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
2637 # Example: see GEOM_TestAll.py
2638 theR,Parameters = ParseParameters(theR)
2640 if theShapeType == ShapeType["EDGE"]:
2641 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
2642 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
2644 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
2645 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
2646 anObj.SetParameters(Parameters)
2649 ## The same that MakeFillet but with two Fillet Radius R1 and R2
2650 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
2651 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
2653 if theShapeType == ShapeType["EDGE"]:
2654 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
2655 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
2657 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
2658 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
2659 anObj.SetParameters(Parameters)
2662 ## Perform a fillet on the specified edges/faces of the given shape
2663 # @param theShape - Face Shape to perform fillet on.
2664 # @param theR - Fillet radius.
2665 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
2666 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2667 # @return New GEOM_Object, containing the result shape.
2669 # @ref tui_fillet2d "Example"
2670 def MakeFillet2D(self,theShape, theR, theListOfVertexes):
2671 # Example: see GEOM_TestAll.py
2672 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
2673 RaiseIfFailed("MakeFillet2D", self.LocalOp)
2676 ## Perform a symmetric chamfer on all edges of the given shape.
2677 # @param theShape Shape, to perform chamfer on.
2678 # @param theD Chamfer size along each face.
2679 # @return New GEOM_Object, containing the result shape.
2681 # @ref tui_chamfer "Example 1"
2682 # \n @ref swig_MakeChamferAll "Example 2"
2683 def MakeChamferAll(self,theShape, theD):
2684 # Example: see GEOM_TestOthers.py
2685 theD,Parameters = ParseParameters(theD)
2686 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
2687 RaiseIfFailed("MakeChamferAll", self.LocalOp)
2688 anObj.SetParameters(Parameters)
2691 ## Perform a chamfer on edges, common to the specified faces,
2692 # with distance D1 on the Face1
2693 # @param theShape Shape, to perform chamfer on.
2694 # @param theD1 Chamfer size along \a theFace1.
2695 # @param theD2 Chamfer size along \a theFace2.
2696 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
2697 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2698 # @return New GEOM_Object, containing the result shape.
2700 # @ref tui_chamfer "Example"
2701 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
2702 # Example: see GEOM_TestAll.py
2703 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2704 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
2705 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
2706 anObj.SetParameters(Parameters)
2709 ## The Same that MakeChamferEdge but with params theD is chamfer length and
2710 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2711 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
2713 if isinstance(theAngle,str):
2715 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2717 theAngle = theAngle*math.pi/180.0
2718 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
2719 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
2720 anObj.SetParameters(Parameters)
2723 ## Perform a chamfer on all edges of the specified faces,
2724 # with distance D1 on the first specified face (if several for one edge)
2725 # @param theShape Shape, to perform chamfer on.
2726 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
2727 # connected to the edge, are in \a theFaces, \a theD1
2728 # will be get along face, which is nearer to \a theFaces beginning.
2729 # @param theD2 Chamfer size along another of two faces, connected to the edge.
2730 # @param theFaces Sequence of global indices of faces of \a theShape.
2731 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2732 # @return New GEOM_Object, containing the result shape.
2734 # @ref tui_chamfer "Example"
2735 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
2736 # Example: see GEOM_TestAll.py
2737 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2738 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
2739 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
2740 anObj.SetParameters(Parameters)
2743 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
2744 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2746 # @ref swig_FilletChamfer "Example"
2747 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
2749 if isinstance(theAngle,str):
2751 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2753 theAngle = theAngle*math.pi/180.0
2754 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
2755 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
2756 anObj.SetParameters(Parameters)
2759 ## Perform a chamfer on edges,
2760 # with distance D1 on the first specified face (if several for one edge)
2761 # @param theShape Shape, to perform chamfer on.
2762 # @param theD1,theD2 Chamfer size
2763 # @param theEdges Sequence of edges of \a theShape.
2764 # @return New GEOM_Object, containing the result shape.
2766 # @ref swig_FilletChamfer "Example"
2767 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
2768 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2769 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
2770 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
2771 anObj.SetParameters(Parameters)
2774 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
2775 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2776 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
2778 if isinstance(theAngle,str):
2780 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2782 theAngle = theAngle*math.pi/180.0
2783 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
2784 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
2785 anObj.SetParameters(Parameters)
2788 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
2790 # @ref swig_MakeChamfer "Example"
2791 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
2792 # Example: see GEOM_TestOthers.py
2794 if aShapeType == ShapeType["EDGE"]:
2795 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
2797 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
2803 ## @addtogroup l3_basic_op
2806 ## Perform an Archimde operation on the given shape with given parameters.
2807 # The object presenting the resulting face is returned.
2808 # @param theShape Shape to be put in water.
2809 # @param theWeight Weight og the shape.
2810 # @param theWaterDensity Density of the water.
2811 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
2812 # @return New GEOM_Object, containing a section of \a theShape
2813 # by a plane, corresponding to water level.
2815 # @ref tui_archimede "Example"
2816 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
2817 # Example: see GEOM_TestAll.py
2818 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
2819 theWeight,theWaterDensity,theMeshDeflection)
2820 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
2821 RaiseIfFailed("MakeArchimede", self.LocalOp)
2822 anObj.SetParameters(Parameters)
2825 # end of l3_basic_op
2828 ## @addtogroup l2_measure
2831 ## Get point coordinates
2834 # @ref tui_measurement_tools_page "Example"
2835 def PointCoordinates(self,Point):
2836 # Example: see GEOM_TestMeasures.py
2837 aTuple = self.MeasuOp.PointCoordinates(Point)
2838 RaiseIfFailed("PointCoordinates", self.MeasuOp)
2841 ## Get summarized length of all wires,
2842 # area of surface and volume of the given shape.
2843 # @param theShape Shape to define properties of.
2844 # @return [theLength, theSurfArea, theVolume]
2845 # theLength: Summarized length of all wires of the given shape.
2846 # theSurfArea: Area of surface of the given shape.
2847 # theVolume: Volume of the given shape.
2849 # @ref tui_measurement_tools_page "Example"
2850 def BasicProperties(self,theShape):
2851 # Example: see GEOM_TestMeasures.py
2852 aTuple = self.MeasuOp.GetBasicProperties(theShape)
2853 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
2856 ## Get parameters of bounding box of the given shape
2857 # @param theShape Shape to obtain bounding box of.
2858 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
2859 # Xmin,Xmax: Limits of shape along OX axis.
2860 # Ymin,Ymax: Limits of shape along OY axis.
2861 # Zmin,Zmax: Limits of shape along OZ axis.
2863 # @ref tui_measurement_tools_page "Example"
2864 def BoundingBox(self,theShape):
2865 # Example: see GEOM_TestMeasures.py
2866 aTuple = self.MeasuOp.GetBoundingBox(theShape)
2867 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
2870 ## Get inertia matrix and moments of inertia of theShape.
2871 # @param theShape Shape to calculate inertia of.
2872 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
2873 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
2874 # Ix,Iy,Iz: Moments of inertia of the given shape.
2876 # @ref tui_measurement_tools_page "Example"
2877 def Inertia(self,theShape):
2878 # Example: see GEOM_TestMeasures.py
2879 aTuple = self.MeasuOp.GetInertia(theShape)
2880 RaiseIfFailed("GetInertia", self.MeasuOp)
2883 ## Get minimal distance between the given shapes.
2884 # @param theShape1,theShape2 Shapes to find minimal distance between.
2885 # @return Value of the minimal distance between the given shapes.
2887 # @ref tui_measurement_tools_page "Example"
2888 def MinDistance(self, theShape1, theShape2):
2889 # Example: see GEOM_TestMeasures.py
2890 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2891 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2894 ## Get minimal distance between the given shapes.
2895 # @param theShape1,theShape2 Shapes to find minimal distance between.
2896 # @return Value of the minimal distance between the given shapes.
2898 # @ref swig_all_measure "Example"
2899 def MinDistanceComponents(self, theShape1, theShape2):
2900 # Example: see GEOM_TestMeasures.py
2901 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2902 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2903 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
2906 ## Get angle between the given shapes in degrees.
2907 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2908 # @return Value of the angle between the given shapes in degrees.
2910 # @ref tui_measurement_tools_page "Example"
2911 def GetAngle(self, theShape1, theShape2):
2912 # Example: see GEOM_TestMeasures.py
2913 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
2914 RaiseIfFailed("GetAngle", self.MeasuOp)
2916 ## Get angle between the given shapes in radians.
2917 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2918 # @return Value of the angle between the given shapes in radians.
2920 # @ref tui_measurement_tools_page "Example"
2921 def GetAngleRadians(self, theShape1, theShape2):
2922 # Example: see GEOM_TestMeasures.py
2923 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
2924 RaiseIfFailed("GetAngle", self.MeasuOp)
2927 ## @name Curve Curvature Measurement
2928 # Methods for receiving radius of curvature of curves
2929 # in the given point
2932 ## Measure curvature of a curve at a point, set by parameter.
2933 # @ref swig_todo "Example"
2934 def CurveCurvatureByParam(self, theCurve, theParam):
2935 # Example: see GEOM_TestMeasures.py
2936 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
2937 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
2941 # @ref swig_todo "Example"
2942 def CurveCurvatureByPoint(self, theCurve, thePoint):
2943 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
2944 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
2948 ## @name Surface Curvature Measurement
2949 # Methods for receiving max and min radius of curvature of surfaces
2950 # in the given point
2954 ## @ref swig_todo "Example"
2955 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2956 # Example: see GEOM_TestMeasures.py
2957 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2958 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
2962 ## @ref swig_todo "Example"
2963 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
2964 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
2965 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
2969 ## @ref swig_todo "Example"
2970 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2971 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2972 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
2976 ## @ref swig_todo "Example"
2977 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
2978 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
2979 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
2983 ## Get min and max tolerances of sub-shapes of theShape
2984 # @param theShape Shape, to get tolerances of.
2985 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
2986 # FaceMin,FaceMax: Min and max tolerances of the faces.
2987 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
2988 # VertMin,VertMax: Min and max tolerances of the vertices.
2990 # @ref tui_measurement_tools_page "Example"
2991 def Tolerance(self,theShape):
2992 # Example: see GEOM_TestMeasures.py
2993 aTuple = self.MeasuOp.GetTolerance(theShape)
2994 RaiseIfFailed("GetTolerance", self.MeasuOp)
2997 ## Obtain description of the given shape (number of sub-shapes of each type)
2998 # @param theShape Shape to be described.
2999 # @return Description of the given shape.
3001 # @ref tui_measurement_tools_page "Example"
3002 def WhatIs(self,theShape):
3003 # Example: see GEOM_TestMeasures.py
3004 aDescr = self.MeasuOp.WhatIs(theShape)
3005 RaiseIfFailed("WhatIs", self.MeasuOp)
3008 ## Get a point, situated at the centre of mass of theShape.
3009 # @param theShape Shape to define centre of mass of.
3010 # @return New GEOM_Object, containing the created point.
3012 # @ref tui_measurement_tools_page "Example"
3013 def MakeCDG(self,theShape):
3014 # Example: see GEOM_TestMeasures.py
3015 anObj = self.MeasuOp.GetCentreOfMass(theShape)
3016 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
3019 ## Get a normale to the given face. If the point is not given,
3020 # the normale is calculated at the center of mass.
3021 # @param theFace Face to define normale of.
3022 # @param theOptionalPoint Point to compute the normale at.
3023 # @return New GEOM_Object, containing the created vector.
3025 # @ref swig_todo "Example"
3026 def GetNormal(self, theFace, theOptionalPoint = None):
3027 # Example: see GEOM_TestMeasures.py
3028 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
3029 RaiseIfFailed("GetNormal", self.MeasuOp)
3032 ## Check a topology of the given shape.
3033 # @param theShape Shape to check validity of.
3034 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
3035 # if TRUE, the shape's geometry will be checked also.
3036 # @return TRUE, if the shape "seems to be valid".
3037 # If theShape is invalid, prints a description of problem.
3039 # @ref tui_measurement_tools_page "Example"
3040 def CheckShape(self,theShape, theIsCheckGeom = 0):
3041 # Example: see GEOM_TestMeasures.py
3043 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
3044 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
3046 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
3047 RaiseIfFailed("CheckShape", self.MeasuOp)
3052 ## Get position (LCS) of theShape.
3054 # Origin of the LCS is situated at the shape's center of mass.
3055 # Axes of the LCS are obtained from shape's location or,
3056 # if the shape is a planar face, from position of its plane.
3058 # @param theShape Shape to calculate position of.
3059 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
3060 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
3061 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
3062 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
3064 # @ref swig_todo "Example"
3065 def GetPosition(self,theShape):
3066 # Example: see GEOM_TestMeasures.py
3067 aTuple = self.MeasuOp.GetPosition(theShape)
3068 RaiseIfFailed("GetPosition", self.MeasuOp)
3071 ## Get kind of theShape.
3073 # @param theShape Shape to get a kind of.
3074 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
3075 # and a list of parameters, describing the shape.
3076 # @note Concrete meaning of each value, returned via \a theIntegers
3077 # or \a theDoubles list depends on the kind of the shape.
3078 # The full list of possible outputs is:
3080 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
3081 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
3083 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
3084 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
3086 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
3087 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
3089 # - geompy.kind.SPHERE xc yc zc R
3090 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
3091 # - geompy.kind.BOX xc yc zc ax ay az
3092 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
3093 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
3094 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
3095 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
3096 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
3098 # - geompy.kind.SPHERE2D xc yc zc R
3099 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
3100 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
3101 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
3102 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
3103 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
3104 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
3105 # - geompy.kind.PLANE xo yo zo dx dy dz
3106 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
3107 # - geompy.kind.FACE nb_edges nb_vertices
3109 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
3110 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
3111 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
3112 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
3113 # - geompy.kind.LINE xo yo zo dx dy dz
3114 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
3115 # - geompy.kind.EDGE nb_vertices
3117 # - geompy.kind.VERTEX x y z
3119 # @ref swig_todo "Example"
3120 def KindOfShape(self,theShape):
3121 # Example: see GEOM_TestMeasures.py
3122 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
3123 RaiseIfFailed("KindOfShape", self.MeasuOp)
3125 aKind = aRoughTuple[0]
3126 anInts = aRoughTuple[1]
3127 aDbls = aRoughTuple[2]
3129 # Now there is no exception from this rule:
3130 aKindTuple = [aKind] + aDbls + anInts
3132 # If they are we will regroup parameters for such kind of shape.
3134 #if aKind == kind.SOME_KIND:
3135 # # SOME_KIND int int double int double double
3136 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
3143 ## @addtogroup l2_import_export
3146 ## Import a shape from the BREP or IGES or STEP file
3147 # (depends on given format) with given name.
3148 # @param theFileName The file, containing the shape.
3149 # @param theFormatName Specify format for the file reading.
3150 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3151 # @return New GEOM_Object, containing the imported shape.
3153 # @ref swig_Import_Export "Example"
3154 def Import(self,theFileName, theFormatName):
3155 # Example: see GEOM_TestOthers.py
3156 anObj = self.InsertOp.Import(theFileName, theFormatName)
3157 RaiseIfFailed("Import", self.InsertOp)
3160 ## Shortcut to Import() for BREP format
3162 # @ref swig_Import_Export "Example"
3163 def ImportBREP(self,theFileName):
3164 # Example: see GEOM_TestOthers.py
3165 return self.Import(theFileName, "BREP")
3167 ## Shortcut to Import() for IGES format
3169 # @ref swig_Import_Export "Example"
3170 def ImportIGES(self,theFileName):
3171 # Example: see GEOM_TestOthers.py
3172 return self.Import(theFileName, "IGES")
3174 ## Shortcut to Import() for STEP format
3176 # @ref swig_Import_Export "Example"
3177 def ImportSTEP(self,theFileName):
3178 # Example: see GEOM_TestOthers.py
3179 return self.Import(theFileName, "STEP")
3181 ## Export the given shape into a file with given name.
3182 # @param theObject Shape to be stored in the file.
3183 # @param theFileName Name of the file to store the given shape in.
3184 # @param theFormatName Specify format for the shape storage.
3185 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3187 # @ref swig_Import_Export "Example"
3188 def Export(self,theObject, theFileName, theFormatName):
3189 # Example: see GEOM_TestOthers.py
3190 self.InsertOp.Export(theObject, theFileName, theFormatName)
3191 if self.InsertOp.IsDone() == 0:
3192 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
3196 ## Shortcut to Export() for BREP format
3198 # @ref swig_Import_Export "Example"
3199 def ExportBREP(self,theObject, theFileName):
3200 # Example: see GEOM_TestOthers.py
3201 return self.Export(theObject, theFileName, "BREP")
3203 ## Shortcut to Export() for IGES format
3205 # @ref swig_Import_Export "Example"
3206 def ExportIGES(self,theObject, theFileName):
3207 # Example: see GEOM_TestOthers.py
3208 return self.Export(theObject, theFileName, "IGES")
3210 ## Shortcut to Export() for STEP format
3212 # @ref swig_Import_Export "Example"
3213 def ExportSTEP(self,theObject, theFileName):
3214 # Example: see GEOM_TestOthers.py
3215 return self.Export(theObject, theFileName, "STEP")
3217 # end of l2_import_export
3220 ## @addtogroup l3_blocks
3223 ## Create a quadrangle face from four edges. Order of Edges is not
3224 # important. It is not necessary that edges share the same vertex.
3225 # @param E1,E2,E3,E4 Edges for the face bound.
3226 # @return New GEOM_Object, containing the created face.
3228 # @ref tui_building_by_blocks_page "Example"
3229 def MakeQuad(self,E1, E2, E3, E4):
3230 # Example: see GEOM_Spanner.py
3231 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
3232 RaiseIfFailed("MakeQuad", self.BlocksOp)
3235 ## Create a quadrangle face on two edges.
3236 # The missing edges will be built by creating the shortest ones.
3237 # @param E1,E2 Two opposite edges for the face.
3238 # @return New GEOM_Object, containing the created face.
3240 # @ref tui_building_by_blocks_page "Example"
3241 def MakeQuad2Edges(self,E1, E2):
3242 # Example: see GEOM_Spanner.py
3243 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
3244 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
3247 ## Create a quadrangle face with specified corners.
3248 # The missing edges will be built by creating the shortest ones.
3249 # @param V1,V2,V3,V4 Corner vertices for the face.
3250 # @return New GEOM_Object, containing the created face.
3252 # @ref tui_building_by_blocks_page "Example 1"
3253 # \n @ref swig_MakeQuad4Vertices "Example 2"
3254 def MakeQuad4Vertices(self,V1, V2, V3, V4):
3255 # Example: see GEOM_Spanner.py
3256 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
3257 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
3260 ## Create a hexahedral solid, bounded by the six given faces. Order of
3261 # faces is not important. It is not necessary that Faces share the same edge.
3262 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
3263 # @return New GEOM_Object, containing the created solid.
3265 # @ref tui_building_by_blocks_page "Example 1"
3266 # \n @ref swig_MakeHexa "Example 2"
3267 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
3268 # Example: see GEOM_Spanner.py
3269 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
3270 RaiseIfFailed("MakeHexa", self.BlocksOp)
3273 ## Create a hexahedral solid between two given faces.
3274 # The missing faces will be built by creating the smallest ones.
3275 # @param F1,F2 Two opposite faces for the hexahedral solid.
3276 # @return New GEOM_Object, containing the created solid.
3278 # @ref tui_building_by_blocks_page "Example 1"
3279 # \n @ref swig_MakeHexa2Faces "Example 2"
3280 def MakeHexa2Faces(self,F1, F2):
3281 # Example: see GEOM_Spanner.py
3282 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
3283 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
3289 ## @addtogroup l3_blocks_op
3292 ## Get a vertex, found in the given shape by its coordinates.
3293 # @param theShape Block or a compound of blocks.
3294 # @param theX,theY,theZ Coordinates of the sought vertex.
3295 # @param theEpsilon Maximum allowed distance between the resulting
3296 # vertex and point with the given coordinates.
3297 # @return New GEOM_Object, containing the found vertex.
3299 # @ref swig_GetPoint "Example"
3300 def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
3301 # Example: see GEOM_TestOthers.py
3302 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
3303 RaiseIfFailed("GetPoint", self.BlocksOp)
3306 ## Get an edge, found in the given shape by two given vertices.
3307 # @param theShape Block or a compound of blocks.
3308 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
3309 # @return New GEOM_Object, containing the found edge.
3311 # @ref swig_todo "Example"
3312 def GetEdge(self,theShape, thePoint1, thePoint2):
3313 # Example: see GEOM_Spanner.py
3314 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
3315 RaiseIfFailed("GetEdge", self.BlocksOp)
3318 ## Find an edge of the given shape, which has minimal distance to the given point.
3319 # @param theShape Block or a compound of blocks.
3320 # @param thePoint Point, close to the desired edge.
3321 # @return New GEOM_Object, containing the found edge.
3323 # @ref swig_GetEdgeNearPoint "Example"
3324 def GetEdgeNearPoint(self,theShape, thePoint):
3325 # Example: see GEOM_TestOthers.py
3326 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
3327 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
3330 ## Returns a face, found in the given shape by four given corner vertices.
3331 # @param theShape Block or a compound of blocks.
3332 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
3333 # @return New GEOM_Object, containing the found face.
3335 # @ref swig_todo "Example"
3336 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
3337 # Example: see GEOM_Spanner.py
3338 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
3339 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
3342 ## Get a face of block, found in the given shape by two given edges.
3343 # @param theShape Block or a compound of blocks.
3344 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
3345 # @return New GEOM_Object, containing the found face.
3347 # @ref swig_todo "Example"
3348 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
3349 # Example: see GEOM_Spanner.py
3350 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
3351 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
3354 ## Find a face, opposite to the given one in the given block.
3355 # @param theBlock Must be a hexahedral solid.
3356 # @param theFace Face of \a theBlock, opposite to the desired face.
3357 # @return New GEOM_Object, containing the found face.
3359 # @ref swig_GetOppositeFace "Example"
3360 def GetOppositeFace(self,theBlock, theFace):
3361 # Example: see GEOM_Spanner.py
3362 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
3363 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
3366 ## Find a face of the given shape, which has minimal distance to the given point.
3367 # @param theShape Block or a compound of blocks.
3368 # @param thePoint Point, close to the desired face.
3369 # @return New GEOM_Object, containing the found face.
3371 # @ref swig_GetFaceNearPoint "Example"
3372 def GetFaceNearPoint(self,theShape, thePoint):
3373 # Example: see GEOM_Spanner.py
3374 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
3375 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
3378 ## Find a face of block, whose outside normale has minimal angle with the given vector.
3379 # @param theBlock Block or a compound of blocks.
3380 # @param theVector Vector, close to the normale of the desired face.
3381 # @return New GEOM_Object, containing the found face.
3383 # @ref swig_todo "Example"
3384 def GetFaceByNormale(self, theBlock, theVector):
3385 # Example: see GEOM_Spanner.py
3386 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
3387 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
3390 # end of l3_blocks_op
3393 ## @addtogroup l4_blocks_measure
3396 ## Check, if the compound of blocks is given.
3397 # To be considered as a compound of blocks, the
3398 # given shape must satisfy the following conditions:
3399 # - Each element of the compound should be a Block (6 faces and 12 edges).
3400 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
3401 # - The compound should be connexe.
3402 # - The glue between two quadrangle faces should be applied.
3403 # @param theCompound The compound to check.
3404 # @return TRUE, if the given shape is a compound of blocks.
3405 # If theCompound is not valid, prints all discovered errors.
3407 # @ref tui_measurement_tools_page "Example 1"
3408 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
3409 def CheckCompoundOfBlocks(self,theCompound):
3410 # Example: see GEOM_Spanner.py
3411 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
3412 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
3414 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
3418 ## Remove all seam and degenerated edges from \a theShape.
3419 # Unite faces and edges, sharing one surface. It means that
3420 # this faces must have references to one C++ surface object (handle).
3421 # @param theShape The compound or single solid to remove irregular edges from.
3422 # @param theOptimumNbFaces If more than zero, unite faces only for those solids,
3423 # that have more than theOptimumNbFaces faces. If zero, unite faces always,
3424 # regardsless their quantity in the solid. If negative (the default value),
3425 # do not unite faces at all. For blocks repairing recommended value is 6.
3426 # @return Improved shape.
3428 # @ref swig_RemoveExtraEdges "Example"
3429 def RemoveExtraEdges(self,theShape,theOptimumNbFaces=-1):
3430 # Example: see GEOM_TestOthers.py
3431 anObj = self.BlocksOp.RemoveExtraEdges(theShape,theOptimumNbFaces)
3432 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
3435 ## Check, if the given shape is a blocks compound.
3436 # Fix all detected errors.
3437 # \note Single block can be also fixed by this method.
3438 # @param theShape The compound to check and improve.
3439 # @return Improved compound.
3441 # @ref swig_CheckAndImprove "Example"
3442 def CheckAndImprove(self,theShape):
3443 # Example: see GEOM_TestOthers.py
3444 anObj = self.BlocksOp.CheckAndImprove(theShape)
3445 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
3448 # end of l4_blocks_measure
3451 ## @addtogroup l3_blocks_op
3454 ## Get all the blocks, contained in the given compound.
3455 # @param theCompound The compound to explode.
3456 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
3457 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
3458 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
3459 # @return List of GEOM_Objects, containing the retrieved blocks.
3461 # @ref tui_explode_on_blocks "Example 1"
3462 # \n @ref swig_MakeBlockExplode "Example 2"
3463 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
3464 # Example: see GEOM_TestOthers.py
3465 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
3466 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
3467 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
3469 anObj.SetParameters(Parameters)
3473 ## Find block, containing the given point inside its volume or on boundary.
3474 # @param theCompound Compound, to find block in.
3475 # @param thePoint Point, close to the desired block. If the point lays on
3476 # boundary between some blocks, we return block with nearest center.
3477 # @return New GEOM_Object, containing the found block.
3479 # @ref swig_todo "Example"
3480 def GetBlockNearPoint(self,theCompound, thePoint):
3481 # Example: see GEOM_Spanner.py
3482 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
3483 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
3486 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
3487 # @param theCompound Compound, to find block in.
3488 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
3489 # @return New GEOM_Object, containing the found block.
3491 # @ref swig_GetBlockByParts "Example"
3492 def GetBlockByParts(self,theCompound, theParts):
3493 # Example: see GEOM_TestOthers.py
3494 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
3495 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
3498 ## Return all blocks, containing all the elements, passed as the parts.
3499 # @param theCompound Compound, to find blocks in.
3500 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
3501 # @return List of GEOM_Objects, containing the found blocks.
3503 # @ref swig_todo "Example"
3504 def GetBlocksByParts(self,theCompound, theParts):
3505 # Example: see GEOM_Spanner.py
3506 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
3507 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
3510 ## Multi-transformate block and glue the result.
3511 # Transformation is defined so, as to superpose direction faces.
3512 # @param Block Hexahedral solid to be multi-transformed.
3513 # @param DirFace1 ID of First direction face.
3514 # @param DirFace2 ID of Second direction face.
3515 # @param NbTimes Quantity of transformations to be done.
3516 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
3517 # @return New GEOM_Object, containing the result shape.
3519 # @ref tui_multi_transformation "Example"
3520 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
3521 # Example: see GEOM_Spanner.py
3522 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
3523 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
3524 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
3525 anObj.SetParameters(Parameters)
3528 ## Multi-transformate block and glue the result.
3529 # @param Block Hexahedral solid to be multi-transformed.
3530 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
3531 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
3532 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
3533 # @return New GEOM_Object, containing the result shape.
3535 # @ref tui_multi_transformation "Example"
3536 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
3537 DirFace1V, DirFace2V, NbTimesV):
3538 # Example: see GEOM_Spanner.py
3539 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
3540 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
3541 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
3542 DirFace1V, DirFace2V, NbTimesV)
3543 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
3544 anObj.SetParameters(Parameters)
3547 ## Build all possible propagation groups.
3548 # Propagation group is a set of all edges, opposite to one (main)
3549 # edge of this group directly or through other opposite edges.
3550 # Notion of Opposite Edge make sence only on quadrangle face.
3551 # @param theShape Shape to build propagation groups on.
3552 # @return List of GEOM_Objects, each of them is a propagation group.
3554 # @ref swig_Propagate "Example"
3555 def Propagate(self,theShape):
3556 # Example: see GEOM_TestOthers.py
3557 listChains = self.BlocksOp.Propagate(theShape)
3558 RaiseIfFailed("Propagate", self.BlocksOp)
3561 # end of l3_blocks_op
3564 ## @addtogroup l3_groups
3567 ## Creates a new group which will store sub shapes of theMainShape
3568 # @param theMainShape is a GEOM object on which the group is selected
3569 # @param theShapeType defines a shape type of the group
3570 # @return a newly created GEOM group
3572 # @ref tui_working_with_groups_page "Example 1"
3573 # \n @ref swig_CreateGroup "Example 2"
3574 def CreateGroup(self,theMainShape, theShapeType):
3575 # Example: see GEOM_TestOthers.py
3576 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
3577 RaiseIfFailed("CreateGroup", self.GroupOp)
3580 ## Adds a sub object with ID theSubShapeId to the group
3581 # @param theGroup is a GEOM group to which the new sub shape is added
3582 # @param theSubShapeID is a sub shape ID in the main object.
3583 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3585 # @ref tui_working_with_groups_page "Example"
3586 def AddObject(self,theGroup, theSubShapeID):
3587 # Example: see GEOM_TestOthers.py
3588 self.GroupOp.AddObject(theGroup, theSubShapeID)
3589 RaiseIfFailed("AddObject", self.GroupOp)
3592 ## Removes a sub object with ID \a theSubShapeId from the group
3593 # @param theGroup is a GEOM group from which the new sub shape is removed
3594 # @param theSubShapeID is a sub shape ID in the main object.
3595 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3597 # @ref tui_working_with_groups_page "Example"
3598 def RemoveObject(self,theGroup, theSubShapeID):
3599 # Example: see GEOM_TestOthers.py
3600 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
3601 RaiseIfFailed("RemoveObject", self.GroupOp)
3604 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
3605 # @param theGroup is a GEOM group to which the new sub shapes are added.
3606 # @param theSubShapes is a list of sub shapes to be added.
3608 # @ref tui_working_with_groups_page "Example"
3609 def UnionList (self,theGroup, theSubShapes):
3610 # Example: see GEOM_TestOthers.py
3611 self.GroupOp.UnionList(theGroup, theSubShapes)
3612 RaiseIfFailed("UnionList", self.GroupOp)
3615 ## Works like the above method, but argument
3616 # theSubShapes here is a list of sub-shapes indices
3618 # @ref swig_UnionIDs "Example"
3619 def UnionIDs(self,theGroup, theSubShapes):
3620 # Example: see GEOM_TestOthers.py
3621 self.GroupOp.UnionIDs(theGroup, theSubShapes)
3622 RaiseIfFailed("UnionIDs", self.GroupOp)
3625 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
3626 # @param theGroup is a GEOM group from which the sub-shapes are removed.
3627 # @param theSubShapes is a list of sub-shapes to be removed.
3629 # @ref tui_working_with_groups_page "Example"
3630 def DifferenceList (self,theGroup, theSubShapes):
3631 # Example: see GEOM_TestOthers.py
3632 self.GroupOp.DifferenceList(theGroup, theSubShapes)
3633 RaiseIfFailed("DifferenceList", self.GroupOp)
3636 ## Works like the above method, but argument
3637 # theSubShapes here is a list of sub-shapes indices
3639 # @ref swig_DifferenceIDs "Example"
3640 def DifferenceIDs(self,theGroup, theSubShapes):
3641 # Example: see GEOM_TestOthers.py
3642 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
3643 RaiseIfFailed("DifferenceIDs", self.GroupOp)
3646 ## Returns a list of sub objects ID stored in the group
3647 # @param theGroup is a GEOM group for which a list of IDs is requested
3649 # @ref swig_GetObjectIDs "Example"
3650 def GetObjectIDs(self,theGroup):
3651 # Example: see GEOM_TestOthers.py
3652 ListIDs = self.GroupOp.GetObjects(theGroup)
3653 RaiseIfFailed("GetObjects", self.GroupOp)
3656 ## Returns a type of sub objects stored in the group
3657 # @param theGroup is a GEOM group which type is returned.
3659 # @ref swig_GetType "Example"
3660 def GetType(self,theGroup):
3661 # Example: see GEOM_TestOthers.py
3662 aType = self.GroupOp.GetType(theGroup)
3663 RaiseIfFailed("GetType", self.GroupOp)
3666 ## Returns a main shape associated with the group
3667 # @param theGroup is a GEOM group for which a main shape object is requested
3668 # @return a GEOM object which is a main shape for theGroup
3670 # @ref swig_GetMainShape "Example"
3671 def GetMainShape(self,theGroup):
3672 # Example: see GEOM_TestOthers.py
3673 anObj = self.GroupOp.GetMainShape(theGroup)
3674 RaiseIfFailed("GetMainShape", self.GroupOp)
3677 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
3678 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3680 # @ref swig_todo "Example"
3681 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
3682 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
3685 Props = self.BasicProperties(edge)
3686 if min_length <= Props[0] and Props[0] <= max_length:
3687 if (not include_min) and (min_length == Props[0]):
3690 if (not include_max) and (Props[0] == max_length):
3693 edges_in_range.append(edge)
3695 if len(edges_in_range) <= 0:
3696 print "No edges found by given criteria"
3699 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
3700 self.UnionList(group_edges, edges_in_range)
3704 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
3705 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3707 # @ref swig_todo "Example"
3708 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
3709 nb_selected = sg.SelectedCount()
3711 print "Select a shape before calling this function, please."
3714 print "Only one shape must be selected"
3717 id_shape = sg.getSelected(0)
3718 shape = IDToObject( id_shape )
3720 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
3724 if include_min: left_str = " <= "
3725 if include_max: right_str = " <= "
3727 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
3728 + left_str + "length" + right_str + `max_length`)
3730 sg.updateObjBrowser(1)
3737 ## Create a copy of the given object
3738 # @ingroup l1_geompy_auxiliary
3740 # @ref swig_all_advanced "Example"
3741 def MakeCopy(self,theOriginal):
3742 # Example: see GEOM_TestAll.py
3743 anObj = self.InsertOp.MakeCopy(theOriginal)
3744 RaiseIfFailed("MakeCopy", self.InsertOp)
3747 ## Add Path to load python scripts from
3748 # @ingroup l1_geompy_auxiliary
3749 def addPath(self,Path):
3750 if (sys.path.count(Path) < 1):
3751 sys.path.append(Path)
3754 #Register the new proxy for GEOM_Gen
3755 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)