1 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
3 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 # Author : Paul RASCLE, EDF
34 ## @defgroup l1_geompy_auxiliary Auxiliary data structures and methods
36 ## @defgroup l1_geompy_purpose All package methods, grouped by their purpose
38 ## @defgroup l2_import_export Importing/exporting geometrical objects
39 ## @defgroup l2_creating Creating geometrical objects
41 ## @defgroup l3_basic_go Creating Basic Geometric Objects
43 ## @defgroup l4_curves Creating Curves
46 ## @defgroup l3_3d_primitives Creating 3D Primitives
47 ## @defgroup l3_complex Creating Complex Objects
48 ## @defgroup l3_groups Working with groups
49 ## @defgroup l3_blocks Building by blocks
51 ## @defgroup l4_blocks_measure Check and Improve
54 ## @defgroup l3_sketcher Sketcher
55 ## @defgroup l3_advanced Creating Advanced Geometrical Objects
57 ## @defgroup l4_decompose Decompose objects
58 ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
59 ## @defgroup l4_obtain Access to subshapes by a criteria
64 ## @defgroup l2_transforming Transforming geometrical objects
66 ## @defgroup l3_basic_op Basic Operations
67 ## @defgroup l3_boolean Boolean Operations
68 ## @defgroup l3_transform Transformation Operations
69 ## @defgroup l3_local Local Operations (Fillet and Chamfer)
70 ## @defgroup l3_blocks_op Blocks Operations
71 ## @defgroup l3_healing Repairing Operations
72 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of subshapes
75 ## @defgroup l2_measure Using measurement tools
83 from salome_notebook import *
88 ## Enumeration ShapeType as a dictionary
89 # @ingroup l1_geompy_auxiliary
90 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
92 ## Raise an Error, containing the Method_name, if Operation is Failed
93 ## @ingroup l1_geompy_auxiliary
94 def RaiseIfFailed (Method_name, Operation):
95 if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
96 raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
98 ## Return list of variables value from salome notebook
99 ## @ingroup l1_geompy_auxiliary
100 def ParseParameters(*parameters):
103 for parameter in parameters:
104 if isinstance(parameter,str):
105 if notebook.isVariable(parameter):
106 Result.append(notebook.get(parameter))
110 Result.append(parameter)
113 StringResult = StringResult + str(parameter)
114 StringResult = StringResult + ":"
116 StringResult = StringResult[:len(StringResult)-1]
117 Result.append(StringResult)
120 ## Return list of variables value from salome notebook
121 ## @ingroup l1_geompy_auxiliary
125 for parameter in list:
126 if isinstance(parameter,str) and notebook.isVariable(parameter):
127 Result.append(str(notebook.get(parameter)))
130 Result.append(str(parameter))
133 StringResult = StringResult + str(parameter)
134 StringResult = StringResult + ":"
136 StringResult = StringResult[:len(StringResult)-1]
137 return Result,StringResult
140 ## Kinds of shape enumeration
141 # @ingroup l1_geompy_auxiliary
142 kind = GEOM.GEOM_IKindOfShape
144 ## Information about closed/unclosed state of shell or wire
145 # @ingroup l1_geompy_auxiliary
152 class geompyDC(GEOM._objref_GEOM_Gen):
154 ## @addtogroup l1_geompy_auxiliary
157 GEOM._objref_GEOM_Gen.__init__(self)
158 self.myBuilder = None
176 def init_geom(self,theStudy):
177 self.myStudy = theStudy
178 self.myStudyId = self.myStudy._get_StudyId()
179 self.myBuilder = self.myStudy.NewBuilder()
180 self.father = self.myStudy.FindComponent("GEOM")
181 if self.father is None:
182 self.father = self.myBuilder.NewComponent("GEOM")
183 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
184 FName = A1._narrow(SALOMEDS.AttributeName)
185 FName.SetValue("Geometry")
186 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
187 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
188 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
189 self.myBuilder.DefineComponentInstance(self.father,self)
191 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
192 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
193 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
194 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
195 self.HealOp = self.GetIHealingOperations (self.myStudyId)
196 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
197 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
198 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
199 self.LocalOp = self.GetILocalOperations (self.myStudyId)
200 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
201 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
202 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
205 ## Get name for sub-shape aSubObj of shape aMainObj
207 # @ref swig_SubShapeAllSorted "Example"
208 def SubShapeName(self,aSubObj, aMainObj):
209 # Example: see GEOM_TestAll.py
211 #aSubId = orb.object_to_string(aSubObj)
212 #aMainId = orb.object_to_string(aMainObj)
213 #index = gg.getIndexTopology(aSubId, aMainId)
214 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
215 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
216 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
219 ## Publish in study aShape with name aName
221 # \param aShape the shape to be published
222 # \param aName the name for the shape
223 # \param doRestoreSubShapes if True, finds and publishes also
224 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
225 # and published sub-shapes of arguments
226 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
227 # these arguments description
228 # \return study entry of the published shape in form of string
230 # @ref swig_MakeQuad4Vertices "Example"
231 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
232 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
233 # Example: see GEOM_TestAll.py
235 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
236 if doRestoreSubShapes:
237 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
238 theFindMethod, theInheritFirstArg)
240 print "addToStudy() failed"
242 return aShape.GetStudyEntry()
244 ## Publish in study aShape with name aName as sub-object of previously published aFather
246 # @ref swig_SubShapeAllSorted "Example"
247 def addToStudyInFather(self, aFather, aShape, aName):
248 # Example: see GEOM_TestAll.py
250 aSObject = self.AddInStudy(myStudy, aShape, aName, aFather)
252 print "addToStudyInFather() failed"
254 return aShape.GetStudyEntry()
256 # end of l1_geompy_auxiliary
259 ## @addtogroup l3_restore_ss
262 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
263 # To be used from python scripts out of geompy.addToStudy (non-default usage)
264 # \param theObject published GEOM object, arguments of which will be published
265 # \param theArgs list of GEOM_Object, operation arguments to be published.
266 # If this list is empty, all operation arguments will be published
267 # \param theFindMethod method to search subshapes, corresponding to arguments and
268 # their subshapes. Value from enumeration GEOM::find_shape_method.
269 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
270 # Do not publish subshapes in place of arguments, but only
271 # in place of subshapes of the first argument,
272 # because the whole shape corresponds to the first argument.
273 # Mainly to be used after transformations, but it also can be
274 # usefull after partition with one object shape, and some other
275 # operations, where only the first argument has to be considered.
276 # If theObject has only one argument shape, this flag is automatically
277 # considered as True, not regarding really passed value.
278 # \return True in case of success, False otherwise.
280 # @ref tui_restore_prs_params "Example"
281 def RestoreSubShapes (self, theObject, theArgs=[],
282 theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
283 # Example: see GEOM_TestAll.py
284 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
285 theFindMethod, theInheritFirstArg)
287 # end of l3_restore_ss
290 ## @addtogroup l3_basic_go
293 ## Create point by three coordinates.
294 # @param theX The X coordinate of the point.
295 # @param theY The Y coordinate of the point.
296 # @param theZ The Z coordinate of the point.
297 # @return New GEOM_Object, containing the created point.
299 # @ref tui_creation_point "Example"
300 def MakeVertex(self,theX, theY, theZ):
301 # Example: see GEOM_TestAll.py
302 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
303 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
304 RaiseIfFailed("MakePointXYZ", self.BasicOp)
305 anObj.SetParameters(Parameters)
308 ## Create a point, distant from the referenced point
309 # on the given distances along the coordinate axes.
310 # @param theReference The referenced point.
311 # @param theX Displacement from the referenced point along OX axis.
312 # @param theY Displacement from the referenced point along OY axis.
313 # @param theZ Displacement from the referenced point along OZ axis.
314 # @return New GEOM_Object, containing the created point.
316 # @ref tui_creation_point "Example"
317 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
318 # Example: see GEOM_TestAll.py
319 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
320 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
321 RaiseIfFailed("MakePointWithReference", self.BasicOp)
322 anObj.SetParameters(Parameters)
325 ## Create a point, corresponding to the given parameter on the given curve.
326 # @param theRefCurve The referenced curve.
327 # @param theParameter Value of parameter on the referenced curve.
328 # @return New GEOM_Object, containing the created point.
330 # @ref tui_creation_point "Example"
331 def MakeVertexOnCurve(self,theRefCurve, theParameter):
332 # Example: see GEOM_TestAll.py
333 theParameter, Parameters = ParseParameters(theParameter)
334 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
335 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
336 anObj.SetParameters(Parameters)
339 ## Create a point, corresponding to the given parameters on the
341 # @param theRefSurf The referenced surface.
342 # @param theUParameter Value of U-parameter on the referenced surface.
343 # @param theVParameter Value of V-parameter on the referenced surface.
344 # @return New GEOM_Object, containing the created point.
346 # @ref swig_MakeVertexOnSurface "Example"
347 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
348 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
349 # Example: see GEOM_TestAll.py
350 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
351 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
352 anObj.SetParameters(Parameters);
355 ## Create a point on intersection of two lines.
356 # @param theRefLine1, theRefLine2 The referenced lines.
357 # @return New GEOM_Object, containing the created point.
359 # @ref swig_MakeVertexOnLinesIntersection "Example"
360 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
361 # Example: see GEOM_TestAll.py
362 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
363 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
366 ## Create a tangent, corresponding to the given parameter on the given curve.
367 # @param theRefCurve The referenced curve.
368 # @param theParameter Value of parameter on the referenced curve.
369 # @return New GEOM_Object, containing the created tangent.
371 # @ref swig_MakeTangentOnCurve "Example"
372 def MakeTangentOnCurve(self, theRefCurve, theParameter):
373 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
374 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
377 ## Create a vector with the given components.
378 # @param theDX X component of the vector.
379 # @param theDY Y component of the vector.
380 # @param theDZ Z component of the vector.
381 # @return New GEOM_Object, containing the created vector.
383 # @ref tui_creation_vector "Example"
384 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
385 # Example: see GEOM_TestAll.py
386 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
387 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
388 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
389 anObj.SetParameters(Parameters)
392 ## Create a vector between two points.
393 # @param thePnt1 Start point for the vector.
394 # @param thePnt2 End point for the vector.
395 # @return New GEOM_Object, containing the created vector.
397 # @ref tui_creation_vector "Example"
398 def MakeVector(self,thePnt1, thePnt2):
399 # Example: see GEOM_TestAll.py
400 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
401 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
404 ## Create a line, passing through the given point
405 # and parrallel to the given direction
406 # @param thePnt Point. The resulting line will pass through it.
407 # @param theDir Direction. The resulting line will be parallel to it.
408 # @return New GEOM_Object, containing the created line.
410 # @ref tui_creation_line "Example"
411 def MakeLine(self,thePnt, theDir):
412 # Example: see GEOM_TestAll.py
413 anObj = self.BasicOp.MakeLine(thePnt, theDir)
414 RaiseIfFailed("MakeLine", self.BasicOp)
417 ## Create a line, passing through the given points
418 # @param thePnt1 First of two points, defining the line.
419 # @param thePnt2 Second of two points, defining the line.
420 # @return New GEOM_Object, containing the created line.
422 # @ref tui_creation_line "Example"
423 def MakeLineTwoPnt(self,thePnt1, thePnt2):
424 # Example: see GEOM_TestAll.py
425 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
426 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
429 ## Create a line on two faces intersection.
430 # @param theFace1 First of two faces, defining the line.
431 # @param theFace2 Second of two faces, defining the line.
432 # @return New GEOM_Object, containing the created line.
434 # @ref swig_MakeLineTwoFaces "Example"
435 def MakeLineTwoFaces(self, theFace1, theFace2):
436 # Example: see GEOM_TestAll.py
437 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
438 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
441 ## Create a plane, passing through the given point
442 # and normal to the given vector.
443 # @param thePnt Point, the plane has to pass through.
444 # @param theVec Vector, defining the plane normal direction.
445 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
446 # @return New GEOM_Object, containing the created plane.
448 # @ref tui_creation_plane "Example"
449 def MakePlane(self,thePnt, theVec, theTrimSize):
450 # Example: see GEOM_TestAll.py
451 theTrimSize, Parameters = ParseParameters(theTrimSize);
452 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
453 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
454 anObj.SetParameters(Parameters)
457 ## Create a plane, passing through the three given points
458 # @param thePnt1 First of three points, defining the plane.
459 # @param thePnt2 Second of three points, defining the plane.
460 # @param thePnt3 Fird of three points, defining the plane.
461 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
462 # @return New GEOM_Object, containing the created plane.
464 # @ref tui_creation_plane "Example"
465 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
466 # Example: see GEOM_TestAll.py
467 theTrimSize, Parameters = ParseParameters(theTrimSize);
468 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
469 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
470 anObj.SetParameters(Parameters)
473 ## Create a plane, similar to the existing one, but with another size of representing face.
474 # @param theFace Referenced plane or LCS(Marker).
475 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
476 # @return New GEOM_Object, containing the created plane.
478 # @ref tui_creation_plane "Example"
479 def MakePlaneFace(self,theFace, theTrimSize):
480 # Example: see GEOM_TestAll.py
481 theTrimSize, Parameters = ParseParameters(theTrimSize);
482 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
483 RaiseIfFailed("MakePlaneFace", self.BasicOp)
484 anObj.SetParameters(Parameters)
487 ## Create a local coordinate system.
488 # @param OX,OY,OZ Three coordinates of coordinate system origin.
489 # @param XDX,XDY,XDZ Three components of OX direction
490 # @param YDX,YDY,YDZ Three components of OY direction
491 # @return New GEOM_Object, containing the created coordinate system.
493 # @ref swig_MakeMarker "Example"
494 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
495 # Example: see GEOM_TestAll.py
496 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
497 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
498 RaiseIfFailed("MakeMarker", self.BasicOp)
499 anObj.SetParameters(Parameters)
502 ## Create a local coordinate system.
503 # @param theOrigin Point of coordinate system origin.
504 # @param theXVec Vector of X direction
505 # @param theYVec Vector of Y direction
506 # @return New GEOM_Object, containing the created coordinate system.
508 # @ref swig_MakeMarker "Example"
509 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
510 O = self.PointCoordinates( theOrigin )
512 for vec in [ theXVec, theYVec ]:
513 v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] )
514 p1 = self.PointCoordinates( v1 )
515 p2 = self.PointCoordinates( v2 )
516 for i in range( 0, 3 ):
517 OXOY.append( p2[i] - p1[i] )
519 anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2],
520 OXOY[0], OXOY[1], OXOY[2],
521 OXOY[3], OXOY[4], OXOY[5], )
522 RaiseIfFailed("MakeMarker", self.BasicOp)
528 ## @addtogroup l4_curves
531 ## Create an arc of circle, passing through three given points.
532 # @param thePnt1 Start point of the arc.
533 # @param thePnt2 Middle point of the arc.
534 # @param thePnt3 End point of the arc.
535 # @return New GEOM_Object, containing the created arc.
537 # @ref swig_MakeArc "Example"
538 def MakeArc(self,thePnt1, thePnt2, thePnt3):
539 # Example: see GEOM_TestAll.py
540 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
541 RaiseIfFailed("MakeArc", self.CurvesOp)
544 ## Create an arc of circle from a center and 2 points.
545 # @param thePnt1 Center of the arc
546 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
547 # @param thePnt3 End point of the arc (Gives also a direction)
548 # @param theSense Orientation of the arc
549 # @return New GEOM_Object, containing the created arc.
551 # @ref swig_MakeArc "Example"
552 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
553 # Example: see GEOM_TestAll.py
554 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
555 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
558 ## Create a circle with given center, normal vector and radius.
559 # @param thePnt Circle center.
560 # @param theVec Vector, normal to the plane of the circle.
561 # @param theR Circle radius.
562 # @return New GEOM_Object, containing the created circle.
564 # @ref tui_creation_circle "Example"
565 def MakeCircle(self, thePnt, theVec, theR):
566 # Example: see GEOM_TestAll.py
567 theR, Parameters = ParseParameters(theR)
568 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
569 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
570 anObj.SetParameters(Parameters)
573 ## Create a circle with given radius.
574 # Center of the circle will be in the origin of global
575 # coordinate system and normal vector will be codirected with Z axis
576 # @param theR Circle radius.
577 # @return New GEOM_Object, containing the created circle.
578 def MakeCircleR(self, theR):
579 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
580 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
583 ## Create a circle, passing through three given points
584 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
585 # @return New GEOM_Object, containing the created circle.
587 # @ref tui_creation_circle "Example"
588 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
589 # Example: see GEOM_TestAll.py
590 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
591 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
594 ## Create a circle, with given point1 as center,
595 # passing through the point2 as radius and laying in the plane,
596 # defined by all three given points.
597 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
598 # @return New GEOM_Object, containing the created circle.
600 # @ref swig_MakeCircle "Example"
601 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
602 # Example: see GEOM_example6.py
603 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
604 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
607 ## Create an ellipse with given center, normal vector and radiuses.
608 # @param thePnt Ellipse center.
609 # @param theVec Vector, normal to the plane of the ellipse.
610 # @param theRMajor Major ellipse radius.
611 # @param theRMinor Minor ellipse radius.
612 # @return New GEOM_Object, containing the created ellipse.
614 # @ref tui_creation_ellipse "Example"
615 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor):
616 # Example: see GEOM_TestAll.py
617 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
618 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
619 RaiseIfFailed("MakeEllipse", self.CurvesOp)
620 anObj.SetParameters(Parameters)
623 ## Create an ellipse with given radiuses.
624 # Center of the ellipse will be in the origin of global
625 # coordinate system and normal vector will be codirected with Z axis
626 # @param theRMajor Major ellipse radius.
627 # @param theRMinor Minor ellipse radius.
628 # @return New GEOM_Object, containing the created ellipse.
629 def MakeEllipseRR(self, theRMajor, theRMinor):
630 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
631 RaiseIfFailed("MakeEllipse", self.CurvesOp)
634 ## Create a polyline on the set of points.
635 # @param thePoints Sequence of points for the polyline.
636 # @return New GEOM_Object, containing the created polyline.
638 # @ref tui_creation_curve "Example"
639 def MakePolyline(self,thePoints):
640 # Example: see GEOM_TestAll.py
641 anObj = self.CurvesOp.MakePolyline(thePoints)
642 RaiseIfFailed("MakePolyline", self.CurvesOp)
645 ## Create bezier curve on the set of points.
646 # @param thePoints Sequence of points for the bezier curve.
647 # @return New GEOM_Object, containing the created bezier curve.
649 # @ref tui_creation_curve "Example"
650 def MakeBezier(self,thePoints):
651 # Example: see GEOM_TestAll.py
652 anObj = self.CurvesOp.MakeSplineBezier(thePoints)
653 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
656 ## Create B-Spline curve on the set of points.
657 # @param thePoints Sequence of points for the B-Spline curve.
658 # @return New GEOM_Object, containing the created B-Spline curve.
660 # @ref tui_creation_curve "Example"
661 def MakeInterpol(self,thePoints):
662 # Example: see GEOM_TestAll.py
663 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints)
664 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
670 ## @addtogroup l3_sketcher
673 ## Create a sketcher (wire or face), following the textual description,
674 # passed through <VAR>theCommand</VAR> argument. \n
675 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
676 # Format of the description string have to be the following:
678 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
681 # - x1, y1 are coordinates of the first sketcher point (zero by default),
683 # - "R angle" : Set the direction by angle
684 # - "D dx dy" : Set the direction by DX & DY
687 # - "TT x y" : Create segment by point at X & Y
688 # - "T dx dy" : Create segment by point with DX & DY
689 # - "L length" : Create segment by direction & Length
690 # - "IX x" : Create segment by direction & Intersect. X
691 # - "IY y" : Create segment by direction & Intersect. Y
694 # - "C radius length" : Create arc by direction, radius and length(in degree)
697 # - "WW" : Close Wire (to finish)
698 # - "WF" : Close Wire and build face (to finish)
700 # @param theCommand String, defining the sketcher in local
701 # coordinates of the working plane.
702 # @param theWorkingPlane Nine double values, defining origin,
703 # OZ and OX directions of the working plane.
704 # @return New GEOM_Object, containing the created wire.
706 # @ref tui_sketcher_page "Example"
707 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
708 # Example: see GEOM_TestAll.py
709 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
710 RaiseIfFailed("MakeSketcher", self.CurvesOp)
713 ## Create a sketcher (wire or face), following the textual description,
714 # passed through <VAR>theCommand</VAR> argument. \n
715 # For format of the description string see the previous method.\n
716 # @param theCommand String, defining the sketcher in local
717 # coordinates of the working plane.
718 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
719 # @return New GEOM_Object, containing the created wire.
721 # @ref tui_sketcher_page "Example"
722 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
723 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
724 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
730 ## @addtogroup l3_3d_primitives
733 ## Create a box by coordinates of two opposite vertices.
735 # @ref tui_creation_box "Example"
736 def MakeBox(self,x1,y1,z1,x2,y2,z2):
737 # Example: see GEOM_TestAll.py
738 pnt1 = self.MakeVertex(x1,y1,z1)
739 pnt2 = self.MakeVertex(x2,y2,z2)
740 return self.MakeBoxTwoPnt(pnt1,pnt2)
742 ## Create a box with specified dimensions along the coordinate axes
743 # and with edges, parallel to the coordinate axes.
744 # Center of the box will be at point (DX/2, DY/2, DZ/2).
745 # @param theDX Length of Box edges, parallel to OX axis.
746 # @param theDY Length of Box edges, parallel to OY axis.
747 # @param theDZ Length of Box edges, parallel to OZ axis.
748 # @return New GEOM_Object, containing the created box.
750 # @ref tui_creation_box "Example"
751 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
752 # Example: see GEOM_TestAll.py
753 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
754 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
755 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
756 anObj.SetParameters(Parameters)
759 ## Create a box with two specified opposite vertices,
760 # and with edges, parallel to the coordinate axes
761 # @param thePnt1 First of two opposite vertices.
762 # @param thePnt2 Second of two opposite vertices.
763 # @return New GEOM_Object, containing the created box.
765 # @ref tui_creation_box "Example"
766 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
767 # Example: see GEOM_TestAll.py
768 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
769 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
772 ## Create a face with specified dimensions along OX-OY coordinate axes,
773 # with edges, parallel to this coordinate axes.
774 # @param theH height of Face.
775 # @param theW width of Face.
776 # @param theOrientation orientation belong axis OXY OYZ OZX
777 # @return New GEOM_Object, containing the created face.
779 # @ref tui_creation_face "Example"
780 def MakeFaceHW(self,theH, theW, theOrientation):
781 # Example: see GEOM_TestAll.py
782 theH,theW,Parameters = ParseParameters(theH, theW)
783 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
784 RaiseIfFailed("MakeFaceHW", self.PrimOp)
785 anObj.SetParameters(Parameters)
788 ## Create a face from another plane and two sizes,
789 # vertical size and horisontal size.
790 # @param theObj Normale vector to the creating face or
792 # @param theH Height (vertical size).
793 # @param theW Width (horisontal size).
794 # @return New GEOM_Object, containing the created face.
796 # @ref tui_creation_face "Example"
797 def MakeFaceObjHW(self, theObj, theH, theW):
798 # Example: see GEOM_TestAll.py
799 theH,theW,Parameters = ParseParameters(theH, theW)
800 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
801 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
802 anObj.SetParameters(Parameters)
805 ## Create a disk with given center, normal vector and radius.
806 # @param thePnt Disk center.
807 # @param theVec Vector, normal to the plane of the disk.
808 # @param theR Disk radius.
809 # @return New GEOM_Object, containing the created disk.
811 # @ref tui_creation_disk "Example"
812 def MakeDiskPntVecR(self,thePnt, theVec, theR):
813 # Example: see GEOM_TestAll.py
814 theR,Parameters = ParseParameters(theR)
815 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
816 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
817 anObj.SetParameters(Parameters)
820 ## Create a disk, passing through three given points
821 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
822 # @return New GEOM_Object, containing the created disk.
824 # @ref tui_creation_disk "Example"
825 def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3):
826 # Example: see GEOM_TestAll.py
827 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
828 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
831 ## Create a disk with specified dimensions along OX-OY coordinate axes.
832 # @param theR Radius of Face.
833 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
834 # @return New GEOM_Object, containing the created disk.
836 # @ref tui_creation_face "Example"
837 def MakeDiskR(self,theR, theOrientation):
838 # Example: see GEOM_TestAll.py
839 theR,Parameters = ParseParameters(theR)
840 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
841 RaiseIfFailed("MakeDiskR", self.PrimOp)
842 anObj.SetParameters(Parameters)
845 ## Create a cylinder with given base point, axis, radius and height.
846 # @param thePnt Central point of cylinder base.
847 # @param theAxis Cylinder axis.
848 # @param theR Cylinder radius.
849 # @param theH Cylinder height.
850 # @return New GEOM_Object, containing the created cylinder.
852 # @ref tui_creation_cylinder "Example"
853 def MakeCylinder(self,thePnt, theAxis, theR, theH):
854 # Example: see GEOM_TestAll.py
855 theR,theH,Parameters = ParseParameters(theR, theH)
856 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
857 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
858 anObj.SetParameters(Parameters)
861 ## Create a cylinder with given radius and height at
862 # the origin of coordinate system. Axis of the cylinder
863 # will be collinear to the OZ axis of the coordinate system.
864 # @param theR Cylinder radius.
865 # @param theH Cylinder height.
866 # @return New GEOM_Object, containing the created cylinder.
868 # @ref tui_creation_cylinder "Example"
869 def MakeCylinderRH(self,theR, theH):
870 # Example: see GEOM_TestAll.py
871 theR,theH,Parameters = ParseParameters(theR, theH)
872 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
873 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
874 anObj.SetParameters(Parameters)
877 ## Create a sphere with given center and radius.
878 # @param thePnt Sphere center.
879 # @param theR Sphere radius.
880 # @return New GEOM_Object, containing the created sphere.
882 # @ref tui_creation_sphere "Example"
883 def MakeSpherePntR(self, thePnt, theR):
884 # Example: see GEOM_TestAll.py
885 theR,Parameters = ParseParameters(theR)
886 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
887 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
888 anObj.SetParameters(Parameters)
891 ## Create a sphere with given center and radius.
892 # @param x,y,z Coordinates of sphere center.
893 # @param theR Sphere radius.
894 # @return New GEOM_Object, containing the created sphere.
896 # @ref tui_creation_sphere "Example"
897 def MakeSphere(self, x, y, z, theR):
898 # Example: see GEOM_TestAll.py
899 point = self.MakeVertex(x, y, z)
900 anObj = self.MakeSpherePntR(point, theR)
903 ## Create a sphere with given radius at the origin of coordinate system.
904 # @param theR Sphere radius.
905 # @return New GEOM_Object, containing the created sphere.
907 # @ref tui_creation_sphere "Example"
908 def MakeSphereR(self, theR):
909 # Example: see GEOM_TestAll.py
910 theR,Parameters = ParseParameters(theR)
911 anObj = self.PrimOp.MakeSphereR(theR)
912 RaiseIfFailed("MakeSphereR", self.PrimOp)
913 anObj.SetParameters(Parameters)
916 ## Create a cone with given base point, axis, height and radiuses.
917 # @param thePnt Central point of the first cone base.
918 # @param theAxis Cone axis.
919 # @param theR1 Radius of the first cone base.
920 # @param theR2 Radius of the second cone base.
921 # \note If both radiuses are non-zero, the cone will be truncated.
922 # \note If the radiuses are equal, a cylinder will be created instead.
923 # @param theH Cone height.
924 # @return New GEOM_Object, containing the created cone.
926 # @ref tui_creation_cone "Example"
927 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
928 # Example: see GEOM_TestAll.py
929 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
930 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
931 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
932 anObj.SetParameters(Parameters)
935 ## Create a cone with given height and radiuses at
936 # the origin of coordinate system. Axis of the cone will
937 # be collinear to the OZ axis of the coordinate system.
938 # @param theR1 Radius of the first cone base.
939 # @param theR2 Radius of the second cone base.
940 # \note If both radiuses are non-zero, the cone will be truncated.
941 # \note If the radiuses are equal, a cylinder will be created instead.
942 # @param theH Cone height.
943 # @return New GEOM_Object, containing the created cone.
945 # @ref tui_creation_cone "Example"
946 def MakeConeR1R2H(self,theR1, theR2, theH):
947 # Example: see GEOM_TestAll.py
948 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
949 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
950 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
951 anObj.SetParameters(Parameters)
954 ## Create a torus with given center, normal vector and radiuses.
955 # @param thePnt Torus central point.
956 # @param theVec Torus axis of symmetry.
957 # @param theRMajor Torus major radius.
958 # @param theRMinor Torus minor radius.
959 # @return New GEOM_Object, containing the created torus.
961 # @ref tui_creation_torus "Example"
962 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
963 # Example: see GEOM_TestAll.py
964 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
965 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
966 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
967 anObj.SetParameters(Parameters)
970 ## Create a torus with given radiuses at the origin of coordinate system.
971 # @param theRMajor Torus major radius.
972 # @param theRMinor Torus minor radius.
973 # @return New GEOM_Object, containing the created torus.
975 # @ref tui_creation_torus "Example"
976 def MakeTorusRR(self, theRMajor, theRMinor):
977 # Example: see GEOM_TestAll.py
978 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
979 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
980 RaiseIfFailed("MakeTorusRR", self.PrimOp)
981 anObj.SetParameters(Parameters)
984 # end of l3_3d_primitives
987 ## @addtogroup l3_complex
990 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
991 # @param theBase Base shape to be extruded.
992 # @param thePoint1 First end of extrusion vector.
993 # @param thePoint2 Second end of extrusion vector.
994 # @return New GEOM_Object, containing the created prism.
996 # @ref tui_creation_prism "Example"
997 def MakePrism(self, theBase, thePoint1, thePoint2):
998 # Example: see GEOM_TestAll.py
999 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
1000 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1003 ## Create a shape by extrusion of the base shape along the vector,
1004 # i.e. all the space, transfixed by the base shape during its translation
1005 # along the vector on the given distance.
1006 # @param theBase Base shape to be extruded.
1007 # @param theVec Direction of extrusion.
1008 # @param theH Prism dimension along theVec.
1009 # @return New GEOM_Object, containing the created prism.
1011 # @ref tui_creation_prism "Example"
1012 def MakePrismVecH(self, theBase, theVec, theH):
1013 # Example: see GEOM_TestAll.py
1014 theH,Parameters = ParseParameters(theH)
1015 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
1016 RaiseIfFailed("MakePrismVecH", self.PrimOp)
1017 anObj.SetParameters(Parameters)
1020 ## Create a shape by extrusion of the base shape along the vector,
1021 # i.e. all the space, transfixed by the base shape during its translation
1022 # along the vector on the given distance in 2 Ways (forward/backward) .
1023 # @param theBase Base shape to be extruded.
1024 # @param theVec Direction of extrusion.
1025 # @param theH Prism dimension along theVec in forward direction.
1026 # @return New GEOM_Object, containing the created prism.
1028 # @ref tui_creation_prism "Example"
1029 def MakePrismVecH2Ways(self, theBase, theVec, theH):
1030 # Example: see GEOM_TestAll.py
1031 theH,Parameters = ParseParameters(theH)
1032 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
1033 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
1034 anObj.SetParameters(Parameters)
1037 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1038 # @param theBase Base shape to be extruded.
1039 # @param theDX, theDY, theDZ Directions of extrusion.
1040 # @return New GEOM_Object, containing the created prism.
1042 # @ref tui_creation_prism "Example"
1043 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ):
1044 # Example: see GEOM_TestAll.py
1045 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1046 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
1047 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
1048 anObj.SetParameters(Parameters)
1051 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1052 # i.e. all the space, transfixed by the base shape during its translation
1053 # along the vector on the given distance in 2 Ways (forward/backward) .
1054 # @param theBase Base shape to be extruded.
1055 # @param theDX, theDY, theDZ Directions of extrusion.
1056 # @return New GEOM_Object, containing the created prism.
1058 # @ref tui_creation_prism "Example"
1059 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
1060 # Example: see GEOM_TestAll.py
1061 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1062 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
1063 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
1064 anObj.SetParameters(Parameters)
1067 ## Create a shape by revolution of the base shape around the axis
1068 # on the given angle, i.e. all the space, transfixed by the base
1069 # shape during its rotation around the axis on the given angle.
1070 # @param theBase Base shape to be rotated.
1071 # @param theAxis Rotation axis.
1072 # @param theAngle Rotation angle in radians.
1073 # @return New GEOM_Object, containing the created revolution.
1075 # @ref tui_creation_revolution "Example"
1076 def MakeRevolution(self, theBase, theAxis, theAngle):
1077 # Example: see GEOM_TestAll.py
1078 theAngle,Parameters = ParseParameters(theAngle)
1079 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
1080 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
1081 anObj.SetParameters(Parameters)
1084 ## The Same Revolution but in both ways forward&backward.
1085 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
1086 theAngle,Parameters = ParseParameters(theAngle)
1087 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
1088 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
1089 anObj.SetParameters(Parameters)
1092 ## Create a filling from the given compound of contours.
1093 # @param theShape the compound of contours
1094 # @param theMinDeg a minimal degree of BSpline surface to create
1095 # @param theMaxDeg a maximal degree of BSpline surface to create
1096 # @param theTol2D a 2d tolerance to be reached
1097 # @param theTol3D a 3d tolerance to be reached
1098 # @param theNbIter a number of iteration of approximation algorithm
1099 # @param isApprox if True, BSpline curves are generated in the process
1100 # of surface construction. By default it is False, that means
1101 # the surface is created using Besier curves. The usage of
1102 # Approximation makes the algorithm work slower, but allows
1103 # building the surface for rather complex cases
1104 # @return New GEOM_Object, containing the created filling surface.
1106 # @ref tui_creation_filling "Example"
1107 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
1108 # Example: see GEOM_TestAll.py
1109 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg,
1110 theTol2D, theTol3D, theNbIter)
1111 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
1112 theTol2D, theTol3D, theNbIter, isApprox)
1113 RaiseIfFailed("MakeFilling", self.PrimOp)
1114 anObj.SetParameters(Parameters)
1117 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
1118 # @param theSeqSections - set of specified sections.
1119 # @param theModeSolid - mode defining building solid or shell
1120 # @param thePreci - precision 3D used for smoothing by default 1.e-6
1121 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
1122 # @return New GEOM_Object, containing the created shell or solid.
1124 # @ref swig_todo "Example"
1125 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
1126 # Example: see GEOM_TestAll.py
1127 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
1128 RaiseIfFailed("MakeThruSections", self.PrimOp)
1131 ## Create a shape by extrusion of the base shape along
1132 # the path shape. The path shape can be a wire or an edge.
1133 # @param theBase Base shape to be extruded.
1134 # @param thePath Path shape to extrude the base shape along it.
1135 # @return New GEOM_Object, containing the created pipe.
1137 # @ref tui_creation_pipe "Example"
1138 def MakePipe(self,theBase, thePath):
1139 # Example: see GEOM_TestAll.py
1140 anObj = self.PrimOp.MakePipe(theBase, thePath)
1141 RaiseIfFailed("MakePipe", self.PrimOp)
1144 ## Create a shape by extrusion of the profile shape along
1145 # the path shape. The path shape can be a wire or an edge.
1146 # the several profiles can be specified in the several locations of path.
1147 # @param theSeqBases - list of Bases shape to be extruded.
1148 # @param theLocations - list of locations on the path corresponding
1149 # specified list of the Bases shapes. Number of locations
1150 # should be equal to number of bases or list of locations can be empty.
1151 # @param thePath - Path shape to extrude the base shape along it.
1152 # @param theWithContact - the mode defining that the section is translated to be in
1153 # contact with the spine.
1154 # @param theWithCorrection - defining that the section is rotated to be
1155 # orthogonal to the spine tangent in the correspondent point
1156 # @return New GEOM_Object, containing the created pipe.
1158 # @ref tui_creation_pipe_with_diff_sec "Example"
1159 def MakePipeWithDifferentSections(self, theSeqBases,
1160 theLocations, thePath,
1161 theWithContact, theWithCorrection):
1162 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
1163 theLocations, thePath,
1164 theWithContact, theWithCorrection)
1165 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
1168 ## Create a shape by extrusion of the profile shape along
1169 # the path shape. The path shape can be a wire or a edge.
1170 # the several profiles can be specified in the several locations of path.
1171 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
1172 # shell or face. If number of faces in neighbour sections
1173 # aren't coincided result solid between such sections will
1174 # be created using external boundaries of this shells.
1175 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
1176 # This list is used for searching correspondences between
1177 # faces in the sections. Size of this list must be equal
1178 # to size of list of base shapes.
1179 # @param theLocations - list of locations on the path corresponding
1180 # specified list of the Bases shapes. Number of locations
1181 # should be equal to number of bases. First and last
1182 # locations must be coincided with first and last vertexes
1183 # of path correspondingly.
1184 # @param thePath - Path shape to extrude the base shape along it.
1185 # @param theWithContact - the mode defining that the section is translated to be in
1186 # contact with the spine.
1187 # @param theWithCorrection - defining that the section is rotated to be
1188 # orthogonal to the spine tangent in the correspondent point
1189 # @return New GEOM_Object, containing the created solids.
1191 # @ref tui_creation_pipe_with_shell_sec "Example"
1192 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
1193 theLocations, thePath,
1194 theWithContact, theWithCorrection):
1195 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
1196 theLocations, thePath,
1197 theWithContact, theWithCorrection)
1198 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1201 ## Create a shape by extrusion of the profile shape along
1202 # the path shape. This function is used only for debug pipe
1203 # functionality - it is a version of previous function
1204 # (MakePipeWithShellSections(...)) which give a possibility to
1205 # recieve information about creating pipe between each pair of
1206 # sections step by step.
1207 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
1208 theLocations, thePath,
1209 theWithContact, theWithCorrection):
1211 nbsect = len(theSeqBases)
1212 nbsubsect = len(theSeqSubBases)
1213 #print "nbsect = ",nbsect
1214 for i in range(1,nbsect):
1216 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
1217 tmpLocations = [ theLocations[i-1], theLocations[i] ]
1219 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
1220 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
1221 tmpLocations, thePath,
1222 theWithContact, theWithCorrection)
1223 if self.PrimOp.IsDone() == 0:
1224 print "Problems with pipe creation between ",i," and ",i+1," sections"
1225 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1228 print "Pipe between ",i," and ",i+1," sections is OK"
1233 resc = self.MakeCompound(res)
1234 #resc = self.MakeSewing(res, 0.001)
1235 #print "resc: ",resc
1238 ## Create solids between given sections
1239 # @param theSeqBases - list of sections (shell or face).
1240 # @param theLocations - list of corresponding vertexes
1241 # @return New GEOM_Object, containing the created solids.
1243 # @ref tui_creation_pipe_without_path "Example"
1244 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1245 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1246 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1249 ## Create a shape by extrusion of the base shape along
1250 # the path shape with constant bi-normal direction along the given vector.
1251 # The path shape can be a wire or an edge.
1252 # @param theBase Base shape to be extruded.
1253 # @param thePath Path shape to extrude the base shape along it.
1254 # @param theVec Vector defines a constant binormal direction to keep the
1255 # same angle beetween the direction and the sections
1256 # along the sweep surface.
1257 # @return New GEOM_Object, containing the created pipe.
1259 # @ref tui_creation_pipe "Example"
1260 def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
1261 # Example: see GEOM_TestAll.py
1262 anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
1263 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
1269 ## @addtogroup l3_advanced
1272 ## Create a linear edge with specified ends.
1273 # @param thePnt1 Point for the first end of edge.
1274 # @param thePnt2 Point for the second end of edge.
1275 # @return New GEOM_Object, containing the created edge.
1277 # @ref tui_creation_edge "Example"
1278 def MakeEdge(self,thePnt1, thePnt2):
1279 # Example: see GEOM_TestAll.py
1280 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1281 RaiseIfFailed("MakeEdge", self.ShapesOp)
1284 ## Create a wire from the set of edges and wires.
1285 # @param theEdgesAndWires List of edges and/or wires.
1286 # @return New GEOM_Object, containing the created wire.
1288 # @ref tui_creation_wire "Example"
1289 def MakeWire(self,theEdgesAndWires):
1290 # Example: see GEOM_TestAll.py
1291 anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
1292 RaiseIfFailed("MakeWire", self.ShapesOp)
1295 ## Create a face on the given wire.
1296 # @param theWire closed Wire or Edge to build the face on.
1297 # @param isPlanarWanted If TRUE, only planar face will be built.
1298 # If impossible, NULL object will be returned.
1299 # @return New GEOM_Object, containing the created face.
1301 # @ref tui_creation_face "Example"
1302 def MakeFace(self,theWire, isPlanarWanted):
1303 # Example: see GEOM_TestAll.py
1304 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1305 RaiseIfFailed("MakeFace", self.ShapesOp)
1308 ## Create a face on the given wires set.
1309 # @param theWires List of closed wires or edges to build the face on.
1310 # @param isPlanarWanted If TRUE, only planar face will be built.
1311 # If impossible, NULL object will be returned.
1312 # @return New GEOM_Object, containing the created face.
1314 # @ref tui_creation_face "Example"
1315 def MakeFaceWires(self,theWires, isPlanarWanted):
1316 # Example: see GEOM_TestAll.py
1317 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1318 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1321 ## Shortcut to MakeFaceWires()
1323 # @ref tui_creation_face "Example 1"
1324 # \n @ref swig_MakeFaces "Example 2"
1325 def MakeFaces(self,theWires, isPlanarWanted):
1326 # Example: see GEOM_TestOthers.py
1327 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1330 ## Create a shell from the set of faces and shells.
1331 # @param theFacesAndShells List of faces and/or shells.
1332 # @return New GEOM_Object, containing the created shell.
1334 # @ref tui_creation_shell "Example"
1335 def MakeShell(self,theFacesAndShells):
1336 # Example: see GEOM_TestAll.py
1337 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1338 RaiseIfFailed("MakeShell", self.ShapesOp)
1341 ## Create a solid, bounded by the given shells.
1342 # @param theShells Sequence of bounding shells.
1343 # @return New GEOM_Object, containing the created solid.
1345 # @ref tui_creation_solid "Example"
1346 def MakeSolid(self,theShells):
1347 # Example: see GEOM_TestAll.py
1348 anObj = self.ShapesOp.MakeSolidShells(theShells)
1349 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1352 ## Create a compound of the given shapes.
1353 # @param theShapes List of shapes to put in compound.
1354 # @return New GEOM_Object, containing the created compound.
1356 # @ref tui_creation_compound "Example"
1357 def MakeCompound(self,theShapes):
1358 # Example: see GEOM_TestAll.py
1359 anObj = self.ShapesOp.MakeCompound(theShapes)
1360 RaiseIfFailed("MakeCompound", self.ShapesOp)
1363 # end of l3_advanced
1366 ## @addtogroup l2_measure
1369 ## Gives quantity of faces in the given shape.
1370 # @param theShape Shape to count faces of.
1371 # @return Quantity of faces.
1373 # @ref swig_NumberOfFaces "Example"
1374 def NumberOfFaces(self,theShape):
1375 # Example: see GEOM_TestOthers.py
1376 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1377 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1380 ## Gives quantity of edges in the given shape.
1381 # @param theShape Shape to count edges of.
1382 # @return Quantity of edges.
1384 # @ref swig_NumberOfEdges "Example"
1385 def NumberOfEdges(self,theShape):
1386 # Example: see GEOM_TestOthers.py
1387 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1388 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1394 ## @addtogroup l3_healing
1397 ## Reverses an orientation the given shape.
1398 # @param theShape Shape to be reversed.
1399 # @return The reversed copy of theShape.
1401 # @ref swig_ChangeOrientation "Example"
1402 def ChangeOrientation(self,theShape):
1403 # Example: see GEOM_TestAll.py
1404 anObj = self.ShapesOp.ChangeOrientation(theShape)
1405 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1408 ## Shortcut to ChangeOrientation()
1410 # @ref swig_OrientationChange "Example"
1411 def OrientationChange(self,theShape):
1412 # Example: see GEOM_TestOthers.py
1413 anObj = self.ChangeOrientation(theShape)
1419 ## @addtogroup l4_obtain
1422 ## Retrieve all free faces from the given shape.
1423 # Free face is a face, which is not shared between two shells of the shape.
1424 # @param theShape Shape to find free faces in.
1425 # @return List of IDs of all free faces, contained in theShape.
1427 # @ref tui_measurement_tools_page "Example"
1428 def GetFreeFacesIDs(self,theShape):
1429 # Example: see GEOM_TestOthers.py
1430 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1431 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1434 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1435 # @param theShape1 Shape to find sub-shapes in.
1436 # @param theShape2 Shape to find shared sub-shapes with.
1437 # @param theShapeType Type of sub-shapes to be retrieved.
1438 # @return List of sub-shapes of theShape1, shared with theShape2.
1440 # @ref swig_GetSharedShapes "Example"
1441 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1442 # Example: see GEOM_TestOthers.py
1443 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1444 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1447 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1448 # situated relatively the specified plane by the certain way,
1449 # defined through <VAR>theState</VAR> parameter.
1450 # @param theShape Shape to find sub-shapes of.
1451 # @param theShapeType Type of sub-shapes to be retrieved.
1452 # @param theAx1 Vector (or line, or linear edge), specifying normal
1453 # direction and location of the plane to find shapes on.
1454 # @param theState The state of the subshapes to find. It can be one of
1455 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1456 # @return List of all found sub-shapes.
1458 # @ref swig_GetShapesOnPlane "Example"
1459 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1460 # Example: see GEOM_TestOthers.py
1461 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1462 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1465 ## Works like the above method, but returns list of sub-shapes indices
1467 # @ref swig_GetShapesOnPlaneIDs "Example"
1468 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1469 # Example: see GEOM_TestOthers.py
1470 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1471 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1474 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1475 # situated relatively the specified plane by the certain way,
1476 # defined through <VAR>theState</VAR> parameter.
1477 # @param theShape Shape to find sub-shapes of.
1478 # @param theShapeType Type of sub-shapes to be retrieved.
1479 # @param theAx1 Vector (or line, or linear edge), specifying normal
1480 # direction of the plane to find shapes on.
1481 # @param thePnt Point specifying location of the plane to find shapes on.
1482 # @param theState The state of the subshapes to find. It can be one of
1483 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1484 # @return List of all found sub-shapes.
1486 # @ref swig_GetShapesOnPlaneWithLocation "Example"
1487 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1488 # Example: see GEOM_TestOthers.py
1489 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1490 theAx1, thePnt, theState)
1491 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1494 ## Works like the above method, but returns list of sub-shapes indices
1496 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
1497 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1498 # Example: see GEOM_TestOthers.py
1499 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1500 theAx1, thePnt, theState)
1501 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1504 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1505 # the specified cylinder by the certain way, defined through \a theState parameter.
1506 # @param theShape Shape to find sub-shapes of.
1507 # @param theShapeType Type of sub-shapes to be retrieved.
1508 # @param theAxis Vector (or line, or linear edge), specifying
1509 # axis of the cylinder to find shapes on.
1510 # @param theRadius Radius of the cylinder to find shapes on.
1511 # @param theState The state of the subshapes to find. It can be one of
1512 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1513 # @return List of all found sub-shapes.
1515 # @ref swig_GetShapesOnCylinder "Example"
1516 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1517 # Example: see GEOM_TestOthers.py
1518 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1519 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1522 ## Works like the above method, but returns list of sub-shapes indices
1524 # @ref swig_GetShapesOnCylinderIDs "Example"
1525 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1526 # Example: see GEOM_TestOthers.py
1527 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1528 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1531 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1532 # the specified sphere by the certain way, defined through \a theState parameter.
1533 # @param theShape Shape to find sub-shapes of.
1534 # @param theShapeType Type of sub-shapes to be retrieved.
1535 # @param theCenter Point, specifying center of the sphere to find shapes on.
1536 # @param theRadius Radius of the sphere to find shapes on.
1537 # @param theState The state of the subshapes to find. It can be one of
1538 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1539 # @return List of all found sub-shapes.
1541 # @ref swig_GetShapesOnSphere "Example"
1542 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1543 # Example: see GEOM_TestOthers.py
1544 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1545 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1548 ## Works like the above method, but returns list of sub-shapes indices
1550 # @ref swig_GetShapesOnSphereIDs "Example"
1551 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1552 # Example: see GEOM_TestOthers.py
1553 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1554 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1557 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1558 # the specified quadrangle by the certain way, defined through \a theState parameter.
1559 # @param theShape Shape to find sub-shapes of.
1560 # @param theShapeType Type of sub-shapes to be retrieved.
1561 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1562 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1563 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1564 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1565 # @param theState The state of the subshapes to find. It can be one of
1566 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1567 # @return List of all found sub-shapes.
1569 # @ref swig_GetShapesOnQuadrangle "Example"
1570 def GetShapesOnQuadrangle(self, theShape, theShapeType,
1571 theTopLeftPoint, theTopRigthPoint,
1572 theBottomLeftPoint, theBottomRigthPoint, theState):
1573 # Example: see GEOM_TestOthers.py
1574 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
1575 theTopLeftPoint, theTopRigthPoint,
1576 theBottomLeftPoint, theBottomRigthPoint, theState)
1577 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
1580 ## Works like the above method, but returns list of sub-shapes indices
1582 # @ref swig_GetShapesOnQuadrangleIDs "Example"
1583 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
1584 theTopLeftPoint, theTopRigthPoint,
1585 theBottomLeftPoint, theBottomRigthPoint, theState):
1586 # Example: see GEOM_TestOthers.py
1587 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
1588 theTopLeftPoint, theTopRigthPoint,
1589 theBottomLeftPoint, theBottomRigthPoint, theState)
1590 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
1593 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1594 # the specified \a theBox by the certain way, defined through \a theState parameter.
1595 # @param theBox Shape for relative comparing.
1596 # @param theShape Shape to find sub-shapes of.
1597 # @param theShapeType Type of sub-shapes to be retrieved.
1598 # @param theState The state of the subshapes to find. It can be one of
1599 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1600 # @return List of all found sub-shapes.
1602 # @ref swig_GetShapesOnBox "Example"
1603 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
1604 # Example: see GEOM_TestOthers.py
1605 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
1606 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
1609 ## Works like the above method, but returns list of sub-shapes indices
1611 # @ref swig_GetShapesOnBoxIDs "Example"
1612 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
1613 # Example: see GEOM_TestOthers.py
1614 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
1615 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
1618 ## Find in \a theShape all sub-shapes of type \a theShapeType,
1619 # situated relatively the specified \a theCheckShape by the
1620 # certain way, defined through \a theState parameter.
1621 # @param theCheckShape Shape for relative comparing.
1622 # @param theShape Shape to find sub-shapes of.
1623 # @param theShapeType Type of sub-shapes to be retrieved.
1624 # @param theState The state of the subshapes to find. It can be one of
1625 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1626 # @return List of all found sub-shapes.
1628 # @ref swig_GetShapesOnShape "Example"
1629 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
1630 # Example: see GEOM_TestOthers.py
1631 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
1632 theShapeType, theState)
1633 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
1636 ## Works like the above method, but returns result as compound
1638 # @ref swig_GetShapesOnShapeAsCompound "Example"
1639 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
1640 # Example: see GEOM_TestOthers.py
1641 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
1642 theShapeType, theState)
1643 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
1646 ## Works like the above method, but returns list of sub-shapes indices
1648 # @ref swig_GetShapesOnShapeIDs "Example"
1649 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
1650 # Example: see GEOM_TestOthers.py
1651 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
1652 theShapeType, theState)
1653 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
1656 ## Get sub-shape(s) of theShapeWhere, which are
1657 # coincident with \a theShapeWhat or could be a part of it.
1658 # @param theShapeWhere Shape to find sub-shapes of.
1659 # @param theShapeWhat Shape, specifying what to find.
1660 # @return Group of all found sub-shapes or a single found sub-shape.
1662 # @ref swig_GetInPlace "Example"
1663 def GetInPlace(self,theShapeWhere, theShapeWhat):
1664 # Example: see GEOM_TestOthers.py
1665 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
1666 RaiseIfFailed("GetInPlace", self.ShapesOp)
1669 ## Get sub-shape(s) of \a theShapeWhere, which are
1670 # coincident with \a theShapeWhat or could be a part of it.
1672 # Implementation of this method is based on a saved history of an operation,
1673 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
1674 # arguments (an argument shape or a sub-shape of an argument shape).
1675 # The operation could be the Partition or one of boolean operations,
1676 # performed on simple shapes (not on compounds).
1678 # @param theShapeWhere Shape to find sub-shapes of.
1679 # @param theShapeWhat Shape, specifying what to find (must be in the
1680 # building history of the ShapeWhere).
1681 # @return Group of all found sub-shapes or a single found sub-shape.
1683 # @ref swig_GetInPlace "Example"
1684 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
1685 # Example: see GEOM_TestOthers.py
1686 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
1687 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
1690 ## Get sub-shape of theShapeWhere, which is
1691 # equal to \a theShapeWhat.
1692 # @param theShapeWhere Shape to find sub-shape of.
1693 # @param theShapeWhat Shape, specifying what to find.
1694 # @return New GEOM_Object for found sub-shape.
1696 # @ref swig_GetSame "Example"
1697 def GetSame(self,theShapeWhere, theShapeWhat):
1698 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
1699 RaiseIfFailed("GetSame", self.ShapesOp)
1705 ## @addtogroup l4_access
1708 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
1709 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
1711 # @ref swig_all_decompose "Example"
1712 def GetSubShape(self, aShape, ListOfID):
1713 # Example: see GEOM_TestAll.py
1714 anObj = self.AddSubShape(aShape,ListOfID)
1717 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
1719 # @ref swig_all_decompose "Example"
1720 def GetSubShapeID(self, aShape, aSubShape):
1721 # Example: see GEOM_TestAll.py
1722 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
1723 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
1729 ## @addtogroup l4_decompose
1732 ## Explode a shape on subshapes of a given type.
1733 # @param aShape Shape to be exploded.
1734 # @param aType Type of sub-shapes to be retrieved.
1735 # @return List of sub-shapes of type theShapeType, contained in theShape.
1737 # @ref swig_all_decompose "Example"
1738 def SubShapeAll(self, aShape, aType):
1739 # Example: see GEOM_TestAll.py
1740 ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
1741 RaiseIfFailed("MakeExplode", self.ShapesOp)
1744 ## Explode a shape on subshapes of a given type.
1745 # @param aShape Shape to be exploded.
1746 # @param aType Type of sub-shapes to be retrieved.
1747 # @return List of IDs of sub-shapes.
1749 # @ref swig_all_decompose "Example"
1750 def SubShapeAllIDs(self, aShape, aType):
1751 ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
1752 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1755 ## Explode a shape on subshapes of a given type.
1756 # Sub-shapes will be sorted by coordinates of their gravity centers.
1757 # @param aShape Shape to be exploded.
1758 # @param aType Type of sub-shapes to be retrieved.
1759 # @return List of sub-shapes of type theShapeType, contained in theShape.
1761 # @ref swig_SubShapeAllSorted "Example"
1762 def SubShapeAllSorted(self, aShape, aType):
1763 # Example: see GEOM_TestAll.py
1764 ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
1765 RaiseIfFailed("MakeExplode", self.ShapesOp)
1768 ## Explode a shape on subshapes of a given type.
1769 # Sub-shapes will be sorted by coordinates of their gravity centers.
1770 # @param aShape Shape to be exploded.
1771 # @param aType Type of sub-shapes to be retrieved.
1772 # @return List of IDs of sub-shapes.
1774 # @ref swig_all_decompose "Example"
1775 def SubShapeAllSortedIDs(self, aShape, aType):
1776 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
1777 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1780 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1781 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
1782 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1784 # @ref swig_all_decompose "Example"
1785 def SubShape(self, aShape, aType, ListOfInd):
1786 # Example: see GEOM_TestAll.py
1788 AllShapeList = self.SubShapeAll(aShape, aType)
1789 for ind in ListOfInd:
1790 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1791 anObj = self.GetSubShape(aShape, ListOfIDs)
1794 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1795 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
1796 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1798 # @ref swig_all_decompose "Example"
1799 def SubShapeSorted(self,aShape, aType, ListOfInd):
1800 # Example: see GEOM_TestAll.py
1802 AllShapeList = self.SubShapeAllSorted(aShape, aType)
1803 for ind in ListOfInd:
1804 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1805 anObj = self.GetSubShape(aShape, ListOfIDs)
1808 # end of l4_decompose
1811 ## @addtogroup l3_healing
1814 ## Apply a sequence of Shape Healing operators to the given object.
1815 # @param theShape Shape to be processed.
1816 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1817 # @param theParameters List of names of parameters
1818 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1819 # @param theValues List of values of parameters, in the same order
1820 # as parameters are listed in <VAR>theParameters</VAR> list.
1821 # @return New GEOM_Object, containing processed shape.
1823 # @ref tui_shape_processing "Example"
1824 def ProcessShape(self,theShape, theOperators, theParameters, theValues):
1825 # Example: see GEOM_TestHealing.py
1826 theValues,Parameters = ParseList(theValues)
1827 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1828 RaiseIfFailed("ProcessShape", self.HealOp)
1829 for string in (theOperators + theParameters):
1830 Parameters = ":" + Parameters
1832 anObj.SetParameters(Parameters)
1835 ## Remove faces from the given object (shape).
1836 # @param theObject Shape to be processed.
1837 # @param theFaces Indices of faces to be removed, if EMPTY then the method
1838 # removes ALL faces of the given object.
1839 # @return New GEOM_Object, containing processed shape.
1841 # @ref tui_suppress_faces "Example"
1842 def SuppressFaces(self,theObject, theFaces):
1843 # Example: see GEOM_TestHealing.py
1844 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
1845 RaiseIfFailed("SuppressFaces", self.HealOp)
1848 ## Sewing of some shapes into single shape.
1850 # @ref tui_sewing "Example"
1851 def MakeSewing(self, ListShape, theTolerance):
1852 # Example: see GEOM_TestHealing.py
1853 comp = self.MakeCompound(ListShape)
1854 anObj = self.Sew(comp, theTolerance)
1857 ## Sewing of the given object.
1858 # @param theObject Shape to be processed.
1859 # @param theTolerance Required tolerance value.
1860 # @return New GEOM_Object, containing processed shape.
1861 def Sew(self, theObject, theTolerance):
1862 # Example: see MakeSewing() above
1863 theTolerance,Parameters = ParseParameters(theTolerance)
1864 anObj = self.HealOp.Sew(theObject, theTolerance)
1865 RaiseIfFailed("Sew", self.HealOp)
1866 anObj.SetParameters(Parameters)
1869 ## Remove internal wires and edges from the given object (face).
1870 # @param theObject Shape to be processed.
1871 # @param theWires Indices of wires to be removed, if EMPTY then the method
1872 # removes ALL internal wires of the given object.
1873 # @return New GEOM_Object, containing processed shape.
1875 # @ref tui_suppress_internal_wires "Example"
1876 def SuppressInternalWires(self,theObject, theWires):
1877 # Example: see GEOM_TestHealing.py
1878 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
1879 RaiseIfFailed("RemoveIntWires", self.HealOp)
1882 ## Remove internal closed contours (holes) from the given object.
1883 # @param theObject Shape to be processed.
1884 # @param theWires Indices of wires to be removed, if EMPTY then the method
1885 # removes ALL internal holes of the given object
1886 # @return New GEOM_Object, containing processed shape.
1888 # @ref tui_suppress_holes "Example"
1889 def SuppressHoles(self,theObject, theWires):
1890 # Example: see GEOM_TestHealing.py
1891 anObj = self.HealOp.FillHoles(theObject, theWires)
1892 RaiseIfFailed("FillHoles", self.HealOp)
1895 ## Close an open wire.
1896 # @param theObject Shape to be processed.
1897 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1898 # if -1, then <VAR>theObject</VAR> itself is a wire.
1899 # @param isCommonVertex If TRUE : closure by creation of a common vertex,
1900 # If FALS : closure by creation of an edge between ends.
1901 # @return New GEOM_Object, containing processed shape.
1903 # @ref tui_close_contour "Example"
1904 def CloseContour(self,theObject, theWires, isCommonVertex):
1905 # Example: see GEOM_TestHealing.py
1906 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
1907 RaiseIfFailed("CloseContour", self.HealOp)
1910 ## Addition of a point to a given edge object.
1911 # @param theObject Shape to be processed.
1912 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
1913 # if -1, then theObject itself is the edge.
1914 # @param theValue Value of parameter on edge or length parameter,
1915 # depending on \a isByParameter.
1916 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1917 # if FALSE : \a theValue is treated as a length parameter [0..1]
1918 # @return New GEOM_Object, containing processed shape.
1920 # @ref tui_add_point_on_edge "Example"
1921 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
1922 # Example: see GEOM_TestHealing.py
1923 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
1924 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1925 RaiseIfFailed("DivideEdge", self.HealOp)
1926 anObj.SetParameters(Parameters)
1929 ## Change orientation of the given object. Updates given shape.
1930 # @param theObject Shape to be processed.
1932 # @ref swig_todo "Example"
1933 def ChangeOrientationShell(self,theObject):
1934 theObject = self.HealOp.ChangeOrientation(theObject)
1935 RaiseIfFailed("ChangeOrientation", self.HealOp)
1938 ## Change orientation of the given object.
1939 # @param theObject Shape to be processed.
1940 # @return New GEOM_Object, containing processed shape.
1942 # @ref swig_todo "Example"
1943 def ChangeOrientationShellCopy(self,theObject):
1944 anObj = self.HealOp.ChangeOrientationCopy(theObject)
1945 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
1948 ## Get a list of wires (wrapped in GEOM_Object-s),
1949 # that constitute a free boundary of the given shape.
1950 # @param theObject Shape to get free boundary of.
1951 # @return [status, theClosedWires, theOpenWires]
1952 # status: FALSE, if an error(s) occured during the method execution.
1953 # theClosedWires: Closed wires on the free boundary of the given shape.
1954 # theOpenWires: Open wires on the free boundary of the given shape.
1956 # @ref tui_measurement_tools_page "Example"
1957 def GetFreeBoundary(self,theObject):
1958 # Example: see GEOM_TestHealing.py
1959 anObj = self.HealOp.GetFreeBoundary(theObject)
1960 RaiseIfFailed("GetFreeBoundary", self.HealOp)
1963 ## Replace coincident faces in theShape by one face.
1964 # @param theShape Initial shape.
1965 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
1966 # @param doKeepNonSolids If FALSE, only solids will present in the result,
1967 # otherwise all initial shapes.
1968 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
1970 # @ref tui_glue_faces "Example"
1971 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
1972 # Example: see GEOM_Spanner.py
1973 theTolerance,Parameters = ParseParameters(theTolerance)
1974 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
1976 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
1977 anObj.SetParameters(Parameters)
1980 ## Find coincident faces in theShape for possible gluing.
1981 # @param theShape Initial shape.
1982 # @param theTolerance Maximum distance between faces,
1983 # which can be considered as coincident.
1986 # @ref swig_todo "Example"
1987 def GetGlueFaces(self, theShape, theTolerance):
1988 # Example: see GEOM_Spanner.py
1989 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
1990 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
1993 ## Replace coincident faces in theShape by one face
1994 # in compliance with given list of faces
1995 # @param theShape Initial shape.
1996 # @param theTolerance Maximum distance between faces,
1997 # which can be considered as coincident.
1998 # @param theFaces List of faces for gluing.
1999 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2000 # otherwise all initial shapes.
2001 # @return New GEOM_Object, containing a copy of theShape
2002 # without some faces.
2004 # @ref swig_todo "Example"
2005 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
2006 # Example: see GEOM_Spanner.py
2007 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
2009 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
2015 ## @addtogroup l3_boolean Boolean Operations
2018 # -----------------------------------------------------------------------------
2019 # Boolean (Common, Cut, Fuse, Section)
2020 # -----------------------------------------------------------------------------
2022 ## Perform one of boolean operations on two given shapes.
2023 # @param theShape1 First argument for boolean operation.
2024 # @param theShape2 Second argument for boolean operation.
2025 # @param theOperation Indicates the operation to be done:
2026 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
2027 # @return New GEOM_Object, containing the result shape.
2029 # @ref tui_fuse "Example"
2030 def MakeBoolean(self,theShape1, theShape2, theOperation):
2031 # Example: see GEOM_TestAll.py
2032 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
2033 RaiseIfFailed("MakeBoolean", self.BoolOp)
2036 ## Shortcut to MakeBoolean(s1, s2, 1)
2038 # @ref tui_common "Example 1"
2039 # \n @ref swig_MakeCommon "Example 2"
2040 def MakeCommon(self, s1, s2):
2041 # Example: see GEOM_TestOthers.py
2042 return self.MakeBoolean(s1, s2, 1)
2044 ## Shortcut to MakeBoolean(s1, s2, 2)
2046 # @ref tui_cut "Example 1"
2047 # \n @ref swig_MakeCommon "Example 2"
2048 def MakeCut(self, s1, s2):
2049 # Example: see GEOM_TestOthers.py
2050 return self.MakeBoolean(s1, s2, 2)
2052 ## Shortcut to MakeBoolean(s1, s2, 3)
2054 # @ref tui_fuse "Example 1"
2055 # \n @ref swig_MakeCommon "Example 2"
2056 def MakeFuse(self, s1, s2):
2057 # Example: see GEOM_TestOthers.py
2058 return self.MakeBoolean(s1, s2, 3)
2060 ## Shortcut to MakeBoolean(s1, s2, 4)
2062 # @ref tui_section "Example 1"
2063 # \n @ref swig_MakeCommon "Example 2"
2064 def MakeSection(self, s1, s2):
2065 # Example: see GEOM_TestOthers.py
2066 return self.MakeBoolean(s1, s2, 4)
2071 ## @addtogroup l3_basic_op
2074 ## Perform partition operation.
2075 # @param ListShapes Shapes to be intersected.
2076 # @param ListTools Shapes to intersect theShapes.
2077 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
2078 # in order to avoid possible intersection between shapes from
2080 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
2081 # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
2082 # type <= Limit are kept in the result,
2083 # else - shapes with type > Limit are kept
2084 # also (if they exist)
2086 # After implementation new version of PartitionAlgo (October 2006)
2087 # other parameters are ignored by current functionality. They are kept
2088 # in this function only for support old versions.
2089 # Ignored parameters:
2090 # @param ListKeepInside Shapes, outside which the results will be deleted.
2091 # Each shape from theKeepInside must belong to theShapes also.
2092 # @param ListRemoveInside Shapes, inside which the results will be deleted.
2093 # Each shape from theRemoveInside must belong to theShapes also.
2094 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
2095 # @param ListMaterials Material indices for each shape. Make sence,
2096 # only if theRemoveWebs is TRUE.
2098 # @return New GEOM_Object, containing the result shapes.
2100 # @ref tui_partition "Example"
2101 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2102 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
2103 KeepNonlimitShapes=0):
2104 # Example: see GEOM_TestAll.py
2105 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
2106 ListKeepInside, ListRemoveInside,
2107 Limit, RemoveWebs, ListMaterials,
2108 KeepNonlimitShapes);
2109 RaiseIfFailed("MakePartition", self.BoolOp)
2112 ## Perform partition operation.
2113 # This method may be useful if it is needed to make a partition for
2114 # compound contains nonintersected shapes. Performance will be better
2115 # since intersection between shapes from compound is not performed.
2117 # Description of all parameters as in previous method MakePartition()
2119 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
2120 # have to consist of nonintersecting shapes.
2122 # @return New GEOM_Object, containing the result shapes.
2124 # @ref swig_todo "Example"
2125 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
2126 ListKeepInside=[], ListRemoveInside=[],
2127 Limit=ShapeType["SHAPE"], RemoveWebs=0,
2128 ListMaterials=[], KeepNonlimitShapes=0):
2129 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
2130 ListKeepInside, ListRemoveInside,
2131 Limit, RemoveWebs, ListMaterials,
2132 KeepNonlimitShapes);
2133 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
2136 ## Shortcut to MakePartition()
2138 # @ref tui_partition "Example 1"
2139 # \n @ref swig_Partition "Example 2"
2140 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2141 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
2142 KeepNonlimitShapes=0):
2143 # Example: see GEOM_TestOthers.py
2144 anObj = self.MakePartition(ListShapes, ListTools,
2145 ListKeepInside, ListRemoveInside,
2146 Limit, RemoveWebs, ListMaterials,
2147 KeepNonlimitShapes);
2150 ## Perform partition of the Shape with the Plane
2151 # @param theShape Shape to be intersected.
2152 # @param thePlane Tool shape, to intersect theShape.
2153 # @return New GEOM_Object, containing the result shape.
2155 # @ref tui_partition "Example"
2156 def MakeHalfPartition(self,theShape, thePlane):
2157 # Example: see GEOM_TestAll.py
2158 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
2159 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
2162 # end of l3_basic_op
2165 ## @addtogroup l3_transform
2168 ## Translate the given object along the vector, specified
2169 # by its end points, creating its copy before the translation.
2170 # @param theObject The object to be translated.
2171 # @param thePoint1 Start point of translation vector.
2172 # @param thePoint2 End point of translation vector.
2173 # @return New GEOM_Object, containing the translated object.
2175 # @ref tui_translation "Example 1"
2176 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
2177 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
2178 # Example: see GEOM_TestAll.py
2179 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
2180 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
2183 ## Translate the given object along the vector, specified
2184 # by its components, creating its copy before the translation.
2185 # @param theObject The object to be translated.
2186 # @param theDX,theDY,theDZ Components of translation vector.
2187 # @return New GEOM_Object, containing the translated object.
2189 # @ref tui_translation "Example"
2190 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
2191 # Example: see GEOM_TestAll.py
2192 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2193 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
2194 anObj.SetParameters(Parameters)
2195 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2198 ## Translate the given object along the given vector,
2199 # creating its copy before the translation.
2200 # @param theObject The object to be translated.
2201 # @param theVector The translation vector.
2202 # @return New GEOM_Object, containing the translated object.
2204 # @ref tui_translation "Example"
2205 def MakeTranslationVector(self,theObject, theVector):
2206 # Example: see GEOM_TestAll.py
2207 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
2208 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
2211 ## Translate the given object along the given vector on given distance,
2212 # creating its copy before the translation.
2213 # @param theObject The object to be translated.
2214 # @param theVector The translation vector.
2215 # @param theDistance The translation distance.
2216 # @return New GEOM_Object, containing the translated object.
2218 # @ref tui_translation "Example"
2219 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
2220 # Example: see GEOM_TestAll.py
2221 theDistance,Parameters = ParseParameters(theDistance)
2222 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
2223 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2224 anObj.SetParameters(Parameters)
2227 ## Rotate the given object around the given axis
2228 # on the given angle, creating its copy before the rotatation.
2229 # @param theObject The object to be rotated.
2230 # @param theAxis Rotation axis.
2231 # @param theAngle Rotation angle in radians.
2232 # @return New GEOM_Object, containing the rotated object.
2234 # @ref tui_rotation "Example"
2235 def MakeRotation(self,theObject, theAxis, theAngle):
2236 # Example: see GEOM_TestAll.py
2238 if isinstance(theAngle,str):
2240 theAngle, Parameters = ParseParameters(theAngle)
2242 theAngle = theAngle*math.pi/180.0
2243 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
2244 RaiseIfFailed("RotateCopy", self.TrsfOp)
2245 anObj.SetParameters(Parameters)
2248 ## Rotate given object around vector perpendicular to plane
2249 # containing three points, creating its copy before the rotatation.
2250 # @param theObject The object to be rotated.
2251 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
2252 # containing the three points.
2253 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
2254 # @return New GEOM_Object, containing the rotated object.
2256 # @ref tui_rotation "Example"
2257 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
2258 # Example: see GEOM_TestAll.py
2259 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
2260 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
2263 ## Scale the given object by the factor, creating its copy before the scaling.
2264 # @param theObject The object to be scaled.
2265 # @param thePoint Center point for scaling.
2266 # Passing None for it means scaling relatively the origin of global CS.
2267 # @param theFactor Scaling factor value.
2268 # @return New GEOM_Object, containing the scaled shape.
2270 # @ref tui_scale "Example"
2271 def MakeScaleTransform(self, theObject, thePoint, theFactor):
2272 # Example: see GEOM_TestAll.py
2273 theFactor, Parameters = ParseParameters(theFactor)
2274 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
2275 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
2276 anObj.SetParameters(Parameters)
2279 ## Scale the given object by different factors along coordinate axes,
2280 # creating its copy before the scaling.
2281 # @param theObject The object to be scaled.
2282 # @param thePoint Center point for scaling.
2283 # Passing None for it means scaling relatively the origin of global CS.
2284 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
2285 # @return New GEOM_Object, containing the scaled shape.
2287 # @ref swig_scale "Example"
2288 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
2289 # Example: see GEOM_TestAll.py
2290 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
2291 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
2292 theFactorX, theFactorY, theFactorZ)
2293 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
2294 anObj.SetParameters(Parameters)
2297 ## Create an object, symmetrical
2298 # to the given one relatively the given plane.
2299 # @param theObject The object to be mirrored.
2300 # @param thePlane Plane of symmetry.
2301 # @return New GEOM_Object, containing the mirrored shape.
2303 # @ref tui_mirror "Example"
2304 def MakeMirrorByPlane(self,theObject, thePlane):
2305 # Example: see GEOM_TestAll.py
2306 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
2307 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
2310 ## Create an object, symmetrical
2311 # to the given one relatively the given axis.
2312 # @param theObject The object to be mirrored.
2313 # @param theAxis Axis of symmetry.
2314 # @return New GEOM_Object, containing the mirrored shape.
2316 # @ref tui_mirror "Example"
2317 def MakeMirrorByAxis(self,theObject, theAxis):
2318 # Example: see GEOM_TestAll.py
2319 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
2320 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
2323 ## Create an object, symmetrical
2324 # to the given one relatively the given point.
2325 # @param theObject The object to be mirrored.
2326 # @param thePoint Point of symmetry.
2327 # @return New GEOM_Object, containing the mirrored shape.
2329 # @ref tui_mirror "Example"
2330 def MakeMirrorByPoint(self,theObject, thePoint):
2331 # Example: see GEOM_TestAll.py
2332 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
2333 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
2336 ## Modify the Location of the given object by LCS,
2337 # creating its copy before the setting.
2338 # @param theObject The object to be displaced.
2339 # @param theStartLCS Coordinate system to perform displacement from it.
2340 # If \a theStartLCS is NULL, displacement
2341 # will be performed from global CS.
2342 # If \a theObject itself is used as \a theStartLCS,
2343 # its location will be changed to \a theEndLCS.
2344 # @param theEndLCS Coordinate system to perform displacement to it.
2345 # @return New GEOM_Object, containing the displaced shape.
2347 # @ref tui_modify_location "Example"
2348 def MakePosition(self,theObject, theStartLCS, theEndLCS):
2349 # Example: see GEOM_TestAll.py
2350 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
2351 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
2354 ## Create new object as offset of the given one.
2355 # @param theObject The base object for the offset.
2356 # @param theOffset Offset value.
2357 # @return New GEOM_Object, containing the offset object.
2359 # @ref tui_offset "Example"
2360 def MakeOffset(self,theObject, theOffset):
2361 # Example: see GEOM_TestAll.py
2362 theOffset, Parameters = ParseParameters(theOffset)
2363 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
2364 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
2365 anObj.SetParameters(Parameters)
2368 # -----------------------------------------------------------------------------
2370 # -----------------------------------------------------------------------------
2372 ## Translate the given object along the given vector a given number times
2373 # @param theObject The object to be translated.
2374 # @param theVector Direction of the translation.
2375 # @param theStep Distance to translate on.
2376 # @param theNbTimes Quantity of translations to be done.
2377 # @return New GEOM_Object, containing compound of all
2378 # the shapes, obtained after each translation.
2380 # @ref tui_multi_translation "Example"
2381 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
2382 # Example: see GEOM_TestAll.py
2383 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
2384 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
2385 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
2386 anObj.SetParameters(Parameters)
2389 ## Conseqently apply two specified translations to theObject specified number of times.
2390 # @param theObject The object to be translated.
2391 # @param theVector1 Direction of the first translation.
2392 # @param theStep1 Step of the first translation.
2393 # @param theNbTimes1 Quantity of translations to be done along theVector1.
2394 # @param theVector2 Direction of the second translation.
2395 # @param theStep2 Step of the second translation.
2396 # @param theNbTimes2 Quantity of translations to be done along theVector2.
2397 # @return New GEOM_Object, containing compound of all
2398 # the shapes, obtained after each translation.
2400 # @ref tui_multi_translation "Example"
2401 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
2402 theVector2, theStep2, theNbTimes2):
2403 # Example: see GEOM_TestAll.py
2404 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
2405 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
2406 theVector2, theStep2, theNbTimes2)
2407 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
2408 anObj.SetParameters(Parameters)
2411 ## Rotate the given object around the given axis a given number times.
2412 # Rotation angle will be 2*PI/theNbTimes.
2413 # @param theObject The object to be rotated.
2414 # @param theAxis The rotation axis.
2415 # @param theNbTimes Quantity of rotations to be done.
2416 # @return New GEOM_Object, containing compound of all the
2417 # shapes, obtained after each rotation.
2419 # @ref tui_multi_rotation "Example"
2420 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
2421 # Example: see GEOM_TestAll.py
2422 theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
2423 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
2424 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
2425 anObj.SetParameters(Parameters)
2428 ## Rotate the given object around the
2429 # given axis on the given angle a given number
2430 # times and multi-translate each rotation result.
2431 # Translation direction passes through center of gravity
2432 # of rotated shape and its projection on the rotation axis.
2433 # @param theObject The object to be rotated.
2434 # @param theAxis Rotation axis.
2435 # @param theAngle Rotation angle in graduces.
2436 # @param theNbTimes1 Quantity of rotations to be done.
2437 # @param theStep Translation distance.
2438 # @param theNbTimes2 Quantity of translations to be done.
2439 # @return New GEOM_Object, containing compound of all the
2440 # shapes, obtained after each transformation.
2442 # @ref tui_multi_rotation "Example"
2443 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
2444 # Example: see GEOM_TestAll.py
2445 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
2446 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
2447 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
2448 anObj.SetParameters(Parameters)
2451 ## The same, as MultiRotate1D(), but axis is given by direction and point
2452 # @ref swig_MakeMultiRotation "Example"
2453 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
2454 # Example: see GEOM_TestOthers.py
2455 aVec = self.MakeLine(aPoint,aDir)
2456 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
2459 ## The same, as MultiRotate2D(), but axis is given by direction and point
2460 # @ref swig_MakeMultiRotation "Example"
2461 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
2462 # Example: see GEOM_TestOthers.py
2463 aVec = self.MakeLine(aPoint,aDir)
2464 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
2467 # end of l3_transform
2470 ## @addtogroup l3_local
2473 ## Perform a fillet on all edges of the given shape.
2474 # @param theShape Shape, to perform fillet on.
2475 # @param theR Fillet radius.
2476 # @return New GEOM_Object, containing the result shape.
2478 # @ref tui_fillet "Example 1"
2479 # \n @ref swig_MakeFilletAll "Example 2"
2480 def MakeFilletAll(self,theShape, theR):
2481 # Example: see GEOM_TestOthers.py
2482 theR,Parameters = ParseParameters(theR)
2483 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
2484 RaiseIfFailed("MakeFilletAll", self.LocalOp)
2485 anObj.SetParameters(Parameters)
2488 ## Perform a fillet on the specified edges/faces of the given shape
2489 # @param theShape Shape, to perform fillet on.
2490 # @param theR Fillet radius.
2491 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
2492 # @param theListShapes Global indices of edges/faces to perform fillet on.
2493 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2494 # @return New GEOM_Object, containing the result shape.
2496 # @ref tui_fillet "Example"
2497 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
2498 # Example: see GEOM_TestAll.py
2499 theR,Parameters = ParseParameters(theR)
2501 if theShapeType == ShapeType["EDGE"]:
2502 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
2503 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
2505 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
2506 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
2507 anObj.SetParameters(Parameters)
2510 ## The same that MakeFillet but with two Fillet Radius R1 and R2
2511 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
2512 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
2514 if theShapeType == ShapeType["EDGE"]:
2515 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
2516 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
2518 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
2519 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
2520 anObj.SetParameters(Parameters)
2523 ## Perform a symmetric chamfer on all edges of the given shape.
2524 # @param theShape Shape, to perform chamfer on.
2525 # @param theD Chamfer size along each face.
2526 # @return New GEOM_Object, containing the result shape.
2528 # @ref tui_chamfer "Example 1"
2529 # \n @ref swig_MakeChamferAll "Example 2"
2530 def MakeChamferAll(self,theShape, theD):
2531 # Example: see GEOM_TestOthers.py
2532 theD,Parameters = ParseParameters(theD)
2533 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
2534 RaiseIfFailed("MakeChamferAll", self.LocalOp)
2535 anObj.SetParameters(Parameters)
2538 ## Perform a chamfer on edges, common to the specified faces,
2539 # with distance D1 on the Face1
2540 # @param theShape Shape, to perform chamfer on.
2541 # @param theD1 Chamfer size along \a theFace1.
2542 # @param theD2 Chamfer size along \a theFace2.
2543 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
2544 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2545 # @return New GEOM_Object, containing the result shape.
2547 # @ref tui_chamfer "Example"
2548 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
2549 # Example: see GEOM_TestAll.py
2550 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2551 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
2552 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
2553 anObj.SetParameters(Parameters)
2556 ## The Same that MakeChamferEdge but with params theD is chamfer length and
2557 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2558 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
2560 if isinstance(theAngle,str):
2562 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2564 theAngle = theAngle*math.pi/180.0
2565 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
2566 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
2567 anObj.SetParameters(Parameters)
2570 ## Perform a chamfer on all edges of the specified faces,
2571 # with distance D1 on the first specified face (if several for one edge)
2572 # @param theShape Shape, to perform chamfer on.
2573 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
2574 # connected to the edge, are in \a theFaces, \a theD1
2575 # will be get along face, which is nearer to \a theFaces beginning.
2576 # @param theD2 Chamfer size along another of two faces, connected to the edge.
2577 # @param theFaces Sequence of global indices of faces of \a theShape.
2578 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2579 # @return New GEOM_Object, containing the result shape.
2581 # @ref tui_chamfer "Example"
2582 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
2583 # Example: see GEOM_TestAll.py
2584 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2585 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
2586 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
2587 anObj.SetParameters(Parameters)
2590 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
2591 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2593 # @ref swig_FilletChamfer "Example"
2594 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
2596 if isinstance(theAngle,str):
2598 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2600 theAngle = theAngle*math.pi/180.0
2601 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
2602 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
2603 anObj.SetParameters(Parameters)
2606 ## Perform a chamfer on edges,
2607 # with distance D1 on the first specified face (if several for one edge)
2608 # @param theShape Shape, to perform chamfer on.
2609 # @param theD1,theD2 Chamfer size
2610 # @param theEdges Sequence of edges of \a theShape.
2611 # @return New GEOM_Object, containing the result shape.
2613 # @ref swig_FilletChamfer "Example"
2614 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
2615 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2616 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
2617 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
2618 anObj.SetParameters(Parameters)
2621 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
2622 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2623 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
2625 if isinstance(theAngle,str):
2627 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2629 theAngle = theAngle*math.pi/180.0
2630 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
2631 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
2632 anObj.SetParameters(Parameters)
2635 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
2637 # @ref swig_MakeChamfer "Example"
2638 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
2639 # Example: see GEOM_TestOthers.py
2641 if aShapeType == ShapeType["EDGE"]:
2642 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
2644 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
2650 ## @addtogroup l3_basic_op
2653 ## Perform an Archimde operation on the given shape with given parameters.
2654 # The object presenting the resulting face is returned.
2655 # @param theShape Shape to be put in water.
2656 # @param theWeight Weight og the shape.
2657 # @param theWaterDensity Density of the water.
2658 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
2659 # @return New GEOM_Object, containing a section of \a theShape
2660 # by a plane, corresponding to water level.
2662 # @ref tui_archimede "Example"
2663 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
2664 # Example: see GEOM_TestAll.py
2665 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
2666 theWeight,theWaterDensity,theMeshDeflection)
2667 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
2668 RaiseIfFailed("MakeArchimede", self.LocalOp)
2669 anObj.SetParameters(Parameters)
2672 # end of l3_basic_op
2675 ## @addtogroup l2_measure
2678 ## Get point coordinates
2681 # @ref tui_measurement_tools_page "Example"
2682 def PointCoordinates(self,Point):
2683 # Example: see GEOM_TestMeasures.py
2684 aTuple = self.MeasuOp.PointCoordinates(Point)
2685 RaiseIfFailed("PointCoordinates", self.MeasuOp)
2688 ## Get summarized length of all wires,
2689 # area of surface and volume of the given shape.
2690 # @param theShape Shape to define properties of.
2691 # @return [theLength, theSurfArea, theVolume]
2692 # theLength: Summarized length of all wires of the given shape.
2693 # theSurfArea: Area of surface of the given shape.
2694 # theVolume: Volume of the given shape.
2696 # @ref tui_measurement_tools_page "Example"
2697 def BasicProperties(self,theShape):
2698 # Example: see GEOM_TestMeasures.py
2699 aTuple = self.MeasuOp.GetBasicProperties(theShape)
2700 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
2703 ## Get parameters of bounding box of the given shape
2704 # @param theShape Shape to obtain bounding box of.
2705 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
2706 # Xmin,Xmax: Limits of shape along OX axis.
2707 # Ymin,Ymax: Limits of shape along OY axis.
2708 # Zmin,Zmax: Limits of shape along OZ axis.
2710 # @ref tui_measurement_tools_page "Example"
2711 def BoundingBox(self,theShape):
2712 # Example: see GEOM_TestMeasures.py
2713 aTuple = self.MeasuOp.GetBoundingBox(theShape)
2714 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
2717 ## Get inertia matrix and moments of inertia of theShape.
2718 # @param theShape Shape to calculate inertia of.
2719 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
2720 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
2721 # Ix,Iy,Iz: Moments of inertia of the given shape.
2723 # @ref tui_measurement_tools_page "Example"
2724 def Inertia(self,theShape):
2725 # Example: see GEOM_TestMeasures.py
2726 aTuple = self.MeasuOp.GetInertia(theShape)
2727 RaiseIfFailed("GetInertia", self.MeasuOp)
2730 ## Get minimal distance between the given shapes.
2731 # @param theShape1,theShape2 Shapes to find minimal distance between.
2732 # @return Value of the minimal distance between the given shapes.
2734 # @ref tui_measurement_tools_page "Example"
2735 def MinDistance(self, theShape1, theShape2):
2736 # Example: see GEOM_TestMeasures.py
2737 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2738 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2741 ## Get minimal distance between the given shapes.
2742 # @param theShape1,theShape2 Shapes to find minimal distance between.
2743 # @return Value of the minimal distance between the given shapes.
2745 # @ref swig_all_measure "Example"
2746 def MinDistanceComponents(self, theShape1, theShape2):
2747 # Example: see GEOM_TestMeasures.py
2748 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2749 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2750 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
2753 ## Get angle between the given shapes in degrees.
2754 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2755 # @return Value of the angle between the given shapes in degrees.
2757 # @ref tui_measurement_tools_page "Example"
2758 def GetAngle(self, theShape1, theShape2):
2759 # Example: see GEOM_TestMeasures.py
2760 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
2761 RaiseIfFailed("GetAngle", self.MeasuOp)
2763 ## Get angle between the given shapes in radians.
2764 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2765 # @return Value of the angle between the given shapes in radians.
2767 # @ref tui_measurement_tools_page "Example"
2768 def GetAngleRadians(self, theShape1, theShape2):
2769 # Example: see GEOM_TestMeasures.py
2770 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
2771 RaiseIfFailed("GetAngle", self.MeasuOp)
2774 ## @name Curve Curvature Measurement
2775 # Methods for receiving radius of curvature of curves
2776 # in the given point
2779 ## Measure curvature of a curve at a point, set by parameter.
2780 # @ref swig_todo "Example"
2781 def CurveCurvatureByParam(self, theCurve, theParam):
2782 # Example: see GEOM_TestMeasures.py
2783 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
2784 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
2788 # @ref swig_todo "Example"
2789 def CurveCurvatureByPoint(self, theCurve, thePoint):
2790 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
2791 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
2795 ## @name Surface Curvature Measurement
2796 # Methods for receiving max and min radius of curvature of surfaces
2797 # in the given point
2801 ## @ref swig_todo "Example"
2802 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2803 # Example: see GEOM_TestMeasures.py
2804 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2805 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
2809 ## @ref swig_todo "Example"
2810 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
2811 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
2812 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
2816 ## @ref swig_todo "Example"
2817 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2818 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2819 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
2823 ## @ref swig_todo "Example"
2824 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
2825 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
2826 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
2830 ## Get min and max tolerances of sub-shapes of theShape
2831 # @param theShape Shape, to get tolerances of.
2832 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
2833 # FaceMin,FaceMax: Min and max tolerances of the faces.
2834 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
2835 # VertMin,VertMax: Min and max tolerances of the vertices.
2837 # @ref tui_measurement_tools_page "Example"
2838 def Tolerance(self,theShape):
2839 # Example: see GEOM_TestMeasures.py
2840 aTuple = self.MeasuOp.GetTolerance(theShape)
2841 RaiseIfFailed("GetTolerance", self.MeasuOp)
2844 ## Obtain description of the given shape (number of sub-shapes of each type)
2845 # @param theShape Shape to be described.
2846 # @return Description of the given shape.
2848 # @ref tui_measurement_tools_page "Example"
2849 def WhatIs(self,theShape):
2850 # Example: see GEOM_TestMeasures.py
2851 aDescr = self.MeasuOp.WhatIs(theShape)
2852 RaiseIfFailed("WhatIs", self.MeasuOp)
2855 ## Get a point, situated at the centre of mass of theShape.
2856 # @param theShape Shape to define centre of mass of.
2857 # @return New GEOM_Object, containing the created point.
2859 # @ref tui_measurement_tools_page "Example"
2860 def MakeCDG(self,theShape):
2861 # Example: see GEOM_TestMeasures.py
2862 anObj = self.MeasuOp.GetCentreOfMass(theShape)
2863 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
2866 ## Get a normale to the given face. If the point is not given,
2867 # the normale is calculated at the center of mass.
2868 # @param theFace Face to define normale of.
2869 # @param theOptionalPoint Point to compute the normale at.
2870 # @return New GEOM_Object, containing the created vector.
2872 # @ref swig_todo "Example"
2873 def GetNormal(self, theFace, theOptionalPoint = None):
2874 # Example: see GEOM_TestMeasures.py
2875 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
2876 RaiseIfFailed("GetNormal", self.MeasuOp)
2879 ## Check a topology of the given shape.
2880 # @param theShape Shape to check validity of.
2881 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
2882 # if TRUE, the shape's geometry will be checked also.
2883 # @return TRUE, if the shape "seems to be valid".
2884 # If theShape is invalid, prints a description of problem.
2886 # @ref tui_measurement_tools_page "Example"
2887 def CheckShape(self,theShape, theIsCheckGeom = 0):
2888 # Example: see GEOM_TestMeasures.py
2890 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
2891 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
2893 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
2894 RaiseIfFailed("CheckShape", self.MeasuOp)
2899 ## Get position (LCS) of theShape.
2901 # Origin of the LCS is situated at the shape's center of mass.
2902 # Axes of the LCS are obtained from shape's location or,
2903 # if the shape is a planar face, from position of its plane.
2905 # @param theShape Shape to calculate position of.
2906 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
2907 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
2908 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
2909 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
2911 # @ref swig_todo "Example"
2912 def GetPosition(self,theShape):
2913 # Example: see GEOM_TestMeasures.py
2914 aTuple = self.MeasuOp.GetPosition(theShape)
2915 RaiseIfFailed("GetPosition", self.MeasuOp)
2918 ## Get kind of theShape.
2920 # @param theShape Shape to get a kind of.
2921 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
2922 # and a list of parameters, describing the shape.
2923 # @note Concrete meaning of each value, returned via \a theIntegers
2924 # or \a theDoubles list depends on the kind of the shape.
2925 # The full list of possible outputs is:
2927 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
2928 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
2930 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
2931 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
2933 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
2934 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
2936 # - geompy.kind.SPHERE xc yc zc R
2937 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
2938 # - geompy.kind.BOX xc yc zc ax ay az
2939 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
2940 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
2941 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
2942 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
2943 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
2945 # - geompy.kind.SPHERE2D xc yc zc R
2946 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
2947 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
2948 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
2949 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
2950 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
2951 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
2952 # - geompy.kind.PLANE xo yo zo dx dy dz
2953 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
2954 # - geompy.kind.FACE nb_edges nb_vertices
2956 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
2957 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
2958 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
2959 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
2960 # - geompy.kind.LINE xo yo zo dx dy dz
2961 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
2962 # - geompy.kind.EDGE nb_vertices
2964 # - geompy.kind.VERTEX x y z
2966 # @ref swig_todo "Example"
2967 def KindOfShape(self,theShape):
2968 # Example: see GEOM_TestMeasures.py
2969 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
2970 RaiseIfFailed("KindOfShape", self.MeasuOp)
2972 aKind = aRoughTuple[0]
2973 anInts = aRoughTuple[1]
2974 aDbls = aRoughTuple[2]
2976 # Now there is no exception from this rule:
2977 aKindTuple = [aKind] + aDbls + anInts
2979 # If they are we will regroup parameters for such kind of shape.
2981 #if aKind == kind.SOME_KIND:
2982 # # SOME_KIND int int double int double double
2983 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
2990 ## @addtogroup l2_import_export
2993 ## Import a shape from the BREP or IGES or STEP file
2994 # (depends on given format) with given name.
2995 # @param theFileName The file, containing the shape.
2996 # @param theFormatName Specify format for the file reading.
2997 # Available formats can be obtained with InsertOp.ImportTranslators() method.
2998 # @return New GEOM_Object, containing the imported shape.
3000 # @ref swig_Import_Export "Example"
3001 def Import(self,theFileName, theFormatName):
3002 # Example: see GEOM_TestOthers.py
3003 anObj = self.InsertOp.Import(theFileName, theFormatName)
3004 RaiseIfFailed("Import", self.InsertOp)
3007 ## Shortcut to Import() for BREP format
3009 # @ref swig_Import_Export "Example"
3010 def ImportBREP(self,theFileName):
3011 # Example: see GEOM_TestOthers.py
3012 return self.Import(theFileName, "BREP")
3014 ## Shortcut to Import() for IGES format
3016 # @ref swig_Import_Export "Example"
3017 def ImportIGES(self,theFileName):
3018 # Example: see GEOM_TestOthers.py
3019 return self.Import(theFileName, "IGES")
3021 ## Shortcut to Import() for STEP format
3023 # @ref swig_Import_Export "Example"
3024 def ImportSTEP(self,theFileName):
3025 # Example: see GEOM_TestOthers.py
3026 return self.Import(theFileName, "STEP")
3028 ## Export the given shape into a file with given name.
3029 # @param theObject Shape to be stored in the file.
3030 # @param theFileName Name of the file to store the given shape in.
3031 # @param theFormatName Specify format for the shape storage.
3032 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3034 # @ref swig_Import_Export "Example"
3035 def Export(self,theObject, theFileName, theFormatName):
3036 # Example: see GEOM_TestOthers.py
3037 self.InsertOp.Export(theObject, theFileName, theFormatName)
3038 if self.InsertOp.IsDone() == 0:
3039 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
3043 ## Shortcut to Export() for BREP format
3045 # @ref swig_Import_Export "Example"
3046 def ExportBREP(self,theObject, theFileName):
3047 # Example: see GEOM_TestOthers.py
3048 return self.Export(theObject, theFileName, "BREP")
3050 ## Shortcut to Export() for IGES format
3052 # @ref swig_Import_Export "Example"
3053 def ExportIGES(self,theObject, theFileName):
3054 # Example: see GEOM_TestOthers.py
3055 return self.Export(theObject, theFileName, "IGES")
3057 ## Shortcut to Export() for STEP format
3059 # @ref swig_Import_Export "Example"
3060 def ExportSTEP(self,theObject, theFileName):
3061 # Example: see GEOM_TestOthers.py
3062 return self.Export(theObject, theFileName, "STEP")
3064 # end of l2_import_export
3067 ## @addtogroup l3_blocks
3070 ## Create a quadrangle face from four edges. Order of Edges is not
3071 # important. It is not necessary that edges share the same vertex.
3072 # @param E1,E2,E3,E4 Edges for the face bound.
3073 # @return New GEOM_Object, containing the created face.
3075 # @ref tui_building_by_blocks_page "Example"
3076 def MakeQuad(self,E1, E2, E3, E4):
3077 # Example: see GEOM_Spanner.py
3078 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
3079 RaiseIfFailed("MakeQuad", self.BlocksOp)
3082 ## Create a quadrangle face on two edges.
3083 # The missing edges will be built by creating the shortest ones.
3084 # @param E1,E2 Two opposite edges for the face.
3085 # @return New GEOM_Object, containing the created face.
3087 # @ref tui_building_by_blocks_page "Example"
3088 def MakeQuad2Edges(self,E1, E2):
3089 # Example: see GEOM_Spanner.py
3090 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
3091 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
3094 ## Create a quadrangle face with specified corners.
3095 # The missing edges will be built by creating the shortest ones.
3096 # @param V1,V2,V3,V4 Corner vertices for the face.
3097 # @return New GEOM_Object, containing the created face.
3099 # @ref tui_building_by_blocks_page "Example 1"
3100 # \n @ref swig_MakeQuad4Vertices "Example 2"
3101 def MakeQuad4Vertices(self,V1, V2, V3, V4):
3102 # Example: see GEOM_Spanner.py
3103 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
3104 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
3107 ## Create a hexahedral solid, bounded by the six given faces. Order of
3108 # faces is not important. It is not necessary that Faces share the same edge.
3109 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
3110 # @return New GEOM_Object, containing the created solid.
3112 # @ref tui_building_by_blocks_page "Example 1"
3113 # \n @ref swig_MakeHexa "Example 2"
3114 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
3115 # Example: see GEOM_Spanner.py
3116 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
3117 RaiseIfFailed("MakeHexa", self.BlocksOp)
3120 ## Create a hexahedral solid between two given faces.
3121 # The missing faces will be built by creating the smallest ones.
3122 # @param F1,F2 Two opposite faces for the hexahedral solid.
3123 # @return New GEOM_Object, containing the created solid.
3125 # @ref tui_building_by_blocks_page "Example 1"
3126 # \n @ref swig_MakeHexa2Faces "Example 2"
3127 def MakeHexa2Faces(self,F1, F2):
3128 # Example: see GEOM_Spanner.py
3129 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
3130 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
3136 ## @addtogroup l3_blocks_op
3139 ## Get a vertex, found in the given shape by its coordinates.
3140 # @param theShape Block or a compound of blocks.
3141 # @param theX,theY,theZ Coordinates of the sought vertex.
3142 # @param theEpsilon Maximum allowed distance between the resulting
3143 # vertex and point with the given coordinates.
3144 # @return New GEOM_Object, containing the found vertex.
3146 # @ref swig_GetPoint "Example"
3147 def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
3148 # Example: see GEOM_TestOthers.py
3149 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
3150 RaiseIfFailed("GetPoint", self.BlocksOp)
3153 ## Get an edge, found in the given shape by two given vertices.
3154 # @param theShape Block or a compound of blocks.
3155 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
3156 # @return New GEOM_Object, containing the found edge.
3158 # @ref swig_todo "Example"
3159 def GetEdge(self,theShape, thePoint1, thePoint2):
3160 # Example: see GEOM_Spanner.py
3161 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
3162 RaiseIfFailed("GetEdge", self.BlocksOp)
3165 ## Find an edge of the given shape, which has minimal distance to the given point.
3166 # @param theShape Block or a compound of blocks.
3167 # @param thePoint Point, close to the desired edge.
3168 # @return New GEOM_Object, containing the found edge.
3170 # @ref swig_GetEdgeNearPoint "Example"
3171 def GetEdgeNearPoint(self,theShape, thePoint):
3172 # Example: see GEOM_TestOthers.py
3173 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
3174 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
3177 ## Returns a face, found in the given shape by four given corner vertices.
3178 # @param theShape Block or a compound of blocks.
3179 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
3180 # @return New GEOM_Object, containing the found face.
3182 # @ref swig_todo "Example"
3183 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
3184 # Example: see GEOM_Spanner.py
3185 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
3186 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
3189 ## Get a face of block, found in the given shape by two given edges.
3190 # @param theShape Block or a compound of blocks.
3191 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
3192 # @return New GEOM_Object, containing the found face.
3194 # @ref swig_todo "Example"
3195 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
3196 # Example: see GEOM_Spanner.py
3197 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
3198 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
3201 ## Find a face, opposite to the given one in the given block.
3202 # @param theBlock Must be a hexahedral solid.
3203 # @param theFace Face of \a theBlock, opposite to the desired face.
3204 # @return New GEOM_Object, containing the found face.
3206 # @ref swig_GetOppositeFace "Example"
3207 def GetOppositeFace(self,theBlock, theFace):
3208 # Example: see GEOM_Spanner.py
3209 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
3210 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
3213 ## Find a face of the given shape, which has minimal distance to the given point.
3214 # @param theShape Block or a compound of blocks.
3215 # @param thePoint Point, close to the desired face.
3216 # @return New GEOM_Object, containing the found face.
3218 # @ref swig_GetFaceNearPoint "Example"
3219 def GetFaceNearPoint(self,theShape, thePoint):
3220 # Example: see GEOM_Spanner.py
3221 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
3222 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
3225 ## Find a face of block, whose outside normale has minimal angle with the given vector.
3226 # @param theBlock Block or a compound of blocks.
3227 # @param theVector Vector, close to the normale of the desired face.
3228 # @return New GEOM_Object, containing the found face.
3230 # @ref swig_todo "Example"
3231 def GetFaceByNormale(self, theBlock, theVector):
3232 # Example: see GEOM_Spanner.py
3233 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
3234 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
3237 # end of l3_blocks_op
3240 ## @addtogroup l4_blocks_measure
3243 ## Check, if the compound of blocks is given.
3244 # To be considered as a compound of blocks, the
3245 # given shape must satisfy the following conditions:
3246 # - Each element of the compound should be a Block (6 faces and 12 edges).
3247 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
3248 # - The compound should be connexe.
3249 # - The glue between two quadrangle faces should be applied.
3250 # @param theCompound The compound to check.
3251 # @return TRUE, if the given shape is a compound of blocks.
3252 # If theCompound is not valid, prints all discovered errors.
3254 # @ref tui_measurement_tools_page "Example 1"
3255 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
3256 def CheckCompoundOfBlocks(self,theCompound):
3257 # Example: see GEOM_Spanner.py
3258 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
3259 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
3261 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
3265 ## Remove all seam and degenerated edges from \a theShape.
3266 # Unite faces and edges, sharing one surface. It means that
3267 # this faces must have references to one C++ surface object (handle).
3268 # @param theShape The compound or single solid to remove irregular edges from.
3269 # @return Improved shape.
3271 # @ref swig_RemoveExtraEdges "Example"
3272 def RemoveExtraEdges(self,theShape):
3273 # Example: see GEOM_TestOthers.py
3274 anObj = self.BlocksOp.RemoveExtraEdges(theShape)
3275 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
3278 ## Check, if the given shape is a blocks compound.
3279 # Fix all detected errors.
3280 # \note Single block can be also fixed by this method.
3281 # @param theShape The compound to check and improve.
3282 # @return Improved compound.
3284 # @ref swig_CheckAndImprove "Example"
3285 def CheckAndImprove(self,theShape):
3286 # Example: see GEOM_TestOthers.py
3287 anObj = self.BlocksOp.CheckAndImprove(theShape)
3288 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
3291 # end of l4_blocks_measure
3294 ## @addtogroup l3_blocks_op
3297 ## Get all the blocks, contained in the given compound.
3298 # @param theCompound The compound to explode.
3299 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
3300 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
3301 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
3302 # @return List of GEOM_Objects, containing the retrieved blocks.
3304 # @ref tui_explode_on_blocks "Example 1"
3305 # \n @ref swig_MakeBlockExplode "Example 2"
3306 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
3307 # Example: see GEOM_TestOthers.py
3308 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
3309 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
3310 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
3312 anObj.SetParameters(Parameters)
3316 ## Find block, containing the given point inside its volume or on boundary.
3317 # @param theCompound Compound, to find block in.
3318 # @param thePoint Point, close to the desired block. If the point lays on
3319 # boundary between some blocks, we return block with nearest center.
3320 # @return New GEOM_Object, containing the found block.
3322 # @ref swig_todo "Example"
3323 def GetBlockNearPoint(self,theCompound, thePoint):
3324 # Example: see GEOM_Spanner.py
3325 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
3326 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
3329 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
3330 # @param theCompound Compound, to find block in.
3331 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
3332 # @return New GEOM_Object, containing the found block.
3334 # @ref swig_GetBlockByParts "Example"
3335 def GetBlockByParts(self,theCompound, theParts):
3336 # Example: see GEOM_TestOthers.py
3337 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
3338 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
3341 ## Return all blocks, containing all the elements, passed as the parts.
3342 # @param theCompound Compound, to find blocks in.
3343 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
3344 # @return List of GEOM_Objects, containing the found blocks.
3346 # @ref swig_todo "Example"
3347 def GetBlocksByParts(self,theCompound, theParts):
3348 # Example: see GEOM_Spanner.py
3349 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
3350 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
3353 ## Multi-transformate block and glue the result.
3354 # Transformation is defined so, as to superpose direction faces.
3355 # @param Block Hexahedral solid to be multi-transformed.
3356 # @param DirFace1 ID of First direction face.
3357 # @param DirFace2 ID of Second direction face.
3358 # @param NbTimes Quantity of transformations to be done.
3359 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
3360 # @return New GEOM_Object, containing the result shape.
3362 # @ref tui_multi_transformation "Example"
3363 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
3364 # Example: see GEOM_Spanner.py
3365 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
3366 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
3367 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
3368 anObj.SetParameters(Parameters)
3371 ## Multi-transformate block and glue the result.
3372 # @param Block Hexahedral solid to be multi-transformed.
3373 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
3374 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
3375 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
3376 # @return New GEOM_Object, containing the result shape.
3378 # @ref tui_multi_transformation "Example"
3379 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
3380 DirFace1V, DirFace2V, NbTimesV):
3381 # Example: see GEOM_Spanner.py
3382 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
3383 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
3384 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
3385 DirFace1V, DirFace2V, NbTimesV)
3386 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
3387 anObj.SetParameters(Parameters)
3390 ## Build all possible propagation groups.
3391 # Propagation group is a set of all edges, opposite to one (main)
3392 # edge of this group directly or through other opposite edges.
3393 # Notion of Opposite Edge make sence only on quadrangle face.
3394 # @param theShape Shape to build propagation groups on.
3395 # @return List of GEOM_Objects, each of them is a propagation group.
3397 # @ref swig_Propagate "Example"
3398 def Propagate(self,theShape):
3399 # Example: see GEOM_TestOthers.py
3400 listChains = self.BlocksOp.Propagate(theShape)
3401 RaiseIfFailed("Propagate", self.BlocksOp)
3404 # end of l3_blocks_op
3407 ## @addtogroup l3_groups
3410 ## Creates a new group which will store sub shapes of theMainShape
3411 # @param theMainShape is a GEOM object on which the group is selected
3412 # @param theShapeType defines a shape type of the group
3413 # @return a newly created GEOM group
3415 # @ref tui_working_with_groups_page "Example 1"
3416 # \n @ref swig_CreateGroup "Example 2"
3417 def CreateGroup(self,theMainShape, theShapeType):
3418 # Example: see GEOM_TestOthers.py
3419 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
3420 RaiseIfFailed("CreateGroup", self.GroupOp)
3423 ## Adds a sub object with ID theSubShapeId to the group
3424 # @param theGroup is a GEOM group to which the new sub shape is added
3425 # @param theSubShapeID is a sub shape ID in the main object.
3426 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3428 # @ref tui_working_with_groups_page "Example"
3429 def AddObject(self,theGroup, theSubShapeID):
3430 # Example: see GEOM_TestOthers.py
3431 self.GroupOp.AddObject(theGroup, theSubShapeID)
3432 RaiseIfFailed("AddObject", self.GroupOp)
3435 ## Removes a sub object with ID \a theSubShapeId from the group
3436 # @param theGroup is a GEOM group from which the new sub shape is removed
3437 # @param theSubShapeID is a sub shape ID in the main object.
3438 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3440 # @ref tui_working_with_groups_page "Example"
3441 def RemoveObject(self,theGroup, theSubShapeID):
3442 # Example: see GEOM_TestOthers.py
3443 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
3444 RaiseIfFailed("RemoveObject", self.GroupOp)
3447 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
3448 # @param theGroup is a GEOM group to which the new sub shapes are added.
3449 # @param theSubShapes is a list of sub shapes to be added.
3451 # @ref tui_working_with_groups_page "Example"
3452 def UnionList (self,theGroup, theSubShapes):
3453 # Example: see GEOM_TestOthers.py
3454 self.GroupOp.UnionList(theGroup, theSubShapes)
3455 RaiseIfFailed("UnionList", self.GroupOp)
3458 ## Works like the above method, but argument
3459 # theSubShapes here is a list of sub-shapes indices
3461 # @ref swig_UnionIDs "Example"
3462 def UnionIDs(self,theGroup, theSubShapes):
3463 # Example: see GEOM_TestOthers.py
3464 self.GroupOp.UnionIDs(theGroup, theSubShapes)
3465 RaiseIfFailed("UnionIDs", self.GroupOp)
3468 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
3469 # @param theGroup is a GEOM group from which the sub-shapes are removed.
3470 # @param theSubShapes is a list of sub-shapes to be removed.
3472 # @ref tui_working_with_groups_page "Example"
3473 def DifferenceList (self,theGroup, theSubShapes):
3474 # Example: see GEOM_TestOthers.py
3475 self.GroupOp.DifferenceList(theGroup, theSubShapes)
3476 RaiseIfFailed("DifferenceList", self.GroupOp)
3479 ## Works like the above method, but argument
3480 # theSubShapes here is a list of sub-shapes indices
3482 # @ref swig_DifferenceIDs "Example"
3483 def DifferenceIDs(self,theGroup, theSubShapes):
3484 # Example: see GEOM_TestOthers.py
3485 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
3486 RaiseIfFailed("DifferenceIDs", self.GroupOp)
3489 ## Returns a list of sub objects ID stored in the group
3490 # @param theGroup is a GEOM group for which a list of IDs is requested
3492 # @ref swig_GetObjectIDs "Example"
3493 def GetObjectIDs(self,theGroup):
3494 # Example: see GEOM_TestOthers.py
3495 ListIDs = self.GroupOp.GetObjects(theGroup)
3496 RaiseIfFailed("GetObjects", self.GroupOp)
3499 ## Returns a type of sub objects stored in the group
3500 # @param theGroup is a GEOM group which type is returned.
3502 # @ref swig_GetType "Example"
3503 def GetType(self,theGroup):
3504 # Example: see GEOM_TestOthers.py
3505 aType = self.GroupOp.GetType(theGroup)
3506 RaiseIfFailed("GetType", self.GroupOp)
3509 ## Returns a main shape associated with the group
3510 # @param theGroup is a GEOM group for which a main shape object is requested
3511 # @return a GEOM object which is a main shape for theGroup
3513 # @ref swig_GetMainShape "Example"
3514 def GetMainShape(self,theGroup):
3515 # Example: see GEOM_TestOthers.py
3516 anObj = self.GroupOp.GetMainShape(theGroup)
3517 RaiseIfFailed("GetMainShape", self.GroupOp)
3520 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
3521 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3523 # @ref swig_todo "Example"
3524 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
3525 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
3528 Props = self.BasicProperties(edge)
3529 if min_length <= Props[0] and Props[0] <= max_length:
3530 if (not include_min) and (min_length == Props[0]):
3533 if (not include_max) and (Props[0] == max_length):
3536 edges_in_range.append(edge)
3538 if len(edges_in_range) <= 0:
3539 print "No edges found by given criteria"
3542 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
3543 self.UnionList(group_edges, edges_in_range)
3547 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
3548 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3550 # @ref swig_todo "Example"
3551 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
3552 nb_selected = sg.SelectedCount()
3554 print "Select a shape before calling this function, please."
3557 print "Only one shape must be selected"
3560 id_shape = sg.getSelected(0)
3561 shape = IDToObject( id_shape )
3563 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
3567 if include_min: left_str = " <= "
3568 if include_max: right_str = " <= "
3570 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
3571 + left_str + "length" + right_str + `max_length`)
3573 sg.updateObjBrowser(1)
3580 ## Create a copy of the given object
3581 # @ingroup l1_geompy_auxiliary
3583 # @ref swig_all_advanced "Example"
3584 def MakeCopy(self,theOriginal):
3585 # Example: see GEOM_TestAll.py
3586 anObj = self.InsertOp.MakeCopy(theOriginal)
3587 RaiseIfFailed("MakeCopy", self.InsertOp)
3590 ## Add Path to load python scripts from
3591 # @ingroup l1_geompy_auxiliary
3592 def addPath(self,Path):
3593 if (sys.path.count(Path) < 1):
3594 sys.path.append(Path)
3597 #Register the new proxy for GEOM_Gen
3598 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)