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 # \param aShape the shape to be published
130 # \param aName the name for the shape
131 # \param doRestoreSubShapes if True, finds and publishes also
132 # sub-shapes of \a aShape, corresponding to its arguments
133 # and published sub-shapes of arguments
134 # \param theArgs,isTrsf see geompy.RestoreSubShapes for these arguments description
135 # \return study entry of the published shape in form of string
137 # Example: see GEOM_TestAll.py
138 def addToStudy(self, aShape, aName,
139 doRestoreSubShapes=False, theArgs=[], isTrsf=False):
141 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
142 if doRestoreSubShapes:
143 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs, isTrsf)
145 print "addToStudy() failed"
147 return aShape.GetStudyEntry()
149 ## Publish in study aShape with name aName as sub-object of previously published aFather
151 # Example: see GEOM_TestAll.py
152 def addToStudyInFather(self, aFather, aShape, aName):
154 aSObject = self.AddInStudy(myStudy, aShape, aName, aFather)
156 print "addToStudyInFather() failed"
158 return aShape.GetStudyEntry()
160 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
161 # To be used from python scripts out of geompy.addToStudy (non-default usage)
162 # \param theStudy the study, in which theObject is published already,
163 # and in which the arguments will be published
164 # \param theObject published GEOM object, arguments of which will be published
165 # \param theArgs list of GEOM_Object, operation arguments to be published.
166 # If this list is empty, all operation arguments will be published
167 # \param isTrsf If True, search sub-shapes by indices, as in case of
168 # transformation they cannot be found by GetInPlace.
169 # The argument itself is not published in this case,
170 # because the whole shape corresponds to the argument.
171 # \return True in case of success, False otherwise.
173 # Example: see GEOM_TestAll.py
174 def RestoreSubShapes (self, theObject, theArgs=[], isTrsf=False):
175 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs, isTrsf)
177 # -----------------------------------------------------------------------------
179 # -----------------------------------------------------------------------------
181 ## Create point by three coordinates.
182 # @param theX The X coordinate of the point.
183 # @param theY The Y coordinate of the point.
184 # @param theZ The Z coordinate of the point.
185 # @return New GEOM_Object, containing the created point.
187 # Example: see GEOM_TestAll.py
188 def MakeVertex(self,theX, theY, theZ):
189 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
190 RaiseIfFailed("MakePointXYZ", self.BasicOp)
193 ## Create a point, distant from the referenced point
194 # on the given distances along the coordinate axes.
195 # @param theReference The referenced point.
196 # @param theX Displacement from the referenced point along OX axis.
197 # @param theY Displacement from the referenced point along OY axis.
198 # @param theZ Displacement from the referenced point along OZ axis.
199 # @return New GEOM_Object, containing the created point.
201 # Example: see GEOM_TestAll.py
202 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
203 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
204 RaiseIfFailed("MakePointWithReference", self.BasicOp)
207 ## Create a point, corresponding to the given parameter on the given curve.
208 # @param theRefCurve The referenced curve.
209 # @param theParameter Value of parameter on the referenced curve.
210 # @return New GEOM_Object, containing the created point.
212 # Example: see GEOM_TestAll.py
213 def MakeVertexOnCurve(self,theRefCurve, theParameter):
214 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
215 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
218 ## Create a point on intersection of two lines.
219 # @param theRefLine1, theRefLine2 The referenced lines.
220 # @return New GEOM_Object, containing the created point.
222 # Example: see GEOM_TestAll.py
223 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
224 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
225 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
228 ## Create a tangent, corresponding to the given parameter on the given curve.
229 # @param theRefCurve The referenced curve.
230 # @param theParameter Value of parameter on the referenced curve.
231 # @return New GEOM_Object, containing the created tangent.
232 def MakeTangentOnCurve(self,theRefCurve, theParameter):
233 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
234 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
237 ## Create a vector with the given components.
238 # @param theDX X component of the vector.
239 # @param theDY Y component of the vector.
240 # @param theDZ Z component of the vector.
241 # @return New GEOM_Object, containing the created vector.
243 # Example: see GEOM_TestAll.py
244 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
245 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
246 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
249 ## Create a vector between two points.
250 # @param thePnt1 Start point for the vector.
251 # @param thePnt2 End point for the vector.
252 # @return New GEOM_Object, containing the created vector.
254 # Example: see GEOM_TestAll.py
255 def MakeVector(self,thePnt1, thePnt2):
256 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
257 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
260 ## Create a line, passing through the given point
261 # and parrallel to the given direction
262 # @param thePnt Point. The resulting line will pass through it.
263 # @param theDir Direction. The resulting line will be parallel to it.
264 # @return New GEOM_Object, containing the created line.
266 # Example: see GEOM_TestAll.py
267 def MakeLine(self,thePnt, theDir):
268 anObj = self.BasicOp.MakeLine(thePnt, theDir)
269 RaiseIfFailed("MakeLine", self.BasicOp)
272 ## Create a line, passing through the given points
273 # @param thePnt1 First of two points, defining the line.
274 # @param thePnt2 Second of two points, defining the line.
275 # @return New GEOM_Object, containing the created line.
277 # Example: see GEOM_TestAll.py
278 def MakeLineTwoPnt(self,thePnt1, thePnt2):
279 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
280 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
283 ## Create a line on two faces intersection.
284 # @param theFace1 First of two faces, defining the line.
285 # @param theFace2 Second of two faces, defining the line.
286 # @return New GEOM_Object, containing the created line.
288 # Example: see GEOM_TestAll.py
289 def MakeLineTwoFaces(self, theFace1, theFace2):
290 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
291 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
294 ## Create a plane, passing through the given point
295 # and normal to the given vector.
296 # @param thePnt Point, the plane has to pass through.
297 # @param theVec Vector, defining the plane normal direction.
298 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
299 # @return New GEOM_Object, containing the created plane.
301 # Example: see GEOM_TestAll.py
302 def MakePlane(self,thePnt, theVec, theTrimSize):
303 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
304 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
307 ## Create a plane, passing through the three given points
308 # @param thePnt1 First of three points, defining the plane.
309 # @param thePnt2 Second of three points, defining the plane.
310 # @param thePnt3 Fird of three points, defining the plane.
311 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
312 # @return New GEOM_Object, containing the created plane.
314 # Example: see GEOM_TestAll.py
315 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
316 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
317 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
320 ## Create a plane, similar to the existing one, but with another size of representing face.
321 # @param theFace Referenced plane or LCS(Marker).
322 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
323 # @return New GEOM_Object, containing the created plane.
325 # Example: see GEOM_TestAll.py
326 def MakePlaneFace(self,theFace, theTrimSize):
327 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
328 RaiseIfFailed("MakePlaneFace", self.BasicOp)
331 ## Create a local coordinate system.
332 # @param OX,OY,OZ Three coordinates of coordinate system origin.
333 # @param XDX,XDY,XDZ Three components of OX direction
334 # @param YDX,YDY,YDZ Three components of OY direction
335 # @return New GEOM_Object, containing the created coordinate system.
337 # Example: see GEOM_TestAll.py
338 def MakeMarker(self,OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
339 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
340 RaiseIfFailed("MakeMarker", self.BasicOp)
343 ## Create a local coordinate system.
344 # @param theOrigin Point of coordinate system origin.
345 # @param theXVec Vector of X direction
346 # @param theYVec Vector of Y direction
347 # @return New GEOM_Object, containing the created coordinate system.
348 def MakeMarkerPntTwoVec(self,theOrigin, theXVec, theYVec):
349 O = self.PointCoordinates( theOrigin )
351 for vec in [ theXVec, theYVec ]:
352 v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] )
353 p1 = self.PointCoordinates( v1 )
354 p2 = self.PointCoordinates( v2 )
355 for i in range( 0, 3 ):
356 OXOY.append( p2[i] - p1[i] )
358 anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2],
359 OXOY[0], OXOY[1], OXOY[2],
360 OXOY[3], OXOY[4], OXOY[5], )
361 RaiseIfFailed("MakeMarker", self.BasicOp)
364 # -----------------------------------------------------------------------------
366 # -----------------------------------------------------------------------------
368 ## Create an arc of circle, passing through three given points.
369 # @param thePnt1 Start point of the arc.
370 # @param thePnt2 Middle point of the arc.
371 # @param thePnt3 End point of the arc.
372 # @return New GEOM_Object, containing the created arc.
374 # Example: see GEOM_TestAll.py
375 def MakeArc(self,thePnt1, thePnt2, thePnt3):
376 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
377 RaiseIfFailed("MakeArc", self.CurvesOp)
380 ## Create an arc of circle from a center and 2 points.
381 # @param thePnt1 Center of the arc
382 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
383 # @param thePnt3 End point of the arc (Gives also a direction)
384 # @return New GEOM_Object, containing the created arc.
386 # Example: see GEOM_TestAll.py
387 def MakeArcCenter(self,thePnt1, thePnt2, thePnt3,theSense):
388 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense)
389 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
392 ## Create a circle with given center, normal vector and radius.
393 # @param thePnt Circle center.
394 # @param theVec Vector, normal to the plane of the circle.
395 # @param theR Circle radius.
396 # @return New GEOM_Object, containing the created circle.
398 # Example: see GEOM_TestAll.py
399 def MakeCircle(self,thePnt, theVec, theR):
400 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
401 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
404 ## Create a circle, passing through three given points
405 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
406 # @return New GEOM_Object, containing the created circle.
408 # Example: see GEOM_TestAll.py
409 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
410 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
411 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
414 ## Create a circle, with given point1 as center,
415 # passing through the point2 as radius and laying in the plane,
416 # defined by all three given points.
417 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
418 # @return New GEOM_Object, containing the created circle.
420 # Example: see GEOM_example6.py
421 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
422 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
423 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
426 ## Create an ellipse with given center, normal vector and radiuses.
427 # @param thePnt Ellipse center.
428 # @param theVec Vector, normal to the plane of the ellipse.
429 # @param theRMajor Major ellipse radius.
430 # @param theRMinor Minor ellipse radius.
431 # @return New GEOM_Object, containing the created ellipse.
433 # Example: see GEOM_TestAll.py
434 def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor):
435 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
436 RaiseIfFailed("MakeEllipse", self.CurvesOp)
439 ## Create a polyline on the set of points.
440 # @param thePoints Sequence of points for the polyline.
441 # @return New GEOM_Object, containing the created polyline.
443 # Example: see GEOM_TestAll.py
444 def MakePolyline(self,thePoints):
445 anObj = self.CurvesOp.MakePolyline(thePoints)
446 RaiseIfFailed("MakePolyline", self.CurvesOp)
449 ## Create bezier curve on the set of points.
450 # @param thePoints Sequence of points for the bezier curve.
451 # @return New GEOM_Object, containing the created bezier curve.
453 # Example: see GEOM_TestAll.py
454 def MakeBezier(self,thePoints):
455 anObj = self.CurvesOp.MakeSplineBezier(thePoints)
456 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
459 ## Create B-Spline curve on the set of points.
460 # @param thePoints Sequence of points for the B-Spline curve.
461 # @return New GEOM_Object, containing the created B-Spline curve.
463 # Example: see GEOM_TestAll.py
464 def MakeInterpol(self,thePoints):
465 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints)
466 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
469 ## Create a sketcher (wire or face), following the textual description,
470 # passed through \a theCommand argument. \n
471 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
472 # Format of the description string have to be the following:
474 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
477 # - x1, y1 are coordinates of the first sketcher point (zero by default),
479 # - "R angle" : Set the direction by angle
480 # - "D dx dy" : Set the direction by DX & DY
483 # - "TT x y" : Create segment by point at X & Y
484 # - "T dx dy" : Create segment by point with DX & DY
485 # - "L length" : Create segment by direction & Length
486 # - "IX x" : Create segment by direction & Intersect. X
487 # - "IY y" : Create segment by direction & Intersect. Y
490 # - "C radius length" : Create arc by direction, radius and length(in degree)
493 # - "WW" : Close Wire (to finish)
494 # - "WF" : Close Wire and build face (to finish)
496 # @param theCommand String, defining the sketcher in local
497 # coordinates of the working plane.
498 # @param theWorkingPlane Nine double values, defining origin,
499 # OZ and OX directions of the working plane.
500 # @return New GEOM_Object, containing the created wire.
502 # Example: see GEOM_TestAll.py
503 def MakeSketcher(self,theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
504 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
505 RaiseIfFailed("MakeSketcher", self.CurvesOp)
508 ## Create a sketcher (wire or face), following the textual description,
509 # passed through \a theCommand argument. \n
510 # For format of the description string see the previous method.\n
511 # @param theCommand String, defining the sketcher in local
512 # coordinates of the working plane.
513 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
514 # @return New GEOM_Object, containing the created wire.
515 def MakeSketcherOnPlane(self,theCommand, theWorkingPlane):
516 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
517 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
520 # -----------------------------------------------------------------------------
521 # Create 3D Primitives
522 # -----------------------------------------------------------------------------
524 ## Create a box by coordinates of two opposite vertices.
526 # Example: see GEOM_TestAll.py
527 def MakeBox(self,x1,y1,z1,x2,y2,z2):
528 pnt1 = self.MakeVertex(x1,y1,z1)
529 pnt2 = self.MakeVertex(x2,y2,z2)
530 return self.MakeBoxTwoPnt(pnt1,pnt2)
532 ## Create a box with specified dimensions along the coordinate axes
533 # and with edges, parallel to the coordinate axes.
534 # Center of the box will be at point (DX/2, DY/2, DZ/2).
535 # @param theDX Length of Box edges, parallel to OX axis.
536 # @param theDY Length of Box edges, parallel to OY axis.
537 # @param theDZ Length of Box edges, parallel to OZ axis.
538 # @return New GEOM_Object, containing the created box.
540 # Example: see GEOM_TestAll.py
541 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
542 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
543 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
546 ## Create a box with two specified opposite vertices,
547 # and with edges, parallel to the coordinate axes
548 # @param thePnt1 First of two opposite vertices.
549 # @param thePnt2 Second of two opposite vertices.
550 # @return New GEOM_Object, containing the created box.
552 # Example: see GEOM_TestAll.py
553 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
554 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
555 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
558 ## Create a cylinder with given base point, axis, radius and height.
559 # @param thePnt Central point of cylinder base.
560 # @param theAxis Cylinder axis.
561 # @param theR Cylinder radius.
562 # @param theH Cylinder height.
563 # @return New GEOM_Object, containing the created cylinder.
565 # Example: see GEOM_TestAll.py
566 def MakeCylinder(self,thePnt, theAxis, theR, theH):
567 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
568 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
571 ## Create a cylinder with given radius and height at
572 # the origin of coordinate system. Axis of the cylinder
573 # will be collinear to the OZ axis of the coordinate system.
574 # @param theR Cylinder radius.
575 # @param theH Cylinder height.
576 # @return New GEOM_Object, containing the created cylinder.
578 # Example: see GEOM_TestAll.py
579 def MakeCylinderRH(self,theR, theH):
580 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
581 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
584 ## Create a sphere with given center and radius.
585 # @param thePnt Sphere center.
586 # @param theR Sphere radius.
587 # @return New GEOM_Object, containing the created sphere.
589 # Example: see GEOM_TestAll.py
590 def MakeSpherePntR(self,thePnt, theR):
591 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
592 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
595 ## Create a sphere with given center and radius.
596 # @param x,y,z Coordinates of sphere center.
597 # @param theR Sphere radius.
598 # @return New GEOM_Object, containing the created sphere.
600 # Example: see GEOM_TestAll.py
601 def MakeSphere(self,x, y, z, theR):
602 point = self.MakeVertex(x, y, z)
603 anObj = self.MakeSpherePntR(point, theR)
606 ## Create a sphere with given radius at the origin of coordinate system.
607 # @param theR Sphere radius.
608 # @return New GEOM_Object, containing the created sphere.
610 # Example: see GEOM_TestAll.py
611 def MakeSphereR(self,theR):
612 anObj = self.PrimOp.MakeSphereR(theR)
613 RaiseIfFailed("MakeSphereR", self.PrimOp)
616 ## Create a cone with given base point, axis, height and radiuses.
617 # @param thePnt Central point of the first cone base.
618 # @param theAxis Cone axis.
619 # @param theR1 Radius of the first cone base.
620 # @param theR2 Radius of the second cone base.
621 # \note If both radiuses are non-zero, the cone will be truncated.
622 # \note If the radiuses are equal, a cylinder will be created instead.
623 # @param theH Cone height.
624 # @return New GEOM_Object, containing the created cone.
626 # Example: see GEOM_TestAll.py
627 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
628 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
629 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
632 ## Create a cone with given height and radiuses at
633 # the origin of coordinate system. Axis of the cone will
634 # be collinear to the OZ axis of the coordinate system.
635 # @param theR1 Radius of the first cone base.
636 # @param theR2 Radius of the second cone base.
637 # \note If both radiuses are non-zero, the cone will be truncated.
638 # \note If the radiuses are equal, a cylinder will be created instead.
639 # @param theH Cone height.
640 # @return New GEOM_Object, containing the created cone.
642 # Example: see GEOM_TestAll.py
643 def MakeConeR1R2H(self,theR1, theR2, theH):
644 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
645 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
648 ## Create a torus with given center, normal vector and radiuses.
649 # @param thePnt Torus central point.
650 # @param theVec Torus axis of symmetry.
651 # @param theRMajor Torus major radius.
652 # @param theRMinor Torus minor radius.
653 # @return New GEOM_Object, containing the created torus.
655 # Example: see GEOM_TestAll.py
656 def MakeTorus(self,thePnt, theVec, theRMajor, theRMinor):
657 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
658 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
661 ## Create a torus with given radiuses at the origin of coordinate system.
662 # @param theRMajor Torus major radius.
663 # @param theRMinor Torus minor radius.
664 # @return New GEOM_Object, containing the created torus.
666 # Example: see GEOM_TestAll.py
667 def MakeTorusRR(self,theRMajor, theRMinor):
668 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
669 RaiseIfFailed("MakeTorusRR", self.PrimOp)
672 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
673 # @param theBase Base shape to be extruded.
674 # @param thePoint1 First end of extrusion vector.
675 # @param thePoint2 Second end of extrusion vector.
676 # @return New GEOM_Object, containing the created prism.
678 # Example: see GEOM_TestAll.py
679 def MakePrism(self,theBase, thePoint1, thePoint2):
680 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
681 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
684 ## Create a shape by extrusion of the base shape along the vector,
685 # i.e. all the space, transfixed by the base shape during its translation
686 # along the vector on the given distance.
687 # @param theBase Base shape to be extruded.
688 # @param theVec Direction of extrusion.
689 # @param theH Prism dimension along theVec.
690 # @return New GEOM_Object, containing the created prism.
692 # Example: see GEOM_TestAll.py
693 def MakePrismVecH(self,theBase, theVec, theH):
694 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
695 RaiseIfFailed("MakePrismVecH", self.PrimOp)
698 ## Create a shape by extrusion of the base shape along the vector,
699 # i.e. all the space, transfixed by the base shape during its translation
700 # along the vector on the given distance in 2 Ways (forward/backward) .
701 # @param theBase Base shape to be extruded.
702 # @param theVec Direction of extrusion.
703 # @param theH Prism dimension along theVec in forward direction.
704 # @return New GEOM_Object, containing the created prism.
706 # Example: see GEOM_TestAll.py
707 def MakePrismVecH2Ways(self, theBase, theVec, theH):
708 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
709 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
712 ## Create a shape by extrusion of the base shape along
713 # the path shape. The path shape can be a wire or an edge.
714 # @param theBase Base shape to be extruded.
715 # @param thePath Path shape to extrude the base shape along it.
716 # @return New GEOM_Object, containing the created pipe.
718 # Example: see GEOM_TestAll.py
719 def MakePipe(self,theBase, thePath):
720 anObj = self.PrimOp.MakePipe(theBase, thePath)
721 RaiseIfFailed("MakePipe", self.PrimOp)
724 ## Create a shape by revolution of the base shape around the axis
725 # on the given angle, i.e. all the space, transfixed by the base
726 # shape during its rotation around the axis on the given angle.
727 # @param theBase Base shape to be rotated.
728 # @param theAxis Rotation axis.
729 # @param theAngle Rotation angle in radians.
730 # @return New GEOM_Object, containing the created revolution.
732 # Example: see GEOM_TestAll.py
733 def MakeRevolution(self,theBase, theAxis, theAngle):
734 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
735 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
737 ## The Same Revolution but in both ways forward&backward.
738 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
739 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
740 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
743 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
744 # @param theSeqSections - set of specified sections.
745 # @param theModeSolid - mode defining building solid or shell
746 # @param thePreci - precision 3D used for smoothing by default 1.e-6
747 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
748 # @return New GEOM_Object, containing the created shell or solid.
750 # Example: see GEOM_TestAll.py
751 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
752 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
753 RaiseIfFailed("MakeThruSections", self.PrimOp)
756 ## Create a shape by extrusion of the profile shape along
757 # the path shape. The path shape can be a wire or an edge.
758 # the several profiles can be specified in the several locations of path.
759 # @param theSeqBases - list of Bases shape to be extruded.
760 # @param theLocations - list of locations on the path corresponding
761 # specified list of the Bases shapes. Number of locations
762 # should be equal to number of bases or list of locations can be empty.
763 # @param thePath - Path shape to extrude the base shape along it.
764 # @param theWithContact - the mode defining that the section is translated to be in
765 # contact with the spine.
766 # @param - WithCorrection - defining that the section is rotated to be
767 # orthogonal to the spine tangent in the correspondent point
768 # @return New GEOM_Object, containing the created pipe.
770 def MakePipeWithDifferentSections(self, theSeqBases,
771 theLocations, thePath,
772 theWithContact, theWithCorrection):
773 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
774 theLocations, thePath,
775 theWithContact, theWithCorrection)
776 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
779 ## Create a shape by extrusion of the profile shape along
780 # the path shape. The path shape can be a shell or a face.
781 # the several profiles can be specified in the several locations of path.
782 # @param theSeqBases - list of Bases shape to be extruded.
783 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
784 # @param theLocations - list of locations on the path corresponding
785 # specified list of the Bases shapes. Number of locations
786 # should be equal to number of bases. First and last
787 # locations must be coincided with first and last vertexes
788 # of path correspondingly.
789 # @param thePath - Path shape to extrude the base shape along it.
790 # @param theWithContact - the mode defining that the section is translated to be in
791 # contact with the spine.
792 # @param - WithCorrection - defining that the section is rotated to be
793 # orthogonal to the spine tangent in the correspondent point
794 # @return New GEOM_Object, containing the created solids.
796 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
797 theLocations, thePath,
798 theWithContact, theWithCorrection):
799 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
800 theLocations, thePath,
801 theWithContact, theWithCorrection)
802 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
805 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
806 theLocations, thePath,
807 theWithContact, theWithCorrection):
809 nbsect = len(theSeqBases)
810 nbsubsect = len(theSeqSubBases)
811 #print "nbsect = ",nbsect
812 for i in range(1,nbsect):
814 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
815 tmpLocations = [ theLocations[i-1], theLocations[i] ]
817 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
818 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
819 tmpLocations, thePath,
820 theWithContact, theWithCorrection)
821 if self.PrimOp.IsDone() == 0:
822 print "Problems with pipe creation between ",i," and ",i+1," sections"
823 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
826 print "Pipe between ",i," and ",i+1," sections is OK"
831 resc = self.MakeCompound(res)
832 #resc = self.MakeSewing(res, 0.001)
836 ## Create solids between given sections
837 # @param theSeqBases - list of sections (shell or face).
838 # @param theLocations - list of corresponding vertexes
839 # @return New GEOM_Object, containing the created solids.
841 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
842 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
843 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
847 # -----------------------------------------------------------------------------
849 # -----------------------------------------------------------------------------
851 ## Create a linear edge with specified ends.
852 # @param thePnt1 Point for the first end of edge.
853 # @param thePnt2 Point for the second end of edge.
854 # @return New GEOM_Object, containing the created edge.
856 # Example: see GEOM_TestAll.py
857 def MakeEdge(self,thePnt1, thePnt2):
858 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
859 RaiseIfFailed("MakeEdge", self.ShapesOp)
862 ## Create a wire from the set of edges and wires.
863 # @param theEdgesAndWires List of edges and/or wires.
864 # @return New GEOM_Object, containing the created wire.
866 # Example: see GEOM_TestAll.py
867 def MakeWire(self,theEdgesAndWires):
868 anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
869 RaiseIfFailed("MakeWire", self.ShapesOp)
872 ## Create a face on the given wire.
873 # @param theWire closed Wire or Edge to build the face on.
874 # @param isPlanarWanted If TRUE, only planar face will be built.
875 # If impossible, NULL object will be returned.
876 # @return New GEOM_Object, containing the created face.
878 # Example: see GEOM_TestAll.py
879 def MakeFace(self,theWire, isPlanarWanted):
880 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
881 RaiseIfFailed("MakeFace", self.ShapesOp)
884 ## Create a face on the given wires set.
885 # @param theWires List of closed wires or edges to build the face on.
886 # @param isPlanarWanted If TRUE, only planar face will be built.
887 # If impossible, NULL object will be returned.
888 # @return New GEOM_Object, containing the created face.
890 # Example: see GEOM_TestAll.py
891 def MakeFaceWires(self,theWires, isPlanarWanted):
892 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
893 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
896 ## Shortcut to MakeFaceWires()
898 # Example: see GEOM_TestOthers.py
899 def MakeFaces(self,theWires, isPlanarWanted):
900 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
903 ## Create a shell from the set of faces and shells.
904 # @param theFacesAndShells List of faces and/or shells.
905 # @return New GEOM_Object, containing the created shell.
907 # Example: see GEOM_TestAll.py
908 def MakeShell(self,theFacesAndShells):
909 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
910 RaiseIfFailed("MakeShell", self.ShapesOp)
913 ## Create a solid, bounded by the given shells.
914 # @param theShells Sequence of bounding shells.
915 # @return New GEOM_Object, containing the created solid.
917 # Example: see GEOM_TestAll.py
918 def MakeSolid(self,theShells):
919 anObj = self.ShapesOp.MakeSolidShells(theShells)
920 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
923 ## Create a compound of the given shapes.
924 # @param theShapes List of shapes to put in compound.
925 # @return New GEOM_Object, containing the created compound.
927 # Example: see GEOM_TestAll.py
928 def MakeCompound(self,theShapes):
929 anObj = self.ShapesOp.MakeCompound(theShapes)
930 RaiseIfFailed("MakeCompound", self.ShapesOp)
933 ## Gives quantity of faces in the given shape.
934 # @param theShape Shape to count faces of.
935 # @return Quantity of faces.
937 # Example: see GEOM_TestOthers.py
938 def NumberOfFaces(self,theShape):
939 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
940 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
943 ## Gives quantity of edges in the given shape.
944 # @param theShape Shape to count edges of.
945 # @return Quantity of edges.
947 # Example: see GEOM_TestOthers.py
948 def NumberOfEdges(self,theShape):
949 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
950 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
953 ## Reverses an orientation the given shape.
954 # @param theShape Shape to be reversed.
955 # @return The reversed copy of theShape.
957 # Example: see GEOM_TestAll.py
958 def ChangeOrientation(self,theShape):
959 anObj = self.ShapesOp.ChangeOrientation(theShape)
960 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
963 ## Shortcut to ChangeOrientation()
965 # Example: see GEOM_TestOthers.py
966 def OrientationChange(self,theShape):
967 anObj = self.ChangeOrientation(theShape)
970 ## Retrieve all free faces from the given shape.
971 # Free face is a face, which is not shared between two shells of the shape.
972 # @param theShape Shape to find free faces in.
973 # @return List of IDs of all free faces, contained in theShape.
975 # Example: see GEOM_TestOthers.py
976 def GetFreeFacesIDs(self,theShape):
977 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
978 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
981 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
982 # @param theShape1 Shape to find sub-shapes in.
983 # @param theShape2 Shape to find shared sub-shapes with.
984 # @param theShapeType Type of sub-shapes to be retrieved.
985 # @return List of sub-shapes of theShape1, shared with theShape2.
987 # Example: see GEOM_TestOthers.py
988 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
989 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
990 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
993 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
994 # the specified plane by the certain way, defined through \a theState parameter.
995 # @param theShape Shape to find sub-shapes of.
996 # @param theShapeType Type of sub-shapes to be retrieved.
997 # @param theAx1 Vector (or line, or linear edge), specifying normal
998 # direction and location of the plane to find shapes on.
999 # @param theState The state of the subshapes to find. It can be one of
1000 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1001 # @return List of all found sub-shapes.
1003 # Example: see GEOM_TestOthers.py
1004 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1005 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1006 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1009 ## Works like the above method, but returns list of sub-shapes indices
1011 # Example: see GEOM_TestOthers.py
1012 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1013 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1014 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1017 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1018 # the specified plane by the certain way, defined through \a theState parameter.
1019 # @param theShape Shape to find sub-shapes of.
1020 # @param theShapeType Type of sub-shapes to be retrieved.
1021 # @param theAx1 Vector (or line, or linear edge), specifying normal
1022 # direction of the plane to find shapes on.
1023 # @param thePnt Point specifying location of the plane to find shapes on.
1024 # @param theState The state of the subshapes to find. It can be one of
1025 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1026 # @return List of all found sub-shapes.
1028 # Example: see GEOM_TestOthers.py
1029 def GetShapesOnPlaneWithLocation(self,theShape, theShapeType, theAx1, thePnt, theState):
1030 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState)
1031 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1034 ## Works like the above method, but returns list of sub-shapes indices
1036 # Example: see GEOM_TestOthers.py
1037 def GetShapesOnPlaneWithLocationIDs(self,theShape, theShapeType, theAx1, thePnt, theState):
1038 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState)
1039 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1042 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1043 # the specified cylinder by the certain way, defined through \a theState parameter.
1044 # @param theShape Shape to find sub-shapes of.
1045 # @param theShapeType Type of sub-shapes to be retrieved.
1046 # @param theAxis Vector (or line, or linear edge), specifying
1047 # axis of the cylinder to find shapes on.
1048 # @param theRadius Radius of the cylinder to find shapes on.
1049 # @param theState The state of the subshapes to find. It can be one of
1050 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1051 # @return List of all found sub-shapes.
1053 # Example: see GEOM_TestOthers.py
1054 def GetShapesOnCylinder(self,theShape, theShapeType, theAxis, theRadius, theState):
1055 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1056 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1059 ## Works like the above method, but returns list of sub-shapes indices
1061 # Example: see GEOM_TestOthers.py
1062 def GetShapesOnCylinderIDs(self,theShape, theShapeType, theAxis, theRadius, theState):
1063 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1064 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1067 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1068 # the specified sphere by the certain way, defined through \a theState parameter.
1069 # @param theShape Shape to find sub-shapes of.
1070 # @param theShapeType Type of sub-shapes to be retrieved.
1071 # @param theCenter Point, specifying center of the sphere to find shapes on.
1072 # @param theRadius Radius of the sphere to find shapes on.
1073 # @param theState The state of the subshapes to find. It can be one of
1074 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1075 # @return List of all found sub-shapes.
1077 # Example: see GEOM_TestOthers.py
1078 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1079 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1080 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1083 ## Works like the above method, but returns list of sub-shapes indices
1085 # Example: see GEOM_TestOthers.py
1086 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1087 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1088 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1091 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1092 # the specified quadrangle by the certain way, defined through \a theState parameter.
1093 # @param theShape Shape to find sub-shapes of.
1094 # @param theShapeType Type of sub-shapes to be retrieved.
1095 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1096 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1097 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1098 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1099 # @param theState The state of the subshapes to find. It can be one of
1100 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1101 # @return List of all found sub-shapes.
1103 # Example: see GEOM_TestOthers.py
1104 def GetShapesOnQuadrangle(self,theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
1105 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
1106 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
1109 ## Works like the above method, but returns list of sub-shapes indices
1111 # Example: see GEOM_TestOthers.py
1112 def GetShapesOnQuadrangleIDs(self,theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
1113 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
1114 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
1117 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1118 # the specified \a theBox by the certain way, defined through \a theState parameter.
1119 # @param theBox Shape for relative comparing.
1120 # @param theShape Shape to find sub-shapes of.
1121 # @param theShapeType Type of sub-shapes to be retrieved.
1122 # @param theState The state of the subshapes to find. It can be one of
1123 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1124 # @return List of all found sub-shapes.
1126 def GetShapesOnBox(self,theBox, theShape, theShapeType, theState):
1127 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
1128 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
1131 ## Works like the above method, but returns list of sub-shapes indices
1133 def GetShapesOnBoxIDs(self,theBox, theShape, theShapeType, theState):
1134 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
1135 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
1138 ## Find in \a theShape all sub-shapes of type \a theShapeType,
1139 # situated relatively the specified \a theCheckShape by the
1140 # certain way, defined through \a theState parameter.
1141 # @param theCheckShape Shape for relative comparing.
1142 # @param theShape Shape to find sub-shapes of.
1143 # @param theShapeType Type of sub-shapes to be retrieved.
1144 # @param theState The state of the subshapes to find. It can be one of
1145 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1146 # @return List of all found sub-shapes.
1148 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
1149 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
1150 theShapeType, theState)
1151 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
1154 ## Works like the above method, but returns result as compound
1156 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
1157 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
1158 theShapeType, theState)
1159 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
1162 ## Works like the above method, but returns list of sub-shapes indices
1164 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
1165 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
1166 theShapeType, theState)
1167 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
1170 ## Get sub-shape(s) of theShapeWhere, which are
1171 # coincident with \a theShapeWhat or could be a part of it.
1172 # @param theShapeWhere Shape to find sub-shapes of.
1173 # @param theShapeWhat Shape, specifying what to find.
1174 # @return Group of all found sub-shapes or a single found sub-shape.
1176 # Example: see GEOM_TestOthers.py
1177 def GetInPlace(self,theShapeWhere, theShapeWhat):
1178 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
1179 RaiseIfFailed("GetInPlace", self.ShapesOp)
1182 ## Get sub-shape(s) of \a theShapeWhere, which are
1183 # coincident with \a theShapeWhat or could be a part of it.
1185 # Implementation of this method is based on a saved history of an operation,
1186 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
1187 # arguments (an argument shape or a sub-shape of an argument shape).
1188 # The operation could be the Partition or one of boolean operations,
1189 # performed on simple shapes (not on compounds).
1191 # @param theShapeWhere Shape to find sub-shapes of.
1192 # @param theShapeWhat Shape, specifying what to find (must be in the
1193 # building history of the ShapeWhere).
1194 # @return Group of all found sub-shapes or a single found sub-shape.
1196 # Example: see GEOM_TestOthers.py
1197 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
1198 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
1199 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
1202 ## Get sub-shape of theShapeWhere, which is
1203 # equal to \a theShapeWhat.
1204 # @param theShapeWhere Shape to find sub-shape of.
1205 # @param theShapeWhat Shape, specifying what to find.
1206 # @return New GEOM_Object for found sub-shape.
1208 def GetSame(self,theShapeWhere, theShapeWhat):
1209 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
1210 RaiseIfFailed("GetSame", self.ShapesOp)
1213 # -----------------------------------------------------------------------------
1214 # Access to sub-shapes by their unique IDs inside the main shape.
1215 # -----------------------------------------------------------------------------
1217 ## Obtain a composite sub-shape of <aShape>, composed from sub-shapes
1218 # of <aShape>, selected by their unique IDs inside <aShape>
1220 # Example: see GEOM_TestAll.py
1221 def GetSubShape(self,aShape, ListOfID):
1222 anObj = self.AddSubShape(aShape,ListOfID)
1225 ## Obtain unique ID of sub-shape <aSubShape> inside <aShape>
1227 # Example: see GEOM_TestAll.py
1228 def GetSubShapeID(self,aShape, aSubShape):
1229 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
1230 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
1233 # -----------------------------------------------------------------------------
1235 # -----------------------------------------------------------------------------
1237 ## Explode a shape on subshapes of a given type.
1238 # @param theShape Shape to be exploded.
1239 # @param theShapeType Type of sub-shapes to be retrieved.
1240 # @return List of sub-shapes of type theShapeType, contained in theShape.
1242 # Example: see GEOM_TestAll.py
1243 def SubShapeAll(self,aShape, aType):
1244 ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
1245 RaiseIfFailed("MakeExplode", self.ShapesOp)
1248 ## Explode a shape on subshapes of a given type.
1249 # @param theShape Shape to be exploded.
1250 # @param theShapeType Type of sub-shapes to be retrieved.
1251 # @return List of IDs of sub-shapes.
1252 def SubShapeAllIDs(self,aShape, aType):
1253 ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
1254 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1257 ## Explode a shape on subshapes of a given type.
1258 # Sub-shapes will be sorted by coordinates of their gravity centers.
1259 # @param theShape Shape to be exploded.
1260 # @param theShapeType Type of sub-shapes to be retrieved.
1261 # @return List of sub-shapes of type theShapeType, contained in theShape.
1263 # Example: see GEOM_TestAll.py
1264 def SubShapeAllSorted(self,aShape, aType):
1265 ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
1266 RaiseIfFailed("MakeExplode", self.ShapesOp)
1269 ## Explode a shape on subshapes of a given type.
1270 # Sub-shapes will be sorted by coordinates of their gravity centers.
1271 # @param theShape Shape to be exploded.
1272 # @param theShapeType Type of sub-shapes to be retrieved.
1273 # @return List of IDs of sub-shapes.
1274 def SubShapeAllSortedIDs(self,aShape, aType):
1275 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
1276 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1279 ## Obtain a compound of sub-shapes of <aShape>,
1280 # selected by they indices in list of all sub-shapes of type <aType>.
1281 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1283 # Example: see GEOM_TestAll.py
1284 def SubShape(self,aShape, aType, ListOfInd):
1286 AllShapeList = self.SubShapeAll(aShape, aType)
1287 for ind in ListOfInd:
1288 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1289 anObj = self.GetSubShape(aShape, ListOfIDs)
1292 ## Obtain a compound of sub-shapes of <aShape>,
1293 # selected by they indices in sorted list of all sub-shapes of type <aType>.
1294 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1296 # Example: see GEOM_TestAll.py
1297 def SubShapeSorted(self,aShape, aType, ListOfInd):
1299 AllShapeList = self.SubShapeAllSorted(aShape, aType)
1300 for ind in ListOfInd:
1301 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1302 anObj = self.GetSubShape(aShape, ListOfIDs)
1305 # -----------------------------------------------------------------------------
1306 # Healing operations
1307 # -----------------------------------------------------------------------------
1309 ## Apply a sequence of Shape Healing operators to the given object.
1310 # @param theShape Shape to be processed.
1311 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1312 # @param theParameters List of names of parameters
1313 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1314 # @param theValues List of values of parameters, in the same order
1315 # as parameters are listed in \a theParameters list.
1316 # @return New GEOM_Object, containing processed shape.
1318 # Example: see GEOM_TestHealing.py
1319 def ProcessShape(self,theShape, theOperators, theParameters, theValues):
1320 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1321 RaiseIfFailed("ProcessShape", self.HealOp)
1324 ## Remove faces from the given object (shape).
1325 # @param theObject Shape to be processed.
1326 # @param theFaces Indices of faces to be removed, if EMPTY then the method
1327 # removes ALL faces of the given object.
1328 # @return New GEOM_Object, containing processed shape.
1330 # Example: see GEOM_TestHealing.py
1331 def SuppressFaces(self,theObject, theFaces):
1332 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
1333 RaiseIfFailed("SuppressFaces", self.HealOp)
1336 ## Sewing of some shapes into single shape.
1338 # Example: see GEOM_TestHealing.py
1339 def MakeSewing(self,ListShape, theTolerance):
1340 comp = self.MakeCompound(ListShape)
1341 anObj = self.Sew(comp, theTolerance)
1344 ## Sewing of the given object.
1345 # @param theObject Shape to be processed.
1346 # @param theTolerance Required tolerance value.
1347 # @return New GEOM_Object, containing processed shape.
1349 # Example: see MakeSewing() above
1350 def Sew(self,theObject, theTolerance):
1351 anObj = self.HealOp.Sew(theObject, theTolerance)
1352 RaiseIfFailed("Sew", self.HealOp)
1355 ## Remove internal wires and edges from the given object (face).
1356 # @param theObject Shape to be processed.
1357 # @param theWires Indices of wires to be removed, if EMPTY then the method
1358 # removes ALL internal wires of the given object.
1359 # @return New GEOM_Object, containing processed shape.
1361 # Example: see GEOM_TestHealing.py
1362 def SuppressInternalWires(self,theObject, theWires):
1363 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
1364 RaiseIfFailed("RemoveIntWires", self.HealOp)
1367 ## Remove internal closed contours (holes) from the given object.
1368 # @param theObject Shape to be processed.
1369 # @param theWires Indices of wires to be removed, if EMPTY then the method
1370 # removes ALL internal holes of the given object
1371 # @return New GEOM_Object, containing processed shape.
1373 # Example: see GEOM_TestHealing.py
1374 def SuppressHoles(self,theObject, theWires):
1375 anObj = self.HealOp.FillHoles(theObject, theWires)
1376 RaiseIfFailed("FillHoles", self.HealOp)
1379 ## Close an open wire.
1380 # @param theObject Shape to be processed.
1381 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1382 # if -1, then theObject itself is a wire.
1383 # @param isCommonVertex If TRUE : closure by creation of a common vertex,
1384 # If FALS : closure by creation of an edge between ends.
1385 # @return New GEOM_Object, containing processed shape.
1387 # Example: see GEOM_TestHealing.py
1388 def CloseContour(self,theObject, theWires, isCommonVertex):
1389 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
1390 RaiseIfFailed("CloseContour", self.HealOp)
1393 ## Addition of a point to a given edge object.
1394 # @param theObject Shape to be processed.
1395 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
1396 # if -1, then theObject itself is the edge.
1397 # @param theValue Value of parameter on edge or length parameter,
1398 # depending on \a isByParameter.
1399 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1400 # if FALSE : \a theValue is treated as a length parameter [0..1]
1401 # @return New GEOM_Object, containing processed shape.
1403 # Example: see GEOM_TestHealing.py
1404 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
1405 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1406 RaiseIfFailed("DivideEdge", self.HealOp)
1409 ## Change orientation of the given object.
1410 # @param theObject Shape to be processed.
1411 # @update given shape
1412 def ChangeOrientationShell(self,theObject):
1413 theObject = self.HealOp.ChangeOrientation(theObject)
1414 RaiseIfFailed("ChangeOrientation", self.HealOp)
1417 ## Change orientation of the given object.
1418 # @param theObject Shape to be processed.
1419 # @return New GEOM_Object, containing processed shape.
1420 def ChangeOrientationShellCopy(self,theObject):
1421 anObj = self.HealOp.ChangeOrientationCopy(theObject)
1422 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
1425 ## Get a list of wires (wrapped in GEOM_Object-s),
1426 # that constitute a free boundary of the given shape.
1427 # @param theObject Shape to get free boundary of.
1428 # @return [status, theClosedWires, theOpenWires]
1429 # status: FALSE, if an error(s) occured during the method execution.
1430 # theClosedWires: Closed wires on the free boundary of the given shape.
1431 # theOpenWires: Open wires on the free boundary of the given shape.
1433 # Example: see GEOM_TestHealing.py
1434 def GetFreeBoundary(self,theObject):
1435 anObj = self.HealOp.GetFreeBoundary(theObject)
1436 RaiseIfFailed("GetFreeBoundary", self.HealOp)
1439 # -----------------------------------------------------------------------------
1440 # Create advanced objects
1441 # -----------------------------------------------------------------------------
1443 ## Create a copy of the given object
1445 # Example: see GEOM_TestAll.py
1446 def MakeCopy(self,theOriginal):
1447 anObj = self.InsertOp.MakeCopy(theOriginal)
1448 RaiseIfFailed("MakeCopy", self.InsertOp)
1451 ## Create a filling from the given compound of contours.
1452 # @param theShape the compound of contours
1453 # @param theMinDeg a minimal degree of BSpline surface to create
1454 # @param theMaxDeg a maximal degree of BSpline surface to create
1455 # @param theTol2D a 2d tolerance to be reached
1456 # @param theTol3D a 3d tolerance to be reached
1457 # @param theNbIter a number of iteration of approximation algorithm
1458 # @return New GEOM_Object, containing the created filling surface.
1460 # Example: see GEOM_TestAll.py
1461 def MakeFilling(self,theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
1462 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox)
1463 RaiseIfFailed("MakeFilling", self.PrimOp)
1466 ## Replace coincident faces in theShape by one face.
1467 # @param theShape Initial shape.
1468 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
1469 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1470 # otherwise all initial shapes.
1471 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
1473 # Example: see GEOM_Spanner.py
1474 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
1475 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
1477 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
1481 ## Find coincident faces in theShape for possible gluing.
1482 # @param theShape Initial shape.
1483 # @param theTolerance Maximum distance between faces,
1484 # which can be considered as coincident.
1487 # Example: see GEOM_Spanner.py
1488 def GetGlueFaces(self, theShape, theTolerance):
1489 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
1490 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
1494 ## Replace coincident faces in theShape by one face
1495 # in compliance with given list of faces
1496 # @param theShape Initial shape.
1497 # @param theTolerance Maximum distance between faces,
1498 # which can be considered as coincident.
1499 # @param theFaces List of faces for gluing.
1500 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1501 # otherwise all initial shapes.
1502 # @return New GEOM_Object, containing a copy of theShape
1503 # without some faces.
1505 # Example: see GEOM_Spanner.py
1506 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
1507 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
1509 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
1513 # -----------------------------------------------------------------------------
1514 # Boolean (Common, Cut, Fuse, Section)
1515 # -----------------------------------------------------------------------------
1517 ## Perform one of boolean operations on two given shapes.
1518 # @param theShape1 First argument for boolean operation.
1519 # @param theShape2 Second argument for boolean operation.
1520 # @param theOperation Indicates the operation to be done:
1521 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
1522 # @return New GEOM_Object, containing the result shape.
1524 # Example: see GEOM_TestAll.py
1525 def MakeBoolean(self,theShape1, theShape2, theOperation):
1526 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
1527 RaiseIfFailed("MakeBoolean", self.BoolOp)
1530 ## Shortcut to MakeBoolean(s1, s2, 1)
1532 # Example: see GEOM_TestOthers.py
1533 def MakeCommon(self, s1, s2):
1534 return self.MakeBoolean(s1, s2, 1)
1536 ## Shortcut to MakeBoolean(s1, s2, 2)
1538 # Example: see GEOM_TestOthers.py
1539 def MakeCut(self, s1, s2):
1540 return self.MakeBoolean(s1, s2, 2)
1542 ## Shortcut to MakeBoolean(s1, s2, 3)
1544 # Example: see GEOM_TestOthers.py
1545 def MakeFuse(self, s1, s2):
1546 return self.MakeBoolean(s1, s2, 3)
1548 ## Shortcut to MakeBoolean(s1, s2, 4)
1550 # Example: see GEOM_TestOthers.py
1551 def MakeSection(self, s1, s2):
1552 return self.MakeBoolean(s1, s2, 4)
1554 ## Perform partition operation.
1555 # @param ListShapes Shapes to be intersected.
1556 # @param ListTools Shapes to intersect theShapes.
1557 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
1558 # in order to avoid possible intersection between shapes from
1560 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
1561 # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
1562 # type <= Limit are kept in the result,
1563 # else - shapes with type > Limit are kept
1564 # also (if they exist)
1566 # After implementation new version of PartitionAlgo (October 2006)
1567 # other parameters are ignored by current functionality. They are kept
1568 # in this function only for support old versions.
1569 # Ignored parameters:
1570 # @param ListKeepInside Shapes, outside which the results will be deleted.
1571 # Each shape from theKeepInside must belong to theShapes also.
1572 # @param ListRemoveInside Shapes, inside which the results will be deleted.
1573 # Each shape from theRemoveInside must belong to theShapes also.
1574 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
1575 # @param ListMaterials Material indices for each shape. Make sence,
1576 # only if theRemoveWebs is TRUE.
1578 # @return New GEOM_Object, containing the result shapes.
1580 # Example: see GEOM_TestAll.py
1581 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1582 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
1583 KeepNonlimitShapes=0):
1584 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
1585 ListKeepInside, ListRemoveInside,
1586 Limit, RemoveWebs, ListMaterials,
1587 KeepNonlimitShapes);
1588 RaiseIfFailed("MakePartition", self.BoolOp)
1591 ## Perform partition operation.
1592 # This method may be useful if it is needed to make a partition for
1593 # compound contains nonintersected shapes. Performance will be better
1594 # since intersection between shapes from compound is not performed.
1596 # Description of all parameters as in previous method MakePartition()
1598 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
1599 # have to consist of nonintersecting shapes.
1601 # @return New GEOM_Object, containing the result shapes.
1603 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
1604 ListKeepInside=[], ListRemoveInside=[],
1605 Limit=ShapeType["SHAPE"], RemoveWebs=0,
1606 ListMaterials=[], KeepNonlimitShapes=0):
1607 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
1608 ListKeepInside, ListRemoveInside,
1609 Limit, RemoveWebs, ListMaterials,
1610 KeepNonlimitShapes);
1611 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
1614 ## Shortcut to MakePartition()
1616 # Example: see GEOM_TestOthers.py
1617 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1618 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
1619 KeepNonlimitShapes=0):
1620 anObj = self.MakePartition(ListShapes, ListTools,
1621 ListKeepInside, ListRemoveInside,
1622 Limit, RemoveWebs, ListMaterials,
1623 KeepNonlimitShapes);
1626 ## Perform partition of the Shape with the Plane
1627 # @param theShape Shape to be intersected.
1628 # @param thePlane Tool shape, to intersect theShape.
1629 # @return New GEOM_Object, containing the result shape.
1631 # Example: see GEOM_TestAll.py
1632 def MakeHalfPartition(self,theShape, thePlane):
1633 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
1634 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
1637 # -----------------------------------------------------------------------------
1639 # -----------------------------------------------------------------------------
1641 ## Translate the given object along the vector, specified
1642 # by its end points, creating its copy before the translation.
1643 # @param theObject The object to be translated.
1644 # @param thePoint1 Start point of translation vector.
1645 # @param thePoint2 End point of translation vector.
1646 # @return New GEOM_Object, containing the translated object.
1648 # Example: see GEOM_TestAll.py
1649 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
1650 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
1651 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
1654 ## Translate the given object along the vector, specified
1655 # by its components, creating its copy before the translation.
1656 # @param theObject The object to be translated.
1657 # @param theDX,theDY,theDZ Components of translation vector.
1658 # @return New GEOM_Object, containing the translated object.
1660 # Example: see GEOM_TestAll.py
1661 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
1662 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
1663 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
1666 ## Translate the given object along the given vector,
1667 # creating its copy before the translation.
1668 # @param theObject The object to be translated.
1669 # @param theVector The translation vector.
1670 # @return New GEOM_Object, containing the translated object.
1672 # Example: see GEOM_TestAll.py
1673 def MakeTranslationVector(self,theObject, theVector):
1674 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
1675 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
1678 ## Translate the given object along the given vector on given distance,
1679 # creating its copy before the translation.
1680 # @param theObject The object to be translated.
1681 # @param theVector The translation vector.
1682 # @param theDistance The translation distance.
1683 # @return New GEOM_Object, containing the translated object.
1685 # Example: see GEOM_TestAll.py
1686 def MakeTranslationVectorDistance(self,theObject, theVector, theDistance):
1687 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
1688 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
1691 ## Rotate the given object around the given axis
1692 # on the given angle, creating its copy before the rotatation.
1693 # @param theObject The object to be rotated.
1694 # @param theAxis Rotation axis.
1695 # @param theAngle Rotation angle in radians.
1696 # @return New GEOM_Object, containing the rotated object.
1698 # Example: see GEOM_TestAll.py
1699 def MakeRotation(self,theObject, theAxis, theAngle):
1700 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
1701 RaiseIfFailed("RotateCopy", self.TrsfOp)
1704 ## Rotate given object around vector perpendicular to plane
1705 # containing three points, creating its copy before the rotatation.
1706 # @param theObject The object to be rotated.
1707 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
1708 # containing the three points.
1709 # @param thePoint1 and thePoint2 - in a perpendicular plan of the axis.
1710 # @return New GEOM_Object, containing the rotated object.
1712 # Example: see GEOM_TestAll.py
1713 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
1714 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
1715 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
1718 ## Scale the given object by the factor, creating its copy before the scaling.
1719 # @param theObject The object to be scaled.
1720 # @param thePoint Center point for scaling.
1721 # @param theFactor Scaling factor value.
1722 # @return New GEOM_Object, containing the scaled shape.
1724 # Example: see GEOM_TestAll.py
1725 def MakeScaleTransform(self,theObject, thePoint, theFactor):
1726 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
1727 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
1730 ## Create an object, symmetrical
1731 # to the given one relatively the given plane.
1732 # @param theObject The object to be mirrored.
1733 # @param thePlane Plane of symmetry.
1734 # @return New GEOM_Object, containing the mirrored shape.
1736 # Example: see GEOM_TestAll.py
1737 def MakeMirrorByPlane(self,theObject, thePlane):
1738 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
1739 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
1742 ## Create an object, symmetrical
1743 # to the given one relatively the given axis.
1744 # @param theObject The object to be mirrored.
1745 # @param theAxis Axis of symmetry.
1746 # @return New GEOM_Object, containing the mirrored shape.
1748 # Example: see GEOM_TestAll.py
1749 def MakeMirrorByAxis(self,theObject, theAxis):
1750 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
1751 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
1754 ## Create an object, symmetrical
1755 # to the given one relatively the given point.
1756 # @param theObject The object to be mirrored.
1757 # @param thePoint Point of symmetry.
1758 # @return New GEOM_Object, containing the mirrored shape.
1760 # Example: see GEOM_TestAll.py
1761 def MakeMirrorByPoint(self,theObject, thePoint):
1762 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
1763 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
1766 ## Modify the Location of the given object by LCS,
1767 # creating its copy before the setting.
1768 # @param theObject The object to be displaced.
1769 # @param theStartLCS Coordinate system to perform displacement from it.
1770 # If \a theStartLCS is NULL, displacement
1771 # will be performed from global CS.
1772 # If \a theObject itself is used as \a theStartLCS,
1773 # its location will be changed to \a theEndLCS.
1774 # @param theEndLCS Coordinate system to perform displacement to it.
1775 # @return New GEOM_Object, containing the displaced shape.
1777 # Example: see GEOM_TestAll.py
1778 def MakePosition(self,theObject, theStartLCS, theEndLCS):
1779 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
1780 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
1783 ## Create new object as offset of the given one.
1784 # @param theObject The base object for the offset.
1785 # @param theOffset Offset value.
1786 # @return New GEOM_Object, containing the offset object.
1788 # Example: see GEOM_TestAll.py
1789 def MakeOffset(self,theObject, theOffset):
1790 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
1791 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
1794 # -----------------------------------------------------------------------------
1796 # -----------------------------------------------------------------------------
1798 ## Translate the given object along the given vector a given number times
1799 # @param theObject The object to be translated.
1800 # @param theVector Direction of the translation.
1801 # @param theStep Distance to translate on.
1802 # @param theNbTimes Quantity of translations to be done.
1803 # @return New GEOM_Object, containing compound of all
1804 # the shapes, obtained after each translation.
1806 # Example: see GEOM_TestAll.py
1807 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
1808 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
1809 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
1812 ## Conseqently apply two specified translations to theObject specified number of times.
1813 # @param theObject The object to be translated.
1814 # @param theVector1 Direction of the first translation.
1815 # @param theStep1 Step of the first translation.
1816 # @param theNbTimes1 Quantity of translations to be done along theVector1.
1817 # @param theVector2 Direction of the second translation.
1818 # @param theStep2 Step of the second translation.
1819 # @param theNbTimes2 Quantity of translations to be done along theVector2.
1820 # @return New GEOM_Object, containing compound of all
1821 # the shapes, obtained after each translation.
1823 # Example: see GEOM_TestAll.py
1824 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
1825 theVector2, theStep2, theNbTimes2):
1826 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
1827 theVector2, theStep2, theNbTimes2)
1828 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
1831 ## Rotate the given object around the given axis a given number times.
1832 # Rotation angle will be 2*PI/theNbTimes.
1833 # @param theObject The object to be rotated.
1834 # @param theAxis The rotation axis.
1835 # @param theNbTimes Quantity of rotations to be done.
1836 # @return New GEOM_Object, containing compound of all the
1837 # shapes, obtained after each rotation.
1839 # Example: see GEOM_TestAll.py
1840 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
1841 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
1842 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
1845 ## Rotate the given object around the
1846 # given axis on the given angle a given number
1847 # times and multi-translate each rotation result.
1848 # Translation direction passes through center of gravity
1849 # of rotated shape and its projection on the rotation axis.
1850 # @param theObject The object to be rotated.
1851 # @param theAxis Rotation axis.
1852 # @param theAngle Rotation angle in graduces.
1853 # @param theNbTimes1 Quantity of rotations to be done.
1854 # @param theStep Translation distance.
1855 # @param theNbTimes2 Quantity of translations to be done.
1856 # @return New GEOM_Object, containing compound of all the
1857 # shapes, obtained after each transformation.
1859 # Example: see GEOM_TestAll.py
1860 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
1861 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
1862 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
1865 ## The same, as MultiRotate1D(), but axis is given by direction and point
1867 # Example: see GEOM_TestOthers.py
1868 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
1869 aVec = self.MakeLine(aPoint,aDir)
1870 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
1873 ## The same, as MultiRotate2D(), but axis is given by direction and point
1875 # Example: see GEOM_TestOthers.py
1876 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
1877 aVec = self.MakeLine(aPoint,aDir)
1878 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
1881 # -----------------------------------------------------------------------------
1883 # -----------------------------------------------------------------------------
1885 ## Perform a fillet on all edges of the given shape.
1886 # @param theShape Shape, to perform fillet on.
1887 # @param theR Fillet radius.
1888 # @return New GEOM_Object, containing the result shape.
1890 # Example: see GEOM_TestOthers.py
1891 def MakeFilletAll(self,theShape, theR):
1892 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
1893 RaiseIfFailed("MakeFilletAll", self.LocalOp)
1896 ## Perform a fillet on the specified edges/faces of the given shape
1897 # @param theShape Shape, to perform fillet on.
1898 # @param theR Fillet radius.
1899 # @param theShapeType Type of shapes in <theListShapes>.
1900 # @param theListShapes Global indices of edges/faces to perform fillet on.
1901 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1902 # @return New GEOM_Object, containing the result shape.
1904 # Example: see GEOM_TestAll.py
1905 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
1907 if theShapeType == ShapeType["EDGE"]:
1908 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
1909 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
1911 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
1912 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
1915 ## The same that MakeFillet but with two Fillet Radius R1 and R2
1916 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
1918 if theShapeType == ShapeType["EDGE"]:
1919 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
1920 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
1922 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
1923 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
1926 ## Perform a symmetric chamfer on all edges of the given shape.
1927 # @param theShape Shape, to perform chamfer on.
1928 # @param theD Chamfer size along each face.
1929 # @return New GEOM_Object, containing the result shape.
1931 # Example: see GEOM_TestOthers.py
1932 def MakeChamferAll(self,theShape, theD):
1933 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
1934 RaiseIfFailed("MakeChamferAll", self.LocalOp)
1937 ## Perform a chamfer on edges, common to the specified faces,
1938 # with distance D1 on the Face1
1939 # @param theShape Shape, to perform chamfer on.
1940 # @param theD1 Chamfer size along \a theFace1.
1941 # @param theD2 Chamfer size along \a theFace2.
1942 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
1943 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1944 # @return New GEOM_Object, containing the result shape.
1946 # Example: see GEOM_TestAll.py
1947 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
1948 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
1949 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
1952 ## The Same that MakeChamferEdge but with params theD is chamfer lenght and
1953 # theAngle is Angle of chamfer (angle in radians)
1954 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
1955 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
1956 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
1959 ## Perform a chamfer on all edges of the specified faces,
1960 # with distance D1 on the first specified face (if several for one edge)
1961 # @param theShape Shape, to perform chamfer on.
1962 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
1963 # connected to the edge, are in \a theFaces, \a theD1
1964 # will be get along face, which is nearer to \a theFaces beginning.
1965 # @param theD2 Chamfer size along another of two faces, connected to the edge.
1966 # @param theFaces Sequence of global indices of faces of \a theShape.
1967 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1968 # @return New GEOM_Object, containing the result shape.
1970 # Example: see GEOM_TestAll.py
1971 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
1972 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
1973 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
1976 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
1977 # theAngle is Angle of chamfer (angle in radians)
1978 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
1979 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
1980 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
1983 ## Perform a chamfer on edges,
1984 # with distance D1 on the first specified face (if several for one edge)
1985 # @param theShape Shape, to perform chamfer on.
1986 # @param theD1 and theD2 Chamfer size
1987 # @param theEdges Sequence of edges of \a theShape.
1988 # @return New GEOM_Object, containing the result shape.
1991 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
1992 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
1993 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
1996 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
1997 # theAngle is Angle of chamfer (angle in radians)
1998 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
1999 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
2000 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
2003 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
2005 # Example: see GEOM_TestOthers.py
2006 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
2008 if aShapeType == ShapeType["EDGE"]:
2009 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
2011 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
2014 ## Perform an Archimde operation on the given shape with given parameters.
2015 # The object presenting the resulting face is returned.
2016 # @param theShape Shape to be put in water.
2017 # @param theWeight Weight og the shape.
2018 # @param theWaterDensity Density of the water.
2019 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
2020 # @return New GEOM_Object, containing a section of \a theShape
2021 # by a plane, corresponding to water level.
2023 # Example: see GEOM_TestAll.py
2024 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
2025 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
2026 RaiseIfFailed("MakeArchimede", self.LocalOp)
2029 # -----------------------------------------------------------------------------
2030 # Information objects
2031 # -----------------------------------------------------------------------------
2033 ## Get point coordinates
2036 # Example: see GEOM_TestMeasures.py
2037 def PointCoordinates(self,Point):
2038 aTuple = self.MeasuOp.PointCoordinates(Point)
2039 RaiseIfFailed("PointCoordinates", self.MeasuOp)
2042 ## Get summarized length of all wires,
2043 # area of surface and volume of the given shape.
2044 # @param theShape Shape to define properties of.
2045 # @return [theLength, theSurfArea, theVolume]
2046 # theLength: Summarized length of all wires of the given shape.
2047 # theSurfArea: Area of surface of the given shape.
2048 # theVolume: Volume of the given shape.
2050 # Example: see GEOM_TestMeasures.py
2051 def BasicProperties(self,theShape):
2052 aTuple = self.MeasuOp.GetBasicProperties(theShape)
2053 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
2056 ## Get parameters of bounding box of the given shape
2057 # @param theShape Shape to obtain bounding box of.
2058 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
2059 # Xmin,Xmax: Limits of shape along OX axis.
2060 # Ymin,Ymax: Limits of shape along OY axis.
2061 # Zmin,Zmax: Limits of shape along OZ axis.
2063 # Example: see GEOM_TestMeasures.py
2064 def BoundingBox(self,theShape):
2065 aTuple = self.MeasuOp.GetBoundingBox(theShape)
2066 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
2069 ## Get inertia matrix and moments of inertia of theShape.
2070 # @param theShape Shape to calculate inertia of.
2071 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
2072 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
2073 # Ix,Iy,Iz: Moments of inertia of the given shape.
2075 # Example: see GEOM_TestMeasures.py
2076 def Inertia(self,theShape):
2077 aTuple = self.MeasuOp.GetInertia(theShape)
2078 RaiseIfFailed("GetInertia", self.MeasuOp)
2081 ## Get minimal distance between the given shapes.
2082 # @param theShape1,theShape2 Shapes to find minimal distance between.
2083 # @return Value of the minimal distance between the given shapes.
2085 # Example: see GEOM_TestMeasures.py
2086 def MinDistance(self, theShape1, theShape2):
2087 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2088 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2091 ## Get minimal distance between the given shapes.
2092 # @param theShape1,theShape2 Shapes to find minimal distance between.
2093 # @return Value of the minimal distance between the given shapes.
2095 # Example: see GEOM_TestMeasures.py
2096 def MinDistanceComponents(self, theShape1, theShape2):
2097 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2098 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2099 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
2102 ## Get angle between the given shapes.
2103 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2104 # @return Value of the angle between the given shapes.
2106 # Example: see GEOM_TestMeasures.py
2107 def GetAngle(self, theShape1, theShape2):
2108 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
2109 RaiseIfFailed("GetAngle", self.MeasuOp)
2112 ## Get min and max tolerances of sub-shapes of theShape
2113 # @param theShape Shape, to get tolerances of.
2114 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
2115 # FaceMin,FaceMax: Min and max tolerances of the faces.
2116 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
2117 # VertMin,VertMax: Min and max tolerances of the vertices.
2119 # Example: see GEOM_TestMeasures.py
2120 def Tolerance(self,theShape):
2121 aTuple = self.MeasuOp.GetTolerance(theShape)
2122 RaiseIfFailed("GetTolerance", self.MeasuOp)
2125 ## Obtain description of the given shape (number of sub-shapes of each type)
2126 # @param theShape Shape to be described.
2127 # @return Description of the given shape.
2129 # Example: see GEOM_TestMeasures.py
2130 def WhatIs(self,theShape):
2131 aDescr = self.MeasuOp.WhatIs(theShape)
2132 RaiseIfFailed("WhatIs", self.MeasuOp)
2135 ## Get a point, situated at the centre of mass of theShape.
2136 # @param theShape Shape to define centre of mass of.
2137 # @return New GEOM_Object, containing the created point.
2139 # Example: see GEOM_TestMeasures.py
2140 def MakeCDG(self,theShape):
2141 anObj = self.MeasuOp.GetCentreOfMass(theShape)
2142 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
2145 ## Get a normale to the given face. If the point is not given,
2146 # the normale is calculated at the center of mass.
2147 # @param theFace Face to define normale of.
2148 # @param theOptionalPoint Point to compute the normale at.
2149 # @return New GEOM_Object, containing the created vector.
2151 # Example: see GEOM_TestMeasures.py
2152 def GetNormal(self, theFace, theOptionalPoint = None):
2153 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
2154 RaiseIfFailed("GetNormal", self.MeasuOp)
2157 ## Check a topology of the given shape.
2158 # @param theShape Shape to check validity of.
2159 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
2160 # if TRUE, the shape's geometry will be checked also.
2161 # @return TRUE, if the shape "seems to be valid".
2162 # If theShape is invalid, prints a description of problem.
2164 # Example: see GEOM_TestMeasures.py
2165 def CheckShape(self,theShape, theIsCheckGeom = 0):
2167 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
2168 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
2170 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
2171 RaiseIfFailed("CheckShape", self.MeasuOp)
2176 ## Get position (LCS) of theShape.
2178 # Origin of the LCS is situated at the shape's center of mass.
2179 # Axes of the LCS are obtained from shape's location or,
2180 # if the shape is a planar face, from position of its plane.
2182 # @param theShape Shape to calculate position of.
2183 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
2184 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
2185 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
2186 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
2188 # Example: see GEOM_TestMeasures.py
2189 def GetPosition(self,theShape):
2190 aTuple = self.MeasuOp.GetPosition(theShape)
2191 RaiseIfFailed("GetPosition", self.MeasuOp)
2194 ## Get kind of theShape.
2196 # @param theShape Shape to get a kind of.
2197 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
2198 # and a list of parameters, describing the shape.
2199 # @note Concrete meaning of each value, returned via \a theIntegers
2200 # or \a theDoubles list depends on the kind of the shape.
2201 # The full list of possible outputs is:
2203 # geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
2204 # geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
2206 # geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
2207 # geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
2209 # geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
2210 # geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
2212 # geompy.kind.SPHERE xc yc zc R
2213 # geompy.kind.CYLINDER xb yb zb dx dy dz R H
2214 # geompy.kind.BOX xc yc zc ax ay az
2215 # geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
2216 # geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
2217 # geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
2218 # geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
2219 # geompy.kind.SOLID nb_faces nb_edges nb_vertices
2221 # geompy.kind.SPHERE2D xc yc zc R
2222 # geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
2223 # geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
2224 # geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
2225 # geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
2226 # geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
2227 # geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
2228 # geompy.kind.PLANE xo yo zo dx dy dz
2229 # geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
2230 # geompy.kind.FACE nb_edges nb_vertices
2232 # geompy.kind.CIRCLE xc yc zc dx dy dz R
2233 # geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
2234 # geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
2235 # geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
2236 # geompy.kind.LINE xo yo zo dx dy dz
2237 # geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
2238 # geompy.kind.EDGE nb_vertices
2240 # geompy.kind.VERTEX x y z
2242 # Example: see GEOM_TestMeasures.py
2243 def KindOfShape(self,theShape):
2244 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
2245 RaiseIfFailed("KindOfShape", self.MeasuOp)
2247 aKind = aRoughTuple[0]
2248 anInts = aRoughTuple[1]
2249 aDbls = aRoughTuple[2]
2251 # Now there is no exception from this rule:
2252 aKindTuple = [aKind] + aDbls + anInts
2254 # If they are we will regroup parameters for such kind of shape.
2256 #if aKind == kind.SOME_KIND:
2257 # # SOME_KIND int int double int double double
2258 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
2262 # -----------------------------------------------------------------------------
2263 # Import/Export objects
2264 # -----------------------------------------------------------------------------
2266 ## Import a shape from the BREP or IGES or STEP file
2267 # (depends on given format) with given name.
2268 # @param theFileName The file, containing the shape.
2269 # @param theFormatName Specify format for the file reading.
2270 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2271 # @return New GEOM_Object, containing the imported shape.
2273 # Example: see GEOM_TestOthers.py
2274 def Import(self,theFileName, theFormatName):
2275 anObj = self.InsertOp.Import(theFileName, theFormatName)
2276 RaiseIfFailed("Import", self.InsertOp)
2279 ## Shortcut to Import() for BREP format
2281 # Example: see GEOM_TestOthers.py
2282 def ImportBREP(self,theFileName):
2283 return self.Import(theFileName, "BREP")
2285 ## Shortcut to Import() for IGES format
2287 # Example: see GEOM_TestOthers.py
2288 def ImportIGES(self,theFileName):
2289 return self.Import(theFileName, "IGES")
2291 ## Shortcut to Import() for STEP format
2293 # Example: see GEOM_TestOthers.py
2294 def ImportSTEP(self,theFileName):
2295 return self.Import(theFileName, "STEP")
2297 ## Export the given shape into a file with given name.
2298 # @param theObject Shape to be stored in the file.
2299 # @param theFileName Name of the file to store the given shape in.
2300 # @param theFormatName Specify format for the shape storage.
2301 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2303 # Example: see GEOM_TestOthers.py
2304 def Export(self,theObject, theFileName, theFormatName):
2305 self.InsertOp.Export(theObject, theFileName, theFormatName)
2306 if self.InsertOp.IsDone() == 0:
2307 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
2311 ## Shortcut to Export() for BREP format
2313 # Example: see GEOM_TestOthers.py
2314 def ExportBREP(self,theObject, theFileName):
2315 return self.Export(theObject, theFileName, "BREP")
2317 ## Shortcut to Export() for IGES format
2319 # Example: see GEOM_TestOthers.py
2320 def ExportIGES(self,theObject, theFileName):
2321 return self.Export(theObject, theFileName, "IGES")
2323 ## Shortcut to Export() for STEP format
2325 # Example: see GEOM_TestOthers.py
2326 def ExportSTEP(self,theObject, theFileName):
2327 return self.Export(theObject, theFileName, "STEP")
2329 # -----------------------------------------------------------------------------
2331 # -----------------------------------------------------------------------------
2333 ## Create a quadrangle face from four edges. Order of Edges is not
2334 # important. It is not necessary that edges share the same vertex.
2335 # @param E1,E2,E3,E4 Edges for the face bound.
2336 # @return New GEOM_Object, containing the created face.
2338 # Example: see GEOM_Spanner.py
2339 def MakeQuad(self,E1, E2, E3, E4):
2340 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
2341 RaiseIfFailed("MakeQuad", self.BlocksOp)
2344 ## Create a quadrangle face on two edges.
2345 # The missing edges will be built by creating the shortest ones.
2346 # @param E1,E2 Two opposite edges for the face.
2347 # @return New GEOM_Object, containing the created face.
2349 # Example: see GEOM_Spanner.py
2350 def MakeQuad2Edges(self,E1, E2):
2351 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
2352 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
2355 ## Create a quadrangle face with specified corners.
2356 # The missing edges will be built by creating the shortest ones.
2357 # @param V1,V2,V3,V4 Corner vertices for the face.
2358 # @return New GEOM_Object, containing the created face.
2360 # Example: see GEOM_Spanner.py
2361 def MakeQuad4Vertices(self,V1, V2, V3, V4):
2362 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
2363 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
2366 ## Create a hexahedral solid, bounded by the six given faces. Order of
2367 # faces is not important. It is not necessary that Faces share the same edge.
2368 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
2369 # @return New GEOM_Object, containing the created solid.
2371 # Example: see GEOM_Spanner.py
2372 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
2373 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
2374 RaiseIfFailed("MakeHexa", self.BlocksOp)
2377 ## Create a hexahedral solid between two given faces.
2378 # The missing faces will be built by creating the smallest ones.
2379 # @param F1,F2 Two opposite faces for the hexahedral solid.
2380 # @return New GEOM_Object, containing the created solid.
2382 # Example: see GEOM_Spanner.py
2383 def MakeHexa2Faces(self,F1, F2):
2384 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
2385 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
2388 ## Get a vertex, found in the given shape by its coordinates.
2389 # @param theShape Block or a compound of blocks.
2390 # @param theX,theY,theZ Coordinates of the sought vertex.
2391 # @param theEpsilon Maximum allowed distance between the resulting
2392 # vertex and point with the given coordinates.
2393 # @return New GEOM_Object, containing the found vertex.
2395 # Example: see GEOM_TestOthers.py
2396 def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
2397 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
2398 RaiseIfFailed("GetPoint", self.BlocksOp)
2401 ## Get an edge, found in the given shape by two given vertices.
2402 # @param theShape Block or a compound of blocks.
2403 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
2404 # @return New GEOM_Object, containing the found edge.
2406 # Example: see GEOM_Spanner.py
2407 def GetEdge(self,theShape, thePoint1, thePoint2):
2408 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
2409 RaiseIfFailed("GetEdge", self.BlocksOp)
2412 ## Find an edge of the given shape, which has minimal distance to the given point.
2413 # @param theShape Block or a compound of blocks.
2414 # @param thePoint Point, close to the desired edge.
2415 # @return New GEOM_Object, containing the found edge.
2417 # Example: see GEOM_TestOthers.py
2418 def GetEdgeNearPoint(self,theShape, thePoint):
2419 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
2420 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
2423 ## Returns a face, found in the given shape by four given corner vertices.
2424 # @param theShape Block or a compound of blocks.
2425 # @param thePoint1-thePoint4 Points, close to the corners of the desired face.
2426 # @return New GEOM_Object, containing the found face.
2428 # Example: see GEOM_Spanner.py
2429 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
2430 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
2431 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
2434 ## Get a face of block, found in the given shape by two given edges.
2435 # @param theShape Block or a compound of blocks.
2436 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
2437 # @return New GEOM_Object, containing the found face.
2439 # Example: see GEOM_Spanner.py
2440 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
2441 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
2442 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
2445 ## Find a face, opposite to the given one in the given block.
2446 # @param theBlock Must be a hexahedral solid.
2447 # @param theFace Face of \a theBlock, opposite to the desired face.
2448 # @return New GEOM_Object, containing the found face.
2450 # Example: see GEOM_Spanner.py
2451 def GetOppositeFace(self,theBlock, theFace):
2452 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
2453 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
2456 ## Find a face of the given shape, which has minimal distance to the given point.
2457 # @param theShape Block or a compound of blocks.
2458 # @param thePoint Point, close to the desired face.
2459 # @return New GEOM_Object, containing the found face.
2461 # Example: see GEOM_Spanner.py
2462 def GetFaceNearPoint(self,theShape, thePoint):
2463 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
2464 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
2467 ## Find a face of block, whose outside normale has minimal angle with the given vector.
2468 # @param theShape Block or a compound of blocks.
2469 # @param theVector Vector, close to the normale of the desired face.
2470 # @return New GEOM_Object, containing the found face.
2472 # Example: see GEOM_Spanner.py
2473 def GetFaceByNormale(self,theBlock, theVector):
2474 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
2475 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
2478 ## Check, if the compound of blocks is given.
2479 # To be considered as a compound of blocks, the
2480 # given shape must satisfy the following conditions:
2481 # - Each element of the compound should be a Block (6 faces and 12 edges).
2482 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
2483 # - The compound should be connexe.
2484 # - The glue between two quadrangle faces should be applied.
2485 # @param theCompound The compound to check.
2486 # @return TRUE, if the given shape is a compound of blocks.
2487 # If theCompound is not valid, prints all discovered errors.
2489 # Example: see GEOM_Spanner.py
2490 def CheckCompoundOfBlocks(self,theCompound):
2491 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
2492 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
2494 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
2498 ## Remove all seam and degenerated edges from \a theShape.
2499 # Unite faces and edges, sharing one surface. It means that
2500 # this faces must have references to one C++ surface object (handle).
2501 # @param theShape The compound or single solid to remove irregular edges from.
2502 # @return Improved shape.
2504 # Example: see GEOM_TestOthers.py
2505 def RemoveExtraEdges(self,theShape):
2506 anObj = self.BlocksOp.RemoveExtraEdges(theShape)
2507 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
2510 ## Check, if the given shape is a blocks compound.
2511 # Fix all detected errors.
2512 # \note Single block can be also fixed by this method.
2513 # @param theCompound The compound to check and improve.
2514 # @return Improved compound.
2516 # Example: see GEOM_TestOthers.py
2517 def CheckAndImprove(self,theShape):
2518 anObj = self.BlocksOp.CheckAndImprove(theShape)
2519 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
2522 ## Get all the blocks, contained in the given compound.
2523 # @param theCompound The compound to explode.
2524 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
2525 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
2526 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
2527 # @return List of GEOM_Objects, containing the retrieved blocks.
2529 # Example: see GEOM_TestOthers.py
2530 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
2531 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
2532 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
2535 ## Find block, containing the given point inside its volume or on boundary.
2536 # @param theCompound Compound, to find block in.
2537 # @param thePoint Point, close to the desired block. If the point lays on
2538 # boundary between some blocks, we return block with nearest center.
2539 # @return New GEOM_Object, containing the found block.
2541 # Example: see GEOM_Spanner.py
2542 def GetBlockNearPoint(self,theCompound, thePoint):
2543 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
2544 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
2547 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
2548 # @param theCompound Compound, to find block in.
2549 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
2550 # @return New GEOM_Object, containing the found block.
2552 # Example: see GEOM_TestOthers.py
2553 def GetBlockByParts(self,theCompound, theParts):
2554 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
2555 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
2558 ## Return all blocks, containing all the elements, passed as the parts.
2559 # @param theCompound Compound, to find blocks in.
2560 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
2561 # @return List of GEOM_Objects, containing the found blocks.
2563 # Example: see GEOM_Spanner.py
2564 def GetBlocksByParts(self,theCompound, theParts):
2565 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
2566 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
2569 ## Multi-transformate block and glue the result.
2570 # Transformation is defined so, as to superpose direction faces.
2571 # @param Block Hexahedral solid to be multi-transformed.
2572 # @param DirFace1 ID of First direction face.
2573 # @param DirFace2 ID of Second direction face.
2574 # @param NbTimes Quantity of transformations to be done.
2575 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
2576 # @return New GEOM_Object, containing the result shape.
2578 # Example: see GEOM_Spanner.py
2579 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
2580 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
2581 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
2584 ## Multi-transformate block and glue the result.
2585 # @param Block Hexahedral solid to be multi-transformed.
2586 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
2587 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
2588 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
2589 # @return New GEOM_Object, containing the result shape.
2591 # Example: see GEOM_Spanner.py
2592 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
2593 DirFace1V, DirFace2V, NbTimesV):
2594 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
2595 DirFace1V, DirFace2V, NbTimesV)
2596 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
2599 ## Build all possible propagation groups.
2600 # Propagation group is a set of all edges, opposite to one (main)
2601 # edge of this group directly or through other opposite edges.
2602 # Notion of Opposite Edge make sence only on quadrangle face.
2603 # @param theShape Shape to build propagation groups on.
2604 # @return List of GEOM_Objects, each of them is a propagation group.
2606 # Example: see GEOM_TestOthers.py
2607 def Propagate(self,theShape):
2608 listChains = self.BlocksOp.Propagate(theShape)
2609 RaiseIfFailed("Propagate", self.BlocksOp)
2612 # -----------------------------------------------------------------------------
2614 # -----------------------------------------------------------------------------
2616 ## Creates a new group which will store sub shapes of theMainShape
2617 # @param theMainShape is a GEOM object on which the group is selected
2618 # @param theShapeType defines a shape type of the group
2619 # @return a newly created GEOM group
2621 # Example: see GEOM_TestOthers.py
2622 def CreateGroup(self,theMainShape, theShapeType):
2623 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
2624 RaiseIfFailed("CreateGroup", self.GroupOp)
2627 ## Adds a sub object with ID theSubShapeId to the group
2628 # @param theGroup is a GEOM group to which the new sub shape is added
2629 # @param theSubShapeID is a sub shape ID in the main object.
2630 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
2632 # Example: see GEOM_TestOthers.py
2633 def AddObject(self,theGroup, theSubShapeID):
2634 self.GroupOp.AddObject(theGroup, theSubShapeID)
2635 RaiseIfFailed("AddObject", self.GroupOp)
2638 ## Removes a sub object with ID \a theSubShapeId from the group
2639 # @param theGroup is a GEOM group from which the new sub shape is removed
2640 # @param theSubShapeID is a sub shape ID in the main object.
2641 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
2643 # Example: see GEOM_TestOthers.py
2644 def RemoveObject(self,theGroup, theSubShapeID):
2645 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
2646 RaiseIfFailed("RemoveObject", self.GroupOp)
2649 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
2650 # @param theGroup is a GEOM group to which the new sub shapes are added.
2651 # @param theSubShapes is a list of sub shapes to be added.
2653 # Example: see GEOM_TestOthers.py
2654 def UnionList (self,theGroup, theSubShapes):
2655 self.GroupOp.UnionList(theGroup, theSubShapes)
2656 RaiseIfFailed("UnionList", self.GroupOp)
2659 ## Works like the above method, but argument
2660 # theSubShapes here is a list of sub-shapes indices
2662 # Example: see GEOM_TestOthers.py
2663 def UnionIDs(self,theGroup, theSubShapes):
2664 self.GroupOp.UnionIDs(theGroup, theSubShapes)
2665 RaiseIfFailed("UnionIDs", self.GroupOp)
2668 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
2669 # @param theGroup is a GEOM group from which the sub-shapes are removed.
2670 # @param theSubShapes is a list of sub-shapes to be removed.
2672 # Example: see GEOM_TestOthers.py
2673 def DifferenceList (self,theGroup, theSubShapes):
2674 self.GroupOp.DifferenceList(theGroup, theSubShapes)
2675 RaiseIfFailed("DifferenceList", self.GroupOp)
2678 ## Works like the above method, but argument
2679 # theSubShapes here is a list of sub-shapes indices
2681 # Example: see GEOM_TestOthers.py
2682 def DifferenceIDs(self,theGroup, theSubShapes):
2683 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
2684 RaiseIfFailed("DifferenceIDs", self.GroupOp)
2687 ## Returns a list of sub objects ID stored in the group
2688 # @param theGroup is a GEOM group for which a list of IDs is requested
2690 # Example: see GEOM_TestOthers.py
2691 def GetObjectIDs(self,theGroup):
2692 ListIDs = self.GroupOp.GetObjects(theGroup)
2693 RaiseIfFailed("GetObjects", self.GroupOp)
2696 ## Returns a type of sub objects stored in the group
2697 # @param theGroup is a GEOM group which type is returned.
2699 # Example: see GEOM_TestOthers.py
2700 def GetType(self,theGroup):
2701 aType = self.GroupOp.GetType(theGroup)
2702 RaiseIfFailed("GetType", self.GroupOp)
2705 ## Returns a main shape associated with the group
2706 # @param theGroup is a GEOM group for which a main shape object is requested
2707 # @return a GEOM object which is a main shape for theGroup
2709 # Example: see GEOM_TestOthers.py
2710 def GetMainShape(self,theGroup):
2711 anObj = self.GroupOp.GetMainShape(theGroup)
2712 RaiseIfFailed("GetMainShape", self.GroupOp)
2715 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
2716 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
2717 def GetEdgesByLength (self,theShape, min_length, max_length, include_min = 1, include_max = 1):
2718 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
2721 Props = self.BasicProperties(edge)
2722 if min_length <= Props[0] and Props[0] <= max_length:
2723 if (not include_min) and (min_length == Props[0]):
2726 if (not include_max) and (Props[0] == max_length):
2729 edges_in_range.append(edge)
2731 if len(edges_in_range) <= 0:
2732 print "No edges found by given criteria"
2735 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
2736 self.UnionList(group_edges, edges_in_range)
2740 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
2741 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
2742 def SelectEdges (self,min_length, max_length, include_min = 1, include_max = 1):
2743 nb_selected = sg.SelectedCount()
2745 print "Select a shape before calling this function, please."
2748 print "Only one shape must be selected"
2751 id_shape = sg.getSelected(0)
2752 shape = IDToObject( id_shape )
2754 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
2758 if include_min: left_str = " <= "
2759 if include_max: right_str = " <= "
2761 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
2762 + left_str + "length" + right_str + `max_length`)
2764 sg.updateObjBrowser(1)
2768 ## Add Path to load python scripts from
2769 def addPath(self,Path):
2770 if (sys.path.count(Path) < 1):
2771 sys.path.append(Path)
2774 #Register the new proxy for GEOM_Gen
2775 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)