1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
22 # Author : Paul RASCLE, EDF
30 ## @defgroup l1_geompy_auxiliary Auxiliary data structures and methods
32 ## @defgroup l1_geompy_purpose All package methods, grouped by their purpose
34 ## @defgroup l2_import_export Importing/exporting geometrical objects
35 ## @defgroup l2_creating Creating geometrical objects
37 ## @defgroup l3_basic_go Creating Basic Geometric Objects
39 ## @defgroup l4_curves Creating Curves
42 ## @defgroup l3_3d_primitives Creating 3D Primitives
43 ## @defgroup l3_complex Creating Complex Objects
44 ## @defgroup l3_groups Working with groups
45 ## @defgroup l3_blocks Building by blocks
47 ## @defgroup l4_blocks_measure Check and Improve
50 ## @defgroup l3_sketcher Sketcher
51 ## @defgroup l3_advanced Creating Advanced Geometrical Objects
53 ## @defgroup l4_decompose Decompose objects
54 ## @defgroup l4_decompose_d Decompose objects deprecated methods
55 ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
56 ## @defgroup l4_obtain Access to subshapes by a criteria
57 ## @defgroup l4_advanced Advanced objects creation functions
62 ## @defgroup l2_transforming Transforming geometrical objects
64 ## @defgroup l3_basic_op Basic Operations
65 ## @defgroup l3_boolean Boolean Operations
66 ## @defgroup l3_transform Transformation Operations
67 ## @defgroup l3_local Local Operations (Fillet and Chamfer)
68 ## @defgroup l3_blocks_op Blocks Operations
69 ## @defgroup l3_healing Repairing Operations
70 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of subshapes
73 ## @defgroup l2_measure Using measurement tools
81 from salome_notebook import *
86 ## Enumeration ShapeType as a dictionary
87 # @ingroup l1_geompy_auxiliary
88 ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
90 ## Raise an Error, containing the Method_name, if Operation is Failed
91 ## @ingroup l1_geompy_auxiliary
92 def RaiseIfFailed (Method_name, Operation):
93 if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
94 raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
96 ## Return list of variables value from salome notebook
97 ## @ingroup l1_geompy_auxiliary
98 def ParseParameters(*parameters):
101 for parameter in parameters:
102 if isinstance(parameter, list):
103 lResults = ParseParameters(*parameter)
104 if len(lResults) > 0:
105 Result.append(lResults[:-1])
106 StringResult += lResults[-1].split(":")
110 if isinstance(parameter,str):
111 if notebook.isVariable(parameter):
112 Result.append(notebook.get(parameter))
114 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
117 Result.append(parameter)
119 StringResult.append(str(parameter))
123 Result.append(":".join(StringResult))
125 Result = ":".join(StringResult)
128 ## Return list of variables value from salome notebook
129 ## @ingroup l1_geompy_auxiliary
133 for parameter in list:
134 if isinstance(parameter,str) and notebook.isVariable(parameter):
135 Result.append(str(notebook.get(parameter)))
138 Result.append(str(parameter))
141 StringResult = StringResult + str(parameter)
142 StringResult = StringResult + ":"
144 StringResult = StringResult[:len(StringResult)-1]
145 return Result, StringResult
147 ## Return list of variables value from salome notebook
148 ## @ingroup l1_geompy_auxiliary
149 def ParseSketcherCommand(command):
152 sections = command.split(":")
153 for section in sections:
154 parameters = section.split(" ")
156 for parameter in parameters:
157 if paramIndex > 1 and parameter.find("'") != -1:
158 parameter = parameter.replace("'","")
159 if notebook.isVariable(parameter):
160 Result = Result + str(notebook.get(parameter)) + " "
163 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
167 Result = Result + str(parameter) + " "
170 StringResult = StringResult + parameter
171 StringResult = StringResult + ":"
173 paramIndex = paramIndex + 1
175 Result = Result[:len(Result)-1] + ":"
177 Result = Result[:len(Result)-1]
178 return Result, StringResult
180 ## Helper function which can be used to pack the passed string to the byte data.
181 ## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
182 ## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
185 ## val = PackData("10001110") # val = 0xAE
186 ## val = PackData("1") # val = 0x80
188 ## @param data unpacked data - a string containing '1' and '0' symbols
189 ## @return data packed to the byte stream
190 ## @ingroup l1_geompy_auxiliary
193 if len(data)%8: bytes += 1
195 for b in range(bytes):
196 d = data[b*8:(b+1)*8]
201 if d[i] == "1": val += 1
203 raise "Invalid symbol %s" % d[i]
210 ## Read bitmap texture from the text file.
211 ## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
212 ## A zero symbol ('0') represents transparent pixel of the texture bitmap.
213 ## The function returns width and height of the pixmap in pixels and byte stream representing
214 ## texture bitmap itself.
216 ## This function can be used to read the texture to the byte stream in order to pass it to
217 ## the AddTexture() function of geompy class.
221 ## geompy.init_geom(salome.myStudy)
222 ## texture = geompy.readtexture('mytexture.dat')
223 ## texture = geompy.AddTexture(*texture)
224 ## obj.SetMarkerTexture(texture)
226 ## @param fname texture file name
227 ## @return sequence of tree values: texture's width, height in pixels and its byte stream
228 ## @ingroup l1_geompy_auxiliary
229 def ReadTexture(fname):
232 lines = [ l.strip() for l in f.readlines()]
235 if lines: maxlen = max([len(x) for x in lines])
237 if maxlen%8: lenbytes += 1
241 lenline = (len(line)/8+1)*8
244 lenline = (len(line)/8)*8
246 for i in range(lenline/8):
249 if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
252 bytedata += PackData(byte)
254 for i in range(lenline/8, lenbytes):
255 bytedata += PackData("0")
257 return lenbytes*8, len(lines), bytedata
262 ## Returns a long value from enumeration type
263 # Can be used for CORBA enumerator types like GEOM.shape_type
264 # @ingroup l1_geompy_auxiliary
265 def EnumToLong(theItem):
267 if hasattr(theItem, "_v"): ret = theItem._v
270 ## Kinds of shape enumeration
271 # @ingroup l1_geompy_auxiliary
272 kind = GEOM.GEOM_IKindOfShape
274 ## Information about closed/unclosed state of shell or wire
275 # @ingroup l1_geompy_auxiliary
281 class geompyDC(GEOM._objref_GEOM_Gen):
284 GEOM._objref_GEOM_Gen.__init__(self)
285 self.myBuilder = None
304 ## @addtogroup l1_geompy_auxiliary
306 def init_geom(self,theStudy):
307 self.myStudy = theStudy
308 self.myStudyId = self.myStudy._get_StudyId()
309 self.myBuilder = self.myStudy.NewBuilder()
310 self.father = self.myStudy.FindComponent("GEOM")
311 if self.father is None:
312 self.father = self.myBuilder.NewComponent("GEOM")
313 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
314 FName = A1._narrow(SALOMEDS.AttributeName)
315 FName.SetValue("Geometry")
316 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
317 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
318 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
319 self.myBuilder.DefineComponentInstance(self.father,self)
321 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
322 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
323 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
324 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
325 self.HealOp = self.GetIHealingOperations (self.myStudyId)
326 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
327 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
328 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
329 self.LocalOp = self.GetILocalOperations (self.myStudyId)
330 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
331 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
332 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
333 self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
336 ## Get name for sub-shape aSubObj of shape aMainObj
338 # @ref swig_SubShapeAllSorted "Example"
339 def SubShapeName(self,aSubObj, aMainObj):
340 # Example: see GEOM_TestAll.py
342 #aSubId = orb.object_to_string(aSubObj)
343 #aMainId = orb.object_to_string(aMainObj)
344 #index = gg.getIndexTopology(aSubId, aMainId)
345 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
346 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
347 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
350 ## Publish in study aShape with name aName
352 # \param aShape the shape to be published
353 # \param aName the name for the shape
354 # \param doRestoreSubShapes if True, finds and publishes also
355 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
356 # and published sub-shapes of arguments
357 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
358 # these arguments description
359 # \return study entry of the published shape in form of string
361 # @ref swig_MakeQuad4Vertices "Example"
362 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
363 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
364 # Example: see GEOM_TestAll.py
366 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
367 if doRestoreSubShapes:
368 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
369 theFindMethod, theInheritFirstArg, True )
371 print "addToStudy() failed"
373 return aShape.GetStudyEntry()
375 ## Publish in study aShape with name aName as sub-object of previously published aFather
377 # @ref swig_SubShapeAllSorted "Example"
378 def addToStudyInFather(self, aFather, aShape, aName):
379 # Example: see GEOM_TestAll.py
381 aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather)
383 print "addToStudyInFather() failed"
385 return aShape.GetStudyEntry()
387 # end of l1_geompy_auxiliary
390 ## @addtogroup l3_restore_ss
393 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
394 # To be used from python scripts out of geompy.addToStudy (non-default usage)
395 # \param theObject published GEOM object, arguments of which will be published
396 # \param theArgs list of GEOM_Object, operation arguments to be published.
397 # If this list is empty, all operation arguments will be published
398 # \param theFindMethod method to search subshapes, corresponding to arguments and
399 # their subshapes. Value from enumeration GEOM::find_shape_method.
400 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
401 # Do not publish subshapes in place of arguments, but only
402 # in place of subshapes of the first argument,
403 # because the whole shape corresponds to the first argument.
404 # Mainly to be used after transformations, but it also can be
405 # usefull after partition with one object shape, and some other
406 # operations, where only the first argument has to be considered.
407 # If theObject has only one argument shape, this flag is automatically
408 # considered as True, not regarding really passed value.
409 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
410 # and prefix "from_subshapes_of_" to names of partially restored subshapes.
411 # \return list of published sub-shapes
413 # @ref tui_restore_prs_params "Example"
414 def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
415 theInheritFirstArg=False, theAddPrefix=True):
416 # Example: see GEOM_TestAll.py
417 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
418 theFindMethod, theInheritFirstArg, theAddPrefix)
420 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
421 # To be used from python scripts out of geompy.addToStudy (non-default usage)
422 # \param theObject published GEOM object, arguments of which will be published
423 # \param theArgs list of GEOM_Object, operation arguments to be published.
424 # If this list is empty, all operation arguments will be published
425 # \param theFindMethod method to search subshapes, corresponding to arguments and
426 # their subshapes. Value from enumeration GEOM::find_shape_method.
427 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
428 # Do not publish subshapes in place of arguments, but only
429 # in place of subshapes of the first argument,
430 # because the whole shape corresponds to the first argument.
431 # Mainly to be used after transformations, but it also can be
432 # usefull after partition with one object shape, and some other
433 # operations, where only the first argument has to be considered.
434 # If theObject has only one argument shape, this flag is automatically
435 # considered as True, not regarding really passed value.
436 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
437 # and prefix "from_subshapes_of_" to names of partially restored subshapes.
438 # \return list of published sub-shapes
440 # @ref tui_restore_prs_params "Example"
441 def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
442 theInheritFirstArg=False, theAddPrefix=True):
443 # Example: see GEOM_TestAll.py
444 return self.RestoreGivenSubShapesO(self.myStudy, theObject, theArgs,
445 theFindMethod, theInheritFirstArg, theAddPrefix)
447 # end of l3_restore_ss
450 ## @addtogroup l3_basic_go
453 ## Create point by three coordinates.
454 # @param theX The X coordinate of the point.
455 # @param theY The Y coordinate of the point.
456 # @param theZ The Z coordinate of the point.
457 # @return New GEOM_Object, containing the created point.
459 # @ref tui_creation_point "Example"
460 def MakeVertex(self, theX, theY, theZ):
461 # Example: see GEOM_TestAll.py
462 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
463 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
464 RaiseIfFailed("MakePointXYZ", self.BasicOp)
465 anObj.SetParameters(Parameters)
468 ## Create a point, distant from the referenced point
469 # on the given distances along the coordinate axes.
470 # @param theReference The referenced point.
471 # @param theX Displacement from the referenced point along OX axis.
472 # @param theY Displacement from the referenced point along OY axis.
473 # @param theZ Displacement from the referenced point along OZ axis.
474 # @return New GEOM_Object, containing the created point.
476 # @ref tui_creation_point "Example"
477 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
478 # Example: see GEOM_TestAll.py
479 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
480 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
481 RaiseIfFailed("MakePointWithReference", self.BasicOp)
482 anObj.SetParameters(Parameters)
485 ## Create a point, corresponding to the given parameter on the given curve.
486 # @param theRefCurve The referenced curve.
487 # @param theParameter Value of parameter on the referenced curve.
488 # @return New GEOM_Object, containing the created point.
490 # @ref tui_creation_point "Example"
491 def MakeVertexOnCurve(self,theRefCurve, theParameter):
492 # Example: see GEOM_TestAll.py
493 theParameter, Parameters = ParseParameters(theParameter)
494 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
495 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
496 anObj.SetParameters(Parameters)
499 ## Create a point by projection give coordinates on the given curve
500 # @param theRefCurve The referenced curve.
501 # @param theX X-coordinate in 3D space
502 # @param theY Y-coordinate in 3D space
503 # @param theZ Z-coordinate in 3D space
504 # @return New GEOM_Object, containing the created point.
506 # @ref tui_creation_point "Example"
507 def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ):
508 # Example: see GEOM_TestAll.py
509 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
510 anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
511 RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
512 anObj.SetParameters(Parameters)
515 ## Create a point, corresponding to the given length on the given curve.
516 # @param theRefCurve The referenced curve.
517 # @param theLength Length on the referenced curve. It can be negative.
518 # @param theStartPoint Point allowing to choose the direction for the calculation
519 # of the length. If None, start from the first point of theRefCurve.
520 # @return New GEOM_Object, containing the created point.
522 # @ref tui_creation_point "Example"
523 def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
524 # Example: see GEOM_TestAll.py
525 theLength, Parameters = ParseParameters(theLength)
526 anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
527 RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
528 anObj.SetParameters(Parameters)
531 ## Create a point, corresponding to the given parameters on the
533 # @param theRefSurf The referenced surface.
534 # @param theUParameter Value of U-parameter on the referenced surface.
535 # @param theVParameter Value of V-parameter on the referenced surface.
536 # @return New GEOM_Object, containing the created point.
538 # @ref swig_MakeVertexOnSurface "Example"
539 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
540 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
541 # Example: see GEOM_TestAll.py
542 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
543 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
544 anObj.SetParameters(Parameters);
547 ## Create a point by projection give coordinates on the given surface
548 # @param theRefSurf The referenced surface.
549 # @param theX X-coordinate in 3D space
550 # @param theY Y-coordinate in 3D space
551 # @param theZ Z-coordinate in 3D space
552 # @return New GEOM_Object, containing the created point.
554 # @ref swig_MakeVertexOnSurfaceByCoord "Example"
555 def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ):
556 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
557 # Example: see GEOM_TestAll.py
558 anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
559 RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
560 anObj.SetParameters(Parameters);
563 ## Create a point on intersection of two lines.
564 # @param theRefLine1, theRefLine2 The referenced lines.
565 # @return New GEOM_Object, containing the created point.
567 # @ref swig_MakeVertexOnLinesIntersection "Example"
568 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
569 # Example: see GEOM_TestAll.py
570 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
571 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
574 ## Create a tangent, corresponding to the given parameter on the given curve.
575 # @param theRefCurve The referenced curve.
576 # @param theParameter Value of parameter on the referenced curve.
577 # @return New GEOM_Object, containing the created tangent.
579 # @ref swig_MakeTangentOnCurve "Example"
580 def MakeTangentOnCurve(self, theRefCurve, theParameter):
581 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
582 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
585 ## Create a tangent plane, corresponding to the given parameter on the given face.
586 # @param theFace The face for which tangent plane should be built.
587 # @param theParameterV vertical value of the center point (0.0 - 1.0).
588 # @param theParameterU horisontal value of the center point (0.0 - 1.0).
589 # @param theTrimSize the size of plane.
590 # @return New GEOM_Object, containing the created tangent.
592 # @ref swig_MakeTangentPlaneOnFace "Example"
593 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize):
594 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
595 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
598 ## Create a vector with the given components.
599 # @param theDX X component of the vector.
600 # @param theDY Y component of the vector.
601 # @param theDZ Z component of the vector.
602 # @return New GEOM_Object, containing the created vector.
604 # @ref tui_creation_vector "Example"
605 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
606 # Example: see GEOM_TestAll.py
607 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
608 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
609 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
610 anObj.SetParameters(Parameters)
613 ## Create a vector between two points.
614 # @param thePnt1 Start point for the vector.
615 # @param thePnt2 End point for the vector.
616 # @return New GEOM_Object, containing the created vector.
618 # @ref tui_creation_vector "Example"
619 def MakeVector(self,thePnt1, thePnt2):
620 # Example: see GEOM_TestAll.py
621 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
622 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
625 ## Create a line, passing through the given point
626 # and parrallel to the given direction
627 # @param thePnt Point. The resulting line will pass through it.
628 # @param theDir Direction. The resulting line will be parallel to it.
629 # @return New GEOM_Object, containing the created line.
631 # @ref tui_creation_line "Example"
632 def MakeLine(self,thePnt, theDir):
633 # Example: see GEOM_TestAll.py
634 anObj = self.BasicOp.MakeLine(thePnt, theDir)
635 RaiseIfFailed("MakeLine", self.BasicOp)
638 ## Create a line, passing through the given points
639 # @param thePnt1 First of two points, defining the line.
640 # @param thePnt2 Second of two points, defining the line.
641 # @return New GEOM_Object, containing the created line.
643 # @ref tui_creation_line "Example"
644 def MakeLineTwoPnt(self,thePnt1, thePnt2):
645 # Example: see GEOM_TestAll.py
646 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
647 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
650 ## Create a line on two faces intersection.
651 # @param theFace1 First of two faces, defining the line.
652 # @param theFace2 Second of two faces, defining the line.
653 # @return New GEOM_Object, containing the created line.
655 # @ref swig_MakeLineTwoFaces "Example"
656 def MakeLineTwoFaces(self, theFace1, theFace2):
657 # Example: see GEOM_TestAll.py
658 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
659 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
662 ## Create a plane, passing through the given point
663 # and normal to the given vector.
664 # @param thePnt Point, the plane has to pass through.
665 # @param theVec Vector, defining the plane normal direction.
666 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
667 # @return New GEOM_Object, containing the created plane.
669 # @ref tui_creation_plane "Example"
670 def MakePlane(self,thePnt, theVec, theTrimSize):
671 # Example: see GEOM_TestAll.py
672 theTrimSize, Parameters = ParseParameters(theTrimSize);
673 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
674 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
675 anObj.SetParameters(Parameters)
678 ## Create a plane, passing through the three given points
679 # @param thePnt1 First of three points, defining the plane.
680 # @param thePnt2 Second of three points, defining the plane.
681 # @param thePnt3 Fird of three points, defining the plane.
682 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
683 # @return New GEOM_Object, containing the created plane.
685 # @ref tui_creation_plane "Example"
686 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
687 # Example: see GEOM_TestAll.py
688 theTrimSize, Parameters = ParseParameters(theTrimSize);
689 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
690 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
691 anObj.SetParameters(Parameters)
694 ## Create a plane, similar to the existing one, but with another size of representing face.
695 # @param theFace Referenced plane or LCS(Marker).
696 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
697 # @return New GEOM_Object, containing the created plane.
699 # @ref tui_creation_plane "Example"
700 def MakePlaneFace(self,theFace, theTrimSize):
701 # Example: see GEOM_TestAll.py
702 theTrimSize, Parameters = ParseParameters(theTrimSize);
703 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
704 RaiseIfFailed("MakePlaneFace", self.BasicOp)
705 anObj.SetParameters(Parameters)
708 ## Create a plane, passing through the 2 vectors
709 # with center in a start point of the first vector.
710 # @param theVec1 Vector, defining center point and plane direction.
711 # @param theVec2 Vector, defining the plane normal direction.
712 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
713 # @return New GEOM_Object, containing the created plane.
715 # @ref tui_creation_plane "Example"
716 def MakePlane2Vec(self,theVec1, theVec2, theTrimSize):
717 # Example: see GEOM_TestAll.py
718 theTrimSize, Parameters = ParseParameters(theTrimSize);
719 anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
720 RaiseIfFailed("MakePlane2Vec", self.BasicOp)
721 anObj.SetParameters(Parameters)
724 ## Create a plane, based on a Local coordinate system.
725 # @param theLCS coordinate system, defining plane.
726 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
727 # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
728 # @return New GEOM_Object, containing the created plane.
730 # @ref tui_creation_plane "Example"
731 def MakePlaneLCS(self,theLCS, theTrimSize, theOrientation):
732 # Example: see GEOM_TestAll.py
733 theTrimSize, Parameters = ParseParameters(theTrimSize);
734 anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
735 RaiseIfFailed("MakePlaneLCS", self.BasicOp)
736 anObj.SetParameters(Parameters)
739 ## Create a local coordinate system.
740 # @param OX,OY,OZ Three coordinates of coordinate system origin.
741 # @param XDX,XDY,XDZ Three components of OX direction
742 # @param YDX,YDY,YDZ Three components of OY direction
743 # @return New GEOM_Object, containing the created coordinate system.
745 # @ref swig_MakeMarker "Example"
746 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
747 # Example: see GEOM_TestAll.py
748 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
749 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
750 RaiseIfFailed("MakeMarker", self.BasicOp)
751 anObj.SetParameters(Parameters)
754 ## Create a local coordinate system from shape.
755 # @param theShape The initial shape to detect the coordinate system.
756 # @return New GEOM_Object, containing the created coordinate system.
758 # @ref tui_creation_lcs "Example"
759 def MakeMarkerFromShape(self, theShape):
760 anObj = self.BasicOp.MakeMarkerFromShape(theShape)
761 RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
764 ## Create a local coordinate system from point and two vectors.
765 # @param theOrigin Point of coordinate system origin.
766 # @param theXVec Vector of X direction
767 # @param theYVec Vector of Y direction
768 # @return New GEOM_Object, containing the created coordinate system.
770 # @ref tui_creation_lcs "Example"
771 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
772 anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
773 RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
779 ## @addtogroup l4_curves
782 ## Create an arc of circle, passing through three given points.
783 # @param thePnt1 Start point of the arc.
784 # @param thePnt2 Middle point of the arc.
785 # @param thePnt3 End point of the arc.
786 # @return New GEOM_Object, containing the created arc.
788 # @ref swig_MakeArc "Example"
789 def MakeArc(self,thePnt1, thePnt2, thePnt3):
790 # Example: see GEOM_TestAll.py
791 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
792 RaiseIfFailed("MakeArc", self.CurvesOp)
795 ## Create an arc of circle from a center and 2 points.
796 # @param thePnt1 Center of the arc
797 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
798 # @param thePnt3 End point of the arc (Gives also a direction)
799 # @param theSense Orientation of the arc
800 # @return New GEOM_Object, containing the created arc.
802 # @ref swig_MakeArc "Example"
803 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
804 # Example: see GEOM_TestAll.py
805 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
806 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
809 ## Create an arc of ellipse, of center and two points.
810 # @param theCenter Center of the arc.
811 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
812 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
813 # @return New GEOM_Object, containing the created arc.
815 # @ref swig_MakeArc "Example"
816 def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2):
817 # Example: see GEOM_TestAll.py
818 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
819 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
822 ## Create a circle with given center, normal vector and radius.
823 # @param thePnt Circle center.
824 # @param theVec Vector, normal to the plane of the circle.
825 # @param theR Circle radius.
826 # @return New GEOM_Object, containing the created circle.
828 # @ref tui_creation_circle "Example"
829 def MakeCircle(self, thePnt, theVec, theR):
830 # Example: see GEOM_TestAll.py
831 theR, Parameters = ParseParameters(theR)
832 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
833 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
834 anObj.SetParameters(Parameters)
837 ## Create a circle with given radius.
838 # Center of the circle will be in the origin of global
839 # coordinate system and normal vector will be codirected with Z axis
840 # @param theR Circle radius.
841 # @return New GEOM_Object, containing the created circle.
842 def MakeCircleR(self, theR):
843 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
844 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
847 ## Create a circle, passing through three given points
848 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
849 # @return New GEOM_Object, containing the created circle.
851 # @ref tui_creation_circle "Example"
852 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
853 # Example: see GEOM_TestAll.py
854 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
855 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
858 ## Create a circle, with given point1 as center,
859 # passing through the point2 as radius and laying in the plane,
860 # defined by all three given points.
861 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
862 # @return New GEOM_Object, containing the created circle.
864 # @ref swig_MakeCircle "Example"
865 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
866 # Example: see GEOM_example6.py
867 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
868 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
871 ## Create an ellipse with given center, normal vector and radiuses.
872 # @param thePnt Ellipse center.
873 # @param theVec Vector, normal to the plane of the ellipse.
874 # @param theRMajor Major ellipse radius.
875 # @param theRMinor Minor ellipse radius.
876 # @param theVecMaj Vector, direction of the ellipse's main axis.
877 # @return New GEOM_Object, containing the created ellipse.
879 # @ref tui_creation_ellipse "Example"
880 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None):
881 # Example: see GEOM_TestAll.py
882 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
883 if theVecMaj is not None:
884 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
886 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
888 RaiseIfFailed("MakeEllipse", self.CurvesOp)
889 anObj.SetParameters(Parameters)
892 ## Create an ellipse with given radiuses.
893 # Center of the ellipse will be in the origin of global
894 # coordinate system and normal vector will be codirected with Z axis
895 # @param theRMajor Major ellipse radius.
896 # @param theRMinor Minor ellipse radius.
897 # @return New GEOM_Object, containing the created ellipse.
898 def MakeEllipseRR(self, theRMajor, theRMinor):
899 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
900 RaiseIfFailed("MakeEllipse", self.CurvesOp)
903 ## Create a polyline on the set of points.
904 # @param thePoints Sequence of points for the polyline.
905 # @param theIsClosed If True, build a closed wire.
906 # @return New GEOM_Object, containing the created polyline.
908 # @ref tui_creation_curve "Example"
909 def MakePolyline(self, thePoints, theIsClosed=False):
910 # Example: see GEOM_TestAll.py
911 anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
912 RaiseIfFailed("MakePolyline", self.CurvesOp)
915 ## Create bezier curve on the set of points.
916 # @param thePoints Sequence of points for the bezier curve.
917 # @param theIsClosed If True, build a closed curve.
918 # @return New GEOM_Object, containing the created bezier curve.
920 # @ref tui_creation_curve "Example"
921 def MakeBezier(self, thePoints, theIsClosed=False):
922 # Example: see GEOM_TestAll.py
923 anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
924 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
927 ## Create B-Spline curve on the set of points.
928 # @param thePoints Sequence of points for the B-Spline curve.
929 # @param theIsClosed If True, build a closed curve.
930 # @param theDoReordering If TRUE, the algo does not follow the order of
931 # \a thePoints but searches for the closest vertex.
932 # @return New GEOM_Object, containing the created B-Spline curve.
934 # @ref tui_creation_curve "Example"
935 def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False):
936 # Example: see GEOM_TestAll.py
937 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
938 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
944 ## @addtogroup l3_sketcher
947 ## Create a sketcher (wire or face), following the textual description,
948 # passed through <VAR>theCommand</VAR> argument. \n
949 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
950 # Format of the description string have to be the following:
952 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
955 # - x1, y1 are coordinates of the first sketcher point (zero by default),
957 # - "R angle" : Set the direction by angle
958 # - "D dx dy" : Set the direction by DX & DY
961 # - "TT x y" : Create segment by point at X & Y
962 # - "T dx dy" : Create segment by point with DX & DY
963 # - "L length" : Create segment by direction & Length
964 # - "IX x" : Create segment by direction & Intersect. X
965 # - "IY y" : Create segment by direction & Intersect. Y
968 # - "C radius length" : Create arc by direction, radius and length(in degree)
969 # - "AA x y": Create arc by point at X & Y
970 # - "A dx dy" : Create arc by point with DX & DY
971 # - "A dx dy" : Create arc by point with DX & DY
972 # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
973 # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
974 # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
975 # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
978 # - "WW" : Close Wire (to finish)
979 # - "WF" : Close Wire and build face (to finish)
982 # - Flag1 (= reverse) is 0 or 2 ...
983 # - if 0 the drawn arc is the one of lower angle (< Pi)
984 # - if 2 the drawn arc ius the one of greater angle (> Pi)
987 # - Flag2 (= control tolerance) is 0 or 1 ...
988 # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
989 # - if 1 the wire is built only if the end point is on the arc
990 # with a tolerance of 10^-7 on the distance else the creation fails
992 # @param theCommand String, defining the sketcher in local
993 # coordinates of the working plane.
994 # @param theWorkingPlane Nine double values, defining origin,
995 # OZ and OX directions of the working plane.
996 # @return New GEOM_Object, containing the created wire.
998 # @ref tui_sketcher_page "Example"
999 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
1000 # Example: see GEOM_TestAll.py
1001 theCommand,Parameters = ParseSketcherCommand(theCommand)
1002 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
1003 RaiseIfFailed("MakeSketcher", self.CurvesOp)
1004 anObj.SetParameters(Parameters)
1007 ## Create a sketcher (wire or face), following the textual description,
1008 # passed through <VAR>theCommand</VAR> argument. \n
1009 # For format of the description string see the previous method.\n
1010 # @param theCommand String, defining the sketcher in local
1011 # coordinates of the working plane.
1012 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
1013 # @return New GEOM_Object, containing the created wire.
1015 # @ref tui_sketcher_page "Example"
1016 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
1017 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
1018 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
1021 ## Create a sketcher wire, following the numerical description,
1022 # passed through <VAR>theCoordinates</VAR> argument. \n
1023 # @param theCoordinates double values, defining points to create a wire,
1025 # @return New GEOM_Object, containing the created wire.
1027 # @ref tui_sketcher_page "Example"
1028 def Make3DSketcher(self, theCoordinates):
1029 theCoordinates,Parameters = ParseParameters(theCoordinates)
1030 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
1031 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
1032 anObj.SetParameters(Parameters)
1035 # end of l3_sketcher
1038 ## @addtogroup l3_3d_primitives
1041 ## Create a box by coordinates of two opposite vertices.
1043 # @ref tui_creation_box "Example"
1044 def MakeBox(self,x1,y1,z1,x2,y2,z2):
1045 # Example: see GEOM_TestAll.py
1046 pnt1 = self.MakeVertex(x1,y1,z1)
1047 pnt2 = self.MakeVertex(x2,y2,z2)
1048 return self.MakeBoxTwoPnt(pnt1,pnt2)
1050 ## Create a box with specified dimensions along the coordinate axes
1051 # and with edges, parallel to the coordinate axes.
1052 # Center of the box will be at point (DX/2, DY/2, DZ/2).
1053 # @param theDX Length of Box edges, parallel to OX axis.
1054 # @param theDY Length of Box edges, parallel to OY axis.
1055 # @param theDZ Length of Box edges, parallel to OZ axis.
1056 # @return New GEOM_Object, containing the created box.
1058 # @ref tui_creation_box "Example"
1059 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
1060 # Example: see GEOM_TestAll.py
1061 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1062 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
1063 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
1064 anObj.SetParameters(Parameters)
1067 ## Create a box with two specified opposite vertices,
1068 # and with edges, parallel to the coordinate axes
1069 # @param thePnt1 First of two opposite vertices.
1070 # @param thePnt2 Second of two opposite vertices.
1071 # @return New GEOM_Object, containing the created box.
1073 # @ref tui_creation_box "Example"
1074 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
1075 # Example: see GEOM_TestAll.py
1076 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
1077 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
1080 ## Create a face with specified dimensions along OX-OY coordinate axes,
1081 # with edges, parallel to this coordinate axes.
1082 # @param theH height of Face.
1083 # @param theW width of Face.
1084 # @param theOrientation orientation belong axis OXY OYZ OZX
1085 # @return New GEOM_Object, containing the created face.
1087 # @ref tui_creation_face "Example"
1088 def MakeFaceHW(self,theH, theW, theOrientation):
1089 # Example: see GEOM_TestAll.py
1090 theH,theW,Parameters = ParseParameters(theH, theW)
1091 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
1092 RaiseIfFailed("MakeFaceHW", self.PrimOp)
1093 anObj.SetParameters(Parameters)
1096 ## Create a face from another plane and two sizes,
1097 # vertical size and horisontal size.
1098 # @param theObj Normale vector to the creating face or
1100 # @param theH Height (vertical size).
1101 # @param theW Width (horisontal size).
1102 # @return New GEOM_Object, containing the created face.
1104 # @ref tui_creation_face "Example"
1105 def MakeFaceObjHW(self, theObj, theH, theW):
1106 # Example: see GEOM_TestAll.py
1107 theH,theW,Parameters = ParseParameters(theH, theW)
1108 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
1109 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
1110 anObj.SetParameters(Parameters)
1113 ## Create a disk with given center, normal vector and radius.
1114 # @param thePnt Disk center.
1115 # @param theVec Vector, normal to the plane of the disk.
1116 # @param theR Disk radius.
1117 # @return New GEOM_Object, containing the created disk.
1119 # @ref tui_creation_disk "Example"
1120 def MakeDiskPntVecR(self,thePnt, theVec, theR):
1121 # Example: see GEOM_TestAll.py
1122 theR,Parameters = ParseParameters(theR)
1123 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
1124 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
1125 anObj.SetParameters(Parameters)
1128 ## Create a disk, passing through three given points
1129 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
1130 # @return New GEOM_Object, containing the created disk.
1132 # @ref tui_creation_disk "Example"
1133 def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3):
1134 # Example: see GEOM_TestAll.py
1135 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
1136 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
1139 ## Create a disk with specified dimensions along OX-OY coordinate axes.
1140 # @param theR Radius of Face.
1141 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
1142 # @return New GEOM_Object, containing the created disk.
1144 # @ref tui_creation_face "Example"
1145 def MakeDiskR(self,theR, theOrientation):
1146 # Example: see GEOM_TestAll.py
1147 theR,Parameters = ParseParameters(theR)
1148 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
1149 RaiseIfFailed("MakeDiskR", self.PrimOp)
1150 anObj.SetParameters(Parameters)
1153 ## Create a cylinder with given base point, axis, radius and height.
1154 # @param thePnt Central point of cylinder base.
1155 # @param theAxis Cylinder axis.
1156 # @param theR Cylinder radius.
1157 # @param theH Cylinder height.
1158 # @return New GEOM_Object, containing the created cylinder.
1160 # @ref tui_creation_cylinder "Example"
1161 def MakeCylinder(self,thePnt, theAxis, theR, theH):
1162 # Example: see GEOM_TestAll.py
1163 theR,theH,Parameters = ParseParameters(theR, theH)
1164 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
1165 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
1166 anObj.SetParameters(Parameters)
1169 ## Create a cylinder with given radius and height at
1170 # the origin of coordinate system. Axis of the cylinder
1171 # will be collinear to the OZ axis of the coordinate system.
1172 # @param theR Cylinder radius.
1173 # @param theH Cylinder height.
1174 # @return New GEOM_Object, containing the created cylinder.
1176 # @ref tui_creation_cylinder "Example"
1177 def MakeCylinderRH(self,theR, theH):
1178 # Example: see GEOM_TestAll.py
1179 theR,theH,Parameters = ParseParameters(theR, theH)
1180 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
1181 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
1182 anObj.SetParameters(Parameters)
1185 ## Create a sphere with given center and radius.
1186 # @param thePnt Sphere center.
1187 # @param theR Sphere radius.
1188 # @return New GEOM_Object, containing the created sphere.
1190 # @ref tui_creation_sphere "Example"
1191 def MakeSpherePntR(self, thePnt, theR):
1192 # Example: see GEOM_TestAll.py
1193 theR,Parameters = ParseParameters(theR)
1194 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
1195 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
1196 anObj.SetParameters(Parameters)
1199 ## Create a sphere with given center and radius.
1200 # @param x,y,z Coordinates of sphere center.
1201 # @param theR Sphere radius.
1202 # @return New GEOM_Object, containing the created sphere.
1204 # @ref tui_creation_sphere "Example"
1205 def MakeSphere(self, x, y, z, theR):
1206 # Example: see GEOM_TestAll.py
1207 point = self.MakeVertex(x, y, z)
1208 anObj = self.MakeSpherePntR(point, theR)
1211 ## Create a sphere with given radius at the origin of coordinate system.
1212 # @param theR Sphere radius.
1213 # @return New GEOM_Object, containing the created sphere.
1215 # @ref tui_creation_sphere "Example"
1216 def MakeSphereR(self, theR):
1217 # Example: see GEOM_TestAll.py
1218 theR,Parameters = ParseParameters(theR)
1219 anObj = self.PrimOp.MakeSphereR(theR)
1220 RaiseIfFailed("MakeSphereR", self.PrimOp)
1221 anObj.SetParameters(Parameters)
1224 ## Create a cone with given base point, axis, height and radiuses.
1225 # @param thePnt Central point of the first cone base.
1226 # @param theAxis Cone axis.
1227 # @param theR1 Radius of the first cone base.
1228 # @param theR2 Radius of the second cone base.
1229 # \note If both radiuses are non-zero, the cone will be truncated.
1230 # \note If the radiuses are equal, a cylinder will be created instead.
1231 # @param theH Cone height.
1232 # @return New GEOM_Object, containing the created cone.
1234 # @ref tui_creation_cone "Example"
1235 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
1236 # Example: see GEOM_TestAll.py
1237 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1238 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
1239 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
1240 anObj.SetParameters(Parameters)
1243 ## Create a cone with given height and radiuses at
1244 # the origin of coordinate system. Axis of the cone will
1245 # be collinear to the OZ axis of the coordinate system.
1246 # @param theR1 Radius of the first cone base.
1247 # @param theR2 Radius of the second cone base.
1248 # \note If both radiuses are non-zero, the cone will be truncated.
1249 # \note If the radiuses are equal, a cylinder will be created instead.
1250 # @param theH Cone height.
1251 # @return New GEOM_Object, containing the created cone.
1253 # @ref tui_creation_cone "Example"
1254 def MakeConeR1R2H(self,theR1, theR2, theH):
1255 # Example: see GEOM_TestAll.py
1256 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1257 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
1258 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
1259 anObj.SetParameters(Parameters)
1262 ## Create a torus with given center, normal vector and radiuses.
1263 # @param thePnt Torus central point.
1264 # @param theVec Torus axis of symmetry.
1265 # @param theRMajor Torus major radius.
1266 # @param theRMinor Torus minor radius.
1267 # @return New GEOM_Object, containing the created torus.
1269 # @ref tui_creation_torus "Example"
1270 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
1271 # Example: see GEOM_TestAll.py
1272 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1273 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
1274 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
1275 anObj.SetParameters(Parameters)
1278 ## Create a torus with given radiuses at the origin of coordinate system.
1279 # @param theRMajor Torus major radius.
1280 # @param theRMinor Torus minor radius.
1281 # @return New GEOM_Object, containing the created torus.
1283 # @ref tui_creation_torus "Example"
1284 def MakeTorusRR(self, theRMajor, theRMinor):
1285 # Example: see GEOM_TestAll.py
1286 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1287 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
1288 RaiseIfFailed("MakeTorusRR", self.PrimOp)
1289 anObj.SetParameters(Parameters)
1292 # end of l3_3d_primitives
1295 ## @addtogroup l3_complex
1298 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
1299 # @param theBase Base shape to be extruded.
1300 # @param thePoint1 First end of extrusion vector.
1301 # @param thePoint2 Second end of extrusion vector.
1302 # @param theScaleFactor Use it to make prism with scaled second base.
1303 # Nagative value means not scaled second base.
1304 # @return New GEOM_Object, containing the created prism.
1306 # @ref tui_creation_prism "Example"
1307 def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0):
1308 # Example: see GEOM_TestAll.py
1311 if theScaleFactor > 0:
1312 theScaleFactor,Parameters = ParseParameters(theScaleFactor)
1313 anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor)
1315 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
1316 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1317 anObj.SetParameters(Parameters)
1320 ## Create a shape by extrusion of the base shape along a
1321 # vector, defined by two points, in 2 Ways (forward/backward).
1322 # @param theBase Base shape to be extruded.
1323 # @param thePoint1 First end of extrusion vector.
1324 # @param thePoint2 Second end of extrusion vector.
1325 # @return New GEOM_Object, containing the created prism.
1327 # @ref tui_creation_prism "Example"
1328 def MakePrism2Ways(self, theBase, thePoint1, thePoint2):
1329 # Example: see GEOM_TestAll.py
1330 anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
1331 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1334 ## Create a shape by extrusion of the base shape along the vector,
1335 # i.e. all the space, transfixed by the base shape during its translation
1336 # along the vector on the given distance.
1337 # @param theBase Base shape to be extruded.
1338 # @param theVec Direction of extrusion.
1339 # @param theH Prism dimension along theVec.
1340 # @param theScaleFactor Use it to make prism with scaled second base.
1341 # Nagative value means not scaled second base.
1342 # @return New GEOM_Object, containing the created prism.
1344 # @ref tui_creation_prism "Example"
1345 def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0):
1346 # Example: see GEOM_TestAll.py
1349 if theScaleFactor > 0:
1350 theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor)
1351 anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor)
1353 theH,Parameters = ParseParameters(theH)
1354 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
1355 RaiseIfFailed("MakePrismVecH", self.PrimOp)
1356 anObj.SetParameters(Parameters)
1359 ## Create a shape by extrusion of the base shape along the vector,
1360 # i.e. all the space, transfixed by the base shape during its translation
1361 # along the vector on the given distance in 2 Ways (forward/backward).
1362 # @param theBase Base shape to be extruded.
1363 # @param theVec Direction of extrusion.
1364 # @param theH Prism dimension along theVec in forward direction.
1365 # @return New GEOM_Object, containing the created prism.
1367 # @ref tui_creation_prism "Example"
1368 def MakePrismVecH2Ways(self, theBase, theVec, theH):
1369 # Example: see GEOM_TestAll.py
1370 theH,Parameters = ParseParameters(theH)
1371 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
1372 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
1373 anObj.SetParameters(Parameters)
1376 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1377 # @param theBase Base shape to be extruded.
1378 # @param theDX, theDY, theDZ Directions of extrusion.
1379 # @param theScaleFactor Use it to make prism with scaled second base.
1380 # Nagative value means not scaled second base.
1381 # @return New GEOM_Object, containing the created prism.
1383 # @ref tui_creation_prism "Example"
1384 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0):
1385 # Example: see GEOM_TestAll.py
1388 if theScaleFactor > 0:
1389 theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor)
1390 anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor)
1392 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1393 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
1394 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
1395 anObj.SetParameters(Parameters)
1398 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1399 # i.e. all the space, transfixed by the base shape during its translation
1400 # along the vector on the given distance in 2 Ways (forward/backward).
1401 # @param theBase Base shape to be extruded.
1402 # @param theDX, theDY, theDZ Directions of extrusion.
1403 # @return New GEOM_Object, containing the created prism.
1405 # @ref tui_creation_prism "Example"
1406 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
1407 # Example: see GEOM_TestAll.py
1408 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1409 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
1410 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
1411 anObj.SetParameters(Parameters)
1414 ## Create a shape by revolution of the base shape around the axis
1415 # on the given angle, i.e. all the space, transfixed by the base
1416 # shape during its rotation around the axis on the given angle.
1417 # @param theBase Base shape to be rotated.
1418 # @param theAxis Rotation axis.
1419 # @param theAngle Rotation angle in radians.
1420 # @return New GEOM_Object, containing the created revolution.
1422 # @ref tui_creation_revolution "Example"
1423 def MakeRevolution(self, theBase, theAxis, theAngle):
1424 # Example: see GEOM_TestAll.py
1425 theAngle,Parameters = ParseParameters(theAngle)
1426 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
1427 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
1428 anObj.SetParameters(Parameters)
1431 ## The Same Revolution but in both ways forward&backward.
1432 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
1433 theAngle,Parameters = ParseParameters(theAngle)
1434 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
1435 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
1436 anObj.SetParameters(Parameters)
1439 ## Create a filling from the given compound of contours.
1440 # @param theShape the compound of contours
1441 # @param theMinDeg a minimal degree of BSpline surface to create
1442 # @param theMaxDeg a maximal degree of BSpline surface to create
1443 # @param theTol2D a 2d tolerance to be reached
1444 # @param theTol3D a 3d tolerance to be reached
1445 # @param theNbIter a number of iteration of approximation algorithm
1446 # @param theMethod Kind of method to perform filling operation:
1447 # GEOM.FOM_Default - Default - standard behaviour
1448 # /GEOM.FOM_UseOri - Use edges orientation - orientation of edges is
1449 # used: if the edge is reversed, the curve from this edge
1450 # is reversed before using it in the filling algorithm.
1451 # /GEOM.FOM_AutoCorrect - Auto-correct orientation - changes the orientation
1452 # of the curves using minimization of sum of distances
1453 # between the end points of the edges.
1454 # @param isApprox if True, BSpline curves are generated in the process
1455 # of surface construction. By default it is False, that means
1456 # the surface is created using Besier curves. The usage of
1457 # Approximation makes the algorithm work slower, but allows
1458 # building the surface for rather complex cases
1459 # @return New GEOM_Object, containing the created filling surface.
1461 # @ref tui_creation_filling "Example"
1462 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D,
1463 theTol3D, theNbIter, theMethod=GEOM.FOM_Default, isApprox=0):
1464 # Example: see GEOM_TestAll.py
1465 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
1466 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
1467 theTol2D, theTol3D, theNbIter,
1468 theMethod, isApprox)
1469 RaiseIfFailed("MakeFilling", self.PrimOp)
1470 anObj.SetParameters(Parameters)
1473 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
1474 # @param theSeqSections - set of specified sections.
1475 # @param theModeSolid - mode defining building solid or shell
1476 # @param thePreci - precision 3D used for smoothing by default 1.e-6
1477 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
1478 # @return New GEOM_Object, containing the created shell or solid.
1480 # @ref swig_todo "Example"
1481 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
1482 # Example: see GEOM_TestAll.py
1483 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
1484 RaiseIfFailed("MakeThruSections", self.PrimOp)
1487 ## Create a shape by extrusion of the base shape along
1488 # the path shape. The path shape can be a wire or an edge.
1489 # @param theBase Base shape to be extruded.
1490 # @param thePath Path shape to extrude the base shape along it.
1491 # @return New GEOM_Object, containing the created pipe.
1493 # @ref tui_creation_pipe "Example"
1494 def MakePipe(self,theBase, thePath):
1495 # Example: see GEOM_TestAll.py
1496 anObj = self.PrimOp.MakePipe(theBase, thePath)
1497 RaiseIfFailed("MakePipe", self.PrimOp)
1500 ## Create a shape by extrusion of the profile shape along
1501 # the path shape. The path shape can be a wire or an edge.
1502 # the several profiles can be specified in the several locations of path.
1503 # @param theSeqBases - list of Bases shape to be extruded.
1504 # @param theLocations - list of locations on the path corresponding
1505 # specified list of the Bases shapes. Number of locations
1506 # should be equal to number of bases or list of locations can be empty.
1507 # @param thePath - Path shape to extrude the base shape along it.
1508 # @param theWithContact - the mode defining that the section is translated to be in
1509 # contact with the spine.
1510 # @param theWithCorrection - defining that the section is rotated to be
1511 # orthogonal to the spine tangent in the correspondent point
1512 # @return New GEOM_Object, containing the created pipe.
1514 # @ref tui_creation_pipe_with_diff_sec "Example"
1515 def MakePipeWithDifferentSections(self, theSeqBases,
1516 theLocations, thePath,
1517 theWithContact, theWithCorrection):
1518 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
1519 theLocations, thePath,
1520 theWithContact, theWithCorrection)
1521 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
1524 ## Create a shape by extrusion of the profile shape along
1525 # the path shape. The path shape can be a wire or a edge.
1526 # the several profiles can be specified in the several locations of path.
1527 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
1528 # shell or face. If number of faces in neighbour sections
1529 # aren't coincided result solid between such sections will
1530 # be created using external boundaries of this shells.
1531 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
1532 # This list is used for searching correspondences between
1533 # faces in the sections. Size of this list must be equal
1534 # to size of list of base shapes.
1535 # @param theLocations - list of locations on the path corresponding
1536 # specified list of the Bases shapes. Number of locations
1537 # should be equal to number of bases. First and last
1538 # locations must be coincided with first and last vertexes
1539 # of path correspondingly.
1540 # @param thePath - Path shape to extrude the base shape along it.
1541 # @param theWithContact - the mode defining that the section is translated to be in
1542 # contact with the spine.
1543 # @param theWithCorrection - defining that the section is rotated to be
1544 # orthogonal to the spine tangent in the correspondent point
1545 # @return New GEOM_Object, containing the created solids.
1547 # @ref tui_creation_pipe_with_shell_sec "Example"
1548 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
1549 theLocations, thePath,
1550 theWithContact, theWithCorrection):
1551 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
1552 theLocations, thePath,
1553 theWithContact, theWithCorrection)
1554 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1557 ## Create a shape by extrusion of the profile shape along
1558 # the path shape. This function is used only for debug pipe
1559 # functionality - it is a version of previous function
1560 # (MakePipeWithShellSections(...)) which give a possibility to
1561 # recieve information about creating pipe between each pair of
1562 # sections step by step.
1563 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
1564 theLocations, thePath,
1565 theWithContact, theWithCorrection):
1567 nbsect = len(theSeqBases)
1568 nbsubsect = len(theSeqSubBases)
1569 #print "nbsect = ",nbsect
1570 for i in range(1,nbsect):
1572 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
1573 tmpLocations = [ theLocations[i-1], theLocations[i] ]
1575 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
1576 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
1577 tmpLocations, thePath,
1578 theWithContact, theWithCorrection)
1579 if self.PrimOp.IsDone() == 0:
1580 print "Problems with pipe creation between ",i," and ",i+1," sections"
1581 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1584 print "Pipe between ",i," and ",i+1," sections is OK"
1589 resc = self.MakeCompound(res)
1590 #resc = self.MakeSewing(res, 0.001)
1591 #print "resc: ",resc
1594 ## Create solids between given sections
1595 # @param theSeqBases - list of sections (shell or face).
1596 # @param theLocations - list of corresponding vertexes
1597 # @return New GEOM_Object, containing the created solids.
1599 # @ref tui_creation_pipe_without_path "Example"
1600 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1601 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1602 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1605 ## Create a shape by extrusion of the base shape along
1606 # the path shape with constant bi-normal direction along the given vector.
1607 # The path shape can be a wire or an edge.
1608 # @param theBase Base shape to be extruded.
1609 # @param thePath Path shape to extrude the base shape along it.
1610 # @param theVec Vector defines a constant binormal direction to keep the
1611 # same angle beetween the direction and the sections
1612 # along the sweep surface.
1613 # @return New GEOM_Object, containing the created pipe.
1615 # @ref tui_creation_pipe "Example"
1616 def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
1617 # Example: see GEOM_TestAll.py
1618 anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
1619 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
1625 ## @addtogroup l3_advanced
1628 ## Create a linear edge with specified ends.
1629 # @param thePnt1 Point for the first end of edge.
1630 # @param thePnt2 Point for the second end of edge.
1631 # @return New GEOM_Object, containing the created edge.
1633 # @ref tui_creation_edge "Example"
1634 def MakeEdge(self,thePnt1, thePnt2):
1635 # Example: see GEOM_TestAll.py
1636 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1637 RaiseIfFailed("MakeEdge", self.ShapesOp)
1640 ## Create a new edge, corresponding to the given length on the given curve.
1641 # @param theRefCurve The referenced curve (edge).
1642 # @param theLength Length on the referenced curve. It can be negative.
1643 # @param theStartPoint Any point can be selected for it, the new edge will begin
1644 # at the end of \a theRefCurve, close to the selected point.
1645 # If None, start from the first point of \a theRefCurve.
1646 # @return New GEOM_Object, containing the created edge.
1648 # @ref tui_creation_edge "Example"
1649 def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
1650 # Example: see GEOM_TestAll.py
1651 theLength, Parameters = ParseParameters(theLength)
1652 anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
1653 RaiseIfFailed("MakeEdgeOnCurveByLength", self.BasicOp)
1654 anObj.SetParameters(Parameters)
1657 ## Create an edge from specified wire.
1658 # @param theWire source Wire.
1659 # @param theLinearTolerance linear tolerance value.
1660 # @param theAngularTolerance angular tolerance value.
1661 # @return New GEOM_Object, containing the created edge.
1663 # @ref tui_creation_edge "Example"
1664 def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12):
1665 # Example: see GEOM_TestAll.py
1666 anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
1667 RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
1670 ## Create a wire from the set of edges and wires.
1671 # @param theEdgesAndWires List of edges and/or wires.
1672 # @param theTolerance Maximum distance between vertices, that will be merged.
1673 # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
1674 # @return New GEOM_Object, containing the created wire.
1676 # @ref tui_creation_wire "Example"
1677 def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07):
1678 # Example: see GEOM_TestAll.py
1679 anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
1680 RaiseIfFailed("MakeWire", self.ShapesOp)
1683 ## Create a face on the given wire.
1684 # @param theWire closed Wire or Edge to build the face on.
1685 # @param isPlanarWanted If TRUE, only planar face will be built.
1686 # If impossible, NULL object will be returned.
1687 # @return New GEOM_Object, containing the created face.
1689 # @ref tui_creation_face "Example"
1690 def MakeFace(self,theWire, isPlanarWanted):
1691 # Example: see GEOM_TestAll.py
1692 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1693 RaiseIfFailed("MakeFace", self.ShapesOp)
1696 ## Create a face on the given wires set.
1697 # @param theWires List of closed wires or edges to build the face on.
1698 # @param isPlanarWanted If TRUE, only planar face will be built.
1699 # If impossible, NULL object will be returned.
1700 # @return New GEOM_Object, containing the created face.
1702 # @ref tui_creation_face "Example"
1703 def MakeFaceWires(self,theWires, isPlanarWanted):
1704 # Example: see GEOM_TestAll.py
1705 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1706 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1709 ## Shortcut to MakeFaceWires()
1711 # @ref tui_creation_face "Example 1"
1712 # \n @ref swig_MakeFaces "Example 2"
1713 def MakeFaces(self,theWires, isPlanarWanted):
1714 # Example: see GEOM_TestOthers.py
1715 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1718 ## Create a shell from the set of faces and shells.
1719 # @param theFacesAndShells List of faces and/or shells.
1720 # @return New GEOM_Object, containing the created shell.
1722 # @ref tui_creation_shell "Example"
1723 def MakeShell(self,theFacesAndShells):
1724 # Example: see GEOM_TestAll.py
1725 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1726 RaiseIfFailed("MakeShell", self.ShapesOp)
1729 ## Create a solid, bounded by the given shells.
1730 # @param theShells Sequence of bounding shells.
1731 # @return New GEOM_Object, containing the created solid.
1733 # @ref tui_creation_solid "Example"
1734 def MakeSolid(self,theShells):
1735 # Example: see GEOM_TestAll.py
1736 anObj = self.ShapesOp.MakeSolidShells(theShells)
1737 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1740 ## Create a compound of the given shapes.
1741 # @param theShapes List of shapes to put in compound.
1742 # @return New GEOM_Object, containing the created compound.
1744 # @ref tui_creation_compound "Example"
1745 def MakeCompound(self,theShapes):
1746 # Example: see GEOM_TestAll.py
1747 anObj = self.ShapesOp.MakeCompound(theShapes)
1748 RaiseIfFailed("MakeCompound", self.ShapesOp)
1751 # end of l3_advanced
1754 ## @addtogroup l2_measure
1757 ## Gives quantity of faces in the given shape.
1758 # @param theShape Shape to count faces of.
1759 # @return Quantity of faces.
1761 # @ref swig_NumberOf "Example"
1762 def NumberOfFaces(self, theShape):
1763 # Example: see GEOM_TestOthers.py
1764 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1765 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1768 ## Gives quantity of edges in the given shape.
1769 # @param theShape Shape to count edges of.
1770 # @return Quantity of edges.
1772 # @ref swig_NumberOf "Example"
1773 def NumberOfEdges(self, theShape):
1774 # Example: see GEOM_TestOthers.py
1775 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1776 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1779 ## Gives quantity of subshapes of type theShapeType in the given shape.
1780 # @param theShape Shape to count subshapes of.
1781 # @param theShapeType Type of subshapes to count.
1782 # @return Quantity of subshapes of given type.
1784 # @ref swig_NumberOf "Example"
1785 def NumberOfSubShapes(self, theShape, theShapeType):
1786 # Example: see GEOM_TestOthers.py
1787 nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
1788 RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
1791 ## Gives quantity of solids in the given shape.
1792 # @param theShape Shape to count solids in.
1793 # @return Quantity of solids.
1795 # @ref swig_NumberOf "Example"
1796 def NumberOfSolids(self, theShape):
1797 # Example: see GEOM_TestOthers.py
1798 nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["SOLID"])
1799 RaiseIfFailed("NumberOfSolids", self.ShapesOp)
1805 ## @addtogroup l3_healing
1808 ## Reverses an orientation the given shape.
1809 # @param theShape Shape to be reversed.
1810 # @return The reversed copy of theShape.
1812 # @ref swig_ChangeOrientation "Example"
1813 def ChangeOrientation(self,theShape):
1814 # Example: see GEOM_TestAll.py
1815 anObj = self.ShapesOp.ChangeOrientation(theShape)
1816 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1819 ## Shortcut to ChangeOrientation()
1821 # @ref swig_OrientationChange "Example"
1822 def OrientationChange(self,theShape):
1823 # Example: see GEOM_TestOthers.py
1824 anObj = self.ChangeOrientation(theShape)
1830 ## @addtogroup l4_obtain
1833 ## Retrieve all free faces from the given shape.
1834 # Free face is a face, which is not shared between two shells of the shape.
1835 # @param theShape Shape to find free faces in.
1836 # @return List of IDs of all free faces, contained in theShape.
1838 # @ref tui_measurement_tools_page "Example"
1839 def GetFreeFacesIDs(self,theShape):
1840 # Example: see GEOM_TestOthers.py
1841 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1842 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1845 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1846 # @param theShape1 Shape to find sub-shapes in.
1847 # @param theShape2 Shape to find shared sub-shapes with.
1848 # @param theShapeType Type of sub-shapes to be retrieved.
1849 # @return List of sub-shapes of theShape1, shared with theShape2.
1851 # @ref swig_GetSharedShapes "Example"
1852 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1853 # Example: see GEOM_TestOthers.py
1854 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1855 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1858 ## Get all sub-shapes, shared by all shapes in the list <VAR>theShapes</VAR>.
1859 # @param theShapes Shapes to find common sub-shapes of.
1860 # @param theShapeType Type of sub-shapes to be retrieved.
1861 # @return List of objects, that are sub-shapes of all given shapes.
1863 # @ref swig_GetSharedShapes "Example"
1864 def GetSharedShapesMulti(self, theShapes, theShapeType):
1865 # Example: see GEOM_TestOthers.py
1866 aList = self.ShapesOp.GetSharedShapesMulti(theShapes, theShapeType)
1867 RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
1870 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1871 # situated relatively the specified plane by the certain way,
1872 # defined through <VAR>theState</VAR> parameter.
1873 # @param theShape Shape to find sub-shapes of.
1874 # @param theShapeType Type of sub-shapes to be retrieved.
1875 # @param theAx1 Vector (or line, or linear edge), specifying normal
1876 # direction and location of the plane to find shapes on.
1877 # @param theState The state of the subshapes to find. It can be one of
1878 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1879 # @return List of all found sub-shapes.
1881 # @ref swig_GetShapesOnPlane "Example"
1882 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1883 # Example: see GEOM_TestOthers.py
1884 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1885 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1888 ## Works like the above method, but returns list of sub-shapes indices
1890 # @ref swig_GetShapesOnPlaneIDs "Example"
1891 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1892 # Example: see GEOM_TestOthers.py
1893 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1894 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1897 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1898 # situated relatively the specified plane by the certain way,
1899 # defined through <VAR>theState</VAR> parameter.
1900 # @param theShape Shape to find sub-shapes of.
1901 # @param theShapeType Type of sub-shapes to be retrieved.
1902 # @param theAx1 Vector (or line, or linear edge), specifying normal
1903 # direction of the plane to find shapes on.
1904 # @param thePnt Point specifying location of the plane to find shapes on.
1905 # @param theState The state of the subshapes to find. It can be one of
1906 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1907 # @return List of all found sub-shapes.
1909 # @ref swig_GetShapesOnPlaneWithLocation "Example"
1910 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1911 # Example: see GEOM_TestOthers.py
1912 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1913 theAx1, thePnt, theState)
1914 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1917 ## Works like the above method, but returns list of sub-shapes indices
1919 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
1920 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1921 # Example: see GEOM_TestOthers.py
1922 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1923 theAx1, thePnt, theState)
1924 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1927 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1928 # the specified cylinder by the certain way, defined through \a theState parameter.
1929 # @param theShape Shape to find sub-shapes of.
1930 # @param theShapeType Type of sub-shapes to be retrieved.
1931 # @param theAxis Vector (or line, or linear edge), specifying
1932 # axis of the cylinder to find shapes on.
1933 # @param theRadius Radius of the cylinder to find shapes on.
1934 # @param theState The state of the subshapes to find. It can be one of
1935 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1936 # @return List of all found sub-shapes.
1938 # @ref swig_GetShapesOnCylinder "Example"
1939 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1940 # Example: see GEOM_TestOthers.py
1941 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1942 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1945 ## Works like the above method, but returns list of sub-shapes indices
1947 # @ref swig_GetShapesOnCylinderIDs "Example"
1948 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1949 # Example: see GEOM_TestOthers.py
1950 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1951 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1954 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1955 # the specified cylinder by the certain way, defined through \a theState parameter.
1956 # @param theShape Shape to find sub-shapes of.
1957 # @param theShapeType Type of sub-shapes to be retrieved.
1958 # @param theAxis Vector (or line, or linear edge), specifying
1959 # axis of the cylinder to find shapes on.
1960 # @param thePnt Point specifying location of the bottom of the cylinder.
1961 # @param theRadius Radius of the cylinder to find shapes on.
1962 # @param theState The state of the subshapes to find. It can be one of
1963 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1964 # @return List of all found sub-shapes.
1966 # @ref swig_GetShapesOnCylinderWithLocation "Example"
1967 def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
1968 # Example: see GEOM_TestOthers.py
1969 aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
1970 RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
1973 ## Works like the above method, but returns list of sub-shapes indices
1975 # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
1976 def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
1977 # Example: see GEOM_TestOthers.py
1978 aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
1979 RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
1982 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1983 # the specified sphere by the certain way, defined through \a theState parameter.
1984 # @param theShape Shape to find sub-shapes of.
1985 # @param theShapeType Type of sub-shapes to be retrieved.
1986 # @param theCenter Point, specifying center of the sphere to find shapes on.
1987 # @param theRadius Radius of the sphere to find shapes on.
1988 # @param theState The state of the subshapes to find. It can be one of
1989 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1990 # @return List of all found sub-shapes.
1992 # @ref swig_GetShapesOnSphere "Example"
1993 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1994 # Example: see GEOM_TestOthers.py
1995 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1996 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1999 ## Works like the above method, but returns list of sub-shapes indices
2001 # @ref swig_GetShapesOnSphereIDs "Example"
2002 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
2003 # Example: see GEOM_TestOthers.py
2004 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
2005 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
2008 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
2009 # the specified quadrangle by the certain way, defined through \a theState parameter.
2010 # @param theShape Shape to find sub-shapes of.
2011 # @param theShapeType Type of sub-shapes to be retrieved.
2012 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
2013 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
2014 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
2015 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
2016 # @param theState The state of the subshapes to find. It can be one of
2017 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2018 # @return List of all found sub-shapes.
2020 # @ref swig_GetShapesOnQuadrangle "Example"
2021 def GetShapesOnQuadrangle(self, theShape, theShapeType,
2022 theTopLeftPoint, theTopRigthPoint,
2023 theBottomLeftPoint, theBottomRigthPoint, theState):
2024 # Example: see GEOM_TestOthers.py
2025 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
2026 theTopLeftPoint, theTopRigthPoint,
2027 theBottomLeftPoint, theBottomRigthPoint, theState)
2028 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
2031 ## Works like the above method, but returns list of sub-shapes indices
2033 # @ref swig_GetShapesOnQuadrangleIDs "Example"
2034 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
2035 theTopLeftPoint, theTopRigthPoint,
2036 theBottomLeftPoint, theBottomRigthPoint, theState):
2037 # Example: see GEOM_TestOthers.py
2038 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
2039 theTopLeftPoint, theTopRigthPoint,
2040 theBottomLeftPoint, theBottomRigthPoint, theState)
2041 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
2044 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
2045 # the specified \a theBox by the certain way, defined through \a theState parameter.
2046 # @param theBox Shape for relative comparing.
2047 # @param theShape Shape to find sub-shapes of.
2048 # @param theShapeType Type of sub-shapes to be retrieved.
2049 # @param theState The state of the subshapes to find. It can be one of
2050 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2051 # @return List of all found sub-shapes.
2053 # @ref swig_GetShapesOnBox "Example"
2054 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
2055 # Example: see GEOM_TestOthers.py
2056 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
2057 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
2060 ## Works like the above method, but returns list of sub-shapes indices
2062 # @ref swig_GetShapesOnBoxIDs "Example"
2063 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
2064 # Example: see GEOM_TestOthers.py
2065 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
2066 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
2069 ## Find in \a theShape all sub-shapes of type \a theShapeType,
2070 # situated relatively the specified \a theCheckShape by the
2071 # certain way, defined through \a theState parameter.
2072 # @param theCheckShape Shape for relative comparing. It must be a solid.
2073 # @param theShape Shape to find sub-shapes of.
2074 # @param theShapeType Type of sub-shapes to be retrieved.
2075 # @param theState The state of the subshapes to find. It can be one of
2076 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2077 # @return List of all found sub-shapes.
2079 # @ref swig_GetShapesOnShape "Example"
2080 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
2081 # Example: see GEOM_TestOthers.py
2082 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
2083 theShapeType, theState)
2084 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
2087 ## Works like the above method, but returns result as compound
2089 # @ref swig_GetShapesOnShapeAsCompound "Example"
2090 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
2091 # Example: see GEOM_TestOthers.py
2092 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
2093 theShapeType, theState)
2094 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
2097 ## Works like the above method, but returns list of sub-shapes indices
2099 # @ref swig_GetShapesOnShapeIDs "Example"
2100 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
2101 # Example: see GEOM_TestOthers.py
2102 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
2103 theShapeType, theState)
2104 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
2107 ## Get sub-shape(s) of theShapeWhere, which are
2108 # coincident with \a theShapeWhat or could be a part of it.
2109 # @param theShapeWhere Shape to find sub-shapes of.
2110 # @param theShapeWhat Shape, specifying what to find.
2111 # @return Group of all found sub-shapes or a single found sub-shape.
2113 # @note This function has a restriction on argument shapes.
2114 # If \a theShapeWhere has curved parts with significantly
2115 # outstanding centres (i.e. the mass centre of a part is closer to
2116 # \a theShapeWhat than to the part), such parts will not be found.
2117 # @image html get_in_place_lost_part.png
2119 # @ref swig_GetInPlace "Example"
2120 def GetInPlace(self, theShapeWhere, theShapeWhat):
2121 # Example: see GEOM_TestOthers.py
2122 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
2123 RaiseIfFailed("GetInPlace", self.ShapesOp)
2126 ## Get sub-shape(s) of \a theShapeWhere, which are
2127 # coincident with \a theShapeWhat or could be a part of it.
2129 # Implementation of this method is based on a saved history of an operation,
2130 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
2131 # arguments (an argument shape or a sub-shape of an argument shape).
2132 # The operation could be the Partition or one of boolean operations,
2133 # performed on simple shapes (not on compounds).
2135 # @param theShapeWhere Shape to find sub-shapes of.
2136 # @param theShapeWhat Shape, specifying what to find (must be in the
2137 # building history of the ShapeWhere).
2138 # @return Group of all found sub-shapes or a single found sub-shape.
2140 # @ref swig_GetInPlace "Example"
2141 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
2142 # Example: see GEOM_TestOthers.py
2143 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
2144 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
2147 ## Get sub-shape of theShapeWhere, which is
2148 # equal to \a theShapeWhat.
2149 # @param theShapeWhere Shape to find sub-shape of.
2150 # @param theShapeWhat Shape, specifying what to find.
2151 # @return New GEOM_Object for found sub-shape.
2153 # @ref swig_GetSame "Example"
2154 def GetSame(self,theShapeWhere, theShapeWhat):
2155 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
2156 RaiseIfFailed("GetSame", self.ShapesOp)
2162 ## @addtogroup l4_access
2165 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
2166 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
2168 # @ref swig_all_decompose "Example"
2169 def GetSubShape(self, aShape, ListOfID):
2170 # Example: see GEOM_TestAll.py
2171 anObj = self.AddSubShape(aShape,ListOfID)
2174 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
2176 # @ref swig_all_decompose "Example"
2177 def GetSubShapeID(self, aShape, aSubShape):
2178 # Example: see GEOM_TestAll.py
2179 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
2180 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
2186 ## @addtogroup l4_decompose
2189 ## Get all sub-shapes and groups of \a theShape,
2190 # that were created already by any other methods.
2191 # @param theShape Any shape.
2192 # @param theGroupsOnly If this parameter is TRUE, only groups will be
2193 # returned, else all found sub-shapes and groups.
2194 # @return List of existing sub-objects of \a theShape.
2196 # @ref swig_all_decompose "Example"
2197 def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
2198 # Example: see GEOM_TestAll.py
2199 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
2200 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
2203 ## Get all groups of \a theShape,
2204 # that were created already by any other methods.
2205 # @param theShape Any shape.
2206 # @return List of existing groups of \a theShape.
2208 # @ref swig_all_decompose "Example"
2209 def GetGroups(self, theShape):
2210 # Example: see GEOM_TestAll.py
2211 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
2212 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
2215 ## Explode a shape on subshapes of a given type.
2216 # If the shape itself matches the type, it is also returned.
2217 # @param aShape Shape to be exploded.
2218 # @param aType Type of sub-shapes to be retrieved.
2219 # @return List of sub-shapes of type theShapeType, contained in theShape.
2221 # @ref swig_all_decompose "Example"
2222 def SubShapeAll(self, aShape, aType):
2223 # Example: see GEOM_TestAll.py
2224 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, False)
2225 RaiseIfFailed("SubShapeAll", self.ShapesOp)
2228 ## Explode a shape on subshapes of a given type.
2229 # @param aShape Shape to be exploded.
2230 # @param aType Type of sub-shapes to be retrieved.
2231 # @return List of IDs of sub-shapes.
2233 # @ref swig_all_decompose "Example"
2234 def SubShapeAllIDs(self, aShape, aType):
2235 ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, False)
2236 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2239 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2240 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
2241 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2243 # @ref swig_all_decompose "Example"
2244 def SubShape(self, aShape, aType, ListOfInd):
2245 # Example: see GEOM_TestAll.py
2247 AllShapeIDsList = self.SubShapeAllIDs(aShape, aType)
2248 for ind in ListOfInd:
2249 ListOfIDs.append(AllShapeIDsList[ind - 1])
2250 anObj = self.GetSubShape(aShape, ListOfIDs)
2253 ## Explode a shape on subshapes of a given type.
2254 # Sub-shapes will be sorted by coordinates of their gravity centers.
2255 # If the shape itself matches the type, it is also returned.
2256 # @param aShape Shape to be exploded.
2257 # @param aType Type of sub-shapes to be retrieved.
2258 # @return List of sub-shapes of type theShapeType, contained in theShape.
2260 # @ref swig_SubShapeAllSorted "Example"
2261 def SubShapeAllSortedCentres(self, aShape, aType):
2262 # Example: see GEOM_TestAll.py
2263 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, True)
2264 RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
2267 ## Explode a shape on subshapes of a given type.
2268 # Sub-shapes will be sorted by coordinates of their gravity centers.
2269 # @param aShape Shape to be exploded.
2270 # @param aType Type of sub-shapes to be retrieved.
2271 # @return List of IDs of sub-shapes.
2273 # @ref swig_all_decompose "Example"
2274 def SubShapeAllSortedCentresIDs(self, aShape, aType):
2275 ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, True)
2276 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2279 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2280 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
2281 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2283 # @ref swig_all_decompose "Example"
2284 def SubShapeSortedCentres(self, aShape, aType, ListOfInd):
2285 # Example: see GEOM_TestAll.py
2287 AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, aType)
2288 for ind in ListOfInd:
2289 ListOfIDs.append(AllShapeIDsList[ind - 1])
2290 anObj = self.GetSubShape(aShape, ListOfIDs)
2293 ## Extract shapes (excluding the main shape) of given type.
2294 # @param aShape The shape.
2295 # @param aType The shape type.
2296 # @param isSorted Boolean flag to switch sorting on/off.
2297 # @return List of sub-shapes of type aType, contained in aShape.
2299 # @ref swig_FilletChamfer "Example"
2300 def ExtractShapes(self, aShape, aType, isSorted = False):
2301 # Example: see GEOM_TestAll.py
2302 ListObj = self.ShapesOp.ExtractSubShapes(aShape, aType, isSorted)
2303 RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
2306 # end of l4_decompose
2309 ## @addtogroup l4_decompose_d
2312 ## Deprecated method
2313 # It works like SubShapeAllSortedCentres, but wrongly
2314 # defines centres of faces, shells and solids.
2315 def SubShapeAllSorted(self, aShape, aType):
2316 ListObj = self.ShapesOp.MakeExplode(aShape, aType, True)
2317 RaiseIfFailed("MakeExplode", self.ShapesOp)
2320 ## Deprecated method
2321 # It works like SubShapeAllSortedCentresIDs, but wrongly
2322 # defines centres of faces, shells and solids.
2323 def SubShapeAllSortedIDs(self, aShape, aType):
2324 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, aType, True)
2325 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2328 ## Deprecated method
2329 # It works like SubShapeSortedCentres, but has a bug
2330 # (wrongly defines centres of faces, shells and solids).
2331 def SubShapeSorted(self, aShape, aType, ListOfInd):
2333 AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, aType)
2334 for ind in ListOfInd:
2335 ListOfIDs.append(AllShapeIDsList[ind - 1])
2336 anObj = self.GetSubShape(aShape, ListOfIDs)
2339 # end of l4_decompose_d
2342 ## @addtogroup l3_healing
2345 ## Apply a sequence of Shape Healing operators to the given object.
2346 # @param theShape Shape to be processed.
2347 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
2348 # @param theParameters List of names of parameters
2349 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
2350 # @param theValues List of values of parameters, in the same order
2351 # as parameters are listed in <VAR>theParameters</VAR> list.
2352 # @return New GEOM_Object, containing processed shape.
2354 # @ref tui_shape_processing "Example"
2355 def ProcessShape(self, theShape, theOperators, theParameters, theValues):
2356 # Example: see GEOM_TestHealing.py
2357 theValues,Parameters = ParseList(theValues)
2358 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
2359 # To avoid script failure in case of good argument shape
2360 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
2362 RaiseIfFailed("ProcessShape", self.HealOp)
2363 for string in (theOperators + theParameters):
2364 Parameters = ":" + Parameters
2366 anObj.SetParameters(Parameters)
2369 ## Remove faces from the given object (shape).
2370 # @param theObject Shape to be processed.
2371 # @param theFaces Indices of faces to be removed, if EMPTY then the method
2372 # removes ALL faces of the given object.
2373 # @return New GEOM_Object, containing processed shape.
2375 # @ref tui_suppress_faces "Example"
2376 def SuppressFaces(self,theObject, theFaces):
2377 # Example: see GEOM_TestHealing.py
2378 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
2379 RaiseIfFailed("SuppressFaces", self.HealOp)
2382 ## Sewing of some shapes into single shape.
2384 # @ref tui_sewing "Example"
2385 def MakeSewing(self, ListShape, theTolerance):
2386 # Example: see GEOM_TestHealing.py
2387 comp = self.MakeCompound(ListShape)
2388 anObj = self.Sew(comp, theTolerance)
2391 ## Sewing of the given object.
2392 # @param theObject Shape to be processed.
2393 # @param theTolerance Required tolerance value.
2394 # @return New GEOM_Object, containing processed shape.
2395 def Sew(self, theObject, theTolerance):
2396 # Example: see MakeSewing() above
2397 theTolerance,Parameters = ParseParameters(theTolerance)
2398 anObj = self.HealOp.Sew(theObject, theTolerance)
2399 RaiseIfFailed("Sew", self.HealOp)
2400 anObj.SetParameters(Parameters)
2403 ## Remove internal wires and edges from the given object (face).
2404 # @param theObject Shape to be processed.
2405 # @param theWires Indices of wires to be removed, if EMPTY then the method
2406 # removes ALL internal wires of the given object.
2407 # @return New GEOM_Object, containing processed shape.
2409 # @ref tui_suppress_internal_wires "Example"
2410 def SuppressInternalWires(self,theObject, theWires):
2411 # Example: see GEOM_TestHealing.py
2412 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
2413 RaiseIfFailed("RemoveIntWires", self.HealOp)
2416 ## Remove internal closed contours (holes) from the given object.
2417 # @param theObject Shape to be processed.
2418 # @param theWires Indices of wires to be removed, if EMPTY then the method
2419 # removes ALL internal holes of the given object
2420 # @return New GEOM_Object, containing processed shape.
2422 # @ref tui_suppress_holes "Example"
2423 def SuppressHoles(self,theObject, theWires):
2424 # Example: see GEOM_TestHealing.py
2425 anObj = self.HealOp.FillHoles(theObject, theWires)
2426 RaiseIfFailed("FillHoles", self.HealOp)
2429 ## Close an open wire.
2430 # @param theObject Shape to be processed.
2431 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
2432 # if [ ], then <VAR>theObject</VAR> itself is a wire.
2433 # @param isCommonVertex If True : closure by creation of a common vertex,
2434 # If False : closure by creation of an edge between ends.
2435 # @return New GEOM_Object, containing processed shape.
2437 # @ref tui_close_contour "Example"
2438 def CloseContour(self,theObject, theWires, isCommonVertex):
2439 # Example: see GEOM_TestHealing.py
2440 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
2441 RaiseIfFailed("CloseContour", self.HealOp)
2444 ## Addition of a point to a given edge object.
2445 # @param theObject Shape to be processed.
2446 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
2447 # if -1, then theObject itself is the edge.
2448 # @param theValue Value of parameter on edge or length parameter,
2449 # depending on \a isByParameter.
2450 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
2451 # if FALSE : \a theValue is treated as a length parameter [0..1]
2452 # @return New GEOM_Object, containing processed shape.
2454 # @ref tui_add_point_on_edge "Example"
2455 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
2456 # Example: see GEOM_TestHealing.py
2457 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
2458 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
2459 RaiseIfFailed("DivideEdge", self.HealOp)
2460 anObj.SetParameters(Parameters)
2463 ## Change orientation of the given object. Updates given shape.
2464 # @param theObject Shape to be processed.
2466 # @ref swig_todo "Example"
2467 def ChangeOrientationShell(self,theObject):
2468 theObject = self.HealOp.ChangeOrientation(theObject)
2469 RaiseIfFailed("ChangeOrientation", self.HealOp)
2472 ## Change orientation of the given object.
2473 # @param theObject Shape to be processed.
2474 # @return New GEOM_Object, containing processed shape.
2476 # @ref swig_todo "Example"
2477 def ChangeOrientationShellCopy(self, theObject):
2478 anObj = self.HealOp.ChangeOrientationCopy(theObject)
2479 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
2482 ## Try to limit tolerance of the given object by value \a theTolerance.
2483 # @param theObject Shape to be processed.
2484 # @param theTolerance Required tolerance value.
2485 # @return New GEOM_Object, containing processed shape.
2487 # @ref tui_limit_tolerance "Example"
2488 def LimitTolerance(self, theObject, theTolerance = 1e-07):
2489 anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
2490 RaiseIfFailed("LimitTolerance", self.HealOp)
2493 ## Get a list of wires (wrapped in GEOM_Object-s),
2494 # that constitute a free boundary of the given shape.
2495 # @param theObject Shape to get free boundary of.
2496 # @return [status, theClosedWires, theOpenWires]
2497 # status: FALSE, if an error(s) occured during the method execution.
2498 # theClosedWires: Closed wires on the free boundary of the given shape.
2499 # theOpenWires: Open wires on the free boundary of the given shape.
2501 # @ref tui_measurement_tools_page "Example"
2502 def GetFreeBoundary(self, theObject):
2503 # Example: see GEOM_TestHealing.py
2504 anObj = self.HealOp.GetFreeBoundary(theObject)
2505 RaiseIfFailed("GetFreeBoundary", self.HealOp)
2508 ## Replace coincident faces in theShape by one face.
2509 # @param theShape Initial shape.
2510 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
2511 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2512 # otherwise all initial shapes.
2513 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
2515 # @ref tui_glue_faces "Example"
2516 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
2517 # Example: see GEOM_Spanner.py
2518 theTolerance,Parameters = ParseParameters(theTolerance)
2519 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
2521 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
2522 anObj.SetParameters(Parameters)
2525 ## Find coincident faces in theShape for possible gluing.
2526 # @param theShape Initial shape.
2527 # @param theTolerance Maximum distance between faces,
2528 # which can be considered as coincident.
2531 # @ref swig_todo "Example"
2532 def GetGlueFaces(self, theShape, theTolerance):
2533 # Example: see GEOM_Spanner.py
2534 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
2535 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
2538 ## Replace coincident faces in theShape by one face
2539 # in compliance with given list of faces
2540 # @param theShape Initial shape.
2541 # @param theTolerance Maximum distance between faces,
2542 # which can be considered as coincident.
2543 # @param theFaces List of faces for gluing.
2544 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2545 # otherwise all initial shapes.
2546 # @return New GEOM_Object, containing a copy of theShape
2547 # without some faces.
2549 # @ref swig_todo "Example"
2550 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
2551 # Example: see GEOM_Spanner.py
2552 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
2554 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
2560 ## @addtogroup l3_boolean Boolean Operations
2563 # -----------------------------------------------------------------------------
2564 # Boolean (Common, Cut, Fuse, Section)
2565 # -----------------------------------------------------------------------------
2567 ## Perform one of boolean operations on two given shapes.
2568 # @param theShape1 First argument for boolean operation.
2569 # @param theShape2 Second argument for boolean operation.
2570 # @param theOperation Indicates the operation to be done:
2571 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
2572 # @return New GEOM_Object, containing the result shape.
2574 # @ref tui_fuse "Example"
2575 def MakeBoolean(self,theShape1, theShape2, theOperation):
2576 # Example: see GEOM_TestAll.py
2577 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
2578 RaiseIfFailed("MakeBoolean", self.BoolOp)
2581 ## Shortcut to MakeBoolean(s1, s2, 1)
2583 # @ref tui_common "Example 1"
2584 # \n @ref swig_MakeCommon "Example 2"
2585 def MakeCommon(self, s1, s2):
2586 # Example: see GEOM_TestOthers.py
2587 return self.MakeBoolean(s1, s2, 1)
2589 ## Shortcut to MakeBoolean(s1, s2, 2)
2591 # @ref tui_cut "Example 1"
2592 # \n @ref swig_MakeCommon "Example 2"
2593 def MakeCut(self, s1, s2):
2594 # Example: see GEOM_TestOthers.py
2595 return self.MakeBoolean(s1, s2, 2)
2597 ## Shortcut to MakeBoolean(s1, s2, 3)
2599 # @ref tui_fuse "Example 1"
2600 # \n @ref swig_MakeCommon "Example 2"
2601 def MakeFuse(self, s1, s2):
2602 # Example: see GEOM_TestOthers.py
2603 return self.MakeBoolean(s1, s2, 3)
2605 ## Shortcut to MakeBoolean(s1, s2, 4)
2607 # @ref tui_section "Example 1"
2608 # \n @ref swig_MakeCommon "Example 2"
2609 def MakeSection(self, s1, s2):
2610 # Example: see GEOM_TestOthers.py
2611 return self.MakeBoolean(s1, s2, 4)
2616 ## @addtogroup l3_basic_op
2619 ## Perform partition operation.
2620 # @param ListShapes Shapes to be intersected.
2621 # @param ListTools Shapes to intersect theShapes.
2622 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
2623 # in order to avoid possible intersection between shapes from
2625 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
2626 # If this parameter is set to -1 ("Auto"), most appropriate shape limit
2627 # type will be detected automatically.
2628 # @param KeepNonlimitShapes: if this parameter == 0, then only shapes of
2629 # target type (equal to Limit) are kept in the result,
2630 # else standalone shapes of lower dimension
2631 # are kept also (if they exist).
2633 # After implementation new version of PartitionAlgo (October 2006)
2634 # other parameters are ignored by current functionality. They are kept
2635 # in this function only for support old versions.
2636 # Ignored parameters:
2637 # @param ListKeepInside Shapes, outside which the results will be deleted.
2638 # Each shape from theKeepInside must belong to theShapes also.
2639 # @param ListRemoveInside Shapes, inside which the results will be deleted.
2640 # Each shape from theRemoveInside must belong to theShapes also.
2641 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
2642 # @param ListMaterials Material indices for each shape. Make sence,
2643 # only if theRemoveWebs is TRUE.
2645 # @return New GEOM_Object, containing the result shapes.
2647 # @ref tui_partition "Example"
2648 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2649 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
2650 KeepNonlimitShapes=0):
2651 # Example: see GEOM_TestAll.py
2652 if Limit == ShapeType["AUTO"]:
2653 # automatic detection of the most appropriate shape limit type
2655 for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
2656 Limit = EnumToLong(lim)
2658 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
2659 ListKeepInside, ListRemoveInside,
2660 Limit, RemoveWebs, ListMaterials,
2661 KeepNonlimitShapes);
2662 RaiseIfFailed("MakePartition", self.BoolOp)
2665 ## Perform partition operation.
2666 # This method may be useful if it is needed to make a partition for
2667 # compound contains nonintersected shapes. Performance will be better
2668 # since intersection between shapes from compound is not performed.
2670 # Description of all parameters as in previous method MakePartition()
2672 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
2673 # have to consist of nonintersecting shapes.
2675 # @return New GEOM_Object, containing the result shapes.
2677 # @ref swig_todo "Example"
2678 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
2679 ListKeepInside=[], ListRemoveInside=[],
2680 Limit=ShapeType["AUTO"], RemoveWebs=0,
2681 ListMaterials=[], KeepNonlimitShapes=0):
2682 if Limit == ShapeType["AUTO"]:
2683 # automatic detection of the most appropriate shape limit type
2685 for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
2686 Limit = EnumToLong(lim)
2688 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
2689 ListKeepInside, ListRemoveInside,
2690 Limit, RemoveWebs, ListMaterials,
2691 KeepNonlimitShapes);
2692 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
2695 ## Shortcut to MakePartition()
2697 # @ref tui_partition "Example 1"
2698 # \n @ref swig_Partition "Example 2"
2699 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2700 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
2701 KeepNonlimitShapes=0):
2702 # Example: see GEOM_TestOthers.py
2703 anObj = self.MakePartition(ListShapes, ListTools,
2704 ListKeepInside, ListRemoveInside,
2705 Limit, RemoveWebs, ListMaterials,
2706 KeepNonlimitShapes);
2709 ## Perform partition of the Shape with the Plane
2710 # @param theShape Shape to be intersected.
2711 # @param thePlane Tool shape, to intersect theShape.
2712 # @return New GEOM_Object, containing the result shape.
2714 # @ref tui_partition "Example"
2715 def MakeHalfPartition(self,theShape, thePlane):
2716 # Example: see GEOM_TestAll.py
2717 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
2718 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
2721 # end of l3_basic_op
2724 ## @addtogroup l3_transform
2727 ## Translate the given object along the vector, specified
2728 # by its end points, creating its copy before the translation.
2729 # @param theObject The object to be translated.
2730 # @param thePoint1 Start point of translation vector.
2731 # @param thePoint2 End point of translation vector.
2732 # @return New GEOM_Object, containing the translated object.
2734 # @ref tui_translation "Example 1"
2735 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
2736 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
2737 # Example: see GEOM_TestAll.py
2738 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
2739 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
2742 ## Translate the given object along the vector, specified by its components.
2743 # @param theObject The object to be translated.
2744 # @param theDX,theDY,theDZ Components of translation vector.
2745 # @return Translated GEOM_Object.
2747 # @ref tui_translation "Example"
2748 def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ):
2749 # Example: see GEOM_TestAll.py
2750 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2751 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
2752 anObj.SetParameters(Parameters)
2753 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2756 ## Translate the given object along the vector, specified
2757 # by its components, creating its copy before the translation.
2758 # @param theObject The object to be translated.
2759 # @param theDX,theDY,theDZ Components of translation vector.
2760 # @return New GEOM_Object, containing the translated object.
2762 # @ref tui_translation "Example"
2763 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
2764 # Example: see GEOM_TestAll.py
2765 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2766 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
2767 anObj.SetParameters(Parameters)
2768 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2771 ## Translate the given object along the given vector,
2772 # creating its copy before the translation.
2773 # @param theObject The object to be translated.
2774 # @param theVector The translation vector.
2775 # @return New GEOM_Object, containing the translated object.
2777 # @ref tui_translation "Example"
2778 def MakeTranslationVector(self,theObject, theVector):
2779 # Example: see GEOM_TestAll.py
2780 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
2781 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
2784 ## Translate the given object along the given vector on given distance.
2785 # @param theObject The object to be translated.
2786 # @param theVector The translation vector.
2787 # @param theDistance The translation distance.
2788 # @param theCopy Flag used to translate object itself or create a copy.
2789 # @return Translated GEOM_Object.
2791 # @ref tui_translation "Example"
2792 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy):
2793 # Example: see GEOM_TestAll.py
2794 theDistance,Parameters = ParseParameters(theDistance)
2795 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
2796 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2797 anObj.SetParameters(Parameters)
2800 ## Translate the given object along the given vector on given distance,
2801 # creating its copy before the translation.
2802 # @param theObject The object to be translated.
2803 # @param theVector The translation vector.
2804 # @param theDistance The translation distance.
2805 # @return New GEOM_Object, containing the translated object.
2807 # @ref tui_translation "Example"
2808 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
2809 # Example: see GEOM_TestAll.py
2810 theDistance,Parameters = ParseParameters(theDistance)
2811 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
2812 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2813 anObj.SetParameters(Parameters)
2816 ## Rotate the given object around the given axis on the given angle.
2817 # @param theObject The object to be rotated.
2818 # @param theAxis Rotation axis.
2819 # @param theAngle Rotation angle in radians.
2820 # @return Rotated GEOM_Object.
2822 # @ref tui_rotation "Example"
2823 def Rotate(self,theObject, theAxis, theAngle):
2824 # Example: see GEOM_TestAll.py
2826 if isinstance(theAngle,str):
2828 theAngle, Parameters = ParseParameters(theAngle)
2830 theAngle = theAngle*math.pi/180.0
2831 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
2832 RaiseIfFailed("RotateCopy", self.TrsfOp)
2833 anObj.SetParameters(Parameters)
2836 ## Rotate the given object around the given axis
2837 # on the given angle, creating its copy before the rotatation.
2838 # @param theObject The object to be rotated.
2839 # @param theAxis Rotation axis.
2840 # @param theAngle Rotation angle in radians.
2841 # @return New GEOM_Object, containing the rotated object.
2843 # @ref tui_rotation "Example"
2844 def MakeRotation(self,theObject, theAxis, theAngle):
2845 # Example: see GEOM_TestAll.py
2847 if isinstance(theAngle,str):
2849 theAngle, Parameters = ParseParameters(theAngle)
2851 theAngle = theAngle*math.pi/180.0
2852 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
2853 RaiseIfFailed("RotateCopy", self.TrsfOp)
2854 anObj.SetParameters(Parameters)
2857 ## Rotate given object around vector perpendicular to plane
2858 # containing three points, creating its copy before the rotatation.
2859 # @param theObject The object to be rotated.
2860 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
2861 # containing the three points.
2862 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
2863 # @return New GEOM_Object, containing the rotated object.
2865 # @ref tui_rotation "Example"
2866 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
2867 # Example: see GEOM_TestAll.py
2868 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
2869 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
2872 ## Scale the given object by the factor, creating its copy before the scaling.
2873 # @param theObject The object to be scaled.
2874 # @param thePoint Center point for scaling.
2875 # Passing None for it means scaling relatively the origin of global CS.
2876 # @param theFactor Scaling factor value.
2877 # @return New GEOM_Object, containing the scaled shape.
2879 # @ref tui_scale "Example"
2880 def MakeScaleTransform(self, theObject, thePoint, theFactor):
2881 # Example: see GEOM_TestAll.py
2882 theFactor, Parameters = ParseParameters(theFactor)
2883 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
2884 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
2885 anObj.SetParameters(Parameters)
2888 ## Scale the given object by different factors along coordinate axes,
2889 # creating its copy before the scaling.
2890 # @param theObject The object to be scaled.
2891 # @param thePoint Center point for scaling.
2892 # Passing None for it means scaling relatively the origin of global CS.
2893 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
2894 # @return New GEOM_Object, containing the scaled shape.
2896 # @ref swig_scale "Example"
2897 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
2898 # Example: see GEOM_TestAll.py
2899 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
2900 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
2901 theFactorX, theFactorY, theFactorZ)
2902 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
2903 anObj.SetParameters(Parameters)
2906 ## Create an object, symmetrical
2907 # to the given one relatively the given plane.
2908 # @param theObject The object to be mirrored.
2909 # @param thePlane Plane of symmetry.
2910 # @return New GEOM_Object, containing the mirrored shape.
2912 # @ref tui_mirror "Example"
2913 def MakeMirrorByPlane(self,theObject, thePlane):
2914 # Example: see GEOM_TestAll.py
2915 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
2916 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
2919 ## Create an object, symmetrical
2920 # to the given one relatively the given axis.
2921 # @param theObject The object to be mirrored.
2922 # @param theAxis Axis of symmetry.
2923 # @return New GEOM_Object, containing the mirrored shape.
2925 # @ref tui_mirror "Example"
2926 def MakeMirrorByAxis(self,theObject, theAxis):
2927 # Example: see GEOM_TestAll.py
2928 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
2929 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
2932 ## Create an object, symmetrical
2933 # to the given one relatively the given point.
2934 # @param theObject The object to be mirrored.
2935 # @param thePoint Point of symmetry.
2936 # @return New GEOM_Object, containing the mirrored shape.
2938 # @ref tui_mirror "Example"
2939 def MakeMirrorByPoint(self,theObject, thePoint):
2940 # Example: see GEOM_TestAll.py
2941 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
2942 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
2945 ## Modify the Location of the given object by LCS,
2946 # creating its copy before the setting.
2947 # @param theObject The object to be displaced.
2948 # @param theStartLCS Coordinate system to perform displacement from it.
2949 # If \a theStartLCS is NULL, displacement
2950 # will be performed from global CS.
2951 # If \a theObject itself is used as \a theStartLCS,
2952 # its location will be changed to \a theEndLCS.
2953 # @param theEndLCS Coordinate system to perform displacement to it.
2954 # @return New GEOM_Object, containing the displaced shape.
2956 # @ref tui_modify_location "Example"
2957 def MakePosition(self,theObject, theStartLCS, theEndLCS):
2958 # Example: see GEOM_TestAll.py
2959 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
2960 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
2963 ## Modify the Location of the given object by Path,
2964 # @param theObject The object to be displaced.
2965 # @param thePath Wire or Edge along that the object will be translated.
2966 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
2967 # @param theCopy is to create a copy objects if true.
2968 # @param theReverse - 0 for usual direction, 1 to reverse path direction.
2969 # @return New GEOM_Object, containing the displaced shape.
2971 # @ref tui_modify_location "Example"
2972 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
2973 # Example: see GEOM_TestAll.py
2974 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
2975 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
2978 ## Create new object as offset of the given one.
2979 # @param theObject The base object for the offset.
2980 # @param theOffset Offset value.
2981 # @return New GEOM_Object, containing the offset object.
2983 # @ref tui_offset "Example"
2984 def MakeOffset(self,theObject, theOffset):
2985 # Example: see GEOM_TestAll.py
2986 theOffset, Parameters = ParseParameters(theOffset)
2987 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
2988 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
2989 anObj.SetParameters(Parameters)
2992 # -----------------------------------------------------------------------------
2994 # -----------------------------------------------------------------------------
2996 ## Translate the given object along the given vector a given number times
2997 # @param theObject The object to be translated.
2998 # @param theVector Direction of the translation.
2999 # @param theStep Distance to translate on.
3000 # @param theNbTimes Quantity of translations to be done.
3001 # @return New GEOM_Object, containing compound of all
3002 # the shapes, obtained after each translation.
3004 # @ref tui_multi_translation "Example"
3005 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
3006 # Example: see GEOM_TestAll.py
3007 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
3008 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
3009 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
3010 anObj.SetParameters(Parameters)
3013 ## Conseqently apply two specified translations to theObject specified number of times.
3014 # @param theObject The object to be translated.
3015 # @param theVector1 Direction of the first translation.
3016 # @param theStep1 Step of the first translation.
3017 # @param theNbTimes1 Quantity of translations to be done along theVector1.
3018 # @param theVector2 Direction of the second translation.
3019 # @param theStep2 Step of the second translation.
3020 # @param theNbTimes2 Quantity of translations to be done along theVector2.
3021 # @return New GEOM_Object, containing compound of all
3022 # the shapes, obtained after each translation.
3024 # @ref tui_multi_translation "Example"
3025 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
3026 theVector2, theStep2, theNbTimes2):
3027 # Example: see GEOM_TestAll.py
3028 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
3029 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
3030 theVector2, theStep2, theNbTimes2)
3031 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
3032 anObj.SetParameters(Parameters)
3035 ## Rotate the given object around the given axis a given number times.
3036 # Rotation angle will be 2*PI/theNbTimes.
3037 # @param theObject The object to be rotated.
3038 # @param theAxis The rotation axis.
3039 # @param theNbTimes Quantity of rotations to be done.
3040 # @return New GEOM_Object, containing compound of all the
3041 # shapes, obtained after each rotation.
3043 # @ref tui_multi_rotation "Example"
3044 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
3045 # Example: see GEOM_TestAll.py
3046 theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
3047 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
3048 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
3049 anObj.SetParameters(Parameters)
3052 ## Rotate the given object around the
3053 # given axis on the given angle a given number
3054 # times and multi-translate each rotation result.
3055 # Translation direction passes through center of gravity
3056 # of rotated shape and its projection on the rotation axis.
3057 # @param theObject The object to be rotated.
3058 # @param theAxis Rotation axis.
3059 # @param theAngle Rotation angle in graduces.
3060 # @param theNbTimes1 Quantity of rotations to be done.
3061 # @param theStep Translation distance.
3062 # @param theNbTimes2 Quantity of translations to be done.
3063 # @return New GEOM_Object, containing compound of all the
3064 # shapes, obtained after each transformation.
3066 # @ref tui_multi_rotation "Example"
3067 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
3068 # Example: see GEOM_TestAll.py
3069 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
3070 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
3071 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
3072 anObj.SetParameters(Parameters)
3075 ## The same, as MultiRotate1D(), but axis is given by direction and point
3076 # @ref swig_MakeMultiRotation "Example"
3077 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
3078 # Example: see GEOM_TestOthers.py
3079 aVec = self.MakeLine(aPoint,aDir)
3080 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
3083 ## The same, as MultiRotate2D(), but axis is given by direction and point
3084 # @ref swig_MakeMultiRotation "Example"
3085 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
3086 # Example: see GEOM_TestOthers.py
3087 aVec = self.MakeLine(aPoint,aDir)
3088 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
3091 # end of l3_transform
3094 ## @addtogroup l3_local
3097 ## Perform a fillet on all edges of the given shape.
3098 # @param theShape Shape, to perform fillet on.
3099 # @param theR Fillet radius.
3100 # @return New GEOM_Object, containing the result shape.
3102 # @ref tui_fillet "Example 1"
3103 # \n @ref swig_MakeFilletAll "Example 2"
3104 def MakeFilletAll(self,theShape, theR):
3105 # Example: see GEOM_TestOthers.py
3106 theR,Parameters = ParseParameters(theR)
3107 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
3108 RaiseIfFailed("MakeFilletAll", self.LocalOp)
3109 anObj.SetParameters(Parameters)
3112 ## Perform a fillet on the specified edges/faces of the given shape
3113 # @param theShape Shape, to perform fillet on.
3114 # @param theR Fillet radius.
3115 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
3116 # @param theListShapes Global indices of edges/faces to perform fillet on.
3117 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3118 # @return New GEOM_Object, containing the result shape.
3120 # @ref tui_fillet "Example"
3121 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
3122 # Example: see GEOM_TestAll.py
3123 theR,Parameters = ParseParameters(theR)
3125 if theShapeType == ShapeType["EDGE"]:
3126 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
3127 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
3129 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
3130 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
3131 anObj.SetParameters(Parameters)
3134 ## The same that MakeFillet but with two Fillet Radius R1 and R2
3135 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
3136 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
3138 if theShapeType == ShapeType["EDGE"]:
3139 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
3140 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
3142 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
3143 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
3144 anObj.SetParameters(Parameters)
3147 ## Perform a fillet on the specified edges of the given shape
3148 # @param theShape - Wire Shape to perform fillet on.
3149 # @param theR - Fillet radius.
3150 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
3151 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3152 # \note The list of vertices could be empty,
3153 # in this case fillet will done done at all vertices in wire
3154 # @return New GEOM_Object, containing the result shape.
3156 # @ref tui_fillet2d "Example"
3157 def MakeFillet1D(self,theShape, theR, theListOfVertexes):
3158 # Example: see GEOM_TestAll.py
3159 theR,Parameters = ParseParameters(theR)
3160 anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes)
3161 RaiseIfFailed("MakeFillet1D", self.LocalOp)
3162 anObj.SetParameters(Parameters)
3165 ## Perform a fillet on the specified edges/faces of the given shape
3166 # @param theShape - Face Shape to perform fillet on.
3167 # @param theR - Fillet radius.
3168 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
3169 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3170 # @return New GEOM_Object, containing the result shape.
3172 # @ref tui_fillet2d "Example"
3173 def MakeFillet2D(self,theShape, theR, theListOfVertexes):
3174 # Example: see GEOM_TestAll.py
3175 theR,Parameters = ParseParameters(theR)
3176 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
3177 RaiseIfFailed("MakeFillet2D", self.LocalOp)
3178 anObj.SetParameters(Parameters)
3181 ## Perform a symmetric chamfer on all edges of the given shape.
3182 # @param theShape Shape, to perform chamfer on.
3183 # @param theD Chamfer size along each face.
3184 # @return New GEOM_Object, containing the result shape.
3186 # @ref tui_chamfer "Example 1"
3187 # \n @ref swig_MakeChamferAll "Example 2"
3188 def MakeChamferAll(self,theShape, theD):
3189 # Example: see GEOM_TestOthers.py
3190 theD,Parameters = ParseParameters(theD)
3191 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
3192 RaiseIfFailed("MakeChamferAll", self.LocalOp)
3193 anObj.SetParameters(Parameters)
3196 ## Perform a chamfer on edges, common to the specified faces,
3197 # with distance D1 on the Face1
3198 # @param theShape Shape, to perform chamfer on.
3199 # @param theD1 Chamfer size along \a theFace1.
3200 # @param theD2 Chamfer size along \a theFace2.
3201 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
3202 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3203 # @return New GEOM_Object, containing the result shape.
3205 # @ref tui_chamfer "Example"
3206 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
3207 # Example: see GEOM_TestAll.py
3208 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3209 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
3210 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
3211 anObj.SetParameters(Parameters)
3214 ## The Same that MakeChamferEdge but with params theD is chamfer length and
3215 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3216 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
3218 if isinstance(theAngle,str):
3220 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3222 theAngle = theAngle*math.pi/180.0
3223 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
3224 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
3225 anObj.SetParameters(Parameters)
3228 ## Perform a chamfer on all edges of the specified faces,
3229 # with distance D1 on the first specified face (if several for one edge)
3230 # @param theShape Shape, to perform chamfer on.
3231 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
3232 # connected to the edge, are in \a theFaces, \a theD1
3233 # will be get along face, which is nearer to \a theFaces beginning.
3234 # @param theD2 Chamfer size along another of two faces, connected to the edge.
3235 # @param theFaces Sequence of global indices of faces of \a theShape.
3236 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3237 # @return New GEOM_Object, containing the result shape.
3239 # @ref tui_chamfer "Example"
3240 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
3241 # Example: see GEOM_TestAll.py
3242 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3243 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
3244 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
3245 anObj.SetParameters(Parameters)
3248 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
3249 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3251 # @ref swig_FilletChamfer "Example"
3252 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
3254 if isinstance(theAngle,str):
3256 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3258 theAngle = theAngle*math.pi/180.0
3259 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
3260 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
3261 anObj.SetParameters(Parameters)
3264 ## Perform a chamfer on edges,
3265 # with distance D1 on the first specified face (if several for one edge)
3266 # @param theShape Shape, to perform chamfer on.
3267 # @param theD1,theD2 Chamfer size
3268 # @param theEdges Sequence of edges of \a theShape.
3269 # @return New GEOM_Object, containing the result shape.
3271 # @ref swig_FilletChamfer "Example"
3272 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
3273 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3274 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
3275 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
3276 anObj.SetParameters(Parameters)
3279 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
3280 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3281 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
3283 if isinstance(theAngle,str):
3285 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3287 theAngle = theAngle*math.pi/180.0
3288 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
3289 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
3290 anObj.SetParameters(Parameters)
3293 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
3295 # @ref swig_MakeChamfer "Example"
3296 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
3297 # Example: see GEOM_TestOthers.py
3299 if aShapeType == ShapeType["EDGE"]:
3300 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
3302 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
3308 ## @addtogroup l3_basic_op
3311 ## Perform an Archimde operation on the given shape with given parameters.
3312 # The object presenting the resulting face is returned.
3313 # @param theShape Shape to be put in water.
3314 # @param theWeight Weight og the shape.
3315 # @param theWaterDensity Density of the water.
3316 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
3317 # @return New GEOM_Object, containing a section of \a theShape
3318 # by a plane, corresponding to water level.
3320 # @ref tui_archimede "Example"
3321 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
3322 # Example: see GEOM_TestAll.py
3323 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
3324 theWeight,theWaterDensity,theMeshDeflection)
3325 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
3326 RaiseIfFailed("MakeArchimede", self.LocalOp)
3327 anObj.SetParameters(Parameters)
3330 # end of l3_basic_op
3333 ## @addtogroup l2_measure
3336 ## Get point coordinates
3339 # @ref tui_measurement_tools_page "Example"
3340 def PointCoordinates(self,Point):
3341 # Example: see GEOM_TestMeasures.py
3342 aTuple = self.MeasuOp.PointCoordinates(Point)
3343 RaiseIfFailed("PointCoordinates", self.MeasuOp)
3346 ## Get summarized length of all wires,
3347 # area of surface and volume of the given shape.
3348 # @param theShape Shape to define properties of.
3349 # @return [theLength, theSurfArea, theVolume]
3350 # theLength: Summarized length of all wires of the given shape.
3351 # theSurfArea: Area of surface of the given shape.
3352 # theVolume: Volume of the given shape.
3354 # @ref tui_measurement_tools_page "Example"
3355 def BasicProperties(self,theShape):
3356 # Example: see GEOM_TestMeasures.py
3357 aTuple = self.MeasuOp.GetBasicProperties(theShape)
3358 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
3361 ## Get parameters of bounding box of the given shape
3362 # @param theShape Shape to obtain bounding box of.
3363 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
3364 # Xmin,Xmax: Limits of shape along OX axis.
3365 # Ymin,Ymax: Limits of shape along OY axis.
3366 # Zmin,Zmax: Limits of shape along OZ axis.
3368 # @ref tui_measurement_tools_page "Example"
3369 def BoundingBox(self,theShape):
3370 # Example: see GEOM_TestMeasures.py
3371 aTuple = self.MeasuOp.GetBoundingBox(theShape)
3372 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
3375 ## Get inertia matrix and moments of inertia of theShape.
3376 # @param theShape Shape to calculate inertia of.
3377 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
3378 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
3379 # Ix,Iy,Iz: Moments of inertia of the given shape.
3381 # @ref tui_measurement_tools_page "Example"
3382 def Inertia(self,theShape):
3383 # Example: see GEOM_TestMeasures.py
3384 aTuple = self.MeasuOp.GetInertia(theShape)
3385 RaiseIfFailed("GetInertia", self.MeasuOp)
3388 ## Get if coords are included in the shape (ST_IN or ST_ON)
3389 # @param theShape Shape
3390 # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
3391 # @param tolerance to be used (default is 1.0e-7)
3392 # @return list_of_boolean = [res1, res2, ...]
3393 def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
3394 return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
3396 ## Get minimal distance between the given shapes.
3397 # @param theShape1,theShape2 Shapes to find minimal distance between.
3398 # @return Value of the minimal distance between the given shapes.
3400 # @ref tui_measurement_tools_page "Example"
3401 def MinDistance(self, theShape1, theShape2):
3402 # Example: see GEOM_TestMeasures.py
3403 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
3404 RaiseIfFailed("GetMinDistance", self.MeasuOp)
3407 ## Get minimal distance between the given shapes.
3408 # @param theShape1,theShape2 Shapes to find minimal distance between.
3409 # @return Value of the minimal distance between the given shapes.
3411 # @ref swig_all_measure "Example"
3412 def MinDistanceComponents(self, theShape1, theShape2):
3413 # Example: see GEOM_TestMeasures.py
3414 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
3415 RaiseIfFailed("GetMinDistance", self.MeasuOp)
3416 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
3419 ## Get angle between the given shapes in degrees.
3420 # @param theShape1,theShape2 Lines or linear edges to find angle between.
3421 # @return Value of the angle between the given shapes in degrees.
3423 # @ref tui_measurement_tools_page "Example"
3424 def GetAngle(self, theShape1, theShape2):
3425 # Example: see GEOM_TestMeasures.py
3426 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
3427 RaiseIfFailed("GetAngle", self.MeasuOp)
3429 ## Get angle between the given shapes in radians.
3430 # @param theShape1,theShape2 Lines or linear edges to find angle between.
3431 # @return Value of the angle between the given shapes in radians.
3433 # @ref tui_measurement_tools_page "Example"
3434 def GetAngleRadians(self, theShape1, theShape2):
3435 # Example: see GEOM_TestMeasures.py
3436 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
3437 RaiseIfFailed("GetAngle", self.MeasuOp)
3440 ## @name Curve Curvature Measurement
3441 # Methods for receiving radius of curvature of curves
3442 # in the given point
3445 ## Measure curvature of a curve at a point, set by parameter.
3446 # @ref swig_todo "Example"
3447 def CurveCurvatureByParam(self, theCurve, theParam):
3448 # Example: see GEOM_TestMeasures.py
3449 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
3450 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
3454 # @ref swig_todo "Example"
3455 def CurveCurvatureByPoint(self, theCurve, thePoint):
3456 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
3457 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
3461 ## @name Surface Curvature Measurement
3462 # Methods for receiving max and min radius of curvature of surfaces
3463 # in the given point
3467 ## @ref swig_todo "Example"
3468 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
3469 # Example: see GEOM_TestMeasures.py
3470 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
3471 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
3475 ## @ref swig_todo "Example"
3476 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
3477 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
3478 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
3482 ## @ref swig_todo "Example"
3483 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
3484 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
3485 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
3489 ## @ref swig_todo "Example"
3490 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
3491 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
3492 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
3496 ## Get min and max tolerances of sub-shapes of theShape
3497 # @param theShape Shape, to get tolerances of.
3498 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
3499 # FaceMin,FaceMax: Min and max tolerances of the faces.
3500 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
3501 # VertMin,VertMax: Min and max tolerances of the vertices.
3503 # @ref tui_measurement_tools_page "Example"
3504 def Tolerance(self,theShape):
3505 # Example: see GEOM_TestMeasures.py
3506 aTuple = self.MeasuOp.GetTolerance(theShape)
3507 RaiseIfFailed("GetTolerance", self.MeasuOp)
3510 ## Obtain description of the given shape (number of sub-shapes of each type)
3511 # @param theShape Shape to be described.
3512 # @return Description of the given shape.
3514 # @ref tui_measurement_tools_page "Example"
3515 def WhatIs(self,theShape):
3516 # Example: see GEOM_TestMeasures.py
3517 aDescr = self.MeasuOp.WhatIs(theShape)
3518 RaiseIfFailed("WhatIs", self.MeasuOp)
3521 ## Obtain quantity of shapes of the given type in \a theShape.
3522 # If \a theShape is of type \a theType, it is also counted.
3523 # @param theShape Shape to be described.
3524 # @return Quantity of shapes of type \a theType in \a theShape.
3526 # @ref tui_measurement_tools_page "Example"
3527 def NbShapes (self, theShape, theType):
3528 # Example: see GEOM_TestMeasures.py
3529 listSh = self.SubShapeAllIDs(theShape, theType)
3531 t = EnumToLong(theShape.GetShapeType())
3532 theType = EnumToLong(theType)
3538 ## Obtain quantity of shapes of each type in \a theShape.
3539 # The \a theShape is also counted.
3540 # @param theShape Shape to be described.
3541 # @return Dictionary of shape types with bound quantities of shapes.
3543 # @ref tui_measurement_tools_page "Example"
3544 def ShapeInfo (self, theShape):
3545 # Example: see GEOM_TestMeasures.py
3547 for typeSh in ShapeType:
3548 if typeSh in ( "AUTO", "SHAPE" ): continue
3549 listSh = self.SubShapeAllIDs(theShape, ShapeType[typeSh])
3551 if EnumToLong(theShape.GetShapeType()) == ShapeType[typeSh]:
3558 ## Get a point, situated at the centre of mass of theShape.
3559 # @param theShape Shape to define centre of mass of.
3560 # @return New GEOM_Object, containing the created point.
3562 # @ref tui_measurement_tools_page "Example"
3563 def MakeCDG(self,theShape):
3564 # Example: see GEOM_TestMeasures.py
3565 anObj = self.MeasuOp.GetCentreOfMass(theShape)
3566 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
3569 ## Get a vertex subshape by index depended with orientation.
3570 # @param theShape Shape to find subshape.
3571 # @param theIndex Index to find vertex by this index.
3572 # @return New GEOM_Object, containing the created vertex.
3574 # @ref tui_measurement_tools_page "Example"
3575 def GetVertexByIndex(self,theShape, theIndex):
3576 # Example: see GEOM_TestMeasures.py
3577 anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex)
3578 RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
3581 ## Get the first vertex of wire/edge depended orientation.
3582 # @param theShape Shape to find first vertex.
3583 # @return New GEOM_Object, containing the created vertex.
3585 # @ref tui_measurement_tools_page "Example"
3586 def GetFirstVertex(self,theShape):
3587 # Example: see GEOM_TestMeasures.py
3588 anObj = self.GetVertexByIndex(theShape, 0)
3589 RaiseIfFailed("GetFirstVertex", self.MeasuOp)
3592 ## Get the last vertex of wire/edge depended orientation.
3593 # @param theShape Shape to find last vertex.
3594 # @return New GEOM_Object, containing the created vertex.
3596 # @ref tui_measurement_tools_page "Example"
3597 def GetLastVertex(self,theShape):
3598 # Example: see GEOM_TestMeasures.py
3599 nb_vert = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["VERTEX"])
3600 anObj = self.GetVertexByIndex(theShape, (nb_vert-1))
3601 RaiseIfFailed("GetLastVertex", self.MeasuOp)
3604 ## Get a normale to the given face. If the point is not given,
3605 # the normale is calculated at the center of mass.
3606 # @param theFace Face to define normale of.
3607 # @param theOptionalPoint Point to compute the normale at.
3608 # @return New GEOM_Object, containing the created vector.
3610 # @ref swig_todo "Example"
3611 def GetNormal(self, theFace, theOptionalPoint = None):
3612 # Example: see GEOM_TestMeasures.py
3613 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
3614 RaiseIfFailed("GetNormal", self.MeasuOp)
3617 ## Check a topology of the given shape.
3618 # @param theShape Shape to check validity of.
3619 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
3620 # if TRUE, the shape's geometry will be checked also.
3621 # @return TRUE, if the shape "seems to be valid".
3622 # If theShape is invalid, prints a description of problem.
3624 # @ref tui_measurement_tools_page "Example"
3625 def CheckShape(self,theShape, theIsCheckGeom = 0):
3626 # Example: see GEOM_TestMeasures.py
3628 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
3629 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
3631 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
3632 RaiseIfFailed("CheckShape", self.MeasuOp)
3637 ## Get position (LCS) of theShape.
3639 # Origin of the LCS is situated at the shape's center of mass.
3640 # Axes of the LCS are obtained from shape's location or,
3641 # if the shape is a planar face, from position of its plane.
3643 # @param theShape Shape to calculate position of.
3644 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
3645 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
3646 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
3647 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
3649 # @ref swig_todo "Example"
3650 def GetPosition(self,theShape):
3651 # Example: see GEOM_TestMeasures.py
3652 aTuple = self.MeasuOp.GetPosition(theShape)
3653 RaiseIfFailed("GetPosition", self.MeasuOp)
3656 ## Get kind of theShape.
3658 # @param theShape Shape to get a kind of.
3659 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
3660 # and a list of parameters, describing the shape.
3661 # @note Concrete meaning of each value, returned via \a theIntegers
3662 # or \a theDoubles list depends on the kind of the shape.
3663 # The full list of possible outputs is:
3665 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
3666 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
3668 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
3669 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
3671 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
3672 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
3674 # - geompy.kind.SPHERE xc yc zc R
3675 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
3676 # - geompy.kind.BOX xc yc zc ax ay az
3677 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
3678 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
3679 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
3680 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
3681 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
3683 # - geompy.kind.SPHERE2D xc yc zc R
3684 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
3685 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
3686 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
3687 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
3688 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
3689 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
3690 # - geompy.kind.PLANE xo yo zo dx dy dz
3691 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
3692 # - geompy.kind.FACE nb_edges nb_vertices
3694 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
3695 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
3696 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
3697 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
3698 # - geompy.kind.LINE xo yo zo dx dy dz
3699 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
3700 # - geompy.kind.EDGE nb_vertices
3702 # - geompy.kind.VERTEX x y z
3704 # @ref swig_todo "Example"
3705 def KindOfShape(self,theShape):
3706 # Example: see GEOM_TestMeasures.py
3707 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
3708 RaiseIfFailed("KindOfShape", self.MeasuOp)
3710 aKind = aRoughTuple[0]
3711 anInts = aRoughTuple[1]
3712 aDbls = aRoughTuple[2]
3714 # Now there is no exception from this rule:
3715 aKindTuple = [aKind] + aDbls + anInts
3717 # If they are we will regroup parameters for such kind of shape.
3719 #if aKind == kind.SOME_KIND:
3720 # # SOME_KIND int int double int double double
3721 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
3728 ## @addtogroup l2_import_export
3731 ## Import a shape from the BREP or IGES or STEP file
3732 # (depends on given format) with given name.
3733 # @param theFileName The file, containing the shape.
3734 # @param theFormatName Specify format for the file reading.
3735 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3736 # If format 'IGES_SCALE' is used instead 'IGES' length unit will be
3737 # set to 'meter' and result model will be scaled.
3738 # @return New GEOM_Object, containing the imported shape.
3740 # @ref swig_Import_Export "Example"
3741 def ImportFile(self,theFileName, theFormatName):
3742 # Example: see GEOM_TestOthers.py
3743 anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
3744 RaiseIfFailed("Import", self.InsertOp)
3747 ## Deprecated analog of ImportFile
3748 def Import(self,theFileName, theFormatName):
3749 print "WARNING: Function Import is deprecated, use ImportFile instead"
3750 anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
3751 RaiseIfFailed("Import", self.InsertOp)
3754 ## Shortcut to ImportFile() for BREP format
3756 # @ref swig_Import_Export "Example"
3757 def ImportBREP(self,theFileName):
3758 # Example: see GEOM_TestOthers.py
3759 return self.ImportFile(theFileName, "BREP")
3761 ## Shortcut to ImportFile() for IGES format
3763 # @ref swig_Import_Export "Example"
3764 def ImportIGES(self,theFileName):
3765 # Example: see GEOM_TestOthers.py
3766 return self.ImportFile(theFileName, "IGES")
3768 ## Return length unit from given IGES file
3770 # @ref swig_Import_Export "Example"
3771 def GetIGESUnit(self,theFileName):
3772 # Example: see GEOM_TestOthers.py
3773 anObj = self.InsertOp.ImportFile(theFileName, "IGES_UNIT")
3774 #RaiseIfFailed("Import", self.InsertOp)
3775 # recieve name using returned vertex
3777 if anObj.GetShapeType() == GEOM.VERTEX:
3780 vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
3782 p = self.PointCoordinates(vertices[0])
3783 if abs(p[0]-0.01) < 1.e-6:
3785 elif abs(p[0]-0.001) < 1.e-6:
3789 ## Shortcut to ImportFile() for STEP format
3791 # @ref swig_Import_Export "Example"
3792 def ImportSTEP(self,theFileName):
3793 # Example: see GEOM_TestOthers.py
3794 return self.ImportFile(theFileName, "STEP")
3796 ## Export the given shape into a file with given name.
3797 # @param theObject Shape to be stored in the file.
3798 # @param theFileName Name of the file to store the given shape in.
3799 # @param theFormatName Specify format for the shape storage.
3800 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3802 # @ref swig_Import_Export "Example"
3803 def Export(self,theObject, theFileName, theFormatName):
3804 # Example: see GEOM_TestOthers.py
3805 self.InsertOp.Export(theObject, theFileName, theFormatName)
3806 if self.InsertOp.IsDone() == 0:
3807 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
3811 ## Shortcut to Export() for BREP format
3813 # @ref swig_Import_Export "Example"
3814 def ExportBREP(self,theObject, theFileName):
3815 # Example: see GEOM_TestOthers.py
3816 return self.Export(theObject, theFileName, "BREP")
3818 ## Shortcut to Export() for IGES format
3820 # @ref swig_Import_Export "Example"
3821 def ExportIGES(self,theObject, theFileName):
3822 # Example: see GEOM_TestOthers.py
3823 return self.Export(theObject, theFileName, "IGES")
3825 ## Shortcut to Export() for STEP format
3827 # @ref swig_Import_Export "Example"
3828 def ExportSTEP(self,theObject, theFileName):
3829 # Example: see GEOM_TestOthers.py
3830 return self.Export(theObject, theFileName, "STEP")
3832 # end of l2_import_export
3835 ## @addtogroup l3_blocks
3838 ## Create a quadrangle face from four edges. Order of Edges is not
3839 # important. It is not necessary that edges share the same vertex.
3840 # @param E1,E2,E3,E4 Edges for the face bound.
3841 # @return New GEOM_Object, containing the created face.
3843 # @ref tui_building_by_blocks_page "Example"
3844 def MakeQuad(self,E1, E2, E3, E4):
3845 # Example: see GEOM_Spanner.py
3846 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
3847 RaiseIfFailed("MakeQuad", self.BlocksOp)
3850 ## Create a quadrangle face on two edges.
3851 # The missing edges will be built by creating the shortest ones.
3852 # @param E1,E2 Two opposite edges for the face.
3853 # @return New GEOM_Object, containing the created face.
3855 # @ref tui_building_by_blocks_page "Example"
3856 def MakeQuad2Edges(self,E1, E2):
3857 # Example: see GEOM_Spanner.py
3858 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
3859 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
3862 ## Create a quadrangle face with specified corners.
3863 # The missing edges will be built by creating the shortest ones.
3864 # @param V1,V2,V3,V4 Corner vertices for the face.
3865 # @return New GEOM_Object, containing the created face.
3867 # @ref tui_building_by_blocks_page "Example 1"
3868 # \n @ref swig_MakeQuad4Vertices "Example 2"
3869 def MakeQuad4Vertices(self,V1, V2, V3, V4):
3870 # Example: see GEOM_Spanner.py
3871 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
3872 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
3875 ## Create a hexahedral solid, bounded by the six given faces. Order of
3876 # faces is not important. It is not necessary that Faces share the same edge.
3877 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
3878 # @return New GEOM_Object, containing the created solid.
3880 # @ref tui_building_by_blocks_page "Example 1"
3881 # \n @ref swig_MakeHexa "Example 2"
3882 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
3883 # Example: see GEOM_Spanner.py
3884 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
3885 RaiseIfFailed("MakeHexa", self.BlocksOp)
3888 ## Create a hexahedral solid between two given faces.
3889 # The missing faces will be built by creating the smallest ones.
3890 # @param F1,F2 Two opposite faces for the hexahedral solid.
3891 # @return New GEOM_Object, containing the created solid.
3893 # @ref tui_building_by_blocks_page "Example 1"
3894 # \n @ref swig_MakeHexa2Faces "Example 2"
3895 def MakeHexa2Faces(self,F1, F2):
3896 # Example: see GEOM_Spanner.py
3897 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
3898 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
3904 ## @addtogroup l3_blocks_op
3907 ## Get a vertex, found in the given shape by its coordinates.
3908 # @param theShape Block or a compound of blocks.
3909 # @param theX,theY,theZ Coordinates of the sought vertex.
3910 # @param theEpsilon Maximum allowed distance between the resulting
3911 # vertex and point with the given coordinates.
3912 # @return New GEOM_Object, containing the found vertex.
3914 # @ref swig_GetPoint "Example"
3915 def GetPoint(self, theShape, theX, theY, theZ, theEpsilon):
3916 # Example: see GEOM_TestOthers.py
3917 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
3918 RaiseIfFailed("GetPoint", self.BlocksOp)
3921 ## Find a vertex of the given shape, which has minimal distance to the given point.
3922 # @param theShape Any shape.
3923 # @param thePoint Point, close to the desired vertex.
3924 # @return New GEOM_Object, containing the found vertex.
3926 # @ref swig_GetVertexNearPoint "Example"
3927 def GetVertexNearPoint(self, theShape, thePoint):
3928 # Example: see GEOM_TestOthers.py
3929 anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
3930 RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
3933 ## Get an edge, found in the given shape by two given vertices.
3934 # @param theShape Block or a compound of blocks.
3935 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
3936 # @return New GEOM_Object, containing the found edge.
3938 # @ref swig_GetEdge "Example"
3939 def GetEdge(self, theShape, thePoint1, thePoint2):
3940 # Example: see GEOM_Spanner.py
3941 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
3942 RaiseIfFailed("GetEdge", self.BlocksOp)
3945 ## Find an edge of the given shape, which has minimal distance to the given point.
3946 # @param theShape Block or a compound of blocks.
3947 # @param thePoint Point, close to the desired edge.
3948 # @return New GEOM_Object, containing the found edge.
3950 # @ref swig_GetEdgeNearPoint "Example"
3951 def GetEdgeNearPoint(self, theShape, thePoint):
3952 # Example: see GEOM_TestOthers.py
3953 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
3954 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
3957 ## Returns a face, found in the given shape by four given corner vertices.
3958 # @param theShape Block or a compound of blocks.
3959 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
3960 # @return New GEOM_Object, containing the found face.
3962 # @ref swig_todo "Example"
3963 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
3964 # Example: see GEOM_Spanner.py
3965 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
3966 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
3969 ## Get a face of block, found in the given shape by two given edges.
3970 # @param theShape Block or a compound of blocks.
3971 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
3972 # @return New GEOM_Object, containing the found face.
3974 # @ref swig_todo "Example"
3975 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
3976 # Example: see GEOM_Spanner.py
3977 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
3978 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
3981 ## Find a face, opposite to the given one in the given block.
3982 # @param theBlock Must be a hexahedral solid.
3983 # @param theFace Face of \a theBlock, opposite to the desired face.
3984 # @return New GEOM_Object, containing the found face.
3986 # @ref swig_GetOppositeFace "Example"
3987 def GetOppositeFace(self,theBlock, theFace):
3988 # Example: see GEOM_Spanner.py
3989 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
3990 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
3993 ## Find a face of the given shape, which has minimal distance to the given point.
3994 # @param theShape Block or a compound of blocks.
3995 # @param thePoint Point, close to the desired face.
3996 # @return New GEOM_Object, containing the found face.
3998 # @ref swig_GetFaceNearPoint "Example"
3999 def GetFaceNearPoint(self, theShape, thePoint):
4000 # Example: see GEOM_Spanner.py
4001 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
4002 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
4005 ## Find a face of block, whose outside normale has minimal angle with the given vector.
4006 # @param theBlock Block or a compound of blocks.
4007 # @param theVector Vector, close to the normale of the desired face.
4008 # @return New GEOM_Object, containing the found face.
4010 # @ref swig_todo "Example"
4011 def GetFaceByNormale(self, theBlock, theVector):
4012 # Example: see GEOM_Spanner.py
4013 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
4014 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
4017 ## Find all subshapes of type \a theShapeType of the given shape,
4018 # which have minimal distance to the given point.
4019 # @param theShape Any shape.
4020 # @param thePoint Point, close to the desired shape.
4021 # @param theShapeType Defines what kind of subshapes is searched.
4022 # @param theTolerance The tolerance for distances comparison. All shapes
4023 # with distances to the given point in interval
4024 # [minimal_distance, minimal_distance + theTolerance] will be gathered.
4025 # @return New GEOM_Object, containing a group of all found shapes.
4027 # @ref swig_GetShapesNearPoint "Example"
4028 def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07):
4029 # Example: see GEOM_TestOthers.py
4030 anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
4031 RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
4034 # end of l3_blocks_op
4037 ## @addtogroup l4_blocks_measure
4040 ## Check, if the compound of blocks is given.
4041 # To be considered as a compound of blocks, the
4042 # given shape must satisfy the following conditions:
4043 # - Each element of the compound should be a Block (6 faces and 12 edges).
4044 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
4045 # - The compound should be connexe.
4046 # - The glue between two quadrangle faces should be applied.
4047 # @param theCompound The compound to check.
4048 # @return TRUE, if the given shape is a compound of blocks.
4049 # If theCompound is not valid, prints all discovered errors.
4051 # @ref tui_measurement_tools_page "Example 1"
4052 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
4053 def CheckCompoundOfBlocks(self,theCompound):
4054 # Example: see GEOM_Spanner.py
4055 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
4056 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
4058 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
4062 ## Remove all seam and degenerated edges from \a theShape.
4063 # Unite faces and edges, sharing one surface. It means that
4064 # this faces must have references to one C++ surface object (handle).
4065 # @param theShape The compound or single solid to remove irregular edges from.
4066 # @param doUnionFaces If True, then unite faces. If False (the default value),
4067 # do not unite faces.
4068 # @return Improved shape.
4070 # @ref swig_RemoveExtraEdges "Example"
4071 def RemoveExtraEdges(self, theShape, doUnionFaces=False):
4072 # Example: see GEOM_TestOthers.py
4073 nbFacesOptimum = -1 # -1 means do not unite faces
4074 if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
4075 anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
4076 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
4079 ## Check, if the given shape is a blocks compound.
4080 # Fix all detected errors.
4081 # \note Single block can be also fixed by this method.
4082 # @param theShape The compound to check and improve.
4083 # @return Improved compound.
4085 # @ref swig_CheckAndImprove "Example"
4086 def CheckAndImprove(self,theShape):
4087 # Example: see GEOM_TestOthers.py
4088 anObj = self.BlocksOp.CheckAndImprove(theShape)
4089 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
4092 # end of l4_blocks_measure
4095 ## @addtogroup l3_blocks_op
4098 ## Get all the blocks, contained in the given compound.
4099 # @param theCompound The compound to explode.
4100 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
4101 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
4102 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
4103 # @return List of GEOM_Objects, containing the retrieved blocks.
4105 # @ref tui_explode_on_blocks "Example 1"
4106 # \n @ref swig_MakeBlockExplode "Example 2"
4107 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
4108 # Example: see GEOM_TestOthers.py
4109 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
4110 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
4111 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
4113 anObj.SetParameters(Parameters)
4117 ## Find block, containing the given point inside its volume or on boundary.
4118 # @param theCompound Compound, to find block in.
4119 # @param thePoint Point, close to the desired block. If the point lays on
4120 # boundary between some blocks, we return block with nearest center.
4121 # @return New GEOM_Object, containing the found block.
4123 # @ref swig_todo "Example"
4124 def GetBlockNearPoint(self,theCompound, thePoint):
4125 # Example: see GEOM_Spanner.py
4126 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
4127 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
4130 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
4131 # @param theCompound Compound, to find block in.
4132 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
4133 # @return New GEOM_Object, containing the found block.
4135 # @ref swig_GetBlockByParts "Example"
4136 def GetBlockByParts(self,theCompound, theParts):
4137 # Example: see GEOM_TestOthers.py
4138 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
4139 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
4142 ## Return all blocks, containing all the elements, passed as the parts.
4143 # @param theCompound Compound, to find blocks in.
4144 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
4145 # @return List of GEOM_Objects, containing the found blocks.
4147 # @ref swig_todo "Example"
4148 def GetBlocksByParts(self,theCompound, theParts):
4149 # Example: see GEOM_Spanner.py
4150 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
4151 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
4154 ## Multi-transformate block and glue the result.
4155 # Transformation is defined so, as to superpose direction faces.
4156 # @param Block Hexahedral solid to be multi-transformed.
4157 # @param DirFace1 ID of First direction face.
4158 # @param DirFace2 ID of Second direction face.
4159 # @param NbTimes Quantity of transformations to be done.
4160 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
4161 # @return New GEOM_Object, containing the result shape.
4163 # @ref tui_multi_transformation "Example"
4164 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
4165 # Example: see GEOM_Spanner.py
4166 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
4167 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
4168 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
4169 anObj.SetParameters(Parameters)
4172 ## Multi-transformate block and glue the result.
4173 # @param Block Hexahedral solid to be multi-transformed.
4174 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
4175 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
4176 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
4177 # @return New GEOM_Object, containing the result shape.
4179 # @ref tui_multi_transformation "Example"
4180 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
4181 DirFace1V, DirFace2V, NbTimesV):
4182 # Example: see GEOM_Spanner.py
4183 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
4184 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
4185 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
4186 DirFace1V, DirFace2V, NbTimesV)
4187 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
4188 anObj.SetParameters(Parameters)
4191 ## Build all possible propagation groups.
4192 # Propagation group is a set of all edges, opposite to one (main)
4193 # edge of this group directly or through other opposite edges.
4194 # Notion of Opposite Edge make sence only on quadrangle face.
4195 # @param theShape Shape to build propagation groups on.
4196 # @return List of GEOM_Objects, each of them is a propagation group.
4198 # @ref swig_Propagate "Example"
4199 def Propagate(self,theShape):
4200 # Example: see GEOM_TestOthers.py
4201 listChains = self.BlocksOp.Propagate(theShape)
4202 RaiseIfFailed("Propagate", self.BlocksOp)
4205 # end of l3_blocks_op
4208 ## @addtogroup l3_groups
4211 ## Creates a new group which will store sub shapes of theMainShape
4212 # @param theMainShape is a GEOM object on which the group is selected
4213 # @param theShapeType defines a shape type of the group
4214 # @return a newly created GEOM group
4216 # @ref tui_working_with_groups_page "Example 1"
4217 # \n @ref swig_CreateGroup "Example 2"
4218 def CreateGroup(self,theMainShape, theShapeType):
4219 # Example: see GEOM_TestOthers.py
4220 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
4221 RaiseIfFailed("CreateGroup", self.GroupOp)
4224 ## Adds a sub object with ID theSubShapeId to the group
4225 # @param theGroup is a GEOM group to which the new sub shape is added
4226 # @param theSubShapeID is a sub shape ID in the main object.
4227 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
4229 # @ref tui_working_with_groups_page "Example"
4230 def AddObject(self,theGroup, theSubShapeID):
4231 # Example: see GEOM_TestOthers.py
4232 self.GroupOp.AddObject(theGroup, theSubShapeID)
4233 if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT":
4234 RaiseIfFailed("AddObject", self.GroupOp)
4238 ## Removes a sub object with ID \a theSubShapeId from the group
4239 # @param theGroup is a GEOM group from which the new sub shape is removed
4240 # @param theSubShapeID is a sub shape ID in the main object.
4241 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
4243 # @ref tui_working_with_groups_page "Example"
4244 def RemoveObject(self,theGroup, theSubShapeID):
4245 # Example: see GEOM_TestOthers.py
4246 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
4247 RaiseIfFailed("RemoveObject", self.GroupOp)
4250 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
4251 # @param theGroup is a GEOM group to which the new sub shapes are added.
4252 # @param theSubShapes is a list of sub shapes to be added.
4254 # @ref tui_working_with_groups_page "Example"
4255 def UnionList (self,theGroup, theSubShapes):
4256 # Example: see GEOM_TestOthers.py
4257 self.GroupOp.UnionList(theGroup, theSubShapes)
4258 RaiseIfFailed("UnionList", self.GroupOp)
4261 ## Works like the above method, but argument
4262 # theSubShapes here is a list of sub-shapes indices
4264 # @ref swig_UnionIDs "Example"
4265 def UnionIDs(self,theGroup, theSubShapes):
4266 # Example: see GEOM_TestOthers.py
4267 self.GroupOp.UnionIDs(theGroup, theSubShapes)
4268 RaiseIfFailed("UnionIDs", self.GroupOp)
4271 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
4272 # @param theGroup is a GEOM group from which the sub-shapes are removed.
4273 # @param theSubShapes is a list of sub-shapes to be removed.
4275 # @ref tui_working_with_groups_page "Example"
4276 def DifferenceList (self,theGroup, theSubShapes):
4277 # Example: see GEOM_TestOthers.py
4278 self.GroupOp.DifferenceList(theGroup, theSubShapes)
4279 RaiseIfFailed("DifferenceList", self.GroupOp)
4282 ## Works like the above method, but argument
4283 # theSubShapes here is a list of sub-shapes indices
4285 # @ref swig_DifferenceIDs "Example"
4286 def DifferenceIDs(self,theGroup, theSubShapes):
4287 # Example: see GEOM_TestOthers.py
4288 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
4289 RaiseIfFailed("DifferenceIDs", self.GroupOp)
4292 ## Returns a list of sub objects ID stored in the group
4293 # @param theGroup is a GEOM group for which a list of IDs is requested
4295 # @ref swig_GetObjectIDs "Example"
4296 def GetObjectIDs(self,theGroup):
4297 # Example: see GEOM_TestOthers.py
4298 ListIDs = self.GroupOp.GetObjects(theGroup)
4299 RaiseIfFailed("GetObjects", self.GroupOp)
4302 ## Returns a type of sub objects stored in the group
4303 # @param theGroup is a GEOM group which type is returned.
4305 # @ref swig_GetType "Example"
4306 def GetType(self,theGroup):
4307 # Example: see GEOM_TestOthers.py
4308 aType = self.GroupOp.GetType(theGroup)
4309 RaiseIfFailed("GetType", self.GroupOp)
4312 ## Convert a type of geom object from id to string value
4313 # @param theId is a GEOM obect type id.
4315 # @ref swig_GetType "Example"
4316 def ShapeIdToType(self, theId):
4390 return "FREE_BOUNDS"
4398 return "THRUSECTIONS"
4400 return "COMPOUNDFILTER"
4402 return "SHAPES_ON_SHAPE"
4404 return "ELLIPSE_ARC"
4411 return "Shape Id not exist."
4413 ## Returns a main shape associated with the group
4414 # @param theGroup is a GEOM group for which a main shape object is requested
4415 # @return a GEOM object which is a main shape for theGroup
4417 # @ref swig_GetMainShape "Example"
4418 def GetMainShape(self,theGroup):
4419 # Example: see GEOM_TestOthers.py
4420 anObj = self.GroupOp.GetMainShape(theGroup)
4421 RaiseIfFailed("GetMainShape", self.GroupOp)
4424 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
4425 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
4427 # @ref swig_todo "Example"
4428 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
4429 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
4432 Props = self.BasicProperties(edge)
4433 if min_length <= Props[0] and Props[0] <= max_length:
4434 if (not include_min) and (min_length == Props[0]):
4437 if (not include_max) and (Props[0] == max_length):
4440 edges_in_range.append(edge)
4442 if len(edges_in_range) <= 0:
4443 print "No edges found by given criteria"
4446 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
4447 self.UnionList(group_edges, edges_in_range)
4451 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
4452 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
4454 # @ref swig_todo "Example"
4455 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
4456 nb_selected = sg.SelectedCount()
4458 print "Select a shape before calling this function, please."
4461 print "Only one shape must be selected"
4464 id_shape = sg.getSelected(0)
4465 shape = IDToObject( id_shape )
4467 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
4471 if include_min: left_str = " <= "
4472 if include_max: right_str = " <= "
4474 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
4475 + left_str + "length" + right_str + `max_length`)
4477 sg.updateObjBrowser(1)
4484 ## @addtogroup l4_advanced
4487 ## Create a T-shape object with specified caracteristics for the main
4488 # and the incident pipes (radius, width, half-length).
4489 # The extremities of the main pipe are located on junctions points P1 and P2.
4490 # The extremity of the incident pipe is located on junction point P3.
4491 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4492 # the main plane of the T-shape is XOY.
4493 # @param theR1 Internal radius of main pipe
4494 # @param theW1 Width of main pipe
4495 # @param theL1 Half-length of main pipe
4496 # @param theR2 Internal radius of incident pipe (R2 < R1)
4497 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4498 # @param theL2 Half-length of incident pipe
4499 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4500 # @param theP1 1st junction point of main pipe
4501 # @param theP2 2nd junction point of main pipe
4502 # @param theP3 Junction point of incident pipe
4503 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4505 # @ref tui_creation_pipetshape "Example"
4506 def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4507 theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
4508 if (theP1 and theP2 and theP3):
4509 anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3)
4511 anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh)
4512 RaiseIfFailed("MakePipeTShape", self.AdvOp)
4513 if Parameters: anObj[0].SetParameters(Parameters)
4516 ## Create a T-shape object with chamfer and with specified caracteristics for the main
4517 # and the incident pipes (radius, width, half-length). The chamfer is
4518 # created on the junction of the pipes.
4519 # The extremities of the main pipe are located on junctions points P1 and P2.
4520 # The extremity of the incident pipe is located on junction point P3.
4521 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4522 # the main plane of the T-shape is XOY.
4523 # @param theR1 Internal radius of main pipe
4524 # @param theW1 Width of main pipe
4525 # @param theL1 Half-length of main pipe
4526 # @param theR2 Internal radius of incident pipe (R2 < R1)
4527 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4528 # @param theL2 Half-length of incident pipe
4529 # @param theH Height of the chamfer.
4530 # @param theW Width of the chamfer.
4531 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4532 # @param theP1 1st junction point of main pipe
4533 # @param theP2 2nd junction point of main pipe
4534 # @param theP3 Junction point of incident pipe
4535 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4537 # @ref tui_creation_pipetshape "Example"
4538 def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4539 theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW)
4540 if (theP1 and theP2 and theP3):
4541 anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3)
4543 anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh)
4544 RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp)
4545 if Parameters: anObj[0].SetParameters(Parameters)
4548 ## Create a T-shape object with fillet and with specified caracteristics for the main
4549 # and the incident pipes (radius, width, half-length). The fillet is
4550 # created on the junction of the pipes.
4551 # The extremities of the main pipe are located on junctions points P1 and P2.
4552 # The extremity of the incident pipe is located on junction point P3.
4553 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4554 # the main plane of the T-shape is XOY.
4555 # @param theR1 Internal radius of main pipe
4556 # @param theW1 Width of main pipe
4557 # @param theL1 Half-length of main pipe
4558 # @param theR2 Internal radius of incident pipe (R2 < R1)
4559 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4560 # @param theL2 Half-length of incident pipe
4561 # @param theRF Radius of curvature of fillet.
4562 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4563 # @param theP1 1st junction point of main pipe
4564 # @param theP2 2nd junction point of main pipe
4565 # @param theP3 Junction point of incident pipe
4566 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4568 # @ref tui_creation_pipetshape "Example"
4569 def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4570 theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF)
4571 if (theP1 and theP2 and theP3):
4572 anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3)
4574 anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh)
4575 RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp)
4576 if Parameters: anObj[0].SetParameters(Parameters)
4579 #@@ insert new functions before this line @@ do not remove this line @@#
4581 # end of l4_advanced
4584 ## Create a copy of the given object
4585 # @ingroup l1_geompy_auxiliary
4587 # @ref swig_all_advanced "Example"
4588 def MakeCopy(self,theOriginal):
4589 # Example: see GEOM_TestAll.py
4590 anObj = self.InsertOp.MakeCopy(theOriginal)
4591 RaiseIfFailed("MakeCopy", self.InsertOp)
4594 ## Add Path to load python scripts from
4595 # @ingroup l1_geompy_auxiliary
4596 def addPath(self,Path):
4597 if (sys.path.count(Path) < 1):
4598 sys.path.append(Path)
4602 ## Load marker texture from the file
4603 # @param Path a path to the texture file
4604 # @return unique texture identifier
4605 # @ingroup l1_geompy_auxiliary
4606 def LoadTexture(self, Path):
4607 # Example: see GEOM_TestAll.py
4608 ID = self.InsertOp.LoadTexture(Path)
4609 RaiseIfFailed("LoadTexture", self.InsertOp)
4612 ## Add marker texture. @a Width and @a Height parameters
4613 # specify width and height of the texture in pixels.
4614 # If @a RowData is @c True, @a Texture parameter should represent texture data
4615 # packed into the byte array. If @a RowData is @c False (default), @a Texture
4616 # parameter should be unpacked string, in which '1' symbols represent opaque
4617 # pixels and '0' represent transparent pixels of the texture bitmap.
4619 # @param Width texture width in pixels
4620 # @param Height texture height in pixels
4621 # @param Texture texture data
4622 # @param RowData if @c True, @a Texture data are packed in the byte stream
4623 # @ingroup l1_geompy_auxiliary
4624 def AddTexture(self, Width, Height, Texture, RowData=False):
4625 # Example: see GEOM_TestAll.py
4626 if not RowData: Texture = PackData(Texture)
4627 ID = self.InsertOp.AddTexture(Width, Height, Texture)
4628 RaiseIfFailed("AddTexture", self.InsertOp)
4632 #Register the new proxy for GEOM_Gen
4633 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)