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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 # Author : Paul RASCLE, EDF
37 g = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
38 geom = g._narrow( GEOM.GEOM_Gen )
39 myBuilder = myStudy.NewBuilder()
41 father = myStudy.FindComponent("GEOM")
43 father = myBuilder.NewComponent("GEOM")
44 A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName")
45 FName = A1._narrow(SALOMEDS.AttributeName)
46 FName.SetValue("Geometry")
47 A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap")
48 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
49 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
50 myBuilder.DefineComponentInstance(father,geom)
52 gg = ImportComponentGUI("GEOM")
55 * Get name for sub-shape aSubObj of shape aMainObj
57 * Example: see GEOM_TestAll.py
59 def SubShapeName(aSubObj, aMainObj):
60 aSubId = orb.object_to_string(aSubObj)
61 aMainId = orb.object_to_string(aMainObj)
62 index = gg.getIndexTopology(aSubId, aMainId)
63 name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
67 * Publish in study aShape with name aName
69 * Example: see GEOM_TestAll.py
71 def addToStudy(aShape, aName):
73 aSObject = geom.AddInStudy(myStudy, aShape, aName, None)
75 print "addToStudy() failed"
77 return aShape.GetStudyEntry()
80 * Publish in study aShape with name aName as sub-object of previously published aFather
82 * Example: see GEOM_TestAll.py
84 def addToStudyInFather(aFather, aShape, aName):
86 aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather)
88 print "addToStudyInFather() failed"
90 return aShape.GetStudyEntry()
92 # -----------------------------------------------------------------------------
93 # enumeration ShapeType as a dictionary
94 # -----------------------------------------------------------------------------
96 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
98 # -----------------------------------------------------------------------------
99 # Get Operations Interfaces
100 # -----------------------------------------------------------------------------
102 BasicOp = geom.GetIBasicOperations (myStudyId)
103 CurvesOp = geom.GetICurvesOperations (myStudyId)
104 PrimOp = geom.GetI3DPrimOperations (myStudyId)
105 ShapesOp = geom.GetIShapesOperations (myStudyId)
106 HealOp = geom.GetIHealingOperations (myStudyId)
107 InsertOp = geom.GetIInsertOperations (myStudyId)
108 BoolOp = geom.GetIBooleanOperations (myStudyId)
109 TrsfOp = geom.GetITransformOperations(myStudyId)
110 LocalOp = geom.GetILocalOperations (myStudyId)
111 MeasuOp = geom.GetIMeasureOperations (myStudyId)
112 BlocksOp = geom.GetIBlocksOperations (myStudyId)
113 GroupOp = geom.GetIGroupOperations (myStudyId)
115 # -----------------------------------------------------------------------------
117 # -----------------------------------------------------------------------------
120 * Create point by three coordinates.
121 * \param theX The X coordinate of the point.
122 * \param theY The Y coordinate of the point.
123 * \param theZ The Z coordinate of the point.
124 * \return New GEOM_Object, containing the created point.
126 * Example: see GEOM_TestAll.py
128 def MakeVertex(theX, theY, theZ):
129 anObj = BasicOp.MakePointXYZ(theX, theY, theZ)
130 if BasicOp.IsDone() == 0:
131 print "MakePointXYZ : ", BasicOp.GetErrorCode()
135 * Create a point, distant from the referenced point
136 * on the given distances along the coordinate axes.
137 * \param theReference The referenced point.
138 * \param theX Displacement from the referenced point along OX axis.
139 * \param theY Displacement from the referenced point along OY axis.
140 * \param theZ Displacement from the referenced point along OZ axis.
141 * \return New GEOM_Object, containing the created point.
143 * Example: see GEOM_TestAll.py
145 def MakeVertexWithRef(theReference, theX, theY, theZ):
146 anObj = BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
147 if BasicOp.IsDone() == 0:
148 print "MakePointWithReference : ", BasicOp.GetErrorCode()
152 * Create a point, corresponding to the given parameter on the given curve.
153 * \param theRefCurve The referenced curve.
154 * \param theParameter Value of parameter on the referenced curve.
155 * \return New GEOM_Object, containing the created point.
157 * Example: see GEOM_TestAll.py
159 def MakeVertexOnCurve(theRefCurve, theParameter):
160 anObj = BasicOp.MakePointOnCurve(theRefCurve, theParameter)
161 if BasicOp.IsDone() == 0:
162 print "MakePointOnCurve : ", BasicOp.GetErrorCode()
166 * Create a vector with the given components.
167 * \param theDX X component of the vector.
168 * \param theDY Y component of the vector.
169 * \param theDZ Z component of the vector.
170 * \return New GEOM_Object, containing the created vector.
172 * Example: see GEOM_TestAll.py
174 def MakeVectorDXDYDZ(theDX, theDY, theDZ):
175 anObj = BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
176 if BasicOp.IsDone() == 0:
177 print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode()
181 * Create a vector between two points.
182 * \param thePnt1 Start point for the vector.
183 * \param thePnt2 End point for the vector.
184 * \return New GEOM_Object, containing the created vector.
186 * Example: see GEOM_TestAll.py
188 def MakeVector(thePnt1, thePnt2):
189 anObj = BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
190 if BasicOp.IsDone() == 0:
191 print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode()
195 * Create a line, passing through the given point
196 * and parrallel to the given direction
197 * \param thePnt Point. The resulting line will pass through it.
198 * \param theDir Direction. The resulting line will be parallel to it.
199 * \return New GEOM_Object, containing the created line.
201 * Example: see GEOM_TestAll.py
203 def MakeLine(thePnt, theDir):
204 anObj = BasicOp.MakeLine(thePnt, theDir)
205 if BasicOp.IsDone() == 0:
206 print "MakeLine : ", BasicOp.GetErrorCode()
210 * Create a line, passing through the given points
211 * \param thePnt1 First of two points, defining the line.
212 * \param thePnt2 Second of two points, defining the line.
213 * \return New GEOM_Object, containing the created line.
215 * Example: see GEOM_TestAll.py
217 def MakeLineTwoPnt(thePnt1, thePnt2):
218 anObj = BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
219 if BasicOp.IsDone() == 0:
220 print "MakeLineTwoPnt : ", BasicOp.GetErrorCode()
224 * Create a plane, passing through the given point
225 * and normal to the given vector.
226 * \param thePnt Point, the plane has to pass through.
227 * \param theVec Vector, defining the plane normal direction.
228 * \param theTrimSize Half size of a side of quadrangle face, representing the plane.
229 * \return New GEOM_Object, containing the created plane.
231 * Example: see GEOM_TestAll.py
233 def MakePlane(thePnt, theVec, theTrimSize):
234 anObj = BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
235 if BasicOp.IsDone() == 0:
236 print "MakePlanePntVec : ", BasicOp.GetErrorCode()
240 * Create a plane, passing through the three given points
241 * \param thePnt1 First of three points, defining the plane.
242 * \param thePnt2 Second of three points, defining the plane.
243 * \param thePnt3 Fird of three points, defining the plane.
244 * \param theTrimSize Half size of a side of quadrangle face, representing the plane.
245 * \return New GEOM_Object, containing the created plane.
247 * Example: see GEOM_TestAll.py
249 def MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize):
250 anObj = BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
251 if BasicOp.IsDone() == 0:
252 print "MakePlaneThreePnt : ", BasicOp.GetErrorCode()
256 * Create a plane, similar to the existing one, but with another size of representing face.
257 * \param theFace Referenced plane.
258 * \param theTrimSize New half size of a side of quadrangle face, representing the plane.
259 * \return New GEOM_Object, containing the created plane.
261 * Example: see GEOM_TestAll.py
263 def MakePlaneFace(theFace, theTrimSize):
264 anObj = BasicOp.MakePlaneFace(theFace, theTrimSize)
265 if BasicOp.IsDone() == 0:
266 print "MakePlaneFace : ", BasicOp.GetErrorCode()
270 * Create a local coordinate system.
271 * \param OX,OY,OZ Three coordinates of coordinate system origin.
272 * \param XDX,XDY,XDZ Three components of OX direction
273 * \param YDX,YDY,YDZ Three components of OY direction
274 * \return New GEOM_Object, containing the created coordinate system.
276 * Example: see GEOM_TestAll.py
278 def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
279 anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
280 if BasicOp.IsDone() == 0:
281 print "MakeMarker : ", BasicOp.GetErrorCode()
284 # -----------------------------------------------------------------------------
286 # -----------------------------------------------------------------------------
289 * Create an arc of circle, passing through three given points.
290 * \param thePnt1 Start point of the arc.
291 * \param thePnt2 Middle point of the arc.
292 * \param thePnt3 End point of the arc.
293 * \return New GEOM_Object, containing the created arc.
295 * Example: see GEOM_TestAll.py
297 def MakeArc(thePnt1, thePnt2, thePnt3):
298 anObj = CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
299 if CurvesOp.IsDone() == 0:
300 print "MakeArc : ", CurvesOp.GetErrorCode()
304 * Create a circle with given center, normal vector and radius.
305 * \param thePnt Circle center.
306 * \param theVec Vector, normal to the plane of the circle.
307 * \param theR Circle radius.
308 * \return New GEOM_Object, containing the created circle.
310 * Example: see GEOM_TestAll.py
312 def MakeCircle(thePnt, theVec, theR):
313 anObj = CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
314 if CurvesOp.IsDone() == 0:
315 print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode()
319 * Create a circle, passing through three given points
320 * \param thePnt1,thePnt2,thePnt3 Points, defining the circle.
321 * \return New GEOM_Object, containing the created circle.
323 * Example: see GEOM_TestAll.py
325 def MakeCircleThreePnt(thePnt1, thePnt2, thePnt3):
326 anObj = CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
327 if CurvesOp.IsDone() == 0:
328 print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
332 * Create an ellipse with given center, normal vector and radiuses.
333 * \param thePnt Ellipse center.
334 * \param theVec Vector, normal to the plane of the ellipse.
335 * \param theRMajor Major ellipse radius.
336 * \param theRMinor Minor ellipse radius.
337 * \return New GEOM_Object, containing the created ellipse.
339 * Example: see GEOM_TestAll.py
341 def MakeEllipse(thePnt, theVec, theRMajor, theRMinor):
342 anObj = CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
343 if CurvesOp.IsDone() == 0:
344 print "MakeEllipse : ", CurvesOp.GetErrorCode()
348 * Create a polyline on the set of points.
349 * \param thePoints Sequence of points for the polyline.
350 * \return New GEOM_Object, containing the created polyline.
352 * Example: see GEOM_TestAll.py
354 def MakePolyline(thePoints):
355 anObj = CurvesOp.MakePolyline(thePoints)
356 if CurvesOp.IsDone() == 0:
357 print "MakePolyline : ", CurvesOp.GetErrorCode()
361 * Create bezier curve on the set of points.
362 * \param thePoints Sequence of points for the bezier curve.
363 * \return New GEOM_Object, containing the created bezier curve.
365 * Example: see GEOM_TestAll.py
367 def MakeBezier(thePoints):
368 anObj = CurvesOp.MakeSplineBezier(thePoints)
369 if CurvesOp.IsDone() == 0:
370 print "MakeSplineBezier : ", CurvesOp.GetErrorCode()
374 * Create B-Spline curve on the set of points.
375 * \param thePoints Sequence of points for the B-Spline curve.
376 * \return New GEOM_Object, containing the created B-Spline curve.
378 * Example: see GEOM_TestAll.py
380 def MakeInterpol(thePoints):
381 anObj = CurvesOp.MakeSplineInterpolation(thePoints)
382 if CurvesOp.IsDone() == 0:
383 print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode()
387 * Create a sketcher (wire or face), following the textual description,
388 * passed through \a theCommand argument. \n
389 * Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
390 * Format of the description string have to be the following:
392 * "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
395 * - x1, y1 are coordinates of the first sketcher point (zero by default),
397 * - "R angle" : Set the direction by angle
398 * - "D dx dy" : Set the direction by DX & DY
401 * - "TT x y" : Create segment by point at X & Y
402 * - "T dx dy" : Create segment by point with DX & DY
403 * - "L length" : Create segment by direction & Length
404 * - "IX x" : Create segment by direction & Intersect. X
405 * - "IY y" : Create segment by direction & Intersect. Y
408 * - "C radius length" : Create arc by direction, radius and length(in degree)
411 * - "WW" : Close Wire (to finish)
412 * - "WF" : Close Wire and build face (to finish)
414 * \param theCommand String, defining the sketcher in local
415 * coordinates of the working plane.
416 * \param theWorkingPlane Nine double values, defining origin,
417 * OZ and OX directions of the working plane.
418 * \return New GEOM_Object, containing the created wire.
420 * Example: see GEOM_TestAll.py
422 def MakeSketcher(theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
423 anObj = CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
424 if CurvesOp.IsDone() == 0:
425 print "MakeSketcher : ", CurvesOp.GetErrorCode()
428 # -----------------------------------------------------------------------------
429 # Create 3D Primitives
430 # -----------------------------------------------------------------------------
433 * Create a box by coordinates of two opposite vertices.
435 * Example: see GEOM_TestAll.py
437 def MakeBox(x1,y1,z1,x2,y2,z2):
438 pnt1 = MakeVertex(x1,y1,z1)
439 pnt2 = MakeVertex(x2,y2,z2)
440 return MakeBoxTwoPnt(pnt1,pnt2)
443 * Create a box with specified dimensions along the coordinate axes
444 * and with edges, parallel to the coordinate axes.
445 * Center of the box will be at point (DX/2, DY/2, DZ/2).
446 * \param theDX Length of Box edges, parallel to OX axis.
447 * \param theDY Length of Box edges, parallel to OY axis.
448 * \param theDZ Length of Box edges, parallel to OZ axis.
449 * \return New GEOM_Object, containing the created box.
451 * Example: see GEOM_TestAll.py
453 def MakeBoxDXDYDZ(theDX, theDY, theDZ):
454 anObj = PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
455 if PrimOp.IsDone() == 0:
456 print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode()
460 * Create a box with two specified opposite vertices,
461 * and with edges, parallel to the coordinate axes
462 * \param thePnt1 First of two opposite vertices.
463 * \param thePnt2 Second of two opposite vertices.
464 * \return New GEOM_Object, containing the created box.
466 * Example: see GEOM_TestAll.py
468 def MakeBoxTwoPnt(thePnt1, thePnt2):
469 anObj = PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
470 if PrimOp.IsDone() == 0:
471 print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode()
475 * Create a cylinder with given base point, axis, radius and height.
476 * \param thePnt Central point of cylinder base.
477 * \param theAxis Cylinder axis.
478 * \param theR Cylinder radius.
479 * \param theH Cylinder height.
480 * \return New GEOM_Object, containing the created cylinder.
482 * Example: see GEOM_TestAll.py
484 def MakeCylinder(thePnt, theAxis, theR, theH):
485 anObj = PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
486 if PrimOp.IsDone() == 0:
487 print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode()
491 * Create a cylinder with given radius and height at
492 * the origin of coordinate system. Axis of the cylinder
493 * will be collinear to the OZ axis of the coordinate system.
494 * \param theR Cylinder radius.
495 * \param theH Cylinder height.
496 * \return New GEOM_Object, containing the created cylinder.
498 * Example: see GEOM_TestAll.py
500 def MakeCylinderRH(theR, theH):
501 anObj = PrimOp.MakeCylinderRH(theR, theH)
502 if PrimOp.IsDone() == 0:
503 print "MakeCylinderRH : ", PrimOp.GetErrorCode()
507 * Create a sphere with given center and radius.
508 * \param thePnt Sphere center.
509 * \param theR Sphere radius.
510 * \return New GEOM_Object, containing the created sphere.
512 * Example: see GEOM_TestAll.py
514 def MakeSpherePntR(thePnt, theR):
515 anObj = PrimOp.MakeSpherePntR(thePnt, theR)
516 if PrimOp.IsDone() == 0:
517 print "MakeSpherePntR : ", PrimOp.GetErrorCode()
521 * Create a sphere with given center and radius.
522 * \param x,y,z Coordinates of sphere center.
523 * \param theR Sphere radius.
524 * \return New GEOM_Object, containing the created sphere.
526 * Example: see GEOM_TestAll.py
528 def MakeSphere(x, y, z, theR):
529 point = MakeVertex(x, y, z)
530 anObj = MakeSpherePntR(point, theR)
534 * Create a sphere with given radius at the origin of coordinate system.
535 * \param theR Sphere radius.
536 * \return New GEOM_Object, containing the created sphere.
538 * Example: see GEOM_TestAll.py
540 def MakeSphereR(theR):
541 anObj = PrimOp.MakeSphereR(theR)
542 if PrimOp.IsDone() == 0:
543 print "MakeSphereR : ", PrimOp.GetErrorCode()
547 * Create a cone with given base point, axis, height and radiuses.
548 * \param thePnt Central point of the first cone base.
549 * \param theAxis Cone axis.
550 * \param theR1 Radius of the first cone base.
551 * \param theR2 Radius of the second cone base.
552 * \note If both radiuses are non-zero, the cone will be truncated.
553 * \note If the radiuses are equal, a cylinder will be created instead.
554 * \param theH Cone height.
555 * \return New GEOM_Object, containing the created cone.
557 * Example: see GEOM_TestAll.py
559 def MakeCone(thePnt, theAxis, theR1, theR2, theH):
560 anObj = PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
561 if PrimOp.IsDone() == 0:
562 print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode()
566 * Create a cone with given height and radiuses at
567 * the origin of coordinate system. Axis of the cone will
568 * be collinear to the OZ axis of the coordinate system.
569 * \param theR1 Radius of the first cone base.
570 * \param theR2 Radius of the second cone base.
571 * \note If both radiuses are non-zero, the cone will be truncated.
572 * \note If the radiuses are equal, a cylinder will be created instead.
573 * \param theH Cone height.
574 * \return New GEOM_Object, containing the created cone.
576 * Example: see GEOM_TestAll.py
578 def MakeConeR1R2H(theR1, theR2, theH):
579 anObj = PrimOp.MakeConeR1R2H(theR1, theR2, theH)
580 if PrimOp.IsDone() == 0:
581 print "MakeConeR1R2H : ", PrimOp.GetErrorCode()
585 * Create a torus with given center, normal vector and radiuses.
586 * \param thePnt Torus central point.
587 * \param theVec Torus axis of symmetry.
588 * \param theRMajor Torus major radius.
589 * \param theRMinor Torus minor radius.
590 * \return New GEOM_Object, containing the created torus.
592 * Example: see GEOM_TestAll.py
594 def MakeTorus(thePnt, theVec, theRMajor, theRMinor):
595 anObj = PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
596 if PrimOp.IsDone() == 0:
597 print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode()
601 * Create a torus with given radiuses at the origin of coordinate system.
602 * \param theRMajor Torus major radius.
603 * \param theRMinor Torus minor radius.
604 * \return New GEOM_Object, containing the created torus.
606 * Example: see GEOM_TestAll.py
608 def MakeTorusRR(theRMajor, theRMinor):
609 anObj = PrimOp.MakeTorusRR(theRMajor, theRMinor)
610 if PrimOp.IsDone() == 0:
611 print "MakeTorusRR : ", PrimOp.GetErrorCode()
615 * Create a shape by extrusion of the base shape along a vector, defined by two points.
616 * \param theBase Base shape to be extruded.
617 * \param thePoint1 First end of extrusion vector.
618 * \param thePoint2 Second end of extrusion vector.
619 * \return New GEOM_Object, containing the created prism.
621 * Example: see GEOM_TestAll.py
623 def MakePrism(theBase, thePoint1, thePoint2):
624 anObj = PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
625 if PrimOp.IsDone() == 0:
626 print "MakePrismTwoPnt : ", PrimOp.GetErrorCode()
630 * Create a shape by extrusion of the base shape along the vector,
631 * i.e. all the space, transfixed by the base shape during its translation
632 * along the vector on the given distance.
633 * \param theBase Base shape to be extruded.
634 * \param theVec Direction of extrusion.
635 * \param theH Prism dimension along theVec.
636 * \return New GEOM_Object, containing the created prism.
638 * Example: see GEOM_TestAll.py
640 def MakePrismVecH(theBase, theVec, theH):
641 anObj = PrimOp.MakePrismVecH(theBase, theVec, theH)
642 if PrimOp.IsDone() == 0:
643 print "MakePrismVecH : ", PrimOp.GetErrorCode()
647 * Create a shape by extrusion of the base shape along
648 * the path shape. The path shape can be a wire or an edge.
649 * \param theBase Base shape to be extruded.
650 * \param thePath Path shape to extrude the base shape along it.
651 * \return New GEOM_Object, containing the created pipe.
653 * Example: see GEOM_TestAll.py
655 def MakePipe(theBase, thePath):
656 anObj = PrimOp.MakePipe(theBase, thePath)
657 if PrimOp.IsDone() == 0:
658 print "MakePipe : ", PrimOp.GetErrorCode()
662 * Create a shape by revolution of the base shape around the axis
663 * on the given angle, i.e. all the space, transfixed by the base
664 * shape during its rotation around the axis on the given angle.
665 * \param theBase Base shape to be rotated.
666 * \param theAxis Rotation axis.
667 * \param theAngle Rotation angle in radians.
668 * \return New GEOM_Object, containing the created revolution.
670 * Example: see GEOM_TestAll.py
672 def MakeRevolution(theBase, theAxis, theAngle):
673 anObj = PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
674 if PrimOp.IsDone() == 0:
675 print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
678 # -----------------------------------------------------------------------------
680 # -----------------------------------------------------------------------------
683 * Create a linear edge with specified ends.
684 * \param thePnt1 Point for the first end of edge.
685 * \param thePnt2 Point for the second end of edge.
686 * \return New GEOM_Object, containing the created edge.
688 * Example: see GEOM_TestAll.py
690 def MakeEdge(thePnt1, thePnt2):
691 anObj = ShapesOp.MakeEdge(thePnt1, thePnt2)
692 if ShapesOp.IsDone() == 0:
693 print "MakeEdge : ", ShapesOp.GetErrorCode()
697 * Create a wire from the set of edges and wires.
698 * \param theEdgesAndWires List of edges and/or wires.
699 * \return New GEOM_Object, containing the created wire.
701 * Example: see GEOM_TestAll.py
703 def MakeWire(theEdgesAndWires):
704 anObj = ShapesOp.MakeWire(theEdgesAndWires)
705 if ShapesOp.IsDone() == 0:
706 print "MakeWire : ", ShapesOp.GetErrorCode()
710 * Create a face on the given wire.
711 * \param theWire Wire to build the face on.
712 * \param isPlanarWanted If TRUE, only planar face will be built.
713 * If impossible, NULL object will be returned.
714 * \return New GEOM_Object, containing the created face.
716 * Example: see GEOM_TestAll.py
718 def MakeFace(theWire, isPlanarWanted):
719 anObj = ShapesOp.MakeFace(theWire, isPlanarWanted)
720 if ShapesOp.IsDone() == 0:
721 print "MakeFace : ", ShapesOp.GetErrorCode()
725 * Create a face on the given wires set.
726 * \param theWires List of wires to build the face on.
727 * \param isPlanarWanted If TRUE, only planar face will be built.
728 * If impossible, NULL object will be returned.
729 * \return New GEOM_Object, containing the created face.
731 * Example: see GEOM_TestAll.py
733 def MakeFaceWires(theWires, isPlanarWanted):
734 anObj = ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
735 if ShapesOp.IsDone() == 0:
736 print "MakeFaceWires : ", ShapesOp.GetErrorCode()
740 * Shortcut to MakeFaceWires()
742 * Example: see GEOM_TestOthers.py
744 def MakeFaces(theWires, isPlanarWanted):
745 anObj = MakeFaceWires(theWires, isPlanarWanted)
749 * Create a shell from the set of faces and shells.
750 * \param theFacesAndShells List of faces and/or shells.
751 * \return New GEOM_Object, containing the created shell.
753 * Example: see GEOM_TestAll.py
755 def MakeShell(theFacesAndShells):
756 anObj = ShapesOp.MakeShell(theFacesAndShells)
757 if ShapesOp.IsDone() == 0:
758 print "MakeShell : ", ShapesOp.GetErrorCode()
762 * Create a solid, bounded by the given shells.
763 * \param theShells Sequence of bounding shells.
764 * \return New GEOM_Object, containing the created solid.
766 * Example: see GEOM_TestAll.py
768 def MakeSolid(theShells):
769 anObj = ShapesOp.MakeSolidShells(theShells)
770 if ShapesOp.IsDone() == 0:
771 print "MakeSolid : ", ShapesOp.GetErrorCode()
775 * Create a compound of the given shapes.
776 * \param theShapes List of shapes to put in compound.
777 * \return New GEOM_Object, containing the created compound.
779 * Example: see GEOM_TestAll.py
781 def MakeCompound(theShapes):
782 anObj = ShapesOp.MakeCompound(theShapes)
783 if ShapesOp.IsDone() == 0:
784 print "MakeCompound : ", ShapesOp.GetErrorCode()
788 * Gives quantity of faces in the given shape.
789 * \param theShape Shape to count faces of.
790 * \return Quantity of faces.
792 * Example: see GEOM_TestOthers.py
794 def NumberOfFaces(theShape):
795 nb_faces = ShapesOp.NumberOfFaces(theShape)
796 if ShapesOp.IsDone() == 0:
797 print "NumberOfFaces : ", ShapesOp.GetErrorCode()
801 * Gives quantity of edges in the given shape.
802 * \param theShape Shape to count edges of.
803 * \return Quantity of edges.
805 * Example: see GEOM_TestOthers.py
807 def NumberOfEdges(theShape):
808 nb_edges = ShapesOp.NumberOfEdges(theShape)
809 if ShapesOp.IsDone() == 0:
810 print "NumberOfEdges : ", ShapesOp.GetErrorCode()
814 * Reverses an orientation the given shape.
815 * \param theShape Shape to be reversed.
816 * \return The reversed copy of theShape.
818 * Example: see GEOM_TestAll.py
820 def ChangeOrientation(theShape):
821 anObj = ShapesOp.ChangeOrientation(theShape)
822 if ShapesOp.IsDone() == 0:
823 print "ChangeOrientation : ", ShapesOp.GetErrorCode()
827 * Shortcut to ChangeOrientation()
829 * Example: see GEOM_TestOthers.py
831 def OrientationChange(theShape):
832 anObj = ChangeOrientation(theShape)
836 * Retrieve all free faces from the given shape.
837 * Free face is a face, which is not shared between two shells of the shape.
838 * \param theShape Shape to find free faces in.
839 * \return List of IDs of all free faces, contained in theShape.
841 * Example: see GEOM_TestOthers.py
843 def GetFreeFacesIDs(theShape):
844 anIDs = ShapesOp.GetFreeFacesIDs(theShape)
845 if ShapesOp.IsDone() == 0:
846 print "GetFreeFacesIDs : ", ShapesOp.GetErrorCode()
850 * Get all sub-shapes of theShape1 of the given type, shared with theShape2.
851 * \param theShape1 Shape to find sub-shapes in.
852 * \param theShape2 Shape to find shared sub-shapes with.
853 * \param theShapeType Type of sub-shapes to be retrieved.
854 * \return List of sub-shapes of theShape1, shared with theShape2.
856 * Example: see GEOM_TestOthers.py
858 def GetSharedShapes(theShape1, theShape2, theShapeType):
859 aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
860 if ShapesOp.IsDone() == 0:
861 print "GetSharedShapes : ", ShapesOp.GetErrorCode()
865 * Get sub-shapes of theShape of the given type,
866 * laying on the specified plane.
867 * \param theShape Shape to find sub-shapes of.
868 * \param theShapeType Type of sub-shapes to be retrieved.
869 * \param thePlane Face, specifying the plane to find shapes on.
870 * \return Group of all found sub-shapes.
872 * Example: see GEOM_TestOthers.py
874 def GetShapesOnPlane(theShape, theShapeType, thePlane):
875 anObj = ShapesOp.GetShapesOnPlane(theShape, theShapeType, thePlane)
876 if ShapesOp.IsDone() == 0:
877 print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
881 * Get sub-shape of theShape of the given type,
882 * laying on the specified cylinder.
883 * \param theShape Shape to find sub-shapes of.
884 * \param theShapeType Type of sub-shapes to be retrieved.
885 * \param theAxis Vector (or line, or linear edge), specifying
886 * axis of the cylinder to find shapes on.
887 * \param theRadius Radius of the cylinder to find shapes on.
888 * \return Group of all found sub-shapes.
890 * Example: see GEOM_TestOthers.py
892 def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius):
893 anObj = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius)
894 if ShapesOp.IsDone() == 0:
895 print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
899 * Get sub-shape of theShape of the given type,
900 * laying on the specified sphere.
901 * \param theShape Shape to find sub-shapes of.
902 * \param theShapeType Type of sub-shapes to be retrieved.
903 * \param theCenter Point, specifying center of the sphere to find shapes on.
904 * \param theRadius Radius of the sphere to find shapes on.
905 * \return Group of all found sub-shapes.
907 * Example: see GEOM_TestOthers.py
909 def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius):
910 anObj = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius)
911 if ShapesOp.IsDone() == 0:
912 print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
916 * Get sub-shape(s) of theShapeWhere, which are
917 * coincident with \a theShapeWhat or could be a part of it.
918 * \param theShapeWhere Shape to find sub-shapes of.
919 * \param theShapeWhat Shape, specifying what to find.
920 * \return Group of all found sub-shapes or a single found sub-shape.
922 * Example: see GEOM_TestOthers.py
924 def GetInPlace(theShapeWhere, theShapeWhat):
925 anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
926 if ShapesOp.IsDone() == 0:
927 print "GetInPlace : ", ShapesOp.GetErrorCode()
930 # -----------------------------------------------------------------------------
931 # Access to sub-shapes by their unique IDs inside the main shape.
932 # -----------------------------------------------------------------------------
935 * Obtain a composite sub-shape of <aShape>, composed from sub-shapes
936 * of <aShape>, selected by their unique IDs inside <aShape>
938 * Example: see GEOM_TestAll.py
940 def GetSubShape(aShape, ListOfID):
941 anObj = geom.AddSubShape(aShape,ListOfID)
945 * Obtain unique ID of sub-shape <aSubShape> inside <aShape>
947 * Example: see GEOM_TestAll.py
949 def GetSubShapeID(aShape, aSubShape):
950 anID = LocalOp.GetSubShapeIndex(aShape, aSubShape)
951 if LocalOp.IsDone() == 0:
952 print "GetSubShapeIndex : ", LocalOp.GetErrorCode()
955 # -----------------------------------------------------------------------------
957 # -----------------------------------------------------------------------------
960 * Explode a shape on subshapes of a given type.
961 * \param theShape Shape to be exploded.
962 * \param theShapeType Type of sub-shapes to be retrieved.
963 * \return List of sub-shapes of type theShapeType, contained in theShape.
965 * Example: see GEOM_TestAll.py
967 def SubShapeAll(aShape, aType):
968 ListObj = ShapesOp.MakeExplode(aShape,aType,0)
969 if ShapesOp.IsDone() == 0:
970 print "MakeExplode : ", ShapesOp.GetErrorCode()
974 * Explode a shape on subshapes of a given type.
975 * \param theShape Shape to be exploded.
976 * \param theShapeType Type of sub-shapes to be retrieved.
977 * \return List of IDs of sub-shapes.
979 def SubShapeAllIDs(aShape, aType):
980 ListObj = ShapesOp.SubShapeAllIDs(aShape,aType,0)
981 if ShapesOp.IsDone() == 0:
982 print "SubShapeAllIDs : ", ShapesOp.GetErrorCode()
986 * Explode a shape on subshapes of a given type.
987 * Sub-shapes will be sorted by coordinates of their gravity centers.
988 * \param theShape Shape to be exploded.
989 * \param theShapeType Type of sub-shapes to be retrieved.
990 * \return List of sub-shapes of type theShapeType, contained in theShape.
992 * Example: see GEOM_TestAll.py
994 def SubShapeAllSorted(aShape, aType):
995 ListObj = ShapesOp.MakeExplode(aShape,aType,1)
996 if ShapesOp.IsDone() == 0:
997 print "MakeExplode : ", ShapesOp.GetErrorCode()
1001 * Explode a shape on subshapes of a given type.
1002 * Sub-shapes will be sorted by coordinates of their gravity centers.
1003 * \param theShape Shape to be exploded.
1004 * \param theShapeType Type of sub-shapes to be retrieved.
1005 * \return List of IDs of sub-shapes.
1007 def SubShapeAllSortedIDs(aShape, aType):
1008 ListIDs = ShapesOp.SubShapeAllIDs(aShape,aType,1)
1009 if ShapesOp.IsDone() == 0:
1010 print "SubShapeAllSortedIDs : ", ShapesOp.GetErrorCode()
1014 * Obtain a compound of sub-shapes of <aShape>,
1015 * selected by they indices in list of all sub-shapes of type <aType>.
1016 * Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1018 * Example: see GEOM_TestAll.py
1020 def SubShape(aShape, aType, ListOfInd):
1022 AllShapeList = SubShapeAll(aShape, aType)
1023 for ind in ListOfInd:
1024 ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1]))
1025 anObj = GetSubShape(aShape, ListOfIDs)
1029 * Obtain a compound of sub-shapes of <aShape>,
1030 * selected by they indices in sorted list of all sub-shapes of type <aType>.
1031 * Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1033 * Example: see GEOM_TestAll.py
1035 def SubShapeSorted(aShape, aType, ListOfInd):
1037 AllShapeList = SubShapeAllSorted(aShape, aType)
1038 for ind in ListOfInd:
1039 ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1]))
1040 anObj = GetSubShape(aShape, ListOfIDs)
1043 # -----------------------------------------------------------------------------
1044 # Healing operations
1045 # -----------------------------------------------------------------------------
1048 * Apply a sequence of Shape Healing operators to the given object.
1049 * \param theShape Shape to be processed.
1050 * \param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1051 * \param theParameters List of names of parameters
1052 * ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1053 * \param theValues List of values of parameters, in the same order
1054 * as parameters are listed in \a theParameters list.
1055 * \return New GEOM_Object, containing processed shape.
1057 * Example: see GEOM_TestHealing.py
1059 def ProcessShape(theShape, theOperators, theParameters, theValues):
1060 anObj = HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1061 if HealOp.IsDone() == 0:
1062 print "ProcessShape : ", HealOp.GetErrorCode()
1066 * Remove faces from the given object (shape).
1067 * \param theObject Shape to be processed.
1068 * \param theFaces Indices of faces to be removed, if EMPTY then the method
1069 * removes ALL faces of the given object.
1070 * \return New GEOM_Object, containing processed shape.
1072 * Example: see GEOM_TestHealing.py
1074 def SuppressFaces(theObject, theFaces):
1075 anObj = HealOp.SuppressFaces(theObject, theFaces)
1076 if HealOp.IsDone() == 0:
1077 print "SuppressFaces : ", HealOp.GetErrorCode()
1081 * Sewing of some shapes into single shape.
1083 * Example: see GEOM_TestHealing.py
1085 def MakeSewing(ListShape, theTolerance):
1086 comp = MakeCompound(ListShape)
1087 anObj = Sew(comp, theTolerance)
1091 * Sewing of the given object.
1092 * \param theObject Shape to be processed.
1093 * \param theTolerance Required tolerance value.
1094 * \return New GEOM_Object, containing processed shape.
1096 * Example: see MakeSewing() above
1098 def Sew(theObject, theTolerance):
1099 anObj = HealOp.Sew(theObject, theTolerance)
1100 if HealOp.IsDone() == 0:
1101 print "Sew : ", HealOp.GetErrorCode()
1105 * Remove internal wires and edges from the given object (face).
1106 * \param theObject Shape to be processed.
1107 * \param theWires Indices of wires to be removed, if EMPTY then the method
1108 * removes ALL internal wires of the given object.
1109 * \return New GEOM_Object, containing processed shape.
1111 * Example: see GEOM_TestHealing.py
1113 def SuppressInternalWires(theObject, theWires):
1114 anObj = HealOp.RemoveIntWires(theObject, theWires)
1115 if HealOp.IsDone() == 0:
1116 print "SuppressInternalWires : ", HealOp.GetErrorCode()
1120 * Remove internal closed contours (holes) from the given object.
1121 * \param theObject Shape to be processed.
1122 * \param theWires Indices of wires to be removed, if EMPTY then the method
1123 * removes ALL internal holes of the given object
1124 * \return New GEOM_Object, containing processed shape.
1126 * Example: see GEOM_TestHealing.py
1128 def SuppressHoles(theObject, theWires):
1129 anObj = HealOp.FillHoles(theObject, theWires)
1130 if HealOp.IsDone() == 0:
1131 print "SuppressHoles : ", HealOp.GetErrorCode()
1135 * Close an open wire.
1136 * \param theObject Shape to be processed.
1137 * \param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1138 * if -1, then theObject itself is a wire.
1139 * \param isCommonVertex If TRUE : closure by creation of a common vertex,
1140 * If FALS : closure by creation of an edge between ends.
1141 * \return New GEOM_Object, containing processed shape.
1143 * Example: see GEOM_TestHealing.py
1145 def CloseContour(theObject, theWires, isCommonVertex):
1146 anObj = HealOp.CloseContour(theObject, theWires, isCommonVertex)
1147 if HealOp.IsDone() == 0:
1148 print "CloseContour : ", HealOp.GetErrorCode()
1152 * Addition of a point to a given edge object.
1153 * \param theObject Shape to be processed.
1154 * \param theEdgeIndex Index of edge to be divided within theObject's shape,
1155 * if -1, then theObject itself is the edge.
1156 * \param theValue Value of parameter on edge or length parameter,
1157 * depending on \a isByParameter.
1158 * \param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1159 * if FALSE : \a theValue is treated as a length parameter [0..1]
1160 * \return New GEOM_Object, containing processed shape.
1162 * Example: see GEOM_TestHealing.py
1164 def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter):
1165 anObj = HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1166 if HealOp.IsDone() == 0:
1167 print "DivideEdge : ", HealOp.GetErrorCode()
1171 * Get a list of wires (wrapped in GEOM_Object-s),
1172 * that constitute a free boundary of the given shape.
1173 * \param theObject Shape to get free boundary of.
1174 * \return [status, theClosedWires, theOpenWires]
1175 * status: FALSE, if an error(s) occured during the method execution.
1176 * theClosedWires: Closed wires on the free boundary of the given shape.
1177 * theOpenWires: Open wires on the free boundary of the given shape.
1179 * Example: see GEOM_TestHealing.py
1181 def GetFreeBoundary(theObject):
1182 anObj = HealOp.GetFreeBoundary(theObject)
1183 if HealOp.IsDone() == 0:
1184 print "GetFreeBoundaries : ", HealOp.GetErrorCode()
1187 # -----------------------------------------------------------------------------
1188 # Create advanced objects
1189 # -----------------------------------------------------------------------------
1192 * Create a copy of the given object
1194 * Example: see GEOM_TestAll.py
1196 def MakeCopy(theOriginal):
1197 anObj = InsertOp.MakeCopy(theOriginal)
1198 if InsertOp.IsDone() == 0:
1199 print "MakeCopy : ", InsertOp.GetErrorCode()
1203 * Create a filling from the given compound of contours.
1204 * \param theShape the compound of contours
1205 * \param theMinDeg a minimal degree
1206 * \param theMaxDeg a maximal degree
1207 * \param theTol2D a 2d tolerance
1208 * \param theTol3D a 3d tolerance
1209 * \param theNbIter a number of iteration
1210 * \return New GEOM_Object, containing the created filling surface.
1212 * Example: see GEOM_TestAll.py
1214 def MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter):
1215 anObj = PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
1216 if PrimOp.IsDone() == 0:
1217 print "MakeFilling : ", PrimOp.GetErrorCode()
1221 * Replace coincident faces in theShape by one face.
1222 * \param theShape Initial shape.
1223 * \param theTolerance Maximum distance between faces, which can be considered as coincident.
1224 * \return New GEOM_Object, containing a copy of theShape without coincident faces.
1226 * Example: see GEOM_Spanner.py
1228 def MakeGlueFaces(theShape, theTolerance):
1229 anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance)
1230 if ShapesOp.IsDone() == 0:
1231 print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
1234 # -----------------------------------------------------------------------------
1235 # Boolean (Common, Cut, Fuse, Section)
1236 # -----------------------------------------------------------------------------
1239 * Perform one of boolean operations on two given shapes.
1240 * \param theShape1 First argument for boolean operation.
1241 * \param theShape2 Second argument for boolean operation.
1242 * \param theOperation Indicates the operation to be done:
1243 * 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
1244 * \return New GEOM_Object, containing the result shape.
1246 * Example: see GEOM_TestAll.py
1248 def MakeBoolean(theShape1, theShape2, theOperation):
1249 anObj = BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
1250 if BoolOp.IsDone() == 0:
1251 print "MakeBoolean : ", BoolOp.GetErrorCode()
1255 * Shortcuts to MakeBoolean() for certain operations
1257 * Example: see GEOM_TestOthers.py
1259 def MakeCommon(s1, s2):
1260 return MakeBoolean(s1, s2, 1)
1262 def MakeCut(s1, s2):
1263 return MakeBoolean(s1, s2, 2)
1265 def MakeFuse(s1, s2):
1266 return MakeBoolean(s1, s2, 3)
1268 def MakeSection(s1, s2):
1269 return MakeBoolean(s1, s2, 4)
1272 * Perform partition operation.
1273 * \param ListShapes Shapes to be intersected.
1274 * \param ListTools Shapes to intersect theShapes.
1275 * \param ListKeepInside Shapes, outside which the results will be deleted.
1276 * Each shape from theKeepInside must belong to theShapes also.
1277 * \param ListRemoveInside Shapes, inside which the results will be deleted.
1278 * Each shape from theRemoveInside must belong to theShapes also.
1279 * \param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
1280 * \param RemoveWebs If TRUE, perform Glue 3D algorithm.
1281 * \param ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
1282 * \return New GEOM_Object, containing the result shapes.
1284 * Example: see GEOM_TestAll.py
1286 def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1287 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
1288 anObj = BoolOp.MakePartition(ListShapes, ListTools,
1289 ListKeepInside, ListRemoveInside,
1290 Limit, RemoveWebs, ListMaterials);
1291 if BoolOp.IsDone() == 0:
1292 print "MakePartition : ", BoolOp.GetErrorCode()
1296 * Shortcut to MakePartition()
1298 * Example: see GEOM_TestOthers.py
1300 def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1301 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
1302 anObj = MakePartition(ListShapes, ListTools,
1303 ListKeepInside, ListRemoveInside,
1304 Limit, RemoveWebs, ListMaterials);
1308 * Perform partition of the Shape with the Plane
1309 * \param theShape Shape to be intersected.
1310 * \param thePlane Tool shape, to intersect theShape.
1311 * \return New GEOM_Object, containing the result shape.
1313 * Example: see GEOM_TestAll.py
1315 def MakeHalfPartition(theShape, thePlane):
1316 anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
1317 if BoolOp.IsDone() == 0:
1318 print "MakeHalfPartition : ", BoolOp.GetErrorCode()
1321 # -----------------------------------------------------------------------------
1323 # -----------------------------------------------------------------------------
1326 * Translate the given object along the vector, specified
1327 * by its end points, creating its copy before the translation.
1328 * \param theObject The object to be translated.
1329 * \param thePoint1 Start point of translation vector.
1330 * \param thePoint2 End point of translation vector.
1331 * \return New GEOM_Object, containing the translated object.
1333 * Example: see GEOM_TestAll.py
1335 def MakeTranslationTwoPoints(theObject, thePoint1, thePoint2):
1336 anObj = TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
1337 if TrsfOp.IsDone() == 0:
1338 print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode()
1342 * Translate the given object along the vector, specified
1343 * by its components, creating its copy before the translation.
1344 * \param theObject The object to be translated.
1345 * \param theDX,theDY,theDZ Components of translation vector.
1346 * \return New GEOM_Object, containing the translated object.
1348 * Example: see GEOM_TestAll.py
1350 def MakeTranslation(theObject, theDX, theDY, theDZ):
1351 anObj = TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
1352 if TrsfOp.IsDone() == 0:
1353 print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode()
1357 * Translate the given object along the given vector,
1358 * creating its copy before the translation.
1359 * \param theObject The object to be translated.
1360 * \param theVector The translation vector.
1361 * \return New GEOM_Object, containing the translated object.
1363 * Example: see GEOM_TestAll.py
1365 def MakeTranslationVector(theObject, theVector):
1366 anObj = TrsfOp.TranslateVectorCopy(theObject, theVector)
1367 if TrsfOp.IsDone() == 0:
1368 print "TranslateVectorCopy : ", TrsfOp.GetErrorCode()
1372 * Rotate the given object around the given axis
1373 * on the given angle, creating its copy before the rotatation.
1374 * \param theObject The object to be rotated.
1375 * \param theAxis Rotation axis.
1376 * \param theAngle Rotation angle in radians.
1377 * \return New GEOM_Object, containing the rotated object.
1379 * Example: see GEOM_TestAll.py
1381 def MakeRotation(theObject, theAxis, theAngle):
1382 anObj = TrsfOp.RotateCopy(theObject, theAxis, theAngle)
1383 if TrsfOp.IsDone() == 0:
1384 print "RotateCopy : ", TrsfOp.GetErrorCode()
1388 * Scale the given object by the factor, creating its copy before the scaling.
1389 * \param theObject The object to be scaled.
1390 * \param thePoint Center point for scaling.
1391 * \param theFactor Scaling factor value.
1392 * \return New GEOM_Object, containing the scaled shape.
1394 * Example: see GEOM_TestAll.py
1396 def MakeScaleTransform(theObject, thePoint, theFactor):
1397 anObj = TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
1398 if TrsfOp.IsDone() == 0:
1399 print "ScaleShapeCopy : ", TrsfOp.GetErrorCode()
1403 * Create an object, symmetrical
1404 * to the given one relatively the given plane.
1405 * \param theObject The object to be mirrored.
1406 * \param thePlane Plane of symmetry.
1407 * \return New GEOM_Object, containing the mirrored shape.
1409 * Example: see GEOM_TestAll.py
1411 def MakeMirrorByPlane(theObject, thePlane):
1412 anObj = TrsfOp.MirrorPlaneCopy(theObject, thePlane)
1413 if TrsfOp.IsDone() == 0:
1414 print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode()
1418 * Create an object, symmetrical
1419 * to the given one relatively the given axis.
1420 * \param theObject The object to be mirrored.
1421 * \param theAxis Axis of symmetry.
1422 * \return New GEOM_Object, containing the mirrored shape.
1424 * Example: see GEOM_TestAll.py
1426 def MakeMirrorByAxis(theObject, theAxis):
1427 anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis)
1428 if TrsfOp.IsDone() == 0:
1429 print "MirrorAxisCopy : ", TrsfOp.GetErrorCode()
1433 * Create an object, symmetrical
1434 * to the given one relatively the given point.
1435 * \param theObject The object to be mirrored.
1436 * \param thePoint Point of symmetry.
1437 * \return New GEOM_Object, containing the mirrored shape.
1439 * Example: see GEOM_TestAll.py
1441 def MakeMirrorByPoint(theObject, thePoint):
1442 anObj = TrsfOp.MirrorPointCopy(theObject, thePoint)
1443 if TrsfOp.IsDone() == 0:
1444 print "MirrorPointCopy : ", TrsfOp.GetErrorCode()
1448 * Modify the Location of the given object by LCS
1449 * creating its copy before the setting
1451 * Example: see GEOM_TestAll.py
1453 def MakePosition(theObject, theStartLCS, theEndLCS):
1454 anObj = TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
1455 if TrsfOp.IsDone() == 0:
1456 print "PositionShapeCopy : ", TrsfOp.GetErrorCode()
1460 * Create new object as offset of the given one.
1461 * \param theObject The base object for the offset.
1462 * \param theOffset Offset value.
1463 * \return New GEOM_Object, containing the offset object.
1465 * Example: see GEOM_TestAll.py
1467 def MakeOffset(theObject, theOffset):
1468 anObj = TrsfOp.OffsetShapeCopy(theObject, theOffset)
1469 if TrsfOp.IsDone() == 0:
1470 print "OffsetShapeCopy : ", TrsfOp.GetErrorCode()
1473 # -----------------------------------------------------------------------------
1475 # -----------------------------------------------------------------------------
1478 * Translate the given object along the given vector a given number times
1479 * \param theObject The object to be translated.
1480 * \param theVector Direction of the translation.
1481 * \param theStep Distance to translate on.
1482 * \param theNbTimes Quantity of translations to be done.
1483 * \return New GEOM_Object, containing compound of all
1484 * the shapes, obtained after each translation.
1486 * Example: see GEOM_TestAll.py
1488 def MakeMultiTranslation1D(theObject, theVector, theStep, theNbTimes):
1489 anObj = TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
1490 if TrsfOp.IsDone() == 0:
1491 print "MultiTranslate1D : ", TrsfOp.GetErrorCode()
1495 * Conseqently apply two specified translations to theObject specified number of times.
1496 * \param theObject The object to be translated.
1497 * \param theVector1 Direction of the first translation.
1498 * \param theStep1 Step of the first translation.
1499 * \param theNbTimes1 Quantity of translations to be done along theVector1.
1500 * \param theVector2 Direction of the second translation.
1501 * \param theStep2 Step of the second translation.
1502 * \param theNbTimes2 Quantity of translations to be done along theVector2.
1503 * \return New GEOM_Object, containing compound of all
1504 * the shapes, obtained after each translation.
1506 * Example: see GEOM_TestAll.py
1508 def MakeMultiTranslation2D(theObject, theVector1, theStep1, theNbTimes1,
1509 theVector2, theStep2, theNbTimes2):
1510 anObj = TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
1511 theVector2, theStep2, theNbTimes2)
1512 if TrsfOp.IsDone() == 0:
1513 print "MultiTranslate2D : ", TrsfOp.GetErrorCode()
1517 * Rotate the given object around the given axis a given number times.
1518 * Rotation angle will be 2*PI/theNbTimes.
1519 * \param theObject The object to be rotated.
1520 * \param theAxis The rotation axis.
1521 * \param theNbTimes Quantity of rotations to be done.
1522 * \return New GEOM_Object, containing compound of all the
1523 * shapes, obtained after each rotation.
1525 * Example: see GEOM_TestAll.py
1527 def MultiRotate1D(theObject, theAxis, theNbTimes):
1528 anObj = TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
1529 if TrsfOp.IsDone() == 0:
1530 print "MultiRotate1D : ", TrsfOp.GetErrorCode()
1534 * Rotate the given object around the
1535 * given axis on the given angle a given number
1536 * times and multi-translate each rotation result.
1537 * Translation direction passes through center of gravity
1538 * of rotated shape and its projection on the rotation axis.
1539 * \param theObject The object to be rotated.
1540 * \param theAxis Rotation axis.
1541 * \param theAngle Rotation angle in graduces.
1542 * \param theNbTimes1 Quantity of rotations to be done.
1543 * \param theStep Translation distance.
1544 * \param theNbTimes2 Quantity of translations to be done.
1545 * \return New GEOM_Object, containing compound of all the
1546 * shapes, obtained after each transformation.
1548 * Example: see GEOM_TestAll.py
1550 def MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
1551 anObj = TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
1552 if TrsfOp.IsDone() == 0:
1553 print "MultiRotate2D : ", TrsfOp.GetErrorCode()
1557 * The same, as MultiRotate1D(), but axis is given by direction and point
1559 * Example: see GEOM_TestOthers.py
1561 def MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes):
1562 aVec = MakeLine(aPoint,aDir)
1563 anObj = MultiRotate1D(aShape,aVec,aNbTimes)
1567 * The same, as MultiRotate2D(), but axis is given by direction and point
1569 * Example: see GEOM_TestOthers.py
1571 def MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
1572 aVec = MakeLine(aPoint,aDir)
1573 anObj = MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
1576 # -----------------------------------------------------------------------------
1578 # -----------------------------------------------------------------------------
1581 * Perform a fillet on all edges of the given shape.
1582 * \param theShape Shape, to perform fillet on.
1583 * \param theR Fillet radius.
1584 * \return New GEOM_Object, containing the result shape.
1586 * Example: see GEOM_TestOthers.py
1588 def MakeFilletAll(theShape, theR):
1589 anObj = LocalOp.MakeFilletAll(theShape, theR)
1590 if LocalOp.IsDone() == 0:
1591 print "MakeFilletAll : ", LocalOp.GetErrorCode()
1595 * Perform a fillet on the specified edges/faces of the given shape
1596 * \param theShape Shape, to perform fillet on.
1597 * \param theR Fillet radius.
1598 * \param theShapeType Type of shapes in <theListShapes>.
1599 * \param theListShapes Global indices of edges/faces to perform fillet on.
1600 * \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1601 * \return New GEOM_Object, containing the result shape.
1603 * Example: see GEOM_TestAll.py
1605 def MakeFillet(theShape, theR, theShapeType, theListShapes):
1607 if theShapeType == ShapeType["EDGE"]:
1608 anObj = LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
1610 anObj = LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
1611 if LocalOp.IsDone() == 0:
1612 print "MakeFillet : ", LocalOp.GetErrorCode()
1616 * Perform a symmetric chamfer on all edges of the given shape.
1617 * \param theShape Shape, to perform chamfer on.
1618 * \param theD Chamfer size along each face.
1619 * \return New GEOM_Object, containing the result shape.
1621 * Example: see GEOM_TestOthers.py
1623 def MakeChamferAll(theShape, theD):
1624 anObj = LocalOp.MakeChamferAll(theShape, theD)
1625 if LocalOp.IsDone() == 0:
1626 print "MakeChamferAll : ", LocalOp.GetErrorCode()
1630 * Perform a chamfer on edges, common to the specified faces,
1631 * with distance D1 on the Face1
1632 * \param theShape Shape, to perform chamfer on.
1633 * \param theD1 Chamfer size along \a theFace1.
1634 * \param theD2 Chamfer size along \a theFace2.
1635 * \param theFace1,theFace2 Global indices of two faces of \a theShape.
1636 * \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1637 * \return New GEOM_Object, containing the result shape.
1639 * Example: see GEOM_TestAll.py
1641 def MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2):
1642 anObj = LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
1643 if LocalOp.IsDone() == 0:
1644 print "MakeChamferEdge : ", LocalOp.GetErrorCode()
1648 * Perform a chamfer on all edges of the specified faces,
1649 * with distance D1 on the first specified face (if several for one edge)
1650 * \param theShape Shape, to perform chamfer on.
1651 * \param theD1 Chamfer size along face from \a theFaces. If both faces,
1652 * connected to the edge, are in \a theFaces, \a theD1
1653 * will be get along face, which is nearer to \a theFaces beginning.
1654 * \param theD2 Chamfer size along another of two faces, connected to the edge.
1655 * \param theFaces Sequence of global indices of faces of \a theShape.
1656 * \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1657 * \return New GEOM_Object, containing the result shape.
1659 * Example: see GEOM_TestAll.py
1661 def MakeChamferFaces(theShape, theD1, theD2, theFaces):
1662 anObj = LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
1663 if LocalOp.IsDone() == 0:
1664 print "MakeChamferFaces : ", LocalOp.GetErrorCode()
1668 * Shortcut to MakeChamferEdge() and MakeChamferFaces()
1670 * Example: see GEOM_TestOthers.py
1672 def MakeChamfer(aShape,d1,d2,aShapeType,ListShape):
1674 if aShapeType == ShapeType["EDGE"]:
1675 anObj = MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
1677 anObj = MakeChamferFaces(aShape,d1,d2,ListShape)
1681 * Perform an Archimde operation on the given shape with given parameters.
1682 * The object presenting the resulting face is returned
1683 * \param theShape Shape to be put in water.
1684 * \param theWeight Weight og the shape.
1685 * \param theWaterDensity Density of the water.
1686 * \param theMeshDeflection Deflection of the mesh, using to compute the section.
1687 * \return New GEOM_Object, containing a section of \a theShape
1688 * by a plane, corresponding to water level.
1690 * Example: see GEOM_TestAll.py
1692 def Archimede(theShape, theWeight, theWaterDensity, theMeshDeflection):
1693 anObj = LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
1694 if LocalOp.IsDone() == 0:
1695 print "MakeArchimede : ", LocalOp.GetErrorCode()
1698 # -----------------------------------------------------------------------------
1699 # Information objects
1700 # -----------------------------------------------------------------------------
1703 * Get point coordinates
1706 * Example: see GEOM_TestMeasures.py
1708 def PointCoordinates(Point):
1709 aTuple = MeasuOp.PointCoordinates(Point)
1710 if MeasuOp.IsDone() == 0:
1711 print "PointCoordinates : ", MeasuOp.GetErrorCode()
1715 * Get summarized length of all wires,
1716 * area of surface and volume of the given shape.
1717 * \param theShape Shape to define properties of.
1718 * \return [theLength, theSurfArea, theVolume]
1719 * theLength: Summarized length of all wires of the given shape.
1720 * theSurfArea: Area of surface of the given shape.
1721 * theVolume: Volume of the given shape.
1723 * Example: see GEOM_TestMeasures.py
1725 def BasicProperties(theShape):
1726 aTuple = MeasuOp.GetBasicProperties(theShape)
1727 if MeasuOp.IsDone() == 0:
1728 print "BasicProperties : ", MeasuOp.GetErrorCode()
1732 * Get parameters of bounding box of the given shape
1733 * \param theShape Shape to obtain bounding box of.
1734 * \return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
1735 * Xmin,Xmax: Limits of shape along OX axis.
1736 * Ymin,Ymax: Limits of shape along OY axis.
1737 * Zmin,Zmax: Limits of shape along OZ axis.
1739 * Example: see GEOM_TestMeasures.py
1741 def BoundingBox(theShape):
1742 aTuple = MeasuOp.GetBoundingBox(theShape)
1743 if MeasuOp.IsDone() == 0:
1744 print "BoundingBox : ", MeasuOp.GetErrorCode()
1748 * Get inertia matrix and moments of inertia of theShape.
1749 * \param theShape Shape to calculate inertia of.
1750 * \return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
1751 * I(1-3)(1-3): Components of the inertia matrix of the given shape.
1752 * Ix,Iy,Iz: Moments of inertia of the given shape.
1754 * Example: see GEOM_TestMeasures.py
1756 def Inertia(theShape):
1757 aTuple = MeasuOp.GetInertia(theShape)
1758 if MeasuOp.IsDone() == 0:
1759 print "Inertia : ", MeasuOp.GetErrorCode()
1763 * Get minimal distance between the given shapes.
1764 * \param theShape1,theShape2 Shapes to find minimal distance between.
1765 * \return Value of the minimal distance between the given shapes.
1767 * Example: see GEOM_TestMeasures.py
1769 def MinDistance(theShape1, theShape2):
1770 aTuple = MeasuOp.GetMinDistance(theShape1, theShape2)
1771 if MeasuOp.IsDone() == 0:
1772 print "MinDistance : ", MeasuOp.GetErrorCode()
1776 * Get min and max tolerances of sub-shapes of theShape
1777 * \param theShape Shape, to get tolerances of.
1778 * \return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
1779 * FaceMin,FaceMax: Min and max tolerances of the faces.
1780 * EdgeMin,EdgeMax: Min and max tolerances of the edges.
1781 * VertMin,VertMax: Min and max tolerances of the vertices.
1783 * Example: see GEOM_TestMeasures.py
1785 def Tolerance(theShape):
1786 aTuple = MeasuOp.GetTolerance(theShape)
1787 if MeasuOp.IsDone() == 0:
1788 print "Tolerance : ", MeasuOp.GetErrorCode()
1792 * Obtain description of the given shape (number of sub-shapes of each type)
1793 * \param theShape Shape to be described.
1794 * \return Description of the given shape.
1796 * Example: see GEOM_TestMeasures.py
1798 def WhatIs(theShape):
1799 aDescr = MeasuOp.WhatIs(theShape)
1800 if MeasuOp.IsDone() == 0:
1801 print "WhatIs : ", MeasuOp.GetErrorCode()
1805 * Get a point, situated at the centre of mass of theShape.
1806 * \param theShape Shape to define centre of mass of.
1807 * \return New GEOM_Object, containing the created point.
1809 * Example: see GEOM_TestMeasures.py
1811 def MakeCDG(theShape):
1812 anObj = MeasuOp.GetCentreOfMass(theShape)
1813 if MeasuOp.IsDone() == 0:
1814 print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
1818 * Check a topology of the given shape.
1819 * \param theShape Shape to check validity of.
1820 * \return TRUE, if the shape "seems to be valid" from the topological point of view.
1821 * If theShape is invalid, prints a description of problem.
1823 * Example: see GEOM_TestMeasures.py
1825 def CheckShape(theShape):
1826 (IsValid, Status) = MeasuOp.CheckShape(theShape)
1827 if MeasuOp.IsDone() == 0:
1828 print "CheckShape : ", MeasuOp.GetErrorCode()
1834 # -----------------------------------------------------------------------------
1835 # Import/Export objects
1836 # -----------------------------------------------------------------------------
1839 * Import a shape from the BREP or IGES or STEP file
1840 * (depends on given format) with given name.
1841 * \param theFileName The file, containing the shape.
1842 * \param theFormatName Specify format for the file reading.
1843 * Available formats can be obtained with InsertOp.ImportTranslators() method.
1844 * \return New GEOM_Object, containing the imported shape.
1846 * Example: see GEOM_TestOthers.py
1848 def Import(theFileName, theFormatName):
1849 anObj = InsertOp.Import(theFileName, theFormatName)
1850 if InsertOp.IsDone() == 0:
1851 print "Import : ", InsertOp.GetErrorCode()
1855 * Shortcuts to Import() for certain formats
1857 * Example: see GEOM_TestOthers.py
1859 def ImportBREP(theFileName):
1860 return Import(theFileName, "BREP")
1862 def ImportIGES(theFileName):
1863 return Import(theFileName, "IGES")
1865 def ImportSTEP(theFileName):
1866 return Import(theFileName, "STEP")
1869 * Export the given shape into a file with given name.
1870 * \param theObject Shape to be stored in the file.
1871 * \param theFileName Name of the file to store the given shape in.
1872 * \param theFormatName Specify format for the shape storage.
1873 * Available formats can be obtained with InsertOp.ImportTranslators() method.
1875 * Example: see GEOM_TestOthers.py
1877 def Export(theObject, theFileName, theFormatName):
1878 InsertOp.Export(theObject, theFileName, theFormatName)
1879 if InsertOp.IsDone() == 0:
1880 print "Export : ", InsertOp.GetErrorCode()
1883 * Shortcuts to Export() for certain formats
1885 * Example: see GEOM_TestOthers.py
1887 def ExportBREP(theObject, theFileName):
1888 return Export(theObject, theFileName, "BREP")
1890 def ExportIGES(theObject, theFileName):
1891 return Export(theObject, theFileName, "IGES")
1893 def ExportSTEP(theObject, theFileName):
1894 return Export(theObject, theFileName, "STEP")
1896 # -----------------------------------------------------------------------------
1898 # -----------------------------------------------------------------------------
1901 * Create a quadrangle face from four edges. Order of Edges is not
1902 * important. It is not necessary that edges share the same vertex.
1903 * \param E1,E2,E3,E4 Edges for the face bound.
1904 * \return New GEOM_Object, containing the created face.
1906 * Example: see GEOM_Spanner.py
1908 def MakeQuad(E1, E2, E3, E4):
1909 anObj = BlocksOp.MakeQuad(E1, E2, E3, E4)
1910 if BlocksOp.IsDone() == 0:
1911 print "MakeQuad : ", BlocksOp.GetErrorCode()
1915 * Create a quadrangle face on two edges.
1916 * The missing edges will be built by creating the shortest ones.
1917 * \param E1,E2 Two opposite edges for the face.
1918 * \return New GEOM_Object, containing the created face.
1920 * Example: see GEOM_Spanner.py
1922 def MakeQuad2Edges(E1, E2):
1923 anObj = BlocksOp.MakeQuad2Edges(E1, E2)
1924 if BlocksOp.IsDone() == 0:
1925 print "MakeQuad2Edges : ", BlocksOp.GetErrorCode()
1929 * Create a quadrangle face with specified corners.
1930 * The missing edges will be built by creating the shortest ones.
1931 * \param V1,V2,V3,V4 Corner vertices for the face.
1932 * \return New GEOM_Object, containing the created face.
1934 * Example: see GEOM_Spanner.py
1936 def MakeQuad4Vertices(V1, V2, V3, V4):
1937 anObj = BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
1938 if BlocksOp.IsDone() == 0:
1939 print "MakeQuad4Vertices : ", BlocksOp.GetErrorCode()
1943 * Create a hexahedral solid, bounded by the six given faces. Order of
1944 * faces is not important. It is not necessary that Faces share the same edge.
1945 * \param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
1946 * \return New GEOM_Object, containing the created solid.
1948 * Example: see GEOM_Spanner.py
1950 def MakeHexa(F1, F2, F3, F4, F5, F6):
1951 anObj = BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
1952 if BlocksOp.IsDone() == 0:
1953 print "MakeHexa : ", BlocksOp.GetErrorCode()
1957 * Create a hexahedral solid between two given faces.
1958 * The missing faces will be built by creating the smallest ones.
1959 * \param F1,F2 Two opposite faces for the hexahedral solid.
1960 * \return New GEOM_Object, containing the created solid.
1962 * Example: see GEOM_Spanner.py
1964 def MakeHexa2Faces(F1, F2):
1965 anObj = BlocksOp.MakeHexa2Faces(F1, F2)
1966 if BlocksOp.IsDone() == 0:
1967 print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
1971 * Get a vertex, found in the given shape by its coordinates.
1972 * \param theShape Block or a compound of blocks.
1973 * \param theX,theY,theZ Coordinates of the sought vertex.
1974 * \param theEpsilon Maximum allowed distance between the resulting
1975 * vertex and point with the given coordinates.
1976 * \return New GEOM_Object, containing the found vertex.
1978 * Example: see GEOM_TestOthers.py
1980 def GetPoint(theShape, theX, theY, theZ, theEpsilon):
1981 anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
1982 if BlocksOp.IsDone() == 0:
1983 print "GetPoint : ", BlocksOp.GetErrorCode()
1987 * Get an edge, found in the given shape by two given vertices.
1988 * \param theShape Block or a compound of blocks.
1989 * \param thePoint1,thePoint2 Points, close to the ends of the desired edge.
1990 * \return New GEOM_Object, containing the found edge.
1992 * Example: see GEOM_Spanner.py
1994 def GetEdge(theShape, thePoint1, thePoint2):
1995 anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
1996 if BlocksOp.IsDone() == 0:
1997 print "GetEdge : ", BlocksOp.GetErrorCode()
2001 * Find an edge of the given shape, which has minimal distance to the given point.
2002 * \param theShape Block or a compound of blocks.
2003 * \param thePoint Point, close to the desired edge.
2004 * \return New GEOM_Object, containing the found edge.
2006 * Example: see GEOM_TestOthers.py
2008 def GetEdgeNearPoint(theShape, thePoint):
2009 anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint)
2010 if BlocksOp.IsDone() == 0:
2011 print "GetEdgeNearPoint : ", BlocksOp.GetErrorCode()
2015 * Returns a face, found in the given shape by four given corner vertices.
2016 * \param theShape Block or a compound of blocks.
2017 * \param thePoint1-thePoint4 Points, close to the corners of the desired face.
2018 * \return New GEOM_Object, containing the found face.
2020 * Example: see GEOM_Spanner.py
2022 def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
2023 anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
2024 if BlocksOp.IsDone() == 0:
2025 print "GetFaceByPoints : ", BlocksOp.GetErrorCode()
2029 * Get a face of block, found in the given shape by two given edges.
2030 * \param theShape Block or a compound of blocks.
2031 * \param theEdge1,theEdge2 Edges, close to the edges of the desired face.
2032 * \return New GEOM_Object, containing the found face.
2034 * Example: see GEOM_Spanner.py
2036 def GetFaceByEdges(theShape, theEdge1, theEdge2):
2037 anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
2038 if BlocksOp.IsDone() == 0:
2039 print "GetFaceByEdges : ", BlocksOp.GetErrorCode()
2043 * Find a face, opposite to the given one in the given block.
2044 * \param theBlock Must be a hexahedral solid.
2045 * \param theFace Face of \a theBlock, opposite to the desired face.
2046 * \return New GEOM_Object, containing the found face.
2048 * Example: see GEOM_Spanner.py
2050 def GetOppositeFace(theBlock, theFace):
2051 anObj = BlocksOp.GetOppositeFace(theBlock, theFace)
2052 if BlocksOp.IsDone() == 0:
2053 print "GetOppositeFace : ", BlocksOp.GetErrorCode()
2057 * Find a face of the given shape, which has minimal distance to the given point.
2058 * \param theShape Block or a compound of blocks.
2059 * \param thePoint Point, close to the desired face.
2060 * \return New GEOM_Object, containing the found face.
2062 * Example: see GEOM_Spanner.py
2064 def GetFaceNearPoint(theShape, thePoint):
2065 anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint)
2066 if BlocksOp.IsDone() == 0:
2067 print "GetFaceNearPoint : ", BlocksOp.GetErrorCode()
2071 * Find a face of block, whose outside normale has minimal angle with the given vector.
2072 * \param theShape Block or a compound of blocks.
2073 * \param theVector Vector, close to the normale of the desired face.
2074 * \return New GEOM_Object, containing the found face.
2076 * Example: see GEOM_Spanner.py
2078 def GetFaceByNormale(theBlock, theVector):
2079 anObj = BlocksOp.GetFaceByNormale(theBlock, theVector)
2080 if BlocksOp.IsDone() == 0:
2081 print "GetFaceByNormale : ", BlocksOp.GetErrorCode()
2085 * Check, if the compound of blocks is given.
2086 * To be considered as a compound of blocks, the
2087 * given shape must satisfy the following conditions:
2088 * - Each element of the compound should be a Block (6 faces and 12 edges).
2089 * - A connection between two Blocks should be an entire quadrangle face or an entire edge.
2090 * - The compound should be connexe.
2091 * - The glue between two quadrangle faces should be applied.
2092 * \param theCompound The compound to check.
2093 * \return TRUE, if the given shape is a compound of blocks.
2094 * If theCompound is not valid, prints all discovered errors.
2096 * Example: see GEOM_Spanner.py
2098 def CheckCompoundOfBlocks(theCompound):
2099 (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound)
2100 if BlocksOp.IsDone() == 0:
2101 print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode()
2104 Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors)
2109 * Remove all seam and degenerated edges from \a theShape.
2110 * Unite faces and edges, sharing one surface.
2111 * \param theShape The compound or single solid to remove irregular edges from.
2112 * \return Improved shape.
2114 * Example: see GEOM_TestOthers.py
2116 def RemoveExtraEdges(theShape):
2117 anObj = BlocksOp.RemoveExtraEdges(theShape)
2118 if BlocksOp.IsDone() == 0:
2119 print "RemoveExtraEdges : ", BlocksOp.GetErrorCode()
2123 * Check, if the given shape is a blocks compound.
2124 * Fix all detected errors.
2125 * \note Single block can be also fixed by this method.
2126 * \param theCompound The compound to check and improve.
2127 * \return Improved compound.
2129 * Example: see GEOM_TestOthers.py
2131 def CheckAndImprove(theShape):
2132 anObj = BlocksOp.CheckAndImprove(theShape)
2133 if BlocksOp.IsDone() == 0:
2134 print "CheckAndImprove : ", BlocksOp.GetErrorCode()
2138 * Get all the blocks, contained in the given compound.
2139 * \param theCompound The compound to explode.
2140 * \param theMinNbFaces If solid has lower number of faces, it is not a block.
2141 * \param theMaxNbFaces If solid has higher number of faces, it is not a block.
2142 * \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
2143 * \return List of GEOM_Objects, containing the retrieved blocks.
2145 * Example: see GEOM_TestOthers.py
2147 def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
2148 aList = BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
2149 if BlocksOp.IsDone() == 0:
2150 print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
2154 * Find block, containing the given point inside its volume or on boundary.
2155 * \param theCompound Compound, to find block in.
2156 * \param thePoint Point, close to the desired block. If the point lays on
2157 * boundary between some blocks, we return block with nearest center.
2158 * \return New GEOM_Object, containing the found block.
2160 * Example: see GEOM_Spanner.py
2162 def GetBlockNearPoint(theCompound, thePoint):
2163 anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
2164 if BlocksOp.IsDone() == 0:
2165 print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
2169 * Find block, containing all the elements, passed as the parts, or maximum quantity of them.
2170 * \param theCompound Compound, to find block in.
2171 * \param theParts List of faces and/or edges and/or vertices to be parts of the found block.
2172 * \return New GEOM_Object, containing the found block.
2174 * Example: see GEOM_TestOthers.py
2176 def GetBlockByParts(theCompound, theParts):
2177 anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
2178 if BlocksOp.IsDone() == 0:
2179 print "GetBlockByParts : ", BlocksOp.GetErrorCode()
2183 * Return all blocks, containing all the elements, passed as the parts.
2184 * \param theCompound Compound, to find blocks in.
2185 * \param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
2186 * \return List of GEOM_Objects, containing the found blocks.
2188 * Example: see GEOM_Spanner.py
2190 def GetBlocksByParts(theCompound, theParts):
2191 aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
2192 if BlocksOp.IsDone() == 0:
2193 print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
2197 * Multi-transformate block and glue the result.
2198 * Transformation is defined so, as to superpose direction faces.
2199 * \param Block Hexahedral solid to be multi-transformed.
2200 * \param DirFace1 ID of First direction face.
2201 * \param DirFace2 ID of Second direction face.
2202 * \param NbTimes Quantity of transformations to be done.
2203 * \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
2204 * \return New GEOM_Object, containing the result shape.
2206 * Example: see GEOM_Spanner.py
2208 def MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes):
2209 anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
2210 if BlocksOp.IsDone() == 0:
2211 print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode()
2215 * Multi-transformate block and glue the result.
2216 * \param Block Hexahedral solid to be multi-transformed.
2217 * \param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
2218 * \param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
2219 * \param NbTimesU,NbTimesV Quantity of transformations to be done.
2220 * \return New GEOM_Object, containing the result shape.
2222 * Example: see GEOM_Spanner.py
2224 def MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
2225 DirFace1V, DirFace2V, NbTimesV):
2226 anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
2227 DirFace1V, DirFace2V, NbTimesV)
2228 if BlocksOp.IsDone() == 0:
2229 print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode()
2233 * Build all possible propagation groups.
2234 * Propagation group is a set of all edges, opposite to one (main)
2235 * edge of this group directly or through other opposite edges.
2236 * Notion of Opposite Edge make sence only on quadrangle face.
2237 * \param theShape Shape to build propagation groups on.
2238 * \return List of GEOM_Objects, each of them is a propagation group.
2240 * Example: see GEOM_TestOthers.py
2242 def Propagate(theShape):
2243 listChains = BlocksOp.Propagate(theShape)
2244 if BlocksOp.IsDone() == 0:
2245 print "Propagate : ", BlocksOp.GetErrorCode()
2248 # -----------------------------------------------------------------------------
2250 # -----------------------------------------------------------------------------
2253 * Creates a new group which will store sub shapes of theMainShape
2254 * \param theMainShape is a GEOM object on which the group is selected
2255 * \param theShapeType defines a shape type of the group
2256 * \return a newly created GEOM group
2258 * Example: see GEOM_TestOthers.py
2260 def CreateGroup(theMainShape, theShapeType):
2261 anObj = GroupOp.CreateGroup(theMainShape, theShapeType)
2262 if GroupOp.IsDone() == 0:
2263 print "CreateGroup : ", GroupOp.GetErrorCode()
2267 * Adds a sub object with ID theSubShapeId to the group
2268 * \param theGroup is a GEOM group to which the new sub shape is added
2269 * \param theSubShapeID is a sub shape ID in the main object.
2270 * \note Use method GetSubShapeID() to get an unique ID of the sub shape
2272 * Example: see GEOM_TestOthers.py
2274 def AddObject(theGroup, theSubShapeID):
2275 GroupOp.AddObject(theGroup, theSubShapeID)
2276 if GroupOp.IsDone() == 0:
2277 print "AddObject : ", GroupOp.GetErrorCode()
2280 * Removes a sub object with ID \a theSubShapeId from the group
2281 * \param theGroup is a GEOM group from which the new sub shape is removed
2282 * \param theSubShapeID is a sub shape ID in the main object.
2283 * \note Use method GetSubShapeID() to get an unique ID of the sub shape
2285 * Example: see GEOM_TestOthers.py
2287 def RemoveObject(theGroup, theSubShapeID):
2288 GroupOp.RemoveObject(theGroup, theSubShapeID)
2289 if GroupOp.IsDone() == 0:
2290 print "RemoveObject : ", GroupOp.GetErrorCode()
2293 * Returns a list of sub objects ID stored in the group
2294 * \param theGroup is a GEOM group for which a list of IDs is requested
2296 * Example: see GEOM_TestOthers.py
2298 def GetObjectIDs(theGroup):
2299 ListIDs = GroupOp.GetObjects(theGroup)
2300 if GroupOp.IsDone() == 0:
2301 print "GetObjectIDs : ", GroupOp.GetErrorCode()
2305 * Returns a type of sub objects stored in the group
2306 * \param theGroup is a GEOM group which type is returned.
2308 * Example: see GEOM_TestOthers.py
2310 def GetType(theGroup):
2311 aType = GroupOp.GetType(theGroup)
2312 if GroupOp.IsDone() == 0:
2313 print "GetType : ", GroupOp.GetErrorCode()
2317 * Returns a main shape associated with the group
2318 * \param theGroup is a GEOM group for which a main shape object is requested
2319 * \return a GEOM object which is a main shape for theGroup
2321 * Example: see GEOM_TestOthers.py
2323 def GetMainShape(theGroup):
2324 anObj = GroupOp.GetMainShape(theGroup)
2325 if GroupOp.IsDone() == 0:
2326 print "GetMainShape : ", GroupOp.GetErrorCode()
2330 * Add Path to the system path
2333 if (sys.path.count(Path) < 1):
2334 sys.path.append(Path)