1 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
3 # Copyright (C) 2003 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
25 # Author : Paul RASCLE, EDF
34 ## @defgroup l1_geompy_auxiliary Auxiliary data structures and methods
36 ## @defgroup l1_geompy_purpose All package methods, grouped by their purpose
38 ## @defgroup l2_import_export Importing/exporting geometrical objects
39 ## @defgroup l2_creating Creating geometrical objects
41 ## @defgroup l3_basic_go Creating Basic Geometric Objects
43 ## @defgroup l4_curves Creating Curves
46 ## @defgroup l3_3d_primitives Creating 3D Primitives
47 ## @defgroup l3_complex Creating Complex Objects
48 ## @defgroup l3_groups Working with groups
49 ## @defgroup l3_blocks Building by blocks
51 ## @defgroup l4_blocks_measure Check and Improve
54 ## @defgroup l3_sketcher Sketcher
55 ## @defgroup l3_advanced Creating Advanced Geometrical Objects
57 ## @defgroup l4_decompose Decompose objects
58 ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
59 ## @defgroup l4_obtain Access to subshapes by a criteria
64 ## @defgroup l2_transforming Transforming geometrical objects
66 ## @defgroup l3_basic_op Basic Operations
67 ## @defgroup l3_boolean Boolean Operations
68 ## @defgroup l3_transform Transformation Operations
69 ## @defgroup l3_local Local Operations (Fillet and Chamfer)
70 ## @defgroup l3_blocks_op Blocks Operations
71 ## @defgroup l3_healing Repairing Operations
72 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of subshapes
75 ## @defgroup l2_measure Using measurement tools
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 ## Kinds of shape enumeration
97 # @ingroup l1_geompy_auxiliary
98 kind = GEOM.GEOM_IKindOfShape
100 ## Information about closed/unclosed state of shell or wire
101 # @ingroup l1_geompy_auxiliary
108 class geompyDC(GEOM._objref_GEOM_Gen):
110 ## @addtogroup l1_geompy_auxiliary
113 GEOM._objref_GEOM_Gen.__init__(self)
114 self.myBuilder = None
132 def init_geom(self,theStudy):
133 self.myStudy = theStudy
134 self.myStudyId = self.myStudy._get_StudyId()
135 self.myBuilder = self.myStudy.NewBuilder()
136 self.father = self.myStudy.FindComponent("GEOM")
137 if self.father is None:
138 self.father = self.myBuilder.NewComponent("GEOM")
139 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
140 FName = A1._narrow(SALOMEDS.AttributeName)
141 FName.SetValue("Geometry")
142 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
143 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
144 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
145 self.myBuilder.DefineComponentInstance(self.father,self)
147 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
148 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
149 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
150 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
151 self.HealOp = self.GetIHealingOperations (self.myStudyId)
152 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
153 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
154 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
155 self.LocalOp = self.GetILocalOperations (self.myStudyId)
156 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
157 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
158 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
161 ## Get name for sub-shape aSubObj of shape aMainObj
163 # @ref swig_SubShapeAllSorted "Example"
164 def SubShapeName(self,aSubObj, aMainObj):
165 # Example: see GEOM_TestAll.py
167 #aSubId = orb.object_to_string(aSubObj)
168 #aMainId = orb.object_to_string(aMainObj)
169 #index = gg.getIndexTopology(aSubId, aMainId)
170 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
171 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
172 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
175 ## Publish in study aShape with name aName
177 # \param aShape the shape to be published
178 # \param aName the name for the shape
179 # \param doRestoreSubShapes if True, finds and publishes also
180 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
181 # and published sub-shapes of arguments
182 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
183 # these arguments description
184 # \return study entry of the published shape in form of string
186 # @ref swig_MakeQuad4Vertices "Example"
187 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
188 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
189 # Example: see GEOM_TestAll.py
191 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
192 if doRestoreSubShapes:
193 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
194 theFindMethod, theInheritFirstArg)
196 print "addToStudy() failed"
198 return aShape.GetStudyEntry()
200 ## Publish in study aShape with name aName as sub-object of previously published aFather
202 # @ref swig_SubShapeAllSorted "Example"
203 def addToStudyInFather(self, aFather, aShape, aName):
204 # Example: see GEOM_TestAll.py
206 aSObject = self.AddInStudy(myStudy, aShape, aName, aFather)
208 print "addToStudyInFather() failed"
210 return aShape.GetStudyEntry()
212 # end of l1_geompy_auxiliary
215 ## @addtogroup l3_restore_ss
218 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
219 # To be used from python scripts out of geompy.addToStudy (non-default usage)
220 # \param theStudy the study, in which theObject is published already,
221 # and in which the arguments will be published
222 # \param theObject published GEOM object, arguments of which will be published
223 # \param theArgs list of GEOM_Object, operation arguments to be published.
224 # If this list is empty, all operation arguments will be published
225 # \param theFindMethod method to search subshapes, corresponding to arguments and
226 # their subshapes. Value from enumeration GEOM::find_shape_method.
227 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
228 # Do not publish subshapes in place of arguments, but only
229 # in place of subshapes of the first argument,
230 # because the whole shape corresponds to the first argument.
231 # Mainly to be used after transformations, but it also can be
232 # usefull after partition with one object shape, and some other
233 # operations, where only the first argument has to be considered.
234 # If theObject has only one argument shape, this flag is automatically
235 # considered as True, not regarding really passed value.
236 # \return True in case of success, False otherwise.
238 # @ref tui_restore_prs_params "Example"
239 def RestoreSubShapes (self, theObject, theArgs=[],
240 theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
241 # Example: see GEOM_TestAll.py
242 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
243 theFindMethod, theInheritFirstArg)
245 # end of l3_restore_ss
248 ## @addtogroup l3_basic_go
251 ## Create point by three coordinates.
252 # @param theX The X coordinate of the point.
253 # @param theY The Y coordinate of the point.
254 # @param theZ The Z coordinate of the point.
255 # @return New GEOM_Object, containing the created point.
257 # @ref tui_creation_point "Example"
258 def MakeVertex(self,theX, theY, theZ):
259 # Example: see GEOM_TestAll.py
260 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
261 RaiseIfFailed("MakePointXYZ", self.BasicOp)
264 ## Create a point, distant from the referenced point
265 # on the given distances along the coordinate axes.
266 # @param theReference The referenced point.
267 # @param theX Displacement from the referenced point along OX axis.
268 # @param theY Displacement from the referenced point along OY axis.
269 # @param theZ Displacement from the referenced point along OZ axis.
270 # @return New GEOM_Object, containing the created point.
272 # @ref tui_creation_point "Example"
273 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
274 # Example: see GEOM_TestAll.py
275 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
276 RaiseIfFailed("MakePointWithReference", self.BasicOp)
279 ## Create a point, corresponding to the given parameter on the given curve.
280 # @param theRefCurve The referenced curve.
281 # @param theParameter Value of parameter on the referenced curve.
282 # @return New GEOM_Object, containing the created point.
284 # @ref tui_creation_point "Example"
285 def MakeVertexOnCurve(self,theRefCurve, theParameter):
286 # Example: see GEOM_TestAll.py
287 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
288 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
291 ## Create a point, corresponding to the given parameters on the
293 # @param theRefSurf The referenced surface.
294 # @param theUParameter Value of U-parameter on the referenced surface.
295 # @param theVParameter Value of V-parameter on the referenced surface.
296 # @return New GEOM_Object, containing the created point.
298 # @ref swig_MakeVertexOnSurface "Example"
299 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
300 # Example: see GEOM_TestAll.py
301 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
302 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
305 ## Create a point on intersection of two lines.
306 # @param theRefLine1, theRefLine2 The referenced lines.
307 # @return New GEOM_Object, containing the created point.
309 # @ref swig_MakeVertexOnLinesIntersection "Example"
310 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
311 # Example: see GEOM_TestAll.py
312 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
313 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
316 ## Create a tangent, corresponding to the given parameter on the given curve.
317 # @param theRefCurve The referenced curve.
318 # @param theParameter Value of parameter on the referenced curve.
319 # @return New GEOM_Object, containing the created tangent.
321 # @ref swig_MakeTangentOnCurve "Example"
322 def MakeTangentOnCurve(self, theRefCurve, theParameter):
323 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
324 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
327 ## Create a vector with the given components.
328 # @param theDX X component of the vector.
329 # @param theDY Y component of the vector.
330 # @param theDZ Z component of the vector.
331 # @return New GEOM_Object, containing the created vector.
333 # @ref tui_creation_vector "Example"
334 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
335 # Example: see GEOM_TestAll.py
336 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
337 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
340 ## Create a vector between two points.
341 # @param thePnt1 Start point for the vector.
342 # @param thePnt2 End point for the vector.
343 # @return New GEOM_Object, containing the created vector.
345 # @ref tui_creation_vector "Example"
346 def MakeVector(self,thePnt1, thePnt2):
347 # Example: see GEOM_TestAll.py
348 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
349 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
352 ## Create a line, passing through the given point
353 # and parrallel to the given direction
354 # @param thePnt Point. The resulting line will pass through it.
355 # @param theDir Direction. The resulting line will be parallel to it.
356 # @return New GEOM_Object, containing the created line.
358 # @ref tui_creation_line "Example"
359 def MakeLine(self,thePnt, theDir):
360 # Example: see GEOM_TestAll.py
361 anObj = self.BasicOp.MakeLine(thePnt, theDir)
362 RaiseIfFailed("MakeLine", self.BasicOp)
365 ## Create a line, passing through the given points
366 # @param thePnt1 First of two points, defining the line.
367 # @param thePnt2 Second of two points, defining the line.
368 # @return New GEOM_Object, containing the created line.
370 # @ref tui_creation_line "Example"
371 def MakeLineTwoPnt(self,thePnt1, thePnt2):
372 # Example: see GEOM_TestAll.py
373 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
374 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
377 ## Create a line on two faces intersection.
378 # @param theFace1 First of two faces, defining the line.
379 # @param theFace2 Second of two faces, defining the line.
380 # @return New GEOM_Object, containing the created line.
382 # @ref swig_MakeLineTwoFaces "Example"
383 def MakeLineTwoFaces(self, theFace1, theFace2):
384 # Example: see GEOM_TestAll.py
385 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
386 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
389 ## Create a plane, passing through the given point
390 # and normal to the given vector.
391 # @param thePnt Point, the plane has to pass through.
392 # @param theVec Vector, defining the plane normal direction.
393 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
394 # @return New GEOM_Object, containing the created plane.
396 # @ref tui_creation_plane "Example"
397 def MakePlane(self,thePnt, theVec, theTrimSize):
398 # Example: see GEOM_TestAll.py
399 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
400 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
403 ## Create a plane, passing through the three given points
404 # @param thePnt1 First of three points, defining the plane.
405 # @param thePnt2 Second of three points, defining the plane.
406 # @param thePnt3 Fird of three points, defining the plane.
407 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
408 # @return New GEOM_Object, containing the created plane.
410 # @ref tui_creation_plane "Example"
411 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
412 # Example: see GEOM_TestAll.py
413 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
414 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
417 ## Create a plane, similar to the existing one, but with another size of representing face.
418 # @param theFace Referenced plane or LCS(Marker).
419 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
420 # @return New GEOM_Object, containing the created plane.
422 # @ref tui_creation_plane "Example"
423 def MakePlaneFace(self,theFace, theTrimSize):
424 # Example: see GEOM_TestAll.py
425 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
426 RaiseIfFailed("MakePlaneFace", self.BasicOp)
429 ## Create a local coordinate system.
430 # @param OX,OY,OZ Three coordinates of coordinate system origin.
431 # @param XDX,XDY,XDZ Three components of OX direction
432 # @param YDX,YDY,YDZ Three components of OY direction
433 # @return New GEOM_Object, containing the created coordinate system.
435 # @ref swig_MakeMarker "Example"
436 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
437 # Example: see GEOM_TestAll.py
438 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
439 RaiseIfFailed("MakeMarker", self.BasicOp)
442 ## Create a local coordinate system.
443 # @param theOrigin Point of coordinate system origin.
444 # @param theXVec Vector of X direction
445 # @param theYVec Vector of Y direction
446 # @return New GEOM_Object, containing the created coordinate system.
448 # @ref swig_MakeMarker "Example"
449 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
450 O = self.PointCoordinates( theOrigin )
452 for vec in [ theXVec, theYVec ]:
453 v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] )
454 p1 = self.PointCoordinates( v1 )
455 p2 = self.PointCoordinates( v2 )
456 for i in range( 0, 3 ):
457 OXOY.append( p2[i] - p1[i] )
459 anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2],
460 OXOY[0], OXOY[1], OXOY[2],
461 OXOY[3], OXOY[4], OXOY[5], )
462 RaiseIfFailed("MakeMarker", self.BasicOp)
468 ## @addtogroup l4_curves
471 ## Create an arc of circle, passing through three given points.
472 # @param thePnt1 Start point of the arc.
473 # @param thePnt2 Middle point of the arc.
474 # @param thePnt3 End point of the arc.
475 # @return New GEOM_Object, containing the created arc.
477 # @ref swig_MakeArc "Example"
478 def MakeArc(self,thePnt1, thePnt2, thePnt3):
479 # Example: see GEOM_TestAll.py
480 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
481 RaiseIfFailed("MakeArc", self.CurvesOp)
484 ## Create an arc of circle from a center and 2 points.
485 # @param thePnt1 Center of the arc
486 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
487 # @param thePnt3 End point of the arc (Gives also a direction)
488 # @param theSense Orientation of the arc
489 # @return New GEOM_Object, containing the created arc.
491 # @ref swig_MakeArc "Example"
492 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
493 # Example: see GEOM_TestAll.py
494 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
495 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
498 ## Create a circle with given center, normal vector and radius.
499 # @param thePnt Circle center.
500 # @param theVec Vector, normal to the plane of the circle.
501 # @param theR Circle radius.
502 # @return New GEOM_Object, containing the created circle.
504 # @ref tui_creation_circle "Example"
505 def MakeCircle(self,thePnt, theVec, theR):
506 # Example: see GEOM_TestAll.py
507 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
508 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
511 ## Create a circle, passing through three given points
512 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
513 # @return New GEOM_Object, containing the created circle.
515 # @ref tui_creation_circle "Example"
516 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
517 # Example: see GEOM_TestAll.py
518 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
519 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
522 ## Create a circle, with given point1 as center,
523 # passing through the point2 as radius and laying in the plane,
524 # defined by all three given points.
525 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
526 # @return New GEOM_Object, containing the created circle.
528 # @ref swig_MakeCircle "Example"
529 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
530 # Example: see GEOM_example6.py
531 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
532 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
535 ## Create an ellipse with given center, normal vector and radiuses.
536 # @param thePnt Ellipse center.
537 # @param theVec Vector, normal to the plane of the ellipse.
538 # @param theRMajor Major ellipse radius.
539 # @param theRMinor Minor ellipse radius.
540 # @return New GEOM_Object, containing the created ellipse.
542 # @ref tui_creation_ellipse "Example"
543 def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor):
544 # Example: see GEOM_TestAll.py
545 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
546 RaiseIfFailed("MakeEllipse", self.CurvesOp)
549 ## Create a polyline on the set of points.
550 # @param thePoints Sequence of points for the polyline.
551 # @return New GEOM_Object, containing the created polyline.
553 # @ref tui_creation_curve "Example"
554 def MakePolyline(self,thePoints):
555 # Example: see GEOM_TestAll.py
556 anObj = self.CurvesOp.MakePolyline(thePoints)
557 RaiseIfFailed("MakePolyline", self.CurvesOp)
560 ## Create bezier curve on the set of points.
561 # @param thePoints Sequence of points for the bezier curve.
562 # @return New GEOM_Object, containing the created bezier curve.
564 # @ref tui_creation_curve "Example"
565 def MakeBezier(self,thePoints):
566 # Example: see GEOM_TestAll.py
567 anObj = self.CurvesOp.MakeSplineBezier(thePoints)
568 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
571 ## Create B-Spline curve on the set of points.
572 # @param thePoints Sequence of points for the B-Spline curve.
573 # @return New GEOM_Object, containing the created B-Spline curve.
575 # @ref tui_creation_curve "Example"
576 def MakeInterpol(self,thePoints):
577 # Example: see GEOM_TestAll.py
578 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints)
579 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
585 ## @addtogroup l3_sketcher
588 ## Create a sketcher (wire or face), following the textual description,
589 # passed through <VAR>theCommand</VAR> argument. \n
590 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
591 # Format of the description string have to be the following:
593 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
596 # - x1, y1 are coordinates of the first sketcher point (zero by default),
598 # - "R angle" : Set the direction by angle
599 # - "D dx dy" : Set the direction by DX & DY
602 # - "TT x y" : Create segment by point at X & Y
603 # - "T dx dy" : Create segment by point with DX & DY
604 # - "L length" : Create segment by direction & Length
605 # - "IX x" : Create segment by direction & Intersect. X
606 # - "IY y" : Create segment by direction & Intersect. Y
609 # - "C radius length" : Create arc by direction, radius and length(in degree)
612 # - "WW" : Close Wire (to finish)
613 # - "WF" : Close Wire and build face (to finish)
615 # @param theCommand String, defining the sketcher in local
616 # coordinates of the working plane.
617 # @param theWorkingPlane Nine double values, defining origin,
618 # OZ and OX directions of the working plane.
619 # @return New GEOM_Object, containing the created wire.
621 # @ref tui_sketcher_page "Example"
622 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
623 # Example: see GEOM_TestAll.py
624 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
625 RaiseIfFailed("MakeSketcher", self.CurvesOp)
628 ## Create a sketcher (wire or face), following the textual description,
629 # passed through <VAR>theCommand</VAR> argument. \n
630 # For format of the description string see the previous method.\n
631 # @param theCommand String, defining the sketcher in local
632 # coordinates of the working plane.
633 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
634 # @return New GEOM_Object, containing the created wire.
636 # @ref tui_sketcher_page "Example"
637 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
638 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
639 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
645 ## @addtogroup l3_3d_primitives
648 ## Create a box by coordinates of two opposite vertices.
650 # @ref tui_creation_box "Example"
651 def MakeBox(self,x1,y1,z1,x2,y2,z2):
652 # Example: see GEOM_TestAll.py
653 pnt1 = self.MakeVertex(x1,y1,z1)
654 pnt2 = self.MakeVertex(x2,y2,z2)
655 return self.MakeBoxTwoPnt(pnt1,pnt2)
657 ## Create a box with specified dimensions along the coordinate axes
658 # and with edges, parallel to the coordinate axes.
659 # Center of the box will be at point (DX/2, DY/2, DZ/2).
660 # @param theDX Length of Box edges, parallel to OX axis.
661 # @param theDY Length of Box edges, parallel to OY axis.
662 # @param theDZ Length of Box edges, parallel to OZ axis.
663 # @return New GEOM_Object, containing the created box.
665 # @ref tui_creation_box "Example"
666 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
667 # Example: see GEOM_TestAll.py
668 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
669 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
672 ## Create a box with two specified opposite vertices,
673 # and with edges, parallel to the coordinate axes
674 # @param thePnt1 First of two opposite vertices.
675 # @param thePnt2 Second of two opposite vertices.
676 # @return New GEOM_Object, containing the created box.
678 # @ref tui_creation_box "Example"
679 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
680 # Example: see GEOM_TestAll.py
681 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
682 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
685 ## Create a cylinder with given base point, axis, radius and height.
686 # @param thePnt Central point of cylinder base.
687 # @param theAxis Cylinder axis.
688 # @param theR Cylinder radius.
689 # @param theH Cylinder height.
690 # @return New GEOM_Object, containing the created cylinder.
692 # @ref tui_creation_cylinder "Example"
693 def MakeCylinder(self,thePnt, theAxis, theR, theH):
694 # Example: see GEOM_TestAll.py
695 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
696 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
699 ## Create a cylinder with given radius and height at
700 # the origin of coordinate system. Axis of the cylinder
701 # will be collinear to the OZ axis of the coordinate system.
702 # @param theR Cylinder radius.
703 # @param theH Cylinder height.
704 # @return New GEOM_Object, containing the created cylinder.
706 # @ref tui_creation_cylinder "Example"
707 def MakeCylinderRH(self,theR, theH):
708 # Example: see GEOM_TestAll.py
709 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
710 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
713 ## Create a sphere with given center and radius.
714 # @param thePnt Sphere center.
715 # @param theR Sphere radius.
716 # @return New GEOM_Object, containing the created sphere.
718 # @ref tui_creation_sphere "Example"
719 def MakeSpherePntR(self, thePnt, theR):
720 # Example: see GEOM_TestAll.py
721 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
722 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
725 ## Create a sphere with given center and radius.
726 # @param x,y,z Coordinates of sphere center.
727 # @param theR Sphere radius.
728 # @return New GEOM_Object, containing the created sphere.
730 # @ref tui_creation_sphere "Example"
731 def MakeSphere(self, x, y, z, theR):
732 # Example: see GEOM_TestAll.py
733 point = self.MakeVertex(x, y, z)
734 anObj = self.MakeSpherePntR(point, theR)
737 ## Create a sphere with given radius at the origin of coordinate system.
738 # @param theR Sphere radius.
739 # @return New GEOM_Object, containing the created sphere.
741 # @ref tui_creation_sphere "Example"
742 def MakeSphereR(self, theR):
743 # Example: see GEOM_TestAll.py
744 anObj = self.PrimOp.MakeSphereR(theR)
745 RaiseIfFailed("MakeSphereR", self.PrimOp)
748 ## Create a cone with given base point, axis, height and radiuses.
749 # @param thePnt Central point of the first cone base.
750 # @param theAxis Cone axis.
751 # @param theR1 Radius of the first cone base.
752 # @param theR2 Radius of the second cone base.
753 # \note If both radiuses are non-zero, the cone will be truncated.
754 # \note If the radiuses are equal, a cylinder will be created instead.
755 # @param theH Cone height.
756 # @return New GEOM_Object, containing the created cone.
758 # @ref tui_creation_cone "Example"
759 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
760 # Example: see GEOM_TestAll.py
761 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
762 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
765 ## Create a cone with given height and radiuses at
766 # the origin of coordinate system. Axis of the cone will
767 # be collinear to the OZ axis of the coordinate system.
768 # @param theR1 Radius of the first cone base.
769 # @param theR2 Radius of the second cone base.
770 # \note If both radiuses are non-zero, the cone will be truncated.
771 # \note If the radiuses are equal, a cylinder will be created instead.
772 # @param theH Cone height.
773 # @return New GEOM_Object, containing the created cone.
775 # @ref tui_creation_cone "Example"
776 def MakeConeR1R2H(self,theR1, theR2, theH):
777 # Example: see GEOM_TestAll.py
778 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
779 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
782 ## Create a torus with given center, normal vector and radiuses.
783 # @param thePnt Torus central point.
784 # @param theVec Torus axis of symmetry.
785 # @param theRMajor Torus major radius.
786 # @param theRMinor Torus minor radius.
787 # @return New GEOM_Object, containing the created torus.
789 # @ref tui_creation_torus "Example"
790 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
791 # Example: see GEOM_TestAll.py
792 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
793 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
796 ## Create a torus with given radiuses at the origin of coordinate system.
797 # @param theRMajor Torus major radius.
798 # @param theRMinor Torus minor radius.
799 # @return New GEOM_Object, containing the created torus.
801 # @ref tui_creation_torus "Example"
802 def MakeTorusRR(self, theRMajor, theRMinor):
803 # Example: see GEOM_TestAll.py
804 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
805 RaiseIfFailed("MakeTorusRR", self.PrimOp)
808 # end of l3_3d_primitives
811 ## @addtogroup l3_complex
814 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
815 # @param theBase Base shape to be extruded.
816 # @param thePoint1 First end of extrusion vector.
817 # @param thePoint2 Second end of extrusion vector.
818 # @return New GEOM_Object, containing the created prism.
820 # @ref tui_creation_prism "Example"
821 def MakePrism(self, theBase, thePoint1, thePoint2):
822 # Example: see GEOM_TestAll.py
823 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
824 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
827 ## Create a shape by extrusion of the base shape along the vector,
828 # i.e. all the space, transfixed by the base shape during its translation
829 # along the vector on the given distance.
830 # @param theBase Base shape to be extruded.
831 # @param theVec Direction of extrusion.
832 # @param theH Prism dimension along theVec.
833 # @return New GEOM_Object, containing the created prism.
835 # @ref tui_creation_prism "Example"
836 def MakePrismVecH(self, theBase, theVec, theH):
837 # Example: see GEOM_TestAll.py
838 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
839 RaiseIfFailed("MakePrismVecH", self.PrimOp)
842 ## Create a shape by extrusion of the base shape along the vector,
843 # i.e. all the space, transfixed by the base shape during its translation
844 # along the vector on the given distance in 2 Ways (forward/backward) .
845 # @param theBase Base shape to be extruded.
846 # @param theVec Direction of extrusion.
847 # @param theH Prism dimension along theVec in forward direction.
848 # @return New GEOM_Object, containing the created prism.
850 # @ref tui_creation_prism "Example"
851 def MakePrismVecH2Ways(self, theBase, theVec, theH):
852 # Example: see GEOM_TestAll.py
853 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
854 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
857 ## Create a shape by revolution of the base shape around the axis
858 # on the given angle, i.e. all the space, transfixed by the base
859 # shape during its rotation around the axis on the given angle.
860 # @param theBase Base shape to be rotated.
861 # @param theAxis Rotation axis.
862 # @param theAngle Rotation angle in radians.
863 # @return New GEOM_Object, containing the created revolution.
865 # @ref tui_creation_revolution "Example"
866 def MakeRevolution(self, theBase, theAxis, theAngle):
867 # Example: see GEOM_TestAll.py
868 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
869 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
872 ## The Same Revolution but in both ways forward&backward.
873 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
874 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
875 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
878 ## Create a filling from the given compound of contours.
879 # @param theShape the compound of contours
880 # @param theMinDeg a minimal degree of BSpline surface to create
881 # @param theMaxDeg a maximal degree of BSpline surface to create
882 # @param theTol2D a 2d tolerance to be reached
883 # @param theTol3D a 3d tolerance to be reached
884 # @param theNbIter a number of iteration of approximation algorithm
885 # @param isApprox if True, BSpline curves are generated in the process
886 # of surface construction. By default it is False, that means
887 # the surface is created using Besier curves. The usage of
888 # Approximation makes the algorithm work slower, but allows
889 # building the surface for rather complex cases
890 # @return New GEOM_Object, containing the created filling surface.
892 # @ref tui_creation_filling "Example"
893 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
894 # Example: see GEOM_TestAll.py
895 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
896 theTol2D, theTol3D, theNbIter, isApprox)
897 RaiseIfFailed("MakeFilling", self.PrimOp)
900 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
901 # @param theSeqSections - set of specified sections.
902 # @param theModeSolid - mode defining building solid or shell
903 # @param thePreci - precision 3D used for smoothing by default 1.e-6
904 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
905 # @return New GEOM_Object, containing the created shell or solid.
907 # @ref swig_todo "Example"
908 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
909 # Example: see GEOM_TestAll.py
910 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
911 RaiseIfFailed("MakeThruSections", self.PrimOp)
914 ## Create a shape by extrusion of the base shape along
915 # the path shape. The path shape can be a wire or an edge.
916 # @param theBase Base shape to be extruded.
917 # @param thePath Path shape to extrude the base shape along it.
918 # @return New GEOM_Object, containing the created pipe.
920 # @ref tui_creation_pipe "Example"
921 def MakePipe(self,theBase, thePath):
922 # Example: see GEOM_TestAll.py
923 anObj = self.PrimOp.MakePipe(theBase, thePath)
924 RaiseIfFailed("MakePipe", self.PrimOp)
927 ## Create a shape by extrusion of the profile shape along
928 # the path shape. The path shape can be a wire or an edge.
929 # the several profiles can be specified in the several locations of path.
930 # @param theSeqBases - list of Bases shape to be extruded.
931 # @param theLocations - list of locations on the path corresponding
932 # specified list of the Bases shapes. Number of locations
933 # should be equal to number of bases or list of locations can be empty.
934 # @param thePath - Path shape to extrude the base shape along it.
935 # @param theWithContact - the mode defining that the section is translated to be in
936 # contact with the spine.
937 # @param theWithCorrection - defining that the section is rotated to be
938 # orthogonal to the spine tangent in the correspondent point
939 # @return New GEOM_Object, containing the created pipe.
941 # @ref swig_todo "Example"
942 def MakePipeWithDifferentSections(self, theSeqBases,
943 theLocations, thePath,
944 theWithContact, theWithCorrection):
945 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
946 theLocations, thePath,
947 theWithContact, theWithCorrection)
948 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
951 ## Create a shape by extrusion of the profile shape along
952 # the path shape. The path shape can be a shell or a face.
953 # the several profiles can be specified in the several locations of path.
954 # @param theSeqBases - list of Bases shape to be extruded.
955 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
956 # @param theLocations - list of locations on the path corresponding
957 # specified list of the Bases shapes. Number of locations
958 # should be equal to number of bases. First and last
959 # locations must be coincided with first and last vertexes
960 # of path correspondingly.
961 # @param thePath - Path shape to extrude the base shape along it.
962 # @param theWithContact - the mode defining that the section is translated to be in
963 # contact with the spine.
964 # @param theWithCorrection - defining that the section is rotated to be
965 # orthogonal to the spine tangent in the correspondent point
966 # @return New GEOM_Object, containing the created solids.
968 # @ref swig_todo "Example"
969 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
970 theLocations, thePath,
971 theWithContact, theWithCorrection):
972 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
973 theLocations, thePath,
974 theWithContact, theWithCorrection)
975 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
978 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
979 theLocations, thePath,
980 theWithContact, theWithCorrection):
982 nbsect = len(theSeqBases)
983 nbsubsect = len(theSeqSubBases)
984 #print "nbsect = ",nbsect
985 for i in range(1,nbsect):
987 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
988 tmpLocations = [ theLocations[i-1], theLocations[i] ]
990 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
991 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
992 tmpLocations, thePath,
993 theWithContact, theWithCorrection)
994 if self.PrimOp.IsDone() == 0:
995 print "Problems with pipe creation between ",i," and ",i+1," sections"
996 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
999 print "Pipe between ",i," and ",i+1," sections is OK"
1004 resc = self.MakeCompound(res)
1005 #resc = self.MakeSewing(res, 0.001)
1006 #print "resc: ",resc
1009 ## Create solids between given sections
1010 # @param theSeqBases - list of sections (shell or face).
1011 # @param theLocations - list of corresponding vertexes
1012 # @return New GEOM_Object, containing the created solids.
1014 # @ref swig_todo "Example"
1015 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1016 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1017 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1023 ## @addtogroup l3_advanced
1026 ## Create a linear edge with specified ends.
1027 # @param thePnt1 Point for the first end of edge.
1028 # @param thePnt2 Point for the second end of edge.
1029 # @return New GEOM_Object, containing the created edge.
1031 # @ref tui_creation_edge "Example"
1032 def MakeEdge(self,thePnt1, thePnt2):
1033 # Example: see GEOM_TestAll.py
1034 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1035 RaiseIfFailed("MakeEdge", self.ShapesOp)
1038 ## Create a wire from the set of edges and wires.
1039 # @param theEdgesAndWires List of edges and/or wires.
1040 # @return New GEOM_Object, containing the created wire.
1042 # @ref tui_creation_wire "Example"
1043 def MakeWire(self,theEdgesAndWires):
1044 # Example: see GEOM_TestAll.py
1045 anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
1046 RaiseIfFailed("MakeWire", self.ShapesOp)
1049 ## Create a face on the given wire.
1050 # @param theWire closed Wire or Edge to build the face on.
1051 # @param isPlanarWanted If TRUE, only planar face will be built.
1052 # If impossible, NULL object will be returned.
1053 # @return New GEOM_Object, containing the created face.
1055 # @ref tui_creation_face "Example"
1056 def MakeFace(self,theWire, isPlanarWanted):
1057 # Example: see GEOM_TestAll.py
1058 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1059 RaiseIfFailed("MakeFace", self.ShapesOp)
1062 ## Create a face on the given wires set.
1063 # @param theWires List of closed wires or edges to build the face on.
1064 # @param isPlanarWanted If TRUE, only planar face will be built.
1065 # If impossible, NULL object will be returned.
1066 # @return New GEOM_Object, containing the created face.
1068 # @ref tui_creation_face "Example"
1069 def MakeFaceWires(self,theWires, isPlanarWanted):
1070 # Example: see GEOM_TestAll.py
1071 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1072 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1075 ## Shortcut to MakeFaceWires()
1077 # @ref tui_creation_face "Example 1"
1078 # \n @ref swig_MakeFaces "Example 2"
1079 def MakeFaces(self,theWires, isPlanarWanted):
1080 # Example: see GEOM_TestOthers.py
1081 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1084 ## Create a shell from the set of faces and shells.
1085 # @param theFacesAndShells List of faces and/or shells.
1086 # @return New GEOM_Object, containing the created shell.
1088 # @ref tui_creation_shell "Example"
1089 def MakeShell(self,theFacesAndShells):
1090 # Example: see GEOM_TestAll.py
1091 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1092 RaiseIfFailed("MakeShell", self.ShapesOp)
1095 ## Create a solid, bounded by the given shells.
1096 # @param theShells Sequence of bounding shells.
1097 # @return New GEOM_Object, containing the created solid.
1099 # @ref tui_creation_solid "Example"
1100 def MakeSolid(self,theShells):
1101 # Example: see GEOM_TestAll.py
1102 anObj = self.ShapesOp.MakeSolidShells(theShells)
1103 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1106 ## Create a compound of the given shapes.
1107 # @param theShapes List of shapes to put in compound.
1108 # @return New GEOM_Object, containing the created compound.
1110 # @ref tui_creation_compound "Example"
1111 def MakeCompound(self,theShapes):
1112 # Example: see GEOM_TestAll.py
1113 anObj = self.ShapesOp.MakeCompound(theShapes)
1114 RaiseIfFailed("MakeCompound", self.ShapesOp)
1117 # end of l3_advanced
1120 ## @addtogroup l2_measure
1123 ## Gives quantity of faces in the given shape.
1124 # @param theShape Shape to count faces of.
1125 # @return Quantity of faces.
1127 # @ref swig_NumberOfFaces "Example"
1128 def NumberOfFaces(self,theShape):
1129 # Example: see GEOM_TestOthers.py
1130 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1131 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1134 ## Gives quantity of edges in the given shape.
1135 # @param theShape Shape to count edges of.
1136 # @return Quantity of edges.
1138 # @ref swig_NumberOfEdges "Example"
1139 def NumberOfEdges(self,theShape):
1140 # Example: see GEOM_TestOthers.py
1141 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1142 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1148 ## @addtogroup l3_healing
1151 ## Reverses an orientation the given shape.
1152 # @param theShape Shape to be reversed.
1153 # @return The reversed copy of theShape.
1155 # @ref swig_ChangeOrientation "Example"
1156 def ChangeOrientation(self,theShape):
1157 # Example: see GEOM_TestAll.py
1158 anObj = self.ShapesOp.ChangeOrientation(theShape)
1159 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1162 ## Shortcut to ChangeOrientation()
1164 # @ref swig_OrientationChange "Example"
1165 def OrientationChange(self,theShape):
1166 # Example: see GEOM_TestOthers.py
1167 anObj = self.ChangeOrientation(theShape)
1173 ## @addtogroup l4_obtain
1176 ## Retrieve all free faces from the given shape.
1177 # Free face is a face, which is not shared between two shells of the shape.
1178 # @param theShape Shape to find free faces in.
1179 # @return List of IDs of all free faces, contained in theShape.
1181 # @ref tui_measurement_tools_page "Example"
1182 def GetFreeFacesIDs(self,theShape):
1183 # Example: see GEOM_TestOthers.py
1184 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1185 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1188 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1189 # @param theShape1 Shape to find sub-shapes in.
1190 # @param theShape2 Shape to find shared sub-shapes with.
1191 # @param theShapeType Type of sub-shapes to be retrieved.
1192 # @return List of sub-shapes of theShape1, shared with theShape2.
1194 # @ref swig_GetSharedShapes "Example"
1195 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1196 # Example: see GEOM_TestOthers.py
1197 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1198 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1201 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1202 # situated relatively the specified plane by the certain way,
1203 # defined through <VAR>theState</VAR> parameter.
1204 # @param theShape Shape to find sub-shapes of.
1205 # @param theShapeType Type of sub-shapes to be retrieved.
1206 # @param theAx1 Vector (or line, or linear edge), specifying normal
1207 # direction and location of the plane to find shapes on.
1208 # @param theState The state of the subshapes to find. It can be one of
1209 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1210 # @return List of all found sub-shapes.
1212 # @ref swig_GetShapesOnPlane "Example"
1213 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1214 # Example: see GEOM_TestOthers.py
1215 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1216 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1219 ## Works like the above method, but returns list of sub-shapes indices
1221 # @ref swig_GetShapesOnPlaneIDs "Example"
1222 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1223 # Example: see GEOM_TestOthers.py
1224 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1225 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1228 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1229 # situated relatively the specified plane by the certain way,
1230 # defined through <VAR>theState</VAR> parameter.
1231 # @param theShape Shape to find sub-shapes of.
1232 # @param theShapeType Type of sub-shapes to be retrieved.
1233 # @param theAx1 Vector (or line, or linear edge), specifying normal
1234 # direction of the plane to find shapes on.
1235 # @param thePnt Point specifying location of the plane to find shapes on.
1236 # @param theState The state of the subshapes to find. It can be one of
1237 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1238 # @return List of all found sub-shapes.
1240 # @ref swig_GetShapesOnPlaneWithLocation "Example"
1241 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1242 # Example: see GEOM_TestOthers.py
1243 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1244 theAx1, thePnt, theState)
1245 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1248 ## Works like the above method, but returns list of sub-shapes indices
1250 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
1251 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1252 # Example: see GEOM_TestOthers.py
1253 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1254 theAx1, thePnt, theState)
1255 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1258 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1259 # the specified cylinder by the certain way, defined through \a theState parameter.
1260 # @param theShape Shape to find sub-shapes of.
1261 # @param theShapeType Type of sub-shapes to be retrieved.
1262 # @param theAxis Vector (or line, or linear edge), specifying
1263 # axis of the cylinder to find shapes on.
1264 # @param theRadius Radius of the cylinder to find shapes on.
1265 # @param theState The state of the subshapes to find. It can be one of
1266 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1267 # @return List of all found sub-shapes.
1269 # @ref swig_GetShapesOnCylinder "Example"
1270 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1271 # Example: see GEOM_TestOthers.py
1272 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1273 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1276 ## Works like the above method, but returns list of sub-shapes indices
1278 # @ref swig_GetShapesOnCylinderIDs "Example"
1279 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1280 # Example: see GEOM_TestOthers.py
1281 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1282 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1285 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1286 # the specified sphere by the certain way, defined through \a theState parameter.
1287 # @param theShape Shape to find sub-shapes of.
1288 # @param theShapeType Type of sub-shapes to be retrieved.
1289 # @param theCenter Point, specifying center of the sphere to find shapes on.
1290 # @param theRadius Radius of the sphere to find shapes on.
1291 # @param theState The state of the subshapes to find. It can be one of
1292 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1293 # @return List of all found sub-shapes.
1295 # @ref swig_GetShapesOnSphere "Example"
1296 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1297 # Example: see GEOM_TestOthers.py
1298 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1299 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1302 ## Works like the above method, but returns list of sub-shapes indices
1304 # @ref swig_GetShapesOnSphereIDs "Example"
1305 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1306 # Example: see GEOM_TestOthers.py
1307 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1308 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1311 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1312 # the specified quadrangle by the certain way, defined through \a theState parameter.
1313 # @param theShape Shape to find sub-shapes of.
1314 # @param theShapeType Type of sub-shapes to be retrieved.
1315 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1316 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1317 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1318 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1319 # @param theState The state of the subshapes to find. It can be one of
1320 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1321 # @return List of all found sub-shapes.
1323 # @ref swig_GetShapesOnQuadrangle "Example"
1324 def GetShapesOnQuadrangle(self, theShape, theShapeType,
1325 theTopLeftPoint, theTopRigthPoint,
1326 theBottomLeftPoint, theBottomRigthPoint, theState):
1327 # Example: see GEOM_TestOthers.py
1328 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
1329 theTopLeftPoint, theTopRigthPoint,
1330 theBottomLeftPoint, theBottomRigthPoint, theState)
1331 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
1334 ## Works like the above method, but returns list of sub-shapes indices
1336 # @ref swig_GetShapesOnQuadrangleIDs "Example"
1337 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
1338 theTopLeftPoint, theTopRigthPoint,
1339 theBottomLeftPoint, theBottomRigthPoint, theState):
1340 # Example: see GEOM_TestOthers.py
1341 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
1342 theTopLeftPoint, theTopRigthPoint,
1343 theBottomLeftPoint, theBottomRigthPoint, theState)
1344 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
1347 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1348 # the specified \a theBox by the certain way, defined through \a theState parameter.
1349 # @param theBox Shape for relative comparing.
1350 # @param theShape Shape to find sub-shapes of.
1351 # @param theShapeType Type of sub-shapes to be retrieved.
1352 # @param theState The state of the subshapes to find. It can be one of
1353 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1354 # @return List of all found sub-shapes.
1356 # @ref swig_GetShapesOnBox "Example"
1357 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
1358 # Example: see GEOM_TestOthers.py
1359 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
1360 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
1363 ## Works like the above method, but returns list of sub-shapes indices
1365 # @ref swig_GetShapesOnBoxIDs "Example"
1366 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
1367 # Example: see GEOM_TestOthers.py
1368 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
1369 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
1372 ## Find in \a theShape all sub-shapes of type \a theShapeType,
1373 # situated relatively the specified \a theCheckShape by the
1374 # certain way, defined through \a theState parameter.
1375 # @param theCheckShape Shape for relative comparing.
1376 # @param theShape Shape to find sub-shapes of.
1377 # @param theShapeType Type of sub-shapes to be retrieved.
1378 # @param theState The state of the subshapes to find. It can be one of
1379 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1380 # @return List of all found sub-shapes.
1382 # @ref swig_GetShapesOnShape "Example"
1383 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
1384 # Example: see GEOM_TestOthers.py
1385 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
1386 theShapeType, theState)
1387 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
1390 ## Works like the above method, but returns result as compound
1392 # @ref swig_GetShapesOnShapeAsCompound "Example"
1393 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
1394 # Example: see GEOM_TestOthers.py
1395 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
1396 theShapeType, theState)
1397 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
1400 ## Works like the above method, but returns list of sub-shapes indices
1402 # @ref swig_GetShapesOnShapeIDs "Example"
1403 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
1404 # Example: see GEOM_TestOthers.py
1405 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
1406 theShapeType, theState)
1407 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
1410 ## Get sub-shape(s) of theShapeWhere, which are
1411 # coincident with \a theShapeWhat or could be a part of it.
1412 # @param theShapeWhere Shape to find sub-shapes of.
1413 # @param theShapeWhat Shape, specifying what to find.
1414 # @return Group of all found sub-shapes or a single found sub-shape.
1416 # @ref swig_GetInPlace "Example"
1417 def GetInPlace(self,theShapeWhere, theShapeWhat):
1418 # Example: see GEOM_TestOthers.py
1419 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
1420 RaiseIfFailed("GetInPlace", self.ShapesOp)
1423 ## Get sub-shape(s) of \a theShapeWhere, which are
1424 # coincident with \a theShapeWhat or could be a part of it.
1426 # Implementation of this method is based on a saved history of an operation,
1427 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
1428 # arguments (an argument shape or a sub-shape of an argument shape).
1429 # The operation could be the Partition or one of boolean operations,
1430 # performed on simple shapes (not on compounds).
1432 # @param theShapeWhere Shape to find sub-shapes of.
1433 # @param theShapeWhat Shape, specifying what to find (must be in the
1434 # building history of the ShapeWhere).
1435 # @return Group of all found sub-shapes or a single found sub-shape.
1437 # @ref swig_GetInPlace "Example"
1438 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
1439 # Example: see GEOM_TestOthers.py
1440 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
1441 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
1444 ## Get sub-shape of theShapeWhere, which is
1445 # equal to \a theShapeWhat.
1446 # @param theShapeWhere Shape to find sub-shape of.
1447 # @param theShapeWhat Shape, specifying what to find.
1448 # @return New GEOM_Object for found sub-shape.
1450 # @ref swig_GetSame "Example"
1451 def GetSame(self,theShapeWhere, theShapeWhat):
1452 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
1453 RaiseIfFailed("GetSame", self.ShapesOp)
1459 ## @addtogroup l4_access
1462 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
1463 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
1465 # @ref swig_all_decompose "Example"
1466 def GetSubShape(self, aShape, ListOfID):
1467 # Example: see GEOM_TestAll.py
1468 anObj = self.AddSubShape(aShape,ListOfID)
1471 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
1473 # @ref swig_all_decompose "Example"
1474 def GetSubShapeID(self, aShape, aSubShape):
1475 # Example: see GEOM_TestAll.py
1476 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
1477 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
1483 ## @addtogroup l4_decompose
1486 ## Explode a shape on subshapes of a given type.
1487 # @param aShape Shape to be exploded.
1488 # @param aType Type of sub-shapes to be retrieved.
1489 # @return List of sub-shapes of type theShapeType, contained in theShape.
1491 # @ref swig_all_decompose "Example"
1492 def SubShapeAll(self, aShape, aType):
1493 # Example: see GEOM_TestAll.py
1494 ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
1495 RaiseIfFailed("MakeExplode", self.ShapesOp)
1498 ## Explode a shape on subshapes of a given type.
1499 # @param aShape Shape to be exploded.
1500 # @param aType Type of sub-shapes to be retrieved.
1501 # @return List of IDs of sub-shapes.
1503 # @ref swig_all_decompose "Example"
1504 def SubShapeAllIDs(self, aShape, aType):
1505 ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
1506 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1509 ## Explode a shape on subshapes of a given type.
1510 # Sub-shapes will be sorted by coordinates of their gravity centers.
1511 # @param aShape Shape to be exploded.
1512 # @param aType Type of sub-shapes to be retrieved.
1513 # @return List of sub-shapes of type theShapeType, contained in theShape.
1515 # @ref swig_SubShapeAllSorted "Example"
1516 def SubShapeAllSorted(self, aShape, aType):
1517 # Example: see GEOM_TestAll.py
1518 ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
1519 RaiseIfFailed("MakeExplode", self.ShapesOp)
1522 ## Explode a shape on subshapes of a given type.
1523 # Sub-shapes will be sorted by coordinates of their gravity centers.
1524 # @param aShape Shape to be exploded.
1525 # @param aType Type of sub-shapes to be retrieved.
1526 # @return List of IDs of sub-shapes.
1528 # @ref swig_all_decompose "Example"
1529 def SubShapeAllSortedIDs(self, aShape, aType):
1530 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
1531 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1534 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1535 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
1536 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1538 # @ref swig_all_decompose "Example"
1539 def SubShape(self, aShape, aType, ListOfInd):
1540 # Example: see GEOM_TestAll.py
1542 AllShapeList = self.SubShapeAll(aShape, aType)
1543 for ind in ListOfInd:
1544 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1545 anObj = self.GetSubShape(aShape, ListOfIDs)
1548 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1549 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
1550 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1552 # @ref swig_all_decompose "Example"
1553 def SubShapeSorted(self,aShape, aType, ListOfInd):
1554 # Example: see GEOM_TestAll.py
1556 AllShapeList = self.SubShapeAllSorted(aShape, aType)
1557 for ind in ListOfInd:
1558 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1559 anObj = self.GetSubShape(aShape, ListOfIDs)
1562 # end of l4_decompose
1565 ## @addtogroup l3_healing
1568 ## Apply a sequence of Shape Healing operators to the given object.
1569 # @param theShape Shape to be processed.
1570 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1571 # @param theParameters List of names of parameters
1572 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1573 # @param theValues List of values of parameters, in the same order
1574 # as parameters are listed in <VAR>theParameters</VAR> list.
1575 # @return New GEOM_Object, containing processed shape.
1577 # @ref tui_shape_processing "Example"
1578 def ProcessShape(self,theShape, theOperators, theParameters, theValues):
1579 # Example: see GEOM_TestHealing.py
1580 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1581 RaiseIfFailed("ProcessShape", self.HealOp)
1584 ## Remove faces from the given object (shape).
1585 # @param theObject Shape to be processed.
1586 # @param theFaces Indices of faces to be removed, if EMPTY then the method
1587 # removes ALL faces of the given object.
1588 # @return New GEOM_Object, containing processed shape.
1590 # @ref tui_suppress_faces "Example"
1591 def SuppressFaces(self,theObject, theFaces):
1592 # Example: see GEOM_TestHealing.py
1593 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
1594 RaiseIfFailed("SuppressFaces", self.HealOp)
1597 ## Sewing of some shapes into single shape.
1599 # @ref tui_sewing "Example"
1600 def MakeSewing(self, ListShape, theTolerance):
1601 # Example: see GEOM_TestHealing.py
1602 comp = self.MakeCompound(ListShape)
1603 anObj = self.Sew(comp, theTolerance)
1606 ## Sewing of the given object.
1607 # @param theObject Shape to be processed.
1608 # @param theTolerance Required tolerance value.
1609 # @return New GEOM_Object, containing processed shape.
1610 def Sew(self, theObject, theTolerance):
1611 # Example: see MakeSewing() above
1612 anObj = self.HealOp.Sew(theObject, theTolerance)
1613 RaiseIfFailed("Sew", self.HealOp)
1616 ## Remove internal wires and edges from the given object (face).
1617 # @param theObject Shape to be processed.
1618 # @param theWires Indices of wires to be removed, if EMPTY then the method
1619 # removes ALL internal wires of the given object.
1620 # @return New GEOM_Object, containing processed shape.
1622 # @ref tui_suppress_internal_wires "Example"
1623 def SuppressInternalWires(self,theObject, theWires):
1624 # Example: see GEOM_TestHealing.py
1625 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
1626 RaiseIfFailed("RemoveIntWires", self.HealOp)
1629 ## Remove internal closed contours (holes) from the given object.
1630 # @param theObject Shape to be processed.
1631 # @param theWires Indices of wires to be removed, if EMPTY then the method
1632 # removes ALL internal holes of the given object
1633 # @return New GEOM_Object, containing processed shape.
1635 # @ref tui_suppress_holes "Example"
1636 def SuppressHoles(self,theObject, theWires):
1637 # Example: see GEOM_TestHealing.py
1638 anObj = self.HealOp.FillHoles(theObject, theWires)
1639 RaiseIfFailed("FillHoles", self.HealOp)
1642 ## Close an open wire.
1643 # @param theObject Shape to be processed.
1644 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1645 # if -1, then <VAR>theObject</VAR> itself is a wire.
1646 # @param isCommonVertex If TRUE : closure by creation of a common vertex,
1647 # If FALS : closure by creation of an edge between ends.
1648 # @return New GEOM_Object, containing processed shape.
1650 # @ref tui_close_contour "Example"
1651 def CloseContour(self,theObject, theWires, isCommonVertex):
1652 # Example: see GEOM_TestHealing.py
1653 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
1654 RaiseIfFailed("CloseContour", self.HealOp)
1657 ## Addition of a point to a given edge object.
1658 # @param theObject Shape to be processed.
1659 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
1660 # if -1, then theObject itself is the edge.
1661 # @param theValue Value of parameter on edge or length parameter,
1662 # depending on \a isByParameter.
1663 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1664 # if FALSE : \a theValue is treated as a length parameter [0..1]
1665 # @return New GEOM_Object, containing processed shape.
1667 # @ref tui_add_point_on_edge "Example"
1668 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
1669 # Example: see GEOM_TestHealing.py
1670 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1671 RaiseIfFailed("DivideEdge", self.HealOp)
1674 ## Change orientation of the given object.
1675 # @param theObject Shape to be processed.
1676 # @update given shape
1678 # @ref swig_todo "Example"
1679 def ChangeOrientationShell(self,theObject):
1680 theObject = self.HealOp.ChangeOrientation(theObject)
1681 RaiseIfFailed("ChangeOrientation", self.HealOp)
1684 ## Change orientation of the given object.
1685 # @param theObject Shape to be processed.
1686 # @return New GEOM_Object, containing processed shape.
1688 # @ref swig_todo "Example"
1689 def ChangeOrientationShellCopy(self,theObject):
1690 anObj = self.HealOp.ChangeOrientationCopy(theObject)
1691 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
1694 ## Get a list of wires (wrapped in GEOM_Object-s),
1695 # that constitute a free boundary of the given shape.
1696 # @param theObject Shape to get free boundary of.
1697 # @return [status, theClosedWires, theOpenWires]
1698 # status: FALSE, if an error(s) occured during the method execution.
1699 # theClosedWires: Closed wires on the free boundary of the given shape.
1700 # theOpenWires: Open wires on the free boundary of the given shape.
1702 # @ref tui_measurement_tools_page "Example"
1703 def GetFreeBoundary(self,theObject):
1704 # Example: see GEOM_TestHealing.py
1705 anObj = self.HealOp.GetFreeBoundary(theObject)
1706 RaiseIfFailed("GetFreeBoundary", self.HealOp)
1709 ## Replace coincident faces in theShape by one face.
1710 # @param theShape Initial shape.
1711 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
1712 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1713 # otherwise all initial shapes.
1714 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
1716 # @ref tui_glue_faces "Example"
1717 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
1718 # Example: see GEOM_Spanner.py
1719 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
1721 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
1724 ## Find coincident faces in theShape for possible gluing.
1725 # @param theShape Initial shape.
1726 # @param theTolerance Maximum distance between faces,
1727 # which can be considered as coincident.
1730 # @ref swig_todo "Example"
1731 def GetGlueFaces(self, theShape, theTolerance):
1732 # Example: see GEOM_Spanner.py
1733 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
1734 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
1737 ## Replace coincident faces in theShape by one face
1738 # in compliance with given list of faces
1739 # @param theShape Initial shape.
1740 # @param theTolerance Maximum distance between faces,
1741 # which can be considered as coincident.
1742 # @param theFaces List of faces for gluing.
1743 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1744 # otherwise all initial shapes.
1745 # @return New GEOM_Object, containing a copy of theShape
1746 # without some faces.
1748 # @ref swig_todo "Example"
1749 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
1750 # Example: see GEOM_Spanner.py
1751 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
1753 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
1759 ## @addtogroup l3_boolean Boolean Operations
1762 # -----------------------------------------------------------------------------
1763 # Boolean (Common, Cut, Fuse, Section)
1764 # -----------------------------------------------------------------------------
1766 ## Perform one of boolean operations on two given shapes.
1767 # @param theShape1 First argument for boolean operation.
1768 # @param theShape2 Second argument for boolean operation.
1769 # @param theOperation Indicates the operation to be done:
1770 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
1771 # @return New GEOM_Object, containing the result shape.
1773 # @ref tui_fuse "Example"
1774 def MakeBoolean(self,theShape1, theShape2, theOperation):
1775 # Example: see GEOM_TestAll.py
1776 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
1777 RaiseIfFailed("MakeBoolean", self.BoolOp)
1780 ## Shortcut to MakeBoolean(s1, s2, 1)
1782 # @ref tui_common "Example 1"
1783 # \n @ref swig_MakeCommon "Example 2"
1784 def MakeCommon(self, s1, s2):
1785 # Example: see GEOM_TestOthers.py
1786 return self.MakeBoolean(s1, s2, 1)
1788 ## Shortcut to MakeBoolean(s1, s2, 2)
1790 # @ref tui_cut "Example 1"
1791 # \n @ref swig_MakeCommon "Example 2"
1792 def MakeCut(self, s1, s2):
1793 # Example: see GEOM_TestOthers.py
1794 return self.MakeBoolean(s1, s2, 2)
1796 ## Shortcut to MakeBoolean(s1, s2, 3)
1798 # @ref tui_fuse "Example 1"
1799 # \n @ref swig_MakeCommon "Example 2"
1800 def MakeFuse(self, s1, s2):
1801 # Example: see GEOM_TestOthers.py
1802 return self.MakeBoolean(s1, s2, 3)
1804 ## Shortcut to MakeBoolean(s1, s2, 4)
1806 # @ref tui_section "Example 1"
1807 # \n @ref swig_MakeCommon "Example 2"
1808 def MakeSection(self, s1, s2):
1809 # Example: see GEOM_TestOthers.py
1810 return self.MakeBoolean(s1, s2, 4)
1815 ## @addtogroup l3_basic_op
1818 ## Perform partition operation.
1819 # @param ListShapes Shapes to be intersected.
1820 # @param ListTools Shapes to intersect theShapes.
1821 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
1822 # in order to avoid possible intersection between shapes from
1824 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
1825 # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
1826 # type <= Limit are kept in the result,
1827 # else - shapes with type > Limit are kept
1828 # also (if they exist)
1830 # After implementation new version of PartitionAlgo (October 2006)
1831 # other parameters are ignored by current functionality. They are kept
1832 # in this function only for support old versions.
1833 # Ignored parameters:
1834 # @param ListKeepInside Shapes, outside which the results will be deleted.
1835 # Each shape from theKeepInside must belong to theShapes also.
1836 # @param ListRemoveInside Shapes, inside which the results will be deleted.
1837 # Each shape from theRemoveInside must belong to theShapes also.
1838 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
1839 # @param ListMaterials Material indices for each shape. Make sence,
1840 # only if theRemoveWebs is TRUE.
1842 # @return New GEOM_Object, containing the result shapes.
1844 # @ref tui_partition "Example"
1845 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1846 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
1847 KeepNonlimitShapes=0):
1848 # Example: see GEOM_TestAll.py
1849 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
1850 ListKeepInside, ListRemoveInside,
1851 Limit, RemoveWebs, ListMaterials,
1852 KeepNonlimitShapes);
1853 RaiseIfFailed("MakePartition", self.BoolOp)
1856 ## Perform partition operation.
1857 # This method may be useful if it is needed to make a partition for
1858 # compound contains nonintersected shapes. Performance will be better
1859 # since intersection between shapes from compound is not performed.
1861 # Description of all parameters as in previous method MakePartition()
1863 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
1864 # have to consist of nonintersecting shapes.
1866 # @return New GEOM_Object, containing the result shapes.
1868 # @ref swig_todo "Example"
1869 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
1870 ListKeepInside=[], ListRemoveInside=[],
1871 Limit=ShapeType["SHAPE"], RemoveWebs=0,
1872 ListMaterials=[], KeepNonlimitShapes=0):
1873 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
1874 ListKeepInside, ListRemoveInside,
1875 Limit, RemoveWebs, ListMaterials,
1876 KeepNonlimitShapes);
1877 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
1880 ## Shortcut to MakePartition()
1882 # @ref tui_partition "Example 1"
1883 # \n @ref swig_Partition "Example 2"
1884 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1885 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
1886 KeepNonlimitShapes=0):
1887 # Example: see GEOM_TestOthers.py
1888 anObj = self.MakePartition(ListShapes, ListTools,
1889 ListKeepInside, ListRemoveInside,
1890 Limit, RemoveWebs, ListMaterials,
1891 KeepNonlimitShapes);
1894 ## Perform partition of the Shape with the Plane
1895 # @param theShape Shape to be intersected.
1896 # @param thePlane Tool shape, to intersect theShape.
1897 # @return New GEOM_Object, containing the result shape.
1899 # @ref tui_partition "Example"
1900 def MakeHalfPartition(self,theShape, thePlane):
1901 # Example: see GEOM_TestAll.py
1902 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
1903 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
1906 # end of l3_basic_op
1909 ## @addtogroup l3_transform
1912 ## Translate the given object along the vector, specified
1913 # by its end points, creating its copy before the translation.
1914 # @param theObject The object to be translated.
1915 # @param thePoint1 Start point of translation vector.
1916 # @param thePoint2 End point of translation vector.
1917 # @return New GEOM_Object, containing the translated object.
1919 # @ref tui_translation "Example 1"
1920 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
1921 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
1922 # Example: see GEOM_TestAll.py
1923 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
1924 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
1927 ## Translate the given object along the vector, specified
1928 # by its components, creating its copy before the translation.
1929 # @param theObject The object to be translated.
1930 # @param theDX,theDY,theDZ Components of translation vector.
1931 # @return New GEOM_Object, containing the translated object.
1933 # @ref tui_translation "Example"
1934 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
1935 # Example: see GEOM_TestAll.py
1936 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
1937 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
1940 ## Translate the given object along the given vector,
1941 # creating its copy before the translation.
1942 # @param theObject The object to be translated.
1943 # @param theVector The translation vector.
1944 # @return New GEOM_Object, containing the translated object.
1946 # @ref tui_translation "Example"
1947 def MakeTranslationVector(self,theObject, theVector):
1948 # Example: see GEOM_TestAll.py
1949 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
1950 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
1953 ## Translate the given object along the given vector on given distance,
1954 # creating its copy before the translation.
1955 # @param theObject The object to be translated.
1956 # @param theVector The translation vector.
1957 # @param theDistance The translation distance.
1958 # @return New GEOM_Object, containing the translated object.
1960 # @ref tui_translation "Example"
1961 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
1962 # Example: see GEOM_TestAll.py
1963 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
1964 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
1967 ## Rotate the given object around the given axis
1968 # on the given angle, creating its copy before the rotatation.
1969 # @param theObject The object to be rotated.
1970 # @param theAxis Rotation axis.
1971 # @param theAngle Rotation angle in radians.
1972 # @return New GEOM_Object, containing the rotated object.
1974 # @ref tui_rotation "Example"
1975 def MakeRotation(self,theObject, theAxis, theAngle):
1976 # Example: see GEOM_TestAll.py
1977 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
1978 RaiseIfFailed("RotateCopy", self.TrsfOp)
1981 ## Rotate given object around vector perpendicular to plane
1982 # containing three points, creating its copy before the rotatation.
1983 # @param theObject The object to be rotated.
1984 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
1985 # containing the three points.
1986 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
1987 # @return New GEOM_Object, containing the rotated object.
1989 # @ref tui_rotation "Example"
1990 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
1991 # Example: see GEOM_TestAll.py
1992 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
1993 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
1996 ## Scale the given object by the factor, creating its copy before the scaling.
1997 # @param theObject The object to be scaled.
1998 # @param thePoint Center point for scaling.
1999 # @param theFactor Scaling factor value.
2000 # @return New GEOM_Object, containing the scaled shape.
2002 # @ref tui_scale "Example"
2003 def MakeScaleTransform(self,theObject, thePoint, theFactor):
2004 # Example: see GEOM_TestAll.py
2005 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
2006 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
2009 ## Create an object, symmetrical
2010 # to the given one relatively the given plane.
2011 # @param theObject The object to be mirrored.
2012 # @param thePlane Plane of symmetry.
2013 # @return New GEOM_Object, containing the mirrored shape.
2015 # @ref tui_mirror "Example"
2016 def MakeMirrorByPlane(self,theObject, thePlane):
2017 # Example: see GEOM_TestAll.py
2018 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
2019 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
2022 ## Create an object, symmetrical
2023 # to the given one relatively the given axis.
2024 # @param theObject The object to be mirrored.
2025 # @param theAxis Axis of symmetry.
2026 # @return New GEOM_Object, containing the mirrored shape.
2028 # @ref tui_mirror "Example"
2029 def MakeMirrorByAxis(self,theObject, theAxis):
2030 # Example: see GEOM_TestAll.py
2031 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
2032 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
2035 ## Create an object, symmetrical
2036 # to the given one relatively the given point.
2037 # @param theObject The object to be mirrored.
2038 # @param thePoint Point of symmetry.
2039 # @return New GEOM_Object, containing the mirrored shape.
2041 # @ref tui_mirror "Example"
2042 def MakeMirrorByPoint(self,theObject, thePoint):
2043 # Example: see GEOM_TestAll.py
2044 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
2045 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
2048 ## Modify the Location of the given object by LCS,
2049 # creating its copy before the setting.
2050 # @param theObject The object to be displaced.
2051 # @param theStartLCS Coordinate system to perform displacement from it.
2052 # If \a theStartLCS is NULL, displacement
2053 # will be performed from global CS.
2054 # If \a theObject itself is used as \a theStartLCS,
2055 # its location will be changed to \a theEndLCS.
2056 # @param theEndLCS Coordinate system to perform displacement to it.
2057 # @return New GEOM_Object, containing the displaced shape.
2059 # @ref tui_modify_location "Example"
2060 def MakePosition(self,theObject, theStartLCS, theEndLCS):
2061 # Example: see GEOM_TestAll.py
2062 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
2063 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
2066 ## Create new object as offset of the given one.
2067 # @param theObject The base object for the offset.
2068 # @param theOffset Offset value.
2069 # @return New GEOM_Object, containing the offset object.
2071 # @ref tui_offset "Example"
2072 def MakeOffset(self,theObject, theOffset):
2073 # Example: see GEOM_TestAll.py
2074 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
2075 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
2078 # -----------------------------------------------------------------------------
2080 # -----------------------------------------------------------------------------
2082 ## Translate the given object along the given vector a given number times
2083 # @param theObject The object to be translated.
2084 # @param theVector Direction of the translation.
2085 # @param theStep Distance to translate on.
2086 # @param theNbTimes Quantity of translations to be done.
2087 # @return New GEOM_Object, containing compound of all
2088 # the shapes, obtained after each translation.
2090 # @ref tui_multi_translation "Example"
2091 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
2092 # Example: see GEOM_TestAll.py
2093 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
2094 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
2097 ## Conseqently apply two specified translations to theObject specified number of times.
2098 # @param theObject The object to be translated.
2099 # @param theVector1 Direction of the first translation.
2100 # @param theStep1 Step of the first translation.
2101 # @param theNbTimes1 Quantity of translations to be done along theVector1.
2102 # @param theVector2 Direction of the second translation.
2103 # @param theStep2 Step of the second translation.
2104 # @param theNbTimes2 Quantity of translations to be done along theVector2.
2105 # @return New GEOM_Object, containing compound of all
2106 # the shapes, obtained after each translation.
2108 # @ref tui_multi_translation "Example"
2109 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
2110 theVector2, theStep2, theNbTimes2):
2111 # Example: see GEOM_TestAll.py
2112 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
2113 theVector2, theStep2, theNbTimes2)
2114 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
2117 ## Rotate the given object around the given axis a given number times.
2118 # Rotation angle will be 2*PI/theNbTimes.
2119 # @param theObject The object to be rotated.
2120 # @param theAxis The rotation axis.
2121 # @param theNbTimes Quantity of rotations to be done.
2122 # @return New GEOM_Object, containing compound of all the
2123 # shapes, obtained after each rotation.
2125 # @ref tui_multi_rotation "Example"
2126 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
2127 # Example: see GEOM_TestAll.py
2128 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
2129 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
2132 ## Rotate the given object around the
2133 # given axis on the given angle a given number
2134 # times and multi-translate each rotation result.
2135 # Translation direction passes through center of gravity
2136 # of rotated shape and its projection on the rotation axis.
2137 # @param theObject The object to be rotated.
2138 # @param theAxis Rotation axis.
2139 # @param theAngle Rotation angle in graduces.
2140 # @param theNbTimes1 Quantity of rotations to be done.
2141 # @param theStep Translation distance.
2142 # @param theNbTimes2 Quantity of translations to be done.
2143 # @return New GEOM_Object, containing compound of all the
2144 # shapes, obtained after each transformation.
2146 # @ref tui_multi_rotation "Example"
2147 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
2148 # Example: see GEOM_TestAll.py
2149 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
2150 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
2153 ## The same, as MultiRotate1D(), but axis is given by direction and point
2154 # @ref swig_MakeMultiRotation "Example"
2155 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
2156 # Example: see GEOM_TestOthers.py
2157 aVec = self.MakeLine(aPoint,aDir)
2158 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
2161 ## The same, as MultiRotate2D(), but axis is given by direction and point
2162 # @ref swig_MakeMultiRotation "Example"
2163 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
2164 # Example: see GEOM_TestOthers.py
2165 aVec = self.MakeLine(aPoint,aDir)
2166 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
2169 # end of l3_transform
2172 ## @addtogroup l3_local
2175 ## Perform a fillet on all edges of the given shape.
2176 # @param theShape Shape, to perform fillet on.
2177 # @param theR Fillet radius.
2178 # @return New GEOM_Object, containing the result shape.
2180 # @ref tui_fillet "Example 1"
2181 # \n @ref swig_MakeFilletAll "Example 2"
2182 def MakeFilletAll(self,theShape, theR):
2183 # Example: see GEOM_TestOthers.py
2184 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
2185 RaiseIfFailed("MakeFilletAll", self.LocalOp)
2188 ## Perform a fillet on the specified edges/faces of the given shape
2189 # @param theShape Shape, to perform fillet on.
2190 # @param theR Fillet radius.
2191 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
2192 # @param theListShapes Global indices of edges/faces to perform fillet on.
2193 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2194 # @return New GEOM_Object, containing the result shape.
2196 # @ref tui_fillet "Example"
2197 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
2198 # Example: see GEOM_TestAll.py
2200 if theShapeType == ShapeType["EDGE"]:
2201 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
2202 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
2204 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
2205 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
2208 ## The same that MakeFillet but with two Fillet Radius R1 and R2
2209 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
2211 if theShapeType == ShapeType["EDGE"]:
2212 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
2213 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
2215 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
2216 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
2219 ## Perform a symmetric chamfer on all edges of the given shape.
2220 # @param theShape Shape, to perform chamfer on.
2221 # @param theD Chamfer size along each face.
2222 # @return New GEOM_Object, containing the result shape.
2224 # @ref tui_chamfer "Example 1"
2225 # \n @ref swig_MakeChamferAll "Example 2"
2226 def MakeChamferAll(self,theShape, theD):
2227 # Example: see GEOM_TestOthers.py
2228 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
2229 RaiseIfFailed("MakeChamferAll", self.LocalOp)
2232 ## Perform a chamfer on edges, common to the specified faces,
2233 # with distance D1 on the Face1
2234 # @param theShape Shape, to perform chamfer on.
2235 # @param theD1 Chamfer size along \a theFace1.
2236 # @param theD2 Chamfer size along \a theFace2.
2237 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
2238 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2239 # @return New GEOM_Object, containing the result shape.
2241 # @ref tui_chamfer "Example"
2242 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
2243 # Example: see GEOM_TestAll.py
2244 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
2245 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
2248 ## The Same that MakeChamferEdge but with params theD is chamfer length and
2249 # theAngle is Angle of chamfer (angle in radians)
2250 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
2251 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
2252 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
2255 ## Perform a chamfer on all edges of the specified faces,
2256 # with distance D1 on the first specified face (if several for one edge)
2257 # @param theShape Shape, to perform chamfer on.
2258 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
2259 # connected to the edge, are in \a theFaces, \a theD1
2260 # will be get along face, which is nearer to \a theFaces beginning.
2261 # @param theD2 Chamfer size along another of two faces, connected to the edge.
2262 # @param theFaces Sequence of global indices of faces of \a theShape.
2263 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2264 # @return New GEOM_Object, containing the result shape.
2266 # @ref tui_chamfer "Example"
2267 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
2268 # Example: see GEOM_TestAll.py
2269 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
2270 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
2273 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
2274 # theAngle is Angle of chamfer (angle in radians)
2276 # @ref swig_FilletChamfer "Example"
2277 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
2278 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
2279 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
2282 ## Perform a chamfer on edges,
2283 # with distance D1 on the first specified face (if several for one edge)
2284 # @param theShape Shape, to perform chamfer on.
2285 # @param theD1,theD2 Chamfer size
2286 # @param theEdges Sequence of edges of \a theShape.
2287 # @return New GEOM_Object, containing the result shape.
2289 # @ref swig_FilletChamfer "Example"
2290 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
2291 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
2292 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
2295 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
2296 # theAngle is Angle of chamfer (angle in radians)
2297 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
2298 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
2299 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
2302 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
2304 # @ref swig_MakeChamfer "Example"
2305 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
2306 # Example: see GEOM_TestOthers.py
2308 if aShapeType == ShapeType["EDGE"]:
2309 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
2311 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
2317 ## @addtogroup l3_basic_op
2320 ## Perform an Archimde operation on the given shape with given parameters.
2321 # The object presenting the resulting face is returned.
2322 # @param theShape Shape to be put in water.
2323 # @param theWeight Weight og the shape.
2324 # @param theWaterDensity Density of the water.
2325 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
2326 # @return New GEOM_Object, containing a section of \a theShape
2327 # by a plane, corresponding to water level.
2329 # @ref tui_archimede "Example"
2330 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
2331 # Example: see GEOM_TestAll.py
2332 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
2333 RaiseIfFailed("MakeArchimede", self.LocalOp)
2336 # end of l3_basic_op
2339 ## @addtogroup l2_measure
2342 ## Get point coordinates
2345 # @ref tui_measurement_tools_page "Example"
2346 def PointCoordinates(self,Point):
2347 # Example: see GEOM_TestMeasures.py
2348 aTuple = self.MeasuOp.PointCoordinates(Point)
2349 RaiseIfFailed("PointCoordinates", self.MeasuOp)
2352 ## Get summarized length of all wires,
2353 # area of surface and volume of the given shape.
2354 # @param theShape Shape to define properties of.
2355 # @return [theLength, theSurfArea, theVolume]
2356 # theLength: Summarized length of all wires of the given shape.
2357 # theSurfArea: Area of surface of the given shape.
2358 # theVolume: Volume of the given shape.
2360 # @ref tui_measurement_tools_page "Example"
2361 def BasicProperties(self,theShape):
2362 # Example: see GEOM_TestMeasures.py
2363 aTuple = self.MeasuOp.GetBasicProperties(theShape)
2364 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
2367 ## Get parameters of bounding box of the given shape
2368 # @param theShape Shape to obtain bounding box of.
2369 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
2370 # Xmin,Xmax: Limits of shape along OX axis.
2371 # Ymin,Ymax: Limits of shape along OY axis.
2372 # Zmin,Zmax: Limits of shape along OZ axis.
2374 # @ref tui_measurement_tools_page "Example"
2375 def BoundingBox(self,theShape):
2376 # Example: see GEOM_TestMeasures.py
2377 aTuple = self.MeasuOp.GetBoundingBox(theShape)
2378 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
2381 ## Get inertia matrix and moments of inertia of theShape.
2382 # @param theShape Shape to calculate inertia of.
2383 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
2384 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
2385 # Ix,Iy,Iz: Moments of inertia of the given shape.
2387 # @ref tui_measurement_tools_page "Example"
2388 def Inertia(self,theShape):
2389 # Example: see GEOM_TestMeasures.py
2390 aTuple = self.MeasuOp.GetInertia(theShape)
2391 RaiseIfFailed("GetInertia", self.MeasuOp)
2394 ## Get minimal distance between the given shapes.
2395 # @param theShape1,theShape2 Shapes to find minimal distance between.
2396 # @return Value of the minimal distance between the given shapes.
2398 # @ref tui_measurement_tools_page "Example"
2399 def MinDistance(self, theShape1, theShape2):
2400 # Example: see GEOM_TestMeasures.py
2401 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2402 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2405 ## Get minimal distance between the given shapes.
2406 # @param theShape1,theShape2 Shapes to find minimal distance between.
2407 # @return Value of the minimal distance between the given shapes.
2409 # @ref swig_all_measure "Example"
2410 def MinDistanceComponents(self, theShape1, theShape2):
2411 # Example: see GEOM_TestMeasures.py
2412 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2413 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2414 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
2417 ## Get angle between the given shapes in degrees.
2418 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2419 # @return Value of the angle between the given shapes in degrees.
2421 # @ref tui_measurement_tools_page "Example"
2422 def GetAngle(self, theShape1, theShape2):
2423 # Example: see GEOM_TestMeasures.py
2424 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
2425 RaiseIfFailed("GetAngle", self.MeasuOp)
2427 ## Get angle between the given shapes in radians.
2428 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2429 # @return Value of the angle between the given shapes in radians.
2431 # @ref tui_measurement_tools_page "Example"
2432 def GetAngleRadians(self, theShape1, theShape2):
2433 # Example: see GEOM_TestMeasures.py
2434 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
2435 RaiseIfFailed("GetAngle", self.MeasuOp)
2438 ## @name Curve Curvature Measurement
2439 # Methods for receiving radius of curvature of curves
2440 # in the given point
2443 ## Measure curvature of a curve at a point, set by parameter.
2444 # @ref swig_todo "Example"
2445 def CurveCurvatureByParam(self, theCurve, theParam):
2446 # Example: see GEOM_TestMeasures.py
2447 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
2448 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
2452 # @ref swig_todo "Example"
2453 def CurveCurvatureByPoint(self, theCurve, thePoint):
2454 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
2455 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
2459 ## @name Surface Curvature Measurement
2460 # Methods for receiving max and min radius of curvature of surfaces
2461 # in the given point
2465 ## @ref swig_todo "Example"
2466 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2467 # Example: see GEOM_TestMeasures.py
2468 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2469 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
2473 ## @ref swig_todo "Example"
2474 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
2475 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
2476 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
2480 ## @ref swig_todo "Example"
2481 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2482 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2483 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
2487 ## @ref swig_todo "Example"
2488 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
2489 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
2490 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
2494 ## Get min and max tolerances of sub-shapes of theShape
2495 # @param theShape Shape, to get tolerances of.
2496 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
2497 # FaceMin,FaceMax: Min and max tolerances of the faces.
2498 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
2499 # VertMin,VertMax: Min and max tolerances of the vertices.
2501 # @ref tui_measurement_tools_page "Example"
2502 def Tolerance(self,theShape):
2503 # Example: see GEOM_TestMeasures.py
2504 aTuple = self.MeasuOp.GetTolerance(theShape)
2505 RaiseIfFailed("GetTolerance", self.MeasuOp)
2508 ## Obtain description of the given shape (number of sub-shapes of each type)
2509 # @param theShape Shape to be described.
2510 # @return Description of the given shape.
2512 # @ref tui_measurement_tools_page "Example"
2513 def WhatIs(self,theShape):
2514 # Example: see GEOM_TestMeasures.py
2515 aDescr = self.MeasuOp.WhatIs(theShape)
2516 RaiseIfFailed("WhatIs", self.MeasuOp)
2519 ## Get a point, situated at the centre of mass of theShape.
2520 # @param theShape Shape to define centre of mass of.
2521 # @return New GEOM_Object, containing the created point.
2523 # @ref tui_measurement_tools_page "Example"
2524 def MakeCDG(self,theShape):
2525 # Example: see GEOM_TestMeasures.py
2526 anObj = self.MeasuOp.GetCentreOfMass(theShape)
2527 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
2530 ## Get a normale to the given face. If the point is not given,
2531 # the normale is calculated at the center of mass.
2532 # @param theFace Face to define normale of.
2533 # @param theOptionalPoint Point to compute the normale at.
2534 # @return New GEOM_Object, containing the created vector.
2536 # @ref swig_todo "Example"
2537 def GetNormal(self, theFace, theOptionalPoint = None):
2538 # Example: see GEOM_TestMeasures.py
2539 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
2540 RaiseIfFailed("GetNormal", self.MeasuOp)
2543 ## Check a topology of the given shape.
2544 # @param theShape Shape to check validity of.
2545 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
2546 # if TRUE, the shape's geometry will be checked also.
2547 # @return TRUE, if the shape "seems to be valid".
2548 # If theShape is invalid, prints a description of problem.
2550 # @ref tui_measurement_tools_page "Example"
2551 def CheckShape(self,theShape, theIsCheckGeom = 0):
2552 # Example: see GEOM_TestMeasures.py
2554 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
2555 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
2557 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
2558 RaiseIfFailed("CheckShape", self.MeasuOp)
2563 ## Get position (LCS) of theShape.
2565 # Origin of the LCS is situated at the shape's center of mass.
2566 # Axes of the LCS are obtained from shape's location or,
2567 # if the shape is a planar face, from position of its plane.
2569 # @param theShape Shape to calculate position of.
2570 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
2571 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
2572 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
2573 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
2575 # @ref swig_todo "Example"
2576 def GetPosition(self,theShape):
2577 # Example: see GEOM_TestMeasures.py
2578 aTuple = self.MeasuOp.GetPosition(theShape)
2579 RaiseIfFailed("GetPosition", self.MeasuOp)
2582 ## Get kind of theShape.
2584 # @param theShape Shape to get a kind of.
2585 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
2586 # and a list of parameters, describing the shape.
2587 # @note Concrete meaning of each value, returned via \a theIntegers
2588 # or \a theDoubles list depends on the kind of the shape.
2589 # The full list of possible outputs is:
2591 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
2592 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
2594 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
2595 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
2597 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
2598 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
2600 # - geompy.kind.SPHERE xc yc zc R
2601 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
2602 # - geompy.kind.BOX xc yc zc ax ay az
2603 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
2604 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
2605 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
2606 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
2607 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
2609 # - geompy.kind.SPHERE2D xc yc zc R
2610 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
2611 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
2612 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
2613 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
2614 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
2615 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
2616 # - geompy.kind.PLANE xo yo zo dx dy dz
2617 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
2618 # - geompy.kind.FACE nb_edges nb_vertices
2620 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
2621 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
2622 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
2623 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
2624 # - geompy.kind.LINE xo yo zo dx dy dz
2625 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
2626 # - geompy.kind.EDGE nb_vertices
2628 # - geompy.kind.VERTEX x y z
2630 # @ref swig_todo "Example"
2631 def KindOfShape(self,theShape):
2632 # Example: see GEOM_TestMeasures.py
2633 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
2634 RaiseIfFailed("KindOfShape", self.MeasuOp)
2636 aKind = aRoughTuple[0]
2637 anInts = aRoughTuple[1]
2638 aDbls = aRoughTuple[2]
2640 # Now there is no exception from this rule:
2641 aKindTuple = [aKind] + aDbls + anInts
2643 # If they are we will regroup parameters for such kind of shape.
2645 #if aKind == kind.SOME_KIND:
2646 # # SOME_KIND int int double int double double
2647 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
2654 ## @addtogroup l2_import_export
2657 ## Import a shape from the BREP or IGES or STEP file
2658 # (depends on given format) with given name.
2659 # @param theFileName The file, containing the shape.
2660 # @param theFormatName Specify format for the file reading.
2661 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2662 # @return New GEOM_Object, containing the imported shape.
2664 # @ref swig_Import_Export "Example"
2665 def Import(self,theFileName, theFormatName):
2666 # Example: see GEOM_TestOthers.py
2667 anObj = self.InsertOp.Import(theFileName, theFormatName)
2668 RaiseIfFailed("Import", self.InsertOp)
2671 ## Shortcut to Import() for BREP format
2673 # @ref swig_Import_Export "Example"
2674 def ImportBREP(self,theFileName):
2675 # Example: see GEOM_TestOthers.py
2676 return self.Import(theFileName, "BREP")
2678 ## Shortcut to Import() for IGES format
2680 # @ref swig_Import_Export "Example"
2681 def ImportIGES(self,theFileName):
2682 # Example: see GEOM_TestOthers.py
2683 return self.Import(theFileName, "IGES")
2685 ## Shortcut to Import() for STEP format
2687 # @ref swig_Import_Export "Example"
2688 def ImportSTEP(self,theFileName):
2689 # Example: see GEOM_TestOthers.py
2690 return self.Import(theFileName, "STEP")
2692 ## Export the given shape into a file with given name.
2693 # @param theObject Shape to be stored in the file.
2694 # @param theFileName Name of the file to store the given shape in.
2695 # @param theFormatName Specify format for the shape storage.
2696 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2698 # @ref swig_Import_Export "Example"
2699 def Export(self,theObject, theFileName, theFormatName):
2700 # Example: see GEOM_TestOthers.py
2701 self.InsertOp.Export(theObject, theFileName, theFormatName)
2702 if self.InsertOp.IsDone() == 0:
2703 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
2707 ## Shortcut to Export() for BREP format
2709 # @ref swig_Import_Export "Example"
2710 def ExportBREP(self,theObject, theFileName):
2711 # Example: see GEOM_TestOthers.py
2712 return self.Export(theObject, theFileName, "BREP")
2714 ## Shortcut to Export() for IGES format
2716 # @ref swig_Import_Export "Example"
2717 def ExportIGES(self,theObject, theFileName):
2718 # Example: see GEOM_TestOthers.py
2719 return self.Export(theObject, theFileName, "IGES")
2721 ## Shortcut to Export() for STEP format
2723 # @ref swig_Import_Export "Example"
2724 def ExportSTEP(self,theObject, theFileName):
2725 # Example: see GEOM_TestOthers.py
2726 return self.Export(theObject, theFileName, "STEP")
2728 # end of l2_import_export
2731 ## @addtogroup l3_blocks
2734 ## Create a quadrangle face from four edges. Order of Edges is not
2735 # important. It is not necessary that edges share the same vertex.
2736 # @param E1,E2,E3,E4 Edges for the face bound.
2737 # @return New GEOM_Object, containing the created face.
2739 # @ref tui_building_by_blocks_page "Example"
2740 def MakeQuad(self,E1, E2, E3, E4):
2741 # Example: see GEOM_Spanner.py
2742 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
2743 RaiseIfFailed("MakeQuad", self.BlocksOp)
2746 ## Create a quadrangle face on two edges.
2747 # The missing edges will be built by creating the shortest ones.
2748 # @param E1,E2 Two opposite edges for the face.
2749 # @return New GEOM_Object, containing the created face.
2751 # @ref tui_building_by_blocks_page "Example"
2752 def MakeQuad2Edges(self,E1, E2):
2753 # Example: see GEOM_Spanner.py
2754 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
2755 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
2758 ## Create a quadrangle face with specified corners.
2759 # The missing edges will be built by creating the shortest ones.
2760 # @param V1,V2,V3,V4 Corner vertices for the face.
2761 # @return New GEOM_Object, containing the created face.
2763 # @ref tui_building_by_blocks_page "Example 1"
2764 # \n @ref swig_MakeQuad4Vertices "Example 2"
2765 def MakeQuad4Vertices(self,V1, V2, V3, V4):
2766 # Example: see GEOM_Spanner.py
2767 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
2768 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
2771 ## Create a hexahedral solid, bounded by the six given faces. Order of
2772 # faces is not important. It is not necessary that Faces share the same edge.
2773 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
2774 # @return New GEOM_Object, containing the created solid.
2776 # @ref tui_building_by_blocks_page "Example 1"
2777 # \n @ref swig_MakeHexa "Example 2"
2778 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
2779 # Example: see GEOM_Spanner.py
2780 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
2781 RaiseIfFailed("MakeHexa", self.BlocksOp)
2784 ## Create a hexahedral solid between two given faces.
2785 # The missing faces will be built by creating the smallest ones.
2786 # @param F1,F2 Two opposite faces for the hexahedral solid.
2787 # @return New GEOM_Object, containing the created solid.
2789 # @ref tui_building_by_blocks_page "Example 1"
2790 # \n @ref swig_MakeHexa2Faces "Example 2"
2791 def MakeHexa2Faces(self,F1, F2):
2792 # Example: see GEOM_Spanner.py
2793 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
2794 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
2800 ## @addtogroup l3_blocks_op
2803 ## Get a vertex, found in the given shape by its coordinates.
2804 # @param theShape Block or a compound of blocks.
2805 # @param theX,theY,theZ Coordinates of the sought vertex.
2806 # @param theEpsilon Maximum allowed distance between the resulting
2807 # vertex and point with the given coordinates.
2808 # @return New GEOM_Object, containing the found vertex.
2810 # @ref swig_GetPoint "Example"
2811 def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
2812 # Example: see GEOM_TestOthers.py
2813 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
2814 RaiseIfFailed("GetPoint", self.BlocksOp)
2817 ## Get an edge, found in the given shape by two given vertices.
2818 # @param theShape Block or a compound of blocks.
2819 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
2820 # @return New GEOM_Object, containing the found edge.
2822 # @ref swig_todo "Example"
2823 def GetEdge(self,theShape, thePoint1, thePoint2):
2824 # Example: see GEOM_Spanner.py
2825 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
2826 RaiseIfFailed("GetEdge", self.BlocksOp)
2829 ## Find an edge of the given shape, which has minimal distance to the given point.
2830 # @param theShape Block or a compound of blocks.
2831 # @param thePoint Point, close to the desired edge.
2832 # @return New GEOM_Object, containing the found edge.
2834 # @ref swig_GetEdgeNearPoint "Example"
2835 def GetEdgeNearPoint(self,theShape, thePoint):
2836 # Example: see GEOM_TestOthers.py
2837 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
2838 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
2841 ## Returns a face, found in the given shape by four given corner vertices.
2842 # @param theShape Block or a compound of blocks.
2843 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
2844 # @return New GEOM_Object, containing the found face.
2846 # @ref swig_todo "Example"
2847 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
2848 # Example: see GEOM_Spanner.py
2849 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
2850 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
2853 ## Get a face of block, found in the given shape by two given edges.
2854 # @param theShape Block or a compound of blocks.
2855 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
2856 # @return New GEOM_Object, containing the found face.
2858 # @ref swig_todo "Example"
2859 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
2860 # Example: see GEOM_Spanner.py
2861 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
2862 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
2865 ## Find a face, opposite to the given one in the given block.
2866 # @param theBlock Must be a hexahedral solid.
2867 # @param theFace Face of \a theBlock, opposite to the desired face.
2868 # @return New GEOM_Object, containing the found face.
2870 # @ref swig_GetOppositeFace "Example"
2871 def GetOppositeFace(self,theBlock, theFace):
2872 # Example: see GEOM_Spanner.py
2873 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
2874 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
2877 ## Find a face of the given shape, which has minimal distance to the given point.
2878 # @param theShape Block or a compound of blocks.
2879 # @param thePoint Point, close to the desired face.
2880 # @return New GEOM_Object, containing the found face.
2882 # @ref swig_GetFaceNearPoint "Example"
2883 def GetFaceNearPoint(self,theShape, thePoint):
2884 # Example: see GEOM_Spanner.py
2885 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
2886 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
2889 ## Find a face of block, whose outside normale has minimal angle with the given vector.
2890 # @param theBlock Block or a compound of blocks.
2891 # @param theVector Vector, close to the normale of the desired face.
2892 # @return New GEOM_Object, containing the found face.
2894 # @ref swig_todo "Example"
2895 def GetFaceByNormale(self, theBlock, theVector):
2896 # Example: see GEOM_Spanner.py
2897 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
2898 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
2901 # end of l3_blocks_op
2904 ## @addtogroup l4_blocks_measure
2907 ## Check, if the compound of blocks is given.
2908 # To be considered as a compound of blocks, the
2909 # given shape must satisfy the following conditions:
2910 # - Each element of the compound should be a Block (6 faces and 12 edges).
2911 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
2912 # - The compound should be connexe.
2913 # - The glue between two quadrangle faces should be applied.
2914 # @param theCompound The compound to check.
2915 # @return TRUE, if the given shape is a compound of blocks.
2916 # If theCompound is not valid, prints all discovered errors.
2918 # @ref tui_measurement_tools_page "Example 1"
2919 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
2920 def CheckCompoundOfBlocks(self,theCompound):
2921 # Example: see GEOM_Spanner.py
2922 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
2923 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
2925 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
2929 ## Remove all seam and degenerated edges from \a theShape.
2930 # Unite faces and edges, sharing one surface. It means that
2931 # this faces must have references to one C++ surface object (handle).
2932 # @param theShape The compound or single solid to remove irregular edges from.
2933 # @return Improved shape.
2935 # @ref swig_RemoveExtraEdges "Example"
2936 def RemoveExtraEdges(self,theShape):
2937 # Example: see GEOM_TestOthers.py
2938 anObj = self.BlocksOp.RemoveExtraEdges(theShape)
2939 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
2942 ## Check, if the given shape is a blocks compound.
2943 # Fix all detected errors.
2944 # \note Single block can be also fixed by this method.
2945 # @param theShape The compound to check and improve.
2946 # @return Improved compound.
2948 # @ref swig_CheckAndImprove "Example"
2949 def CheckAndImprove(self,theShape):
2950 # Example: see GEOM_TestOthers.py
2951 anObj = self.BlocksOp.CheckAndImprove(theShape)
2952 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
2955 # end of l4_blocks_measure
2958 ## @addtogroup l3_blocks_op
2961 ## Get all the blocks, contained in the given compound.
2962 # @param theCompound The compound to explode.
2963 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
2964 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
2965 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
2966 # @return List of GEOM_Objects, containing the retrieved blocks.
2968 # @ref tui_explode_on_blocks "Example 1"
2969 # \n @ref swig_MakeBlockExplode "Example 2"
2970 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
2971 # Example: see GEOM_TestOthers.py
2972 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
2973 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
2976 ## Find block, containing the given point inside its volume or on boundary.
2977 # @param theCompound Compound, to find block in.
2978 # @param thePoint Point, close to the desired block. If the point lays on
2979 # boundary between some blocks, we return block with nearest center.
2980 # @return New GEOM_Object, containing the found block.
2982 # @ref swig_todo "Example"
2983 def GetBlockNearPoint(self,theCompound, thePoint):
2984 # Example: see GEOM_Spanner.py
2985 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
2986 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
2989 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
2990 # @param theCompound Compound, to find block in.
2991 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
2992 # @return New GEOM_Object, containing the found block.
2994 # @ref swig_GetBlockByParts "Example"
2995 def GetBlockByParts(self,theCompound, theParts):
2996 # Example: see GEOM_TestOthers.py
2997 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
2998 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
3001 ## Return all blocks, containing all the elements, passed as the parts.
3002 # @param theCompound Compound, to find blocks in.
3003 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
3004 # @return List of GEOM_Objects, containing the found blocks.
3006 # @ref swig_todo "Example"
3007 def GetBlocksByParts(self,theCompound, theParts):
3008 # Example: see GEOM_Spanner.py
3009 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
3010 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
3013 ## Multi-transformate block and glue the result.
3014 # Transformation is defined so, as to superpose direction faces.
3015 # @param Block Hexahedral solid to be multi-transformed.
3016 # @param DirFace1 ID of First direction face.
3017 # @param DirFace2 ID of Second direction face.
3018 # @param NbTimes Quantity of transformations to be done.
3019 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
3020 # @return New GEOM_Object, containing the result shape.
3022 # @ref tui_multi_transformation "Example"
3023 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
3024 # Example: see GEOM_Spanner.py
3025 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
3026 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
3029 ## Multi-transformate block and glue the result.
3030 # @param Block Hexahedral solid to be multi-transformed.
3031 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
3032 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
3033 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
3034 # @return New GEOM_Object, containing the result shape.
3036 # @ref tui_multi_transformation "Example"
3037 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
3038 DirFace1V, DirFace2V, NbTimesV):
3039 # Example: see GEOM_Spanner.py
3040 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
3041 DirFace1V, DirFace2V, NbTimesV)
3042 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
3045 ## Build all possible propagation groups.
3046 # Propagation group is a set of all edges, opposite to one (main)
3047 # edge of this group directly or through other opposite edges.
3048 # Notion of Opposite Edge make sence only on quadrangle face.
3049 # @param theShape Shape to build propagation groups on.
3050 # @return List of GEOM_Objects, each of them is a propagation group.
3052 # @ref swig_Propagate "Example"
3053 def Propagate(self,theShape):
3054 # Example: see GEOM_TestOthers.py
3055 listChains = self.BlocksOp.Propagate(theShape)
3056 RaiseIfFailed("Propagate", self.BlocksOp)
3059 # end of l3_blocks_op
3062 ## @addtogroup l3_groups
3065 ## Creates a new group which will store sub shapes of theMainShape
3066 # @param theMainShape is a GEOM object on which the group is selected
3067 # @param theShapeType defines a shape type of the group
3068 # @return a newly created GEOM group
3070 # @ref tui_working_with_groups_page "Example 1"
3071 # \n @ref swig_CreateGroup "Example 2"
3072 def CreateGroup(self,theMainShape, theShapeType):
3073 # Example: see GEOM_TestOthers.py
3074 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
3075 RaiseIfFailed("CreateGroup", self.GroupOp)
3078 ## Adds a sub object with ID theSubShapeId to the group
3079 # @param theGroup is a GEOM group to which the new sub shape is added
3080 # @param theSubShapeID is a sub shape ID in the main object.
3081 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3083 # @ref tui_working_with_groups_page "Example"
3084 def AddObject(self,theGroup, theSubShapeID):
3085 # Example: see GEOM_TestOthers.py
3086 self.GroupOp.AddObject(theGroup, theSubShapeID)
3087 RaiseIfFailed("AddObject", self.GroupOp)
3090 ## Removes a sub object with ID \a theSubShapeId from the group
3091 # @param theGroup is a GEOM group from which the new sub shape is removed
3092 # @param theSubShapeID is a sub shape ID in the main object.
3093 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3095 # @ref tui_working_with_groups_page "Example"
3096 def RemoveObject(self,theGroup, theSubShapeID):
3097 # Example: see GEOM_TestOthers.py
3098 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
3099 RaiseIfFailed("RemoveObject", self.GroupOp)
3102 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
3103 # @param theGroup is a GEOM group to which the new sub shapes are added.
3104 # @param theSubShapes is a list of sub shapes to be added.
3106 # @ref tui_working_with_groups_page "Example"
3107 def UnionList (self,theGroup, theSubShapes):
3108 # Example: see GEOM_TestOthers.py
3109 self.GroupOp.UnionList(theGroup, theSubShapes)
3110 RaiseIfFailed("UnionList", self.GroupOp)
3113 ## Works like the above method, but argument
3114 # theSubShapes here is a list of sub-shapes indices
3116 # @ref swig_UnionIDs "Example"
3117 def UnionIDs(self,theGroup, theSubShapes):
3118 # Example: see GEOM_TestOthers.py
3119 self.GroupOp.UnionIDs(theGroup, theSubShapes)
3120 RaiseIfFailed("UnionIDs", self.GroupOp)
3123 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
3124 # @param theGroup is a GEOM group from which the sub-shapes are removed.
3125 # @param theSubShapes is a list of sub-shapes to be removed.
3127 # @ref tui_working_with_groups_page "Example"
3128 def DifferenceList (self,theGroup, theSubShapes):
3129 # Example: see GEOM_TestOthers.py
3130 self.GroupOp.DifferenceList(theGroup, theSubShapes)
3131 RaiseIfFailed("DifferenceList", self.GroupOp)
3134 ## Works like the above method, but argument
3135 # theSubShapes here is a list of sub-shapes indices
3137 # @ref swig_DifferenceIDs "Example"
3138 def DifferenceIDs(self,theGroup, theSubShapes):
3139 # Example: see GEOM_TestOthers.py
3140 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
3141 RaiseIfFailed("DifferenceIDs", self.GroupOp)
3144 ## Returns a list of sub objects ID stored in the group
3145 # @param theGroup is a GEOM group for which a list of IDs is requested
3147 # @ref swig_GetObjectIDs "Example"
3148 def GetObjectIDs(self,theGroup):
3149 # Example: see GEOM_TestOthers.py
3150 ListIDs = self.GroupOp.GetObjects(theGroup)
3151 RaiseIfFailed("GetObjects", self.GroupOp)
3154 ## Returns a type of sub objects stored in the group
3155 # @param theGroup is a GEOM group which type is returned.
3157 # @ref swig_GetType "Example"
3158 def GetType(self,theGroup):
3159 # Example: see GEOM_TestOthers.py
3160 aType = self.GroupOp.GetType(theGroup)
3161 RaiseIfFailed("GetType", self.GroupOp)
3164 ## Returns a main shape associated with the group
3165 # @param theGroup is a GEOM group for which a main shape object is requested
3166 # @return a GEOM object which is a main shape for theGroup
3168 # @ref swig_GetMainShape "Example"
3169 def GetMainShape(self,theGroup):
3170 # Example: see GEOM_TestOthers.py
3171 anObj = self.GroupOp.GetMainShape(theGroup)
3172 RaiseIfFailed("GetMainShape", self.GroupOp)
3175 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
3176 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3178 # @ref swig_todo "Example"
3179 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
3180 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
3183 Props = self.BasicProperties(edge)
3184 if min_length <= Props[0] and Props[0] <= max_length:
3185 if (not include_min) and (min_length == Props[0]):
3188 if (not include_max) and (Props[0] == max_length):
3191 edges_in_range.append(edge)
3193 if len(edges_in_range) <= 0:
3194 print "No edges found by given criteria"
3197 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
3198 self.UnionList(group_edges, edges_in_range)
3202 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
3203 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3205 # @ref swig_todo "Example"
3206 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
3207 nb_selected = sg.SelectedCount()
3209 print "Select a shape before calling this function, please."
3212 print "Only one shape must be selected"
3215 id_shape = sg.getSelected(0)
3216 shape = IDToObject( id_shape )
3218 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
3222 if include_min: left_str = " <= "
3223 if include_max: right_str = " <= "
3225 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
3226 + left_str + "length" + right_str + `max_length`)
3228 sg.updateObjBrowser(1)
3235 ## Create a copy of the given object
3236 # @ingroup l1_geompy_auxiliary
3238 # @ref swig_all_advanced "Example"
3239 def MakeCopy(self,theOriginal):
3240 # Example: see GEOM_TestAll.py
3241 anObj = self.InsertOp.MakeCopy(theOriginal)
3242 RaiseIfFailed("MakeCopy", self.InsertOp)
3245 ## Add Path to load python scripts from
3246 # @ingroup l1_geompy_auxiliary
3247 def addPath(self,Path):
3248 if (sys.path.count(Path) < 1):
3249 sys.path.append(Path)
3252 #Register the new proxy for GEOM_Gen
3253 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)