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
39 # -----------------------------------------------------------------------------
40 # enumeration ShapeType as a dictionary
41 # -----------------------------------------------------------------------------
43 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
45 # -----------------------------------------------------------------------------
46 # Raise an Error Function if Operation is Failed
47 # -----------------------------------------------------------------------------
48 def RaiseIfFailed (Method_name, Operation):
49 #NPAL18017#if Operation.IsDone() == 0:
50 if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
51 raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
53 # -----------------------------------------------------------------------------
54 # enumeration shape_kind
55 # -----------------------------------------------------------------------------
57 kind = GEOM.GEOM_IKindOfShape
65 class geompyDC(GEOM._objref_GEOM_Gen):
67 GEOM._objref_GEOM_Gen.__init__(self)
86 def init_geom(self,theStudy):
87 self.myStudy = theStudy
88 self.myStudyId = self.myStudy._get_StudyId()
89 self.myBuilder = self.myStudy.NewBuilder()
90 self.father = self.myStudy.FindComponent("GEOM")
91 if self.father is None:
92 self.father = self.myBuilder.NewComponent("GEOM")
93 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
94 FName = A1._narrow(SALOMEDS.AttributeName)
95 FName.SetValue("Geometry")
96 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
97 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
98 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
99 self.myBuilder.DefineComponentInstance(self.father,self)
101 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
102 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
103 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
104 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
105 self.HealOp = self.GetIHealingOperations (self.myStudyId)
106 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
107 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
108 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
109 self.LocalOp = self.GetILocalOperations (self.myStudyId)
110 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
111 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
112 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
115 ## Get name for sub-shape aSubObj of shape aMainObj
117 # Example: see GEOM_TestAll.py
118 def SubShapeName(self,aSubObj, aMainObj):
119 #aSubId = orb.object_to_string(aSubObj)
120 #aMainId = orb.object_to_string(aMainObj)
121 #index = gg.getIndexTopology(aSubId, aMainId)
122 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
123 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
124 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
127 ## Publish in study aShape with name aName
129 # Example: see GEOM_TestAll.py
130 def addToStudy(self,aShape, aName):
132 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
134 print "addToStudy() failed"
136 return aShape.GetStudyEntry()
138 ## Publish in study aShape with name aName as sub-object of previously published aFather
140 # Example: see GEOM_TestAll.py
141 def addToStudyInFather(self,aFather, aShape, aName):
143 aSObject = self.AddInStudy(myStudy, aShape, aName, aFather)
145 print "addToStudyInFather() failed"
147 return aShape.GetStudyEntry()
149 # -----------------------------------------------------------------------------
151 # -----------------------------------------------------------------------------
153 ## Create point by three coordinates.
154 # @param theX The X coordinate of the point.
155 # @param theY The Y coordinate of the point.
156 # @param theZ The Z coordinate of the point.
157 # @return New GEOM_Object, containing the created point.
159 # Example: see GEOM_TestAll.py
160 def MakeVertex(self,theX, theY, theZ):
161 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
162 RaiseIfFailed("MakePointXYZ", self.BasicOp)
165 ## Create a point, distant from the referenced point
166 # on the given distances along the coordinate axes.
167 # @param theReference The referenced point.
168 # @param theX Displacement from the referenced point along OX axis.
169 # @param theY Displacement from the referenced point along OY axis.
170 # @param theZ Displacement from the referenced point along OZ axis.
171 # @return New GEOM_Object, containing the created point.
173 # Example: see GEOM_TestAll.py
174 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
175 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
176 RaiseIfFailed("MakePointWithReference", self.BasicOp)
179 ## Create a point, corresponding to the given parameter on the given curve.
180 # @param theRefCurve The referenced curve.
181 # @param theParameter Value of parameter on the referenced curve.
182 # @return New GEOM_Object, containing the created point.
184 # Example: see GEOM_TestAll.py
185 def MakeVertexOnCurve(self,theRefCurve, theParameter):
186 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
187 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
190 ## Create a point on intersection of two lines.
191 # @param theRefLine1, theRefLine2 The referenced lines.
192 # @return New GEOM_Object, containing the created point.
194 # Example: see GEOM_TestAll.py
195 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
196 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
197 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
200 ## Create a tangent, corresponding to the given parameter on the given curve.
201 # @param theRefCurve The referenced curve.
202 # @param theParameter Value of parameter on the referenced curve.
203 # @return New GEOM_Object, containing the created tangent.
204 def MakeTangentOnCurve(self,theRefCurve, theParameter):
205 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
206 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
209 ## Create a vector with the given components.
210 # @param theDX X component of the vector.
211 # @param theDY Y component of the vector.
212 # @param theDZ Z component of the vector.
213 # @return New GEOM_Object, containing the created vector.
215 # Example: see GEOM_TestAll.py
216 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
217 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
218 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
221 ## Create a vector between two points.
222 # @param thePnt1 Start point for the vector.
223 # @param thePnt2 End point for the vector.
224 # @return New GEOM_Object, containing the created vector.
226 # Example: see GEOM_TestAll.py
227 def MakeVector(self,thePnt1, thePnt2):
228 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
229 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
232 ## Create a line, passing through the given point
233 # and parrallel to the given direction
234 # @param thePnt Point. The resulting line will pass through it.
235 # @param theDir Direction. The resulting line will be parallel to it.
236 # @return New GEOM_Object, containing the created line.
238 # Example: see GEOM_TestAll.py
239 def MakeLine(self,thePnt, theDir):
240 anObj = self.BasicOp.MakeLine(thePnt, theDir)
241 RaiseIfFailed("MakeLine", self.BasicOp)
244 ## Create a line, passing through the given points
245 # @param thePnt1 First of two points, defining the line.
246 # @param thePnt2 Second of two points, defining the line.
247 # @return New GEOM_Object, containing the created line.
249 # Example: see GEOM_TestAll.py
250 def MakeLineTwoPnt(self,thePnt1, thePnt2):
251 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
252 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
255 ## Create a line on two faces intersection.
256 # @param theFace1 First of two faces, defining the line.
257 # @param theFace2 Second of two faces, defining the line.
258 # @return New GEOM_Object, containing the created line.
260 # Example: see GEOM_TestAll.py
261 def MakeLineTwoFaces(self, theFace1, theFace2):
262 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
263 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
266 ## Create a plane, passing through the given point
267 # and normal to the given vector.
268 # @param thePnt Point, the plane has to pass through.
269 # @param theVec Vector, defining the plane normal direction.
270 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
271 # @return New GEOM_Object, containing the created plane.
273 # Example: see GEOM_TestAll.py
274 def MakePlane(self,thePnt, theVec, theTrimSize):
275 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
276 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
279 ## Create a plane, passing through the three given points
280 # @param thePnt1 First of three points, defining the plane.
281 # @param thePnt2 Second of three points, defining the plane.
282 # @param thePnt3 Fird of three points, defining the plane.
283 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
284 # @return New GEOM_Object, containing the created plane.
286 # Example: see GEOM_TestAll.py
287 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
288 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
289 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
292 ## Create a plane, similar to the existing one, but with another size of representing face.
293 # @param theFace Referenced plane or LCS(Marker).
294 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
295 # @return New GEOM_Object, containing the created plane.
297 # Example: see GEOM_TestAll.py
298 def MakePlaneFace(self,theFace, theTrimSize):
299 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
300 RaiseIfFailed("MakePlaneFace", self.BasicOp)
303 ## Create a local coordinate system.
304 # @param OX,OY,OZ Three coordinates of coordinate system origin.
305 # @param XDX,XDY,XDZ Three components of OX direction
306 # @param YDX,YDY,YDZ Three components of OY direction
307 # @return New GEOM_Object, containing the created coordinate system.
309 # Example: see GEOM_TestAll.py
310 def MakeMarker(self,OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
311 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
312 RaiseIfFailed("MakeMarker", self.BasicOp)
315 ## Create a local coordinate system.
316 # @param theOrigin Point of coordinate system origin.
317 # @param theXVec Vector of X direction
318 # @param theYVec Vector of Y direction
319 # @return New GEOM_Object, containing the created coordinate system.
320 def MakeMarkerPntTwoVec(self,theOrigin, theXVec, theYVec):
321 O = self.PointCoordinates( theOrigin )
323 for vec in [ theXVec, theYVec ]:
324 v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] )
325 p1 = self.PointCoordinates( v1 )
326 p2 = self.PointCoordinates( v2 )
327 for i in range( 0, 3 ):
328 OXOY.append( p2[i] - p1[i] )
330 anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2],
331 OXOY[0], OXOY[1], OXOY[2],
332 OXOY[3], OXOY[4], OXOY[5], )
333 RaiseIfFailed("MakeMarker", self.BasicOp)
336 # -----------------------------------------------------------------------------
338 # -----------------------------------------------------------------------------
340 ## Create an arc of circle, passing through three given points.
341 # @param thePnt1 Start point of the arc.
342 # @param thePnt2 Middle point of the arc.
343 # @param thePnt3 End point of the arc.
344 # @return New GEOM_Object, containing the created arc.
346 # Example: see GEOM_TestAll.py
347 def MakeArc(self,thePnt1, thePnt2, thePnt3):
348 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
349 RaiseIfFailed("MakeArc", self.CurvesOp)
352 ## Create an arc of circle from a center and 2 points.
353 # @param thePnt1 Center of the arc
354 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
355 # @param thePnt3 End point of the arc (Gives also a direction)
356 # @return New GEOM_Object, containing the created arc.
358 # Example: see GEOM_TestAll.py
359 def MakeArcCenter(self,thePnt1, thePnt2, thePnt3,theSense):
360 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense)
361 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
364 ## Create a circle with given center, normal vector and radius.
365 # @param thePnt Circle center.
366 # @param theVec Vector, normal to the plane of the circle.
367 # @param theR Circle radius.
368 # @return New GEOM_Object, containing the created circle.
370 # Example: see GEOM_TestAll.py
371 def MakeCircle(self,thePnt, theVec, theR):
372 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
373 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
376 ## Create a circle, passing through three given points
377 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
378 # @return New GEOM_Object, containing the created circle.
380 # Example: see GEOM_TestAll.py
381 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
382 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
383 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
386 ## Create a circle, with given point1 as center,
387 # passing through the point2 as radius and laying in the plane,
388 # defined by all three given points.
389 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
390 # @return New GEOM_Object, containing the created circle.
392 # Example: see GEOM_example6.py
393 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
394 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
395 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
398 ## Create an ellipse with given center, normal vector and radiuses.
399 # @param thePnt Ellipse center.
400 # @param theVec Vector, normal to the plane of the ellipse.
401 # @param theRMajor Major ellipse radius.
402 # @param theRMinor Minor ellipse radius.
403 # @return New GEOM_Object, containing the created ellipse.
405 # Example: see GEOM_TestAll.py
406 def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor):
407 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
408 RaiseIfFailed("MakeEllipse", self.CurvesOp)
411 ## Create a polyline on the set of points.
412 # @param thePoints Sequence of points for the polyline.
413 # @return New GEOM_Object, containing the created polyline.
415 # Example: see GEOM_TestAll.py
416 def MakePolyline(self,thePoints):
417 anObj = self.CurvesOp.MakePolyline(thePoints)
418 RaiseIfFailed("MakePolyline", self.CurvesOp)
421 ## Create bezier curve on the set of points.
422 # @param thePoints Sequence of points for the bezier curve.
423 # @return New GEOM_Object, containing the created bezier curve.
425 # Example: see GEOM_TestAll.py
426 def MakeBezier(self,thePoints):
427 anObj = self.CurvesOp.MakeSplineBezier(thePoints)
428 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
431 ## Create B-Spline curve on the set of points.
432 # @param thePoints Sequence of points for the B-Spline curve.
433 # @return New GEOM_Object, containing the created B-Spline curve.
435 # Example: see GEOM_TestAll.py
436 def MakeInterpol(self,thePoints):
437 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints)
438 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
441 ## Create a sketcher (wire or face), following the textual description,
442 # passed through \a theCommand argument. \n
443 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
444 # Format of the description string have to be the following:
446 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
449 # - x1, y1 are coordinates of the first sketcher point (zero by default),
451 # - "R angle" : Set the direction by angle
452 # - "D dx dy" : Set the direction by DX & DY
455 # - "TT x y" : Create segment by point at X & Y
456 # - "T dx dy" : Create segment by point with DX & DY
457 # - "L length" : Create segment by direction & Length
458 # - "IX x" : Create segment by direction & Intersect. X
459 # - "IY y" : Create segment by direction & Intersect. Y
462 # - "C radius length" : Create arc by direction, radius and length(in degree)
465 # - "WW" : Close Wire (to finish)
466 # - "WF" : Close Wire and build face (to finish)
468 # @param theCommand String, defining the sketcher in local
469 # coordinates of the working plane.
470 # @param theWorkingPlane Nine double values, defining origin,
471 # OZ and OX directions of the working plane.
472 # @return New GEOM_Object, containing the created wire.
474 # Example: see GEOM_TestAll.py
475 def MakeSketcher(self,theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
476 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
477 RaiseIfFailed("MakeSketcher", self.CurvesOp)
480 ## Create a sketcher (wire or face), following the textual description,
481 # passed through \a theCommand argument. \n
482 # For format of the description string see the previous method.\n
483 # @param theCommand String, defining the sketcher in local
484 # coordinates of the working plane.
485 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
486 # @return New GEOM_Object, containing the created wire.
487 def MakeSketcherOnPlane(self,theCommand, theWorkingPlane):
488 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
489 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
492 # -----------------------------------------------------------------------------
493 # Create 3D Primitives
494 # -----------------------------------------------------------------------------
496 ## Create a box by coordinates of two opposite vertices.
498 # Example: see GEOM_TestAll.py
499 def MakeBox(self,x1,y1,z1,x2,y2,z2):
500 pnt1 = self.MakeVertex(x1,y1,z1)
501 pnt2 = self.MakeVertex(x2,y2,z2)
502 return self.MakeBoxTwoPnt(pnt1,pnt2)
504 ## Create a box with specified dimensions along the coordinate axes
505 # and with edges, parallel to the coordinate axes.
506 # Center of the box will be at point (DX/2, DY/2, DZ/2).
507 # @param theDX Length of Box edges, parallel to OX axis.
508 # @param theDY Length of Box edges, parallel to OY axis.
509 # @param theDZ Length of Box edges, parallel to OZ axis.
510 # @return New GEOM_Object, containing the created box.
512 # Example: see GEOM_TestAll.py
513 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
514 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
515 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
518 ## Create a box with two specified opposite vertices,
519 # and with edges, parallel to the coordinate axes
520 # @param thePnt1 First of two opposite vertices.
521 # @param thePnt2 Second of two opposite vertices.
522 # @return New GEOM_Object, containing the created box.
524 # Example: see GEOM_TestAll.py
525 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
526 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
527 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
530 ## Create a cylinder with given base point, axis, radius and height.
531 # @param thePnt Central point of cylinder base.
532 # @param theAxis Cylinder axis.
533 # @param theR Cylinder radius.
534 # @param theH Cylinder height.
535 # @return New GEOM_Object, containing the created cylinder.
537 # Example: see GEOM_TestAll.py
538 def MakeCylinder(self,thePnt, theAxis, theR, theH):
539 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
540 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
543 ## Create a cylinder with given radius and height at
544 # the origin of coordinate system. Axis of the cylinder
545 # will be collinear to the OZ axis of the coordinate system.
546 # @param theR Cylinder radius.
547 # @param theH Cylinder height.
548 # @return New GEOM_Object, containing the created cylinder.
550 # Example: see GEOM_TestAll.py
551 def MakeCylinderRH(self,theR, theH):
552 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
553 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
556 ## Create a sphere with given center and radius.
557 # @param thePnt Sphere center.
558 # @param theR Sphere radius.
559 # @return New GEOM_Object, containing the created sphere.
561 # Example: see GEOM_TestAll.py
562 def MakeSpherePntR(self,thePnt, theR):
563 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
564 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
567 ## Create a sphere with given center and radius.
568 # @param x,y,z Coordinates of sphere center.
569 # @param theR Sphere radius.
570 # @return New GEOM_Object, containing the created sphere.
572 # Example: see GEOM_TestAll.py
573 def MakeSphere(self,x, y, z, theR):
574 point = self.MakeVertex(x, y, z)
575 anObj = self.MakeSpherePntR(point, theR)
578 ## Create a sphere with given radius at the origin of coordinate system.
579 # @param theR Sphere radius.
580 # @return New GEOM_Object, containing the created sphere.
582 # Example: see GEOM_TestAll.py
583 def MakeSphereR(self,theR):
584 anObj = self.PrimOp.MakeSphereR(theR)
585 RaiseIfFailed("MakeSphereR", self.PrimOp)
588 ## Create a cone with given base point, axis, height and radiuses.
589 # @param thePnt Central point of the first cone base.
590 # @param theAxis Cone axis.
591 # @param theR1 Radius of the first cone base.
592 # @param theR2 Radius of the second cone base.
593 # \note If both radiuses are non-zero, the cone will be truncated.
594 # \note If the radiuses are equal, a cylinder will be created instead.
595 # @param theH Cone height.
596 # @return New GEOM_Object, containing the created cone.
598 # Example: see GEOM_TestAll.py
599 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
600 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
601 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
604 ## Create a cone with given height and radiuses at
605 # the origin of coordinate system. Axis of the cone will
606 # be collinear to the OZ axis of the coordinate system.
607 # @param theR1 Radius of the first cone base.
608 # @param theR2 Radius of the second cone base.
609 # \note If both radiuses are non-zero, the cone will be truncated.
610 # \note If the radiuses are equal, a cylinder will be created instead.
611 # @param theH Cone height.
612 # @return New GEOM_Object, containing the created cone.
614 # Example: see GEOM_TestAll.py
615 def MakeConeR1R2H(self,theR1, theR2, theH):
616 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
617 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
620 ## Create a torus with given center, normal vector and radiuses.
621 # @param thePnt Torus central point.
622 # @param theVec Torus axis of symmetry.
623 # @param theRMajor Torus major radius.
624 # @param theRMinor Torus minor radius.
625 # @return New GEOM_Object, containing the created torus.
627 # Example: see GEOM_TestAll.py
628 def MakeTorus(self,thePnt, theVec, theRMajor, theRMinor):
629 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
630 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
633 ## Create a torus with given radiuses at the origin of coordinate system.
634 # @param theRMajor Torus major radius.
635 # @param theRMinor Torus minor radius.
636 # @return New GEOM_Object, containing the created torus.
638 # Example: see GEOM_TestAll.py
639 def MakeTorusRR(self,theRMajor, theRMinor):
640 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
641 RaiseIfFailed("MakeTorusRR", self.PrimOp)
644 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
645 # @param theBase Base shape to be extruded.
646 # @param thePoint1 First end of extrusion vector.
647 # @param thePoint2 Second end of extrusion vector.
648 # @return New GEOM_Object, containing the created prism.
650 # Example: see GEOM_TestAll.py
651 def MakePrism(self,theBase, thePoint1, thePoint2):
652 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
653 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
656 ## Create a shape by extrusion of the base shape along the vector,
657 # i.e. all the space, transfixed by the base shape during its translation
658 # along the vector on the given distance.
659 # @param theBase Base shape to be extruded.
660 # @param theVec Direction of extrusion.
661 # @param theH Prism dimension along theVec.
662 # @return New GEOM_Object, containing the created prism.
664 # Example: see GEOM_TestAll.py
665 def MakePrismVecH(self,theBase, theVec, theH):
666 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
667 RaiseIfFailed("MakePrismVecH", self.PrimOp)
670 ## Create a shape by extrusion of the base shape along the vector,
671 # i.e. all the space, transfixed by the base shape during its translation
672 # along the vector on the given distance in 2 Ways (forward/backward) .
673 # @param theBase Base shape to be extruded.
674 # @param theVec Direction of extrusion.
675 # @param theH Prism dimension along theVec in forward direction.
676 # @return New GEOM_Object, containing the created prism.
678 # Example: see GEOM_TestAll.py
679 def MakePrismVecH2Ways(self, theBase, theVec, theH):
680 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
681 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
684 ## Create a shape by extrusion of the base shape along
685 # the path shape. The path shape can be a wire or an edge.
686 # @param theBase Base shape to be extruded.
687 # @param thePath Path shape to extrude the base shape along it.
688 # @return New GEOM_Object, containing the created pipe.
690 # Example: see GEOM_TestAll.py
691 def MakePipe(self,theBase, thePath):
692 anObj = self.PrimOp.MakePipe(theBase, thePath)
693 RaiseIfFailed("MakePipe", self.PrimOp)
696 ## Create a shape by revolution of the base shape around the axis
697 # on the given angle, i.e. all the space, transfixed by the base
698 # shape during its rotation around the axis on the given angle.
699 # @param theBase Base shape to be rotated.
700 # @param theAxis Rotation axis.
701 # @param theAngle Rotation angle in radians.
702 # @return New GEOM_Object, containing the created revolution.
704 # Example: see GEOM_TestAll.py
705 def MakeRevolution(self,theBase, theAxis, theAngle):
706 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
707 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
709 ## The Same Revolution but in both ways forward&backward.
710 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
711 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
712 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
715 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
716 # @param theSeqSections - set of specified sections.
717 # @param theModeSolid - mode defining building solid or shell
718 # @param thePreci - precision 3D used for smoothing by default 1.e-6
719 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
720 # @return New GEOM_Object, containing the created shell or solid.
722 # Example: see GEOM_TestAll.py
723 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
724 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
725 RaiseIfFailed("MakeThruSections", self.PrimOp)
728 ## Create a shape by extrusion of the profile shape along
729 # the path shape. The path shape can be a wire or an edge.
730 # the several profiles can be specified in the several locations of path.
731 # @param theSeqBases - list of Bases shape to be extruded.
732 # @param theLocations - list of locations on the path corresponding
733 # specified list of the Bases shapes. Number of locations
734 # should be equal to number of bases or list of locations can be empty.
735 # @param thePath - Path shape to extrude the base shape along it.
736 # @param theWithContact - the mode defining that the section is translated to be in
737 # contact with the spine.
738 # @param - WithCorrection - defining that the section is rotated to be
739 # orthogonal to the spine tangent in the correspondent point
740 # @return New GEOM_Object, containing the created pipe.
742 def MakePipeWithDifferentSections(self, theSeqBases,
743 theLocations, thePath,
744 theWithContact, theWithCorrection):
745 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
746 theLocations, thePath,
747 theWithContact, theWithCorrection)
748 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
751 ## Create a shape by extrusion of the profile shape along
752 # the path shape. The path shape can be a shell or a face.
753 # the several profiles can be specified in the several locations of path.
754 # @param theSeqBases - list of Bases shape to be extruded.
755 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
756 # @param theLocations - list of locations on the path corresponding
757 # specified list of the Bases shapes. Number of locations
758 # should be equal to number of bases. First and last
759 # locations must be coincided with first and last vertexes
760 # of path correspondingly.
761 # @param thePath - Path shape to extrude the base shape along it.
762 # @param theWithContact - the mode defining that the section is translated to be in
763 # contact with the spine.
764 # @param - WithCorrection - defining that the section is rotated to be
765 # orthogonal to the spine tangent in the correspondent point
766 # @return New GEOM_Object, containing the created solids.
768 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
769 theLocations, thePath,
770 theWithContact, theWithCorrection):
771 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
772 theLocations, thePath,
773 theWithContact, theWithCorrection)
774 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
777 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
778 theLocations, thePath,
779 theWithContact, theWithCorrection):
781 nbsect = len(theSeqBases)
782 nbsubsect = len(theSeqSubBases)
783 #print "nbsect = ",nbsect
784 for i in range(1,nbsect):
786 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
787 tmpLocations = [ theLocations[i-1], theLocations[i] ]
789 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
790 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
791 tmpLocations, thePath,
792 theWithContact, theWithCorrection)
793 if self.PrimOp.IsDone() == 0:
794 print "Problems with pipe creation between ",i," and ",i+1," sections"
795 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
798 print "Pipe between ",i," and ",i+1," sections is OK"
803 resc = self.MakeCompound(res)
804 #resc = self.MakeSewing(res, 0.001)
808 ## Create solids between given sections
809 # @param theSeqBases - list of sections (shell or face).
810 # @param theLocations - list of corresponding vertexes
811 # @return New GEOM_Object, containing the created solids.
813 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
814 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
815 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
819 # -----------------------------------------------------------------------------
821 # -----------------------------------------------------------------------------
823 ## Create a linear edge with specified ends.
824 # @param thePnt1 Point for the first end of edge.
825 # @param thePnt2 Point for the second end of edge.
826 # @return New GEOM_Object, containing the created edge.
828 # Example: see GEOM_TestAll.py
829 def MakeEdge(self,thePnt1, thePnt2):
830 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
831 RaiseIfFailed("MakeEdge", self.ShapesOp)
834 ## Create a wire from the set of edges and wires.
835 # @param theEdgesAndWires List of edges and/or wires.
836 # @return New GEOM_Object, containing the created wire.
838 # Example: see GEOM_TestAll.py
839 def MakeWire(self,theEdgesAndWires):
840 anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
841 RaiseIfFailed("MakeWire", self.ShapesOp)
844 ## Create a face on the given wire.
845 # @param theWire closed Wire or Edge to build the face on.
846 # @param isPlanarWanted If TRUE, only planar face will be built.
847 # If impossible, NULL object will be returned.
848 # @return New GEOM_Object, containing the created face.
850 # Example: see GEOM_TestAll.py
851 def MakeFace(self,theWire, isPlanarWanted):
852 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
853 RaiseIfFailed("MakeFace", self.ShapesOp)
856 ## Create a face on the given wires set.
857 # @param theWires List of closed wires or edges to build the face on.
858 # @param isPlanarWanted If TRUE, only planar face will be built.
859 # If impossible, NULL object will be returned.
860 # @return New GEOM_Object, containing the created face.
862 # Example: see GEOM_TestAll.py
863 def MakeFaceWires(self,theWires, isPlanarWanted):
864 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
865 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
868 ## Shortcut to MakeFaceWires()
870 # Example: see GEOM_TestOthers.py
871 def MakeFaces(self,theWires, isPlanarWanted):
872 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
875 ## Create a shell from the set of faces and shells.
876 # @param theFacesAndShells List of faces and/or shells.
877 # @return New GEOM_Object, containing the created shell.
879 # Example: see GEOM_TestAll.py
880 def MakeShell(self,theFacesAndShells):
881 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
882 RaiseIfFailed("MakeShell", self.ShapesOp)
885 ## Create a solid, bounded by the given shells.
886 # @param theShells Sequence of bounding shells.
887 # @return New GEOM_Object, containing the created solid.
889 # Example: see GEOM_TestAll.py
890 def MakeSolid(self,theShells):
891 anObj = self.ShapesOp.MakeSolidShells(theShells)
892 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
895 ## Create a compound of the given shapes.
896 # @param theShapes List of shapes to put in compound.
897 # @return New GEOM_Object, containing the created compound.
899 # Example: see GEOM_TestAll.py
900 def MakeCompound(self,theShapes):
901 anObj = self.ShapesOp.MakeCompound(theShapes)
902 RaiseIfFailed("MakeCompound", self.ShapesOp)
905 ## Gives quantity of faces in the given shape.
906 # @param theShape Shape to count faces of.
907 # @return Quantity of faces.
909 # Example: see GEOM_TestOthers.py
910 def NumberOfFaces(self,theShape):
911 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
912 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
915 ## Gives quantity of edges in the given shape.
916 # @param theShape Shape to count edges of.
917 # @return Quantity of edges.
919 # Example: see GEOM_TestOthers.py
920 def NumberOfEdges(self,theShape):
921 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
922 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
925 ## Reverses an orientation the given shape.
926 # @param theShape Shape to be reversed.
927 # @return The reversed copy of theShape.
929 # Example: see GEOM_TestAll.py
930 def ChangeOrientation(self,theShape):
931 anObj = self.ShapesOp.ChangeOrientation(theShape)
932 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
935 ## Shortcut to ChangeOrientation()
937 # Example: see GEOM_TestOthers.py
938 def OrientationChange(self,theShape):
939 anObj = self.ChangeOrientation(theShape)
942 ## Retrieve all free faces from the given shape.
943 # Free face is a face, which is not shared between two shells of the shape.
944 # @param theShape Shape to find free faces in.
945 # @return List of IDs of all free faces, contained in theShape.
947 # Example: see GEOM_TestOthers.py
948 def GetFreeFacesIDs(self,theShape):
949 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
950 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
953 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
954 # @param theShape1 Shape to find sub-shapes in.
955 # @param theShape2 Shape to find shared sub-shapes with.
956 # @param theShapeType Type of sub-shapes to be retrieved.
957 # @return List of sub-shapes of theShape1, shared with theShape2.
959 # Example: see GEOM_TestOthers.py
960 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
961 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
962 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
965 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
966 # the specified plane by the certain way, defined through \a theState parameter.
967 # @param theShape Shape to find sub-shapes of.
968 # @param theShapeType Type of sub-shapes to be retrieved.
969 # @param theAx1 Vector (or line, or linear edge), specifying normal
970 # direction and location of the plane to find shapes on.
971 # @param theState The state of the subshapes to find. It can be one of
972 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
973 # @return List of all found sub-shapes.
975 # Example: see GEOM_TestOthers.py
976 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
977 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
978 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
981 ## Works like the above method, but returns list of sub-shapes indices
983 # Example: see GEOM_TestOthers.py
984 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
985 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
986 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
989 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
990 # the specified plane by the certain way, defined through \a theState parameter.
991 # @param theShape Shape to find sub-shapes of.
992 # @param theShapeType Type of sub-shapes to be retrieved.
993 # @param theAx1 Vector (or line, or linear edge), specifying normal
994 # direction of the plane to find shapes on.
995 # @param thePnt Point specifying location of the plane to find shapes on.
996 # @param theState The state of the subshapes to find. It can be one of
997 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
998 # @return List of all found sub-shapes.
1000 # Example: see GEOM_TestOthers.py
1001 def GetShapesOnPlaneWithLocation(self,theShape, theShapeType, theAx1, thePnt, theState):
1002 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState)
1003 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1006 ## Works like the above method, but returns list of sub-shapes indices
1008 # Example: see GEOM_TestOthers.py
1009 def GetShapesOnPlaneWithLocationIDs(self,theShape, theShapeType, theAx1, thePnt, theState):
1010 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState)
1011 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1014 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1015 # the specified cylinder by the certain way, defined through \a theState parameter.
1016 # @param theShape Shape to find sub-shapes of.
1017 # @param theShapeType Type of sub-shapes to be retrieved.
1018 # @param theAxis Vector (or line, or linear edge), specifying
1019 # axis of the cylinder to find shapes on.
1020 # @param theRadius Radius of the cylinder to find shapes on.
1021 # @param theState The state of the subshapes to find. It can be one of
1022 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1023 # @return List of all found sub-shapes.
1025 # Example: see GEOM_TestOthers.py
1026 def GetShapesOnCylinder(self,theShape, theShapeType, theAxis, theRadius, theState):
1027 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1028 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1031 ## Works like the above method, but returns list of sub-shapes indices
1033 # Example: see GEOM_TestOthers.py
1034 def GetShapesOnCylinderIDs(self,theShape, theShapeType, theAxis, theRadius, theState):
1035 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1036 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1039 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1040 # the specified sphere by the certain way, defined through \a theState parameter.
1041 # @param theShape Shape to find sub-shapes of.
1042 # @param theShapeType Type of sub-shapes to be retrieved.
1043 # @param theCenter Point, specifying center of the sphere to find shapes on.
1044 # @param theRadius Radius of the sphere to find shapes on.
1045 # @param theState The state of the subshapes to find. It can be one of
1046 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1047 # @return List of all found sub-shapes.
1049 # Example: see GEOM_TestOthers.py
1050 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1051 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1052 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1055 ## Works like the above method, but returns list of sub-shapes indices
1057 # Example: see GEOM_TestOthers.py
1058 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1059 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1060 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1063 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1064 # the specified quadrangle by the certain way, defined through \a theState parameter.
1065 # @param theShape Shape to find sub-shapes of.
1066 # @param theShapeType Type of sub-shapes to be retrieved.
1067 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1068 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1069 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1070 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1071 # @param theState The state of the subshapes to find. It can be one of
1072 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1073 # @return List of all found sub-shapes.
1075 # Example: see GEOM_TestOthers.py
1076 def GetShapesOnQuadrangle(self,theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
1077 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
1078 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
1081 ## Works like the above method, but returns list of sub-shapes indices
1083 # Example: see GEOM_TestOthers.py
1084 def GetShapesOnQuadrangleIDs(self,theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
1085 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
1086 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
1089 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1090 # the specified \a theBox by the certain way, defined through \a theState parameter.
1091 # @param theBox Shape for relative comparing.
1092 # @param theShape Shape to find sub-shapes of.
1093 # @param theShapeType Type of sub-shapes to be retrieved.
1094 # @param theState The state of the subshapes to find. It can be one of
1095 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1096 # @return List of all found sub-shapes.
1098 def GetShapesOnBox(self,theBox, theShape, theShapeType, theState):
1099 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
1100 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
1103 ## Works like the above method, but returns list of sub-shapes indices
1105 def GetShapesOnBoxIDs(self,theBox, theShape, theShapeType, theState):
1106 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
1107 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
1110 ## Find in \a theShape all sub-shapes of type \a theShapeType,
1111 # situated relatively the specified \a theCheckShape by the
1112 # certain way, defined through \a theState parameter.
1113 # @param theCheckShape Shape for relative comparing.
1114 # @param theShape Shape to find sub-shapes of.
1115 # @param theShapeType Type of sub-shapes to be retrieved.
1116 # @param theState The state of the subshapes to find. It can be one of
1117 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1118 # @return List of all found sub-shapes.
1120 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
1121 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
1122 theShapeType, theState)
1123 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
1126 ## Works like the above method, but returns result as compound
1128 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
1129 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
1130 theShapeType, theState)
1131 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
1134 ## Works like the above method, but returns list of sub-shapes indices
1136 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
1137 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
1138 theShapeType, theState)
1139 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
1142 ## Get sub-shape(s) of theShapeWhere, which are
1143 # coincident with \a theShapeWhat or could be a part of it.
1144 # @param theShapeWhere Shape to find sub-shapes of.
1145 # @param theShapeWhat Shape, specifying what to find.
1146 # @return Group of all found sub-shapes or a single found sub-shape.
1148 # Example: see GEOM_TestOthers.py
1149 def GetInPlace(self,theShapeWhere, theShapeWhat):
1150 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
1151 RaiseIfFailed("GetInPlace", self.ShapesOp)
1154 ## Get sub-shape(s) of \a theShapeWhere, which are
1155 # coincident with \a theShapeWhat or could be a part of it.
1157 # Implementation of this method is based on a saved history of an operation,
1158 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
1159 # arguments (an argument shape or a sub-shape of an argument shape).
1160 # The operation could be the Partition or one of boolean operations,
1161 # performed on simple shapes (not on compounds).
1163 # @param theShapeWhere Shape to find sub-shapes of.
1164 # @param theShapeWhat Shape, specifying what to find (must be in the
1165 # building history of the ShapeWhere).
1166 # @return Group of all found sub-shapes or a single found sub-shape.
1168 # Example: see GEOM_TestOthers.py
1169 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
1170 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
1171 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
1174 ## Get sub-shape of theShapeWhere, which is
1175 # equal to \a theShapeWhat.
1176 # @param theShapeWhere Shape to find sub-shape of.
1177 # @param theShapeWhat Shape, specifying what to find.
1178 # @return New GEOM_Object for found sub-shape.
1180 def GetSame(self,theShapeWhere, theShapeWhat):
1181 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
1182 RaiseIfFailed("GetSame", self.ShapesOp)
1185 # -----------------------------------------------------------------------------
1186 # Access to sub-shapes by their unique IDs inside the main shape.
1187 # -----------------------------------------------------------------------------
1189 ## Obtain a composite sub-shape of <aShape>, composed from sub-shapes
1190 # of <aShape>, selected by their unique IDs inside <aShape>
1192 # Example: see GEOM_TestAll.py
1193 def GetSubShape(self,aShape, ListOfID):
1194 anObj = self.AddSubShape(aShape,ListOfID)
1197 ## Obtain unique ID of sub-shape <aSubShape> inside <aShape>
1199 # Example: see GEOM_TestAll.py
1200 def GetSubShapeID(self,aShape, aSubShape):
1201 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
1202 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
1205 # -----------------------------------------------------------------------------
1207 # -----------------------------------------------------------------------------
1209 ## Explode a shape on subshapes of a given type.
1210 # @param theShape Shape to be exploded.
1211 # @param theShapeType Type of sub-shapes to be retrieved.
1212 # @return List of sub-shapes of type theShapeType, contained in theShape.
1214 # Example: see GEOM_TestAll.py
1215 def SubShapeAll(self,aShape, aType):
1216 ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
1217 RaiseIfFailed("MakeExplode", self.ShapesOp)
1220 ## Explode a shape on subshapes of a given type.
1221 # @param theShape Shape to be exploded.
1222 # @param theShapeType Type of sub-shapes to be retrieved.
1223 # @return List of IDs of sub-shapes.
1224 def SubShapeAllIDs(self,aShape, aType):
1225 ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
1226 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1229 ## Explode a shape on subshapes of a given type.
1230 # Sub-shapes will be sorted by coordinates of their gravity centers.
1231 # @param theShape Shape to be exploded.
1232 # @param theShapeType Type of sub-shapes to be retrieved.
1233 # @return List of sub-shapes of type theShapeType, contained in theShape.
1235 # Example: see GEOM_TestAll.py
1236 def SubShapeAllSorted(self,aShape, aType):
1237 ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
1238 RaiseIfFailed("MakeExplode", self.ShapesOp)
1241 ## Explode a shape on subshapes of a given type.
1242 # Sub-shapes will be sorted by coordinates of their gravity centers.
1243 # @param theShape Shape to be exploded.
1244 # @param theShapeType Type of sub-shapes to be retrieved.
1245 # @return List of IDs of sub-shapes.
1246 def SubShapeAllSortedIDs(self,aShape, aType):
1247 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
1248 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1251 ## Obtain a compound of sub-shapes of <aShape>,
1252 # selected by they indices in list of all sub-shapes of type <aType>.
1253 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1255 # Example: see GEOM_TestAll.py
1256 def SubShape(self,aShape, aType, ListOfInd):
1258 AllShapeList = self.SubShapeAll(aShape, aType)
1259 for ind in ListOfInd:
1260 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1261 anObj = self.GetSubShape(aShape, ListOfIDs)
1264 ## Obtain a compound of sub-shapes of <aShape>,
1265 # selected by they indices in sorted list of all sub-shapes of type <aType>.
1266 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1268 # Example: see GEOM_TestAll.py
1269 def SubShapeSorted(self,aShape, aType, ListOfInd):
1271 AllShapeList = self.SubShapeAllSorted(aShape, aType)
1272 for ind in ListOfInd:
1273 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1274 anObj = self.GetSubShape(aShape, ListOfIDs)
1277 # -----------------------------------------------------------------------------
1278 # Healing operations
1279 # -----------------------------------------------------------------------------
1281 ## Apply a sequence of Shape Healing operators to the given object.
1282 # @param theShape Shape to be processed.
1283 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1284 # @param theParameters List of names of parameters
1285 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1286 # @param theValues List of values of parameters, in the same order
1287 # as parameters are listed in \a theParameters list.
1288 # @return New GEOM_Object, containing processed shape.
1290 # Example: see GEOM_TestHealing.py
1291 def ProcessShape(self,theShape, theOperators, theParameters, theValues):
1292 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1293 RaiseIfFailed("ProcessShape", self.HealOp)
1296 ## Remove faces from the given object (shape).
1297 # @param theObject Shape to be processed.
1298 # @param theFaces Indices of faces to be removed, if EMPTY then the method
1299 # removes ALL faces of the given object.
1300 # @return New GEOM_Object, containing processed shape.
1302 # Example: see GEOM_TestHealing.py
1303 def SuppressFaces(self,theObject, theFaces):
1304 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
1305 RaiseIfFailed("SuppressFaces", self.HealOp)
1308 ## Sewing of some shapes into single shape.
1310 # Example: see GEOM_TestHealing.py
1311 def MakeSewing(self,ListShape, theTolerance):
1312 comp = self.MakeCompound(ListShape)
1313 anObj = self.Sew(comp, theTolerance)
1316 ## Sewing of the given object.
1317 # @param theObject Shape to be processed.
1318 # @param theTolerance Required tolerance value.
1319 # @return New GEOM_Object, containing processed shape.
1321 # Example: see MakeSewing() above
1322 def Sew(self,theObject, theTolerance):
1323 anObj = self.HealOp.Sew(theObject, theTolerance)
1324 RaiseIfFailed("Sew", self.HealOp)
1327 ## Remove internal wires and edges from the given object (face).
1328 # @param theObject Shape to be processed.
1329 # @param theWires Indices of wires to be removed, if EMPTY then the method
1330 # removes ALL internal wires of the given object.
1331 # @return New GEOM_Object, containing processed shape.
1333 # Example: see GEOM_TestHealing.py
1334 def SuppressInternalWires(self,theObject, theWires):
1335 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
1336 RaiseIfFailed("RemoveIntWires", self.HealOp)
1339 ## Remove internal closed contours (holes) from the given object.
1340 # @param theObject Shape to be processed.
1341 # @param theWires Indices of wires to be removed, if EMPTY then the method
1342 # removes ALL internal holes of the given object
1343 # @return New GEOM_Object, containing processed shape.
1345 # Example: see GEOM_TestHealing.py
1346 def SuppressHoles(self,theObject, theWires):
1347 anObj = self.HealOp.FillHoles(theObject, theWires)
1348 RaiseIfFailed("FillHoles", self.HealOp)
1351 ## Close an open wire.
1352 # @param theObject Shape to be processed.
1353 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1354 # if -1, then theObject itself is a wire.
1355 # @param isCommonVertex If TRUE : closure by creation of a common vertex,
1356 # If FALS : closure by creation of an edge between ends.
1357 # @return New GEOM_Object, containing processed shape.
1359 # Example: see GEOM_TestHealing.py
1360 def CloseContour(self,theObject, theWires, isCommonVertex):
1361 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
1362 RaiseIfFailed("CloseContour", self.HealOp)
1365 ## Addition of a point to a given edge object.
1366 # @param theObject Shape to be processed.
1367 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
1368 # if -1, then theObject itself is the edge.
1369 # @param theValue Value of parameter on edge or length parameter,
1370 # depending on \a isByParameter.
1371 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1372 # if FALSE : \a theValue is treated as a length parameter [0..1]
1373 # @return New GEOM_Object, containing processed shape.
1375 # Example: see GEOM_TestHealing.py
1376 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
1377 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1378 RaiseIfFailed("DivideEdge", self.HealOp)
1381 ## Change orientation of the given object.
1382 # @param theObject Shape to be processed.
1383 # @update given shape
1384 def ChangeOrientationShell(self,theObject):
1385 theObject = self.HealOp.ChangeOrientation(theObject)
1386 RaiseIfFailed("ChangeOrientation", self.HealOp)
1389 ## Change orientation of the given object.
1390 # @param theObject Shape to be processed.
1391 # @return New GEOM_Object, containing processed shape.
1392 def ChangeOrientationShellCopy(self,theObject):
1393 anObj = self.HealOp.ChangeOrientationCopy(theObject)
1394 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
1397 ## Get a list of wires (wrapped in GEOM_Object-s),
1398 # that constitute a free boundary of the given shape.
1399 # @param theObject Shape to get free boundary of.
1400 # @return [status, theClosedWires, theOpenWires]
1401 # status: FALSE, if an error(s) occured during the method execution.
1402 # theClosedWires: Closed wires on the free boundary of the given shape.
1403 # theOpenWires: Open wires on the free boundary of the given shape.
1405 # Example: see GEOM_TestHealing.py
1406 def GetFreeBoundary(self,theObject):
1407 anObj = self.HealOp.GetFreeBoundary(theObject)
1408 RaiseIfFailed("GetFreeBoundary", self.HealOp)
1411 # -----------------------------------------------------------------------------
1412 # Create advanced objects
1413 # -----------------------------------------------------------------------------
1415 ## Create a copy of the given object
1417 # Example: see GEOM_TestAll.py
1418 def MakeCopy(self,theOriginal):
1419 anObj = self.InsertOp.MakeCopy(theOriginal)
1420 RaiseIfFailed("MakeCopy", self.InsertOp)
1423 ## Create a filling from the given compound of contours.
1424 # @param theShape the compound of contours
1425 # @param theMinDeg a minimal degree of BSpline surface to create
1426 # @param theMaxDeg a maximal degree of BSpline surface to create
1427 # @param theTol2D a 2d tolerance to be reached
1428 # @param theTol3D a 3d tolerance to be reached
1429 # @param theNbIter a number of iteration of approximation algorithm
1430 # @return New GEOM_Object, containing the created filling surface.
1432 # Example: see GEOM_TestAll.py
1433 def MakeFilling(self,theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
1434 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox)
1435 RaiseIfFailed("MakeFilling", self.PrimOp)
1438 ## Replace coincident faces in theShape by one face.
1439 # @param theShape Initial shape.
1440 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
1441 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1442 # otherwise all initial shapes.
1443 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
1445 # Example: see GEOM_Spanner.py
1446 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
1447 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
1449 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
1453 ## Find coincident faces in theShape for possible gluing.
1454 # @param theShape Initial shape.
1455 # @param theTolerance Maximum distance between faces,
1456 # which can be considered as coincident.
1459 # Example: see GEOM_Spanner.py
1460 def GetGlueFaces(self, theShape, theTolerance):
1461 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
1462 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
1466 ## Replace coincident faces in theShape by one face
1467 # in compliance with given list of faces
1468 # @param theShape Initial shape.
1469 # @param theTolerance Maximum distance between faces,
1470 # which can be considered as coincident.
1471 # @param theFaces List of faces for gluing.
1472 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1473 # otherwise all initial shapes.
1474 # @return New GEOM_Object, containing a copy of theShape
1475 # without some faces.
1477 # Example: see GEOM_Spanner.py
1478 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
1479 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
1481 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
1485 # -----------------------------------------------------------------------------
1486 # Boolean (Common, Cut, Fuse, Section)
1487 # -----------------------------------------------------------------------------
1489 ## Perform one of boolean operations on two given shapes.
1490 # @param theShape1 First argument for boolean operation.
1491 # @param theShape2 Second argument for boolean operation.
1492 # @param theOperation Indicates the operation to be done:
1493 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
1494 # @return New GEOM_Object, containing the result shape.
1496 # Example: see GEOM_TestAll.py
1497 def MakeBoolean(self,theShape1, theShape2, theOperation):
1498 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
1499 RaiseIfFailed("MakeBoolean", self.BoolOp)
1502 ## Shortcut to MakeBoolean(s1, s2, 1)
1504 # Example: see GEOM_TestOthers.py
1505 def MakeCommon(self, s1, s2):
1506 return self.MakeBoolean(s1, s2, 1)
1508 ## Shortcut to MakeBoolean(s1, s2, 2)
1510 # Example: see GEOM_TestOthers.py
1511 def MakeCut(self, s1, s2):
1512 return self.MakeBoolean(s1, s2, 2)
1514 ## Shortcut to MakeBoolean(s1, s2, 3)
1516 # Example: see GEOM_TestOthers.py
1517 def MakeFuse(self, s1, s2):
1518 return self.MakeBoolean(s1, s2, 3)
1520 ## Shortcut to MakeBoolean(s1, s2, 4)
1522 # Example: see GEOM_TestOthers.py
1523 def MakeSection(self, s1, s2):
1524 return self.MakeBoolean(s1, s2, 4)
1526 ## Perform partition operation.
1527 # @param ListShapes Shapes to be intersected.
1528 # @param ListTools Shapes to intersect theShapes.
1529 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
1530 # in order to avoid possible intersection between shapes from
1532 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
1533 # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
1534 # type <= Limit are kept in the result,
1535 # else - shapes with type > Limit are kept
1536 # also (if they exist)
1538 # After implementation new version of PartitionAlgo (October 2006)
1539 # other parameters are ignored by current functionality. They are kept
1540 # in this function only for support old versions.
1541 # Ignored parameters:
1542 # @param ListKeepInside Shapes, outside which the results will be deleted.
1543 # Each shape from theKeepInside must belong to theShapes also.
1544 # @param ListRemoveInside Shapes, inside which the results will be deleted.
1545 # Each shape from theRemoveInside must belong to theShapes also.
1546 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
1547 # @param ListMaterials Material indices for each shape. Make sence,
1548 # only if theRemoveWebs is TRUE.
1550 # @return New GEOM_Object, containing the result shapes.
1552 # Example: see GEOM_TestAll.py
1553 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1554 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
1555 KeepNonlimitShapes=0):
1556 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
1557 ListKeepInside, ListRemoveInside,
1558 Limit, RemoveWebs, ListMaterials,
1559 KeepNonlimitShapes);
1560 RaiseIfFailed("MakePartition", self.BoolOp)
1563 ## Perform partition operation.
1564 # This method may be useful if it is needed to make a partition for
1565 # compound contains nonintersected shapes. Performance will be better
1566 # since intersection between shapes from compound is not performed.
1568 # Description of all parameters as in previous method MakePartition()
1570 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
1571 # have to consist of nonintersecting shapes.
1573 # @return New GEOM_Object, containing the result shapes.
1575 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
1576 ListKeepInside=[], ListRemoveInside=[],
1577 Limit=ShapeType["SHAPE"], RemoveWebs=0,
1578 ListMaterials=[], KeepNonlimitShapes=0):
1579 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
1580 ListKeepInside, ListRemoveInside,
1581 Limit, RemoveWebs, ListMaterials,
1582 KeepNonlimitShapes);
1583 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
1586 ## Shortcut to MakePartition()
1588 # Example: see GEOM_TestOthers.py
1589 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1590 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
1591 KeepNonlimitShapes=0):
1592 anObj = self.MakePartition(ListShapes, ListTools,
1593 ListKeepInside, ListRemoveInside,
1594 Limit, RemoveWebs, ListMaterials,
1595 KeepNonlimitShapes);
1598 ## Perform partition of the Shape with the Plane
1599 # @param theShape Shape to be intersected.
1600 # @param thePlane Tool shape, to intersect theShape.
1601 # @return New GEOM_Object, containing the result shape.
1603 # Example: see GEOM_TestAll.py
1604 def MakeHalfPartition(self,theShape, thePlane):
1605 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
1606 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
1609 # -----------------------------------------------------------------------------
1611 # -----------------------------------------------------------------------------
1613 ## Translate the given object along the vector, specified
1614 # by its end points, creating its copy before the translation.
1615 # @param theObject The object to be translated.
1616 # @param thePoint1 Start point of translation vector.
1617 # @param thePoint2 End point of translation vector.
1618 # @return New GEOM_Object, containing the translated object.
1620 # Example: see GEOM_TestAll.py
1621 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
1622 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
1623 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
1626 ## Translate the given object along the vector, specified
1627 # by its components, creating its copy before the translation.
1628 # @param theObject The object to be translated.
1629 # @param theDX,theDY,theDZ Components of translation vector.
1630 # @return New GEOM_Object, containing the translated object.
1632 # Example: see GEOM_TestAll.py
1633 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
1634 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
1635 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
1638 ## Translate the given object along the given vector,
1639 # creating its copy before the translation.
1640 # @param theObject The object to be translated.
1641 # @param theVector The translation vector.
1642 # @return New GEOM_Object, containing the translated object.
1644 # Example: see GEOM_TestAll.py
1645 def MakeTranslationVector(self,theObject, theVector):
1646 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
1647 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
1650 ## Translate the given object along the given vector on given distance,
1651 # creating its copy before the translation.
1652 # @param theObject The object to be translated.
1653 # @param theVector The translation vector.
1654 # @param theDistance The translation distance.
1655 # @return New GEOM_Object, containing the translated object.
1657 # Example: see GEOM_TestAll.py
1658 def MakeTranslationVectorDistance(self,theObject, theVector, theDistance):
1659 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
1660 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
1663 ## Rotate the given object around the given axis
1664 # on the given angle, creating its copy before the rotatation.
1665 # @param theObject The object to be rotated.
1666 # @param theAxis Rotation axis.
1667 # @param theAngle Rotation angle in radians.
1668 # @return New GEOM_Object, containing the rotated object.
1670 # Example: see GEOM_TestAll.py
1671 def MakeRotation(self,theObject, theAxis, theAngle):
1672 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
1673 RaiseIfFailed("RotateCopy", self.TrsfOp)
1676 ## Rotate given object around vector perpendicular to plane
1677 # containing three points, creating its copy before the rotatation.
1678 # @param theObject The object to be rotated.
1679 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
1680 # containing the three points.
1681 # @param thePoint1 and thePoint2 - in a perpendicular plan of the axis.
1682 # @return New GEOM_Object, containing the rotated object.
1684 # Example: see GEOM_TestAll.py
1685 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
1686 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
1687 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
1690 ## Scale the given object by the factor, creating its copy before the scaling.
1691 # @param theObject The object to be scaled.
1692 # @param thePoint Center point for scaling.
1693 # @param theFactor Scaling factor value.
1694 # @return New GEOM_Object, containing the scaled shape.
1696 # Example: see GEOM_TestAll.py
1697 def MakeScaleTransform(self,theObject, thePoint, theFactor):
1698 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
1699 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
1702 ## Create an object, symmetrical
1703 # to the given one relatively the given plane.
1704 # @param theObject The object to be mirrored.
1705 # @param thePlane Plane of symmetry.
1706 # @return New GEOM_Object, containing the mirrored shape.
1708 # Example: see GEOM_TestAll.py
1709 def MakeMirrorByPlane(self,theObject, thePlane):
1710 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
1711 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
1714 ## Create an object, symmetrical
1715 # to the given one relatively the given axis.
1716 # @param theObject The object to be mirrored.
1717 # @param theAxis Axis of symmetry.
1718 # @return New GEOM_Object, containing the mirrored shape.
1720 # Example: see GEOM_TestAll.py
1721 def MakeMirrorByAxis(self,theObject, theAxis):
1722 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
1723 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
1726 ## Create an object, symmetrical
1727 # to the given one relatively the given point.
1728 # @param theObject The object to be mirrored.
1729 # @param thePoint Point of symmetry.
1730 # @return New GEOM_Object, containing the mirrored shape.
1732 # Example: see GEOM_TestAll.py
1733 def MakeMirrorByPoint(self,theObject, thePoint):
1734 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
1735 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
1738 ## Modify the Location of the given object by LCS,
1739 # creating its copy before the setting.
1740 # @param theObject The object to be displaced.
1741 # @param theStartLCS Coordinate system to perform displacement from it.
1742 # If \a theStartLCS is NULL, displacement
1743 # will be performed from global CS.
1744 # If \a theObject itself is used as \a theStartLCS,
1745 # its location will be changed to \a theEndLCS.
1746 # @param theEndLCS Coordinate system to perform displacement to it.
1747 # @return New GEOM_Object, containing the displaced shape.
1749 # Example: see GEOM_TestAll.py
1750 def MakePosition(self,theObject, theStartLCS, theEndLCS):
1751 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
1752 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
1755 ## Create new object as offset of the given one.
1756 # @param theObject The base object for the offset.
1757 # @param theOffset Offset value.
1758 # @return New GEOM_Object, containing the offset object.
1760 # Example: see GEOM_TestAll.py
1761 def MakeOffset(self,theObject, theOffset):
1762 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
1763 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
1766 # -----------------------------------------------------------------------------
1768 # -----------------------------------------------------------------------------
1770 ## Translate the given object along the given vector a given number times
1771 # @param theObject The object to be translated.
1772 # @param theVector Direction of the translation.
1773 # @param theStep Distance to translate on.
1774 # @param theNbTimes Quantity of translations to be done.
1775 # @return New GEOM_Object, containing compound of all
1776 # the shapes, obtained after each translation.
1778 # Example: see GEOM_TestAll.py
1779 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
1780 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
1781 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
1784 ## Conseqently apply two specified translations to theObject specified number of times.
1785 # @param theObject The object to be translated.
1786 # @param theVector1 Direction of the first translation.
1787 # @param theStep1 Step of the first translation.
1788 # @param theNbTimes1 Quantity of translations to be done along theVector1.
1789 # @param theVector2 Direction of the second translation.
1790 # @param theStep2 Step of the second translation.
1791 # @param theNbTimes2 Quantity of translations to be done along theVector2.
1792 # @return New GEOM_Object, containing compound of all
1793 # the shapes, obtained after each translation.
1795 # Example: see GEOM_TestAll.py
1796 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
1797 theVector2, theStep2, theNbTimes2):
1798 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
1799 theVector2, theStep2, theNbTimes2)
1800 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
1803 ## Rotate the given object around the given axis a given number times.
1804 # Rotation angle will be 2*PI/theNbTimes.
1805 # @param theObject The object to be rotated.
1806 # @param theAxis The rotation axis.
1807 # @param theNbTimes Quantity of rotations to be done.
1808 # @return New GEOM_Object, containing compound of all the
1809 # shapes, obtained after each rotation.
1811 # Example: see GEOM_TestAll.py
1812 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
1813 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
1814 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
1817 ## Rotate the given object around the
1818 # given axis on the given angle a given number
1819 # times and multi-translate each rotation result.
1820 # Translation direction passes through center of gravity
1821 # of rotated shape and its projection on the rotation axis.
1822 # @param theObject The object to be rotated.
1823 # @param theAxis Rotation axis.
1824 # @param theAngle Rotation angle in graduces.
1825 # @param theNbTimes1 Quantity of rotations to be done.
1826 # @param theStep Translation distance.
1827 # @param theNbTimes2 Quantity of translations to be done.
1828 # @return New GEOM_Object, containing compound of all the
1829 # shapes, obtained after each transformation.
1831 # Example: see GEOM_TestAll.py
1832 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
1833 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
1834 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
1837 ## The same, as MultiRotate1D(), but axis is given by direction and point
1839 # Example: see GEOM_TestOthers.py
1840 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
1841 aVec = self.MakeLine(aPoint,aDir)
1842 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
1845 ## The same, as MultiRotate2D(), but axis is given by direction and point
1847 # Example: see GEOM_TestOthers.py
1848 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
1849 aVec = self.MakeLine(aPoint,aDir)
1850 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
1853 # -----------------------------------------------------------------------------
1855 # -----------------------------------------------------------------------------
1857 ## Perform a fillet on all edges of the given shape.
1858 # @param theShape Shape, to perform fillet on.
1859 # @param theR Fillet radius.
1860 # @return New GEOM_Object, containing the result shape.
1862 # Example: see GEOM_TestOthers.py
1863 def MakeFilletAll(self,theShape, theR):
1864 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
1865 RaiseIfFailed("MakeFilletAll", self.LocalOp)
1868 ## Perform a fillet on the specified edges/faces of the given shape
1869 # @param theShape Shape, to perform fillet on.
1870 # @param theR Fillet radius.
1871 # @param theShapeType Type of shapes in <theListShapes>.
1872 # @param theListShapes Global indices of edges/faces to perform fillet on.
1873 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1874 # @return New GEOM_Object, containing the result shape.
1876 # Example: see GEOM_TestAll.py
1877 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
1879 if theShapeType == ShapeType["EDGE"]:
1880 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
1881 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
1883 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
1884 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
1887 ## The same that MakeFillet but with two Fillet Radius R1 and R2
1888 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
1890 if theShapeType == ShapeType["EDGE"]:
1891 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
1892 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
1894 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
1895 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
1898 ## Perform a symmetric chamfer on all edges of the given shape.
1899 # @param theShape Shape, to perform chamfer on.
1900 # @param theD Chamfer size along each face.
1901 # @return New GEOM_Object, containing the result shape.
1903 # Example: see GEOM_TestOthers.py
1904 def MakeChamferAll(self,theShape, theD):
1905 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
1906 RaiseIfFailed("MakeChamferAll", self.LocalOp)
1909 ## Perform a chamfer on edges, common to the specified faces,
1910 # with distance D1 on the Face1
1911 # @param theShape Shape, to perform chamfer on.
1912 # @param theD1 Chamfer size along \a theFace1.
1913 # @param theD2 Chamfer size along \a theFace2.
1914 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
1915 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1916 # @return New GEOM_Object, containing the result shape.
1918 # Example: see GEOM_TestAll.py
1919 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
1920 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
1921 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
1924 ## The Same that MakeChamferEdge but with params theD is chamfer lenght and
1925 # theAngle is Angle of chamfer (angle in radians)
1926 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
1927 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
1928 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
1931 ## Perform a chamfer on all edges of the specified faces,
1932 # with distance D1 on the first specified face (if several for one edge)
1933 # @param theShape Shape, to perform chamfer on.
1934 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
1935 # connected to the edge, are in \a theFaces, \a theD1
1936 # will be get along face, which is nearer to \a theFaces beginning.
1937 # @param theD2 Chamfer size along another of two faces, connected to the edge.
1938 # @param theFaces Sequence of global indices of faces of \a theShape.
1939 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1940 # @return New GEOM_Object, containing the result shape.
1942 # Example: see GEOM_TestAll.py
1943 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
1944 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
1945 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
1948 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
1949 # theAngle is Angle of chamfer (angle in radians)
1950 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
1951 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
1952 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
1955 ## Perform a chamfer on edges,
1956 # with distance D1 on the first specified face (if several for one edge)
1957 # @param theShape Shape, to perform chamfer on.
1958 # @param theD1 and theD2 Chamfer size
1959 # @param theEdges Sequence of edges of \a theShape.
1960 # @return New GEOM_Object, containing the result shape.
1963 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
1964 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
1965 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
1968 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
1969 # theAngle is Angle of chamfer (angle in radians)
1970 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
1971 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
1972 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
1975 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
1977 # Example: see GEOM_TestOthers.py
1978 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
1980 if aShapeType == ShapeType["EDGE"]:
1981 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
1983 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
1986 ## Perform an Archimde operation on the given shape with given parameters.
1987 # The object presenting the resulting face is returned.
1988 # @param theShape Shape to be put in water.
1989 # @param theWeight Weight og the shape.
1990 # @param theWaterDensity Density of the water.
1991 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
1992 # @return New GEOM_Object, containing a section of \a theShape
1993 # by a plane, corresponding to water level.
1995 # Example: see GEOM_TestAll.py
1996 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
1997 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
1998 RaiseIfFailed("MakeArchimede", self.LocalOp)
2001 # -----------------------------------------------------------------------------
2002 # Information objects
2003 # -----------------------------------------------------------------------------
2005 ## Get point coordinates
2008 # Example: see GEOM_TestMeasures.py
2009 def PointCoordinates(self,Point):
2010 aTuple = self.MeasuOp.PointCoordinates(Point)
2011 RaiseIfFailed("PointCoordinates", self.MeasuOp)
2014 ## Get summarized length of all wires,
2015 # area of surface and volume of the given shape.
2016 # @param theShape Shape to define properties of.
2017 # @return [theLength, theSurfArea, theVolume]
2018 # theLength: Summarized length of all wires of the given shape.
2019 # theSurfArea: Area of surface of the given shape.
2020 # theVolume: Volume of the given shape.
2022 # Example: see GEOM_TestMeasures.py
2023 def BasicProperties(self,theShape):
2024 aTuple = self.MeasuOp.GetBasicProperties(theShape)
2025 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
2028 ## Get parameters of bounding box of the given shape
2029 # @param theShape Shape to obtain bounding box of.
2030 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
2031 # Xmin,Xmax: Limits of shape along OX axis.
2032 # Ymin,Ymax: Limits of shape along OY axis.
2033 # Zmin,Zmax: Limits of shape along OZ axis.
2035 # Example: see GEOM_TestMeasures.py
2036 def BoundingBox(self,theShape):
2037 aTuple = self.MeasuOp.GetBoundingBox(theShape)
2038 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
2041 ## Get inertia matrix and moments of inertia of theShape.
2042 # @param theShape Shape to calculate inertia of.
2043 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
2044 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
2045 # Ix,Iy,Iz: Moments of inertia of the given shape.
2047 # Example: see GEOM_TestMeasures.py
2048 def Inertia(self,theShape):
2049 aTuple = self.MeasuOp.GetInertia(theShape)
2050 RaiseIfFailed("GetInertia", self.MeasuOp)
2053 ## Get minimal distance between the given shapes.
2054 # @param theShape1,theShape2 Shapes to find minimal distance between.
2055 # @return Value of the minimal distance between the given shapes.
2057 # Example: see GEOM_TestMeasures.py
2058 def MinDistance(self, theShape1, theShape2):
2059 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2060 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2063 ## Get minimal distance between the given shapes.
2064 # @param theShape1,theShape2 Shapes to find minimal distance between.
2065 # @return Value of the minimal distance between the given shapes.
2067 # Example: see GEOM_TestMeasures.py
2068 def MinDistanceComponents(self, theShape1, theShape2):
2069 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2070 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2071 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
2074 ## Get angle between the given shapes.
2075 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2076 # @return Value of the angle between the given shapes.
2078 # Example: see GEOM_TestMeasures.py
2079 def GetAngle(self, theShape1, theShape2):
2080 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
2081 RaiseIfFailed("GetAngle", self.MeasuOp)
2084 ## Get min and max tolerances of sub-shapes of theShape
2085 # @param theShape Shape, to get tolerances of.
2086 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
2087 # FaceMin,FaceMax: Min and max tolerances of the faces.
2088 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
2089 # VertMin,VertMax: Min and max tolerances of the vertices.
2091 # Example: see GEOM_TestMeasures.py
2092 def Tolerance(self,theShape):
2093 aTuple = self.MeasuOp.GetTolerance(theShape)
2094 RaiseIfFailed("GetTolerance", self.MeasuOp)
2097 ## Obtain description of the given shape (number of sub-shapes of each type)
2098 # @param theShape Shape to be described.
2099 # @return Description of the given shape.
2101 # Example: see GEOM_TestMeasures.py
2102 def WhatIs(self,theShape):
2103 aDescr = self.MeasuOp.WhatIs(theShape)
2104 RaiseIfFailed("WhatIs", self.MeasuOp)
2107 ## Get a point, situated at the centre of mass of theShape.
2108 # @param theShape Shape to define centre of mass of.
2109 # @return New GEOM_Object, containing the created point.
2111 # Example: see GEOM_TestMeasures.py
2112 def MakeCDG(self,theShape):
2113 anObj = self.MeasuOp.GetCentreOfMass(theShape)
2114 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
2117 ## Get a normale to the given face. If the point is not given,
2118 # the normale is calculated at the center of mass.
2119 # @param theFace Face to define normale of.
2120 # @param theOptionalPoint Point to compute the normale at.
2121 # @return New GEOM_Object, containing the created vector.
2123 # Example: see GEOM_TestMeasures.py
2124 def GetNormal(self, theFace, theOptionalPoint = None):
2125 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
2126 RaiseIfFailed("GetNormal", self.MeasuOp)
2129 ## Check a topology of the given shape.
2130 # @param theShape Shape to check validity of.
2131 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
2132 # if TRUE, the shape's geometry will be checked also.
2133 # @return TRUE, if the shape "seems to be valid".
2134 # If theShape is invalid, prints a description of problem.
2136 # Example: see GEOM_TestMeasures.py
2137 def CheckShape(self,theShape, theIsCheckGeom = 0):
2139 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
2140 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
2142 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
2143 RaiseIfFailed("CheckShape", self.MeasuOp)
2148 ## Get position (LCS) of theShape.
2150 # Origin of the LCS is situated at the shape's center of mass.
2151 # Axes of the LCS are obtained from shape's location or,
2152 # if the shape is a planar face, from position of its plane.
2154 # @param theShape Shape to calculate position of.
2155 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
2156 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
2157 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
2158 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
2160 # Example: see GEOM_TestMeasures.py
2161 def GetPosition(self,theShape):
2162 aTuple = self.MeasuOp.GetPosition(theShape)
2163 RaiseIfFailed("GetPosition", self.MeasuOp)
2166 ## Get kind of theShape.
2168 # @param theShape Shape to get a kind of.
2169 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
2170 # and a list of parameters, describing the shape.
2171 # @note Concrete meaning of each value, returned via \a theIntegers
2172 # or \a theDoubles list depends on the kind of the shape.
2173 # The full list of possible outputs is:
2175 # geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
2176 # geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
2178 # geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
2179 # geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
2181 # geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
2182 # geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
2184 # geompy.kind.SPHERE xc yc zc R
2185 # geompy.kind.CYLINDER xb yb zb dx dy dz R H
2186 # geompy.kind.BOX xc yc zc ax ay az
2187 # geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
2188 # geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
2189 # geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
2190 # geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
2191 # geompy.kind.SOLID nb_faces nb_edges nb_vertices
2193 # geompy.kind.SPHERE2D xc yc zc R
2194 # geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
2195 # geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
2196 # geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
2197 # geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
2198 # geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
2199 # geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
2200 # geompy.kind.PLANE xo yo zo dx dy dz
2201 # geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
2202 # geompy.kind.FACE nb_edges nb_vertices
2204 # geompy.kind.CIRCLE xc yc zc dx dy dz R
2205 # geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
2206 # geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
2207 # geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
2208 # geompy.kind.LINE xo yo zo dx dy dz
2209 # geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
2210 # geompy.kind.EDGE nb_vertices
2212 # geompy.kind.VERTEX x y z
2214 # Example: see GEOM_TestMeasures.py
2215 def KindOfShape(self,theShape):
2216 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
2217 RaiseIfFailed("KindOfShape", self.MeasuOp)
2219 aKind = aRoughTuple[0]
2220 anInts = aRoughTuple[1]
2221 aDbls = aRoughTuple[2]
2223 # Now there is no exception from this rule:
2224 aKindTuple = [aKind] + aDbls + anInts
2226 # If they are we will regroup parameters for such kind of shape.
2228 #if aKind == kind.SOME_KIND:
2229 # # SOME_KIND int int double int double double
2230 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
2234 # -----------------------------------------------------------------------------
2235 # Import/Export objects
2236 # -----------------------------------------------------------------------------
2238 ## Import a shape from the BREP or IGES or STEP file
2239 # (depends on given format) with given name.
2240 # @param theFileName The file, containing the shape.
2241 # @param theFormatName Specify format for the file reading.
2242 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2243 # @return New GEOM_Object, containing the imported shape.
2245 # Example: see GEOM_TestOthers.py
2246 def Import(self,theFileName, theFormatName):
2247 anObj = self.InsertOp.Import(theFileName, theFormatName)
2248 RaiseIfFailed("Import", self.InsertOp)
2251 ## Shortcut to Import() for BREP format
2253 # Example: see GEOM_TestOthers.py
2254 def ImportBREP(self,theFileName):
2255 return self.Import(theFileName, "BREP")
2257 ## Shortcut to Import() for IGES format
2259 # Example: see GEOM_TestOthers.py
2260 def ImportIGES(self,theFileName):
2261 return self.Import(theFileName, "IGES")
2263 ## Shortcut to Import() for STEP format
2265 # Example: see GEOM_TestOthers.py
2266 def ImportSTEP(self,theFileName):
2267 return self.Import(theFileName, "STEP")
2269 ## Export the given shape into a file with given name.
2270 # @param theObject Shape to be stored in the file.
2271 # @param theFileName Name of the file to store the given shape in.
2272 # @param theFormatName Specify format for the shape storage.
2273 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2275 # Example: see GEOM_TestOthers.py
2276 def Export(self,theObject, theFileName, theFormatName):
2277 self.InsertOp.Export(theObject, theFileName, theFormatName)
2278 if self.InsertOp.IsDone() == 0:
2279 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
2283 ## Shortcut to Export() for BREP format
2285 # Example: see GEOM_TestOthers.py
2286 def ExportBREP(self,theObject, theFileName):
2287 return self.Export(theObject, theFileName, "BREP")
2289 ## Shortcut to Export() for IGES format
2291 # Example: see GEOM_TestOthers.py
2292 def ExportIGES(self,theObject, theFileName):
2293 return self.Export(theObject, theFileName, "IGES")
2295 ## Shortcut to Export() for STEP format
2297 # Example: see GEOM_TestOthers.py
2298 def ExportSTEP(self,theObject, theFileName):
2299 return self.Export(theObject, theFileName, "STEP")
2301 # -----------------------------------------------------------------------------
2303 # -----------------------------------------------------------------------------
2305 ## Create a quadrangle face from four edges. Order of Edges is not
2306 # important. It is not necessary that edges share the same vertex.
2307 # @param E1,E2,E3,E4 Edges for the face bound.
2308 # @return New GEOM_Object, containing the created face.
2310 # Example: see GEOM_Spanner.py
2311 def MakeQuad(self,E1, E2, E3, E4):
2312 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
2313 RaiseIfFailed("MakeQuad", self.BlocksOp)
2316 ## Create a quadrangle face on two edges.
2317 # The missing edges will be built by creating the shortest ones.
2318 # @param E1,E2 Two opposite edges for the face.
2319 # @return New GEOM_Object, containing the created face.
2321 # Example: see GEOM_Spanner.py
2322 def MakeQuad2Edges(self,E1, E2):
2323 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
2324 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
2327 ## Create a quadrangle face with specified corners.
2328 # The missing edges will be built by creating the shortest ones.
2329 # @param V1,V2,V3,V4 Corner vertices for the face.
2330 # @return New GEOM_Object, containing the created face.
2332 # Example: see GEOM_Spanner.py
2333 def MakeQuad4Vertices(self,V1, V2, V3, V4):
2334 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
2335 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
2338 ## Create a hexahedral solid, bounded by the six given faces. Order of
2339 # faces is not important. It is not necessary that Faces share the same edge.
2340 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
2341 # @return New GEOM_Object, containing the created solid.
2343 # Example: see GEOM_Spanner.py
2344 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
2345 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
2346 RaiseIfFailed("MakeHexa", self.BlocksOp)
2349 ## Create a hexahedral solid between two given faces.
2350 # The missing faces will be built by creating the smallest ones.
2351 # @param F1,F2 Two opposite faces for the hexahedral solid.
2352 # @return New GEOM_Object, containing the created solid.
2354 # Example: see GEOM_Spanner.py
2355 def MakeHexa2Faces(self,F1, F2):
2356 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
2357 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
2360 ## Get a vertex, found in the given shape by its coordinates.
2361 # @param theShape Block or a compound of blocks.
2362 # @param theX,theY,theZ Coordinates of the sought vertex.
2363 # @param theEpsilon Maximum allowed distance between the resulting
2364 # vertex and point with the given coordinates.
2365 # @return New GEOM_Object, containing the found vertex.
2367 # Example: see GEOM_TestOthers.py
2368 def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
2369 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
2370 RaiseIfFailed("GetPoint", self.BlocksOp)
2373 ## Get an edge, found in the given shape by two given vertices.
2374 # @param theShape Block or a compound of blocks.
2375 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
2376 # @return New GEOM_Object, containing the found edge.
2378 # Example: see GEOM_Spanner.py
2379 def GetEdge(self,theShape, thePoint1, thePoint2):
2380 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
2381 RaiseIfFailed("GetEdge", self.BlocksOp)
2384 ## Find an edge of the given shape, which has minimal distance to the given point.
2385 # @param theShape Block or a compound of blocks.
2386 # @param thePoint Point, close to the desired edge.
2387 # @return New GEOM_Object, containing the found edge.
2389 # Example: see GEOM_TestOthers.py
2390 def GetEdgeNearPoint(self,theShape, thePoint):
2391 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
2392 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
2395 ## Returns a face, found in the given shape by four given corner vertices.
2396 # @param theShape Block or a compound of blocks.
2397 # @param thePoint1-thePoint4 Points, close to the corners of the desired face.
2398 # @return New GEOM_Object, containing the found face.
2400 # Example: see GEOM_Spanner.py
2401 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
2402 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
2403 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
2406 ## Get a face of block, found in the given shape by two given edges.
2407 # @param theShape Block or a compound of blocks.
2408 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
2409 # @return New GEOM_Object, containing the found face.
2411 # Example: see GEOM_Spanner.py
2412 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
2413 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
2414 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
2417 ## Find a face, opposite to the given one in the given block.
2418 # @param theBlock Must be a hexahedral solid.
2419 # @param theFace Face of \a theBlock, opposite to the desired face.
2420 # @return New GEOM_Object, containing the found face.
2422 # Example: see GEOM_Spanner.py
2423 def GetOppositeFace(self,theBlock, theFace):
2424 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
2425 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
2428 ## Find a face of the given shape, which has minimal distance to the given point.
2429 # @param theShape Block or a compound of blocks.
2430 # @param thePoint Point, close to the desired face.
2431 # @return New GEOM_Object, containing the found face.
2433 # Example: see GEOM_Spanner.py
2434 def GetFaceNearPoint(self,theShape, thePoint):
2435 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
2436 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
2439 ## Find a face of block, whose outside normale has minimal angle with the given vector.
2440 # @param theShape Block or a compound of blocks.
2441 # @param theVector Vector, close to the normale of the desired face.
2442 # @return New GEOM_Object, containing the found face.
2444 # Example: see GEOM_Spanner.py
2445 def GetFaceByNormale(self,theBlock, theVector):
2446 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
2447 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
2450 ## Check, if the compound of blocks is given.
2451 # To be considered as a compound of blocks, the
2452 # given shape must satisfy the following conditions:
2453 # - Each element of the compound should be a Block (6 faces and 12 edges).
2454 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
2455 # - The compound should be connexe.
2456 # - The glue between two quadrangle faces should be applied.
2457 # @param theCompound The compound to check.
2458 # @return TRUE, if the given shape is a compound of blocks.
2459 # If theCompound is not valid, prints all discovered errors.
2461 # Example: see GEOM_Spanner.py
2462 def CheckCompoundOfBlocks(self,theCompound):
2463 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
2464 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
2466 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
2470 ## Remove all seam and degenerated edges from \a theShape.
2471 # Unite faces and edges, sharing one surface. It means that
2472 # this faces must have references to one C++ surface object (handle).
2473 # @param theShape The compound or single solid to remove irregular edges from.
2474 # @return Improved shape.
2476 # Example: see GEOM_TestOthers.py
2477 def RemoveExtraEdges(self,theShape):
2478 anObj = self.BlocksOp.RemoveExtraEdges(theShape)
2479 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
2482 ## Check, if the given shape is a blocks compound.
2483 # Fix all detected errors.
2484 # \note Single block can be also fixed by this method.
2485 # @param theCompound The compound to check and improve.
2486 # @return Improved compound.
2488 # Example: see GEOM_TestOthers.py
2489 def CheckAndImprove(self,theShape):
2490 anObj = self.BlocksOp.CheckAndImprove(theShape)
2491 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
2494 ## Get all the blocks, contained in the given compound.
2495 # @param theCompound The compound to explode.
2496 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
2497 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
2498 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
2499 # @return List of GEOM_Objects, containing the retrieved blocks.
2501 # Example: see GEOM_TestOthers.py
2502 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
2503 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
2504 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
2507 ## Find block, containing the given point inside its volume or on boundary.
2508 # @param theCompound Compound, to find block in.
2509 # @param thePoint Point, close to the desired block. If the point lays on
2510 # boundary between some blocks, we return block with nearest center.
2511 # @return New GEOM_Object, containing the found block.
2513 # Example: see GEOM_Spanner.py
2514 def GetBlockNearPoint(self,theCompound, thePoint):
2515 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
2516 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
2519 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
2520 # @param theCompound Compound, to find block in.
2521 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
2522 # @return New GEOM_Object, containing the found block.
2524 # Example: see GEOM_TestOthers.py
2525 def GetBlockByParts(self,theCompound, theParts):
2526 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
2527 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
2530 ## Return all blocks, containing all the elements, passed as the parts.
2531 # @param theCompound Compound, to find blocks in.
2532 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
2533 # @return List of GEOM_Objects, containing the found blocks.
2535 # Example: see GEOM_Spanner.py
2536 def GetBlocksByParts(self,theCompound, theParts):
2537 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
2538 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
2541 ## Multi-transformate block and glue the result.
2542 # Transformation is defined so, as to superpose direction faces.
2543 # @param Block Hexahedral solid to be multi-transformed.
2544 # @param DirFace1 ID of First direction face.
2545 # @param DirFace2 ID of Second direction face.
2546 # @param NbTimes Quantity of transformations to be done.
2547 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
2548 # @return New GEOM_Object, containing the result shape.
2550 # Example: see GEOM_Spanner.py
2551 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
2552 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
2553 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
2556 ## Multi-transformate block and glue the result.
2557 # @param Block Hexahedral solid to be multi-transformed.
2558 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
2559 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
2560 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
2561 # @return New GEOM_Object, containing the result shape.
2563 # Example: see GEOM_Spanner.py
2564 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
2565 DirFace1V, DirFace2V, NbTimesV):
2566 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
2567 DirFace1V, DirFace2V, NbTimesV)
2568 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
2571 ## Build all possible propagation groups.
2572 # Propagation group is a set of all edges, opposite to one (main)
2573 # edge of this group directly or through other opposite edges.
2574 # Notion of Opposite Edge make sence only on quadrangle face.
2575 # @param theShape Shape to build propagation groups on.
2576 # @return List of GEOM_Objects, each of them is a propagation group.
2578 # Example: see GEOM_TestOthers.py
2579 def Propagate(self,theShape):
2580 listChains = self.BlocksOp.Propagate(theShape)
2581 RaiseIfFailed("Propagate", self.BlocksOp)
2584 # -----------------------------------------------------------------------------
2586 # -----------------------------------------------------------------------------
2588 ## Creates a new group which will store sub shapes of theMainShape
2589 # @param theMainShape is a GEOM object on which the group is selected
2590 # @param theShapeType defines a shape type of the group
2591 # @return a newly created GEOM group
2593 # Example: see GEOM_TestOthers.py
2594 def CreateGroup(self,theMainShape, theShapeType):
2595 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
2596 RaiseIfFailed("CreateGroup", self.GroupOp)
2599 ## Adds a sub object with ID theSubShapeId to the group
2600 # @param theGroup is a GEOM group to which the new sub shape is added
2601 # @param theSubShapeID is a sub shape ID in the main object.
2602 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
2604 # Example: see GEOM_TestOthers.py
2605 def AddObject(self,theGroup, theSubShapeID):
2606 self.GroupOp.AddObject(theGroup, theSubShapeID)
2607 RaiseIfFailed("AddObject", self.GroupOp)
2610 ## Removes a sub object with ID \a theSubShapeId from the group
2611 # @param theGroup is a GEOM group from which the new sub shape is removed
2612 # @param theSubShapeID is a sub shape ID in the main object.
2613 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
2615 # Example: see GEOM_TestOthers.py
2616 def RemoveObject(self,theGroup, theSubShapeID):
2617 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
2618 RaiseIfFailed("RemoveObject", self.GroupOp)
2621 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
2622 # @param theGroup is a GEOM group to which the new sub shapes are added.
2623 # @param theSubShapes is a list of sub shapes to be added.
2625 # Example: see GEOM_TestOthers.py
2626 def UnionList (self,theGroup, theSubShapes):
2627 self.GroupOp.UnionList(theGroup, theSubShapes)
2628 RaiseIfFailed("UnionList", self.GroupOp)
2631 ## Works like the above method, but argument
2632 # theSubShapes here is a list of sub-shapes indices
2634 # Example: see GEOM_TestOthers.py
2635 def UnionIDs(self,theGroup, theSubShapes):
2636 self.GroupOp.UnionIDs(theGroup, theSubShapes)
2637 RaiseIfFailed("UnionIDs", self.GroupOp)
2640 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
2641 # @param theGroup is a GEOM group from which the sub-shapes are removed.
2642 # @param theSubShapes is a list of sub-shapes to be removed.
2644 # Example: see GEOM_TestOthers.py
2645 def DifferenceList (self,theGroup, theSubShapes):
2646 self.GroupOp.DifferenceList(theGroup, theSubShapes)
2647 RaiseIfFailed("DifferenceList", self.GroupOp)
2650 ## Works like the above method, but argument
2651 # theSubShapes here is a list of sub-shapes indices
2653 # Example: see GEOM_TestOthers.py
2654 def DifferenceIDs(self,theGroup, theSubShapes):
2655 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
2656 RaiseIfFailed("DifferenceIDs", self.GroupOp)
2659 ## Returns a list of sub objects ID stored in the group
2660 # @param theGroup is a GEOM group for which a list of IDs is requested
2662 # Example: see GEOM_TestOthers.py
2663 def GetObjectIDs(self,theGroup):
2664 ListIDs = self.GroupOp.GetObjects(theGroup)
2665 RaiseIfFailed("GetObjects", self.GroupOp)
2668 ## Returns a type of sub objects stored in the group
2669 # @param theGroup is a GEOM group which type is returned.
2671 # Example: see GEOM_TestOthers.py
2672 def GetType(self,theGroup):
2673 aType = self.GroupOp.GetType(theGroup)
2674 RaiseIfFailed("GetType", self.GroupOp)
2677 ## Returns a main shape associated with the group
2678 # @param theGroup is a GEOM group for which a main shape object is requested
2679 # @return a GEOM object which is a main shape for theGroup
2681 # Example: see GEOM_TestOthers.py
2682 def GetMainShape(self,theGroup):
2683 anObj = self.GroupOp.GetMainShape(theGroup)
2684 RaiseIfFailed("GetMainShape", self.GroupOp)
2687 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
2688 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
2689 def GetEdgesByLength (self,theShape, min_length, max_length, include_min = 1, include_max = 1):
2690 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
2693 Props = self.BasicProperties(edge)
2694 if min_length <= Props[0] and Props[0] <= max_length:
2695 if (not include_min) and (min_length == Props[0]):
2698 if (not include_max) and (Props[0] == max_length):
2701 edges_in_range.append(edge)
2703 if len(edges_in_range) <= 0:
2704 print "No edges found by given criteria"
2707 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
2708 self.UnionList(group_edges, edges_in_range)
2712 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
2713 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
2714 def SelectEdges (self,min_length, max_length, include_min = 1, include_max = 1):
2715 nb_selected = sg.SelectedCount()
2717 print "Select a shape before calling this function, please."
2720 print "Only one shape must be selected"
2723 id_shape = sg.getSelected(0)
2724 shape = IDToObject( id_shape )
2726 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
2730 if include_min: left_str = " <= "
2731 if include_max: right_str = " <= "
2733 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
2734 + left_str + "length" + right_str + `max_length`)
2736 sg.updateObjBrowser(1)
2740 ## Add Path to load python scripts from
2741 def addPath(self,Path):
2742 if (sys.path.count(Path) < 1):
2743 sys.path.append(Path)
2746 #Register the new proxy for GEOM_Gen
2747 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)