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
85 ## Enumeration ShapeType as a dictionary
86 # @ingroup l1_geompy_auxiliary
87 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
89 ## Raise an Error, containing the Method_name, if Operation is Failed
90 ## @ingroup l1_geompy_auxiliary
91 def RaiseIfFailed (Method_name, Operation):
92 if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
93 raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
95 ## Kinds of shape enumeration
96 # @ingroup l1_geompy_auxiliary
97 kind = GEOM.GEOM_IKindOfShape
99 ## Information about closed/unclosed state of shell or wire
100 # @ingroup l1_geompy_auxiliary
107 class geompyDC(GEOM._objref_GEOM_Gen):
109 ## @addtogroup l1_geompy_auxiliary
112 GEOM._objref_GEOM_Gen.__init__(self)
113 self.myBuilder = None
131 def init_geom(self,theStudy):
132 self.myStudy = theStudy
133 self.myStudyId = self.myStudy._get_StudyId()
134 self.myBuilder = self.myStudy.NewBuilder()
135 self.father = self.myStudy.FindComponent("GEOM")
136 if self.father is None:
137 self.father = self.myBuilder.NewComponent("GEOM")
138 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
139 FName = A1._narrow(SALOMEDS.AttributeName)
140 FName.SetValue("Geometry")
141 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
142 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
143 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
144 self.myBuilder.DefineComponentInstance(self.father,self)
146 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
147 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
148 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
149 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
150 self.HealOp = self.GetIHealingOperations (self.myStudyId)
151 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
152 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
153 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
154 self.LocalOp = self.GetILocalOperations (self.myStudyId)
155 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
156 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
157 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
160 ## Get name for sub-shape aSubObj of shape aMainObj
162 # @ref tui_todo "Example"
163 def SubShapeName(self,aSubObj, aMainObj):
164 # Example: see GEOM_TestAll.py
166 #aSubId = orb.object_to_string(aSubObj)
167 #aMainId = orb.object_to_string(aMainObj)
168 #index = gg.getIndexTopology(aSubId, aMainId)
169 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
170 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
171 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
174 ## Publish in study aShape with name aName
176 # \param aShape the shape to be published
177 # \param aName the name for the shape
178 # \param doRestoreSubShapes if True, finds and publishes also
179 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
180 # and published sub-shapes of arguments
181 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
182 # these arguments description
183 # \return study entry of the published shape in form of string
185 # @ref tui_todo "Example"
186 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
187 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
188 # Example: see GEOM_TestAll.py
190 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
191 if doRestoreSubShapes:
192 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
193 theFindMethod, theInheritFirstArg)
195 print "addToStudy() failed"
197 return aShape.GetStudyEntry()
199 ## Publish in study aShape with name aName as sub-object of previously published aFather
201 # @ref tui_todo "Example"
202 def addToStudyInFather(self, aFather, aShape, aName):
203 # Example: see GEOM_TestAll.py
205 aSObject = self.AddInStudy(myStudy, aShape, aName, aFather)
207 print "addToStudyInFather() failed"
209 return aShape.GetStudyEntry()
211 # end of l1_geompy_auxiliary
214 ## @addtogroup l3_restore_ss
217 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
218 # To be used from python scripts out of geompy.addToStudy (non-default usage)
219 # \param theStudy the study, in which theObject is published already,
220 # and in which the arguments will be published
221 # \param theObject published GEOM object, arguments of which will be published
222 # \param theArgs list of GEOM_Object, operation arguments to be published.
223 # If this list is empty, all operation arguments will be published
224 # \param theFindMethod method to search subshapes, corresponding to arguments and
225 # their subshapes. Value from enumeration GEOM::find_shape_method.
226 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
227 # Do not publish subshapes in place of arguments, but only
228 # in place of subshapes of the first argument,
229 # because the whole shape corresponds to the first argument.
230 # Mainly to be used after transformations, but it also can be
231 # usefull after partition with one object shape, and some other
232 # operations, where only the first argument has to be considered.
233 # If theObject has only one argument shape, this flag is automatically
234 # considered as True, not regarding really passed value.
235 # \return True in case of success, False otherwise.
237 # @ref tui_restore_prs_params "Example"
238 def RestoreSubShapes (self, theObject, theArgs=[],
239 theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
240 # Example: see GEOM_TestAll.py
241 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
242 theFindMethod, theInheritFirstArg)
244 # end of l3_restore_ss
247 ## @addtogroup l3_basic_go
250 ## Create point by three coordinates.
251 # @param theX The X coordinate of the point.
252 # @param theY The Y coordinate of the point.
253 # @param theZ The Z coordinate of the point.
254 # @return New GEOM_Object, containing the created point.
256 # @ref tui_creation_point "Example"
257 def MakeVertex(self,theX, theY, theZ):
258 # Example: see GEOM_TestAll.py
259 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
260 RaiseIfFailed("MakePointXYZ", self.BasicOp)
263 ## Create a point, distant from the referenced point
264 # on the given distances along the coordinate axes.
265 # @param theReference The referenced point.
266 # @param theX Displacement from the referenced point along OX axis.
267 # @param theY Displacement from the referenced point along OY axis.
268 # @param theZ Displacement from the referenced point along OZ axis.
269 # @return New GEOM_Object, containing the created point.
271 # @ref tui_creation_point "Example"
272 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
273 # Example: see GEOM_TestAll.py
274 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
275 RaiseIfFailed("MakePointWithReference", self.BasicOp)
278 ## Create a point, corresponding to the given parameter on the given curve.
279 # @param theRefCurve The referenced curve.
280 # @param theParameter Value of parameter on the referenced curve.
281 # @return New GEOM_Object, containing the created point.
283 # @ref tui_creation_point "Example"
284 def MakeVertexOnCurve(self,theRefCurve, theParameter):
285 # Example: see GEOM_TestAll.py
286 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
287 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
290 ## Create a point, corresponding to the given parameters on the
292 # @param theRefSurf The referenced surface.
293 # @param theUParameter Value of U-parameter on the referenced surface.
294 # @param theVParameter Value of V-parameter on the referenced surface.
295 # @return New GEOM_Object, containing the created point.
297 # @ref tui_todo "Example"
298 def MakeVertexOnSurface(self,theRefSurf, theUParameter, theVParameter):
299 # Example: see GEOM_TestAll.py
300 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
301 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
304 ## Create a point on intersection of two lines.
305 # @param theRefLine1, theRefLine2 The referenced lines.
306 # @return New GEOM_Object, containing the created point.
308 # @ref tui_todo "Example"
309 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
310 # Example: see GEOM_TestAll.py
311 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
312 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
315 ## Create a tangent, corresponding to the given parameter on the given curve.
316 # @param theRefCurve The referenced curve.
317 # @param theParameter Value of parameter on the referenced curve.
318 # @return New GEOM_Object, containing the created tangent.
320 # @ref tui_todo "Example"
321 def MakeTangentOnCurve(self,theRefCurve, theParameter):
322 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
323 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
326 ## Create a vector with the given components.
327 # @param theDX X component of the vector.
328 # @param theDY Y component of the vector.
329 # @param theDZ Z component of the vector.
330 # @return New GEOM_Object, containing the created vector.
332 # @ref tui_creation_vector "Example"
333 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
334 # Example: see GEOM_TestAll.py
335 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
336 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
339 ## Create a vector between two points.
340 # @param thePnt1 Start point for the vector.
341 # @param thePnt2 End point for the vector.
342 # @return New GEOM_Object, containing the created vector.
344 # @ref tui_creation_vector "Example"
345 def MakeVector(self,thePnt1, thePnt2):
346 # Example: see GEOM_TestAll.py
347 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
348 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
351 ## Create a line, passing through the given point
352 # and parrallel to the given direction
353 # @param thePnt Point. The resulting line will pass through it.
354 # @param theDir Direction. The resulting line will be parallel to it.
355 # @return New GEOM_Object, containing the created line.
357 # @ref tui_creation_line "Example"
358 def MakeLine(self,thePnt, theDir):
359 # Example: see GEOM_TestAll.py
360 anObj = self.BasicOp.MakeLine(thePnt, theDir)
361 RaiseIfFailed("MakeLine", self.BasicOp)
364 ## Create a line, passing through the given points
365 # @param thePnt1 First of two points, defining the line.
366 # @param thePnt2 Second of two points, defining the line.
367 # @return New GEOM_Object, containing the created line.
369 # @ref tui_creation_line "Example"
370 def MakeLineTwoPnt(self,thePnt1, thePnt2):
371 # Example: see GEOM_TestAll.py
372 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
373 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
376 ## Create a line on two faces intersection.
377 # @param theFace1 First of two faces, defining the line.
378 # @param theFace2 Second of two faces, defining the line.
379 # @return New GEOM_Object, containing the created line.
381 # @ref tui_todo "Example"
382 def MakeLineTwoFaces(self, theFace1, theFace2):
383 # Example: see GEOM_TestAll.py
384 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
385 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
388 ## Create a plane, passing through the given point
389 # and normal to the given vector.
390 # @param thePnt Point, the plane has to pass through.
391 # @param theVec Vector, defining the plane normal direction.
392 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
393 # @return New GEOM_Object, containing the created plane.
395 # @ref tui_creation_plane "Example"
396 def MakePlane(self,thePnt, theVec, theTrimSize):
397 # Example: see GEOM_TestAll.py
398 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
399 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
402 ## Create a plane, passing through the three given points
403 # @param thePnt1 First of three points, defining the plane.
404 # @param thePnt2 Second of three points, defining the plane.
405 # @param thePnt3 Fird of three points, defining the plane.
406 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
407 # @return New GEOM_Object, containing the created plane.
409 # @ref tui_creation_plane "Example"
410 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
411 # Example: see GEOM_TestAll.py
412 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
413 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
416 ## Create a plane, similar to the existing one, but with another size of representing face.
417 # @param theFace Referenced plane or LCS(Marker).
418 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
419 # @return New GEOM_Object, containing the created plane.
421 # @ref tui_creation_plane "Example"
422 def MakePlaneFace(self,theFace, theTrimSize):
423 # Example: see GEOM_TestAll.py
424 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
425 RaiseIfFailed("MakePlaneFace", self.BasicOp)
428 ## Create a local coordinate system.
429 # @param OX,OY,OZ Three coordinates of coordinate system origin.
430 # @param XDX,XDY,XDZ Three components of OX direction
431 # @param YDX,YDY,YDZ Three components of OY direction
432 # @return New GEOM_Object, containing the created coordinate system.
434 # @ref tui_todo "Example"
435 def MakeMarker(self,OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
436 # Example: see GEOM_TestAll.py
437 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
438 RaiseIfFailed("MakeMarker", self.BasicOp)
441 ## Create a local coordinate system.
442 # @param theOrigin Point of coordinate system origin.
443 # @param theXVec Vector of X direction
444 # @param theYVec Vector of Y direction
445 # @return New GEOM_Object, containing the created coordinate system.
446 def MakeMarkerPntTwoVec(self,theOrigin, theXVec, theYVec):
447 O = self.PointCoordinates( theOrigin )
449 for vec in [ theXVec, theYVec ]:
450 v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] )
451 p1 = self.PointCoordinates( v1 )
452 p2 = self.PointCoordinates( v2 )
453 for i in range( 0, 3 ):
454 OXOY.append( p2[i] - p1[i] )
456 anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2],
457 OXOY[0], OXOY[1], OXOY[2],
458 OXOY[3], OXOY[4], OXOY[5], )
459 RaiseIfFailed("MakeMarker", self.BasicOp)
465 ## @addtogroup l4_curves
468 ## Create an arc of circle, passing through three given points.
469 # @param thePnt1 Start point of the arc.
470 # @param thePnt2 Middle point of the arc.
471 # @param thePnt3 End point of the arc.
472 # @return New GEOM_Object, containing the created arc.
474 # @ref tui_todo "Example"
475 def MakeArc(self,thePnt1, thePnt2, thePnt3):
476 # Example: see GEOM_TestAll.py
477 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
478 RaiseIfFailed("MakeArc", self.CurvesOp)
481 ## Create an arc of circle from a center and 2 points.
482 # @param thePnt1 Center of the arc
483 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
484 # @param thePnt3 End point of the arc (Gives also a direction)
485 # @param theSense Orientation of the arc
486 # @return New GEOM_Object, containing the created arc.
488 # @ref tui_todo "Example"
489 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
490 # Example: see GEOM_TestAll.py
491 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
492 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
495 ## Create a circle with given center, normal vector and radius.
496 # @param thePnt Circle center.
497 # @param theVec Vector, normal to the plane of the circle.
498 # @param theR Circle radius.
499 # @return New GEOM_Object, containing the created circle.
501 # @ref tui_creation_circle "Example"
502 def MakeCircle(self,thePnt, theVec, theR):
503 # Example: see GEOM_TestAll.py
504 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
505 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
508 ## Create a circle, passing through three given points
509 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
510 # @return New GEOM_Object, containing the created circle.
512 # @ref tui_creation_circle "Example"
513 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
514 # Example: see GEOM_TestAll.py
515 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
516 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
519 ## Create a circle, with given point1 as center,
520 # passing through the point2 as radius and laying in the plane,
521 # defined by all three given points.
522 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
523 # @return New GEOM_Object, containing the created circle.
525 # @ref tui_todo "Example"
526 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
527 # Example: see GEOM_example6.py
528 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
529 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
532 ## Create an ellipse with given center, normal vector and radiuses.
533 # @param thePnt Ellipse center.
534 # @param theVec Vector, normal to the plane of the ellipse.
535 # @param theRMajor Major ellipse radius.
536 # @param theRMinor Minor ellipse radius.
537 # @return New GEOM_Object, containing the created ellipse.
539 # @ref tui_creation_ellipse "Example"
540 def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor):
541 # Example: see GEOM_TestAll.py
542 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
543 RaiseIfFailed("MakeEllipse", self.CurvesOp)
546 ## Create a polyline on the set of points.
547 # @param thePoints Sequence of points for the polyline.
548 # @return New GEOM_Object, containing the created polyline.
550 # @ref tui_creation_curve "Example"
551 def MakePolyline(self,thePoints):
552 # Example: see GEOM_TestAll.py
553 anObj = self.CurvesOp.MakePolyline(thePoints)
554 RaiseIfFailed("MakePolyline", self.CurvesOp)
557 ## Create bezier curve on the set of points.
558 # @param thePoints Sequence of points for the bezier curve.
559 # @return New GEOM_Object, containing the created bezier curve.
561 # @ref tui_creation_curve "Example"
562 def MakeBezier(self,thePoints):
563 # Example: see GEOM_TestAll.py
564 anObj = self.CurvesOp.MakeSplineBezier(thePoints)
565 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
568 ## Create B-Spline curve on the set of points.
569 # @param thePoints Sequence of points for the B-Spline curve.
570 # @return New GEOM_Object, containing the created B-Spline curve.
572 # @ref tui_creation_curve "Example"
573 def MakeInterpol(self,thePoints):
574 # Example: see GEOM_TestAll.py
575 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints)
576 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
582 ## @addtogroup l3_sketcher
585 ## Create a sketcher (wire or face), following the textual description,
586 # passed through <VAR>theCommand</VAR> argument. \n
587 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
588 # Format of the description string have to be the following:
590 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
593 # - x1, y1 are coordinates of the first sketcher point (zero by default),
595 # - "R angle" : Set the direction by angle
596 # - "D dx dy" : Set the direction by DX & DY
599 # - "TT x y" : Create segment by point at X & Y
600 # - "T dx dy" : Create segment by point with DX & DY
601 # - "L length" : Create segment by direction & Length
602 # - "IX x" : Create segment by direction & Intersect. X
603 # - "IY y" : Create segment by direction & Intersect. Y
606 # - "C radius length" : Create arc by direction, radius and length(in degree)
609 # - "WW" : Close Wire (to finish)
610 # - "WF" : Close Wire and build face (to finish)
612 # @param theCommand String, defining the sketcher in local
613 # coordinates of the working plane.
614 # @param theWorkingPlane Nine double values, defining origin,
615 # OZ and OX directions of the working plane.
616 # @return New GEOM_Object, containing the created wire.
618 # @ref tui_sketcher_page "Example"
619 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
620 # Example: see GEOM_TestAll.py
621 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
622 RaiseIfFailed("MakeSketcher", self.CurvesOp)
625 ## Create a sketcher (wire or face), following the textual description,
626 # passed through <VAR>theCommand</VAR> argument. \n
627 # For format of the description string see the previous method.\n
628 # @param theCommand String, defining the sketcher in local
629 # coordinates of the working plane.
630 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
631 # @return New GEOM_Object, containing the created wire.
633 # @ref tui_sketcher_page "Example"
634 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
635 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
636 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
642 ## @addtogroup l3_3d_primitives
645 ## Create a box by coordinates of two opposite vertices.
647 # @ref tui_creation_box "Example"
648 def MakeBox(self,x1,y1,z1,x2,y2,z2):
649 # Example: see GEOM_TestAll.py
650 pnt1 = self.MakeVertex(x1,y1,z1)
651 pnt2 = self.MakeVertex(x2,y2,z2)
652 return self.MakeBoxTwoPnt(pnt1,pnt2)
654 ## Create a box with specified dimensions along the coordinate axes
655 # and with edges, parallel to the coordinate axes.
656 # Center of the box will be at point (DX/2, DY/2, DZ/2).
657 # @param theDX Length of Box edges, parallel to OX axis.
658 # @param theDY Length of Box edges, parallel to OY axis.
659 # @param theDZ Length of Box edges, parallel to OZ axis.
660 # @return New GEOM_Object, containing the created box.
662 # @ref tui_creation_box "Example"
663 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
664 # Example: see GEOM_TestAll.py
665 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
666 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
669 ## Create a box with two specified opposite vertices,
670 # and with edges, parallel to the coordinate axes
671 # @param thePnt1 First of two opposite vertices.
672 # @param thePnt2 Second of two opposite vertices.
673 # @return New GEOM_Object, containing the created box.
675 # @ref tui_creation_box "Example"
676 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
677 # Example: see GEOM_TestAll.py
678 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
679 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
682 ## Create a cylinder with given base point, axis, radius and height.
683 # @param thePnt Central point of cylinder base.
684 # @param theAxis Cylinder axis.
685 # @param theR Cylinder radius.
686 # @param theH Cylinder height.
687 # @return New GEOM_Object, containing the created cylinder.
689 # @ref tui_creation_cylinder "Example"
690 def MakeCylinder(self,thePnt, theAxis, theR, theH):
691 # Example: see GEOM_TestAll.py
692 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
693 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
696 ## Create a cylinder with given radius and height at
697 # the origin of coordinate system. Axis of the cylinder
698 # will be collinear to the OZ axis of the coordinate system.
699 # @param theR Cylinder radius.
700 # @param theH Cylinder height.
701 # @return New GEOM_Object, containing the created cylinder.
703 # @ref tui_creation_cylinder "Example"
704 def MakeCylinderRH(self,theR, theH):
705 # Example: see GEOM_TestAll.py
706 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
707 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
710 ## Create a sphere with given center and radius.
711 # @param thePnt Sphere center.
712 # @param theR Sphere radius.
713 # @return New GEOM_Object, containing the created sphere.
715 # @ref tui_creation_sphere "Example"
716 def MakeSpherePntR(self, thePnt, theR):
717 # Example: see GEOM_TestAll.py
718 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
719 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
722 ## Create a sphere with given center and radius.
723 # @param x,y,z Coordinates of sphere center.
724 # @param theR Sphere radius.
725 # @return New GEOM_Object, containing the created sphere.
727 # @ref tui_creation_sphere "Example"
728 def MakeSphere(self, x, y, z, theR):
729 # Example: see GEOM_TestAll.py
730 point = self.MakeVertex(x, y, z)
731 anObj = self.MakeSpherePntR(point, theR)
734 ## Create a sphere with given radius at the origin of coordinate system.
735 # @param theR Sphere radius.
736 # @return New GEOM_Object, containing the created sphere.
738 # @ref tui_creation_sphere "Example"
739 def MakeSphereR(self, theR):
740 # Example: see GEOM_TestAll.py
741 anObj = self.PrimOp.MakeSphereR(theR)
742 RaiseIfFailed("MakeSphereR", self.PrimOp)
745 ## Create a cone with given base point, axis, height and radiuses.
746 # @param thePnt Central point of the first cone base.
747 # @param theAxis Cone axis.
748 # @param theR1 Radius of the first cone base.
749 # @param theR2 Radius of the second cone base.
750 # \note If both radiuses are non-zero, the cone will be truncated.
751 # \note If the radiuses are equal, a cylinder will be created instead.
752 # @param theH Cone height.
753 # @return New GEOM_Object, containing the created cone.
755 # @ref tui_creation_cone "Example"
756 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
757 # Example: see GEOM_TestAll.py
758 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
759 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
762 ## Create a cone with given height and radiuses at
763 # the origin of coordinate system. Axis of the cone will
764 # be collinear to the OZ axis of the coordinate system.
765 # @param theR1 Radius of the first cone base.
766 # @param theR2 Radius of the second cone base.
767 # \note If both radiuses are non-zero, the cone will be truncated.
768 # \note If the radiuses are equal, a cylinder will be created instead.
769 # @param theH Cone height.
770 # @return New GEOM_Object, containing the created cone.
772 # @ref tui_creation_cone "Example"
773 def MakeConeR1R2H(self,theR1, theR2, theH):
774 # Example: see GEOM_TestAll.py
775 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
776 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
779 ## Create a torus with given center, normal vector and radiuses.
780 # @param thePnt Torus central point.
781 # @param theVec Torus axis of symmetry.
782 # @param theRMajor Torus major radius.
783 # @param theRMinor Torus minor radius.
784 # @return New GEOM_Object, containing the created torus.
786 # @ref tui_creation_torus "Example"
787 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
788 # Example: see GEOM_TestAll.py
789 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
790 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
793 ## Create a torus with given radiuses at the origin of coordinate system.
794 # @param theRMajor Torus major radius.
795 # @param theRMinor Torus minor radius.
796 # @return New GEOM_Object, containing the created torus.
798 # @ref tui_creation_torus "Example"
799 def MakeTorusRR(self, theRMajor, theRMinor):
800 # Example: see GEOM_TestAll.py
801 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
802 RaiseIfFailed("MakeTorusRR", self.PrimOp)
805 # end of l3_3d_primitives
808 ## @addtogroup l3_complex
811 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
812 # @param theBase Base shape to be extruded.
813 # @param thePoint1 First end of extrusion vector.
814 # @param thePoint2 Second end of extrusion vector.
815 # @return New GEOM_Object, containing the created prism.
817 # @ref tui_creation_prism "Example"
818 def MakePrism(self, theBase, thePoint1, thePoint2):
819 # Example: see GEOM_TestAll.py
820 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
821 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
824 ## Create a shape by extrusion of the base shape along the vector,
825 # i.e. all the space, transfixed by the base shape during its translation
826 # along the vector on the given distance.
827 # @param theBase Base shape to be extruded.
828 # @param theVec Direction of extrusion.
829 # @param theH Prism dimension along theVec.
830 # @return New GEOM_Object, containing the created prism.
832 # @ref tui_creation_prism "Example"
833 def MakePrismVecH(self, theBase, theVec, theH):
834 # Example: see GEOM_TestAll.py
835 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
836 RaiseIfFailed("MakePrismVecH", self.PrimOp)
839 ## Create a shape by extrusion of the base shape along the vector,
840 # i.e. all the space, transfixed by the base shape during its translation
841 # along the vector on the given distance in 2 Ways (forward/backward) .
842 # @param theBase Base shape to be extruded.
843 # @param theVec Direction of extrusion.
844 # @param theH Prism dimension along theVec in forward direction.
845 # @return New GEOM_Object, containing the created prism.
847 # @ref tui_creation_prism "Example"
848 def MakePrismVecH2Ways(self, theBase, theVec, theH):
849 # Example: see GEOM_TestAll.py
850 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
851 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
854 ## Create a shape by revolution of the base shape around the axis
855 # on the given angle, i.e. all the space, transfixed by the base
856 # shape during its rotation around the axis on the given angle.
857 # @param theBase Base shape to be rotated.
858 # @param theAxis Rotation axis.
859 # @param theAngle Rotation angle in radians.
860 # @return New GEOM_Object, containing the created revolution.
862 # @ref tui_creation_revolution "Example"
863 def MakeRevolution(self, theBase, theAxis, theAngle):
864 # Example: see GEOM_TestAll.py
865 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
866 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
869 ## The Same Revolution but in both ways forward&backward.
870 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
871 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
872 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
875 ## Create a filling from the given compound of contours.
876 # @param theShape the compound of contours
877 # @param theMinDeg a minimal degree of BSpline surface to create
878 # @param theMaxDeg a maximal degree of BSpline surface to create
879 # @param theTol2D a 2d tolerance to be reached
880 # @param theTol3D a 3d tolerance to be reached
881 # @param theNbIter a number of iteration of approximation algorithm
882 # @param isApprox if True, BSpline curves are generated in the process
883 # of surface construction. By default it is False, that means
884 # the surface is created using Besier curves. The usage of
885 # Approximation makes the algorithm work slower, but allows
886 # building the surface for rather complex cases
887 # @return New GEOM_Object, containing the created filling surface.
889 # @ref tui_creation_filling "Example"
890 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
891 # Example: see GEOM_TestAll.py
892 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
893 theTol2D, theTol3D, theNbIter, isApprox)
894 RaiseIfFailed("MakeFilling", self.PrimOp)
897 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
898 # @param theSeqSections - set of specified sections.
899 # @param theModeSolid - mode defining building solid or shell
900 # @param thePreci - precision 3D used for smoothing by default 1.e-6
901 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
902 # @return New GEOM_Object, containing the created shell or solid.
904 # @ref tui_todo "Example"
905 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
906 # Example: see GEOM_TestAll.py
907 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
908 RaiseIfFailed("MakeThruSections", self.PrimOp)
911 ## Create a shape by extrusion of the base shape along
912 # the path shape. The path shape can be a wire or an edge.
913 # @param theBase Base shape to be extruded.
914 # @param thePath Path shape to extrude the base shape along it.
915 # @return New GEOM_Object, containing the created pipe.
917 # @ref tui_creation_pipe "Example"
918 def MakePipe(self,theBase, thePath):
919 # Example: see GEOM_TestAll.py
920 anObj = self.PrimOp.MakePipe(theBase, thePath)
921 RaiseIfFailed("MakePipe", self.PrimOp)
924 ## Create a shape by extrusion of the profile shape along
925 # the path shape. The path shape can be a wire or an edge.
926 # the several profiles can be specified in the several locations of path.
927 # @param theSeqBases - list of Bases shape to be extruded.
928 # @param theLocations - list of locations on the path corresponding
929 # specified list of the Bases shapes. Number of locations
930 # should be equal to number of bases or list of locations can be empty.
931 # @param thePath - Path shape to extrude the base shape along it.
932 # @param theWithContact - the mode defining that the section is translated to be in
933 # contact with the spine.
934 # @param theWithCorrection - defining that the section is rotated to be
935 # orthogonal to the spine tangent in the correspondent point
936 # @return New GEOM_Object, containing the created pipe.
938 # @ref tui_todo "Example"
939 def MakePipeWithDifferentSections(self, theSeqBases,
940 theLocations, thePath,
941 theWithContact, theWithCorrection):
942 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
943 theLocations, thePath,
944 theWithContact, theWithCorrection)
945 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
948 ## Create a shape by extrusion of the profile shape along
949 # the path shape. The path shape can be a shell or a face.
950 # the several profiles can be specified in the several locations of path.
951 # @param theSeqBases - list of Bases shape to be extruded.
952 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
953 # @param theLocations - list of locations on the path corresponding
954 # specified list of the Bases shapes. Number of locations
955 # should be equal to number of bases. First and last
956 # locations must be coincided with first and last vertexes
957 # of path correspondingly.
958 # @param thePath - Path shape to extrude the base shape along it.
959 # @param theWithContact - the mode defining that the section is translated to be in
960 # contact with the spine.
961 # @param theWithCorrection - defining that the section is rotated to be
962 # orthogonal to the spine tangent in the correspondent point
963 # @return New GEOM_Object, containing the created solids.
965 # @ref tui_todo "Example"
966 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
967 theLocations, thePath,
968 theWithContact, theWithCorrection):
969 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
970 theLocations, thePath,
971 theWithContact, theWithCorrection)
972 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
975 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
976 theLocations, thePath,
977 theWithContact, theWithCorrection):
979 nbsect = len(theSeqBases)
980 nbsubsect = len(theSeqSubBases)
981 #print "nbsect = ",nbsect
982 for i in range(1,nbsect):
984 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
985 tmpLocations = [ theLocations[i-1], theLocations[i] ]
987 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
988 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
989 tmpLocations, thePath,
990 theWithContact, theWithCorrection)
991 if self.PrimOp.IsDone() == 0:
992 print "Problems with pipe creation between ",i," and ",i+1," sections"
993 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
996 print "Pipe between ",i," and ",i+1," sections is OK"
1001 resc = self.MakeCompound(res)
1002 #resc = self.MakeSewing(res, 0.001)
1003 #print "resc: ",resc
1006 ## Create solids between given sections
1007 # @param theSeqBases - list of sections (shell or face).
1008 # @param theLocations - list of corresponding vertexes
1009 # @return New GEOM_Object, containing the created solids.
1011 # @ref tui_todo "Example"
1012 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1013 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1014 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1020 ## @addtogroup l3_advanced
1023 ## Create a linear edge with specified ends.
1024 # @param thePnt1 Point for the first end of edge.
1025 # @param thePnt2 Point for the second end of edge.
1026 # @return New GEOM_Object, containing the created edge.
1028 # @ref tui_creation_edge "Example"
1029 def MakeEdge(self,thePnt1, thePnt2):
1030 # Example: see GEOM_TestAll.py
1031 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1032 RaiseIfFailed("MakeEdge", self.ShapesOp)
1035 ## Create a wire from the set of edges and wires.
1036 # @param theEdgesAndWires List of edges and/or wires.
1037 # @return New GEOM_Object, containing the created wire.
1039 # @ref tui_creation_wire "Example"
1040 def MakeWire(self,theEdgesAndWires):
1041 # Example: see GEOM_TestAll.py
1042 anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
1043 RaiseIfFailed("MakeWire", self.ShapesOp)
1046 ## Create a face on the given wire.
1047 # @param theWire closed Wire or Edge to build the face on.
1048 # @param isPlanarWanted If TRUE, only planar face will be built.
1049 # If impossible, NULL object will be returned.
1050 # @return New GEOM_Object, containing the created face.
1052 # @ref tui_creation_face "Example"
1053 def MakeFace(self,theWire, isPlanarWanted):
1054 # Example: see GEOM_TestAll.py
1055 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1056 RaiseIfFailed("MakeFace", self.ShapesOp)
1059 ## Create a face on the given wires set.
1060 # @param theWires List of closed wires or edges to build the face on.
1061 # @param isPlanarWanted If TRUE, only planar face will be built.
1062 # If impossible, NULL object will be returned.
1063 # @return New GEOM_Object, containing the created face.
1065 # @ref tui_creation_face "Example"
1066 def MakeFaceWires(self,theWires, isPlanarWanted):
1067 # Example: see GEOM_TestAll.py
1068 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1069 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1072 ## Shortcut to MakeFaceWires()
1074 # @ref tui_creation_face "Example"
1075 def MakeFaces(self,theWires, isPlanarWanted):
1076 # Example: see GEOM_TestOthers.py
1077 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1080 ## Create a shell from the set of faces and shells.
1081 # @param theFacesAndShells List of faces and/or shells.
1082 # @return New GEOM_Object, containing the created shell.
1084 # @ref tui_creation_shell "Example"
1085 def MakeShell(self,theFacesAndShells):
1086 # Example: see GEOM_TestAll.py
1087 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1088 RaiseIfFailed("MakeShell", self.ShapesOp)
1091 ## Create a solid, bounded by the given shells.
1092 # @param theShells Sequence of bounding shells.
1093 # @return New GEOM_Object, containing the created solid.
1095 # @ref tui_creation_solid "Example"
1096 def MakeSolid(self,theShells):
1097 # Example: see GEOM_TestAll.py
1098 anObj = self.ShapesOp.MakeSolidShells(theShells)
1099 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1102 ## Create a compound of the given shapes.
1103 # @param theShapes List of shapes to put in compound.
1104 # @return New GEOM_Object, containing the created compound.
1106 # @ref tui_creation_compound "Example"
1107 def MakeCompound(self,theShapes):
1108 # Example: see GEOM_TestAll.py
1109 anObj = self.ShapesOp.MakeCompound(theShapes)
1110 RaiseIfFailed("MakeCompound", self.ShapesOp)
1113 # end of l3_advanced
1116 ## @addtogroup l2_measure
1119 ## Gives quantity of faces in the given shape.
1120 # @param theShape Shape to count faces of.
1121 # @return Quantity of faces.
1123 # @ref tui_todo "Example"
1124 def NumberOfFaces(self,theShape):
1125 # Example: see GEOM_TestOthers.py
1126 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1127 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1130 ## Gives quantity of edges in the given shape.
1131 # @param theShape Shape to count edges of.
1132 # @return Quantity of edges.
1134 # @ref tui_todo "Example"
1135 def NumberOfEdges(self,theShape):
1136 # Example: see GEOM_TestOthers.py
1137 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1138 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1144 ## @addtogroup l3_healing
1147 ## Reverses an orientation the given shape.
1148 # @param theShape Shape to be reversed.
1149 # @return The reversed copy of theShape.
1151 # @ref tui_todo "Example"
1152 def ChangeOrientation(self,theShape):
1153 # Example: see GEOM_TestAll.py
1154 anObj = self.ShapesOp.ChangeOrientation(theShape)
1155 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1158 ## Shortcut to ChangeOrientation()
1160 # @ref tui_todo "Example"
1161 def OrientationChange(self,theShape):
1162 # Example: see GEOM_TestOthers.py
1163 anObj = self.ChangeOrientation(theShape)
1169 ## @addtogroup l4_obtain
1172 ## Retrieve all free faces from the given shape.
1173 # Free face is a face, which is not shared between two shells of the shape.
1174 # @param theShape Shape to find free faces in.
1175 # @return List of IDs of all free faces, contained in theShape.
1177 # @ref tui_measurement_tools_page "Example"
1178 def GetFreeFacesIDs(self,theShape):
1179 # Example: see GEOM_TestOthers.py
1180 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1181 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1184 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1185 # @param theShape1 Shape to find sub-shapes in.
1186 # @param theShape2 Shape to find shared sub-shapes with.
1187 # @param theShapeType Type of sub-shapes to be retrieved.
1188 # @return List of sub-shapes of theShape1, shared with theShape2.
1190 # @ref tui_todo "Example"
1191 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1192 # Example: see GEOM_TestOthers.py
1193 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1194 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1197 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1198 # situated relatively the specified plane by the certain way,
1199 # defined through <VAR>theState</VAR> parameter.
1200 # @param theShape Shape to find sub-shapes of.
1201 # @param theShapeType Type of sub-shapes to be retrieved.
1202 # @param theAx1 Vector (or line, or linear edge), specifying normal
1203 # direction and location of the plane to find shapes on.
1204 # @param theState The state of the subshapes to find. It can be one of
1205 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1206 # @return List of all found sub-shapes.
1208 # @ref tui_todo "Example"
1209 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1210 # Example: see GEOM_TestOthers.py
1211 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1212 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1215 ## Works like the above method, but returns list of sub-shapes indices
1217 # @ref tui_todo "Example"
1218 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1219 # Example: see GEOM_TestOthers.py
1220 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1221 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1224 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1225 # situated relatively the specified plane by the certain way,
1226 # defined through <VAR>theState</VAR> parameter.
1227 # @param theShape Shape to find sub-shapes of.
1228 # @param theShapeType Type of sub-shapes to be retrieved.
1229 # @param theAx1 Vector (or line, or linear edge), specifying normal
1230 # direction of the plane to find shapes on.
1231 # @param thePnt Point specifying location of the plane to find shapes on.
1232 # @param theState The state of the subshapes to find. It can be one of
1233 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1234 # @return List of all found sub-shapes.
1236 # @ref tui_todo "Example"
1237 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1238 # Example: see GEOM_TestOthers.py
1239 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1240 theAx1, thePnt, theState)
1241 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1244 ## Works like the above method, but returns list of sub-shapes indices
1246 # @ref tui_todo "Example"
1247 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1248 # Example: see GEOM_TestOthers.py
1249 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1250 theAx1, thePnt, theState)
1251 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1254 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1255 # the specified cylinder by the certain way, defined through \a theState parameter.
1256 # @param theShape Shape to find sub-shapes of.
1257 # @param theShapeType Type of sub-shapes to be retrieved.
1258 # @param theAxis Vector (or line, or linear edge), specifying
1259 # axis of the cylinder to find shapes on.
1260 # @param theRadius Radius of the cylinder to find shapes on.
1261 # @param theState The state of the subshapes to find. It can be one of
1262 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1263 # @return List of all found sub-shapes.
1265 # @ref tui_todo "Example"
1266 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1267 # Example: see GEOM_TestOthers.py
1268 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1269 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1272 ## Works like the above method, but returns list of sub-shapes indices
1274 # @ref tui_todo "Example"
1275 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1276 # Example: see GEOM_TestOthers.py
1277 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1278 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1281 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1282 # the specified sphere by the certain way, defined through \a theState parameter.
1283 # @param theShape Shape to find sub-shapes of.
1284 # @param theShapeType Type of sub-shapes to be retrieved.
1285 # @param theCenter Point, specifying center of the sphere to find shapes on.
1286 # @param theRadius Radius of the sphere to find shapes on.
1287 # @param theState The state of the subshapes to find. It can be one of
1288 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1289 # @return List of all found sub-shapes.
1291 # @ref tui_todo "Example"
1292 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1293 # Example: see GEOM_TestOthers.py
1294 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1295 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1298 ## Works like the above method, but returns list of sub-shapes indices
1300 # @ref tui_todo "Example"
1301 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1302 # Example: see GEOM_TestOthers.py
1303 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1304 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1307 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1308 # the specified quadrangle by the certain way, defined through \a theState parameter.
1309 # @param theShape Shape to find sub-shapes of.
1310 # @param theShapeType Type of sub-shapes to be retrieved.
1311 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1312 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1313 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1314 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1315 # @param theState The state of the subshapes to find. It can be one of
1316 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1317 # @return List of all found sub-shapes.
1319 # @ref tui_todo "Example"
1320 def GetShapesOnQuadrangle(self, theShape, theShapeType,
1321 theTopLeftPoint, theTopRigthPoint,
1322 theBottomLeftPoint, theBottomRigthPoint, theState):
1323 # Example: see GEOM_TestOthers.py
1324 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
1325 theTopLeftPoint, theTopRigthPoint,
1326 theBottomLeftPoint, theBottomRigthPoint, theState)
1327 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
1330 ## Works like the above method, but returns list of sub-shapes indices
1332 # @ref tui_todo "Example"
1333 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
1334 theTopLeftPoint, theTopRigthPoint,
1335 theBottomLeftPoint, theBottomRigthPoint, theState):
1336 # Example: see GEOM_TestOthers.py
1337 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
1338 theTopLeftPoint, theTopRigthPoint,
1339 theBottomLeftPoint, theBottomRigthPoint, theState)
1340 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
1343 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1344 # the specified \a theBox by the certain way, defined through \a theState parameter.
1345 # @param theBox Shape for relative comparing.
1346 # @param theShape Shape to find sub-shapes of.
1347 # @param theShapeType Type of sub-shapes to be retrieved.
1348 # @param theState The state of the subshapes to find. It can be one of
1349 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1350 # @return List of all found sub-shapes.
1352 # @ref tui_todo "Example"
1353 def GetShapesOnBox(self,theBox, theShape, theShapeType, theState):
1354 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
1355 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
1358 ## Works like the above method, but returns list of sub-shapes indices
1360 def GetShapesOnBoxIDs(self,theBox, theShape, theShapeType, theState):
1361 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
1362 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
1365 ## Find in \a theShape all sub-shapes of type \a theShapeType,
1366 # situated relatively the specified \a theCheckShape by the
1367 # certain way, defined through \a theState parameter.
1368 # @param theCheckShape Shape for relative comparing.
1369 # @param theShape Shape to find sub-shapes of.
1370 # @param theShapeType Type of sub-shapes to be retrieved.
1371 # @param theState The state of the subshapes to find. It can be one of
1372 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1373 # @return List of all found sub-shapes.
1375 # @ref tui_todo "Example"
1376 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
1377 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
1378 theShapeType, theState)
1379 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
1382 ## Works like the above method, but returns result as compound
1384 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
1385 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
1386 theShapeType, theState)
1387 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
1390 ## Works like the above method, but returns list of sub-shapes indices
1392 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
1393 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
1394 theShapeType, theState)
1395 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
1398 ## Get sub-shape(s) of theShapeWhere, which are
1399 # coincident with \a theShapeWhat or could be a part of it.
1400 # @param theShapeWhere Shape to find sub-shapes of.
1401 # @param theShapeWhat Shape, specifying what to find.
1402 # @return Group of all found sub-shapes or a single found sub-shape.
1404 # @ref tui_todo "Example"
1405 def GetInPlace(self,theShapeWhere, theShapeWhat):
1406 # Example: see GEOM_TestOthers.py
1407 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
1408 RaiseIfFailed("GetInPlace", self.ShapesOp)
1411 ## Get sub-shape(s) of \a theShapeWhere, which are
1412 # coincident with \a theShapeWhat or could be a part of it.
1414 # Implementation of this method is based on a saved history of an operation,
1415 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
1416 # arguments (an argument shape or a sub-shape of an argument shape).
1417 # The operation could be the Partition or one of boolean operations,
1418 # performed on simple shapes (not on compounds).
1420 # @param theShapeWhere Shape to find sub-shapes of.
1421 # @param theShapeWhat Shape, specifying what to find (must be in the
1422 # building history of the ShapeWhere).
1423 # @return Group of all found sub-shapes or a single found sub-shape.
1425 # @ref tui_todo "Example"
1426 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
1427 # Example: see GEOM_TestOthers.py
1428 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
1429 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
1432 ## Get sub-shape of theShapeWhere, which is
1433 # equal to \a theShapeWhat.
1434 # @param theShapeWhere Shape to find sub-shape of.
1435 # @param theShapeWhat Shape, specifying what to find.
1436 # @return New GEOM_Object for found sub-shape.
1438 # @ref tui_todo "Example"
1439 def GetSame(self,theShapeWhere, theShapeWhat):
1440 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
1441 RaiseIfFailed("GetSame", self.ShapesOp)
1447 ## @addtogroup l4_access
1450 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
1451 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
1453 # @ref tui_todo "Example"
1454 def GetSubShape(self, aShape, ListOfID):
1455 # Example: see GEOM_TestAll.py
1456 anObj = self.AddSubShape(aShape,ListOfID)
1459 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
1461 # @ref tui_todo "Example"
1462 def GetSubShapeID(self, aShape, aSubShape):
1463 # Example: see GEOM_TestAll.py
1464 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
1465 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
1471 ## @addtogroup l4_decompose Decompose objects
1474 ## Explode a shape on subshapes of a given type.
1475 # @param aShape Shape to be exploded.
1476 # @param aType Type of sub-shapes to be retrieved.
1477 # @return List of sub-shapes of type theShapeType, contained in theShape.
1479 # @ref tui_todo "Example"
1480 def SubShapeAll(self, aShape, aType):
1481 # Example: see GEOM_TestAll.py
1482 ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
1483 RaiseIfFailed("MakeExplode", self.ShapesOp)
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 IDs of sub-shapes.
1491 # @ref tui_todo "Example"
1492 def SubShapeAllIDs(self, aShape, aType):
1493 ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
1494 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1497 ## Explode a shape on subshapes of a given type.
1498 # Sub-shapes will be sorted by coordinates of their gravity centers.
1499 # @param aShape Shape to be exploded.
1500 # @param aType Type of sub-shapes to be retrieved.
1501 # @return List of sub-shapes of type theShapeType, contained in theShape.
1503 # @ref tui_working_with_groups_page "Example"
1504 def SubShapeAllSorted(self, aShape, aType):
1505 # Example: see GEOM_TestAll.py
1506 ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
1507 RaiseIfFailed("MakeExplode", self.ShapesOp)
1510 ## Explode a shape on subshapes of a given type.
1511 # Sub-shapes will be sorted by coordinates of their gravity centers.
1512 # @param aShape Shape to be exploded.
1513 # @param aType Type of sub-shapes to be retrieved.
1514 # @return List of IDs of sub-shapes.
1516 # @ref tui_todo "Example"
1517 def SubShapeAllSortedIDs(self, aShape, aType):
1518 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
1519 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1522 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1523 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
1524 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1526 # @ref tui_todo "Example"
1527 def SubShape(self, aShape, aType, ListOfInd):
1528 # Example: see GEOM_TestAll.py
1530 AllShapeList = self.SubShapeAll(aShape, aType)
1531 for ind in ListOfInd:
1532 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1533 anObj = self.GetSubShape(aShape, ListOfIDs)
1536 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1537 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
1538 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1540 # @ref tui_todo "Example"
1541 def SubShapeSorted(self,aShape, aType, ListOfInd):
1542 # Example: see GEOM_TestAll.py
1544 AllShapeList = self.SubShapeAllSorted(aShape, aType)
1545 for ind in ListOfInd:
1546 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1547 anObj = self.GetSubShape(aShape, ListOfIDs)
1550 # end of l4_decompose
1553 ## @addtogroup l3_healing
1556 ## Apply a sequence of Shape Healing operators to the given object.
1557 # @param theShape Shape to be processed.
1558 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1559 # @param theParameters List of names of parameters
1560 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1561 # @param theValues List of values of parameters, in the same order
1562 # as parameters are listed in <VAR>theParameters</VAR> list.
1563 # @return New GEOM_Object, containing processed shape.
1565 # @ref tui_shape_processing "Example"
1566 def ProcessShape(self,theShape, theOperators, theParameters, theValues):
1567 # Example: see GEOM_TestHealing.py
1568 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1569 RaiseIfFailed("ProcessShape", self.HealOp)
1572 ## Remove faces from the given object (shape).
1573 # @param theObject Shape to be processed.
1574 # @param theFaces Indices of faces to be removed, if EMPTY then the method
1575 # removes ALL faces of the given object.
1576 # @return New GEOM_Object, containing processed shape.
1578 # @ref tui_suppress_faces "Example"
1579 def SuppressFaces(self,theObject, theFaces):
1580 # Example: see GEOM_TestHealing.py
1581 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
1582 RaiseIfFailed("SuppressFaces", self.HealOp)
1585 ## Sewing of some shapes into single shape.
1587 # @ref tui_sewing "Example"
1588 def MakeSewing(self, ListShape, theTolerance):
1589 # Example: see GEOM_TestHealing.py
1590 comp = self.MakeCompound(ListShape)
1591 anObj = self.Sew(comp, theTolerance)
1594 ## Sewing of the given object.
1595 # @param theObject Shape to be processed.
1596 # @param theTolerance Required tolerance value.
1597 # @return New GEOM_Object, containing processed shape.
1598 def Sew(self, theObject, theTolerance):
1599 # Example: see MakeSewing() above
1600 anObj = self.HealOp.Sew(theObject, theTolerance)
1601 RaiseIfFailed("Sew", self.HealOp)
1604 ## Remove internal wires and edges from the given object (face).
1605 # @param theObject Shape to be processed.
1606 # @param theWires Indices of wires to be removed, if EMPTY then the method
1607 # removes ALL internal wires of the given object.
1608 # @return New GEOM_Object, containing processed shape.
1610 # @ref tui_suppress_internal_wires "Example"
1611 def SuppressInternalWires(self,theObject, theWires):
1612 # Example: see GEOM_TestHealing.py
1613 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
1614 RaiseIfFailed("RemoveIntWires", self.HealOp)
1617 ## Remove internal closed contours (holes) from the given object.
1618 # @param theObject Shape to be processed.
1619 # @param theWires Indices of wires to be removed, if EMPTY then the method
1620 # removes ALL internal holes of the given object
1621 # @return New GEOM_Object, containing processed shape.
1623 # @ref tui_suppress_holes "Example"
1624 def SuppressHoles(self,theObject, theWires):
1625 # Example: see GEOM_TestHealing.py
1626 anObj = self.HealOp.FillHoles(theObject, theWires)
1627 RaiseIfFailed("FillHoles", self.HealOp)
1630 ## Close an open wire.
1631 # @param theObject Shape to be processed.
1632 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1633 # if -1, then <VAR>theObject</VAR> itself is a wire.
1634 # @param isCommonVertex If TRUE : closure by creation of a common vertex,
1635 # If FALS : closure by creation of an edge between ends.
1636 # @return New GEOM_Object, containing processed shape.
1638 # @ref tui_close_contour "Example"
1639 def CloseContour(self,theObject, theWires, isCommonVertex):
1640 # Example: see GEOM_TestHealing.py
1641 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
1642 RaiseIfFailed("CloseContour", self.HealOp)
1645 ## Addition of a point to a given edge object.
1646 # @param theObject Shape to be processed.
1647 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
1648 # if -1, then theObject itself is the edge.
1649 # @param theValue Value of parameter on edge or length parameter,
1650 # depending on \a isByParameter.
1651 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1652 # if FALSE : \a theValue is treated as a length parameter [0..1]
1653 # @return New GEOM_Object, containing processed shape.
1655 # @ref tui_add_point_on_edge "Example"
1656 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
1657 # Example: see GEOM_TestHealing.py
1658 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1659 RaiseIfFailed("DivideEdge", self.HealOp)
1662 ## Change orientation of the given object.
1663 # @param theObject Shape to be processed.
1664 # @update given shape
1666 # @ref tui_todo "Example"
1667 def ChangeOrientationShell(self,theObject):
1668 theObject = self.HealOp.ChangeOrientation(theObject)
1669 RaiseIfFailed("ChangeOrientation", self.HealOp)
1672 ## Change orientation of the given object.
1673 # @param theObject Shape to be processed.
1674 # @return New GEOM_Object, containing processed shape.
1676 # @ref tui_todo "Example"
1677 def ChangeOrientationShellCopy(self,theObject):
1678 anObj = self.HealOp.ChangeOrientationCopy(theObject)
1679 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
1682 ## Get a list of wires (wrapped in GEOM_Object-s),
1683 # that constitute a free boundary of the given shape.
1684 # @param theObject Shape to get free boundary of.
1685 # @return [status, theClosedWires, theOpenWires]
1686 # status: FALSE, if an error(s) occured during the method execution.
1687 # theClosedWires: Closed wires on the free boundary of the given shape.
1688 # theOpenWires: Open wires on the free boundary of the given shape.
1690 # @ref tui_measurement_tools_page "Example"
1691 def GetFreeBoundary(self,theObject):
1692 # Example: see GEOM_TestHealing.py
1693 anObj = self.HealOp.GetFreeBoundary(theObject)
1694 RaiseIfFailed("GetFreeBoundary", self.HealOp)
1697 ## Replace coincident faces in theShape by one face.
1698 # @param theShape Initial shape.
1699 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
1700 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1701 # otherwise all initial shapes.
1702 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
1704 # @ref tui_glue_faces "Example"
1705 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
1706 # Example: see GEOM_Spanner.py
1707 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
1709 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
1712 ## Find coincident faces in theShape for possible gluing.
1713 # @param theShape Initial shape.
1714 # @param theTolerance Maximum distance between faces,
1715 # which can be considered as coincident.
1718 # @ref tui_todo "Example"
1719 def GetGlueFaces(self, theShape, theTolerance):
1720 # Example: see GEOM_Spanner.py
1721 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
1722 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
1725 ## Replace coincident faces in theShape by one face
1726 # in compliance with given list of faces
1727 # @param theShape Initial shape.
1728 # @param theTolerance Maximum distance between faces,
1729 # which can be considered as coincident.
1730 # @param theFaces List of faces for gluing.
1731 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1732 # otherwise all initial shapes.
1733 # @return New GEOM_Object, containing a copy of theShape
1734 # without some faces.
1736 # @ref tui_todo "Example"
1737 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
1738 # Example: see GEOM_Spanner.py
1739 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
1741 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
1747 ## @addtogroup l3_boolean Boolean Operations
1750 # -----------------------------------------------------------------------------
1751 # Boolean (Common, Cut, Fuse, Section)
1752 # -----------------------------------------------------------------------------
1754 ## Perform one of boolean operations on two given shapes.
1755 # @param theShape1 First argument for boolean operation.
1756 # @param theShape2 Second argument for boolean operation.
1757 # @param theOperation Indicates the operation to be done:
1758 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
1759 # @return New GEOM_Object, containing the result shape.
1761 # @ref tui_fuse "Example"
1762 def MakeBoolean(self,theShape1, theShape2, theOperation):
1763 # Example: see GEOM_TestAll.py
1764 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
1765 RaiseIfFailed("MakeBoolean", self.BoolOp)
1768 ## Shortcut to MakeBoolean(s1, s2, 1)
1770 # @ref tui_common "Example"
1771 def MakeCommon(self, s1, s2):
1772 # Example: see GEOM_TestOthers.py
1773 return self.MakeBoolean(s1, s2, 1)
1775 ## Shortcut to MakeBoolean(s1, s2, 2)
1777 # @ref tui_cut "Example"
1778 def MakeCut(self, s1, s2):
1779 # Example: see GEOM_TestOthers.py
1780 return self.MakeBoolean(s1, s2, 2)
1782 ## Shortcut to MakeBoolean(s1, s2, 3)
1784 # @ref tui_fuse "Example"
1785 def MakeFuse(self, s1, s2):
1786 # Example: see GEOM_TestOthers.py
1787 return self.MakeBoolean(s1, s2, 3)
1789 ## Shortcut to MakeBoolean(s1, s2, 4)
1791 # @ref tui_section "Example"
1792 def MakeSection(self, s1, s2):
1793 # Example: see GEOM_TestOthers.py
1794 return self.MakeBoolean(s1, s2, 4)
1799 ## @addtogroup l3_basic_op
1802 ## Perform partition operation.
1803 # @param ListShapes Shapes to be intersected.
1804 # @param ListTools Shapes to intersect theShapes.
1805 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
1806 # in order to avoid possible intersection between shapes from
1808 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
1809 # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
1810 # type <= Limit are kept in the result,
1811 # else - shapes with type > Limit are kept
1812 # also (if they exist)
1814 # After implementation new version of PartitionAlgo (October 2006)
1815 # other parameters are ignored by current functionality. They are kept
1816 # in this function only for support old versions.
1817 # Ignored parameters:
1818 # @param ListKeepInside Shapes, outside which the results will be deleted.
1819 # Each shape from theKeepInside must belong to theShapes also.
1820 # @param ListRemoveInside Shapes, inside which the results will be deleted.
1821 # Each shape from theRemoveInside must belong to theShapes also.
1822 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
1823 # @param ListMaterials Material indices for each shape. Make sence,
1824 # only if theRemoveWebs is TRUE.
1826 # @return New GEOM_Object, containing the result shapes.
1828 # @ref tui_partition "Example"
1829 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1830 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
1831 KeepNonlimitShapes=0):
1832 # Example: see GEOM_TestAll.py
1833 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
1834 ListKeepInside, ListRemoveInside,
1835 Limit, RemoveWebs, ListMaterials,
1836 KeepNonlimitShapes);
1837 RaiseIfFailed("MakePartition", self.BoolOp)
1840 ## Perform partition operation.
1841 # This method may be useful if it is needed to make a partition for
1842 # compound contains nonintersected shapes. Performance will be better
1843 # since intersection between shapes from compound is not performed.
1845 # Description of all parameters as in previous method MakePartition()
1847 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
1848 # have to consist of nonintersecting shapes.
1850 # @return New GEOM_Object, containing the result shapes.
1852 # @ref tui_todo "Example"
1853 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
1854 ListKeepInside=[], ListRemoveInside=[],
1855 Limit=ShapeType["SHAPE"], RemoveWebs=0,
1856 ListMaterials=[], KeepNonlimitShapes=0):
1857 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
1858 ListKeepInside, ListRemoveInside,
1859 Limit, RemoveWebs, ListMaterials,
1860 KeepNonlimitShapes);
1861 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
1864 ## Shortcut to MakePartition()
1866 # @ref tui_partition "Example"
1867 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1868 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
1869 KeepNonlimitShapes=0):
1870 # Example: see GEOM_TestOthers.py
1871 anObj = self.MakePartition(ListShapes, ListTools,
1872 ListKeepInside, ListRemoveInside,
1873 Limit, RemoveWebs, ListMaterials,
1874 KeepNonlimitShapes);
1877 ## Perform partition of the Shape with the Plane
1878 # @param theShape Shape to be intersected.
1879 # @param thePlane Tool shape, to intersect theShape.
1880 # @return New GEOM_Object, containing the result shape.
1882 # @ref tui_partition "Example"
1883 def MakeHalfPartition(self,theShape, thePlane):
1884 # Example: see GEOM_TestAll.py
1885 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
1886 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
1889 # end of l3_basic_op
1892 ## @addtogroup l3_transform
1895 ## Translate the given object along the vector, specified
1896 # by its end points, creating its copy before the translation.
1897 # @param theObject The object to be translated.
1898 # @param thePoint1 Start point of translation vector.
1899 # @param thePoint2 End point of translation vector.
1900 # @return New GEOM_Object, containing the translated object.
1902 # @ref tui_translation "Example"
1903 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
1904 # Example: see GEOM_TestAll.py
1905 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
1906 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
1909 ## Translate the given object along the vector, specified
1910 # by its components, creating its copy before the translation.
1911 # @param theObject The object to be translated.
1912 # @param theDX,theDY,theDZ Components of translation vector.
1913 # @return New GEOM_Object, containing the translated object.
1915 # @ref tui_translation "Example"
1916 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
1917 # Example: see GEOM_TestAll.py
1918 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
1919 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
1922 ## Translate the given object along the given vector,
1923 # creating its copy before the translation.
1924 # @param theObject The object to be translated.
1925 # @param theVector The translation vector.
1926 # @return New GEOM_Object, containing the translated object.
1928 # @ref tui_translation "Example"
1929 def MakeTranslationVector(self,theObject, theVector):
1930 # Example: see GEOM_TestAll.py
1931 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
1932 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
1935 ## Translate the given object along the given vector on given distance,
1936 # creating its copy before the translation.
1937 # @param theObject The object to be translated.
1938 # @param theVector The translation vector.
1939 # @param theDistance The translation distance.
1940 # @return New GEOM_Object, containing the translated object.
1942 # @ref tui_translation "Example"
1943 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
1944 # Example: see GEOM_TestAll.py
1945 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
1946 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
1949 ## Rotate the given object around the given axis
1950 # on the given angle, creating its copy before the rotatation.
1951 # @param theObject The object to be rotated.
1952 # @param theAxis Rotation axis.
1953 # @param theAngle Rotation angle in radians.
1954 # @return New GEOM_Object, containing the rotated object.
1956 # @ref tui_rotation "Example"
1957 def MakeRotation(self,theObject, theAxis, theAngle):
1958 # Example: see GEOM_TestAll.py
1959 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
1960 RaiseIfFailed("RotateCopy", self.TrsfOp)
1963 ## Rotate given object around vector perpendicular to plane
1964 # containing three points, creating its copy before the rotatation.
1965 # @param theObject The object to be rotated.
1966 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
1967 # containing the three points.
1968 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
1969 # @return New GEOM_Object, containing the rotated object.
1971 # @ref tui_rotation "Example"
1972 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
1973 # Example: see GEOM_TestAll.py
1974 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
1975 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
1978 ## Scale the given object by the factor, creating its copy before the scaling.
1979 # @param theObject The object to be scaled.
1980 # @param thePoint Center point for scaling.
1981 # @param theFactor Scaling factor value.
1982 # @return New GEOM_Object, containing the scaled shape.
1984 # @ref tui_scale "Example"
1985 def MakeScaleTransform(self,theObject, thePoint, theFactor):
1986 # Example: see GEOM_TestAll.py
1987 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
1988 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
1991 ## Create an object, symmetrical
1992 # to the given one relatively the given plane.
1993 # @param theObject The object to be mirrored.
1994 # @param thePlane Plane of symmetry.
1995 # @return New GEOM_Object, containing the mirrored shape.
1997 # @ref tui_mirror "Example"
1998 def MakeMirrorByPlane(self,theObject, thePlane):
1999 # Example: see GEOM_TestAll.py
2000 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
2001 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
2004 ## Create an object, symmetrical
2005 # to the given one relatively the given axis.
2006 # @param theObject The object to be mirrored.
2007 # @param theAxis Axis of symmetry.
2008 # @return New GEOM_Object, containing the mirrored shape.
2010 # @ref tui_mirror "Example"
2011 def MakeMirrorByAxis(self,theObject, theAxis):
2012 # Example: see GEOM_TestAll.py
2013 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
2014 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
2017 ## Create an object, symmetrical
2018 # to the given one relatively the given point.
2019 # @param theObject The object to be mirrored.
2020 # @param thePoint Point of symmetry.
2021 # @return New GEOM_Object, containing the mirrored shape.
2023 # @ref tui_mirror "Example"
2024 def MakeMirrorByPoint(self,theObject, thePoint):
2025 # Example: see GEOM_TestAll.py
2026 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
2027 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
2030 ## Modify the Location of the given object by LCS,
2031 # creating its copy before the setting.
2032 # @param theObject The object to be displaced.
2033 # @param theStartLCS Coordinate system to perform displacement from it.
2034 # If \a theStartLCS is NULL, displacement
2035 # will be performed from global CS.
2036 # If \a theObject itself is used as \a theStartLCS,
2037 # its location will be changed to \a theEndLCS.
2038 # @param theEndLCS Coordinate system to perform displacement to it.
2039 # @return New GEOM_Object, containing the displaced shape.
2041 # @ref tui_modify_location "Example"
2042 def MakePosition(self,theObject, theStartLCS, theEndLCS):
2043 # Example: see GEOM_TestAll.py
2044 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
2045 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
2048 ## Create new object as offset of the given one.
2049 # @param theObject The base object for the offset.
2050 # @param theOffset Offset value.
2051 # @return New GEOM_Object, containing the offset object.
2053 # @ref tui_offset "Example"
2054 def MakeOffset(self,theObject, theOffset):
2055 # Example: see GEOM_TestAll.py
2056 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
2057 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
2060 # -----------------------------------------------------------------------------
2062 # -----------------------------------------------------------------------------
2064 ## Translate the given object along the given vector a given number times
2065 # @param theObject The object to be translated.
2066 # @param theVector Direction of the translation.
2067 # @param theStep Distance to translate on.
2068 # @param theNbTimes Quantity of translations to be done.
2069 # @return New GEOM_Object, containing compound of all
2070 # the shapes, obtained after each translation.
2072 # @ref tui_multi_translation "Example"
2073 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
2074 # Example: see GEOM_TestAll.py
2075 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
2076 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
2079 ## Conseqently apply two specified translations to theObject specified number of times.
2080 # @param theObject The object to be translated.
2081 # @param theVector1 Direction of the first translation.
2082 # @param theStep1 Step of the first translation.
2083 # @param theNbTimes1 Quantity of translations to be done along theVector1.
2084 # @param theVector2 Direction of the second translation.
2085 # @param theStep2 Step of the second translation.
2086 # @param theNbTimes2 Quantity of translations to be done along theVector2.
2087 # @return New GEOM_Object, containing compound of all
2088 # the shapes, obtained after each translation.
2090 # @ref tui_multi_translation "Example"
2091 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
2092 theVector2, theStep2, theNbTimes2):
2093 # Example: see GEOM_TestAll.py
2094 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
2095 theVector2, theStep2, theNbTimes2)
2096 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
2099 ## Rotate the given object around the given axis a given number times.
2100 # Rotation angle will be 2*PI/theNbTimes.
2101 # @param theObject The object to be rotated.
2102 # @param theAxis The rotation axis.
2103 # @param theNbTimes Quantity of rotations to be done.
2104 # @return New GEOM_Object, containing compound of all the
2105 # shapes, obtained after each rotation.
2107 # @ref tui_multi_rotation "Example"
2108 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
2109 # Example: see GEOM_TestAll.py
2110 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
2111 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
2114 ## Rotate the given object around the
2115 # given axis on the given angle a given number
2116 # times and multi-translate each rotation result.
2117 # Translation direction passes through center of gravity
2118 # of rotated shape and its projection on the rotation axis.
2119 # @param theObject The object to be rotated.
2120 # @param theAxis Rotation axis.
2121 # @param theAngle Rotation angle in graduces.
2122 # @param theNbTimes1 Quantity of rotations to be done.
2123 # @param theStep Translation distance.
2124 # @param theNbTimes2 Quantity of translations to be done.
2125 # @return New GEOM_Object, containing compound of all the
2126 # shapes, obtained after each transformation.
2128 # @ref tui_multi_rotation "Example"
2129 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
2130 # Example: see GEOM_TestAll.py
2131 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
2132 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
2135 ## The same, as MultiRotate1D(), but axis is given by direction and point
2136 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
2137 # Example: see GEOM_TestOthers.py
2138 aVec = self.MakeLine(aPoint,aDir)
2139 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
2142 ## The same, as MultiRotate2D(), but axis is given by direction and point
2143 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
2144 # Example: see GEOM_TestOthers.py
2145 aVec = self.MakeLine(aPoint,aDir)
2146 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
2149 # end of l3_transform
2152 ## @addtogroup l3_local
2155 ## Perform a fillet on all edges of the given shape.
2156 # @param theShape Shape, to perform fillet on.
2157 # @param theR Fillet radius.
2158 # @return New GEOM_Object, containing the result shape.
2160 # @ref tui_fillet "Example"
2161 def MakeFilletAll(self,theShape, theR):
2162 # Example: see GEOM_TestOthers.py
2163 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
2164 RaiseIfFailed("MakeFilletAll", self.LocalOp)
2167 ## Perform a fillet on the specified edges/faces of the given shape
2168 # @param theShape Shape, to perform fillet on.
2169 # @param theR Fillet radius.
2170 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
2171 # @param theListShapes Global indices of edges/faces to perform fillet on.
2172 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2173 # @return New GEOM_Object, containing the result shape.
2175 # @ref tui_fillet "Example"
2176 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
2177 # Example: see GEOM_TestAll.py
2179 if theShapeType == ShapeType["EDGE"]:
2180 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
2181 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
2183 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
2184 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
2187 ## The same that MakeFillet but with two Fillet Radius R1 and R2
2188 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
2190 if theShapeType == ShapeType["EDGE"]:
2191 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
2192 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
2194 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
2195 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
2198 ## Perform a symmetric chamfer on all edges of the given shape.
2199 # @param theShape Shape, to perform chamfer on.
2200 # @param theD Chamfer size along each face.
2201 # @return New GEOM_Object, containing the result shape.
2203 # @ref tui_chamfer "Example"
2204 def MakeChamferAll(self,theShape, theD):
2205 # Example: see GEOM_TestOthers.py
2206 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
2207 RaiseIfFailed("MakeChamferAll", self.LocalOp)
2210 ## Perform a chamfer on edges, common to the specified faces,
2211 # with distance D1 on the Face1
2212 # @param theShape Shape, to perform chamfer on.
2213 # @param theD1 Chamfer size along \a theFace1.
2214 # @param theD2 Chamfer size along \a theFace2.
2215 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
2216 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2217 # @return New GEOM_Object, containing the result shape.
2219 # @ref tui_chamfer "Example"
2220 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
2221 # Example: see GEOM_TestAll.py
2222 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
2223 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
2226 ## The Same that MakeChamferEdge but with params theD is chamfer lenght and
2227 # theAngle is Angle of chamfer (angle in radians)
2228 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
2229 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
2230 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
2233 ## Perform a chamfer on all edges of the specified faces,
2234 # with distance D1 on the first specified face (if several for one edge)
2235 # @param theShape Shape, to perform chamfer on.
2236 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
2237 # connected to the edge, are in \a theFaces, \a theD1
2238 # will be get along face, which is nearer to \a theFaces beginning.
2239 # @param theD2 Chamfer size along another of two faces, connected to the edge.
2240 # @param theFaces Sequence of global indices of faces of \a theShape.
2241 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2242 # @return New GEOM_Object, containing the result shape.
2244 # @ref tui_chamfer "Example"
2245 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
2246 # Example: see GEOM_TestAll.py
2247 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
2248 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
2251 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
2252 # theAngle is Angle of chamfer (angle in radians)
2253 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
2254 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
2255 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
2258 ## Perform a chamfer on edges,
2259 # with distance D1 on the first specified face (if several for one edge)
2260 # @param theShape Shape, to perform chamfer on.
2261 # @param theD1,theD2 Chamfer size
2262 # @param theEdges Sequence of edges of \a theShape.
2263 # @return New GEOM_Object, containing the result shape.
2265 # @ref tui_todo "Example"
2266 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
2267 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
2268 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
2271 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
2272 # theAngle is Angle of chamfer (angle in radians)
2274 # @ref tui_todo "Example"
2275 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
2276 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
2277 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
2280 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
2281 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
2282 # Example: see GEOM_TestOthers.py
2284 if aShapeType == ShapeType["EDGE"]:
2285 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
2287 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
2293 ## @addtogroup l3_basic_op
2296 ## Perform an Archimde operation on the given shape with given parameters.
2297 # The object presenting the resulting face is returned.
2298 # @param theShape Shape to be put in water.
2299 # @param theWeight Weight og the shape.
2300 # @param theWaterDensity Density of the water.
2301 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
2302 # @return New GEOM_Object, containing a section of \a theShape
2303 # by a plane, corresponding to water level.
2305 # @ref tui_archimede "Example"
2306 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
2307 # Example: see GEOM_TestAll.py
2308 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
2309 RaiseIfFailed("MakeArchimede", self.LocalOp)
2312 # end of l3_basic_op
2315 ## @addtogroup l2_measure
2318 ## Get point coordinates
2321 # @ref tui_measurement_tools_page "Example"
2322 def PointCoordinates(self,Point):
2323 # Example: see GEOM_TestMeasures.py
2324 aTuple = self.MeasuOp.PointCoordinates(Point)
2325 RaiseIfFailed("PointCoordinates", self.MeasuOp)
2328 ## Get summarized length of all wires,
2329 # area of surface and volume of the given shape.
2330 # @param theShape Shape to define properties of.
2331 # @return [theLength, theSurfArea, theVolume]
2332 # theLength: Summarized length of all wires of the given shape.
2333 # theSurfArea: Area of surface of the given shape.
2334 # theVolume: Volume of the given shape.
2336 # @ref tui_measurement_tools_page "Example"
2337 def BasicProperties(self,theShape):
2338 # Example: see GEOM_TestMeasures.py
2339 aTuple = self.MeasuOp.GetBasicProperties(theShape)
2340 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
2343 ## Get parameters of bounding box of the given shape
2344 # @param theShape Shape to obtain bounding box of.
2345 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
2346 # Xmin,Xmax: Limits of shape along OX axis.
2347 # Ymin,Ymax: Limits of shape along OY axis.
2348 # Zmin,Zmax: Limits of shape along OZ axis.
2350 # @ref tui_measurement_tools_page "Example"
2351 def BoundingBox(self,theShape):
2352 # Example: see GEOM_TestMeasures.py
2353 aTuple = self.MeasuOp.GetBoundingBox(theShape)
2354 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
2357 ## Get inertia matrix and moments of inertia of theShape.
2358 # @param theShape Shape to calculate inertia of.
2359 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
2360 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
2361 # Ix,Iy,Iz: Moments of inertia of the given shape.
2363 # @ref tui_measurement_tools_page "Example"
2364 def Inertia(self,theShape):
2365 # Example: see GEOM_TestMeasures.py
2366 aTuple = self.MeasuOp.GetInertia(theShape)
2367 RaiseIfFailed("GetInertia", self.MeasuOp)
2370 ## Get minimal distance between the given shapes.
2371 # @param theShape1,theShape2 Shapes to find minimal distance between.
2372 # @return Value of the minimal distance between the given shapes.
2374 # @ref tui_measurement_tools_page "Example"
2375 def MinDistance(self, theShape1, theShape2):
2376 # Example: see GEOM_TestMeasures.py
2377 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2378 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2381 ## Get minimal distance between the given shapes.
2382 # @param theShape1,theShape2 Shapes to find minimal distance between.
2383 # @return Value of the minimal distance between the given shapes.
2385 # @ref tui_todo "Example"
2386 def MinDistanceComponents(self, theShape1, theShape2):
2387 # Example: see GEOM_TestMeasures.py
2388 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2389 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2390 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
2393 ## Get angle between the given shapes.
2394 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2395 # @return Value of the angle between the given shapes.
2397 # @ref tui_measurement_tools_page "Example"
2398 def GetAngle(self, theShape1, theShape2):
2399 # Example: see GEOM_TestMeasures.py
2400 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
2401 RaiseIfFailed("GetAngle", self.MeasuOp)
2404 ## @name Curve Curvature Measurement
2405 # Methods for receiving radius of curvature of curves
2406 # in the given point
2409 ## Measure curvature of a curve at a point, set by parameter.
2410 # @ref tui_todo "Example"
2411 def CurveCurvatureByParam(self, theCurve, theParam):
2412 # Example: see GEOM_TestMeasures.py
2413 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
2414 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
2418 # @ref tui_todo "Example"
2419 def CurveCurvatureByPoint(self, theCurve, thePoint):
2420 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
2421 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
2425 ## @name Surface Curvature Measurement
2426 # Methods for receiving max and min radius of curvature of surfaces
2427 # in the given point
2431 ## @ref tui_todo "Example"
2432 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2433 # Example: see GEOM_TestMeasures.py
2434 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2435 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
2439 ## @ref tui_todo "Example"
2440 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
2441 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
2442 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
2446 ## @ref tui_todo "Example"
2447 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2448 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2449 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
2453 ## @ref tui_todo "Example"
2454 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
2455 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
2456 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
2460 ## Get min and max tolerances of sub-shapes of theShape
2461 # @param theShape Shape, to get tolerances of.
2462 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
2463 # FaceMin,FaceMax: Min and max tolerances of the faces.
2464 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
2465 # VertMin,VertMax: Min and max tolerances of the vertices.
2467 # @ref tui_measurement_tools_page "Example"
2468 def Tolerance(self,theShape):
2469 # Example: see GEOM_TestMeasures.py
2470 aTuple = self.MeasuOp.GetTolerance(theShape)
2471 RaiseIfFailed("GetTolerance", self.MeasuOp)
2474 ## Obtain description of the given shape (number of sub-shapes of each type)
2475 # @param theShape Shape to be described.
2476 # @return Description of the given shape.
2478 # @ref tui_measurement_tools_page "Example"
2479 def WhatIs(self,theShape):
2480 # Example: see GEOM_TestMeasures.py
2481 aDescr = self.MeasuOp.WhatIs(theShape)
2482 RaiseIfFailed("WhatIs", self.MeasuOp)
2485 ## Get a point, situated at the centre of mass of theShape.
2486 # @param theShape Shape to define centre of mass of.
2487 # @return New GEOM_Object, containing the created point.
2489 # @ref tui_measurement_tools_page "Example"
2490 def MakeCDG(self,theShape):
2491 # Example: see GEOM_TestMeasures.py
2492 anObj = self.MeasuOp.GetCentreOfMass(theShape)
2493 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
2496 ## Get a normale to the given face. If the point is not given,
2497 # the normale is calculated at the center of mass.
2498 # @param theFace Face to define normale of.
2499 # @param theOptionalPoint Point to compute the normale at.
2500 # @return New GEOM_Object, containing the created vector.
2502 # @ref tui_todo "Example"
2503 def GetNormal(self, theFace, theOptionalPoint = None):
2504 # Example: see GEOM_TestMeasures.py
2505 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
2506 RaiseIfFailed("GetNormal", self.MeasuOp)
2509 ## Check a topology of the given shape.
2510 # @param theShape Shape to check validity of.
2511 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
2512 # if TRUE, the shape's geometry will be checked also.
2513 # @return TRUE, if the shape "seems to be valid".
2514 # If theShape is invalid, prints a description of problem.
2516 # @ref tui_measurement_tools_page "Example"
2517 def CheckShape(self,theShape, theIsCheckGeom = 0):
2518 # Example: see GEOM_TestMeasures.py
2520 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
2521 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
2523 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
2524 RaiseIfFailed("CheckShape", self.MeasuOp)
2529 ## Get position (LCS) of theShape.
2531 # Origin of the LCS is situated at the shape's center of mass.
2532 # Axes of the LCS are obtained from shape's location or,
2533 # if the shape is a planar face, from position of its plane.
2535 # @param theShape Shape to calculate position of.
2536 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
2537 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
2538 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
2539 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
2541 # @ref tui_todo "Example"
2542 def GetPosition(self,theShape):
2543 # Example: see GEOM_TestMeasures.py
2544 aTuple = self.MeasuOp.GetPosition(theShape)
2545 RaiseIfFailed("GetPosition", self.MeasuOp)
2548 ## Get kind of theShape.
2550 # @param theShape Shape to get a kind of.
2551 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
2552 # and a list of parameters, describing the shape.
2553 # @note Concrete meaning of each value, returned via \a theIntegers
2554 # or \a theDoubles list depends on the kind of the shape.
2555 # The full list of possible outputs is:
2557 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
2558 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
2560 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
2561 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
2563 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
2564 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
2566 # - geompy.kind.SPHERE xc yc zc R
2567 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
2568 # - geompy.kind.BOX xc yc zc ax ay az
2569 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
2570 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
2571 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
2572 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
2573 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
2575 # - geompy.kind.SPHERE2D xc yc zc R
2576 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
2577 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
2578 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
2579 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
2580 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
2581 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
2582 # - geompy.kind.PLANE xo yo zo dx dy dz
2583 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
2584 # - geompy.kind.FACE nb_edges nb_vertices
2586 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
2587 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
2588 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
2589 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
2590 # - geompy.kind.LINE xo yo zo dx dy dz
2591 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
2592 # - geompy.kind.EDGE nb_vertices
2594 # - geompy.kind.VERTEX x y z
2596 # @ref tui_todo "Example"
2597 def KindOfShape(self,theShape):
2598 # Example: see GEOM_TestMeasures.py
2599 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
2600 RaiseIfFailed("KindOfShape", self.MeasuOp)
2602 aKind = aRoughTuple[0]
2603 anInts = aRoughTuple[1]
2604 aDbls = aRoughTuple[2]
2606 # Now there is no exception from this rule:
2607 aKindTuple = [aKind] + aDbls + anInts
2609 # If they are we will regroup parameters for such kind of shape.
2611 #if aKind == kind.SOME_KIND:
2612 # # SOME_KIND int int double int double double
2613 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
2620 ## @addtogroup l2_import_export
2623 ## Import a shape from the BREP or IGES or STEP file
2624 # (depends on given format) with given name.
2625 # @param theFileName The file, containing the shape.
2626 # @param theFormatName Specify format for the file reading.
2627 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2628 # @return New GEOM_Object, containing the imported shape.
2630 # @ref tui_todo "Example"
2631 def Import(self,theFileName, theFormatName):
2632 # Example: see GEOM_TestOthers.py
2633 anObj = self.InsertOp.Import(theFileName, theFormatName)
2634 RaiseIfFailed("Import", self.InsertOp)
2637 ## Shortcut to Import() for BREP format
2639 # @ref tui_todo "Example"
2640 def ImportBREP(self,theFileName):
2641 # Example: see GEOM_TestOthers.py
2642 return self.Import(theFileName, "BREP")
2644 ## Shortcut to Import() for IGES format
2646 # @ref tui_todo "Example"
2647 def ImportIGES(self,theFileName):
2648 # Example: see GEOM_TestOthers.py
2649 return self.Import(theFileName, "IGES")
2651 ## Shortcut to Import() for STEP format
2653 # @ref tui_todo "Example"
2654 def ImportSTEP(self,theFileName):
2655 # Example: see GEOM_TestOthers.py
2656 return self.Import(theFileName, "STEP")
2658 ## Export the given shape into a file with given name.
2659 # @param theObject Shape to be stored in the file.
2660 # @param theFileName Name of the file to store the given shape in.
2661 # @param theFormatName Specify format for the shape storage.
2662 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2664 # @ref tui_todo "Example"
2665 def Export(self,theObject, theFileName, theFormatName):
2666 # Example: see GEOM_TestOthers.py
2667 self.InsertOp.Export(theObject, theFileName, theFormatName)
2668 if self.InsertOp.IsDone() == 0:
2669 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
2673 ## Shortcut to Export() for BREP format
2675 # @ref tui_todo "Example"
2676 def ExportBREP(self,theObject, theFileName):
2677 # Example: see GEOM_TestOthers.py
2678 return self.Export(theObject, theFileName, "BREP")
2680 ## Shortcut to Export() for IGES format
2682 # @ref tui_todo "Example"
2683 def ExportIGES(self,theObject, theFileName):
2684 # Example: see GEOM_TestOthers.py
2685 return self.Export(theObject, theFileName, "IGES")
2687 ## Shortcut to Export() for STEP format
2689 # @ref tui_todo "Example"
2690 def ExportSTEP(self,theObject, theFileName):
2691 # Example: see GEOM_TestOthers.py
2692 return self.Export(theObject, theFileName, "STEP")
2694 # end of l2_import_export
2697 ## @addtogroup l3_blocks
2700 ## Create a quadrangle face from four edges. Order of Edges is not
2701 # important. It is not necessary that edges share the same vertex.
2702 # @param E1,E2,E3,E4 Edges for the face bound.
2703 # @return New GEOM_Object, containing the created face.
2705 # @ref tui_building_by_blocks_page "Example"
2706 def MakeQuad(self,E1, E2, E3, E4):
2707 # Example: see GEOM_Spanner.py
2708 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
2709 RaiseIfFailed("MakeQuad", self.BlocksOp)
2712 ## Create a quadrangle face on two edges.
2713 # The missing edges will be built by creating the shortest ones.
2714 # @param E1,E2 Two opposite edges for the face.
2715 # @return New GEOM_Object, containing the created face.
2717 # @ref tui_building_by_blocks_page "Example"
2718 def MakeQuad2Edges(self,E1, E2):
2719 # Example: see GEOM_Spanner.py
2720 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
2721 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
2724 ## Create a quadrangle face with specified corners.
2725 # The missing edges will be built by creating the shortest ones.
2726 # @param V1,V2,V3,V4 Corner vertices for the face.
2727 # @return New GEOM_Object, containing the created face.
2729 # @ref tui_building_by_blocks_page "Example"
2730 def MakeQuad4Vertices(self,V1, V2, V3, V4):
2731 # Example: see GEOM_Spanner.py
2732 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
2733 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
2736 ## Create a hexahedral solid, bounded by the six given faces. Order of
2737 # faces is not important. It is not necessary that Faces share the same edge.
2738 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
2739 # @return New GEOM_Object, containing the created solid.
2741 # @ref tui_building_by_blocks_page "Example"
2742 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
2743 # Example: see GEOM_Spanner.py
2744 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
2745 RaiseIfFailed("MakeHexa", self.BlocksOp)
2748 ## Create a hexahedral solid between two given faces.
2749 # The missing faces will be built by creating the smallest ones.
2750 # @param F1,F2 Two opposite faces for the hexahedral solid.
2751 # @return New GEOM_Object, containing the created solid.
2753 # @ref tui_building_by_blocks_page "Example"
2754 def MakeHexa2Faces(self,F1, F2):
2755 # Example: see GEOM_Spanner.py
2756 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
2757 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
2763 ## @addtogroup l3_blocks_op
2766 ## Get a vertex, found in the given shape by its coordinates.
2767 # @param theShape Block or a compound of blocks.
2768 # @param theX,theY,theZ Coordinates of the sought vertex.
2769 # @param theEpsilon Maximum allowed distance between the resulting
2770 # vertex and point with the given coordinates.
2771 # @return New GEOM_Object, containing the found vertex.
2773 # @ref tui_todo "Example"
2774 def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
2775 # Example: see GEOM_TestOthers.py
2776 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
2777 RaiseIfFailed("GetPoint", self.BlocksOp)
2780 ## Get an edge, found in the given shape by two given vertices.
2781 # @param theShape Block or a compound of blocks.
2782 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
2783 # @return New GEOM_Object, containing the found edge.
2785 # @ref tui_todo "Example"
2786 def GetEdge(self,theShape, thePoint1, thePoint2):
2787 # Example: see GEOM_Spanner.py
2788 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
2789 RaiseIfFailed("GetEdge", self.BlocksOp)
2792 ## Find an edge of the given shape, which has minimal distance to the given point.
2793 # @param theShape Block or a compound of blocks.
2794 # @param thePoint Point, close to the desired edge.
2795 # @return New GEOM_Object, containing the found edge.
2797 # @ref tui_todo "Example"
2798 def GetEdgeNearPoint(self,theShape, thePoint):
2799 # Example: see GEOM_TestOthers.py
2800 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
2801 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
2804 ## Returns a face, found in the given shape by four given corner vertices.
2805 # @param theShape Block or a compound of blocks.
2806 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
2807 # @return New GEOM_Object, containing the found face.
2809 # @ref tui_todo "Example"
2810 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
2811 # Example: see GEOM_Spanner.py
2812 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
2813 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
2816 ## Get a face of block, found in the given shape by two given edges.
2817 # @param theShape Block or a compound of blocks.
2818 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
2819 # @return New GEOM_Object, containing the found face.
2821 # @ref tui_todo "Example"
2822 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
2823 # Example: see GEOM_Spanner.py
2824 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
2825 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
2828 ## Find a face, opposite to the given one in the given block.
2829 # @param theBlock Must be a hexahedral solid.
2830 # @param theFace Face of \a theBlock, opposite to the desired face.
2831 # @return New GEOM_Object, containing the found face.
2833 # @ref tui_todo "Example"
2834 def GetOppositeFace(self,theBlock, theFace):
2835 # Example: see GEOM_Spanner.py
2836 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
2837 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
2840 ## Find a face of the given shape, which has minimal distance to the given point.
2841 # @param theShape Block or a compound of blocks.
2842 # @param thePoint Point, close to the desired face.
2843 # @return New GEOM_Object, containing the found face.
2845 # @ref tui_todo "Example"
2846 def GetFaceNearPoint(self,theShape, thePoint):
2847 # Example: see GEOM_Spanner.py
2848 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
2849 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
2852 ## Find a face of block, whose outside normale has minimal angle with the given vector.
2853 # @param theBlock Block or a compound of blocks.
2854 # @param theVector Vector, close to the normale of the desired face.
2855 # @return New GEOM_Object, containing the found face.
2857 # @ref tui_todo "Example"
2858 def GetFaceByNormale(self, theBlock, theVector):
2859 # Example: see GEOM_Spanner.py
2860 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
2861 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
2864 # end of l3_blocks_op
2867 ## @addtogroup l4_blocks_measure
2870 ## Check, if the compound of blocks is given.
2871 # To be considered as a compound of blocks, the
2872 # given shape must satisfy the following conditions:
2873 # - Each element of the compound should be a Block (6 faces and 12 edges).
2874 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
2875 # - The compound should be connexe.
2876 # - The glue between two quadrangle faces should be applied.
2877 # @param theCompound The compound to check.
2878 # @return TRUE, if the given shape is a compound of blocks.
2879 # If theCompound is not valid, prints all discovered errors.
2881 # @ref tui_measurement_tools_page "Example"
2882 def CheckCompoundOfBlocks(self,theCompound):
2883 # Example: see GEOM_Spanner.py
2884 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
2885 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
2887 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
2891 ## Remove all seam and degenerated edges from \a theShape.
2892 # Unite faces and edges, sharing one surface. It means that
2893 # this faces must have references to one C++ surface object (handle).
2894 # @param theShape The compound or single solid to remove irregular edges from.
2895 # @return Improved shape.
2897 # @ref tui_todo "Example"
2898 def RemoveExtraEdges(self,theShape):
2899 # Example: see GEOM_TestOthers.py
2900 anObj = self.BlocksOp.RemoveExtraEdges(theShape)
2901 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
2904 ## Check, if the given shape is a blocks compound.
2905 # Fix all detected errors.
2906 # \note Single block can be also fixed by this method.
2907 # @param theShape The compound to check and improve.
2908 # @return Improved compound.
2910 # @ref tui_todo "Example"
2911 def CheckAndImprove(self,theShape):
2912 # Example: see GEOM_TestOthers.py
2913 anObj = self.BlocksOp.CheckAndImprove(theShape)
2914 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
2917 # end of l4_blocks_measure
2920 ## @addtogroup l3_blocks_op
2923 ## Get all the blocks, contained in the given compound.
2924 # @param theCompound The compound to explode.
2925 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
2926 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
2927 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
2928 # @return List of GEOM_Objects, containing the retrieved blocks.
2930 # @ref tui_explode_on_blocks "Example"
2931 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
2932 # Example: see GEOM_TestOthers.py
2933 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
2934 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
2937 ## Find block, containing the given point inside its volume or on boundary.
2938 # @param theCompound Compound, to find block in.
2939 # @param thePoint Point, close to the desired block. If the point lays on
2940 # boundary between some blocks, we return block with nearest center.
2941 # @return New GEOM_Object, containing the found block.
2943 # @ref tui_todo "Example"
2944 def GetBlockNearPoint(self,theCompound, thePoint):
2945 # Example: see GEOM_Spanner.py
2946 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
2947 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
2950 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
2951 # @param theCompound Compound, to find block in.
2952 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
2953 # @return New GEOM_Object, containing the found block.
2955 # @ref tui_todo "Example"
2956 def GetBlockByParts(self,theCompound, theParts):
2957 # Example: see GEOM_TestOthers.py
2958 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
2959 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
2962 ## Return all blocks, containing all the elements, passed as the parts.
2963 # @param theCompound Compound, to find blocks in.
2964 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
2965 # @return List of GEOM_Objects, containing the found blocks.
2967 # @ref tui_todo "Example"
2968 def GetBlocksByParts(self,theCompound, theParts):
2969 # Example: see GEOM_Spanner.py
2970 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
2971 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
2974 ## Multi-transformate block and glue the result.
2975 # Transformation is defined so, as to superpose direction faces.
2976 # @param Block Hexahedral solid to be multi-transformed.
2977 # @param DirFace1 ID of First direction face.
2978 # @param DirFace2 ID of Second direction face.
2979 # @param NbTimes Quantity of transformations to be done.
2980 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
2981 # @return New GEOM_Object, containing the result shape.
2983 # @ref tui_multi_transformation "Example"
2984 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
2985 # Example: see GEOM_Spanner.py
2986 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
2987 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
2990 ## Multi-transformate block and glue the result.
2991 # @param Block Hexahedral solid to be multi-transformed.
2992 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
2993 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
2994 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
2995 # @return New GEOM_Object, containing the result shape.
2997 # @ref tui_multi_transformation "Example"
2998 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
2999 DirFace1V, DirFace2V, NbTimesV):
3000 # Example: see GEOM_Spanner.py
3001 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
3002 DirFace1V, DirFace2V, NbTimesV)
3003 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
3006 ## Build all possible propagation groups.
3007 # Propagation group is a set of all edges, opposite to one (main)
3008 # edge of this group directly or through other opposite edges.
3009 # Notion of Opposite Edge make sence only on quadrangle face.
3010 # @param theShape Shape to build propagation groups on.
3011 # @return List of GEOM_Objects, each of them is a propagation group.
3013 # @ref tui_propagate "Example"
3014 def Propagate(self,theShape):
3015 # Example: see GEOM_TestOthers.py
3016 listChains = self.BlocksOp.Propagate(theShape)
3017 RaiseIfFailed("Propagate", self.BlocksOp)
3020 # end of l3_blocks_op
3023 ## @addtogroup l3_groups
3026 ## Creates a new group which will store sub shapes of theMainShape
3027 # @param theMainShape is a GEOM object on which the group is selected
3028 # @param theShapeType defines a shape type of the group
3029 # @return a newly created GEOM group
3031 # @ref tui_working_with_groups_page "Example"
3032 def CreateGroup(self,theMainShape, theShapeType):
3033 # Example: see GEOM_TestOthers.py
3034 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
3035 RaiseIfFailed("CreateGroup", self.GroupOp)
3038 ## Adds a sub object with ID theSubShapeId to the group
3039 # @param theGroup is a GEOM group to which the new sub shape is added
3040 # @param theSubShapeID is a sub shape ID in the main object.
3041 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3043 # @ref tui_working_with_groups_page "Example"
3044 def AddObject(self,theGroup, theSubShapeID):
3045 # Example: see GEOM_TestOthers.py
3046 self.GroupOp.AddObject(theGroup, theSubShapeID)
3047 RaiseIfFailed("AddObject", self.GroupOp)
3050 ## Removes a sub object with ID \a theSubShapeId from the group
3051 # @param theGroup is a GEOM group from which the new sub shape is removed
3052 # @param theSubShapeID is a sub shape ID in the main object.
3053 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3055 # @ref tui_working_with_groups_page "Example"
3056 def RemoveObject(self,theGroup, theSubShapeID):
3057 # Example: see GEOM_TestOthers.py
3058 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
3059 RaiseIfFailed("RemoveObject", self.GroupOp)
3062 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
3063 # @param theGroup is a GEOM group to which the new sub shapes are added.
3064 # @param theSubShapes is a list of sub shapes to be added.
3066 # @ref tui_working_with_groups_page "Example"
3067 def UnionList (self,theGroup, theSubShapes):
3068 # Example: see GEOM_TestOthers.py
3069 self.GroupOp.UnionList(theGroup, theSubShapes)
3070 RaiseIfFailed("UnionList", self.GroupOp)
3073 ## Works like the above method, but argument
3074 # theSubShapes here is a list of sub-shapes indices
3076 # @ref tui_todo "Example"
3077 def UnionIDs(self,theGroup, theSubShapes):
3078 # Example: see GEOM_TestOthers.py
3079 self.GroupOp.UnionIDs(theGroup, theSubShapes)
3080 RaiseIfFailed("UnionIDs", self.GroupOp)
3083 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
3084 # @param theGroup is a GEOM group from which the sub-shapes are removed.
3085 # @param theSubShapes is a list of sub-shapes to be removed.
3087 # @ref tui_working_with_groups_page "Example"
3088 def DifferenceList (self,theGroup, theSubShapes):
3089 # Example: see GEOM_TestOthers.py
3090 self.GroupOp.DifferenceList(theGroup, theSubShapes)
3091 RaiseIfFailed("DifferenceList", self.GroupOp)
3094 ## Works like the above method, but argument
3095 # theSubShapes here is a list of sub-shapes indices
3097 # @ref tui_todo "Example"
3098 def DifferenceIDs(self,theGroup, theSubShapes):
3099 # Example: see GEOM_TestOthers.py
3100 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
3101 RaiseIfFailed("DifferenceIDs", self.GroupOp)
3104 ## Returns a list of sub objects ID stored in the group
3105 # @param theGroup is a GEOM group for which a list of IDs is requested
3107 # @ref tui_todo "Example"
3108 def GetObjectIDs(self,theGroup):
3109 # Example: see GEOM_TestOthers.py
3110 ListIDs = self.GroupOp.GetObjects(theGroup)
3111 RaiseIfFailed("GetObjects", self.GroupOp)
3114 ## Returns a type of sub objects stored in the group
3115 # @param theGroup is a GEOM group which type is returned.
3117 # @ref tui_todo "Example"
3118 def GetType(self,theGroup):
3119 # Example: see GEOM_TestOthers.py
3120 aType = self.GroupOp.GetType(theGroup)
3121 RaiseIfFailed("GetType", self.GroupOp)
3124 ## Returns a main shape associated with the group
3125 # @param theGroup is a GEOM group for which a main shape object is requested
3126 # @return a GEOM object which is a main shape for theGroup
3128 # @ref tui_todo "Example"
3129 def GetMainShape(self,theGroup):
3130 # Example: see GEOM_TestOthers.py
3131 anObj = self.GroupOp.GetMainShape(theGroup)
3132 RaiseIfFailed("GetMainShape", self.GroupOp)
3135 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
3136 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3138 # @ref tui_todo "Example"
3139 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
3140 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
3143 Props = self.BasicProperties(edge)
3144 if min_length <= Props[0] and Props[0] <= max_length:
3145 if (not include_min) and (min_length == Props[0]):
3148 if (not include_max) and (Props[0] == max_length):
3151 edges_in_range.append(edge)
3153 if len(edges_in_range) <= 0:
3154 print "No edges found by given criteria"
3157 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
3158 self.UnionList(group_edges, edges_in_range)
3162 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
3163 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3165 # @ref tui_todo "Example"
3166 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
3167 nb_selected = sg.SelectedCount()
3169 print "Select a shape before calling this function, please."
3172 print "Only one shape must be selected"
3175 id_shape = sg.getSelected(0)
3176 shape = IDToObject( id_shape )
3178 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
3182 if include_min: left_str = " <= "
3183 if include_max: right_str = " <= "
3185 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
3186 + left_str + "length" + right_str + `max_length`)
3188 sg.updateObjBrowser(1)
3195 ## Create a copy of the given object
3196 # @ingroup l1_geompy_auxiliary
3198 # @ref tui_todo "Example"
3199 def MakeCopy(self,theOriginal):
3200 # Example: see GEOM_TestAll.py
3201 anObj = self.InsertOp.MakeCopy(theOriginal)
3202 RaiseIfFailed("MakeCopy", self.InsertOp)
3205 ## Add Path to load python scripts from
3206 # @ingroup l1_geompy_auxiliary
3207 def addPath(self,Path):
3208 if (sys.path.count(Path) < 1):
3209 sys.path.append(Path)
3212 #Register the new proxy for GEOM_Gen
3213 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)