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))
108 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
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
139 ## Return list of variables value from salome notebook
140 ## @ingroup l1_geompy_auxiliary
141 def ParseSketcherCommand(command):
144 sections = command.split(":")
145 for section in sections:
146 parameters = section.split(" ")
148 for parameter in parameters:
149 if paramIndex > 1 and parameter.find("'") != -1:
150 parameter = parameter.replace("'","")
151 if notebook.isVariable(parameter):
152 Result = Result + str(notebook.get(parameter)) + " "
155 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
159 Result = Result + str(parameter) + " "
162 StringResult = StringResult + parameter
163 StringResult = StringResult + ":"
165 paramIndex = paramIndex + 1
167 Result = Result[:len(Result)-1] + ":"
169 Result = Result[:len(Result)-1]
170 return Result, StringResult
172 ## Kinds of shape enumeration
173 # @ingroup l1_geompy_auxiliary
174 kind = GEOM.GEOM_IKindOfShape
176 ## Information about closed/unclosed state of shell or wire
177 # @ingroup l1_geompy_auxiliary
184 class geompyDC(GEOM._objref_GEOM_Gen):
186 ## @addtogroup l1_geompy_auxiliary
189 GEOM._objref_GEOM_Gen.__init__(self)
190 self.myBuilder = None
208 def init_geom(self,theStudy):
209 self.myStudy = theStudy
210 self.myStudyId = self.myStudy._get_StudyId()
211 self.myBuilder = self.myStudy.NewBuilder()
212 self.father = self.myStudy.FindComponent("GEOM")
213 if self.father is None:
214 self.father = self.myBuilder.NewComponent("GEOM")
215 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
216 FName = A1._narrow(SALOMEDS.AttributeName)
217 FName.SetValue("Geometry")
218 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
219 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
220 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
221 self.myBuilder.DefineComponentInstance(self.father,self)
223 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
224 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
225 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
226 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
227 self.HealOp = self.GetIHealingOperations (self.myStudyId)
228 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
229 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
230 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
231 self.LocalOp = self.GetILocalOperations (self.myStudyId)
232 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
233 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
234 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
237 ## Get name for sub-shape aSubObj of shape aMainObj
239 # @ref swig_SubShapeAllSorted "Example"
240 def SubShapeName(self,aSubObj, aMainObj):
241 # Example: see GEOM_TestAll.py
243 #aSubId = orb.object_to_string(aSubObj)
244 #aMainId = orb.object_to_string(aMainObj)
245 #index = gg.getIndexTopology(aSubId, aMainId)
246 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
247 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
248 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
251 ## Publish in study aShape with name aName
253 # \param aShape the shape to be published
254 # \param aName the name for the shape
255 # \param doRestoreSubShapes if True, finds and publishes also
256 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
257 # and published sub-shapes of arguments
258 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
259 # these arguments description
260 # \return study entry of the published shape in form of string
262 # @ref swig_MakeQuad4Vertices "Example"
263 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
264 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
265 # Example: see GEOM_TestAll.py
267 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
268 if doRestoreSubShapes:
269 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
270 theFindMethod, theInheritFirstArg)
272 print "addToStudy() failed"
274 return aShape.GetStudyEntry()
276 ## Publish in study aShape with name aName as sub-object of previously published aFather
278 # @ref swig_SubShapeAllSorted "Example"
279 def addToStudyInFather(self, aFather, aShape, aName):
280 # Example: see GEOM_TestAll.py
282 aSObject = self.AddInStudy(myStudy, aShape, aName, aFather)
284 print "addToStudyInFather() failed"
286 return aShape.GetStudyEntry()
288 # end of l1_geompy_auxiliary
291 ## @addtogroup l3_restore_ss
294 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
295 # To be used from python scripts out of geompy.addToStudy (non-default usage)
296 # \param theObject published GEOM object, arguments of which will be published
297 # \param theArgs list of GEOM_Object, operation arguments to be published.
298 # If this list is empty, all operation arguments will be published
299 # \param theFindMethod method to search subshapes, corresponding to arguments and
300 # their subshapes. Value from enumeration GEOM::find_shape_method.
301 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
302 # Do not publish subshapes in place of arguments, but only
303 # in place of subshapes of the first argument,
304 # because the whole shape corresponds to the first argument.
305 # Mainly to be used after transformations, but it also can be
306 # usefull after partition with one object shape, and some other
307 # operations, where only the first argument has to be considered.
308 # If theObject has only one argument shape, this flag is automatically
309 # considered as True, not regarding really passed value.
310 # \return True in case of success, False otherwise.
312 # @ref tui_restore_prs_params "Example"
313 def RestoreSubShapes (self, theObject, theArgs=[],
314 theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
315 # Example: see GEOM_TestAll.py
316 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
317 theFindMethod, theInheritFirstArg)
319 # end of l3_restore_ss
322 ## @addtogroup l3_basic_go
325 ## Create point by three coordinates.
326 # @param theX The X coordinate of the point.
327 # @param theY The Y coordinate of the point.
328 # @param theZ The Z coordinate of the point.
329 # @return New GEOM_Object, containing the created point.
331 # @ref tui_creation_point "Example"
332 def MakeVertex(self,theX, theY, theZ):
333 # Example: see GEOM_TestAll.py
334 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
335 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
336 RaiseIfFailed("MakePointXYZ", self.BasicOp)
337 anObj.SetParameters(Parameters)
340 ## Create a point, distant from the referenced point
341 # on the given distances along the coordinate axes.
342 # @param theReference The referenced point.
343 # @param theX Displacement from the referenced point along OX axis.
344 # @param theY Displacement from the referenced point along OY axis.
345 # @param theZ Displacement from the referenced point along OZ axis.
346 # @return New GEOM_Object, containing the created point.
348 # @ref tui_creation_point "Example"
349 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
350 # Example: see GEOM_TestAll.py
351 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
352 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
353 RaiseIfFailed("MakePointWithReference", self.BasicOp)
354 anObj.SetParameters(Parameters)
357 ## Create a point, corresponding to the given parameter on the given curve.
358 # @param theRefCurve The referenced curve.
359 # @param theParameter Value of parameter on the referenced curve.
360 # @return New GEOM_Object, containing the created point.
362 # @ref tui_creation_point "Example"
363 def MakeVertexOnCurve(self,theRefCurve, theParameter):
364 # Example: see GEOM_TestAll.py
365 theParameter, Parameters = ParseParameters(theParameter)
366 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
367 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
368 anObj.SetParameters(Parameters)
371 ## Create a point, corresponding to the given parameters on the
373 # @param theRefSurf The referenced surface.
374 # @param theUParameter Value of U-parameter on the referenced surface.
375 # @param theVParameter Value of V-parameter on the referenced surface.
376 # @return New GEOM_Object, containing the created point.
378 # @ref swig_MakeVertexOnSurface "Example"
379 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
380 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
381 # Example: see GEOM_TestAll.py
382 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
383 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
384 anObj.SetParameters(Parameters);
387 ## Create a point on intersection of two lines.
388 # @param theRefLine1, theRefLine2 The referenced lines.
389 # @return New GEOM_Object, containing the created point.
391 # @ref swig_MakeVertexOnLinesIntersection "Example"
392 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
393 # Example: see GEOM_TestAll.py
394 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
395 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
398 ## Create a tangent, corresponding to the given parameter on the given curve.
399 # @param theRefCurve The referenced curve.
400 # @param theParameter Value of parameter on the referenced curve.
401 # @return New GEOM_Object, containing the created tangent.
403 # @ref swig_MakeTangentOnCurve "Example"
404 def MakeTangentOnCurve(self, theRefCurve, theParameter):
405 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
406 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
409 ## Create a vector with the given components.
410 # @param theDX X component of the vector.
411 # @param theDY Y component of the vector.
412 # @param theDZ Z component of the vector.
413 # @return New GEOM_Object, containing the created vector.
415 # @ref tui_creation_vector "Example"
416 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
417 # Example: see GEOM_TestAll.py
418 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
419 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
420 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
421 anObj.SetParameters(Parameters)
424 ## Create a vector between two points.
425 # @param thePnt1 Start point for the vector.
426 # @param thePnt2 End point for the vector.
427 # @return New GEOM_Object, containing the created vector.
429 # @ref tui_creation_vector "Example"
430 def MakeVector(self,thePnt1, thePnt2):
431 # Example: see GEOM_TestAll.py
432 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
433 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
436 ## Create a line, passing through the given point
437 # and parrallel to the given direction
438 # @param thePnt Point. The resulting line will pass through it.
439 # @param theDir Direction. The resulting line will be parallel to it.
440 # @return New GEOM_Object, containing the created line.
442 # @ref tui_creation_line "Example"
443 def MakeLine(self,thePnt, theDir):
444 # Example: see GEOM_TestAll.py
445 anObj = self.BasicOp.MakeLine(thePnt, theDir)
446 RaiseIfFailed("MakeLine", self.BasicOp)
449 ## Create a line, passing through the given points
450 # @param thePnt1 First of two points, defining the line.
451 # @param thePnt2 Second of two points, defining the line.
452 # @return New GEOM_Object, containing the created line.
454 # @ref tui_creation_line "Example"
455 def MakeLineTwoPnt(self,thePnt1, thePnt2):
456 # Example: see GEOM_TestAll.py
457 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
458 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
461 ## Create a line on two faces intersection.
462 # @param theFace1 First of two faces, defining the line.
463 # @param theFace2 Second of two faces, defining the line.
464 # @return New GEOM_Object, containing the created line.
466 # @ref swig_MakeLineTwoFaces "Example"
467 def MakeLineTwoFaces(self, theFace1, theFace2):
468 # Example: see GEOM_TestAll.py
469 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
470 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
473 ## Create a plane, passing through the given point
474 # and normal to the given vector.
475 # @param thePnt Point, the plane has to pass through.
476 # @param theVec Vector, defining the plane normal direction.
477 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
478 # @return New GEOM_Object, containing the created plane.
480 # @ref tui_creation_plane "Example"
481 def MakePlane(self,thePnt, theVec, theTrimSize):
482 # Example: see GEOM_TestAll.py
483 theTrimSize, Parameters = ParseParameters(theTrimSize);
484 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
485 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
486 anObj.SetParameters(Parameters)
489 ## Create a plane, passing through the three given points
490 # @param thePnt1 First of three points, defining the plane.
491 # @param thePnt2 Second of three points, defining the plane.
492 # @param thePnt3 Fird of three points, defining the plane.
493 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
494 # @return New GEOM_Object, containing the created plane.
496 # @ref tui_creation_plane "Example"
497 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
498 # Example: see GEOM_TestAll.py
499 theTrimSize, Parameters = ParseParameters(theTrimSize);
500 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
501 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
502 anObj.SetParameters(Parameters)
505 ## Create a plane, similar to the existing one, but with another size of representing face.
506 # @param theFace Referenced plane or LCS(Marker).
507 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
508 # @return New GEOM_Object, containing the created plane.
510 # @ref tui_creation_plane "Example"
511 def MakePlaneFace(self,theFace, theTrimSize):
512 # Example: see GEOM_TestAll.py
513 theTrimSize, Parameters = ParseParameters(theTrimSize);
514 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
515 RaiseIfFailed("MakePlaneFace", self.BasicOp)
516 anObj.SetParameters(Parameters)
519 ## Create a local coordinate system.
520 # @param OX,OY,OZ Three coordinates of coordinate system origin.
521 # @param XDX,XDY,XDZ Three components of OX direction
522 # @param YDX,YDY,YDZ Three components of OY direction
523 # @return New GEOM_Object, containing the created coordinate system.
525 # @ref swig_MakeMarker "Example"
526 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
527 # Example: see GEOM_TestAll.py
528 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
529 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
530 RaiseIfFailed("MakeMarker", self.BasicOp)
531 anObj.SetParameters(Parameters)
534 ## Create a local coordinate system.
535 # @param theOrigin Point of coordinate system origin.
536 # @param theXVec Vector of X direction
537 # @param theYVec Vector of Y direction
538 # @return New GEOM_Object, containing the created coordinate system.
540 # @ref swig_MakeMarker "Example"
541 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
542 O = self.PointCoordinates( theOrigin )
544 for vec in [ theXVec, theYVec ]:
545 v1, v2 = self.SubShapeAll( vec, ShapeType["VERTEX"] )
546 p1 = self.PointCoordinates( v1 )
547 p2 = self.PointCoordinates( v2 )
548 for i in range( 0, 3 ):
549 OXOY.append( p2[i] - p1[i] )
551 anObj = self.BasicOp.MakeMarker( O[0], O[1], O[2],
552 OXOY[0], OXOY[1], OXOY[2],
553 OXOY[3], OXOY[4], OXOY[5], )
554 RaiseIfFailed("MakeMarker", self.BasicOp)
560 ## @addtogroup l4_curves
563 ## Create an arc of circle, passing through three given points.
564 # @param thePnt1 Start point of the arc.
565 # @param thePnt2 Middle point of the arc.
566 # @param thePnt3 End point of the arc.
567 # @return New GEOM_Object, containing the created arc.
569 # @ref swig_MakeArc "Example"
570 def MakeArc(self,thePnt1, thePnt2, thePnt3):
571 # Example: see GEOM_TestAll.py
572 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
573 RaiseIfFailed("MakeArc", self.CurvesOp)
576 ## Create an arc of circle from a center and 2 points.
577 # @param thePnt1 Center of the arc
578 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
579 # @param thePnt3 End point of the arc (Gives also a direction)
580 # @param theSense Orientation of the arc
581 # @return New GEOM_Object, containing the created arc.
583 # @ref swig_MakeArc "Example"
584 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
585 # Example: see GEOM_TestAll.py
586 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
587 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
590 ## Create a circle with given center, normal vector and radius.
591 # @param thePnt Circle center.
592 # @param theVec Vector, normal to the plane of the circle.
593 # @param theR Circle radius.
594 # @return New GEOM_Object, containing the created circle.
596 # @ref tui_creation_circle "Example"
597 def MakeCircle(self, thePnt, theVec, theR):
598 # Example: see GEOM_TestAll.py
599 theR, Parameters = ParseParameters(theR)
600 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
601 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
602 anObj.SetParameters(Parameters)
605 ## Create a circle with given radius.
606 # Center of the circle will be in the origin of global
607 # coordinate system and normal vector will be codirected with Z axis
608 # @param theR Circle radius.
609 # @return New GEOM_Object, containing the created circle.
610 def MakeCircleR(self, theR):
611 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
612 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
615 ## Create a circle, passing through three given points
616 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
617 # @return New GEOM_Object, containing the created circle.
619 # @ref tui_creation_circle "Example"
620 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
621 # Example: see GEOM_TestAll.py
622 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
623 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
626 ## Create a circle, with given point1 as center,
627 # passing through the point2 as radius and laying in the plane,
628 # defined by all three given points.
629 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
630 # @return New GEOM_Object, containing the created circle.
632 # @ref swig_MakeCircle "Example"
633 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
634 # Example: see GEOM_example6.py
635 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
636 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
639 ## Create an ellipse with given center, normal vector and radiuses.
640 # @param thePnt Ellipse center.
641 # @param theVec Vector, normal to the plane of the ellipse.
642 # @param theRMajor Major ellipse radius.
643 # @param theRMinor Minor ellipse radius.
644 # @return New GEOM_Object, containing the created ellipse.
646 # @ref tui_creation_ellipse "Example"
647 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor):
648 # Example: see GEOM_TestAll.py
649 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
650 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
651 RaiseIfFailed("MakeEllipse", self.CurvesOp)
652 anObj.SetParameters(Parameters)
655 ## Create an ellipse with given radiuses.
656 # Center of the ellipse will be in the origin of global
657 # coordinate system and normal vector will be codirected with Z axis
658 # @param theRMajor Major ellipse radius.
659 # @param theRMinor Minor ellipse radius.
660 # @return New GEOM_Object, containing the created ellipse.
661 def MakeEllipseRR(self, theRMajor, theRMinor):
662 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
663 RaiseIfFailed("MakeEllipse", self.CurvesOp)
666 ## Create a polyline on the set of points.
667 # @param thePoints Sequence of points for the polyline.
668 # @return New GEOM_Object, containing the created polyline.
670 # @ref tui_creation_curve "Example"
671 def MakePolyline(self,thePoints):
672 # Example: see GEOM_TestAll.py
673 anObj = self.CurvesOp.MakePolyline(thePoints)
674 RaiseIfFailed("MakePolyline", self.CurvesOp)
677 ## Create bezier curve on the set of points.
678 # @param thePoints Sequence of points for the bezier curve.
679 # @return New GEOM_Object, containing the created bezier curve.
681 # @ref tui_creation_curve "Example"
682 def MakeBezier(self,thePoints):
683 # Example: see GEOM_TestAll.py
684 anObj = self.CurvesOp.MakeSplineBezier(thePoints)
685 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
688 ## Create B-Spline curve on the set of points.
689 # @param thePoints Sequence of points for the B-Spline curve.
690 # @return New GEOM_Object, containing the created B-Spline curve.
692 # @ref tui_creation_curve "Example"
693 def MakeInterpol(self,thePoints):
694 # Example: see GEOM_TestAll.py
695 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints)
696 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
702 ## @addtogroup l3_sketcher
705 ## Create a sketcher (wire or face), following the textual description,
706 # passed through <VAR>theCommand</VAR> argument. \n
707 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
708 # Format of the description string have to be the following:
710 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
713 # - x1, y1 are coordinates of the first sketcher point (zero by default),
715 # - "R angle" : Set the direction by angle
716 # - "D dx dy" : Set the direction by DX & DY
719 # - "TT x y" : Create segment by point at X & Y
720 # - "T dx dy" : Create segment by point with DX & DY
721 # - "L length" : Create segment by direction & Length
722 # - "IX x" : Create segment by direction & Intersect. X
723 # - "IY y" : Create segment by direction & Intersect. Y
726 # - "C radius length" : Create arc by direction, radius and length(in degree)
729 # - "WW" : Close Wire (to finish)
730 # - "WF" : Close Wire and build face (to finish)
732 # @param theCommand String, defining the sketcher in local
733 # coordinates of the working plane.
734 # @param theWorkingPlane Nine double values, defining origin,
735 # OZ and OX directions of the working plane.
736 # @return New GEOM_Object, containing the created wire.
738 # @ref tui_sketcher_page "Example"
739 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
740 # Example: see GEOM_TestAll.py
741 theCommand,Parameters = ParseSketcherCommand(theCommand)
742 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
743 RaiseIfFailed("MakeSketcher", self.CurvesOp)
744 anObj.SetParameters(Parameters)
747 ## Create a sketcher (wire or face), following the textual description,
748 # passed through <VAR>theCommand</VAR> argument. \n
749 # For format of the description string see the previous method.\n
750 # @param theCommand String, defining the sketcher in local
751 # coordinates of the working plane.
752 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
753 # @return New GEOM_Object, containing the created wire.
755 # @ref tui_sketcher_page "Example"
756 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
757 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
758 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
764 ## @addtogroup l3_3d_primitives
767 ## Create a box by coordinates of two opposite vertices.
769 # @ref tui_creation_box "Example"
770 def MakeBox(self,x1,y1,z1,x2,y2,z2):
771 # Example: see GEOM_TestAll.py
772 pnt1 = self.MakeVertex(x1,y1,z1)
773 pnt2 = self.MakeVertex(x2,y2,z2)
774 return self.MakeBoxTwoPnt(pnt1,pnt2)
776 ## Create a box with specified dimensions along the coordinate axes
777 # and with edges, parallel to the coordinate axes.
778 # Center of the box will be at point (DX/2, DY/2, DZ/2).
779 # @param theDX Length of Box edges, parallel to OX axis.
780 # @param theDY Length of Box edges, parallel to OY axis.
781 # @param theDZ Length of Box edges, parallel to OZ axis.
782 # @return New GEOM_Object, containing the created box.
784 # @ref tui_creation_box "Example"
785 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
786 # Example: see GEOM_TestAll.py
787 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
788 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
789 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
790 anObj.SetParameters(Parameters)
793 ## Create a box with two specified opposite vertices,
794 # and with edges, parallel to the coordinate axes
795 # @param thePnt1 First of two opposite vertices.
796 # @param thePnt2 Second of two opposite vertices.
797 # @return New GEOM_Object, containing the created box.
799 # @ref tui_creation_box "Example"
800 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
801 # Example: see GEOM_TestAll.py
802 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
803 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
806 ## Create a face with specified dimensions along OX-OY coordinate axes,
807 # with edges, parallel to this coordinate axes.
808 # @param theH height of Face.
809 # @param theW width of Face.
810 # @param theOrientation orientation belong axis OXY OYZ OZX
811 # @return New GEOM_Object, containing the created face.
813 # @ref tui_creation_face "Example"
814 def MakeFaceHW(self,theH, theW, theOrientation):
815 # Example: see GEOM_TestAll.py
816 theH,theW,Parameters = ParseParameters(theH, theW)
817 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
818 RaiseIfFailed("MakeFaceHW", self.PrimOp)
819 anObj.SetParameters(Parameters)
822 ## Create a face from another plane and two sizes,
823 # vertical size and horisontal size.
824 # @param theObj Normale vector to the creating face or
826 # @param theH Height (vertical size).
827 # @param theW Width (horisontal size).
828 # @return New GEOM_Object, containing the created face.
830 # @ref tui_creation_face "Example"
831 def MakeFaceObjHW(self, theObj, theH, theW):
832 # Example: see GEOM_TestAll.py
833 theH,theW,Parameters = ParseParameters(theH, theW)
834 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
835 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
836 anObj.SetParameters(Parameters)
839 ## Create a disk with given center, normal vector and radius.
840 # @param thePnt Disk center.
841 # @param theVec Vector, normal to the plane of the disk.
842 # @param theR Disk radius.
843 # @return New GEOM_Object, containing the created disk.
845 # @ref tui_creation_disk "Example"
846 def MakeDiskPntVecR(self,thePnt, theVec, theR):
847 # Example: see GEOM_TestAll.py
848 theR,Parameters = ParseParameters(theR)
849 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
850 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
851 anObj.SetParameters(Parameters)
854 ## Create a disk, passing through three given points
855 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
856 # @return New GEOM_Object, containing the created disk.
858 # @ref tui_creation_disk "Example"
859 def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3):
860 # Example: see GEOM_TestAll.py
861 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
862 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
865 ## Create a disk with specified dimensions along OX-OY coordinate axes.
866 # @param theR Radius of Face.
867 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
868 # @return New GEOM_Object, containing the created disk.
870 # @ref tui_creation_face "Example"
871 def MakeDiskR(self,theR, theOrientation):
872 # Example: see GEOM_TestAll.py
873 theR,Parameters = ParseParameters(theR)
874 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
875 RaiseIfFailed("MakeDiskR", self.PrimOp)
876 anObj.SetParameters(Parameters)
879 ## Create a cylinder with given base point, axis, radius and height.
880 # @param thePnt Central point of cylinder base.
881 # @param theAxis Cylinder axis.
882 # @param theR Cylinder radius.
883 # @param theH Cylinder height.
884 # @return New GEOM_Object, containing the created cylinder.
886 # @ref tui_creation_cylinder "Example"
887 def MakeCylinder(self,thePnt, theAxis, theR, theH):
888 # Example: see GEOM_TestAll.py
889 theR,theH,Parameters = ParseParameters(theR, theH)
890 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
891 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
892 anObj.SetParameters(Parameters)
895 ## Create a cylinder with given radius and height at
896 # the origin of coordinate system. Axis of the cylinder
897 # will be collinear to the OZ axis of the coordinate system.
898 # @param theR Cylinder radius.
899 # @param theH Cylinder height.
900 # @return New GEOM_Object, containing the created cylinder.
902 # @ref tui_creation_cylinder "Example"
903 def MakeCylinderRH(self,theR, theH):
904 # Example: see GEOM_TestAll.py
905 theR,theH,Parameters = ParseParameters(theR, theH)
906 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
907 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
908 anObj.SetParameters(Parameters)
911 ## Create a sphere with given center and radius.
912 # @param thePnt Sphere center.
913 # @param theR Sphere radius.
914 # @return New GEOM_Object, containing the created sphere.
916 # @ref tui_creation_sphere "Example"
917 def MakeSpherePntR(self, thePnt, theR):
918 # Example: see GEOM_TestAll.py
919 theR,Parameters = ParseParameters(theR)
920 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
921 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
922 anObj.SetParameters(Parameters)
925 ## Create a sphere with given center and radius.
926 # @param x,y,z Coordinates of sphere center.
927 # @param theR Sphere radius.
928 # @return New GEOM_Object, containing the created sphere.
930 # @ref tui_creation_sphere "Example"
931 def MakeSphere(self, x, y, z, theR):
932 # Example: see GEOM_TestAll.py
933 point = self.MakeVertex(x, y, z)
934 anObj = self.MakeSpherePntR(point, theR)
937 ## Create a sphere with given radius at the origin of coordinate system.
938 # @param theR Sphere radius.
939 # @return New GEOM_Object, containing the created sphere.
941 # @ref tui_creation_sphere "Example"
942 def MakeSphereR(self, theR):
943 # Example: see GEOM_TestAll.py
944 theR,Parameters = ParseParameters(theR)
945 anObj = self.PrimOp.MakeSphereR(theR)
946 RaiseIfFailed("MakeSphereR", self.PrimOp)
947 anObj.SetParameters(Parameters)
950 ## Create a cone with given base point, axis, height and radiuses.
951 # @param thePnt Central point of the first cone base.
952 # @param theAxis Cone axis.
953 # @param theR1 Radius of the first cone base.
954 # @param theR2 Radius of the second cone base.
955 # \note If both radiuses are non-zero, the cone will be truncated.
956 # \note If the radiuses are equal, a cylinder will be created instead.
957 # @param theH Cone height.
958 # @return New GEOM_Object, containing the created cone.
960 # @ref tui_creation_cone "Example"
961 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
962 # Example: see GEOM_TestAll.py
963 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
964 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
965 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
966 anObj.SetParameters(Parameters)
969 ## Create a cone with given height and radiuses at
970 # the origin of coordinate system. Axis of the cone will
971 # be collinear to the OZ axis of the coordinate system.
972 # @param theR1 Radius of the first cone base.
973 # @param theR2 Radius of the second cone base.
974 # \note If both radiuses are non-zero, the cone will be truncated.
975 # \note If the radiuses are equal, a cylinder will be created instead.
976 # @param theH Cone height.
977 # @return New GEOM_Object, containing the created cone.
979 # @ref tui_creation_cone "Example"
980 def MakeConeR1R2H(self,theR1, theR2, theH):
981 # Example: see GEOM_TestAll.py
982 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
983 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
984 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
985 anObj.SetParameters(Parameters)
988 ## Create a torus with given center, normal vector and radiuses.
989 # @param thePnt Torus central point.
990 # @param theVec Torus axis of symmetry.
991 # @param theRMajor Torus major radius.
992 # @param theRMinor Torus minor radius.
993 # @return New GEOM_Object, containing the created torus.
995 # @ref tui_creation_torus "Example"
996 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
997 # Example: see GEOM_TestAll.py
998 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
999 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
1000 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
1001 anObj.SetParameters(Parameters)
1004 ## Create a torus with given radiuses at the origin of coordinate system.
1005 # @param theRMajor Torus major radius.
1006 # @param theRMinor Torus minor radius.
1007 # @return New GEOM_Object, containing the created torus.
1009 # @ref tui_creation_torus "Example"
1010 def MakeTorusRR(self, theRMajor, theRMinor):
1011 # Example: see GEOM_TestAll.py
1012 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1013 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
1014 RaiseIfFailed("MakeTorusRR", self.PrimOp)
1015 anObj.SetParameters(Parameters)
1018 # end of l3_3d_primitives
1021 ## @addtogroup l3_complex
1024 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
1025 # @param theBase Base shape to be extruded.
1026 # @param thePoint1 First end of extrusion vector.
1027 # @param thePoint2 Second end of extrusion vector.
1028 # @return New GEOM_Object, containing the created prism.
1030 # @ref tui_creation_prism "Example"
1031 def MakePrism(self, theBase, thePoint1, thePoint2):
1032 # Example: see GEOM_TestAll.py
1033 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
1034 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1037 ## Create a shape by extrusion of the base shape along the vector,
1038 # i.e. all the space, transfixed by the base shape during its translation
1039 # along the vector on the given distance.
1040 # @param theBase Base shape to be extruded.
1041 # @param theVec Direction of extrusion.
1042 # @param theH Prism dimension along theVec.
1043 # @return New GEOM_Object, containing the created prism.
1045 # @ref tui_creation_prism "Example"
1046 def MakePrismVecH(self, theBase, theVec, theH):
1047 # Example: see GEOM_TestAll.py
1048 theH,Parameters = ParseParameters(theH)
1049 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
1050 RaiseIfFailed("MakePrismVecH", self.PrimOp)
1051 anObj.SetParameters(Parameters)
1054 ## Create a shape by extrusion of the base shape along the vector,
1055 # i.e. all the space, transfixed by the base shape during its translation
1056 # along the vector on the given distance in 2 Ways (forward/backward) .
1057 # @param theBase Base shape to be extruded.
1058 # @param theVec Direction of extrusion.
1059 # @param theH Prism dimension along theVec in forward direction.
1060 # @return New GEOM_Object, containing the created prism.
1062 # @ref tui_creation_prism "Example"
1063 def MakePrismVecH2Ways(self, theBase, theVec, theH):
1064 # Example: see GEOM_TestAll.py
1065 theH,Parameters = ParseParameters(theH)
1066 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
1067 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
1068 anObj.SetParameters(Parameters)
1071 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1072 # @param theBase Base shape to be extruded.
1073 # @param theDX, theDY, theDZ Directions of extrusion.
1074 # @return New GEOM_Object, containing the created prism.
1076 # @ref tui_creation_prism "Example"
1077 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ):
1078 # Example: see GEOM_TestAll.py
1079 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1080 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
1081 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
1082 anObj.SetParameters(Parameters)
1085 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1086 # i.e. all the space, transfixed by the base shape during its translation
1087 # along the vector on the given distance in 2 Ways (forward/backward) .
1088 # @param theBase Base shape to be extruded.
1089 # @param theDX, theDY, theDZ Directions of extrusion.
1090 # @return New GEOM_Object, containing the created prism.
1092 # @ref tui_creation_prism "Example"
1093 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
1094 # Example: see GEOM_TestAll.py
1095 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1096 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
1097 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
1098 anObj.SetParameters(Parameters)
1101 ## Create a shape by revolution of the base shape around the axis
1102 # on the given angle, i.e. all the space, transfixed by the base
1103 # shape during its rotation around the axis on the given angle.
1104 # @param theBase Base shape to be rotated.
1105 # @param theAxis Rotation axis.
1106 # @param theAngle Rotation angle in radians.
1107 # @return New GEOM_Object, containing the created revolution.
1109 # @ref tui_creation_revolution "Example"
1110 def MakeRevolution(self, theBase, theAxis, theAngle):
1111 # Example: see GEOM_TestAll.py
1112 theAngle,Parameters = ParseParameters(theAngle)
1113 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
1114 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
1115 anObj.SetParameters(Parameters)
1118 ## The Same Revolution but in both ways forward&backward.
1119 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
1120 theAngle,Parameters = ParseParameters(theAngle)
1121 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
1122 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
1123 anObj.SetParameters(Parameters)
1126 ## Create a filling from the given compound of contours.
1127 # @param theShape the compound of contours
1128 # @param theMinDeg a minimal degree of BSpline surface to create
1129 # @param theMaxDeg a maximal degree of BSpline surface to create
1130 # @param theTol2D a 2d tolerance to be reached
1131 # @param theTol3D a 3d tolerance to be reached
1132 # @param theNbIter a number of iteration of approximation algorithm
1133 # @param isApprox if True, BSpline curves are generated in the process
1134 # of surface construction. By default it is False, that means
1135 # the surface is created using Besier curves. The usage of
1136 # Approximation makes the algorithm work slower, but allows
1137 # building the surface for rather complex cases
1138 # @return New GEOM_Object, containing the created filling surface.
1140 # @ref tui_creation_filling "Example"
1141 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
1142 # Example: see GEOM_TestAll.py
1143 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg,
1144 theTol2D, theTol3D, theNbIter)
1145 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
1146 theTol2D, theTol3D, theNbIter, isApprox)
1147 RaiseIfFailed("MakeFilling", self.PrimOp)
1148 anObj.SetParameters(Parameters)
1151 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
1152 # @param theSeqSections - set of specified sections.
1153 # @param theModeSolid - mode defining building solid or shell
1154 # @param thePreci - precision 3D used for smoothing by default 1.e-6
1155 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
1156 # @return New GEOM_Object, containing the created shell or solid.
1158 # @ref swig_todo "Example"
1159 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
1160 # Example: see GEOM_TestAll.py
1161 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
1162 RaiseIfFailed("MakeThruSections", self.PrimOp)
1165 ## Create a shape by extrusion of the base shape along
1166 # the path shape. The path shape can be a wire or an edge.
1167 # @param theBase Base shape to be extruded.
1168 # @param thePath Path shape to extrude the base shape along it.
1169 # @return New GEOM_Object, containing the created pipe.
1171 # @ref tui_creation_pipe "Example"
1172 def MakePipe(self,theBase, thePath):
1173 # Example: see GEOM_TestAll.py
1174 anObj = self.PrimOp.MakePipe(theBase, thePath)
1175 RaiseIfFailed("MakePipe", self.PrimOp)
1178 ## Create a shape by extrusion of the profile shape along
1179 # the path shape. The path shape can be a wire or an edge.
1180 # the several profiles can be specified in the several locations of path.
1181 # @param theSeqBases - list of Bases shape to be extruded.
1182 # @param theLocations - list of locations on the path corresponding
1183 # specified list of the Bases shapes. Number of locations
1184 # should be equal to number of bases or list of locations can be empty.
1185 # @param thePath - Path shape to extrude the base shape along it.
1186 # @param theWithContact - the mode defining that the section is translated to be in
1187 # contact with the spine.
1188 # @param theWithCorrection - defining that the section is rotated to be
1189 # orthogonal to the spine tangent in the correspondent point
1190 # @return New GEOM_Object, containing the created pipe.
1192 # @ref tui_creation_pipe_with_diff_sec "Example"
1193 def MakePipeWithDifferentSections(self, theSeqBases,
1194 theLocations, thePath,
1195 theWithContact, theWithCorrection):
1196 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
1197 theLocations, thePath,
1198 theWithContact, theWithCorrection)
1199 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
1202 ## Create a shape by extrusion of the profile shape along
1203 # the path shape. The path shape can be a wire or a edge.
1204 # the several profiles can be specified in the several locations of path.
1205 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
1206 # shell or face. If number of faces in neighbour sections
1207 # aren't coincided result solid between such sections will
1208 # be created using external boundaries of this shells.
1209 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
1210 # This list is used for searching correspondences between
1211 # faces in the sections. Size of this list must be equal
1212 # to size of list of base shapes.
1213 # @param theLocations - list of locations on the path corresponding
1214 # specified list of the Bases shapes. Number of locations
1215 # should be equal to number of bases. First and last
1216 # locations must be coincided with first and last vertexes
1217 # of path correspondingly.
1218 # @param thePath - Path shape to extrude the base shape along it.
1219 # @param theWithContact - the mode defining that the section is translated to be in
1220 # contact with the spine.
1221 # @param theWithCorrection - defining that the section is rotated to be
1222 # orthogonal to the spine tangent in the correspondent point
1223 # @return New GEOM_Object, containing the created solids.
1225 # @ref tui_creation_pipe_with_shell_sec "Example"
1226 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
1227 theLocations, thePath,
1228 theWithContact, theWithCorrection):
1229 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
1230 theLocations, thePath,
1231 theWithContact, theWithCorrection)
1232 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1235 ## Create a shape by extrusion of the profile shape along
1236 # the path shape. This function is used only for debug pipe
1237 # functionality - it is a version of previous function
1238 # (MakePipeWithShellSections(...)) which give a possibility to
1239 # recieve information about creating pipe between each pair of
1240 # sections step by step.
1241 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
1242 theLocations, thePath,
1243 theWithContact, theWithCorrection):
1245 nbsect = len(theSeqBases)
1246 nbsubsect = len(theSeqSubBases)
1247 #print "nbsect = ",nbsect
1248 for i in range(1,nbsect):
1250 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
1251 tmpLocations = [ theLocations[i-1], theLocations[i] ]
1253 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
1254 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
1255 tmpLocations, thePath,
1256 theWithContact, theWithCorrection)
1257 if self.PrimOp.IsDone() == 0:
1258 print "Problems with pipe creation between ",i," and ",i+1," sections"
1259 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1262 print "Pipe between ",i," and ",i+1," sections is OK"
1267 resc = self.MakeCompound(res)
1268 #resc = self.MakeSewing(res, 0.001)
1269 #print "resc: ",resc
1272 ## Create solids between given sections
1273 # @param theSeqBases - list of sections (shell or face).
1274 # @param theLocations - list of corresponding vertexes
1275 # @return New GEOM_Object, containing the created solids.
1277 # @ref tui_creation_pipe_without_path "Example"
1278 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1279 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1280 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1283 ## Create a shape by extrusion of the base shape along
1284 # the path shape with constant bi-normal direction along the given vector.
1285 # The path shape can be a wire or an edge.
1286 # @param theBase Base shape to be extruded.
1287 # @param thePath Path shape to extrude the base shape along it.
1288 # @param theVec Vector defines a constant binormal direction to keep the
1289 # same angle beetween the direction and the sections
1290 # along the sweep surface.
1291 # @return New GEOM_Object, containing the created pipe.
1293 # @ref tui_creation_pipe "Example"
1294 def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
1295 # Example: see GEOM_TestAll.py
1296 anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
1297 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
1303 ## @addtogroup l3_advanced
1306 ## Create a linear edge with specified ends.
1307 # @param thePnt1 Point for the first end of edge.
1308 # @param thePnt2 Point for the second end of edge.
1309 # @return New GEOM_Object, containing the created edge.
1311 # @ref tui_creation_edge "Example"
1312 def MakeEdge(self,thePnt1, thePnt2):
1313 # Example: see GEOM_TestAll.py
1314 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1315 RaiseIfFailed("MakeEdge", self.ShapesOp)
1318 ## Create a wire from the set of edges and wires.
1319 # @param theEdgesAndWires List of edges and/or wires.
1320 # @return New GEOM_Object, containing the created wire.
1322 # @ref tui_creation_wire "Example"
1323 def MakeWire(self,theEdgesAndWires):
1324 # Example: see GEOM_TestAll.py
1325 anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
1326 RaiseIfFailed("MakeWire", self.ShapesOp)
1329 ## Create a face on the given wire.
1330 # @param theWire closed Wire or Edge to build the face on.
1331 # @param isPlanarWanted If TRUE, only planar face will be built.
1332 # If impossible, NULL object will be returned.
1333 # @return New GEOM_Object, containing the created face.
1335 # @ref tui_creation_face "Example"
1336 def MakeFace(self,theWire, isPlanarWanted):
1337 # Example: see GEOM_TestAll.py
1338 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1339 RaiseIfFailed("MakeFace", self.ShapesOp)
1342 ## Create a face on the given wires set.
1343 # @param theWires List of closed wires or edges to build the face on.
1344 # @param isPlanarWanted If TRUE, only planar face will be built.
1345 # If impossible, NULL object will be returned.
1346 # @return New GEOM_Object, containing the created face.
1348 # @ref tui_creation_face "Example"
1349 def MakeFaceWires(self,theWires, isPlanarWanted):
1350 # Example: see GEOM_TestAll.py
1351 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1352 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1355 ## Shortcut to MakeFaceWires()
1357 # @ref tui_creation_face "Example 1"
1358 # \n @ref swig_MakeFaces "Example 2"
1359 def MakeFaces(self,theWires, isPlanarWanted):
1360 # Example: see GEOM_TestOthers.py
1361 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1364 ## Create a shell from the set of faces and shells.
1365 # @param theFacesAndShells List of faces and/or shells.
1366 # @return New GEOM_Object, containing the created shell.
1368 # @ref tui_creation_shell "Example"
1369 def MakeShell(self,theFacesAndShells):
1370 # Example: see GEOM_TestAll.py
1371 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1372 RaiseIfFailed("MakeShell", self.ShapesOp)
1375 ## Create a solid, bounded by the given shells.
1376 # @param theShells Sequence of bounding shells.
1377 # @return New GEOM_Object, containing the created solid.
1379 # @ref tui_creation_solid "Example"
1380 def MakeSolid(self,theShells):
1381 # Example: see GEOM_TestAll.py
1382 anObj = self.ShapesOp.MakeSolidShells(theShells)
1383 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1386 ## Create a compound of the given shapes.
1387 # @param theShapes List of shapes to put in compound.
1388 # @return New GEOM_Object, containing the created compound.
1390 # @ref tui_creation_compound "Example"
1391 def MakeCompound(self,theShapes):
1392 # Example: see GEOM_TestAll.py
1393 anObj = self.ShapesOp.MakeCompound(theShapes)
1394 RaiseIfFailed("MakeCompound", self.ShapesOp)
1397 # end of l3_advanced
1400 ## @addtogroup l2_measure
1403 ## Gives quantity of faces in the given shape.
1404 # @param theShape Shape to count faces of.
1405 # @return Quantity of faces.
1407 # @ref swig_NumberOfFaces "Example"
1408 def NumberOfFaces(self,theShape):
1409 # Example: see GEOM_TestOthers.py
1410 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1411 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1414 ## Gives quantity of edges in the given shape.
1415 # @param theShape Shape to count edges of.
1416 # @return Quantity of edges.
1418 # @ref swig_NumberOfEdges "Example"
1419 def NumberOfEdges(self,theShape):
1420 # Example: see GEOM_TestOthers.py
1421 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1422 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1428 ## @addtogroup l3_healing
1431 ## Reverses an orientation the given shape.
1432 # @param theShape Shape to be reversed.
1433 # @return The reversed copy of theShape.
1435 # @ref swig_ChangeOrientation "Example"
1436 def ChangeOrientation(self,theShape):
1437 # Example: see GEOM_TestAll.py
1438 anObj = self.ShapesOp.ChangeOrientation(theShape)
1439 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1442 ## Shortcut to ChangeOrientation()
1444 # @ref swig_OrientationChange "Example"
1445 def OrientationChange(self,theShape):
1446 # Example: see GEOM_TestOthers.py
1447 anObj = self.ChangeOrientation(theShape)
1453 ## @addtogroup l4_obtain
1456 ## Retrieve all free faces from the given shape.
1457 # Free face is a face, which is not shared between two shells of the shape.
1458 # @param theShape Shape to find free faces in.
1459 # @return List of IDs of all free faces, contained in theShape.
1461 # @ref tui_measurement_tools_page "Example"
1462 def GetFreeFacesIDs(self,theShape):
1463 # Example: see GEOM_TestOthers.py
1464 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1465 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1468 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1469 # @param theShape1 Shape to find sub-shapes in.
1470 # @param theShape2 Shape to find shared sub-shapes with.
1471 # @param theShapeType Type of sub-shapes to be retrieved.
1472 # @return List of sub-shapes of theShape1, shared with theShape2.
1474 # @ref swig_GetSharedShapes "Example"
1475 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1476 # Example: see GEOM_TestOthers.py
1477 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1478 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1481 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1482 # situated relatively the specified plane by the certain way,
1483 # defined through <VAR>theState</VAR> parameter.
1484 # @param theShape Shape to find sub-shapes of.
1485 # @param theShapeType Type of sub-shapes to be retrieved.
1486 # @param theAx1 Vector (or line, or linear edge), specifying normal
1487 # direction and location of the plane to find shapes on.
1488 # @param theState The state of the subshapes to find. It can be one of
1489 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1490 # @return List of all found sub-shapes.
1492 # @ref swig_GetShapesOnPlane "Example"
1493 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1494 # Example: see GEOM_TestOthers.py
1495 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1496 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1499 ## Works like the above method, but returns list of sub-shapes indices
1501 # @ref swig_GetShapesOnPlaneIDs "Example"
1502 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1503 # Example: see GEOM_TestOthers.py
1504 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1505 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1508 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1509 # situated relatively the specified plane by the certain way,
1510 # defined through <VAR>theState</VAR> parameter.
1511 # @param theShape Shape to find sub-shapes of.
1512 # @param theShapeType Type of sub-shapes to be retrieved.
1513 # @param theAx1 Vector (or line, or linear edge), specifying normal
1514 # direction of the plane to find shapes on.
1515 # @param thePnt Point specifying location of the plane to find shapes on.
1516 # @param theState The state of the subshapes to find. It can be one of
1517 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1518 # @return List of all found sub-shapes.
1520 # @ref swig_GetShapesOnPlaneWithLocation "Example"
1521 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1522 # Example: see GEOM_TestOthers.py
1523 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1524 theAx1, thePnt, theState)
1525 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1528 ## Works like the above method, but returns list of sub-shapes indices
1530 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
1531 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1532 # Example: see GEOM_TestOthers.py
1533 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1534 theAx1, thePnt, theState)
1535 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1538 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1539 # the specified cylinder by the certain way, defined through \a theState parameter.
1540 # @param theShape Shape to find sub-shapes of.
1541 # @param theShapeType Type of sub-shapes to be retrieved.
1542 # @param theAxis Vector (or line, or linear edge), specifying
1543 # axis of the cylinder to find shapes on.
1544 # @param theRadius Radius of the cylinder to find shapes on.
1545 # @param theState The state of the subshapes to find. It can be one of
1546 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1547 # @return List of all found sub-shapes.
1549 # @ref swig_GetShapesOnCylinder "Example"
1550 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1551 # Example: see GEOM_TestOthers.py
1552 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1553 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1556 ## Works like the above method, but returns list of sub-shapes indices
1558 # @ref swig_GetShapesOnCylinderIDs "Example"
1559 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1560 # Example: see GEOM_TestOthers.py
1561 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1562 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1565 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1566 # the specified sphere by the certain way, defined through \a theState parameter.
1567 # @param theShape Shape to find sub-shapes of.
1568 # @param theShapeType Type of sub-shapes to be retrieved.
1569 # @param theCenter Point, specifying center of the sphere to find shapes on.
1570 # @param theRadius Radius of the sphere to find shapes on.
1571 # @param theState The state of the subshapes to find. It can be one of
1572 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1573 # @return List of all found sub-shapes.
1575 # @ref swig_GetShapesOnSphere "Example"
1576 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1577 # Example: see GEOM_TestOthers.py
1578 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1579 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1582 ## Works like the above method, but returns list of sub-shapes indices
1584 # @ref swig_GetShapesOnSphereIDs "Example"
1585 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1586 # Example: see GEOM_TestOthers.py
1587 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1588 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1591 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1592 # the specified quadrangle by the certain way, defined through \a theState parameter.
1593 # @param theShape Shape to find sub-shapes of.
1594 # @param theShapeType Type of sub-shapes to be retrieved.
1595 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1596 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1597 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1598 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1599 # @param theState The state of the subshapes to find. It can be one of
1600 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1601 # @return List of all found sub-shapes.
1603 # @ref swig_GetShapesOnQuadrangle "Example"
1604 def GetShapesOnQuadrangle(self, theShape, theShapeType,
1605 theTopLeftPoint, theTopRigthPoint,
1606 theBottomLeftPoint, theBottomRigthPoint, theState):
1607 # Example: see GEOM_TestOthers.py
1608 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
1609 theTopLeftPoint, theTopRigthPoint,
1610 theBottomLeftPoint, theBottomRigthPoint, theState)
1611 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
1614 ## Works like the above method, but returns list of sub-shapes indices
1616 # @ref swig_GetShapesOnQuadrangleIDs "Example"
1617 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
1618 theTopLeftPoint, theTopRigthPoint,
1619 theBottomLeftPoint, theBottomRigthPoint, theState):
1620 # Example: see GEOM_TestOthers.py
1621 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
1622 theTopLeftPoint, theTopRigthPoint,
1623 theBottomLeftPoint, theBottomRigthPoint, theState)
1624 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
1627 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1628 # the specified \a theBox by the certain way, defined through \a theState parameter.
1629 # @param theBox Shape for relative comparing.
1630 # @param theShape Shape to find sub-shapes of.
1631 # @param theShapeType Type of sub-shapes to be retrieved.
1632 # @param theState The state of the subshapes to find. It can be one of
1633 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1634 # @return List of all found sub-shapes.
1636 # @ref swig_GetShapesOnBox "Example"
1637 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
1638 # Example: see GEOM_TestOthers.py
1639 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
1640 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
1643 ## Works like the above method, but returns list of sub-shapes indices
1645 # @ref swig_GetShapesOnBoxIDs "Example"
1646 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
1647 # Example: see GEOM_TestOthers.py
1648 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
1649 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
1652 ## Find in \a theShape all sub-shapes of type \a theShapeType,
1653 # situated relatively the specified \a theCheckShape by the
1654 # certain way, defined through \a theState parameter.
1655 # @param theCheckShape Shape for relative comparing.
1656 # @param theShape Shape to find sub-shapes of.
1657 # @param theShapeType Type of sub-shapes to be retrieved.
1658 # @param theState The state of the subshapes to find. It can be one of
1659 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1660 # @return List of all found sub-shapes.
1662 # @ref swig_GetShapesOnShape "Example"
1663 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
1664 # Example: see GEOM_TestOthers.py
1665 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
1666 theShapeType, theState)
1667 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
1670 ## Works like the above method, but returns result as compound
1672 # @ref swig_GetShapesOnShapeAsCompound "Example"
1673 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
1674 # Example: see GEOM_TestOthers.py
1675 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
1676 theShapeType, theState)
1677 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
1680 ## Works like the above method, but returns list of sub-shapes indices
1682 # @ref swig_GetShapesOnShapeIDs "Example"
1683 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
1684 # Example: see GEOM_TestOthers.py
1685 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
1686 theShapeType, theState)
1687 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
1690 ## Get sub-shape(s) of theShapeWhere, which are
1691 # coincident with \a theShapeWhat or could be a part of it.
1692 # @param theShapeWhere Shape to find sub-shapes of.
1693 # @param theShapeWhat Shape, specifying what to find.
1694 # @return Group of all found sub-shapes or a single found sub-shape.
1696 # @ref swig_GetInPlace "Example"
1697 def GetInPlace(self,theShapeWhere, theShapeWhat):
1698 # Example: see GEOM_TestOthers.py
1699 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
1700 RaiseIfFailed("GetInPlace", self.ShapesOp)
1703 ## Get sub-shape(s) of \a theShapeWhere, which are
1704 # coincident with \a theShapeWhat or could be a part of it.
1706 # Implementation of this method is based on a saved history of an operation,
1707 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
1708 # arguments (an argument shape or a sub-shape of an argument shape).
1709 # The operation could be the Partition or one of boolean operations,
1710 # performed on simple shapes (not on compounds).
1712 # @param theShapeWhere Shape to find sub-shapes of.
1713 # @param theShapeWhat Shape, specifying what to find (must be in the
1714 # building history of the ShapeWhere).
1715 # @return Group of all found sub-shapes or a single found sub-shape.
1717 # @ref swig_GetInPlace "Example"
1718 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
1719 # Example: see GEOM_TestOthers.py
1720 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
1721 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
1724 ## Get sub-shape of theShapeWhere, which is
1725 # equal to \a theShapeWhat.
1726 # @param theShapeWhere Shape to find sub-shape of.
1727 # @param theShapeWhat Shape, specifying what to find.
1728 # @return New GEOM_Object for found sub-shape.
1730 # @ref swig_GetSame "Example"
1731 def GetSame(self,theShapeWhere, theShapeWhat):
1732 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
1733 RaiseIfFailed("GetSame", self.ShapesOp)
1739 ## @addtogroup l4_access
1742 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
1743 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
1745 # @ref swig_all_decompose "Example"
1746 def GetSubShape(self, aShape, ListOfID):
1747 # Example: see GEOM_TestAll.py
1748 anObj = self.AddSubShape(aShape,ListOfID)
1751 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
1753 # @ref swig_all_decompose "Example"
1754 def GetSubShapeID(self, aShape, aSubShape):
1755 # Example: see GEOM_TestAll.py
1756 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
1757 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
1763 ## @addtogroup l4_decompose
1766 ## Explode a shape on subshapes of a given type.
1767 # @param aShape Shape to be exploded.
1768 # @param aType Type of sub-shapes to be retrieved.
1769 # @return List of sub-shapes of type theShapeType, contained in theShape.
1771 # @ref swig_all_decompose "Example"
1772 def SubShapeAll(self, aShape, aType):
1773 # Example: see GEOM_TestAll.py
1774 ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
1775 RaiseIfFailed("MakeExplode", self.ShapesOp)
1778 ## Explode a shape on subshapes of a given type.
1779 # @param aShape Shape to be exploded.
1780 # @param aType Type of sub-shapes to be retrieved.
1781 # @return List of IDs of sub-shapes.
1783 # @ref swig_all_decompose "Example"
1784 def SubShapeAllIDs(self, aShape, aType):
1785 ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
1786 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1789 ## Explode a shape on subshapes of a given type.
1790 # Sub-shapes will be sorted by coordinates of their gravity centers.
1791 # @param aShape Shape to be exploded.
1792 # @param aType Type of sub-shapes to be retrieved.
1793 # @return List of sub-shapes of type theShapeType, contained in theShape.
1795 # @ref swig_SubShapeAllSorted "Example"
1796 def SubShapeAllSorted(self, aShape, aType):
1797 # Example: see GEOM_TestAll.py
1798 ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
1799 RaiseIfFailed("MakeExplode", self.ShapesOp)
1802 ## Explode a shape on subshapes of a given type.
1803 # Sub-shapes will be sorted by coordinates of their gravity centers.
1804 # @param aShape Shape to be exploded.
1805 # @param aType Type of sub-shapes to be retrieved.
1806 # @return List of IDs of sub-shapes.
1808 # @ref swig_all_decompose "Example"
1809 def SubShapeAllSortedIDs(self, aShape, aType):
1810 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
1811 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
1814 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1815 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
1816 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1818 # @ref swig_all_decompose "Example"
1819 def SubShape(self, aShape, aType, ListOfInd):
1820 # Example: see GEOM_TestAll.py
1822 AllShapeList = self.SubShapeAll(aShape, aType)
1823 for ind in ListOfInd:
1824 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1825 anObj = self.GetSubShape(aShape, ListOfIDs)
1828 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
1829 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
1830 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1832 # @ref swig_all_decompose "Example"
1833 def SubShapeSorted(self,aShape, aType, ListOfInd):
1834 # Example: see GEOM_TestAll.py
1836 AllShapeList = self.SubShapeAllSorted(aShape, aType)
1837 for ind in ListOfInd:
1838 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
1839 anObj = self.GetSubShape(aShape, ListOfIDs)
1842 # end of l4_decompose
1845 ## @addtogroup l3_healing
1848 ## Apply a sequence of Shape Healing operators to the given object.
1849 # @param theShape Shape to be processed.
1850 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1851 # @param theParameters List of names of parameters
1852 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1853 # @param theValues List of values of parameters, in the same order
1854 # as parameters are listed in <VAR>theParameters</VAR> list.
1855 # @return New GEOM_Object, containing processed shape.
1857 # @ref tui_shape_processing "Example"
1858 def ProcessShape(self,theShape, theOperators, theParameters, theValues):
1859 # Example: see GEOM_TestHealing.py
1860 theValues,Parameters = ParseList(theValues)
1861 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1862 RaiseIfFailed("ProcessShape", self.HealOp)
1863 for string in (theOperators + theParameters):
1864 Parameters = ":" + Parameters
1866 anObj.SetParameters(Parameters)
1869 ## Remove faces from the given object (shape).
1870 # @param theObject Shape to be processed.
1871 # @param theFaces Indices of faces to be removed, if EMPTY then the method
1872 # removes ALL faces of the given object.
1873 # @return New GEOM_Object, containing processed shape.
1875 # @ref tui_suppress_faces "Example"
1876 def SuppressFaces(self,theObject, theFaces):
1877 # Example: see GEOM_TestHealing.py
1878 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
1879 RaiseIfFailed("SuppressFaces", self.HealOp)
1882 ## Sewing of some shapes into single shape.
1884 # @ref tui_sewing "Example"
1885 def MakeSewing(self, ListShape, theTolerance):
1886 # Example: see GEOM_TestHealing.py
1887 comp = self.MakeCompound(ListShape)
1888 anObj = self.Sew(comp, theTolerance)
1891 ## Sewing of the given object.
1892 # @param theObject Shape to be processed.
1893 # @param theTolerance Required tolerance value.
1894 # @return New GEOM_Object, containing processed shape.
1895 def Sew(self, theObject, theTolerance):
1896 # Example: see MakeSewing() above
1897 theTolerance,Parameters = ParseParameters(theTolerance)
1898 anObj = self.HealOp.Sew(theObject, theTolerance)
1899 RaiseIfFailed("Sew", self.HealOp)
1900 anObj.SetParameters(Parameters)
1903 ## Remove internal wires and edges from the given object (face).
1904 # @param theObject Shape to be processed.
1905 # @param theWires Indices of wires to be removed, if EMPTY then the method
1906 # removes ALL internal wires of the given object.
1907 # @return New GEOM_Object, containing processed shape.
1909 # @ref tui_suppress_internal_wires "Example"
1910 def SuppressInternalWires(self,theObject, theWires):
1911 # Example: see GEOM_TestHealing.py
1912 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
1913 RaiseIfFailed("RemoveIntWires", self.HealOp)
1916 ## Remove internal closed contours (holes) from the given object.
1917 # @param theObject Shape to be processed.
1918 # @param theWires Indices of wires to be removed, if EMPTY then the method
1919 # removes ALL internal holes of the given object
1920 # @return New GEOM_Object, containing processed shape.
1922 # @ref tui_suppress_holes "Example"
1923 def SuppressHoles(self,theObject, theWires):
1924 # Example: see GEOM_TestHealing.py
1925 anObj = self.HealOp.FillHoles(theObject, theWires)
1926 RaiseIfFailed("FillHoles", self.HealOp)
1929 ## Close an open wire.
1930 # @param theObject Shape to be processed.
1931 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1932 # if -1, then <VAR>theObject</VAR> itself is a wire.
1933 # @param isCommonVertex If TRUE : closure by creation of a common vertex,
1934 # If FALS : closure by creation of an edge between ends.
1935 # @return New GEOM_Object, containing processed shape.
1937 # @ref tui_close_contour "Example"
1938 def CloseContour(self,theObject, theWires, isCommonVertex):
1939 # Example: see GEOM_TestHealing.py
1940 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
1941 RaiseIfFailed("CloseContour", self.HealOp)
1944 ## Addition of a point to a given edge object.
1945 # @param theObject Shape to be processed.
1946 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
1947 # if -1, then theObject itself is the edge.
1948 # @param theValue Value of parameter on edge or length parameter,
1949 # depending on \a isByParameter.
1950 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1951 # if FALSE : \a theValue is treated as a length parameter [0..1]
1952 # @return New GEOM_Object, containing processed shape.
1954 # @ref tui_add_point_on_edge "Example"
1955 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
1956 # Example: see GEOM_TestHealing.py
1957 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
1958 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1959 RaiseIfFailed("DivideEdge", self.HealOp)
1960 anObj.SetParameters(Parameters)
1963 ## Change orientation of the given object. Updates given shape.
1964 # @param theObject Shape to be processed.
1966 # @ref swig_todo "Example"
1967 def ChangeOrientationShell(self,theObject):
1968 theObject = self.HealOp.ChangeOrientation(theObject)
1969 RaiseIfFailed("ChangeOrientation", self.HealOp)
1972 ## Change orientation of the given object.
1973 # @param theObject Shape to be processed.
1974 # @return New GEOM_Object, containing processed shape.
1976 # @ref swig_todo "Example"
1977 def ChangeOrientationShellCopy(self,theObject):
1978 anObj = self.HealOp.ChangeOrientationCopy(theObject)
1979 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
1982 ## Get a list of wires (wrapped in GEOM_Object-s),
1983 # that constitute a free boundary of the given shape.
1984 # @param theObject Shape to get free boundary of.
1985 # @return [status, theClosedWires, theOpenWires]
1986 # status: FALSE, if an error(s) occured during the method execution.
1987 # theClosedWires: Closed wires on the free boundary of the given shape.
1988 # theOpenWires: Open wires on the free boundary of the given shape.
1990 # @ref tui_measurement_tools_page "Example"
1991 def GetFreeBoundary(self,theObject):
1992 # Example: see GEOM_TestHealing.py
1993 anObj = self.HealOp.GetFreeBoundary(theObject)
1994 RaiseIfFailed("GetFreeBoundary", self.HealOp)
1997 ## Replace coincident faces in theShape by one face.
1998 # @param theShape Initial shape.
1999 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
2000 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2001 # otherwise all initial shapes.
2002 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
2004 # @ref tui_glue_faces "Example"
2005 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
2006 # Example: see GEOM_Spanner.py
2007 theTolerance,Parameters = ParseParameters(theTolerance)
2008 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
2010 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
2011 anObj.SetParameters(Parameters)
2014 ## Find coincident faces in theShape for possible gluing.
2015 # @param theShape Initial shape.
2016 # @param theTolerance Maximum distance between faces,
2017 # which can be considered as coincident.
2020 # @ref swig_todo "Example"
2021 def GetGlueFaces(self, theShape, theTolerance):
2022 # Example: see GEOM_Spanner.py
2023 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
2024 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
2027 ## Replace coincident faces in theShape by one face
2028 # in compliance with given list of faces
2029 # @param theShape Initial shape.
2030 # @param theTolerance Maximum distance between faces,
2031 # which can be considered as coincident.
2032 # @param theFaces List of faces for gluing.
2033 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2034 # otherwise all initial shapes.
2035 # @return New GEOM_Object, containing a copy of theShape
2036 # without some faces.
2038 # @ref swig_todo "Example"
2039 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
2040 # Example: see GEOM_Spanner.py
2041 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
2043 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
2049 ## @addtogroup l3_boolean Boolean Operations
2052 # -----------------------------------------------------------------------------
2053 # Boolean (Common, Cut, Fuse, Section)
2054 # -----------------------------------------------------------------------------
2056 ## Perform one of boolean operations on two given shapes.
2057 # @param theShape1 First argument for boolean operation.
2058 # @param theShape2 Second argument for boolean operation.
2059 # @param theOperation Indicates the operation to be done:
2060 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
2061 # @return New GEOM_Object, containing the result shape.
2063 # @ref tui_fuse "Example"
2064 def MakeBoolean(self,theShape1, theShape2, theOperation):
2065 # Example: see GEOM_TestAll.py
2066 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
2067 RaiseIfFailed("MakeBoolean", self.BoolOp)
2070 ## Shortcut to MakeBoolean(s1, s2, 1)
2072 # @ref tui_common "Example 1"
2073 # \n @ref swig_MakeCommon "Example 2"
2074 def MakeCommon(self, s1, s2):
2075 # Example: see GEOM_TestOthers.py
2076 return self.MakeBoolean(s1, s2, 1)
2078 ## Shortcut to MakeBoolean(s1, s2, 2)
2080 # @ref tui_cut "Example 1"
2081 # \n @ref swig_MakeCommon "Example 2"
2082 def MakeCut(self, s1, s2):
2083 # Example: see GEOM_TestOthers.py
2084 return self.MakeBoolean(s1, s2, 2)
2086 ## Shortcut to MakeBoolean(s1, s2, 3)
2088 # @ref tui_fuse "Example 1"
2089 # \n @ref swig_MakeCommon "Example 2"
2090 def MakeFuse(self, s1, s2):
2091 # Example: see GEOM_TestOthers.py
2092 return self.MakeBoolean(s1, s2, 3)
2094 ## Shortcut to MakeBoolean(s1, s2, 4)
2096 # @ref tui_section "Example 1"
2097 # \n @ref swig_MakeCommon "Example 2"
2098 def MakeSection(self, s1, s2):
2099 # Example: see GEOM_TestOthers.py
2100 return self.MakeBoolean(s1, s2, 4)
2105 ## @addtogroup l3_basic_op
2108 ## Perform partition operation.
2109 # @param ListShapes Shapes to be intersected.
2110 # @param ListTools Shapes to intersect theShapes.
2111 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
2112 # in order to avoid possible intersection between shapes from
2114 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
2115 # @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
2116 # type <= Limit are kept in the result,
2117 # else - shapes with type > Limit are kept
2118 # also (if they exist)
2120 # After implementation new version of PartitionAlgo (October 2006)
2121 # other parameters are ignored by current functionality. They are kept
2122 # in this function only for support old versions.
2123 # Ignored parameters:
2124 # @param ListKeepInside Shapes, outside which the results will be deleted.
2125 # Each shape from theKeepInside must belong to theShapes also.
2126 # @param ListRemoveInside Shapes, inside which the results will be deleted.
2127 # Each shape from theRemoveInside must belong to theShapes also.
2128 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
2129 # @param ListMaterials Material indices for each shape. Make sence,
2130 # only if theRemoveWebs is TRUE.
2132 # @return New GEOM_Object, containing the result shapes.
2134 # @ref tui_partition "Example"
2135 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2136 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
2137 KeepNonlimitShapes=0):
2138 # Example: see GEOM_TestAll.py
2139 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
2140 ListKeepInside, ListRemoveInside,
2141 Limit, RemoveWebs, ListMaterials,
2142 KeepNonlimitShapes);
2143 RaiseIfFailed("MakePartition", self.BoolOp)
2146 ## Perform partition operation.
2147 # This method may be useful if it is needed to make a partition for
2148 # compound contains nonintersected shapes. Performance will be better
2149 # since intersection between shapes from compound is not performed.
2151 # Description of all parameters as in previous method MakePartition()
2153 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
2154 # have to consist of nonintersecting shapes.
2156 # @return New GEOM_Object, containing the result shapes.
2158 # @ref swig_todo "Example"
2159 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
2160 ListKeepInside=[], ListRemoveInside=[],
2161 Limit=ShapeType["SHAPE"], RemoveWebs=0,
2162 ListMaterials=[], KeepNonlimitShapes=0):
2163 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
2164 ListKeepInside, ListRemoveInside,
2165 Limit, RemoveWebs, ListMaterials,
2166 KeepNonlimitShapes);
2167 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
2170 ## Shortcut to MakePartition()
2172 # @ref tui_partition "Example 1"
2173 # \n @ref swig_Partition "Example 2"
2174 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2175 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
2176 KeepNonlimitShapes=0):
2177 # Example: see GEOM_TestOthers.py
2178 anObj = self.MakePartition(ListShapes, ListTools,
2179 ListKeepInside, ListRemoveInside,
2180 Limit, RemoveWebs, ListMaterials,
2181 KeepNonlimitShapes);
2184 ## Perform partition of the Shape with the Plane
2185 # @param theShape Shape to be intersected.
2186 # @param thePlane Tool shape, to intersect theShape.
2187 # @return New GEOM_Object, containing the result shape.
2189 # @ref tui_partition "Example"
2190 def MakeHalfPartition(self,theShape, thePlane):
2191 # Example: see GEOM_TestAll.py
2192 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
2193 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
2196 # end of l3_basic_op
2199 ## @addtogroup l3_transform
2202 ## Translate the given object along the vector, specified
2203 # by its end points, creating its copy before the translation.
2204 # @param theObject The object to be translated.
2205 # @param thePoint1 Start point of translation vector.
2206 # @param thePoint2 End point of translation vector.
2207 # @return New GEOM_Object, containing the translated object.
2209 # @ref tui_translation "Example 1"
2210 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
2211 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
2212 # Example: see GEOM_TestAll.py
2213 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
2214 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
2217 ## Translate the given object along the vector, specified
2218 # by its components, creating its copy before the translation.
2219 # @param theObject The object to be translated.
2220 # @param theDX,theDY,theDZ Components of translation vector.
2221 # @return New GEOM_Object, containing the translated object.
2223 # @ref tui_translation "Example"
2224 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
2225 # Example: see GEOM_TestAll.py
2226 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2227 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
2228 anObj.SetParameters(Parameters)
2229 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2232 ## Translate the given object along the given vector,
2233 # creating its copy before the translation.
2234 # @param theObject The object to be translated.
2235 # @param theVector The translation vector.
2236 # @return New GEOM_Object, containing the translated object.
2238 # @ref tui_translation "Example"
2239 def MakeTranslationVector(self,theObject, theVector):
2240 # Example: see GEOM_TestAll.py
2241 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
2242 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
2245 ## Translate the given object along the given vector on given distance,
2246 # creating its copy before the translation.
2247 # @param theObject The object to be translated.
2248 # @param theVector The translation vector.
2249 # @param theDistance The translation distance.
2250 # @return New GEOM_Object, containing the translated object.
2252 # @ref tui_translation "Example"
2253 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
2254 # Example: see GEOM_TestAll.py
2255 theDistance,Parameters = ParseParameters(theDistance)
2256 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
2257 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2258 anObj.SetParameters(Parameters)
2261 ## Rotate the given object around the given axis
2262 # on the given angle, creating its copy before the rotatation.
2263 # @param theObject The object to be rotated.
2264 # @param theAxis Rotation axis.
2265 # @param theAngle Rotation angle in radians.
2266 # @return New GEOM_Object, containing the rotated object.
2268 # @ref tui_rotation "Example"
2269 def MakeRotation(self,theObject, theAxis, theAngle):
2270 # Example: see GEOM_TestAll.py
2272 if isinstance(theAngle,str):
2274 theAngle, Parameters = ParseParameters(theAngle)
2276 theAngle = theAngle*math.pi/180.0
2277 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
2278 RaiseIfFailed("RotateCopy", self.TrsfOp)
2279 anObj.SetParameters(Parameters)
2282 ## Rotate given object around vector perpendicular to plane
2283 # containing three points, creating its copy before the rotatation.
2284 # @param theObject The object to be rotated.
2285 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
2286 # containing the three points.
2287 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
2288 # @return New GEOM_Object, containing the rotated object.
2290 # @ref tui_rotation "Example"
2291 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
2292 # Example: see GEOM_TestAll.py
2293 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
2294 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
2297 ## Scale the given object by the factor, creating its copy before the scaling.
2298 # @param theObject The object to be scaled.
2299 # @param thePoint Center point for scaling.
2300 # Passing None for it means scaling relatively the origin of global CS.
2301 # @param theFactor Scaling factor value.
2302 # @return New GEOM_Object, containing the scaled shape.
2304 # @ref tui_scale "Example"
2305 def MakeScaleTransform(self, theObject, thePoint, theFactor):
2306 # Example: see GEOM_TestAll.py
2307 theFactor, Parameters = ParseParameters(theFactor)
2308 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
2309 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
2310 anObj.SetParameters(Parameters)
2313 ## Scale the given object by different factors along coordinate axes,
2314 # creating its copy before the scaling.
2315 # @param theObject The object to be scaled.
2316 # @param thePoint Center point for scaling.
2317 # Passing None for it means scaling relatively the origin of global CS.
2318 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
2319 # @return New GEOM_Object, containing the scaled shape.
2321 # @ref swig_scale "Example"
2322 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
2323 # Example: see GEOM_TestAll.py
2324 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
2325 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
2326 theFactorX, theFactorY, theFactorZ)
2327 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
2328 anObj.SetParameters(Parameters)
2331 ## Create an object, symmetrical
2332 # to the given one relatively the given plane.
2333 # @param theObject The object to be mirrored.
2334 # @param thePlane Plane of symmetry.
2335 # @return New GEOM_Object, containing the mirrored shape.
2337 # @ref tui_mirror "Example"
2338 def MakeMirrorByPlane(self,theObject, thePlane):
2339 # Example: see GEOM_TestAll.py
2340 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
2341 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
2344 ## Create an object, symmetrical
2345 # to the given one relatively the given axis.
2346 # @param theObject The object to be mirrored.
2347 # @param theAxis Axis of symmetry.
2348 # @return New GEOM_Object, containing the mirrored shape.
2350 # @ref tui_mirror "Example"
2351 def MakeMirrorByAxis(self,theObject, theAxis):
2352 # Example: see GEOM_TestAll.py
2353 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
2354 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
2357 ## Create an object, symmetrical
2358 # to the given one relatively the given point.
2359 # @param theObject The object to be mirrored.
2360 # @param thePoint Point of symmetry.
2361 # @return New GEOM_Object, containing the mirrored shape.
2363 # @ref tui_mirror "Example"
2364 def MakeMirrorByPoint(self,theObject, thePoint):
2365 # Example: see GEOM_TestAll.py
2366 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
2367 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
2370 ## Modify the Location of the given object by LCS,
2371 # creating its copy before the setting.
2372 # @param theObject The object to be displaced.
2373 # @param theStartLCS Coordinate system to perform displacement from it.
2374 # If \a theStartLCS is NULL, displacement
2375 # will be performed from global CS.
2376 # If \a theObject itself is used as \a theStartLCS,
2377 # its location will be changed to \a theEndLCS.
2378 # @param theEndLCS Coordinate system to perform displacement to it.
2379 # @return New GEOM_Object, containing the displaced shape.
2381 # @ref tui_modify_location "Example"
2382 def MakePosition(self,theObject, theStartLCS, theEndLCS):
2383 # Example: see GEOM_TestAll.py
2384 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
2385 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
2388 ## Create new object as offset of the given one.
2389 # @param theObject The base object for the offset.
2390 # @param theOffset Offset value.
2391 # @return New GEOM_Object, containing the offset object.
2393 # @ref tui_offset "Example"
2394 def MakeOffset(self,theObject, theOffset):
2395 # Example: see GEOM_TestAll.py
2396 theOffset, Parameters = ParseParameters(theOffset)
2397 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
2398 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
2399 anObj.SetParameters(Parameters)
2402 # -----------------------------------------------------------------------------
2404 # -----------------------------------------------------------------------------
2406 ## Translate the given object along the given vector a given number times
2407 # @param theObject The object to be translated.
2408 # @param theVector Direction of the translation.
2409 # @param theStep Distance to translate on.
2410 # @param theNbTimes Quantity of translations to be done.
2411 # @return New GEOM_Object, containing compound of all
2412 # the shapes, obtained after each translation.
2414 # @ref tui_multi_translation "Example"
2415 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
2416 # Example: see GEOM_TestAll.py
2417 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
2418 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
2419 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
2420 anObj.SetParameters(Parameters)
2423 ## Conseqently apply two specified translations to theObject specified number of times.
2424 # @param theObject The object to be translated.
2425 # @param theVector1 Direction of the first translation.
2426 # @param theStep1 Step of the first translation.
2427 # @param theNbTimes1 Quantity of translations to be done along theVector1.
2428 # @param theVector2 Direction of the second translation.
2429 # @param theStep2 Step of the second translation.
2430 # @param theNbTimes2 Quantity of translations to be done along theVector2.
2431 # @return New GEOM_Object, containing compound of all
2432 # the shapes, obtained after each translation.
2434 # @ref tui_multi_translation "Example"
2435 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
2436 theVector2, theStep2, theNbTimes2):
2437 # Example: see GEOM_TestAll.py
2438 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
2439 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
2440 theVector2, theStep2, theNbTimes2)
2441 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
2442 anObj.SetParameters(Parameters)
2445 ## Rotate the given object around the given axis a given number times.
2446 # Rotation angle will be 2*PI/theNbTimes.
2447 # @param theObject The object to be rotated.
2448 # @param theAxis The rotation axis.
2449 # @param theNbTimes Quantity of rotations to be done.
2450 # @return New GEOM_Object, containing compound of all the
2451 # shapes, obtained after each rotation.
2453 # @ref tui_multi_rotation "Example"
2454 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
2455 # Example: see GEOM_TestAll.py
2456 theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
2457 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
2458 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
2459 anObj.SetParameters(Parameters)
2462 ## Rotate the given object around the
2463 # given axis on the given angle a given number
2464 # times and multi-translate each rotation result.
2465 # Translation direction passes through center of gravity
2466 # of rotated shape and its projection on the rotation axis.
2467 # @param theObject The object to be rotated.
2468 # @param theAxis Rotation axis.
2469 # @param theAngle Rotation angle in graduces.
2470 # @param theNbTimes1 Quantity of rotations to be done.
2471 # @param theStep Translation distance.
2472 # @param theNbTimes2 Quantity of translations to be done.
2473 # @return New GEOM_Object, containing compound of all the
2474 # shapes, obtained after each transformation.
2476 # @ref tui_multi_rotation "Example"
2477 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
2478 # Example: see GEOM_TestAll.py
2479 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
2480 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
2481 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
2482 anObj.SetParameters(Parameters)
2485 ## The same, as MultiRotate1D(), but axis is given by direction and point
2486 # @ref swig_MakeMultiRotation "Example"
2487 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
2488 # Example: see GEOM_TestOthers.py
2489 aVec = self.MakeLine(aPoint,aDir)
2490 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
2493 ## The same, as MultiRotate2D(), but axis is given by direction and point
2494 # @ref swig_MakeMultiRotation "Example"
2495 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
2496 # Example: see GEOM_TestOthers.py
2497 aVec = self.MakeLine(aPoint,aDir)
2498 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
2501 # end of l3_transform
2504 ## @addtogroup l3_local
2507 ## Perform a fillet on all edges of the given shape.
2508 # @param theShape Shape, to perform fillet on.
2509 # @param theR Fillet radius.
2510 # @return New GEOM_Object, containing the result shape.
2512 # @ref tui_fillet "Example 1"
2513 # \n @ref swig_MakeFilletAll "Example 2"
2514 def MakeFilletAll(self,theShape, theR):
2515 # Example: see GEOM_TestOthers.py
2516 theR,Parameters = ParseParameters(theR)
2517 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
2518 RaiseIfFailed("MakeFilletAll", self.LocalOp)
2519 anObj.SetParameters(Parameters)
2522 ## Perform a fillet on the specified edges/faces of the given shape
2523 # @param theShape Shape, to perform fillet on.
2524 # @param theR Fillet radius.
2525 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
2526 # @param theListShapes Global indices of edges/faces to perform fillet on.
2527 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2528 # @return New GEOM_Object, containing the result shape.
2530 # @ref tui_fillet "Example"
2531 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
2532 # Example: see GEOM_TestAll.py
2533 theR,Parameters = ParseParameters(theR)
2535 if theShapeType == ShapeType["EDGE"]:
2536 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
2537 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
2539 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
2540 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
2541 anObj.SetParameters(Parameters)
2544 ## The same that MakeFillet but with two Fillet Radius R1 and R2
2545 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
2546 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
2548 if theShapeType == ShapeType["EDGE"]:
2549 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
2550 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
2552 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
2553 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
2554 anObj.SetParameters(Parameters)
2557 ## Perform a symmetric chamfer on all edges of the given shape.
2558 # @param theShape Shape, to perform chamfer on.
2559 # @param theD Chamfer size along each face.
2560 # @return New GEOM_Object, containing the result shape.
2562 # @ref tui_chamfer "Example 1"
2563 # \n @ref swig_MakeChamferAll "Example 2"
2564 def MakeChamferAll(self,theShape, theD):
2565 # Example: see GEOM_TestOthers.py
2566 theD,Parameters = ParseParameters(theD)
2567 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
2568 RaiseIfFailed("MakeChamferAll", self.LocalOp)
2569 anObj.SetParameters(Parameters)
2572 ## Perform a chamfer on edges, common to the specified faces,
2573 # with distance D1 on the Face1
2574 # @param theShape Shape, to perform chamfer on.
2575 # @param theD1 Chamfer size along \a theFace1.
2576 # @param theD2 Chamfer size along \a theFace2.
2577 # @param theFace1,theFace2 Global indices of two 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 MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
2583 # Example: see GEOM_TestAll.py
2584 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2585 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
2586 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
2587 anObj.SetParameters(Parameters)
2590 ## The Same that MakeChamferEdge but with params theD is chamfer length and
2591 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2592 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
2594 if isinstance(theAngle,str):
2596 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2598 theAngle = theAngle*math.pi/180.0
2599 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
2600 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
2601 anObj.SetParameters(Parameters)
2604 ## Perform a chamfer on all edges of the specified faces,
2605 # with distance D1 on the first specified face (if several for one edge)
2606 # @param theShape Shape, to perform chamfer on.
2607 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
2608 # connected to the edge, are in \a theFaces, \a theD1
2609 # will be get along face, which is nearer to \a theFaces beginning.
2610 # @param theD2 Chamfer size along another of two faces, connected to the edge.
2611 # @param theFaces Sequence of global indices of faces of \a theShape.
2612 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2613 # @return New GEOM_Object, containing the result shape.
2615 # @ref tui_chamfer "Example"
2616 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
2617 # Example: see GEOM_TestAll.py
2618 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2619 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
2620 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
2621 anObj.SetParameters(Parameters)
2624 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
2625 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2627 # @ref swig_FilletChamfer "Example"
2628 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
2630 if isinstance(theAngle,str):
2632 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2634 theAngle = theAngle*math.pi/180.0
2635 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
2636 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
2637 anObj.SetParameters(Parameters)
2640 ## Perform a chamfer on edges,
2641 # with distance D1 on the first specified face (if several for one edge)
2642 # @param theShape Shape, to perform chamfer on.
2643 # @param theD1,theD2 Chamfer size
2644 # @param theEdges Sequence of edges of \a theShape.
2645 # @return New GEOM_Object, containing the result shape.
2647 # @ref swig_FilletChamfer "Example"
2648 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
2649 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2650 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
2651 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
2652 anObj.SetParameters(Parameters)
2655 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
2656 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2657 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
2659 if isinstance(theAngle,str):
2661 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2663 theAngle = theAngle*math.pi/180.0
2664 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
2665 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
2666 anObj.SetParameters(Parameters)
2669 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
2671 # @ref swig_MakeChamfer "Example"
2672 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
2673 # Example: see GEOM_TestOthers.py
2675 if aShapeType == ShapeType["EDGE"]:
2676 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
2678 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
2684 ## @addtogroup l3_basic_op
2687 ## Perform an Archimde operation on the given shape with given parameters.
2688 # The object presenting the resulting face is returned.
2689 # @param theShape Shape to be put in water.
2690 # @param theWeight Weight og the shape.
2691 # @param theWaterDensity Density of the water.
2692 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
2693 # @return New GEOM_Object, containing a section of \a theShape
2694 # by a plane, corresponding to water level.
2696 # @ref tui_archimede "Example"
2697 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
2698 # Example: see GEOM_TestAll.py
2699 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
2700 theWeight,theWaterDensity,theMeshDeflection)
2701 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
2702 RaiseIfFailed("MakeArchimede", self.LocalOp)
2703 anObj.SetParameters(Parameters)
2706 # end of l3_basic_op
2709 ## @addtogroup l2_measure
2712 ## Get point coordinates
2715 # @ref tui_measurement_tools_page "Example"
2716 def PointCoordinates(self,Point):
2717 # Example: see GEOM_TestMeasures.py
2718 aTuple = self.MeasuOp.PointCoordinates(Point)
2719 RaiseIfFailed("PointCoordinates", self.MeasuOp)
2722 ## Get summarized length of all wires,
2723 # area of surface and volume of the given shape.
2724 # @param theShape Shape to define properties of.
2725 # @return [theLength, theSurfArea, theVolume]
2726 # theLength: Summarized length of all wires of the given shape.
2727 # theSurfArea: Area of surface of the given shape.
2728 # theVolume: Volume of the given shape.
2730 # @ref tui_measurement_tools_page "Example"
2731 def BasicProperties(self,theShape):
2732 # Example: see GEOM_TestMeasures.py
2733 aTuple = self.MeasuOp.GetBasicProperties(theShape)
2734 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
2737 ## Get parameters of bounding box of the given shape
2738 # @param theShape Shape to obtain bounding box of.
2739 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
2740 # Xmin,Xmax: Limits of shape along OX axis.
2741 # Ymin,Ymax: Limits of shape along OY axis.
2742 # Zmin,Zmax: Limits of shape along OZ axis.
2744 # @ref tui_measurement_tools_page "Example"
2745 def BoundingBox(self,theShape):
2746 # Example: see GEOM_TestMeasures.py
2747 aTuple = self.MeasuOp.GetBoundingBox(theShape)
2748 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
2751 ## Get inertia matrix and moments of inertia of theShape.
2752 # @param theShape Shape to calculate inertia of.
2753 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
2754 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
2755 # Ix,Iy,Iz: Moments of inertia of the given shape.
2757 # @ref tui_measurement_tools_page "Example"
2758 def Inertia(self,theShape):
2759 # Example: see GEOM_TestMeasures.py
2760 aTuple = self.MeasuOp.GetInertia(theShape)
2761 RaiseIfFailed("GetInertia", self.MeasuOp)
2764 ## Get minimal distance between the given shapes.
2765 # @param theShape1,theShape2 Shapes to find minimal distance between.
2766 # @return Value of the minimal distance between the given shapes.
2768 # @ref tui_measurement_tools_page "Example"
2769 def MinDistance(self, theShape1, theShape2):
2770 # Example: see GEOM_TestMeasures.py
2771 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2772 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2775 ## Get minimal distance between the given shapes.
2776 # @param theShape1,theShape2 Shapes to find minimal distance between.
2777 # @return Value of the minimal distance between the given shapes.
2779 # @ref swig_all_measure "Example"
2780 def MinDistanceComponents(self, theShape1, theShape2):
2781 # Example: see GEOM_TestMeasures.py
2782 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2783 RaiseIfFailed("GetMinDistance", self.MeasuOp)
2784 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
2787 ## Get angle between the given shapes in degrees.
2788 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2789 # @return Value of the angle between the given shapes in degrees.
2791 # @ref tui_measurement_tools_page "Example"
2792 def GetAngle(self, theShape1, theShape2):
2793 # Example: see GEOM_TestMeasures.py
2794 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
2795 RaiseIfFailed("GetAngle", self.MeasuOp)
2797 ## Get angle between the given shapes in radians.
2798 # @param theShape1,theShape2 Lines or linear edges to find angle between.
2799 # @return Value of the angle between the given shapes in radians.
2801 # @ref tui_measurement_tools_page "Example"
2802 def GetAngleRadians(self, theShape1, theShape2):
2803 # Example: see GEOM_TestMeasures.py
2804 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
2805 RaiseIfFailed("GetAngle", self.MeasuOp)
2808 ## @name Curve Curvature Measurement
2809 # Methods for receiving radius of curvature of curves
2810 # in the given point
2813 ## Measure curvature of a curve at a point, set by parameter.
2814 # @ref swig_todo "Example"
2815 def CurveCurvatureByParam(self, theCurve, theParam):
2816 # Example: see GEOM_TestMeasures.py
2817 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
2818 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
2822 # @ref swig_todo "Example"
2823 def CurveCurvatureByPoint(self, theCurve, thePoint):
2824 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
2825 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
2829 ## @name Surface Curvature Measurement
2830 # Methods for receiving max and min radius of curvature of surfaces
2831 # in the given point
2835 ## @ref swig_todo "Example"
2836 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2837 # Example: see GEOM_TestMeasures.py
2838 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2839 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
2843 ## @ref swig_todo "Example"
2844 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
2845 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
2846 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
2850 ## @ref swig_todo "Example"
2851 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
2852 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
2853 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
2857 ## @ref swig_todo "Example"
2858 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
2859 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
2860 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
2864 ## Get min and max tolerances of sub-shapes of theShape
2865 # @param theShape Shape, to get tolerances of.
2866 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
2867 # FaceMin,FaceMax: Min and max tolerances of the faces.
2868 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
2869 # VertMin,VertMax: Min and max tolerances of the vertices.
2871 # @ref tui_measurement_tools_page "Example"
2872 def Tolerance(self,theShape):
2873 # Example: see GEOM_TestMeasures.py
2874 aTuple = self.MeasuOp.GetTolerance(theShape)
2875 RaiseIfFailed("GetTolerance", self.MeasuOp)
2878 ## Obtain description of the given shape (number of sub-shapes of each type)
2879 # @param theShape Shape to be described.
2880 # @return Description of the given shape.
2882 # @ref tui_measurement_tools_page "Example"
2883 def WhatIs(self,theShape):
2884 # Example: see GEOM_TestMeasures.py
2885 aDescr = self.MeasuOp.WhatIs(theShape)
2886 RaiseIfFailed("WhatIs", self.MeasuOp)
2889 ## Get a point, situated at the centre of mass of theShape.
2890 # @param theShape Shape to define centre of mass of.
2891 # @return New GEOM_Object, containing the created point.
2893 # @ref tui_measurement_tools_page "Example"
2894 def MakeCDG(self,theShape):
2895 # Example: see GEOM_TestMeasures.py
2896 anObj = self.MeasuOp.GetCentreOfMass(theShape)
2897 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
2900 ## Get a normale to the given face. If the point is not given,
2901 # the normale is calculated at the center of mass.
2902 # @param theFace Face to define normale of.
2903 # @param theOptionalPoint Point to compute the normale at.
2904 # @return New GEOM_Object, containing the created vector.
2906 # @ref swig_todo "Example"
2907 def GetNormal(self, theFace, theOptionalPoint = None):
2908 # Example: see GEOM_TestMeasures.py
2909 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
2910 RaiseIfFailed("GetNormal", self.MeasuOp)
2913 ## Check a topology of the given shape.
2914 # @param theShape Shape to check validity of.
2915 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
2916 # if TRUE, the shape's geometry will be checked also.
2917 # @return TRUE, if the shape "seems to be valid".
2918 # If theShape is invalid, prints a description of problem.
2920 # @ref tui_measurement_tools_page "Example"
2921 def CheckShape(self,theShape, theIsCheckGeom = 0):
2922 # Example: see GEOM_TestMeasures.py
2924 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
2925 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
2927 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
2928 RaiseIfFailed("CheckShape", self.MeasuOp)
2933 ## Get position (LCS) of theShape.
2935 # Origin of the LCS is situated at the shape's center of mass.
2936 # Axes of the LCS are obtained from shape's location or,
2937 # if the shape is a planar face, from position of its plane.
2939 # @param theShape Shape to calculate position of.
2940 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
2941 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
2942 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
2943 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
2945 # @ref swig_todo "Example"
2946 def GetPosition(self,theShape):
2947 # Example: see GEOM_TestMeasures.py
2948 aTuple = self.MeasuOp.GetPosition(theShape)
2949 RaiseIfFailed("GetPosition", self.MeasuOp)
2952 ## Get kind of theShape.
2954 # @param theShape Shape to get a kind of.
2955 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
2956 # and a list of parameters, describing the shape.
2957 # @note Concrete meaning of each value, returned via \a theIntegers
2958 # or \a theDoubles list depends on the kind of the shape.
2959 # The full list of possible outputs is:
2961 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
2962 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
2964 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
2965 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
2967 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
2968 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
2970 # - geompy.kind.SPHERE xc yc zc R
2971 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
2972 # - geompy.kind.BOX xc yc zc ax ay az
2973 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
2974 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
2975 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
2976 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
2977 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
2979 # - geompy.kind.SPHERE2D xc yc zc R
2980 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
2981 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
2982 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
2983 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
2984 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
2985 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
2986 # - geompy.kind.PLANE xo yo zo dx dy dz
2987 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
2988 # - geompy.kind.FACE nb_edges nb_vertices
2990 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
2991 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
2992 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
2993 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
2994 # - geompy.kind.LINE xo yo zo dx dy dz
2995 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
2996 # - geompy.kind.EDGE nb_vertices
2998 # - geompy.kind.VERTEX x y z
3000 # @ref swig_todo "Example"
3001 def KindOfShape(self,theShape):
3002 # Example: see GEOM_TestMeasures.py
3003 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
3004 RaiseIfFailed("KindOfShape", self.MeasuOp)
3006 aKind = aRoughTuple[0]
3007 anInts = aRoughTuple[1]
3008 aDbls = aRoughTuple[2]
3010 # Now there is no exception from this rule:
3011 aKindTuple = [aKind] + aDbls + anInts
3013 # If they are we will regroup parameters for such kind of shape.
3015 #if aKind == kind.SOME_KIND:
3016 # # SOME_KIND int int double int double double
3017 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
3024 ## @addtogroup l2_import_export
3027 ## Import a shape from the BREP or IGES or STEP file
3028 # (depends on given format) with given name.
3029 # @param theFileName The file, containing the shape.
3030 # @param theFormatName Specify format for the file reading.
3031 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3032 # @return New GEOM_Object, containing the imported shape.
3034 # @ref swig_Import_Export "Example"
3035 def Import(self,theFileName, theFormatName):
3036 # Example: see GEOM_TestOthers.py
3037 anObj = self.InsertOp.Import(theFileName, theFormatName)
3038 RaiseIfFailed("Import", self.InsertOp)
3041 ## Shortcut to Import() for BREP format
3043 # @ref swig_Import_Export "Example"
3044 def ImportBREP(self,theFileName):
3045 # Example: see GEOM_TestOthers.py
3046 return self.Import(theFileName, "BREP")
3048 ## Shortcut to Import() for IGES format
3050 # @ref swig_Import_Export "Example"
3051 def ImportIGES(self,theFileName):
3052 # Example: see GEOM_TestOthers.py
3053 return self.Import(theFileName, "IGES")
3055 ## Shortcut to Import() for STEP format
3057 # @ref swig_Import_Export "Example"
3058 def ImportSTEP(self,theFileName):
3059 # Example: see GEOM_TestOthers.py
3060 return self.Import(theFileName, "STEP")
3062 ## Export the given shape into a file with given name.
3063 # @param theObject Shape to be stored in the file.
3064 # @param theFileName Name of the file to store the given shape in.
3065 # @param theFormatName Specify format for the shape storage.
3066 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3068 # @ref swig_Import_Export "Example"
3069 def Export(self,theObject, theFileName, theFormatName):
3070 # Example: see GEOM_TestOthers.py
3071 self.InsertOp.Export(theObject, theFileName, theFormatName)
3072 if self.InsertOp.IsDone() == 0:
3073 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
3077 ## Shortcut to Export() for BREP format
3079 # @ref swig_Import_Export "Example"
3080 def ExportBREP(self,theObject, theFileName):
3081 # Example: see GEOM_TestOthers.py
3082 return self.Export(theObject, theFileName, "BREP")
3084 ## Shortcut to Export() for IGES format
3086 # @ref swig_Import_Export "Example"
3087 def ExportIGES(self,theObject, theFileName):
3088 # Example: see GEOM_TestOthers.py
3089 return self.Export(theObject, theFileName, "IGES")
3091 ## Shortcut to Export() for STEP format
3093 # @ref swig_Import_Export "Example"
3094 def ExportSTEP(self,theObject, theFileName):
3095 # Example: see GEOM_TestOthers.py
3096 return self.Export(theObject, theFileName, "STEP")
3098 # end of l2_import_export
3101 ## @addtogroup l3_blocks
3104 ## Create a quadrangle face from four edges. Order of Edges is not
3105 # important. It is not necessary that edges share the same vertex.
3106 # @param E1,E2,E3,E4 Edges for the face bound.
3107 # @return New GEOM_Object, containing the created face.
3109 # @ref tui_building_by_blocks_page "Example"
3110 def MakeQuad(self,E1, E2, E3, E4):
3111 # Example: see GEOM_Spanner.py
3112 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
3113 RaiseIfFailed("MakeQuad", self.BlocksOp)
3116 ## Create a quadrangle face on two edges.
3117 # The missing edges will be built by creating the shortest ones.
3118 # @param E1,E2 Two opposite edges for the face.
3119 # @return New GEOM_Object, containing the created face.
3121 # @ref tui_building_by_blocks_page "Example"
3122 def MakeQuad2Edges(self,E1, E2):
3123 # Example: see GEOM_Spanner.py
3124 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
3125 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
3128 ## Create a quadrangle face with specified corners.
3129 # The missing edges will be built by creating the shortest ones.
3130 # @param V1,V2,V3,V4 Corner vertices for the face.
3131 # @return New GEOM_Object, containing the created face.
3133 # @ref tui_building_by_blocks_page "Example 1"
3134 # \n @ref swig_MakeQuad4Vertices "Example 2"
3135 def MakeQuad4Vertices(self,V1, V2, V3, V4):
3136 # Example: see GEOM_Spanner.py
3137 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
3138 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
3141 ## Create a hexahedral solid, bounded by the six given faces. Order of
3142 # faces is not important. It is not necessary that Faces share the same edge.
3143 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
3144 # @return New GEOM_Object, containing the created solid.
3146 # @ref tui_building_by_blocks_page "Example 1"
3147 # \n @ref swig_MakeHexa "Example 2"
3148 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
3149 # Example: see GEOM_Spanner.py
3150 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
3151 RaiseIfFailed("MakeHexa", self.BlocksOp)
3154 ## Create a hexahedral solid between two given faces.
3155 # The missing faces will be built by creating the smallest ones.
3156 # @param F1,F2 Two opposite faces for the hexahedral solid.
3157 # @return New GEOM_Object, containing the created solid.
3159 # @ref tui_building_by_blocks_page "Example 1"
3160 # \n @ref swig_MakeHexa2Faces "Example 2"
3161 def MakeHexa2Faces(self,F1, F2):
3162 # Example: see GEOM_Spanner.py
3163 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
3164 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
3170 ## @addtogroup l3_blocks_op
3173 ## Get a vertex, found in the given shape by its coordinates.
3174 # @param theShape Block or a compound of blocks.
3175 # @param theX,theY,theZ Coordinates of the sought vertex.
3176 # @param theEpsilon Maximum allowed distance between the resulting
3177 # vertex and point with the given coordinates.
3178 # @return New GEOM_Object, containing the found vertex.
3180 # @ref swig_GetPoint "Example"
3181 def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
3182 # Example: see GEOM_TestOthers.py
3183 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
3184 RaiseIfFailed("GetPoint", self.BlocksOp)
3187 ## Get an edge, found in the given shape by two given vertices.
3188 # @param theShape Block or a compound of blocks.
3189 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
3190 # @return New GEOM_Object, containing the found edge.
3192 # @ref swig_todo "Example"
3193 def GetEdge(self,theShape, thePoint1, thePoint2):
3194 # Example: see GEOM_Spanner.py
3195 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
3196 RaiseIfFailed("GetEdge", self.BlocksOp)
3199 ## Find an edge of the given shape, which has minimal distance to the given point.
3200 # @param theShape Block or a compound of blocks.
3201 # @param thePoint Point, close to the desired edge.
3202 # @return New GEOM_Object, containing the found edge.
3204 # @ref swig_GetEdgeNearPoint "Example"
3205 def GetEdgeNearPoint(self,theShape, thePoint):
3206 # Example: see GEOM_TestOthers.py
3207 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
3208 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
3211 ## Returns a face, found in the given shape by four given corner vertices.
3212 # @param theShape Block or a compound of blocks.
3213 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
3214 # @return New GEOM_Object, containing the found face.
3216 # @ref swig_todo "Example"
3217 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
3218 # Example: see GEOM_Spanner.py
3219 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
3220 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
3223 ## Get a face of block, found in the given shape by two given edges.
3224 # @param theShape Block or a compound of blocks.
3225 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
3226 # @return New GEOM_Object, containing the found face.
3228 # @ref swig_todo "Example"
3229 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
3230 # Example: see GEOM_Spanner.py
3231 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
3232 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
3235 ## Find a face, opposite to the given one in the given block.
3236 # @param theBlock Must be a hexahedral solid.
3237 # @param theFace Face of \a theBlock, opposite to the desired face.
3238 # @return New GEOM_Object, containing the found face.
3240 # @ref swig_GetOppositeFace "Example"
3241 def GetOppositeFace(self,theBlock, theFace):
3242 # Example: see GEOM_Spanner.py
3243 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
3244 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
3247 ## Find a face of the given shape, which has minimal distance to the given point.
3248 # @param theShape Block or a compound of blocks.
3249 # @param thePoint Point, close to the desired face.
3250 # @return New GEOM_Object, containing the found face.
3252 # @ref swig_GetFaceNearPoint "Example"
3253 def GetFaceNearPoint(self,theShape, thePoint):
3254 # Example: see GEOM_Spanner.py
3255 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
3256 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
3259 ## Find a face of block, whose outside normale has minimal angle with the given vector.
3260 # @param theBlock Block or a compound of blocks.
3261 # @param theVector Vector, close to the normale of the desired face.
3262 # @return New GEOM_Object, containing the found face.
3264 # @ref swig_todo "Example"
3265 def GetFaceByNormale(self, theBlock, theVector):
3266 # Example: see GEOM_Spanner.py
3267 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
3268 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
3271 # end of l3_blocks_op
3274 ## @addtogroup l4_blocks_measure
3277 ## Check, if the compound of blocks is given.
3278 # To be considered as a compound of blocks, the
3279 # given shape must satisfy the following conditions:
3280 # - Each element of the compound should be a Block (6 faces and 12 edges).
3281 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
3282 # - The compound should be connexe.
3283 # - The glue between two quadrangle faces should be applied.
3284 # @param theCompound The compound to check.
3285 # @return TRUE, if the given shape is a compound of blocks.
3286 # If theCompound is not valid, prints all discovered errors.
3288 # @ref tui_measurement_tools_page "Example 1"
3289 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
3290 def CheckCompoundOfBlocks(self,theCompound):
3291 # Example: see GEOM_Spanner.py
3292 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
3293 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
3295 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
3299 ## Remove all seam and degenerated edges from \a theShape.
3300 # Unite faces and edges, sharing one surface. It means that
3301 # this faces must have references to one C++ surface object (handle).
3302 # @param theShape The compound or single solid to remove irregular edges from.
3303 # @return Improved shape.
3305 # @ref swig_RemoveExtraEdges "Example"
3306 def RemoveExtraEdges(self,theShape):
3307 # Example: see GEOM_TestOthers.py
3308 anObj = self.BlocksOp.RemoveExtraEdges(theShape)
3309 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
3312 ## Check, if the given shape is a blocks compound.
3313 # Fix all detected errors.
3314 # \note Single block can be also fixed by this method.
3315 # @param theShape The compound to check and improve.
3316 # @return Improved compound.
3318 # @ref swig_CheckAndImprove "Example"
3319 def CheckAndImprove(self,theShape):
3320 # Example: see GEOM_TestOthers.py
3321 anObj = self.BlocksOp.CheckAndImprove(theShape)
3322 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
3325 # end of l4_blocks_measure
3328 ## @addtogroup l3_blocks_op
3331 ## Get all the blocks, contained in the given compound.
3332 # @param theCompound The compound to explode.
3333 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
3334 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
3335 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
3336 # @return List of GEOM_Objects, containing the retrieved blocks.
3338 # @ref tui_explode_on_blocks "Example 1"
3339 # \n @ref swig_MakeBlockExplode "Example 2"
3340 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
3341 # Example: see GEOM_TestOthers.py
3342 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
3343 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
3344 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
3346 anObj.SetParameters(Parameters)
3350 ## Find block, containing the given point inside its volume or on boundary.
3351 # @param theCompound Compound, to find block in.
3352 # @param thePoint Point, close to the desired block. If the point lays on
3353 # boundary between some blocks, we return block with nearest center.
3354 # @return New GEOM_Object, containing the found block.
3356 # @ref swig_todo "Example"
3357 def GetBlockNearPoint(self,theCompound, thePoint):
3358 # Example: see GEOM_Spanner.py
3359 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
3360 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
3363 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
3364 # @param theCompound Compound, to find block in.
3365 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
3366 # @return New GEOM_Object, containing the found block.
3368 # @ref swig_GetBlockByParts "Example"
3369 def GetBlockByParts(self,theCompound, theParts):
3370 # Example: see GEOM_TestOthers.py
3371 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
3372 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
3375 ## Return all blocks, containing all the elements, passed as the parts.
3376 # @param theCompound Compound, to find blocks in.
3377 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
3378 # @return List of GEOM_Objects, containing the found blocks.
3380 # @ref swig_todo "Example"
3381 def GetBlocksByParts(self,theCompound, theParts):
3382 # Example: see GEOM_Spanner.py
3383 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
3384 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
3387 ## Multi-transformate block and glue the result.
3388 # Transformation is defined so, as to superpose direction faces.
3389 # @param Block Hexahedral solid to be multi-transformed.
3390 # @param DirFace1 ID of First direction face.
3391 # @param DirFace2 ID of Second direction face.
3392 # @param NbTimes Quantity of transformations to be done.
3393 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
3394 # @return New GEOM_Object, containing the result shape.
3396 # @ref tui_multi_transformation "Example"
3397 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
3398 # Example: see GEOM_Spanner.py
3399 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
3400 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
3401 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
3402 anObj.SetParameters(Parameters)
3405 ## Multi-transformate block and glue the result.
3406 # @param Block Hexahedral solid to be multi-transformed.
3407 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
3408 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
3409 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
3410 # @return New GEOM_Object, containing the result shape.
3412 # @ref tui_multi_transformation "Example"
3413 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
3414 DirFace1V, DirFace2V, NbTimesV):
3415 # Example: see GEOM_Spanner.py
3416 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
3417 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
3418 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
3419 DirFace1V, DirFace2V, NbTimesV)
3420 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
3421 anObj.SetParameters(Parameters)
3424 ## Build all possible propagation groups.
3425 # Propagation group is a set of all edges, opposite to one (main)
3426 # edge of this group directly or through other opposite edges.
3427 # Notion of Opposite Edge make sence only on quadrangle face.
3428 # @param theShape Shape to build propagation groups on.
3429 # @return List of GEOM_Objects, each of them is a propagation group.
3431 # @ref swig_Propagate "Example"
3432 def Propagate(self,theShape):
3433 # Example: see GEOM_TestOthers.py
3434 listChains = self.BlocksOp.Propagate(theShape)
3435 RaiseIfFailed("Propagate", self.BlocksOp)
3438 # end of l3_blocks_op
3441 ## @addtogroup l3_groups
3444 ## Creates a new group which will store sub shapes of theMainShape
3445 # @param theMainShape is a GEOM object on which the group is selected
3446 # @param theShapeType defines a shape type of the group
3447 # @return a newly created GEOM group
3449 # @ref tui_working_with_groups_page "Example 1"
3450 # \n @ref swig_CreateGroup "Example 2"
3451 def CreateGroup(self,theMainShape, theShapeType):
3452 # Example: see GEOM_TestOthers.py
3453 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
3454 RaiseIfFailed("CreateGroup", self.GroupOp)
3457 ## Adds a sub object with ID theSubShapeId to the group
3458 # @param theGroup is a GEOM group to which the new sub shape is added
3459 # @param theSubShapeID is a sub shape ID in the main object.
3460 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3462 # @ref tui_working_with_groups_page "Example"
3463 def AddObject(self,theGroup, theSubShapeID):
3464 # Example: see GEOM_TestOthers.py
3465 self.GroupOp.AddObject(theGroup, theSubShapeID)
3466 RaiseIfFailed("AddObject", self.GroupOp)
3469 ## Removes a sub object with ID \a theSubShapeId from the group
3470 # @param theGroup is a GEOM group from which the new sub shape is removed
3471 # @param theSubShapeID is a sub shape ID in the main object.
3472 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3474 # @ref tui_working_with_groups_page "Example"
3475 def RemoveObject(self,theGroup, theSubShapeID):
3476 # Example: see GEOM_TestOthers.py
3477 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
3478 RaiseIfFailed("RemoveObject", self.GroupOp)
3481 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
3482 # @param theGroup is a GEOM group to which the new sub shapes are added.
3483 # @param theSubShapes is a list of sub shapes to be added.
3485 # @ref tui_working_with_groups_page "Example"
3486 def UnionList (self,theGroup, theSubShapes):
3487 # Example: see GEOM_TestOthers.py
3488 self.GroupOp.UnionList(theGroup, theSubShapes)
3489 RaiseIfFailed("UnionList", self.GroupOp)
3492 ## Works like the above method, but argument
3493 # theSubShapes here is a list of sub-shapes indices
3495 # @ref swig_UnionIDs "Example"
3496 def UnionIDs(self,theGroup, theSubShapes):
3497 # Example: see GEOM_TestOthers.py
3498 self.GroupOp.UnionIDs(theGroup, theSubShapes)
3499 RaiseIfFailed("UnionIDs", self.GroupOp)
3502 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
3503 # @param theGroup is a GEOM group from which the sub-shapes are removed.
3504 # @param theSubShapes is a list of sub-shapes to be removed.
3506 # @ref tui_working_with_groups_page "Example"
3507 def DifferenceList (self,theGroup, theSubShapes):
3508 # Example: see GEOM_TestOthers.py
3509 self.GroupOp.DifferenceList(theGroup, theSubShapes)
3510 RaiseIfFailed("DifferenceList", self.GroupOp)
3513 ## Works like the above method, but argument
3514 # theSubShapes here is a list of sub-shapes indices
3516 # @ref swig_DifferenceIDs "Example"
3517 def DifferenceIDs(self,theGroup, theSubShapes):
3518 # Example: see GEOM_TestOthers.py
3519 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
3520 RaiseIfFailed("DifferenceIDs", self.GroupOp)
3523 ## Returns a list of sub objects ID stored in the group
3524 # @param theGroup is a GEOM group for which a list of IDs is requested
3526 # @ref swig_GetObjectIDs "Example"
3527 def GetObjectIDs(self,theGroup):
3528 # Example: see GEOM_TestOthers.py
3529 ListIDs = self.GroupOp.GetObjects(theGroup)
3530 RaiseIfFailed("GetObjects", self.GroupOp)
3533 ## Returns a type of sub objects stored in the group
3534 # @param theGroup is a GEOM group which type is returned.
3536 # @ref swig_GetType "Example"
3537 def GetType(self,theGroup):
3538 # Example: see GEOM_TestOthers.py
3539 aType = self.GroupOp.GetType(theGroup)
3540 RaiseIfFailed("GetType", self.GroupOp)
3543 ## Returns a main shape associated with the group
3544 # @param theGroup is a GEOM group for which a main shape object is requested
3545 # @return a GEOM object which is a main shape for theGroup
3547 # @ref swig_GetMainShape "Example"
3548 def GetMainShape(self,theGroup):
3549 # Example: see GEOM_TestOthers.py
3550 anObj = self.GroupOp.GetMainShape(theGroup)
3551 RaiseIfFailed("GetMainShape", self.GroupOp)
3554 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
3555 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3557 # @ref swig_todo "Example"
3558 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
3559 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
3562 Props = self.BasicProperties(edge)
3563 if min_length <= Props[0] and Props[0] <= max_length:
3564 if (not include_min) and (min_length == Props[0]):
3567 if (not include_max) and (Props[0] == max_length):
3570 edges_in_range.append(edge)
3572 if len(edges_in_range) <= 0:
3573 print "No edges found by given criteria"
3576 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
3577 self.UnionList(group_edges, edges_in_range)
3581 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
3582 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
3584 # @ref swig_todo "Example"
3585 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
3586 nb_selected = sg.SelectedCount()
3588 print "Select a shape before calling this function, please."
3591 print "Only one shape must be selected"
3594 id_shape = sg.getSelected(0)
3595 shape = IDToObject( id_shape )
3597 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
3601 if include_min: left_str = " <= "
3602 if include_max: right_str = " <= "
3604 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
3605 + left_str + "length" + right_str + `max_length`)
3607 sg.updateObjBrowser(1)
3614 ## Create a copy of the given object
3615 # @ingroup l1_geompy_auxiliary
3617 # @ref swig_all_advanced "Example"
3618 def MakeCopy(self,theOriginal):
3619 # Example: see GEOM_TestAll.py
3620 anObj = self.InsertOp.MakeCopy(theOriginal)
3621 RaiseIfFailed("MakeCopy", self.InsertOp)
3624 ## Add Path to load python scripts from
3625 # @ingroup l1_geompy_auxiliary
3626 def addPath(self,Path):
3627 if (sys.path.count(Path) < 1):
3628 sys.path.append(Path)
3631 #Register the new proxy for GEOM_Gen
3632 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)