1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2011 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
21 # Author : Paul RASCLE, EDF
29 ## @defgroup l1_geompy_auxiliary Auxiliary data structures and methods
31 ## @defgroup l1_geompy_purpose All package methods, grouped by their purpose
33 ## @defgroup l2_import_export Importing/exporting geometrical objects
34 ## @defgroup l2_creating Creating geometrical objects
36 ## @defgroup l3_basic_go Creating Basic Geometric Objects
38 ## @defgroup l4_curves Creating Curves
41 ## @defgroup l3_3d_primitives Creating 3D Primitives
42 ## @defgroup l3_complex Creating Complex Objects
43 ## @defgroup l3_groups Working with groups
44 ## @defgroup l3_blocks Building by blocks
46 ## @defgroup l4_blocks_measure Check and Improve
49 ## @defgroup l3_sketcher Sketcher
50 ## @defgroup l3_advanced Creating Advanced Geometrical Objects
52 ## @defgroup l4_decompose Decompose objects
53 ## @defgroup l4_decompose_d Decompose objects deprecated methods
54 ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
55 ## @defgroup l4_obtain Access to subshapes by a criteria
56 ## @defgroup l4_advanced Advanced objects creation functions
61 ## @defgroup l2_transforming Transforming geometrical objects
63 ## @defgroup l3_basic_op Basic Operations
64 ## @defgroup l3_boolean Boolean Operations
65 ## @defgroup l3_transform Transformation Operations
66 ## @defgroup l3_local Local Operations (Fillet and Chamfer)
67 ## @defgroup l3_blocks_op Blocks Operations
68 ## @defgroup l3_healing Repairing Operations
69 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of subshapes
72 ## @defgroup l2_measure Using measurement tools
80 from salome_notebook import *
85 ## Enumeration ShapeType as a dictionary
86 # @ingroup l1_geompy_auxiliary
87 ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
89 ## Raise an Error, containing the Method_name, if Operation is Failed
90 ## @ingroup l1_geompy_auxiliary
91 def RaiseIfFailed (Method_name, Operation):
92 if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
93 raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
95 ## Return list of variables value from salome notebook
96 ## @ingroup l1_geompy_auxiliary
97 def ParseParameters(*parameters):
100 for parameter in parameters:
101 if isinstance(parameter, list):
102 lResults = ParseParameters(*parameter)
103 if len(lResults) > 0:
104 Result.append(lResults[:-1])
105 StringResult += lResults[-1].split(":")
109 if isinstance(parameter,str):
110 if notebook.isVariable(parameter):
111 Result.append(notebook.get(parameter))
113 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
116 Result.append(parameter)
118 StringResult.append(str(parameter))
122 Result.append(":".join(StringResult))
124 Result = ":".join(StringResult)
127 ## Return list of variables value from salome notebook
128 ## @ingroup l1_geompy_auxiliary
132 for parameter in list:
133 if isinstance(parameter,str) and notebook.isVariable(parameter):
134 Result.append(str(notebook.get(parameter)))
137 Result.append(str(parameter))
140 StringResult = StringResult + str(parameter)
141 StringResult = StringResult + ":"
143 StringResult = StringResult[:len(StringResult)-1]
144 return Result, StringResult
146 ## Return list of variables value from salome notebook
147 ## @ingroup l1_geompy_auxiliary
148 def ParseSketcherCommand(command):
151 sections = command.split(":")
152 for section in sections:
153 parameters = section.split(" ")
155 for parameter in parameters:
156 if paramIndex > 1 and parameter.find("'") != -1:
157 parameter = parameter.replace("'","")
158 if notebook.isVariable(parameter):
159 Result = Result + str(notebook.get(parameter)) + " "
162 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
166 Result = Result + str(parameter) + " "
169 StringResult = StringResult + parameter
170 StringResult = StringResult + ":"
172 paramIndex = paramIndex + 1
174 Result = Result[:len(Result)-1] + ":"
176 Result = Result[:len(Result)-1]
177 return Result, StringResult
179 ## Helper function which can be used to pack the passed string to the byte data.
180 ## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
181 ## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
184 ## val = PackData("10001110") # val = 0xAE
185 ## val = PackData("1") # val = 0x80
187 ## @param data unpacked data - a string containing '1' and '0' symbols
188 ## @return data packed to the byte stream
189 ## @ingroup l1_geompy_auxiliary
192 if len(data)%8: bytes += 1
194 for b in range(bytes):
195 d = data[b*8:(b+1)*8]
200 if d[i] == "1": val += 1
202 raise "Invalid symbol %s" % d[i]
209 ## Read bitmap texture from the text file.
210 ## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
211 ## A zero symbol ('0') represents transparent pixel of the texture bitmap.
212 ## The function returns width and height of the pixmap in pixels and byte stream representing
213 ## texture bitmap itself.
215 ## This function can be used to read the texture to the byte stream in order to pass it to
216 ## the AddTexture() function of geompy class.
220 ## geompy.init_geom(salome.myStudy)
221 ## texture = geompy.readtexture('mytexture.dat')
222 ## texture = geompy.AddTexture(*texture)
223 ## obj.SetMarkerTexture(texture)
225 ## @param fname texture file name
226 ## @return sequence of tree values: texture's width, height in pixels and its byte stream
227 ## @ingroup l1_geompy_auxiliary
228 def ReadTexture(fname):
231 lines = [ l.strip() for l in f.readlines()]
234 if lines: maxlen = max([len(x) for x in lines])
236 if maxlen%8: lenbytes += 1
240 lenline = (len(line)/8+1)*8
243 lenline = (len(line)/8)*8
245 for i in range(lenline/8):
248 if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
251 bytedata += PackData(byte)
253 for i in range(lenline/8, lenbytes):
254 bytedata += PackData("0")
256 return lenbytes*8, len(lines), bytedata
261 ## Returns a long value from enumeration type
262 # Can be used for CORBA enumerator types like GEOM.shape_type
263 # @ingroup l1_geompy_auxiliary
264 def EnumToLong(theItem):
266 if hasattr(theItem, "_v"): ret = theItem._v
269 ## Kinds of shape enumeration
270 # @ingroup l1_geompy_auxiliary
271 kind = GEOM.GEOM_IKindOfShape
273 ## Information about closed/unclosed state of shell or wire
274 # @ingroup l1_geompy_auxiliary
280 class geompyDC(GEOM._objref_GEOM_Gen):
283 GEOM._objref_GEOM_Gen.__init__(self)
284 self.myBuilder = None
303 ## @addtogroup l1_geompy_auxiliary
305 def init_geom(self,theStudy):
306 self.myStudy = theStudy
307 self.myStudyId = self.myStudy._get_StudyId()
308 self.myBuilder = self.myStudy.NewBuilder()
309 self.father = self.myStudy.FindComponent("GEOM")
310 if self.father is None:
311 self.father = self.myBuilder.NewComponent("GEOM")
312 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
313 FName = A1._narrow(SALOMEDS.AttributeName)
314 FName.SetValue("Geometry")
315 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
316 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
317 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
318 self.myBuilder.DefineComponentInstance(self.father,self)
320 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
321 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
322 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
323 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
324 self.HealOp = self.GetIHealingOperations (self.myStudyId)
325 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
326 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
327 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
328 self.LocalOp = self.GetILocalOperations (self.myStudyId)
329 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
330 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
331 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
332 self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
335 ## Dump component to the Python script
336 # This method overrides IDL function to allow default values for the parameters.
337 def DumpPython(self, theStudy, theIsPublished=True, theIsMultiFile=True):
338 return GEOM._objref_GEOM_Gen.DumpPython(self, theStudy, theIsPublished, theIsMultiFile)
340 ## Get name for sub-shape aSubObj of shape aMainObj
342 # @ref swig_SubShapeAllSorted "Example"
343 def SubShapeName(self,aSubObj, aMainObj):
344 # Example: see GEOM_TestAll.py
346 #aSubId = orb.object_to_string(aSubObj)
347 #aMainId = orb.object_to_string(aMainObj)
348 #index = gg.getIndexTopology(aSubId, aMainId)
349 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
350 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
351 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
354 ## Publish in study aShape with name aName
356 # \param aShape the shape to be published
357 # \param aName the name for the shape
358 # \param doRestoreSubShapes if True, finds and publishes also
359 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
360 # and published sub-shapes of arguments
361 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
362 # these arguments description
363 # \return study entry of the published shape in form of string
365 # @ref swig_MakeQuad4Vertices "Example"
366 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
367 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
368 # Example: see GEOM_TestAll.py
370 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
371 if doRestoreSubShapes:
372 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
373 theFindMethod, theInheritFirstArg, True )
375 print "addToStudy() failed"
377 return aShape.GetStudyEntry()
379 ## Publish in study aShape with name aName as sub-object of previously published aFather
381 # @ref swig_SubShapeAllSorted "Example"
382 def addToStudyInFather(self, aFather, aShape, aName):
383 # Example: see GEOM_TestAll.py
385 aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather)
387 print "addToStudyInFather() failed"
389 return aShape.GetStudyEntry()
391 ## Unpublish object in study
393 def hideInStudy(self, obj):
394 ior = salome.orb.object_to_string(obj)
395 aSObject = self.myStudy.FindObjectIOR(ior)
396 if aSObject is not None:
397 genericAttribute = self.myBuilder.FindOrCreateAttribute(aSObject, "AttributeDrawable")
398 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
399 drwAttribute.SetDrawable(False)
402 # end of l1_geompy_auxiliary
405 ## @addtogroup l3_restore_ss
408 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
409 # To be used from python scripts out of geompy.addToStudy (non-default usage)
410 # \param theObject published GEOM object, arguments of which will be published
411 # \param theArgs list of GEOM_Object, operation arguments to be published.
412 # If this list is empty, all operation arguments will be published
413 # \param theFindMethod method to search subshapes, corresponding to arguments and
414 # their subshapes. Value from enumeration GEOM::find_shape_method.
415 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
416 # Do not publish subshapes in place of arguments, but only
417 # in place of subshapes of the first argument,
418 # because the whole shape corresponds to the first argument.
419 # Mainly to be used after transformations, but it also can be
420 # usefull after partition with one object shape, and some other
421 # operations, where only the first argument has to be considered.
422 # If theObject has only one argument shape, this flag is automatically
423 # considered as True, not regarding really passed value.
424 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
425 # and prefix "from_subshapes_of_" to names of partially restored subshapes.
426 # \return list of published sub-shapes
428 # @ref tui_restore_prs_params "Example"
429 def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
430 theInheritFirstArg=False, theAddPrefix=True):
431 # Example: see GEOM_TestAll.py
432 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
433 theFindMethod, theInheritFirstArg, theAddPrefix)
435 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
436 # To be used from python scripts out of geompy.addToStudy (non-default usage)
437 # \param theObject published GEOM object, arguments of which will be published
438 # \param theArgs list of GEOM_Object, operation arguments to be published.
439 # If this list is empty, all operation arguments will be published
440 # \param theFindMethod method to search subshapes, corresponding to arguments and
441 # their subshapes. Value from enumeration GEOM::find_shape_method.
442 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
443 # Do not publish subshapes in place of arguments, but only
444 # in place of subshapes of the first argument,
445 # because the whole shape corresponds to the first argument.
446 # Mainly to be used after transformations, but it also can be
447 # usefull after partition with one object shape, and some other
448 # operations, where only the first argument has to be considered.
449 # If theObject has only one argument shape, this flag is automatically
450 # considered as True, not regarding really passed value.
451 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
452 # and prefix "from_subshapes_of_" to names of partially restored subshapes.
453 # \return list of published sub-shapes
455 # @ref tui_restore_prs_params "Example"
456 def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
457 theInheritFirstArg=False, theAddPrefix=True):
458 # Example: see GEOM_TestAll.py
459 return self.RestoreGivenSubShapesO(self.myStudy, theObject, theArgs,
460 theFindMethod, theInheritFirstArg, theAddPrefix)
462 # end of l3_restore_ss
465 ## @addtogroup l3_basic_go
468 ## Create point by three coordinates.
469 # @param theX The X coordinate of the point.
470 # @param theY The Y coordinate of the point.
471 # @param theZ The Z coordinate of the point.
472 # @return New GEOM_Object, containing the created point.
474 # @ref tui_creation_point "Example"
475 def MakeVertex(self, theX, theY, theZ):
476 # Example: see GEOM_TestAll.py
477 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
478 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
479 RaiseIfFailed("MakePointXYZ", self.BasicOp)
480 anObj.SetParameters(Parameters)
483 ## Create a point, distant from the referenced point
484 # on the given distances along the coordinate axes.
485 # @param theReference The referenced point.
486 # @param theX Displacement from the referenced point along OX axis.
487 # @param theY Displacement from the referenced point along OY axis.
488 # @param theZ Displacement from the referenced point along OZ axis.
489 # @return New GEOM_Object, containing the created point.
491 # @ref tui_creation_point "Example"
492 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
493 # Example: see GEOM_TestAll.py
494 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
495 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
496 RaiseIfFailed("MakePointWithReference", self.BasicOp)
497 anObj.SetParameters(Parameters)
500 ## Create a point, corresponding to the given parameter on the given curve.
501 # @param theRefCurve The referenced curve.
502 # @param theParameter Value of parameter on the referenced curve.
503 # @return New GEOM_Object, containing the created point.
505 # @ref tui_creation_point "Example"
506 def MakeVertexOnCurve(self,theRefCurve, theParameter):
507 # Example: see GEOM_TestAll.py
508 theParameter, Parameters = ParseParameters(theParameter)
509 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
510 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
511 anObj.SetParameters(Parameters)
514 ## Create a point by projection give coordinates on the given curve
515 # @param theRefCurve The referenced curve.
516 # @param theX X-coordinate in 3D space
517 # @param theY Y-coordinate in 3D space
518 # @param theZ Z-coordinate in 3D space
519 # @return New GEOM_Object, containing the created point.
521 # @ref tui_creation_point "Example"
522 def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ):
523 # Example: see GEOM_TestAll.py
524 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
525 anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
526 RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
527 anObj.SetParameters(Parameters)
530 ## Create a point, corresponding to the given length on the given curve.
531 # @param theRefCurve The referenced curve.
532 # @param theLength Length on the referenced curve. It can be negative.
533 # @param theStartPoint Point allowing to choose the direction for the calculation
534 # of the length. If None, start from the first point of theRefCurve.
535 # @return New GEOM_Object, containing the created point.
537 # @ref tui_creation_point "Example"
538 def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
539 # Example: see GEOM_TestAll.py
540 theLength, Parameters = ParseParameters(theLength)
541 anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
542 RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
543 anObj.SetParameters(Parameters)
546 ## Create a point, corresponding to the given parameters on the
548 # @param theRefSurf The referenced surface.
549 # @param theUParameter Value of U-parameter on the referenced surface.
550 # @param theVParameter Value of V-parameter on the referenced surface.
551 # @return New GEOM_Object, containing the created point.
553 # @ref swig_MakeVertexOnSurface "Example"
554 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
555 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
556 # Example: see GEOM_TestAll.py
557 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
558 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
559 anObj.SetParameters(Parameters);
562 ## Create a point by projection give coordinates on the given surface
563 # @param theRefSurf The referenced surface.
564 # @param theX X-coordinate in 3D space
565 # @param theY Y-coordinate in 3D space
566 # @param theZ Z-coordinate in 3D space
567 # @return New GEOM_Object, containing the created point.
569 # @ref swig_MakeVertexOnSurfaceByCoord "Example"
570 def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ):
571 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
572 # Example: see GEOM_TestAll.py
573 anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
574 RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
575 anObj.SetParameters(Parameters);
578 ## Create a point on intersection of two lines.
579 # @param theRefLine1, theRefLine2 The referenced lines.
580 # @return New GEOM_Object, containing the created point.
582 # @ref swig_MakeVertexOnLinesIntersection "Example"
583 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
584 # Example: see GEOM_TestAll.py
585 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
586 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
589 ## Create a tangent, corresponding to the given parameter on the given curve.
590 # @param theRefCurve The referenced curve.
591 # @param theParameter Value of parameter on the referenced curve.
592 # @return New GEOM_Object, containing the created tangent.
594 # @ref swig_MakeTangentOnCurve "Example"
595 def MakeTangentOnCurve(self, theRefCurve, theParameter):
596 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
597 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
600 ## Create a tangent plane, corresponding to the given parameter on the given face.
601 # @param theFace The face for which tangent plane should be built.
602 # @param theParameterV vertical value of the center point (0.0 - 1.0).
603 # @param theParameterU horisontal value of the center point (0.0 - 1.0).
604 # @param theTrimSize the size of plane.
605 # @return New GEOM_Object, containing the created tangent.
607 # @ref swig_MakeTangentPlaneOnFace "Example"
608 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize):
609 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
610 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
613 ## Create a vector with the given components.
614 # @param theDX X component of the vector.
615 # @param theDY Y component of the vector.
616 # @param theDZ Z component of the vector.
617 # @return New GEOM_Object, containing the created vector.
619 # @ref tui_creation_vector "Example"
620 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
621 # Example: see GEOM_TestAll.py
622 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
623 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
624 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
625 anObj.SetParameters(Parameters)
628 ## Create a vector between two points.
629 # @param thePnt1 Start point for the vector.
630 # @param thePnt2 End point for the vector.
631 # @return New GEOM_Object, containing the created vector.
633 # @ref tui_creation_vector "Example"
634 def MakeVector(self,thePnt1, thePnt2):
635 # Example: see GEOM_TestAll.py
636 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
637 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
640 ## Create a line, passing through the given point
641 # and parrallel to the given direction
642 # @param thePnt Point. The resulting line will pass through it.
643 # @param theDir Direction. The resulting line will be parallel to it.
644 # @return New GEOM_Object, containing the created line.
646 # @ref tui_creation_line "Example"
647 def MakeLine(self,thePnt, theDir):
648 # Example: see GEOM_TestAll.py
649 anObj = self.BasicOp.MakeLine(thePnt, theDir)
650 RaiseIfFailed("MakeLine", self.BasicOp)
653 ## Create a line, passing through the given points
654 # @param thePnt1 First of two points, defining the line.
655 # @param thePnt2 Second of two points, defining the line.
656 # @return New GEOM_Object, containing the created line.
658 # @ref tui_creation_line "Example"
659 def MakeLineTwoPnt(self,thePnt1, thePnt2):
660 # Example: see GEOM_TestAll.py
661 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
662 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
665 ## Create a line on two faces intersection.
666 # @param theFace1 First of two faces, defining the line.
667 # @param theFace2 Second of two faces, defining the line.
668 # @return New GEOM_Object, containing the created line.
670 # @ref swig_MakeLineTwoFaces "Example"
671 def MakeLineTwoFaces(self, theFace1, theFace2):
672 # Example: see GEOM_TestAll.py
673 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
674 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
677 ## Create a plane, passing through the given point
678 # and normal to the given vector.
679 # @param thePnt Point, the plane has to pass through.
680 # @param theVec Vector, defining the plane normal direction.
681 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
682 # @return New GEOM_Object, containing the created plane.
684 # @ref tui_creation_plane "Example"
685 def MakePlane(self,thePnt, theVec, theTrimSize):
686 # Example: see GEOM_TestAll.py
687 theTrimSize, Parameters = ParseParameters(theTrimSize);
688 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
689 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
690 anObj.SetParameters(Parameters)
693 ## Create a plane, passing through the three given points
694 # @param thePnt1 First of three points, defining the plane.
695 # @param thePnt2 Second of three points, defining the plane.
696 # @param thePnt3 Fird of three points, defining the plane.
697 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
698 # @return New GEOM_Object, containing the created plane.
700 # @ref tui_creation_plane "Example"
701 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
702 # Example: see GEOM_TestAll.py
703 theTrimSize, Parameters = ParseParameters(theTrimSize);
704 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
705 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
706 anObj.SetParameters(Parameters)
709 ## Create a plane, similar to the existing one, but with another size of representing face.
710 # @param theFace Referenced plane or LCS(Marker).
711 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
712 # @return New GEOM_Object, containing the created plane.
714 # @ref tui_creation_plane "Example"
715 def MakePlaneFace(self,theFace, theTrimSize):
716 # Example: see GEOM_TestAll.py
717 theTrimSize, Parameters = ParseParameters(theTrimSize);
718 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
719 RaiseIfFailed("MakePlaneFace", self.BasicOp)
720 anObj.SetParameters(Parameters)
723 ## Create a plane, passing through the 2 vectors
724 # with center in a start point of the first vector.
725 # @param theVec1 Vector, defining center point and plane direction.
726 # @param theVec2 Vector, defining the plane normal direction.
727 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
728 # @return New GEOM_Object, containing the created plane.
730 # @ref tui_creation_plane "Example"
731 def MakePlane2Vec(self,theVec1, theVec2, theTrimSize):
732 # Example: see GEOM_TestAll.py
733 theTrimSize, Parameters = ParseParameters(theTrimSize);
734 anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
735 RaiseIfFailed("MakePlane2Vec", self.BasicOp)
736 anObj.SetParameters(Parameters)
739 ## Create a plane, based on a Local coordinate system.
740 # @param theLCS coordinate system, defining plane.
741 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
742 # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
743 # @return New GEOM_Object, containing the created plane.
745 # @ref tui_creation_plane "Example"
746 def MakePlaneLCS(self,theLCS, theTrimSize, theOrientation):
747 # Example: see GEOM_TestAll.py
748 theTrimSize, Parameters = ParseParameters(theTrimSize);
749 anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
750 RaiseIfFailed("MakePlaneLCS", self.BasicOp)
751 anObj.SetParameters(Parameters)
754 ## Create a local coordinate system.
755 # @param OX,OY,OZ Three coordinates of coordinate system origin.
756 # @param XDX,XDY,XDZ Three components of OX direction
757 # @param YDX,YDY,YDZ Three components of OY direction
758 # @return New GEOM_Object, containing the created coordinate system.
760 # @ref swig_MakeMarker "Example"
761 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
762 # Example: see GEOM_TestAll.py
763 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
764 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
765 RaiseIfFailed("MakeMarker", self.BasicOp)
766 anObj.SetParameters(Parameters)
769 ## Create a local coordinate system from shape.
770 # @param theShape The initial shape to detect the coordinate system.
771 # @return New GEOM_Object, containing the created coordinate system.
773 # @ref tui_creation_lcs "Example"
774 def MakeMarkerFromShape(self, theShape):
775 anObj = self.BasicOp.MakeMarkerFromShape(theShape)
776 RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
779 ## Create a local coordinate system from point and two vectors.
780 # @param theOrigin Point of coordinate system origin.
781 # @param theXVec Vector of X direction
782 # @param theYVec Vector of Y direction
783 # @return New GEOM_Object, containing the created coordinate system.
785 # @ref tui_creation_lcs "Example"
786 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
787 anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
788 RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
794 ## @addtogroup l4_curves
797 ## Create an arc of circle, passing through three given points.
798 # @param thePnt1 Start point of the arc.
799 # @param thePnt2 Middle point of the arc.
800 # @param thePnt3 End point of the arc.
801 # @return New GEOM_Object, containing the created arc.
803 # @ref swig_MakeArc "Example"
804 def MakeArc(self,thePnt1, thePnt2, thePnt3):
805 # Example: see GEOM_TestAll.py
806 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
807 RaiseIfFailed("MakeArc", self.CurvesOp)
810 ## Create an arc of circle from a center and 2 points.
811 # @param thePnt1 Center of the arc
812 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
813 # @param thePnt3 End point of the arc (Gives also a direction)
814 # @param theSense Orientation of the arc
815 # @return New GEOM_Object, containing the created arc.
817 # @ref swig_MakeArc "Example"
818 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
819 # Example: see GEOM_TestAll.py
820 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
821 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
824 ## Create an arc of ellipse, of center and two points.
825 # @param theCenter Center of the arc.
826 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
827 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
828 # @return New GEOM_Object, containing the created arc.
830 # @ref swig_MakeArc "Example"
831 def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2):
832 # Example: see GEOM_TestAll.py
833 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
834 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
837 ## Create a circle with given center, normal vector and radius.
838 # @param thePnt Circle center.
839 # @param theVec Vector, normal to the plane of the circle.
840 # @param theR Circle radius.
841 # @return New GEOM_Object, containing the created circle.
843 # @ref tui_creation_circle "Example"
844 def MakeCircle(self, thePnt, theVec, theR):
845 # Example: see GEOM_TestAll.py
846 theR, Parameters = ParseParameters(theR)
847 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
848 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
849 anObj.SetParameters(Parameters)
852 ## Create a circle with given radius.
853 # Center of the circle will be in the origin of global
854 # coordinate system and normal vector will be codirected with Z axis
855 # @param theR Circle radius.
856 # @return New GEOM_Object, containing the created circle.
857 def MakeCircleR(self, theR):
858 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
859 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
862 ## Create a circle, passing through three given points
863 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
864 # @return New GEOM_Object, containing the created circle.
866 # @ref tui_creation_circle "Example"
867 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
868 # Example: see GEOM_TestAll.py
869 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
870 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
873 ## Create a circle, with given point1 as center,
874 # passing through the point2 as radius and laying in the plane,
875 # defined by all three given points.
876 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
877 # @return New GEOM_Object, containing the created circle.
879 # @ref swig_MakeCircle "Example"
880 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
881 # Example: see GEOM_example6.py
882 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
883 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
886 ## Create an ellipse with given center, normal vector and radiuses.
887 # @param thePnt Ellipse center.
888 # @param theVec Vector, normal to the plane of the ellipse.
889 # @param theRMajor Major ellipse radius.
890 # @param theRMinor Minor ellipse radius.
891 # @param theVecMaj Vector, direction of the ellipse's main axis.
892 # @return New GEOM_Object, containing the created ellipse.
894 # @ref tui_creation_ellipse "Example"
895 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None):
896 # Example: see GEOM_TestAll.py
897 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
898 if theVecMaj is not None:
899 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
901 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
903 RaiseIfFailed("MakeEllipse", self.CurvesOp)
904 anObj.SetParameters(Parameters)
907 ## Create an ellipse with given radiuses.
908 # Center of the ellipse will be in the origin of global
909 # coordinate system and normal vector will be codirected with Z axis
910 # @param theRMajor Major ellipse radius.
911 # @param theRMinor Minor ellipse radius.
912 # @return New GEOM_Object, containing the created ellipse.
913 def MakeEllipseRR(self, theRMajor, theRMinor):
914 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
915 RaiseIfFailed("MakeEllipse", self.CurvesOp)
918 ## Create a polyline on the set of points.
919 # @param thePoints Sequence of points for the polyline.
920 # @param theIsClosed If True, build a closed wire.
921 # @return New GEOM_Object, containing the created polyline.
923 # @ref tui_creation_curve "Example"
924 def MakePolyline(self, thePoints, theIsClosed=False):
925 # Example: see GEOM_TestAll.py
926 anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
927 RaiseIfFailed("MakePolyline", self.CurvesOp)
930 ## Create bezier curve on the set of points.
931 # @param thePoints Sequence of points for the bezier curve.
932 # @param theIsClosed If True, build a closed curve.
933 # @return New GEOM_Object, containing the created bezier curve.
935 # @ref tui_creation_curve "Example"
936 def MakeBezier(self, thePoints, theIsClosed=False):
937 # Example: see GEOM_TestAll.py
938 anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
939 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
942 ## Create B-Spline curve on the set of points.
943 # @param thePoints Sequence of points for the B-Spline curve.
944 # @param theIsClosed If True, build a closed curve.
945 # @param theDoReordering If TRUE, the algo does not follow the order of
946 # \a thePoints but searches for the closest vertex.
947 # @return New GEOM_Object, containing the created B-Spline curve.
949 # @ref tui_creation_curve "Example"
950 def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False):
951 # Example: see GEOM_TestAll.py
952 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
953 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
957 ## Creates a curve using the parametric definition of the basic points.
958 # @param thexExpr parametric equation of the coordinates X.
959 # @param theyExpr parametric equation of the coordinates Y.
960 # @param thezExpr parametric equation of the coordinates Z.
961 # @param theParamMin the minimal value of the parameter.
962 # @param theParamMax the maximum value of the parameter.
963 # @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
964 # @param theCurveType the type of the curve.
965 # @param theNewMethod flag for switching to the new method if the flag is set to false a deprecated method is used which can lead to a bug.
966 # @return New GEOM_Object, containing the created curve.
968 # @ref tui_creation_curve "Example"
969 def MakeCurveParametric(self, thexExpr, theyExpr, thezExpr,
970 theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False ):
971 theParamMin,theParamMax,theParamStep,Parameters = ParseParameters(theParamMin,theParamMax,theParamStep)
973 anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
975 anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
976 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
977 anObj.SetParameters(Parameters)
985 ## @addtogroup l3_sketcher
988 ## Create a sketcher (wire or face), following the textual description,
989 # passed through <VAR>theCommand</VAR> argument. \n
990 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
991 # Format of the description string have to be the following:
993 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
996 # - x1, y1 are coordinates of the first sketcher point (zero by default),
998 # - "R angle" : Set the direction by angle
999 # - "D dx dy" : Set the direction by DX & DY
1002 # - "TT x y" : Create segment by point at X & Y
1003 # - "T dx dy" : Create segment by point with DX & DY
1004 # - "L length" : Create segment by direction & Length
1005 # - "IX x" : Create segment by direction & Intersect. X
1006 # - "IY y" : Create segment by direction & Intersect. Y
1009 # - "C radius length" : Create arc by direction, radius and length(in degree)
1010 # - "AA x y": Create arc by point at X & Y
1011 # - "A dx dy" : Create arc by point with DX & DY
1012 # - "A dx dy" : Create arc by point with DX & DY
1013 # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
1014 # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
1015 # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
1016 # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
1019 # - "WW" : Close Wire (to finish)
1020 # - "WF" : Close Wire and build face (to finish)
1023 # - Flag1 (= reverse) is 0 or 2 ...
1024 # - if 0 the drawn arc is the one of lower angle (< Pi)
1025 # - if 2 the drawn arc ius the one of greater angle (> Pi)
1028 # - Flag2 (= control tolerance) is 0 or 1 ...
1029 # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
1030 # - if 1 the wire is built only if the end point is on the arc
1031 # with a tolerance of 10^-7 on the distance else the creation fails
1033 # @param theCommand String, defining the sketcher in local
1034 # coordinates of the working plane.
1035 # @param theWorkingPlane Nine double values, defining origin,
1036 # OZ and OX directions of the working plane.
1037 # @return New GEOM_Object, containing the created wire.
1039 # @ref tui_sketcher_page "Example"
1040 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
1041 # Example: see GEOM_TestAll.py
1042 theCommand,Parameters = ParseSketcherCommand(theCommand)
1043 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
1044 RaiseIfFailed("MakeSketcher", self.CurvesOp)
1045 anObj.SetParameters(Parameters)
1048 ## Create a sketcher (wire or face), following the textual description,
1049 # passed through <VAR>theCommand</VAR> argument. \n
1050 # For format of the description string see the previous method.\n
1051 # @param theCommand String, defining the sketcher in local
1052 # coordinates of the working plane.
1053 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
1054 # @return New GEOM_Object, containing the created wire.
1056 # @ref tui_sketcher_page "Example"
1057 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
1058 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
1059 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
1062 ## Create a sketcher wire, following the numerical description,
1063 # passed through <VAR>theCoordinates</VAR> argument. \n
1064 # @param theCoordinates double values, defining points to create a wire,
1066 # @return New GEOM_Object, containing the created wire.
1068 # @ref tui_sketcher_page "Example"
1069 def Make3DSketcher(self, theCoordinates):
1070 theCoordinates,Parameters = ParseParameters(theCoordinates)
1071 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
1072 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
1073 anObj.SetParameters(Parameters)
1076 # end of l3_sketcher
1079 ## @addtogroup l3_3d_primitives
1082 ## Create a box by coordinates of two opposite vertices.
1084 # @ref tui_creation_box "Example"
1085 def MakeBox(self,x1,y1,z1,x2,y2,z2):
1086 # Example: see GEOM_TestAll.py
1087 pnt1 = self.MakeVertex(x1,y1,z1)
1088 pnt2 = self.MakeVertex(x2,y2,z2)
1089 return self.MakeBoxTwoPnt(pnt1,pnt2)
1091 ## Create a box with specified dimensions along the coordinate axes
1092 # and with edges, parallel to the coordinate axes.
1093 # Center of the box will be at point (DX/2, DY/2, DZ/2).
1094 # @param theDX Length of Box edges, parallel to OX axis.
1095 # @param theDY Length of Box edges, parallel to OY axis.
1096 # @param theDZ Length of Box edges, parallel to OZ axis.
1097 # @return New GEOM_Object, containing the created box.
1099 # @ref tui_creation_box "Example"
1100 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
1101 # Example: see GEOM_TestAll.py
1102 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1103 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
1104 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
1105 anObj.SetParameters(Parameters)
1108 ## Create a box with two specified opposite vertices,
1109 # and with edges, parallel to the coordinate axes
1110 # @param thePnt1 First of two opposite vertices.
1111 # @param thePnt2 Second of two opposite vertices.
1112 # @return New GEOM_Object, containing the created box.
1114 # @ref tui_creation_box "Example"
1115 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
1116 # Example: see GEOM_TestAll.py
1117 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
1118 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
1121 ## Create a face with specified dimensions along OX-OY coordinate axes,
1122 # with edges, parallel to this coordinate axes.
1123 # @param theH height of Face.
1124 # @param theW width of Face.
1125 # @param theOrientation orientation belong axis OXY OYZ OZX
1126 # @return New GEOM_Object, containing the created face.
1128 # @ref tui_creation_face "Example"
1129 def MakeFaceHW(self,theH, theW, theOrientation):
1130 # Example: see GEOM_TestAll.py
1131 theH,theW,Parameters = ParseParameters(theH, theW)
1132 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
1133 RaiseIfFailed("MakeFaceHW", self.PrimOp)
1134 anObj.SetParameters(Parameters)
1137 ## Create a face from another plane and two sizes,
1138 # vertical size and horisontal size.
1139 # @param theObj Normale vector to the creating face or
1141 # @param theH Height (vertical size).
1142 # @param theW Width (horisontal size).
1143 # @return New GEOM_Object, containing the created face.
1145 # @ref tui_creation_face "Example"
1146 def MakeFaceObjHW(self, theObj, theH, theW):
1147 # Example: see GEOM_TestAll.py
1148 theH,theW,Parameters = ParseParameters(theH, theW)
1149 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
1150 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
1151 anObj.SetParameters(Parameters)
1154 ## Create a disk with given center, normal vector and radius.
1155 # @param thePnt Disk center.
1156 # @param theVec Vector, normal to the plane of the disk.
1157 # @param theR Disk radius.
1158 # @return New GEOM_Object, containing the created disk.
1160 # @ref tui_creation_disk "Example"
1161 def MakeDiskPntVecR(self,thePnt, theVec, theR):
1162 # Example: see GEOM_TestAll.py
1163 theR,Parameters = ParseParameters(theR)
1164 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
1165 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
1166 anObj.SetParameters(Parameters)
1169 ## Create a disk, passing through three given points
1170 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
1171 # @return New GEOM_Object, containing the created disk.
1173 # @ref tui_creation_disk "Example"
1174 def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3):
1175 # Example: see GEOM_TestAll.py
1176 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
1177 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
1180 ## Create a disk with specified dimensions along OX-OY coordinate axes.
1181 # @param theR Radius of Face.
1182 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
1183 # @return New GEOM_Object, containing the created disk.
1185 # @ref tui_creation_face "Example"
1186 def MakeDiskR(self,theR, theOrientation):
1187 # Example: see GEOM_TestAll.py
1188 theR,Parameters = ParseParameters(theR)
1189 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
1190 RaiseIfFailed("MakeDiskR", self.PrimOp)
1191 anObj.SetParameters(Parameters)
1194 ## Create a cylinder with given base point, axis, radius and height.
1195 # @param thePnt Central point of cylinder base.
1196 # @param theAxis Cylinder axis.
1197 # @param theR Cylinder radius.
1198 # @param theH Cylinder height.
1199 # @return New GEOM_Object, containing the created cylinder.
1201 # @ref tui_creation_cylinder "Example"
1202 def MakeCylinder(self,thePnt, theAxis, theR, theH):
1203 # Example: see GEOM_TestAll.py
1204 theR,theH,Parameters = ParseParameters(theR, theH)
1205 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
1206 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
1207 anObj.SetParameters(Parameters)
1210 ## Create a cylinder with given radius and height at
1211 # the origin of coordinate system. Axis of the cylinder
1212 # will be collinear to the OZ axis of the coordinate system.
1213 # @param theR Cylinder radius.
1214 # @param theH Cylinder height.
1215 # @return New GEOM_Object, containing the created cylinder.
1217 # @ref tui_creation_cylinder "Example"
1218 def MakeCylinderRH(self,theR, theH):
1219 # Example: see GEOM_TestAll.py
1220 theR,theH,Parameters = ParseParameters(theR, theH)
1221 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
1222 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
1223 anObj.SetParameters(Parameters)
1226 ## Create a sphere with given center and radius.
1227 # @param thePnt Sphere center.
1228 # @param theR Sphere radius.
1229 # @return New GEOM_Object, containing the created sphere.
1231 # @ref tui_creation_sphere "Example"
1232 def MakeSpherePntR(self, thePnt, theR):
1233 # Example: see GEOM_TestAll.py
1234 theR,Parameters = ParseParameters(theR)
1235 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
1236 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
1237 anObj.SetParameters(Parameters)
1240 ## Create a sphere with given center and radius.
1241 # @param x,y,z Coordinates of sphere center.
1242 # @param theR Sphere radius.
1243 # @return New GEOM_Object, containing the created sphere.
1245 # @ref tui_creation_sphere "Example"
1246 def MakeSphere(self, x, y, z, theR):
1247 # Example: see GEOM_TestAll.py
1248 point = self.MakeVertex(x, y, z)
1249 anObj = self.MakeSpherePntR(point, theR)
1252 ## Create a sphere with given radius at the origin of coordinate system.
1253 # @param theR Sphere radius.
1254 # @return New GEOM_Object, containing the created sphere.
1256 # @ref tui_creation_sphere "Example"
1257 def MakeSphereR(self, theR):
1258 # Example: see GEOM_TestAll.py
1259 theR,Parameters = ParseParameters(theR)
1260 anObj = self.PrimOp.MakeSphereR(theR)
1261 RaiseIfFailed("MakeSphereR", self.PrimOp)
1262 anObj.SetParameters(Parameters)
1265 ## Create a cone with given base point, axis, height and radiuses.
1266 # @param thePnt Central point of the first cone base.
1267 # @param theAxis Cone axis.
1268 # @param theR1 Radius of the first cone base.
1269 # @param theR2 Radius of the second cone base.
1270 # \note If both radiuses are non-zero, the cone will be truncated.
1271 # \note If the radiuses are equal, a cylinder will be created instead.
1272 # @param theH Cone height.
1273 # @return New GEOM_Object, containing the created cone.
1275 # @ref tui_creation_cone "Example"
1276 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
1277 # Example: see GEOM_TestAll.py
1278 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1279 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
1280 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
1281 anObj.SetParameters(Parameters)
1284 ## Create a cone with given height and radiuses at
1285 # the origin of coordinate system. Axis of the cone will
1286 # be collinear to the OZ axis of the coordinate system.
1287 # @param theR1 Radius of the first cone base.
1288 # @param theR2 Radius of the second cone base.
1289 # \note If both radiuses are non-zero, the cone will be truncated.
1290 # \note If the radiuses are equal, a cylinder will be created instead.
1291 # @param theH Cone height.
1292 # @return New GEOM_Object, containing the created cone.
1294 # @ref tui_creation_cone "Example"
1295 def MakeConeR1R2H(self,theR1, theR2, theH):
1296 # Example: see GEOM_TestAll.py
1297 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1298 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
1299 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
1300 anObj.SetParameters(Parameters)
1303 ## Create a torus with given center, normal vector and radiuses.
1304 # @param thePnt Torus central point.
1305 # @param theVec Torus axis of symmetry.
1306 # @param theRMajor Torus major radius.
1307 # @param theRMinor Torus minor radius.
1308 # @return New GEOM_Object, containing the created torus.
1310 # @ref tui_creation_torus "Example"
1311 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
1312 # Example: see GEOM_TestAll.py
1313 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1314 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
1315 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
1316 anObj.SetParameters(Parameters)
1319 ## Create a torus with given radiuses at the origin of coordinate system.
1320 # @param theRMajor Torus major radius.
1321 # @param theRMinor Torus minor radius.
1322 # @return New GEOM_Object, containing the created torus.
1324 # @ref tui_creation_torus "Example"
1325 def MakeTorusRR(self, theRMajor, theRMinor):
1326 # Example: see GEOM_TestAll.py
1327 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1328 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
1329 RaiseIfFailed("MakeTorusRR", self.PrimOp)
1330 anObj.SetParameters(Parameters)
1333 # end of l3_3d_primitives
1336 ## @addtogroup l3_complex
1339 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
1340 # @param theBase Base shape to be extruded.
1341 # @param thePoint1 First end of extrusion vector.
1342 # @param thePoint2 Second end of extrusion vector.
1343 # @param theScaleFactor Use it to make prism with scaled second base.
1344 # Nagative value means not scaled second base.
1345 # @return New GEOM_Object, containing the created prism.
1347 # @ref tui_creation_prism "Example"
1348 def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0):
1349 # Example: see GEOM_TestAll.py
1352 if theScaleFactor > 0:
1353 theScaleFactor,Parameters = ParseParameters(theScaleFactor)
1354 anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor)
1356 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
1357 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1358 anObj.SetParameters(Parameters)
1361 ## Create a shape by extrusion of the base shape along a
1362 # vector, defined by two points, in 2 Ways (forward/backward).
1363 # @param theBase Base shape to be extruded.
1364 # @param thePoint1 First end of extrusion vector.
1365 # @param thePoint2 Second end of extrusion vector.
1366 # @return New GEOM_Object, containing the created prism.
1368 # @ref tui_creation_prism "Example"
1369 def MakePrism2Ways(self, theBase, thePoint1, thePoint2):
1370 # Example: see GEOM_TestAll.py
1371 anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
1372 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1375 ## Create a shape by extrusion of the base shape along the vector,
1376 # i.e. all the space, transfixed by the base shape during its translation
1377 # along the vector on the given distance.
1378 # @param theBase Base shape to be extruded.
1379 # @param theVec Direction of extrusion.
1380 # @param theH Prism dimension along theVec.
1381 # @param theScaleFactor Use it to make prism with scaled second base.
1382 # Nagative value means not scaled second base.
1383 # @return New GEOM_Object, containing the created prism.
1385 # @ref tui_creation_prism "Example"
1386 def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0):
1387 # Example: see GEOM_TestAll.py
1390 if theScaleFactor > 0:
1391 theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor)
1392 anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor)
1394 theH,Parameters = ParseParameters(theH)
1395 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
1396 RaiseIfFailed("MakePrismVecH", self.PrimOp)
1397 anObj.SetParameters(Parameters)
1400 ## Create a shape by extrusion of the base shape along the vector,
1401 # i.e. all the space, transfixed by the base shape during its translation
1402 # along the vector on the given distance in 2 Ways (forward/backward).
1403 # @param theBase Base shape to be extruded.
1404 # @param theVec Direction of extrusion.
1405 # @param theH Prism dimension along theVec in forward direction.
1406 # @return New GEOM_Object, containing the created prism.
1408 # @ref tui_creation_prism "Example"
1409 def MakePrismVecH2Ways(self, theBase, theVec, theH):
1410 # Example: see GEOM_TestAll.py
1411 theH,Parameters = ParseParameters(theH)
1412 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
1413 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
1414 anObj.SetParameters(Parameters)
1417 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1418 # @param theBase Base shape to be extruded.
1419 # @param theDX, theDY, theDZ Directions of extrusion.
1420 # @param theScaleFactor Use it to make prism with scaled second base.
1421 # Nagative value means not scaled second base.
1422 # @return New GEOM_Object, containing the created prism.
1424 # @ref tui_creation_prism "Example"
1425 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0):
1426 # Example: see GEOM_TestAll.py
1429 if theScaleFactor > 0:
1430 theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor)
1431 anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor)
1433 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1434 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
1435 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
1436 anObj.SetParameters(Parameters)
1439 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1440 # i.e. all the space, transfixed by the base shape during its translation
1441 # along the vector on the given distance in 2 Ways (forward/backward).
1442 # @param theBase Base shape to be extruded.
1443 # @param theDX, theDY, theDZ Directions of extrusion.
1444 # @return New GEOM_Object, containing the created prism.
1446 # @ref tui_creation_prism "Example"
1447 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
1448 # Example: see GEOM_TestAll.py
1449 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1450 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
1451 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
1452 anObj.SetParameters(Parameters)
1455 ## Create a shape by revolution of the base shape around the axis
1456 # on the given angle, i.e. all the space, transfixed by the base
1457 # shape during its rotation around the axis on the given angle.
1458 # @param theBase Base shape to be rotated.
1459 # @param theAxis Rotation axis.
1460 # @param theAngle Rotation angle in radians.
1461 # @return New GEOM_Object, containing the created revolution.
1463 # @ref tui_creation_revolution "Example"
1464 def MakeRevolution(self, theBase, theAxis, theAngle):
1465 # Example: see GEOM_TestAll.py
1466 theAngle,Parameters = ParseParameters(theAngle)
1467 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
1468 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
1469 anObj.SetParameters(Parameters)
1472 ## The Same Revolution but in both ways forward&backward.
1473 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
1474 theAngle,Parameters = ParseParameters(theAngle)
1475 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
1476 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
1477 anObj.SetParameters(Parameters)
1480 ## Create a filling from the given compound of contours.
1481 # @param theShape the compound of contours
1482 # @param theMinDeg a minimal degree of BSpline surface to create
1483 # @param theMaxDeg a maximal degree of BSpline surface to create
1484 # @param theTol2D a 2d tolerance to be reached
1485 # @param theTol3D a 3d tolerance to be reached
1486 # @param theNbIter a number of iteration of approximation algorithm
1487 # @param theMethod Kind of method to perform filling operation:
1488 # GEOM.FOM_Default - Default - standard behaviour
1489 # /GEOM.FOM_UseOri - Use edges orientation - orientation of edges is
1490 # used: if the edge is reversed, the curve from this edge
1491 # is reversed before using it in the filling algorithm.
1492 # /GEOM.FOM_AutoCorrect - Auto-correct orientation - changes the orientation
1493 # of the curves using minimization of sum of distances
1494 # between the end points of the edges.
1495 # @param isApprox if True, BSpline curves are generated in the process
1496 # of surface construction. By default it is False, that means
1497 # the surface is created using Besier curves. The usage of
1498 # Approximation makes the algorithm work slower, but allows
1499 # building the surface for rather complex cases
1500 # @return New GEOM_Object, containing the created filling surface.
1502 # @ref tui_creation_filling "Example"
1503 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D,
1504 theTol3D, theNbIter, theMethod=GEOM.FOM_Default, isApprox=0):
1505 # Example: see GEOM_TestAll.py
1506 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
1507 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
1508 theTol2D, theTol3D, theNbIter,
1509 theMethod, isApprox)
1510 RaiseIfFailed("MakeFilling", self.PrimOp)
1511 anObj.SetParameters(Parameters)
1514 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
1515 # @param theSeqSections - set of specified sections.
1516 # @param theModeSolid - mode defining building solid or shell
1517 # @param thePreci - precision 3D used for smoothing by default 1.e-6
1518 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
1519 # @return New GEOM_Object, containing the created shell or solid.
1521 # @ref swig_todo "Example"
1522 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
1523 # Example: see GEOM_TestAll.py
1524 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
1525 RaiseIfFailed("MakeThruSections", self.PrimOp)
1528 ## Create a shape by extrusion of the base shape along
1529 # the path shape. The path shape can be a wire or an edge.
1530 # @param theBase Base shape to be extruded.
1531 # @param thePath Path shape to extrude the base shape along it.
1532 # @return New GEOM_Object, containing the created pipe.
1534 # @ref tui_creation_pipe "Example"
1535 def MakePipe(self,theBase, thePath):
1536 # Example: see GEOM_TestAll.py
1537 anObj = self.PrimOp.MakePipe(theBase, thePath)
1538 RaiseIfFailed("MakePipe", self.PrimOp)
1541 ## Create a shape by extrusion of the profile shape along
1542 # the path shape. The path shape can be a wire or an edge.
1543 # the several profiles can be specified in the several locations of path.
1544 # @param theSeqBases - list of Bases shape to be extruded.
1545 # @param theLocations - list of locations on the path corresponding
1546 # specified list of the Bases shapes. Number of locations
1547 # should be equal to number of bases or list of locations can be empty.
1548 # @param thePath - Path shape to extrude the base shape along it.
1549 # @param theWithContact - the mode defining that the section is translated to be in
1550 # contact with the spine.
1551 # @param theWithCorrection - defining that the section is rotated to be
1552 # orthogonal to the spine tangent in the correspondent point
1553 # @return New GEOM_Object, containing the created pipe.
1555 # @ref tui_creation_pipe_with_diff_sec "Example"
1556 def MakePipeWithDifferentSections(self, theSeqBases,
1557 theLocations, thePath,
1558 theWithContact, theWithCorrection):
1559 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
1560 theLocations, thePath,
1561 theWithContact, theWithCorrection)
1562 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
1565 ## Create a shape by extrusion of the profile shape along
1566 # the path shape. The path shape can be a wire or a edge.
1567 # the several profiles can be specified in the several locations of path.
1568 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
1569 # shell or face. If number of faces in neighbour sections
1570 # aren't coincided result solid between such sections will
1571 # be created using external boundaries of this shells.
1572 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
1573 # This list is used for searching correspondences between
1574 # faces in the sections. Size of this list must be equal
1575 # to size of list of base shapes.
1576 # @param theLocations - list of locations on the path corresponding
1577 # specified list of the Bases shapes. Number of locations
1578 # should be equal to number of bases. First and last
1579 # locations must be coincided with first and last vertexes
1580 # of path correspondingly.
1581 # @param thePath - Path shape to extrude the base shape along it.
1582 # @param theWithContact - the mode defining that the section is translated to be in
1583 # contact with the spine.
1584 # @param theWithCorrection - defining that the section is rotated to be
1585 # orthogonal to the spine tangent in the correspondent point
1586 # @return New GEOM_Object, containing the created solids.
1588 # @ref tui_creation_pipe_with_shell_sec "Example"
1589 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
1590 theLocations, thePath,
1591 theWithContact, theWithCorrection):
1592 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
1593 theLocations, thePath,
1594 theWithContact, theWithCorrection)
1595 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1598 ## Create a shape by extrusion of the profile shape along
1599 # the path shape. This function is used only for debug pipe
1600 # functionality - it is a version of previous function
1601 # (MakePipeWithShellSections(...)) which give a possibility to
1602 # recieve information about creating pipe between each pair of
1603 # sections step by step.
1604 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
1605 theLocations, thePath,
1606 theWithContact, theWithCorrection):
1608 nbsect = len(theSeqBases)
1609 nbsubsect = len(theSeqSubBases)
1610 #print "nbsect = ",nbsect
1611 for i in range(1,nbsect):
1613 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
1614 tmpLocations = [ theLocations[i-1], theLocations[i] ]
1616 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
1617 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
1618 tmpLocations, thePath,
1619 theWithContact, theWithCorrection)
1620 if self.PrimOp.IsDone() == 0:
1621 print "Problems with pipe creation between ",i," and ",i+1," sections"
1622 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1625 print "Pipe between ",i," and ",i+1," sections is OK"
1630 resc = self.MakeCompound(res)
1631 #resc = self.MakeSewing(res, 0.001)
1632 #print "resc: ",resc
1635 ## Create solids between given sections
1636 # @param theSeqBases - list of sections (shell or face).
1637 # @param theLocations - list of corresponding vertexes
1638 # @return New GEOM_Object, containing the created solids.
1640 # @ref tui_creation_pipe_without_path "Example"
1641 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1642 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1643 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1646 ## Create a shape by extrusion of the base shape along
1647 # the path shape with constant bi-normal direction along the given vector.
1648 # The path shape can be a wire or an edge.
1649 # @param theBase Base shape to be extruded.
1650 # @param thePath Path shape to extrude the base shape along it.
1651 # @param theVec Vector defines a constant binormal direction to keep the
1652 # same angle beetween the direction and the sections
1653 # along the sweep surface.
1654 # @return New GEOM_Object, containing the created pipe.
1656 # @ref tui_creation_pipe "Example"
1657 def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
1658 # Example: see GEOM_TestAll.py
1659 anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
1660 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
1666 ## @addtogroup l3_advanced
1669 ## Create a linear edge with specified ends.
1670 # @param thePnt1 Point for the first end of edge.
1671 # @param thePnt2 Point for the second end of edge.
1672 # @return New GEOM_Object, containing the created edge.
1674 # @ref tui_creation_edge "Example"
1675 def MakeEdge(self,thePnt1, thePnt2):
1676 # Example: see GEOM_TestAll.py
1677 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1678 RaiseIfFailed("MakeEdge", self.ShapesOp)
1681 ## Create a new edge, corresponding to the given length on the given curve.
1682 # @param theRefCurve The referenced curve (edge).
1683 # @param theLength Length on the referenced curve. It can be negative.
1684 # @param theStartPoint Any point can be selected for it, the new edge will begin
1685 # at the end of \a theRefCurve, close to the selected point.
1686 # If None, start from the first point of \a theRefCurve.
1687 # @return New GEOM_Object, containing the created edge.
1689 # @ref tui_creation_edge "Example"
1690 def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
1691 # Example: see GEOM_TestAll.py
1692 theLength, Parameters = ParseParameters(theLength)
1693 anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
1694 RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp)
1695 anObj.SetParameters(Parameters)
1698 ## Create an edge from specified wire.
1699 # @param theWire source Wire.
1700 # @param theLinearTolerance linear tolerance value.
1701 # @param theAngularTolerance angular tolerance value.
1702 # @return New GEOM_Object, containing the created edge.
1704 # @ref tui_creation_edge "Example"
1705 def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12):
1706 # Example: see GEOM_TestAll.py
1707 anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
1708 RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
1711 ## Create a wire from the set of edges and wires.
1712 # @param theEdgesAndWires List of edges and/or wires.
1713 # @param theTolerance Maximum distance between vertices, that will be merged.
1714 # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
1715 # @return New GEOM_Object, containing the created wire.
1717 # @ref tui_creation_wire "Example"
1718 def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07):
1719 # Example: see GEOM_TestAll.py
1720 anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
1721 RaiseIfFailed("MakeWire", self.ShapesOp)
1724 ## Create a face on the given wire.
1725 # @param theWire closed Wire or Edge to build the face on.
1726 # @param isPlanarWanted If TRUE, only planar face will be built.
1727 # If impossible, NULL object will be returned.
1728 # @return New GEOM_Object, containing the created face.
1730 # @ref tui_creation_face "Example"
1731 def MakeFace(self,theWire, isPlanarWanted):
1732 # Example: see GEOM_TestAll.py
1733 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1734 if anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
1735 print "WARNING: Tolerance of resulting face is too big."
1737 RaiseIfFailed("MakeFace", self.ShapesOp)
1740 ## Create a face on the given wires set.
1741 # @param theWires List of closed wires or edges to build the face on.
1742 # @param isPlanarWanted If TRUE, only planar face will be built.
1743 # If impossible, NULL object will be returned.
1744 # @return New GEOM_Object, containing the created face.
1746 # @ref tui_creation_face "Example"
1747 def MakeFaceWires(self,theWires, isPlanarWanted):
1748 # Example: see GEOM_TestAll.py
1749 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1750 if anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
1751 print "WARNING: Tolerance of resulting face is too big."
1753 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1756 ## Shortcut to MakeFaceWires()
1758 # @ref tui_creation_face "Example 1"
1759 # \n @ref swig_MakeFaces "Example 2"
1760 def MakeFaces(self,theWires, isPlanarWanted):
1761 # Example: see GEOM_TestOthers.py
1762 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1765 ## Create a shell from the set of faces and shells.
1766 # @param theFacesAndShells List of faces and/or shells.
1767 # @return New GEOM_Object, containing the created shell.
1769 # @ref tui_creation_shell "Example"
1770 def MakeShell(self,theFacesAndShells):
1771 # Example: see GEOM_TestAll.py
1772 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1773 RaiseIfFailed("MakeShell", self.ShapesOp)
1776 ## Create a solid, bounded by the given shells.
1777 # @param theShells Sequence of bounding shells.
1778 # @return New GEOM_Object, containing the created solid.
1780 # @ref tui_creation_solid "Example"
1781 def MakeSolid(self,theShells):
1782 # Example: see GEOM_TestAll.py
1783 anObj = self.ShapesOp.MakeSolidShells(theShells)
1784 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1787 ## Create a compound of the given shapes.
1788 # @param theShapes List of shapes to put in compound.
1789 # @return New GEOM_Object, containing the created compound.
1791 # @ref tui_creation_compound "Example"
1792 def MakeCompound(self,theShapes):
1793 # Example: see GEOM_TestAll.py
1794 anObj = self.ShapesOp.MakeCompound(theShapes)
1795 RaiseIfFailed("MakeCompound", self.ShapesOp)
1798 # end of l3_advanced
1801 ## @addtogroup l2_measure
1804 ## Gives quantity of faces in the given shape.
1805 # @param theShape Shape to count faces of.
1806 # @return Quantity of faces.
1808 # @ref swig_NumberOf "Example"
1809 def NumberOfFaces(self, theShape):
1810 # Example: see GEOM_TestOthers.py
1811 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1812 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1815 ## Gives quantity of edges in the given shape.
1816 # @param theShape Shape to count edges of.
1817 # @return Quantity of edges.
1819 # @ref swig_NumberOf "Example"
1820 def NumberOfEdges(self, theShape):
1821 # Example: see GEOM_TestOthers.py
1822 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1823 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1826 ## Gives quantity of subshapes of type theShapeType in the given shape.
1827 # @param theShape Shape to count subshapes of.
1828 # @param theShapeType Type of subshapes to count.
1829 # @return Quantity of subshapes of given type.
1831 # @ref swig_NumberOf "Example"
1832 def NumberOfSubShapes(self, theShape, theShapeType):
1833 # Example: see GEOM_TestOthers.py
1834 nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
1835 RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
1838 ## Gives quantity of solids in the given shape.
1839 # @param theShape Shape to count solids in.
1840 # @return Quantity of solids.
1842 # @ref swig_NumberOf "Example"
1843 def NumberOfSolids(self, theShape):
1844 # Example: see GEOM_TestOthers.py
1845 nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["SOLID"])
1846 RaiseIfFailed("NumberOfSolids", self.ShapesOp)
1852 ## @addtogroup l3_healing
1855 ## Reverses an orientation the given shape.
1856 # @param theShape Shape to be reversed.
1857 # @return The reversed copy of theShape.
1859 # @ref swig_ChangeOrientation "Example"
1860 def ChangeOrientation(self,theShape):
1861 # Example: see GEOM_TestAll.py
1862 anObj = self.ShapesOp.ChangeOrientation(theShape)
1863 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1866 ## Shortcut to ChangeOrientation()
1868 # @ref swig_OrientationChange "Example"
1869 def OrientationChange(self,theShape):
1870 # Example: see GEOM_TestOthers.py
1871 anObj = self.ChangeOrientation(theShape)
1877 ## @addtogroup l4_obtain
1880 ## Retrieve all free faces from the given shape.
1881 # Free face is a face, which is not shared between two shells of the shape.
1882 # @param theShape Shape to find free faces in.
1883 # @return List of IDs of all free faces, contained in theShape.
1885 # @ref tui_measurement_tools_page "Example"
1886 def GetFreeFacesIDs(self,theShape):
1887 # Example: see GEOM_TestOthers.py
1888 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1889 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1892 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1893 # @param theShape1 Shape to find sub-shapes in.
1894 # @param theShape2 Shape to find shared sub-shapes with.
1895 # @param theShapeType Type of sub-shapes to be retrieved.
1896 # @return List of sub-shapes of theShape1, shared with theShape2.
1898 # @ref swig_GetSharedShapes "Example"
1899 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1900 # Example: see GEOM_TestOthers.py
1901 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1902 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1905 ## Get all sub-shapes, shared by all shapes in the list <VAR>theShapes</VAR>.
1906 # @param theShapes Shapes to find common sub-shapes of.
1907 # @param theShapeType Type of sub-shapes to be retrieved.
1908 # @return List of objects, that are sub-shapes of all given shapes.
1910 # @ref swig_GetSharedShapes "Example"
1911 def GetSharedShapesMulti(self, theShapes, theShapeType):
1912 # Example: see GEOM_TestOthers.py
1913 aList = self.ShapesOp.GetSharedShapesMulti(theShapes, theShapeType)
1914 RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
1917 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1918 # situated relatively the specified plane by the certain way,
1919 # defined through <VAR>theState</VAR> parameter.
1920 # @param theShape Shape to find sub-shapes of.
1921 # @param theShapeType Type of sub-shapes to be retrieved.
1922 # @param theAx1 Vector (or line, or linear edge), specifying normal
1923 # direction and location of the plane to find shapes on.
1924 # @param theState The state of the subshapes to find. It can be one of
1925 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1926 # @return List of all found sub-shapes.
1928 # @ref swig_GetShapesOnPlane "Example"
1929 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1930 # Example: see GEOM_TestOthers.py
1931 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1932 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1935 ## Works like the above method, but returns list of sub-shapes indices
1937 # @ref swig_GetShapesOnPlaneIDs "Example"
1938 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1939 # Example: see GEOM_TestOthers.py
1940 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1941 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1944 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1945 # situated relatively the specified plane by the certain way,
1946 # defined through <VAR>theState</VAR> parameter.
1947 # @param theShape Shape to find sub-shapes of.
1948 # @param theShapeType Type of sub-shapes to be retrieved.
1949 # @param theAx1 Vector (or line, or linear edge), specifying normal
1950 # direction of the plane to find shapes on.
1951 # @param thePnt Point specifying location of the plane to find shapes on.
1952 # @param theState The state of the subshapes to find. It can be one of
1953 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1954 # @return List of all found sub-shapes.
1956 # @ref swig_GetShapesOnPlaneWithLocation "Example"
1957 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1958 # Example: see GEOM_TestOthers.py
1959 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1960 theAx1, thePnt, theState)
1961 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1964 ## Works like the above method, but returns list of sub-shapes indices
1966 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
1967 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1968 # Example: see GEOM_TestOthers.py
1969 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1970 theAx1, thePnt, theState)
1971 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1974 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1975 # the specified cylinder by the certain way, defined through \a theState parameter.
1976 # @param theShape Shape to find sub-shapes of.
1977 # @param theShapeType Type of sub-shapes to be retrieved.
1978 # @param theAxis Vector (or line, or linear edge), specifying
1979 # axis of the cylinder to find shapes on.
1980 # @param theRadius Radius of the cylinder to find shapes on.
1981 # @param theState The state of the subshapes to find. It can be one of
1982 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1983 # @return List of all found sub-shapes.
1985 # @ref swig_GetShapesOnCylinder "Example"
1986 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1987 # Example: see GEOM_TestOthers.py
1988 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1989 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1992 ## Works like the above method, but returns list of sub-shapes indices
1994 # @ref swig_GetShapesOnCylinderIDs "Example"
1995 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1996 # Example: see GEOM_TestOthers.py
1997 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1998 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
2001 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
2002 # the specified cylinder by the certain way, defined through \a theState parameter.
2003 # @param theShape Shape to find sub-shapes of.
2004 # @param theShapeType Type of sub-shapes to be retrieved.
2005 # @param theAxis Vector (or line, or linear edge), specifying
2006 # axis of the cylinder to find shapes on.
2007 # @param thePnt Point specifying location of the bottom of the cylinder.
2008 # @param theRadius Radius of the cylinder to find shapes on.
2009 # @param theState The state of the subshapes to find. It can be one of
2010 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2011 # @return List of all found sub-shapes.
2013 # @ref swig_GetShapesOnCylinderWithLocation "Example"
2014 def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
2015 # Example: see GEOM_TestOthers.py
2016 aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
2017 RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
2020 ## Works like the above method, but returns list of sub-shapes indices
2022 # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
2023 def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
2024 # Example: see GEOM_TestOthers.py
2025 aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
2026 RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
2029 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
2030 # the specified sphere by the certain way, defined through \a theState parameter.
2031 # @param theShape Shape to find sub-shapes of.
2032 # @param theShapeType Type of sub-shapes to be retrieved.
2033 # @param theCenter Point, specifying center of the sphere to find shapes on.
2034 # @param theRadius Radius of the sphere to find shapes on.
2035 # @param theState The state of the subshapes to find. It can be one of
2036 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2037 # @return List of all found sub-shapes.
2039 # @ref swig_GetShapesOnSphere "Example"
2040 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
2041 # Example: see GEOM_TestOthers.py
2042 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
2043 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
2046 ## Works like the above method, but returns list of sub-shapes indices
2048 # @ref swig_GetShapesOnSphereIDs "Example"
2049 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
2050 # Example: see GEOM_TestOthers.py
2051 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
2052 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
2055 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
2056 # the specified quadrangle by the certain way, defined through \a theState parameter.
2057 # @param theShape Shape to find sub-shapes of.
2058 # @param theShapeType Type of sub-shapes to be retrieved.
2059 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
2060 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
2061 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
2062 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
2063 # @param theState The state of the subshapes to find. It can be one of
2064 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2065 # @return List of all found sub-shapes.
2067 # @ref swig_GetShapesOnQuadrangle "Example"
2068 def GetShapesOnQuadrangle(self, theShape, theShapeType,
2069 theTopLeftPoint, theTopRigthPoint,
2070 theBottomLeftPoint, theBottomRigthPoint, theState):
2071 # Example: see GEOM_TestOthers.py
2072 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
2073 theTopLeftPoint, theTopRigthPoint,
2074 theBottomLeftPoint, theBottomRigthPoint, theState)
2075 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
2078 ## Works like the above method, but returns list of sub-shapes indices
2080 # @ref swig_GetShapesOnQuadrangleIDs "Example"
2081 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
2082 theTopLeftPoint, theTopRigthPoint,
2083 theBottomLeftPoint, theBottomRigthPoint, theState):
2084 # Example: see GEOM_TestOthers.py
2085 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
2086 theTopLeftPoint, theTopRigthPoint,
2087 theBottomLeftPoint, theBottomRigthPoint, theState)
2088 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
2091 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
2092 # the specified \a theBox by the certain way, defined through \a theState parameter.
2093 # @param theBox Shape for relative comparing.
2094 # @param theShape Shape to find sub-shapes of.
2095 # @param theShapeType Type of sub-shapes to be retrieved.
2096 # @param theState The state of the subshapes to find. It can be one of
2097 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2098 # @return List of all found sub-shapes.
2100 # @ref swig_GetShapesOnBox "Example"
2101 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
2102 # Example: see GEOM_TestOthers.py
2103 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
2104 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
2107 ## Works like the above method, but returns list of sub-shapes indices
2109 # @ref swig_GetShapesOnBoxIDs "Example"
2110 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
2111 # Example: see GEOM_TestOthers.py
2112 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
2113 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
2116 ## Find in \a theShape all sub-shapes of type \a theShapeType,
2117 # situated relatively the specified \a theCheckShape by the
2118 # certain way, defined through \a theState parameter.
2119 # @param theCheckShape Shape for relative comparing. It must be a solid.
2120 # @param theShape Shape to find sub-shapes of.
2121 # @param theShapeType Type of sub-shapes to be retrieved.
2122 # @param theState The state of the subshapes to find. It can be one of
2123 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2124 # @return List of all found sub-shapes.
2126 # @ref swig_GetShapesOnShape "Example"
2127 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
2128 # Example: see GEOM_TestOthers.py
2129 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
2130 theShapeType, theState)
2131 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
2134 ## Works like the above method, but returns result as compound
2136 # @ref swig_GetShapesOnShapeAsCompound "Example"
2137 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
2138 # Example: see GEOM_TestOthers.py
2139 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
2140 theShapeType, theState)
2141 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
2144 ## Works like the above method, but returns list of sub-shapes indices
2146 # @ref swig_GetShapesOnShapeIDs "Example"
2147 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
2148 # Example: see GEOM_TestOthers.py
2149 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
2150 theShapeType, theState)
2151 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
2154 ## Get sub-shape(s) of theShapeWhere, which are
2155 # coincident with \a theShapeWhat or could be a part of it.
2156 # @param theShapeWhere Shape to find sub-shapes of.
2157 # @param theShapeWhat Shape, specifying what to find.
2158 # @return Group of all found sub-shapes or a single found sub-shape.
2160 # @note This function has a restriction on argument shapes.
2161 # If \a theShapeWhere has curved parts with significantly
2162 # outstanding centres (i.e. the mass centre of a part is closer to
2163 # \a theShapeWhat than to the part), such parts will not be found.
2164 # @image html get_in_place_lost_part.png
2166 # @ref swig_GetInPlace "Example"
2167 def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False):
2168 # Example: see GEOM_TestOthers.py
2170 if isNewImplementation:
2171 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
2173 anObj = self.ShapesOp.GetInPlaceOld(theShapeWhere, theShapeWhat)
2175 RaiseIfFailed("GetInPlace", self.ShapesOp)
2178 ## Get sub-shape(s) of \a theShapeWhere, which are
2179 # coincident with \a theShapeWhat or could be a part of it.
2181 # Implementation of this method is based on a saved history of an operation,
2182 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
2183 # arguments (an argument shape or a sub-shape of an argument shape).
2184 # The operation could be the Partition or one of boolean operations,
2185 # performed on simple shapes (not on compounds).
2187 # @param theShapeWhere Shape to find sub-shapes of.
2188 # @param theShapeWhat Shape, specifying what to find (must be in the
2189 # building history of the ShapeWhere).
2190 # @return Group of all found sub-shapes or a single found sub-shape.
2192 # @ref swig_GetInPlace "Example"
2193 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
2194 # Example: see GEOM_TestOthers.py
2195 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
2196 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
2199 ## Get sub-shape of theShapeWhere, which is
2200 # equal to \a theShapeWhat.
2201 # @param theShapeWhere Shape to find sub-shape of.
2202 # @param theShapeWhat Shape, specifying what to find.
2203 # @return New GEOM_Object for found sub-shape.
2205 # @ref swig_GetSame "Example"
2206 def GetSame(self,theShapeWhere, theShapeWhat):
2207 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
2208 RaiseIfFailed("GetSame", self.ShapesOp)
2214 ## @addtogroup l4_access
2217 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
2218 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
2220 # @ref swig_all_decompose "Example"
2221 def GetSubShape(self, aShape, ListOfID):
2222 # Example: see GEOM_TestAll.py
2223 anObj = self.AddSubShape(aShape,ListOfID)
2226 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
2228 # @ref swig_all_decompose "Example"
2229 def GetSubShapeID(self, aShape, aSubShape):
2230 # Example: see GEOM_TestAll.py
2231 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
2232 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
2238 ## @addtogroup l4_decompose
2241 ## Get all sub-shapes and groups of \a theShape,
2242 # that were created already by any other methods.
2243 # @param theShape Any shape.
2244 # @param theGroupsOnly If this parameter is TRUE, only groups will be
2245 # returned, else all found sub-shapes and groups.
2246 # @return List of existing sub-objects of \a theShape.
2248 # @ref swig_all_decompose "Example"
2249 def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
2250 # Example: see GEOM_TestAll.py
2251 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
2252 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
2255 ## Get all groups of \a theShape,
2256 # that were created already by any other methods.
2257 # @param theShape Any shape.
2258 # @return List of existing groups of \a theShape.
2260 # @ref swig_all_decompose "Example"
2261 def GetGroups(self, theShape):
2262 # Example: see GEOM_TestAll.py
2263 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
2264 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
2267 ## Explode a shape on subshapes of a given type.
2268 # If the shape itself matches the type, it is also returned.
2269 # @param aShape Shape to be exploded.
2270 # @param aType Type of sub-shapes to be retrieved.
2271 # @return List of sub-shapes of type theShapeType, contained in theShape.
2273 # @ref swig_all_decompose "Example"
2274 def SubShapeAll(self, aShape, aType):
2275 # Example: see GEOM_TestAll.py
2276 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, False)
2277 RaiseIfFailed("SubShapeAll", self.ShapesOp)
2280 ## Explode a shape on subshapes of a given type.
2281 # @param aShape Shape to be exploded.
2282 # @param aType Type of sub-shapes to be retrieved.
2283 # @return List of IDs of sub-shapes.
2285 # @ref swig_all_decompose "Example"
2286 def SubShapeAllIDs(self, aShape, aType):
2287 ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, False)
2288 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2291 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2292 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
2293 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2295 # @ref swig_all_decompose "Example"
2296 def SubShape(self, aShape, aType, ListOfInd):
2297 # Example: see GEOM_TestAll.py
2299 AllShapeIDsList = self.SubShapeAllIDs(aShape, aType)
2300 for ind in ListOfInd:
2301 ListOfIDs.append(AllShapeIDsList[ind - 1])
2302 anObj = self.GetSubShape(aShape, ListOfIDs)
2305 ## Explode a shape on subshapes of a given type.
2306 # Sub-shapes will be sorted by coordinates of their gravity centers.
2307 # If the shape itself matches the type, it is also returned.
2308 # @param aShape Shape to be exploded.
2309 # @param aType Type of sub-shapes to be retrieved.
2310 # @return List of sub-shapes of type theShapeType, contained in theShape.
2312 # @ref swig_SubShapeAllSorted "Example"
2313 def SubShapeAllSortedCentres(self, aShape, aType):
2314 # Example: see GEOM_TestAll.py
2315 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, True)
2316 RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
2319 ## Explode a shape on subshapes of a given type.
2320 # Sub-shapes will be sorted by coordinates of their gravity centers.
2321 # @param aShape Shape to be exploded.
2322 # @param aType Type of sub-shapes to be retrieved.
2323 # @return List of IDs of sub-shapes.
2325 # @ref swig_all_decompose "Example"
2326 def SubShapeAllSortedCentresIDs(self, aShape, aType):
2327 ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, True)
2328 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2331 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2332 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
2333 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2335 # @ref swig_all_decompose "Example"
2336 def SubShapeSortedCentres(self, aShape, aType, ListOfInd):
2337 # Example: see GEOM_TestAll.py
2339 AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, aType)
2340 for ind in ListOfInd:
2341 ListOfIDs.append(AllShapeIDsList[ind - 1])
2342 anObj = self.GetSubShape(aShape, ListOfIDs)
2345 ## Extract shapes (excluding the main shape) of given type.
2346 # @param aShape The shape.
2347 # @param aType The shape type.
2348 # @param isSorted Boolean flag to switch sorting on/off.
2349 # @return List of sub-shapes of type aType, contained in aShape.
2351 # @ref swig_FilletChamfer "Example"
2352 def ExtractShapes(self, aShape, aType, isSorted = False):
2353 # Example: see GEOM_TestAll.py
2354 ListObj = self.ShapesOp.ExtractSubShapes(aShape, aType, isSorted)
2355 RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
2358 ## Get a set of sub shapes defined by their unique IDs inside <VAR>theMainShape</VAR>
2359 # @param theMainShape Main shape.
2360 # @param theIndices List of unique IDs of sub shapes inside <VAR>theMainShape</VAR>.
2361 # @return List of GEOM_Objects, corresponding to found sub shapes.
2363 # @ref swig_all_decompose "Example"
2364 def SubShapes(self, aShape, anIDs):
2365 # Example: see GEOM_TestAll.py
2366 ListObj = self.ShapesOp.MakeSubShapes(aShape, anIDs)
2367 RaiseIfFailed("SubShapes", self.ShapesOp)
2370 # end of l4_decompose
2373 ## @addtogroup l4_decompose_d
2376 ## Deprecated method
2377 # It works like SubShapeAllSortedCentres, but wrongly
2378 # defines centres of faces, shells and solids.
2379 def SubShapeAllSorted(self, aShape, aType):
2380 ListObj = self.ShapesOp.MakeExplode(aShape, aType, True)
2381 RaiseIfFailed("MakeExplode", self.ShapesOp)
2384 ## Deprecated method
2385 # It works like SubShapeAllSortedCentresIDs, but wrongly
2386 # defines centres of faces, shells and solids.
2387 def SubShapeAllSortedIDs(self, aShape, aType):
2388 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, aType, True)
2389 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2392 ## Deprecated method
2393 # It works like SubShapeSortedCentres, but has a bug
2394 # (wrongly defines centres of faces, shells and solids).
2395 def SubShapeSorted(self, aShape, aType, ListOfInd):
2397 AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, aType)
2398 for ind in ListOfInd:
2399 ListOfIDs.append(AllShapeIDsList[ind - 1])
2400 anObj = self.GetSubShape(aShape, ListOfIDs)
2403 # end of l4_decompose_d
2406 ## @addtogroup l3_healing
2409 ## Apply a sequence of Shape Healing operators to the given object.
2410 # @param theShape Shape to be processed.
2411 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
2412 # @param theParameters List of names of parameters
2413 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
2414 # @param theValues List of values of parameters, in the same order
2415 # as parameters are listed in <VAR>theParameters</VAR> list.
2416 # @return New GEOM_Object, containing processed shape.
2418 # @ref tui_shape_processing "Example"
2419 def ProcessShape(self, theShape, theOperators, theParameters, theValues):
2420 # Example: see GEOM_TestHealing.py
2421 theValues,Parameters = ParseList(theValues)
2422 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
2423 # To avoid script failure in case of good argument shape
2424 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
2426 RaiseIfFailed("ProcessShape", self.HealOp)
2427 for string in (theOperators + theParameters):
2428 Parameters = ":" + Parameters
2430 anObj.SetParameters(Parameters)
2433 ## Remove faces from the given object (shape).
2434 # @param theObject Shape to be processed.
2435 # @param theFaces Indices of faces to be removed, if EMPTY then the method
2436 # removes ALL faces of the given object.
2437 # @return New GEOM_Object, containing processed shape.
2439 # @ref tui_suppress_faces "Example"
2440 def SuppressFaces(self,theObject, theFaces):
2441 # Example: see GEOM_TestHealing.py
2442 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
2443 RaiseIfFailed("SuppressFaces", self.HealOp)
2446 ## Sewing of some shapes into single shape.
2448 # @ref tui_sewing "Example"
2449 def MakeSewing(self, ListShape, theTolerance):
2450 # Example: see GEOM_TestHealing.py
2451 comp = self.MakeCompound(ListShape)
2452 anObj = self.Sew(comp, theTolerance)
2455 ## Sewing of the given object.
2456 # @param theObject Shape to be processed.
2457 # @param theTolerance Required tolerance value.
2458 # @return New GEOM_Object, containing processed shape.
2459 def Sew(self, theObject, theTolerance):
2460 # Example: see MakeSewing() above
2461 theTolerance,Parameters = ParseParameters(theTolerance)
2462 anObj = self.HealOp.Sew(theObject, theTolerance)
2463 RaiseIfFailed("Sew", self.HealOp)
2464 anObj.SetParameters(Parameters)
2467 ## Remove internal wires and edges from the given object (face).
2468 # @param theObject Shape to be processed.
2469 # @param theWires Indices of wires to be removed, if EMPTY then the method
2470 # removes ALL internal wires of the given object.
2471 # @return New GEOM_Object, containing processed shape.
2473 # @ref tui_suppress_internal_wires "Example"
2474 def SuppressInternalWires(self,theObject, theWires):
2475 # Example: see GEOM_TestHealing.py
2476 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
2477 RaiseIfFailed("RemoveIntWires", self.HealOp)
2480 ## Remove internal closed contours (holes) from the given object.
2481 # @param theObject Shape to be processed.
2482 # @param theWires Indices of wires to be removed, if EMPTY then the method
2483 # removes ALL internal holes of the given object
2484 # @return New GEOM_Object, containing processed shape.
2486 # @ref tui_suppress_holes "Example"
2487 def SuppressHoles(self,theObject, theWires):
2488 # Example: see GEOM_TestHealing.py
2489 anObj = self.HealOp.FillHoles(theObject, theWires)
2490 RaiseIfFailed("FillHoles", self.HealOp)
2493 ## Close an open wire.
2494 # @param theObject Shape to be processed.
2495 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
2496 # if [ ], then <VAR>theObject</VAR> itself is a wire.
2497 # @param isCommonVertex If True : closure by creation of a common vertex,
2498 # If False : closure by creation of an edge between ends.
2499 # @return New GEOM_Object, containing processed shape.
2501 # @ref tui_close_contour "Example"
2502 def CloseContour(self,theObject, theWires, isCommonVertex):
2503 # Example: see GEOM_TestHealing.py
2504 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
2505 RaiseIfFailed("CloseContour", self.HealOp)
2508 ## Addition of a point to a given edge object.
2509 # @param theObject Shape to be processed.
2510 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
2511 # if -1, then theObject itself is the edge.
2512 # @param theValue Value of parameter on edge or length parameter,
2513 # depending on \a isByParameter.
2514 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
2515 # if FALSE : \a theValue is treated as a length parameter [0..1]
2516 # @return New GEOM_Object, containing processed shape.
2518 # @ref tui_add_point_on_edge "Example"
2519 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
2520 # Example: see GEOM_TestHealing.py
2521 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
2522 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
2523 RaiseIfFailed("DivideEdge", self.HealOp)
2524 anObj.SetParameters(Parameters)
2527 ## Change orientation of the given object. Updates given shape.
2528 # @param theObject Shape to be processed.
2530 # @ref swig_todo "Example"
2531 def ChangeOrientationShell(self,theObject):
2532 theObject = self.HealOp.ChangeOrientation(theObject)
2533 RaiseIfFailed("ChangeOrientation", self.HealOp)
2536 ## Change orientation of the given object.
2537 # @param theObject Shape to be processed.
2538 # @return New GEOM_Object, containing processed shape.
2540 # @ref swig_todo "Example"
2541 def ChangeOrientationShellCopy(self, theObject):
2542 anObj = self.HealOp.ChangeOrientationCopy(theObject)
2543 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
2546 ## Try to limit tolerance of the given object by value \a theTolerance.
2547 # @param theObject Shape to be processed.
2548 # @param theTolerance Required tolerance value.
2549 # @return New GEOM_Object, containing processed shape.
2551 # @ref tui_limit_tolerance "Example"
2552 def LimitTolerance(self, theObject, theTolerance = 1e-07):
2553 anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
2554 RaiseIfFailed("LimitTolerance", self.HealOp)
2557 ## Get a list of wires (wrapped in GEOM_Object-s),
2558 # that constitute a free boundary of the given shape.
2559 # @param theObject Shape to get free boundary of.
2560 # @return [status, theClosedWires, theOpenWires]
2561 # status: FALSE, if an error(s) occured during the method execution.
2562 # theClosedWires: Closed wires on the free boundary of the given shape.
2563 # theOpenWires: Open wires on the free boundary of the given shape.
2565 # @ref tui_measurement_tools_page "Example"
2566 def GetFreeBoundary(self, theObject):
2567 # Example: see GEOM_TestHealing.py
2568 anObj = self.HealOp.GetFreeBoundary(theObject)
2569 RaiseIfFailed("GetFreeBoundary", self.HealOp)
2572 ## Replace coincident faces in theShape by one face.
2573 # @param theShape Initial shape.
2574 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
2575 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2576 # otherwise all initial shapes.
2577 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
2579 # @ref tui_glue_faces "Example"
2580 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
2581 # Example: see GEOM_Spanner.py
2582 theTolerance,Parameters = ParseParameters(theTolerance)
2583 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
2585 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
2586 anObj.SetParameters(Parameters)
2589 ## Find coincident faces in theShape for possible gluing.
2590 # @param theShape Initial shape.
2591 # @param theTolerance Maximum distance between faces,
2592 # which can be considered as coincident.
2595 # @ref tui_glue_faces "Example"
2596 def GetGlueFaces(self, theShape, theTolerance):
2597 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
2598 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
2601 ## Replace coincident faces in theShape by one face
2602 # in compliance with given list of faces
2603 # @param theShape Initial shape.
2604 # @param theTolerance Maximum distance between faces,
2605 # which can be considered as coincident.
2606 # @param theFaces List of faces for gluing.
2607 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2608 # otherwise all initial shapes.
2609 # @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
2610 # will be glued, otherwise only the edges,
2611 # belonging to <VAR>theFaces</VAR>.
2612 # @return New GEOM_Object, containing a copy of theShape
2613 # without some faces.
2615 # @ref tui_glue_faces "Example"
2616 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces,
2617 doKeepNonSolids=True, doGlueAllEdges=True):
2618 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces,
2619 doKeepNonSolids, doGlueAllEdges)
2621 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
2624 ## Replace coincident edges in theShape by one edge.
2625 # @param theShape Initial shape.
2626 # @param theTolerance Maximum distance between edges, which can be considered as coincident.
2627 # @return New GEOM_Object, containing a copy of theShape without coincident edges.
2629 # @ref tui_glue_edges "Example"
2630 def MakeGlueEdges(self, theShape, theTolerance):
2631 theTolerance,Parameters = ParseParameters(theTolerance)
2632 anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance)
2634 raise RuntimeError, "MakeGlueEdges : " + self.ShapesOp.GetErrorCode()
2635 anObj.SetParameters(Parameters)
2638 ## Find coincident edges in theShape for possible gluing.
2639 # @param theShape Initial shape.
2640 # @param theTolerance Maximum distance between edges,
2641 # which can be considered as coincident.
2644 # @ref tui_glue_edges "Example"
2645 def GetGlueEdges(self, theShape, theTolerance):
2646 anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
2647 RaiseIfFailed("GetGlueEdges", self.ShapesOp)
2650 ## Replace coincident edges in theShape by one edge
2651 # in compliance with given list of edges
2652 # @param theShape Initial shape.
2653 # @param theTolerance Maximum distance between edges,
2654 # which can be considered as coincident.
2655 # @param theFaces List of edges for gluing.
2656 # @return New GEOM_Object, containing a copy of theShape
2657 # without some edges.
2659 # @ref tui_glue_edges "Example"
2660 def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges):
2661 anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
2663 raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()
2669 ## @addtogroup l3_boolean Boolean Operations
2672 # -----------------------------------------------------------------------------
2673 # Boolean (Common, Cut, Fuse, Section)
2674 # -----------------------------------------------------------------------------
2676 ## Perform one of boolean operations on two given shapes.
2677 # @param theShape1 First argument for boolean operation.
2678 # @param theShape2 Second argument for boolean operation.
2679 # @param theOperation Indicates the operation to be done:
2680 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
2681 # @return New GEOM_Object, containing the result shape.
2683 # @ref tui_fuse "Example"
2684 def MakeBoolean(self,theShape1, theShape2, theOperation):
2685 # Example: see GEOM_TestAll.py
2686 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
2687 RaiseIfFailed("MakeBoolean", self.BoolOp)
2690 ## Shortcut to MakeBoolean(s1, s2, 1)
2692 # @ref tui_common "Example 1"
2693 # \n @ref swig_MakeCommon "Example 2"
2694 def MakeCommon(self, s1, s2):
2695 # Example: see GEOM_TestOthers.py
2696 return self.MakeBoolean(s1, s2, 1)
2698 ## Shortcut to MakeBoolean(s1, s2, 2)
2700 # @ref tui_cut "Example 1"
2701 # \n @ref swig_MakeCommon "Example 2"
2702 def MakeCut(self, s1, s2):
2703 # Example: see GEOM_TestOthers.py
2704 return self.MakeBoolean(s1, s2, 2)
2706 ## Shortcut to MakeBoolean(s1, s2, 3)
2708 # @ref tui_fuse "Example 1"
2709 # \n @ref swig_MakeCommon "Example 2"
2710 def MakeFuse(self, s1, s2):
2711 # Example: see GEOM_TestOthers.py
2712 return self.MakeBoolean(s1, s2, 3)
2714 ## Shortcut to MakeBoolean(s1, s2, 4)
2716 # @ref tui_section "Example 1"
2717 # \n @ref swig_MakeCommon "Example 2"
2718 def MakeSection(self, s1, s2):
2719 # Example: see GEOM_TestOthers.py
2720 return self.MakeBoolean(s1, s2, 4)
2725 ## @addtogroup l3_basic_op
2728 ## Perform partition operation.
2729 # @param ListShapes Shapes to be intersected.
2730 # @param ListTools Shapes to intersect theShapes.
2731 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
2732 # in order to avoid possible intersection between shapes from
2734 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
2735 # If this parameter is set to -1 ("Auto"), most appropriate shape limit
2736 # type will be detected automatically.
2737 # @param KeepNonlimitShapes: if this parameter == 0, then only shapes of
2738 # target type (equal to Limit) are kept in the result,
2739 # else standalone shapes of lower dimension
2740 # are kept also (if they exist).
2742 # After implementation new version of PartitionAlgo (October 2006)
2743 # other parameters are ignored by current functionality. They are kept
2744 # in this function only for support old versions.
2745 # Ignored parameters:
2746 # @param ListKeepInside Shapes, outside which the results will be deleted.
2747 # Each shape from theKeepInside must belong to theShapes also.
2748 # @param ListRemoveInside Shapes, inside which the results will be deleted.
2749 # Each shape from theRemoveInside must belong to theShapes also.
2750 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
2751 # @param ListMaterials Material indices for each shape. Make sence,
2752 # only if theRemoveWebs is TRUE.
2754 # @return New GEOM_Object, containing the result shapes.
2756 # @ref tui_partition "Example"
2757 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2758 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
2759 KeepNonlimitShapes=0):
2760 # Example: see GEOM_TestAll.py
2761 if Limit == ShapeType["AUTO"]:
2762 # automatic detection of the most appropriate shape limit type
2764 for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
2765 Limit = EnumToLong(lim)
2767 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
2768 ListKeepInside, ListRemoveInside,
2769 Limit, RemoveWebs, ListMaterials,
2770 KeepNonlimitShapes);
2771 RaiseIfFailed("MakePartition", self.BoolOp)
2774 ## Perform partition operation.
2775 # This method may be useful if it is needed to make a partition for
2776 # compound contains nonintersected shapes. Performance will be better
2777 # since intersection between shapes from compound is not performed.
2779 # Description of all parameters as in previous method MakePartition()
2781 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
2782 # have to consist of nonintersecting shapes.
2784 # @return New GEOM_Object, containing the result shapes.
2786 # @ref swig_todo "Example"
2787 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
2788 ListKeepInside=[], ListRemoveInside=[],
2789 Limit=ShapeType["AUTO"], RemoveWebs=0,
2790 ListMaterials=[], KeepNonlimitShapes=0):
2791 if Limit == ShapeType["AUTO"]:
2792 # automatic detection of the most appropriate shape limit type
2794 for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
2795 Limit = EnumToLong(lim)
2797 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
2798 ListKeepInside, ListRemoveInside,
2799 Limit, RemoveWebs, ListMaterials,
2800 KeepNonlimitShapes);
2801 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
2804 ## Shortcut to MakePartition()
2806 # @ref tui_partition "Example 1"
2807 # \n @ref swig_Partition "Example 2"
2808 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2809 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
2810 KeepNonlimitShapes=0):
2811 # Example: see GEOM_TestOthers.py
2812 anObj = self.MakePartition(ListShapes, ListTools,
2813 ListKeepInside, ListRemoveInside,
2814 Limit, RemoveWebs, ListMaterials,
2815 KeepNonlimitShapes);
2818 ## Perform partition of the Shape with the Plane
2819 # @param theShape Shape to be intersected.
2820 # @param thePlane Tool shape, to intersect theShape.
2821 # @return New GEOM_Object, containing the result shape.
2823 # @ref tui_partition "Example"
2824 def MakeHalfPartition(self,theShape, thePlane):
2825 # Example: see GEOM_TestAll.py
2826 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
2827 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
2830 # end of l3_basic_op
2833 ## @addtogroup l3_transform
2836 ## Translate the given object along the vector, specified
2837 # by its end points, creating its copy before the translation.
2838 # @param theObject The object to be translated.
2839 # @param thePoint1 Start point of translation vector.
2840 # @param thePoint2 End point of translation vector.
2841 # @return New GEOM_Object, containing the translated object.
2843 # @ref tui_translation "Example 1"
2844 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
2845 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
2846 # Example: see GEOM_TestAll.py
2847 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
2848 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
2851 ## Translate the given object along the vector, specified by its components.
2852 # @param theObject The object to be translated.
2853 # @param theDX,theDY,theDZ Components of translation vector.
2854 # @return Translated GEOM_Object.
2856 # @ref tui_translation "Example"
2857 def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ):
2858 # Example: see GEOM_TestAll.py
2859 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2860 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
2861 anObj.SetParameters(Parameters)
2862 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2865 ## Translate the given object along the vector, specified
2866 # by its components, creating its copy before the translation.
2867 # @param theObject The object to be translated.
2868 # @param theDX,theDY,theDZ Components of translation vector.
2869 # @return New GEOM_Object, containing the translated object.
2871 # @ref tui_translation "Example"
2872 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
2873 # Example: see GEOM_TestAll.py
2874 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2875 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
2876 anObj.SetParameters(Parameters)
2877 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2880 ## Translate the given object along the given vector,
2881 # creating its copy before the translation.
2882 # @param theObject The object to be translated.
2883 # @param theVector The translation vector.
2884 # @return New GEOM_Object, containing the translated object.
2886 # @ref tui_translation "Example"
2887 def MakeTranslationVector(self,theObject, theVector):
2888 # Example: see GEOM_TestAll.py
2889 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
2890 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
2893 ## Translate the given object along the given vector on given distance.
2894 # @param theObject The object to be translated.
2895 # @param theVector The translation vector.
2896 # @param theDistance The translation distance.
2897 # @param theCopy Flag used to translate object itself or create a copy.
2898 # @return Translated GEOM_Object.
2900 # @ref tui_translation "Example"
2901 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy):
2902 # Example: see GEOM_TestAll.py
2903 theDistance,Parameters = ParseParameters(theDistance)
2904 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
2905 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2906 anObj.SetParameters(Parameters)
2909 ## Translate the given object along the given vector on given distance,
2910 # creating its copy before the translation.
2911 # @param theObject The object to be translated.
2912 # @param theVector The translation vector.
2913 # @param theDistance The translation distance.
2914 # @return New GEOM_Object, containing the translated object.
2916 # @ref tui_translation "Example"
2917 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
2918 # Example: see GEOM_TestAll.py
2919 theDistance,Parameters = ParseParameters(theDistance)
2920 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
2921 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2922 anObj.SetParameters(Parameters)
2925 ## Rotate the given object around the given axis on the given angle.
2926 # @param theObject The object to be rotated.
2927 # @param theAxis Rotation axis.
2928 # @param theAngle Rotation angle in radians.
2929 # @return Rotated GEOM_Object.
2931 # @ref tui_rotation "Example"
2932 def Rotate(self,theObject, theAxis, theAngle):
2933 # Example: see GEOM_TestAll.py
2935 if isinstance(theAngle,str):
2937 theAngle, Parameters = ParseParameters(theAngle)
2939 theAngle = theAngle*math.pi/180.0
2940 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
2941 RaiseIfFailed("RotateCopy", self.TrsfOp)
2942 anObj.SetParameters(Parameters)
2945 ## Rotate the given object around the given axis
2946 # on the given angle, creating its copy before the rotatation.
2947 # @param theObject The object to be rotated.
2948 # @param theAxis Rotation axis.
2949 # @param theAngle Rotation angle in radians.
2950 # @return New GEOM_Object, containing the rotated object.
2952 # @ref tui_rotation "Example"
2953 def MakeRotation(self,theObject, theAxis, theAngle):
2954 # Example: see GEOM_TestAll.py
2956 if isinstance(theAngle,str):
2958 theAngle, Parameters = ParseParameters(theAngle)
2960 theAngle = theAngle*math.pi/180.0
2961 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
2962 RaiseIfFailed("RotateCopy", self.TrsfOp)
2963 anObj.SetParameters(Parameters)
2966 ## Rotate given object around vector perpendicular to plane
2967 # containing three points, creating its copy before the rotatation.
2968 # @param theObject The object to be rotated.
2969 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
2970 # containing the three points.
2971 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
2972 # @return New GEOM_Object, containing the rotated object.
2974 # @ref tui_rotation "Example"
2975 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
2976 # Example: see GEOM_TestAll.py
2977 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
2978 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
2981 ## Scale the given object by the factor, creating its copy before the scaling.
2982 # @param theObject The object to be scaled.
2983 # @param thePoint Center point for scaling.
2984 # Passing None for it means scaling relatively the origin of global CS.
2985 # @param theFactor Scaling factor value.
2986 # @return New GEOM_Object, containing the scaled shape.
2988 # @ref tui_scale "Example"
2989 def MakeScaleTransform(self, theObject, thePoint, theFactor):
2990 # Example: see GEOM_TestAll.py
2991 theFactor, Parameters = ParseParameters(theFactor)
2992 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
2993 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
2994 anObj.SetParameters(Parameters)
2997 ## Scale the given object by different factors along coordinate axes,
2998 # creating its copy before the scaling.
2999 # @param theObject The object to be scaled.
3000 # @param thePoint Center point for scaling.
3001 # Passing None for it means scaling relatively the origin of global CS.
3002 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
3003 # @return New GEOM_Object, containing the scaled shape.
3005 # @ref swig_scale "Example"
3006 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
3007 # Example: see GEOM_TestAll.py
3008 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
3009 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
3010 theFactorX, theFactorY, theFactorZ)
3011 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
3012 anObj.SetParameters(Parameters)
3015 ## Create an object, symmetrical
3016 # to the given one relatively the given plane.
3017 # @param theObject The object to be mirrored.
3018 # @param thePlane Plane of symmetry.
3019 # @return New GEOM_Object, containing the mirrored shape.
3021 # @ref tui_mirror "Example"
3022 def MakeMirrorByPlane(self,theObject, thePlane):
3023 # Example: see GEOM_TestAll.py
3024 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
3025 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
3028 ## Create an object, symmetrical
3029 # to the given one relatively the given axis.
3030 # @param theObject The object to be mirrored.
3031 # @param theAxis Axis of symmetry.
3032 # @return New GEOM_Object, containing the mirrored shape.
3034 # @ref tui_mirror "Example"
3035 def MakeMirrorByAxis(self,theObject, theAxis):
3036 # Example: see GEOM_TestAll.py
3037 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
3038 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
3041 ## Create an object, symmetrical
3042 # to the given one relatively the given point.
3043 # @param theObject The object to be mirrored.
3044 # @param thePoint Point of symmetry.
3045 # @return New GEOM_Object, containing the mirrored shape.
3047 # @ref tui_mirror "Example"
3048 def MakeMirrorByPoint(self,theObject, thePoint):
3049 # Example: see GEOM_TestAll.py
3050 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
3051 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
3054 ## Modify the Location of the given object by LCS,
3055 # creating its copy before the setting.
3056 # @param theObject The object to be displaced.
3057 # @param theStartLCS Coordinate system to perform displacement from it.
3058 # If \a theStartLCS is NULL, displacement
3059 # will be performed from global CS.
3060 # If \a theObject itself is used as \a theStartLCS,
3061 # its location will be changed to \a theEndLCS.
3062 # @param theEndLCS Coordinate system to perform displacement to it.
3063 # @return New GEOM_Object, containing the displaced shape.
3065 # @ref tui_modify_location "Example"
3066 def MakePosition(self,theObject, theStartLCS, theEndLCS):
3067 # Example: see GEOM_TestAll.py
3068 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
3069 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
3072 ## Modify the Location of the given object by Path,
3073 # @param theObject The object to be displaced.
3074 # @param thePath Wire or Edge along that the object will be translated.
3075 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
3076 # @param theCopy is to create a copy objects if true.
3077 # @param theReverse - 0 for usual direction, 1 to reverse path direction.
3078 # @return New GEOM_Object, containing the displaced shape.
3080 # @ref tui_modify_location "Example"
3081 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
3082 # Example: see GEOM_TestAll.py
3083 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
3084 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
3087 ## Create new object as offset of the given one.
3088 # @param theObject The base object for the offset.
3089 # @param theOffset Offset value.
3090 # @return New GEOM_Object, containing the offset object.
3092 # @ref tui_offset "Example"
3093 def MakeOffset(self,theObject, theOffset):
3094 # Example: see GEOM_TestAll.py
3095 theOffset, Parameters = ParseParameters(theOffset)
3096 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
3097 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
3098 anObj.SetParameters(Parameters)
3101 ## Create new object as projection of the given one on a 2D surface.
3102 # @param theSource The source object for the projection. It can be a point, edge or wire.
3103 # @param theTarget The target object. It can be planar or cylindrical face.
3104 # @return New GEOM_Object, containing the projection.
3106 # @ref tui_projection "Example"
3107 def MakeProjection(self, theSource, theTarget):
3108 # Example: see GEOM_TestAll.py
3109 anObj = self.TrsfOp.ProjectShapeCopy(theSource, theTarget)
3110 RaiseIfFailed("ProjectShapeCopy", self.TrsfOp)
3113 # -----------------------------------------------------------------------------
3115 # -----------------------------------------------------------------------------
3117 ## Translate the given object along the given vector a given number times
3118 # @param theObject The object to be translated.
3119 # @param theVector Direction of the translation.
3120 # @param theStep Distance to translate on.
3121 # @param theNbTimes Quantity of translations to be done.
3122 # @return New GEOM_Object, containing compound of all
3123 # the shapes, obtained after each translation.
3125 # @ref tui_multi_translation "Example"
3126 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
3127 # Example: see GEOM_TestAll.py
3128 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
3129 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
3130 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
3131 anObj.SetParameters(Parameters)
3134 ## Conseqently apply two specified translations to theObject specified number of times.
3135 # @param theObject The object to be translated.
3136 # @param theVector1 Direction of the first translation.
3137 # @param theStep1 Step of the first translation.
3138 # @param theNbTimes1 Quantity of translations to be done along theVector1.
3139 # @param theVector2 Direction of the second translation.
3140 # @param theStep2 Step of the second translation.
3141 # @param theNbTimes2 Quantity of translations to be done along theVector2.
3142 # @return New GEOM_Object, containing compound of all
3143 # the shapes, obtained after each translation.
3145 # @ref tui_multi_translation "Example"
3146 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
3147 theVector2, theStep2, theNbTimes2):
3148 # Example: see GEOM_TestAll.py
3149 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
3150 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
3151 theVector2, theStep2, theNbTimes2)
3152 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
3153 anObj.SetParameters(Parameters)
3156 ## Rotate the given object around the given axis a given number times.
3157 # Rotation angle will be 2*PI/theNbTimes.
3158 # @param theObject The object to be rotated.
3159 # @param theAxis The rotation axis.
3160 # @param theNbTimes Quantity of rotations to be done.
3161 # @return New GEOM_Object, containing compound of all the
3162 # shapes, obtained after each rotation.
3164 # @ref tui_multi_rotation "Example"
3165 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
3166 # Example: see GEOM_TestAll.py
3167 theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
3168 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
3169 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
3170 anObj.SetParameters(Parameters)
3173 ## Rotate the given object around the
3174 # given axis on the given angle a given number
3175 # times and multi-translate each rotation result.
3176 # Translation direction passes through center of gravity
3177 # of rotated shape and its projection on the rotation axis.
3178 # @param theObject The object to be rotated.
3179 # @param theAxis Rotation axis.
3180 # @param theAngle Rotation angle in graduces.
3181 # @param theNbTimes1 Quantity of rotations to be done.
3182 # @param theStep Translation distance.
3183 # @param theNbTimes2 Quantity of translations to be done.
3184 # @return New GEOM_Object, containing compound of all the
3185 # shapes, obtained after each transformation.
3187 # @ref tui_multi_rotation "Example"
3188 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
3189 # Example: see GEOM_TestAll.py
3190 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
3191 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
3192 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
3193 anObj.SetParameters(Parameters)
3196 ## The same, as MultiRotate1D(), but axis is given by direction and point
3197 # @ref swig_MakeMultiRotation "Example"
3198 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
3199 # Example: see GEOM_TestOthers.py
3200 aVec = self.MakeLine(aPoint,aDir)
3201 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
3204 ## The same, as MultiRotate2D(), but axis is given by direction and point
3205 # @ref swig_MakeMultiRotation "Example"
3206 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
3207 # Example: see GEOM_TestOthers.py
3208 aVec = self.MakeLine(aPoint,aDir)
3209 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
3212 # end of l3_transform
3215 ## @addtogroup l3_local
3218 ## Perform a fillet on all edges of the given shape.
3219 # @param theShape Shape, to perform fillet on.
3220 # @param theR Fillet radius.
3221 # @return New GEOM_Object, containing the result shape.
3223 # @ref tui_fillet "Example 1"
3224 # \n @ref swig_MakeFilletAll "Example 2"
3225 def MakeFilletAll(self,theShape, theR):
3226 # Example: see GEOM_TestOthers.py
3227 theR,Parameters = ParseParameters(theR)
3228 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
3229 RaiseIfFailed("MakeFilletAll", self.LocalOp)
3230 anObj.SetParameters(Parameters)
3233 ## Perform a fillet on the specified edges/faces of the given shape
3234 # @param theShape Shape, to perform fillet on.
3235 # @param theR Fillet radius.
3236 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
3237 # @param theListShapes Global indices of edges/faces to perform fillet on.
3238 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3239 # @return New GEOM_Object, containing the result shape.
3241 # @ref tui_fillet "Example"
3242 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
3243 # Example: see GEOM_TestAll.py
3244 theR,Parameters = ParseParameters(theR)
3246 if theShapeType == ShapeType["EDGE"]:
3247 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
3248 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
3250 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
3251 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
3252 anObj.SetParameters(Parameters)
3255 ## The same that MakeFillet but with two Fillet Radius R1 and R2
3256 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
3257 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
3259 if theShapeType == ShapeType["EDGE"]:
3260 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
3261 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
3263 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
3264 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
3265 anObj.SetParameters(Parameters)
3268 ## Perform a fillet on the specified edges of the given shape
3269 # @param theShape - Wire Shape to perform fillet on.
3270 # @param theR - Fillet radius.
3271 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
3272 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3273 # \note The list of vertices could be empty,
3274 # in this case fillet will done done at all vertices in wire
3275 # @return New GEOM_Object, containing the result shape.
3277 # @ref tui_fillet2d "Example"
3278 def MakeFillet1D(self,theShape, theR, theListOfVertexes):
3279 # Example: see GEOM_TestAll.py
3280 theR,Parameters = ParseParameters(theR)
3281 anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes)
3282 RaiseIfFailed("MakeFillet1D", self.LocalOp)
3283 anObj.SetParameters(Parameters)
3286 ## Perform a fillet on the specified edges/faces of the given shape
3287 # @param theShape - Face Shape to perform fillet on.
3288 # @param theR - Fillet radius.
3289 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
3290 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3291 # @return New GEOM_Object, containing the result shape.
3293 # @ref tui_fillet2d "Example"
3294 def MakeFillet2D(self,theShape, theR, theListOfVertexes):
3295 # Example: see GEOM_TestAll.py
3296 theR,Parameters = ParseParameters(theR)
3297 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
3298 RaiseIfFailed("MakeFillet2D", self.LocalOp)
3299 anObj.SetParameters(Parameters)
3302 ## Perform a symmetric chamfer on all edges of the given shape.
3303 # @param theShape Shape, to perform chamfer on.
3304 # @param theD Chamfer size along each face.
3305 # @return New GEOM_Object, containing the result shape.
3307 # @ref tui_chamfer "Example 1"
3308 # \n @ref swig_MakeChamferAll "Example 2"
3309 def MakeChamferAll(self,theShape, theD):
3310 # Example: see GEOM_TestOthers.py
3311 theD,Parameters = ParseParameters(theD)
3312 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
3313 RaiseIfFailed("MakeChamferAll", self.LocalOp)
3314 anObj.SetParameters(Parameters)
3317 ## Perform a chamfer on edges, common to the specified faces,
3318 # with distance D1 on the Face1
3319 # @param theShape Shape, to perform chamfer on.
3320 # @param theD1 Chamfer size along \a theFace1.
3321 # @param theD2 Chamfer size along \a theFace2.
3322 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
3323 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3324 # @return New GEOM_Object, containing the result shape.
3326 # @ref tui_chamfer "Example"
3327 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
3328 # Example: see GEOM_TestAll.py
3329 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3330 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
3331 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
3332 anObj.SetParameters(Parameters)
3335 ## The Same that MakeChamferEdge but with params theD is chamfer length and
3336 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3337 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
3339 if isinstance(theAngle,str):
3341 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3343 theAngle = theAngle*math.pi/180.0
3344 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
3345 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
3346 anObj.SetParameters(Parameters)
3349 ## Perform a chamfer on all edges of the specified faces,
3350 # with distance D1 on the first specified face (if several for one edge)
3351 # @param theShape Shape, to perform chamfer on.
3352 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
3353 # connected to the edge, are in \a theFaces, \a theD1
3354 # will be get along face, which is nearer to \a theFaces beginning.
3355 # @param theD2 Chamfer size along another of two faces, connected to the edge.
3356 # @param theFaces Sequence of global indices of faces of \a theShape.
3357 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3358 # @return New GEOM_Object, containing the result shape.
3360 # @ref tui_chamfer "Example"
3361 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
3362 # Example: see GEOM_TestAll.py
3363 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3364 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
3365 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
3366 anObj.SetParameters(Parameters)
3369 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
3370 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3372 # @ref swig_FilletChamfer "Example"
3373 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
3375 if isinstance(theAngle,str):
3377 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3379 theAngle = theAngle*math.pi/180.0
3380 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
3381 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
3382 anObj.SetParameters(Parameters)
3385 ## Perform a chamfer on edges,
3386 # with distance D1 on the first specified face (if several for one edge)
3387 # @param theShape Shape, to perform chamfer on.
3388 # @param theD1,theD2 Chamfer size
3389 # @param theEdges Sequence of edges of \a theShape.
3390 # @return New GEOM_Object, containing the result shape.
3392 # @ref swig_FilletChamfer "Example"
3393 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
3394 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3395 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
3396 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
3397 anObj.SetParameters(Parameters)
3400 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
3401 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3402 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
3404 if isinstance(theAngle,str):
3406 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3408 theAngle = theAngle*math.pi/180.0
3409 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
3410 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
3411 anObj.SetParameters(Parameters)
3414 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
3416 # @ref swig_MakeChamfer "Example"
3417 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
3418 # Example: see GEOM_TestOthers.py
3420 if aShapeType == ShapeType["EDGE"]:
3421 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
3423 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
3429 ## @addtogroup l3_basic_op
3432 ## Perform an Archimde operation on the given shape with given parameters.
3433 # The object presenting the resulting face is returned.
3434 # @param theShape Shape to be put in water.
3435 # @param theWeight Weight og the shape.
3436 # @param theWaterDensity Density of the water.
3437 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
3438 # @return New GEOM_Object, containing a section of \a theShape
3439 # by a plane, corresponding to water level.
3441 # @ref tui_archimede "Example"
3442 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
3443 # Example: see GEOM_TestAll.py
3444 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
3445 theWeight,theWaterDensity,theMeshDeflection)
3446 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
3447 RaiseIfFailed("MakeArchimede", self.LocalOp)
3448 anObj.SetParameters(Parameters)
3451 # end of l3_basic_op
3454 ## @addtogroup l2_measure
3457 ## Get point coordinates
3460 # @ref tui_measurement_tools_page "Example"
3461 def PointCoordinates(self,Point):
3462 # Example: see GEOM_TestMeasures.py
3463 aTuple = self.MeasuOp.PointCoordinates(Point)
3464 RaiseIfFailed("PointCoordinates", self.MeasuOp)
3467 ## Get summarized length of all wires,
3468 # area of surface and volume of the given shape.
3469 # @param theShape Shape to define properties of.
3470 # @return [theLength, theSurfArea, theVolume]
3471 # theLength: Summarized length of all wires of the given shape.
3472 # theSurfArea: Area of surface of the given shape.
3473 # theVolume: Volume of the given shape.
3475 # @ref tui_measurement_tools_page "Example"
3476 def BasicProperties(self,theShape):
3477 # Example: see GEOM_TestMeasures.py
3478 aTuple = self.MeasuOp.GetBasicProperties(theShape)
3479 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
3482 ## Get parameters of bounding box of the given shape
3483 # @param theShape Shape to obtain bounding box of.
3484 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
3485 # Xmin,Xmax: Limits of shape along OX axis.
3486 # Ymin,Ymax: Limits of shape along OY axis.
3487 # Zmin,Zmax: Limits of shape along OZ axis.
3489 # @ref tui_measurement_tools_page "Example"
3490 def BoundingBox(self,theShape):
3491 # Example: see GEOM_TestMeasures.py
3492 aTuple = self.MeasuOp.GetBoundingBox(theShape)
3493 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
3496 ## Get inertia matrix and moments of inertia of theShape.
3497 # @param theShape Shape to calculate inertia of.
3498 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
3499 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
3500 # Ix,Iy,Iz: Moments of inertia of the given shape.
3502 # @ref tui_measurement_tools_page "Example"
3503 def Inertia(self,theShape):
3504 # Example: see GEOM_TestMeasures.py
3505 aTuple = self.MeasuOp.GetInertia(theShape)
3506 RaiseIfFailed("GetInertia", self.MeasuOp)
3509 ## Get if coords are included in the shape (ST_IN or ST_ON)
3510 # @param theShape Shape
3511 # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
3512 # @param tolerance to be used (default is 1.0e-7)
3513 # @return list_of_boolean = [res1, res2, ...]
3514 def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
3515 return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
3517 ## Get minimal distance between the given shapes.
3518 # @param theShape1,theShape2 Shapes to find minimal distance between.
3519 # @return Value of the minimal distance between the given shapes.
3521 # @ref tui_measurement_tools_page "Example"
3522 def MinDistance(self, theShape1, theShape2):
3523 # Example: see GEOM_TestMeasures.py
3524 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
3525 RaiseIfFailed("GetMinDistance", self.MeasuOp)
3528 ## Get minimal distance between the given shapes.
3529 # @param theShape1,theShape2 Shapes to find minimal distance between.
3530 # @return Value of the minimal distance between the given shapes.
3532 # @ref swig_all_measure "Example"
3533 def MinDistanceComponents(self, theShape1, theShape2):
3534 # Example: see GEOM_TestMeasures.py
3535 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
3536 RaiseIfFailed("GetMinDistance", self.MeasuOp)
3537 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
3540 ## Get angle between the given shapes in degrees.
3541 # @param theShape1,theShape2 Lines or linear edges to find angle between.
3542 # @return Value of the angle between the given shapes in degrees.
3544 # @ref tui_measurement_tools_page "Example"
3545 def GetAngle(self, theShape1, theShape2):
3546 # Example: see GEOM_TestMeasures.py
3547 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
3548 RaiseIfFailed("GetAngle", self.MeasuOp)
3550 ## Get angle between the given shapes in radians.
3551 # @param theShape1,theShape2 Lines or linear edges to find angle between.
3552 # @return Value of the angle between the given shapes in radians.
3554 # @ref tui_measurement_tools_page "Example"
3555 def GetAngleRadians(self, theShape1, theShape2):
3556 # Example: see GEOM_TestMeasures.py
3557 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
3558 RaiseIfFailed("GetAngle", self.MeasuOp)
3561 ## @name Curve Curvature Measurement
3562 # Methods for receiving radius of curvature of curves
3563 # in the given point
3566 ## Measure curvature of a curve at a point, set by parameter.
3567 # @ref swig_todo "Example"
3568 def CurveCurvatureByParam(self, theCurve, theParam):
3569 # Example: see GEOM_TestMeasures.py
3570 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
3571 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
3575 # @ref swig_todo "Example"
3576 def CurveCurvatureByPoint(self, theCurve, thePoint):
3577 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
3578 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
3582 ## @name Surface Curvature Measurement
3583 # Methods for receiving max and min radius of curvature of surfaces
3584 # in the given point
3588 ## @ref swig_todo "Example"
3589 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
3590 # Example: see GEOM_TestMeasures.py
3591 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
3592 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
3596 ## @ref swig_todo "Example"
3597 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
3598 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
3599 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
3603 ## @ref swig_todo "Example"
3604 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
3605 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
3606 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
3610 ## @ref swig_todo "Example"
3611 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
3612 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
3613 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
3617 ## Get min and max tolerances of sub-shapes of theShape
3618 # @param theShape Shape, to get tolerances of.
3619 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
3620 # FaceMin,FaceMax: Min and max tolerances of the faces.
3621 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
3622 # VertMin,VertMax: Min and max tolerances of the vertices.
3624 # @ref tui_measurement_tools_page "Example"
3625 def Tolerance(self,theShape):
3626 # Example: see GEOM_TestMeasures.py
3627 aTuple = self.MeasuOp.GetTolerance(theShape)
3628 RaiseIfFailed("GetTolerance", self.MeasuOp)
3631 ## Obtain description of the given shape (number of sub-shapes of each type)
3632 # @param theShape Shape to be described.
3633 # @return Description of the given shape.
3635 # @ref tui_measurement_tools_page "Example"
3636 def WhatIs(self,theShape):
3637 # Example: see GEOM_TestMeasures.py
3638 aDescr = self.MeasuOp.WhatIs(theShape)
3639 RaiseIfFailed("WhatIs", self.MeasuOp)
3642 ## Obtain quantity of shapes of the given type in \a theShape.
3643 # If \a theShape is of type \a theType, it is also counted.
3644 # @param theShape Shape to be described.
3645 # @return Quantity of shapes of type \a theType in \a theShape.
3647 # @ref tui_measurement_tools_page "Example"
3648 def NbShapes (self, theShape, theType):
3649 # Example: see GEOM_TestMeasures.py
3650 listSh = self.SubShapeAllIDs(theShape, theType)
3652 t = EnumToLong(theShape.GetShapeType())
3653 theType = EnumToLong(theType)
3659 ## Obtain quantity of shapes of each type in \a theShape.
3660 # The \a theShape is also counted.
3661 # @param theShape Shape to be described.
3662 # @return Dictionary of shape types with bound quantities of shapes.
3664 # @ref tui_measurement_tools_page "Example"
3665 def ShapeInfo (self, theShape):
3666 # Example: see GEOM_TestMeasures.py
3668 for typeSh in ShapeType:
3669 if typeSh in ( "AUTO", "SHAPE" ): continue
3670 listSh = self.SubShapeAllIDs(theShape, ShapeType[typeSh])
3672 if EnumToLong(theShape.GetShapeType()) == ShapeType[typeSh]:
3679 ## Get a point, situated at the centre of mass of theShape.
3680 # @param theShape Shape to define centre of mass of.
3681 # @return New GEOM_Object, containing the created point.
3683 # @ref tui_measurement_tools_page "Example"
3684 def MakeCDG(self,theShape):
3685 # Example: see GEOM_TestMeasures.py
3686 anObj = self.MeasuOp.GetCentreOfMass(theShape)
3687 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
3690 ## Get a vertex subshape by index depended with orientation.
3691 # @param theShape Shape to find subshape.
3692 # @param theIndex Index to find vertex by this index (starting from zero)
3693 # @return New GEOM_Object, containing the created vertex.
3695 # @ref tui_measurement_tools_page "Example"
3696 def GetVertexByIndex(self,theShape, theIndex):
3697 # Example: see GEOM_TestMeasures.py
3698 anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex)
3699 RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
3702 ## Get the first vertex of wire/edge depended orientation.
3703 # @param theShape Shape to find first vertex.
3704 # @return New GEOM_Object, containing the created vertex.
3706 # @ref tui_measurement_tools_page "Example"
3707 def GetFirstVertex(self,theShape):
3708 # Example: see GEOM_TestMeasures.py
3709 anObj = self.GetVertexByIndex(theShape, 0)
3710 RaiseIfFailed("GetFirstVertex", self.MeasuOp)
3713 ## Get the last vertex of wire/edge depended orientation.
3714 # @param theShape Shape to find last vertex.
3715 # @return New GEOM_Object, containing the created vertex.
3717 # @ref tui_measurement_tools_page "Example"
3718 def GetLastVertex(self,theShape):
3719 # Example: see GEOM_TestMeasures.py
3720 nb_vert = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["VERTEX"])
3721 anObj = self.GetVertexByIndex(theShape, (nb_vert-1))
3722 RaiseIfFailed("GetLastVertex", self.MeasuOp)
3725 ## Get a normale to the given face. If the point is not given,
3726 # the normale is calculated at the center of mass.
3727 # @param theFace Face to define normale of.
3728 # @param theOptionalPoint Point to compute the normale at.
3729 # @return New GEOM_Object, containing the created vector.
3731 # @ref swig_todo "Example"
3732 def GetNormal(self, theFace, theOptionalPoint = None):
3733 # Example: see GEOM_TestMeasures.py
3734 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
3735 RaiseIfFailed("GetNormal", self.MeasuOp)
3738 ## Check a topology of the given shape.
3739 # @param theShape Shape to check validity of.
3740 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
3741 # if TRUE, the shape's geometry will be checked also.
3742 # @return TRUE, if the shape "seems to be valid".
3743 # If theShape is invalid, prints a description of problem.
3745 # @ref tui_measurement_tools_page "Example"
3746 def CheckShape(self,theShape, theIsCheckGeom = 0):
3747 # Example: see GEOM_TestMeasures.py
3749 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
3750 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
3752 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
3753 RaiseIfFailed("CheckShape", self.MeasuOp)
3758 ## Get position (LCS) of theShape.
3760 # Origin of the LCS is situated at the shape's center of mass.
3761 # Axes of the LCS are obtained from shape's location or,
3762 # if the shape is a planar face, from position of its plane.
3764 # @param theShape Shape to calculate position of.
3765 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
3766 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
3767 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
3768 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
3770 # @ref swig_todo "Example"
3771 def GetPosition(self,theShape):
3772 # Example: see GEOM_TestMeasures.py
3773 aTuple = self.MeasuOp.GetPosition(theShape)
3774 RaiseIfFailed("GetPosition", self.MeasuOp)
3777 ## Get kind of theShape.
3779 # @param theShape Shape to get a kind of.
3780 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
3781 # and a list of parameters, describing the shape.
3782 # @note Concrete meaning of each value, returned via \a theIntegers
3783 # or \a theDoubles list depends on the kind of the shape.
3784 # The full list of possible outputs is:
3786 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
3787 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
3789 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
3790 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
3792 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
3793 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
3795 # - geompy.kind.SPHERE xc yc zc R
3796 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
3797 # - geompy.kind.BOX xc yc zc ax ay az
3798 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
3799 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
3800 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
3801 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
3802 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
3804 # - geompy.kind.SPHERE2D xc yc zc R
3805 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
3806 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
3807 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
3808 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
3809 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
3810 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
3811 # - geompy.kind.PLANE xo yo zo dx dy dz
3812 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
3813 # - geompy.kind.FACE nb_edges nb_vertices
3815 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
3816 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
3817 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
3818 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
3819 # - geompy.kind.LINE xo yo zo dx dy dz
3820 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
3821 # - geompy.kind.EDGE nb_vertices
3823 # - geompy.kind.VERTEX x y z
3825 # @ref swig_todo "Example"
3826 def KindOfShape(self,theShape):
3827 # Example: see GEOM_TestMeasures.py
3828 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
3829 RaiseIfFailed("KindOfShape", self.MeasuOp)
3831 aKind = aRoughTuple[0]
3832 anInts = aRoughTuple[1]
3833 aDbls = aRoughTuple[2]
3835 # Now there is no exception from this rule:
3836 aKindTuple = [aKind] + aDbls + anInts
3838 # If they are we will regroup parameters for such kind of shape.
3840 #if aKind == kind.SOME_KIND:
3841 # # SOME_KIND int int double int double double
3842 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
3849 ## @addtogroup l2_import_export
3852 ## Import a shape from the BREP or IGES or STEP file
3853 # (depends on given format) with given name.
3854 # @param theFileName The file, containing the shape.
3855 # @param theFormatName Specify format for the file reading.
3856 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3857 # If format 'IGES_SCALE' is used instead 'IGES' length unit will be
3858 # set to 'meter' and result model will be scaled.
3859 # @return New GEOM_Object, containing the imported shape.
3861 # @ref swig_Import_Export "Example"
3862 def ImportFile(self,theFileName, theFormatName):
3863 # Example: see GEOM_TestOthers.py
3864 anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
3865 RaiseIfFailed("Import", self.InsertOp)
3868 ## Deprecated analog of ImportFile
3869 def Import(self,theFileName, theFormatName):
3870 print "WARNING: Function Import is deprecated, use ImportFile instead"
3871 anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
3872 RaiseIfFailed("Import", self.InsertOp)
3875 ## Shortcut to ImportFile() for BREP format
3877 # @ref swig_Import_Export "Example"
3878 def ImportBREP(self,theFileName):
3879 # Example: see GEOM_TestOthers.py
3880 return self.ImportFile(theFileName, "BREP")
3882 ## Shortcut to ImportFile() for IGES format
3884 # @ref swig_Import_Export "Example"
3885 def ImportIGES(self,theFileName):
3886 # Example: see GEOM_TestOthers.py
3887 return self.ImportFile(theFileName, "IGES")
3889 ## Return length unit from given IGES file
3891 # @ref swig_Import_Export "Example"
3892 def GetIGESUnit(self,theFileName):
3893 # Example: see GEOM_TestOthers.py
3894 anObj = self.InsertOp.ImportFile(theFileName, "IGES_UNIT")
3895 #RaiseIfFailed("Import", self.InsertOp)
3896 # recieve name using returned vertex
3898 if anObj.GetShapeType() == GEOM.VERTEX:
3901 vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
3903 p = self.PointCoordinates(vertices[0])
3904 if abs(p[0]-0.01) < 1.e-6:
3906 elif abs(p[0]-0.001) < 1.e-6:
3910 ## Shortcut to ImportFile() for STEP format
3912 # @ref swig_Import_Export "Example"
3913 def ImportSTEP(self,theFileName):
3914 # Example: see GEOM_TestOthers.py
3915 return self.ImportFile(theFileName, "STEP")
3917 ## Export the given shape into a file with given name.
3918 # @param theObject Shape to be stored in the file.
3919 # @param theFileName Name of the file to store the given shape in.
3920 # @param theFormatName Specify format for the shape storage.
3921 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3923 # @ref swig_Import_Export "Example"
3924 def Export(self,theObject, theFileName, theFormatName):
3925 # Example: see GEOM_TestOthers.py
3926 self.InsertOp.Export(theObject, theFileName, theFormatName)
3927 if self.InsertOp.IsDone() == 0:
3928 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
3932 ## Shortcut to Export() for BREP format
3934 # @ref swig_Import_Export "Example"
3935 def ExportBREP(self,theObject, theFileName):
3936 # Example: see GEOM_TestOthers.py
3937 return self.Export(theObject, theFileName, "BREP")
3939 ## Shortcut to Export() for IGES format
3941 # @ref swig_Import_Export "Example"
3942 def ExportIGES(self,theObject, theFileName):
3943 # Example: see GEOM_TestOthers.py
3944 return self.Export(theObject, theFileName, "IGES")
3946 ## Shortcut to Export() for STEP format
3948 # @ref swig_Import_Export "Example"
3949 def ExportSTEP(self,theObject, theFileName):
3950 # Example: see GEOM_TestOthers.py
3951 return self.Export(theObject, theFileName, "STEP")
3953 # end of l2_import_export
3956 ## @addtogroup l3_blocks
3959 ## Create a quadrangle face from four edges. Order of Edges is not
3960 # important. It is not necessary that edges share the same vertex.
3961 # @param E1,E2,E3,E4 Edges for the face bound.
3962 # @return New GEOM_Object, containing the created face.
3964 # @ref tui_building_by_blocks_page "Example"
3965 def MakeQuad(self,E1, E2, E3, E4):
3966 # Example: see GEOM_Spanner.py
3967 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
3968 RaiseIfFailed("MakeQuad", self.BlocksOp)
3971 ## Create a quadrangle face on two edges.
3972 # The missing edges will be built by creating the shortest ones.
3973 # @param E1,E2 Two opposite edges for the face.
3974 # @return New GEOM_Object, containing the created face.
3976 # @ref tui_building_by_blocks_page "Example"
3977 def MakeQuad2Edges(self,E1, E2):
3978 # Example: see GEOM_Spanner.py
3979 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
3980 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
3983 ## Create a quadrangle face with specified corners.
3984 # The missing edges will be built by creating the shortest ones.
3985 # @param V1,V2,V3,V4 Corner vertices for the face.
3986 # @return New GEOM_Object, containing the created face.
3988 # @ref tui_building_by_blocks_page "Example 1"
3989 # \n @ref swig_MakeQuad4Vertices "Example 2"
3990 def MakeQuad4Vertices(self,V1, V2, V3, V4):
3991 # Example: see GEOM_Spanner.py
3992 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
3993 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
3996 ## Create a hexahedral solid, bounded by the six given faces. Order of
3997 # faces is not important. It is not necessary that Faces share the same edge.
3998 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
3999 # @return New GEOM_Object, containing the created solid.
4001 # @ref tui_building_by_blocks_page "Example 1"
4002 # \n @ref swig_MakeHexa "Example 2"
4003 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
4004 # Example: see GEOM_Spanner.py
4005 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
4006 RaiseIfFailed("MakeHexa", self.BlocksOp)
4009 ## Create a hexahedral solid between two given faces.
4010 # The missing faces will be built by creating the smallest ones.
4011 # @param F1,F2 Two opposite faces for the hexahedral solid.
4012 # @return New GEOM_Object, containing the created solid.
4014 # @ref tui_building_by_blocks_page "Example 1"
4015 # \n @ref swig_MakeHexa2Faces "Example 2"
4016 def MakeHexa2Faces(self,F1, F2):
4017 # Example: see GEOM_Spanner.py
4018 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
4019 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
4025 ## @addtogroup l3_blocks_op
4028 ## Get a vertex, found in the given shape by its coordinates.
4029 # @param theShape Block or a compound of blocks.
4030 # @param theX,theY,theZ Coordinates of the sought vertex.
4031 # @param theEpsilon Maximum allowed distance between the resulting
4032 # vertex and point with the given coordinates.
4033 # @return New GEOM_Object, containing the found vertex.
4035 # @ref swig_GetPoint "Example"
4036 def GetPoint(self, theShape, theX, theY, theZ, theEpsilon):
4037 # Example: see GEOM_TestOthers.py
4038 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
4039 RaiseIfFailed("GetPoint", self.BlocksOp)
4042 ## Find a vertex of the given shape, which has minimal distance to the given point.
4043 # @param theShape Any shape.
4044 # @param thePoint Point, close to the desired vertex.
4045 # @return New GEOM_Object, containing the found vertex.
4047 # @ref swig_GetVertexNearPoint "Example"
4048 def GetVertexNearPoint(self, theShape, thePoint):
4049 # Example: see GEOM_TestOthers.py
4050 anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
4051 RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
4054 ## Get an edge, found in the given shape by two given vertices.
4055 # @param theShape Block or a compound of blocks.
4056 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
4057 # @return New GEOM_Object, containing the found edge.
4059 # @ref swig_GetEdge "Example"
4060 def GetEdge(self, theShape, thePoint1, thePoint2):
4061 # Example: see GEOM_Spanner.py
4062 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
4063 RaiseIfFailed("GetEdge", self.BlocksOp)
4066 ## Find an edge of the given shape, which has minimal distance to the given point.
4067 # @param theShape Block or a compound of blocks.
4068 # @param thePoint Point, close to the desired edge.
4069 # @return New GEOM_Object, containing the found edge.
4071 # @ref swig_GetEdgeNearPoint "Example"
4072 def GetEdgeNearPoint(self, theShape, thePoint):
4073 # Example: see GEOM_TestOthers.py
4074 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
4075 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
4078 ## Returns a face, found in the given shape by four given corner vertices.
4079 # @param theShape Block or a compound of blocks.
4080 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
4081 # @return New GEOM_Object, containing the found face.
4083 # @ref swig_todo "Example"
4084 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
4085 # Example: see GEOM_Spanner.py
4086 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
4087 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
4090 ## Get a face of block, found in the given shape by two given edges.
4091 # @param theShape Block or a compound of blocks.
4092 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
4093 # @return New GEOM_Object, containing the found face.
4095 # @ref swig_todo "Example"
4096 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
4097 # Example: see GEOM_Spanner.py
4098 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
4099 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
4102 ## Find a face, opposite to the given one in the given block.
4103 # @param theBlock Must be a hexahedral solid.
4104 # @param theFace Face of \a theBlock, opposite to the desired face.
4105 # @return New GEOM_Object, containing the found face.
4107 # @ref swig_GetOppositeFace "Example"
4108 def GetOppositeFace(self,theBlock, theFace):
4109 # Example: see GEOM_Spanner.py
4110 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
4111 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
4114 ## Find a face of the given shape, which has minimal distance to the given point.
4115 # @param theShape Block or a compound of blocks.
4116 # @param thePoint Point, close to the desired face.
4117 # @return New GEOM_Object, containing the found face.
4119 # @ref swig_GetFaceNearPoint "Example"
4120 def GetFaceNearPoint(self, theShape, thePoint):
4121 # Example: see GEOM_Spanner.py
4122 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
4123 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
4126 ## Find a face of block, whose outside normale has minimal angle with the given vector.
4127 # @param theBlock Block or a compound of blocks.
4128 # @param theVector Vector, close to the normale of the desired face.
4129 # @return New GEOM_Object, containing the found face.
4131 # @ref swig_todo "Example"
4132 def GetFaceByNormale(self, theBlock, theVector):
4133 # Example: see GEOM_Spanner.py
4134 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
4135 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
4138 ## Find all subshapes of type \a theShapeType of the given shape,
4139 # which have minimal distance to the given point.
4140 # @param theShape Any shape.
4141 # @param thePoint Point, close to the desired shape.
4142 # @param theShapeType Defines what kind of subshapes is searched.
4143 # @param theTolerance The tolerance for distances comparison. All shapes
4144 # with distances to the given point in interval
4145 # [minimal_distance, minimal_distance + theTolerance] will be gathered.
4146 # @return New GEOM_Object, containing a group of all found shapes.
4148 # @ref swig_GetShapesNearPoint "Example"
4149 def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07):
4150 # Example: see GEOM_TestOthers.py
4151 anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
4152 RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
4155 # end of l3_blocks_op
4158 ## @addtogroup l4_blocks_measure
4161 ## Check, if the compound of blocks is given.
4162 # To be considered as a compound of blocks, the
4163 # given shape must satisfy the following conditions:
4164 # - Each element of the compound should be a Block (6 faces and 12 edges).
4165 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
4166 # - The compound should be connexe.
4167 # - The glue between two quadrangle faces should be applied.
4168 # @param theCompound The compound to check.
4169 # @return TRUE, if the given shape is a compound of blocks.
4170 # If theCompound is not valid, prints all discovered errors.
4172 # @ref tui_measurement_tools_page "Example 1"
4173 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
4174 def CheckCompoundOfBlocks(self,theCompound):
4175 # Example: see GEOM_Spanner.py
4176 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
4177 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
4179 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
4183 ## Remove all seam and degenerated edges from \a theShape.
4184 # Unite faces and edges, sharing one surface. It means that
4185 # this faces must have references to one C++ surface object (handle).
4186 # @param theShape The compound or single solid to remove irregular edges from.
4187 # @param doUnionFaces If True, then unite faces. If False (the default value),
4188 # do not unite faces.
4189 # @return Improved shape.
4191 # @ref swig_RemoveExtraEdges "Example"
4192 def RemoveExtraEdges(self, theShape, doUnionFaces=False):
4193 # Example: see GEOM_TestOthers.py
4194 nbFacesOptimum = -1 # -1 means do not unite faces
4195 if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
4196 anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
4197 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
4200 ## Check, if the given shape is a blocks compound.
4201 # Fix all detected errors.
4202 # \note Single block can be also fixed by this method.
4203 # @param theShape The compound to check and improve.
4204 # @return Improved compound.
4206 # @ref swig_CheckAndImprove "Example"
4207 def CheckAndImprove(self,theShape):
4208 # Example: see GEOM_TestOthers.py
4209 anObj = self.BlocksOp.CheckAndImprove(theShape)
4210 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
4213 # end of l4_blocks_measure
4216 ## @addtogroup l3_blocks_op
4219 ## Get all the blocks, contained in the given compound.
4220 # @param theCompound The compound to explode.
4221 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
4222 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
4223 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
4224 # @return List of GEOM_Objects, containing the retrieved blocks.
4226 # @ref tui_explode_on_blocks "Example 1"
4227 # \n @ref swig_MakeBlockExplode "Example 2"
4228 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
4229 # Example: see GEOM_TestOthers.py
4230 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
4231 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
4232 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
4234 anObj.SetParameters(Parameters)
4238 ## Find block, containing the given point inside its volume or on boundary.
4239 # @param theCompound Compound, to find block in.
4240 # @param thePoint Point, close to the desired block. If the point lays on
4241 # boundary between some blocks, we return block with nearest center.
4242 # @return New GEOM_Object, containing the found block.
4244 # @ref swig_todo "Example"
4245 def GetBlockNearPoint(self,theCompound, thePoint):
4246 # Example: see GEOM_Spanner.py
4247 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
4248 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
4251 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
4252 # @param theCompound Compound, to find block in.
4253 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
4254 # @return New GEOM_Object, containing the found block.
4256 # @ref swig_GetBlockByParts "Example"
4257 def GetBlockByParts(self,theCompound, theParts):
4258 # Example: see GEOM_TestOthers.py
4259 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
4260 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
4263 ## Return all blocks, containing all the elements, passed as the parts.
4264 # @param theCompound Compound, to find blocks in.
4265 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
4266 # @return List of GEOM_Objects, containing the found blocks.
4268 # @ref swig_todo "Example"
4269 def GetBlocksByParts(self,theCompound, theParts):
4270 # Example: see GEOM_Spanner.py
4271 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
4272 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
4275 ## Multi-transformate block and glue the result.
4276 # Transformation is defined so, as to superpose direction faces.
4277 # @param Block Hexahedral solid to be multi-transformed.
4278 # @param DirFace1 ID of First direction face.
4279 # @param DirFace2 ID of Second direction face.
4280 # @param NbTimes Quantity of transformations to be done.
4281 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
4282 # @return New GEOM_Object, containing the result shape.
4284 # @ref tui_multi_transformation "Example"
4285 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
4286 # Example: see GEOM_Spanner.py
4287 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
4288 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
4289 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
4290 anObj.SetParameters(Parameters)
4293 ## Multi-transformate block and glue the result.
4294 # @param Block Hexahedral solid to be multi-transformed.
4295 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
4296 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
4297 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
4298 # @return New GEOM_Object, containing the result shape.
4300 # @ref tui_multi_transformation "Example"
4301 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
4302 DirFace1V, DirFace2V, NbTimesV):
4303 # Example: see GEOM_Spanner.py
4304 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
4305 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
4306 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
4307 DirFace1V, DirFace2V, NbTimesV)
4308 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
4309 anObj.SetParameters(Parameters)
4312 ## Build all possible propagation groups.
4313 # Propagation group is a set of all edges, opposite to one (main)
4314 # edge of this group directly or through other opposite edges.
4315 # Notion of Opposite Edge make sence only on quadrangle face.
4316 # @param theShape Shape to build propagation groups on.
4317 # @return List of GEOM_Objects, each of them is a propagation group.
4319 # @ref swig_Propagate "Example"
4320 def Propagate(self,theShape):
4321 # Example: see GEOM_TestOthers.py
4322 listChains = self.BlocksOp.Propagate(theShape)
4323 RaiseIfFailed("Propagate", self.BlocksOp)
4326 # end of l3_blocks_op
4329 ## @addtogroup l3_groups
4332 ## Creates a new group which will store sub shapes of theMainShape
4333 # @param theMainShape is a GEOM object on which the group is selected
4334 # @param theShapeType defines a shape type of the group
4335 # @return a newly created GEOM group
4337 # @ref tui_working_with_groups_page "Example 1"
4338 # \n @ref swig_CreateGroup "Example 2"
4339 def CreateGroup(self,theMainShape, theShapeType):
4340 # Example: see GEOM_TestOthers.py
4341 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
4342 RaiseIfFailed("CreateGroup", self.GroupOp)
4345 ## Adds a sub object with ID theSubShapeId to the group
4346 # @param theGroup is a GEOM group to which the new sub shape is added
4347 # @param theSubShapeID is a sub shape ID in the main object.
4348 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
4350 # @ref tui_working_with_groups_page "Example"
4351 def AddObject(self,theGroup, theSubShapeID):
4352 # Example: see GEOM_TestOthers.py
4353 self.GroupOp.AddObject(theGroup, theSubShapeID)
4354 if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT":
4355 RaiseIfFailed("AddObject", self.GroupOp)
4359 ## Removes a sub object with ID \a theSubShapeId from the group
4360 # @param theGroup is a GEOM group from which the new sub shape is removed
4361 # @param theSubShapeID is a sub shape ID in the main object.
4362 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
4364 # @ref tui_working_with_groups_page "Example"
4365 def RemoveObject(self,theGroup, theSubShapeID):
4366 # Example: see GEOM_TestOthers.py
4367 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
4368 RaiseIfFailed("RemoveObject", self.GroupOp)
4371 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
4372 # @param theGroup is a GEOM group to which the new sub shapes are added.
4373 # @param theSubShapes is a list of sub shapes to be added.
4375 # @ref tui_working_with_groups_page "Example"
4376 def UnionList (self,theGroup, theSubShapes):
4377 # Example: see GEOM_TestOthers.py
4378 self.GroupOp.UnionList(theGroup, theSubShapes)
4379 RaiseIfFailed("UnionList", self.GroupOp)
4382 ## Works like the above method, but argument
4383 # theSubShapes here is a list of sub-shapes indices
4385 # @ref swig_UnionIDs "Example"
4386 def UnionIDs(self,theGroup, theSubShapes):
4387 # Example: see GEOM_TestOthers.py
4388 self.GroupOp.UnionIDs(theGroup, theSubShapes)
4389 RaiseIfFailed("UnionIDs", self.GroupOp)
4392 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
4393 # @param theGroup is a GEOM group from which the sub-shapes are removed.
4394 # @param theSubShapes is a list of sub-shapes to be removed.
4396 # @ref tui_working_with_groups_page "Example"
4397 def DifferenceList (self,theGroup, theSubShapes):
4398 # Example: see GEOM_TestOthers.py
4399 self.GroupOp.DifferenceList(theGroup, theSubShapes)
4400 RaiseIfFailed("DifferenceList", self.GroupOp)
4403 ## Works like the above method, but argument
4404 # theSubShapes here is a list of sub-shapes indices
4406 # @ref swig_DifferenceIDs "Example"
4407 def DifferenceIDs(self,theGroup, theSubShapes):
4408 # Example: see GEOM_TestOthers.py
4409 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
4410 RaiseIfFailed("DifferenceIDs", self.GroupOp)
4413 ## Returns a list of sub objects ID stored in the group
4414 # @param theGroup is a GEOM group for which a list of IDs is requested
4416 # @ref swig_GetObjectIDs "Example"
4417 def GetObjectIDs(self,theGroup):
4418 # Example: see GEOM_TestOthers.py
4419 ListIDs = self.GroupOp.GetObjects(theGroup)
4420 RaiseIfFailed("GetObjects", self.GroupOp)
4423 ## Returns a type of sub objects stored in the group
4424 # @param theGroup is a GEOM group which type is returned.
4426 # @ref swig_GetType "Example"
4427 def GetType(self,theGroup):
4428 # Example: see GEOM_TestOthers.py
4429 aType = self.GroupOp.GetType(theGroup)
4430 RaiseIfFailed("GetType", self.GroupOp)
4433 ## Convert a type of geom object from id to string value
4434 # @param theId is a GEOM obect type id.
4436 # @ref swig_GetType "Example"
4437 def ShapeIdToType(self, theId):
4511 return "FREE_BOUNDS"
4519 return "THRUSECTIONS"
4521 return "COMPOUNDFILTER"
4523 return "SHAPES_ON_SHAPE"
4525 return "ELLIPSE_ARC"
4532 return "Shape Id not exist."
4534 ## Returns a main shape associated with the group
4535 # @param theGroup is a GEOM group for which a main shape object is requested
4536 # @return a GEOM object which is a main shape for theGroup
4538 # @ref swig_GetMainShape "Example"
4539 def GetMainShape(self,theGroup):
4540 # Example: see GEOM_TestOthers.py
4541 anObj = self.GroupOp.GetMainShape(theGroup)
4542 RaiseIfFailed("GetMainShape", self.GroupOp)
4545 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
4546 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
4548 # @ref swig_todo "Example"
4549 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
4550 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
4553 Props = self.BasicProperties(edge)
4554 if min_length <= Props[0] and Props[0] <= max_length:
4555 if (not include_min) and (min_length == Props[0]):
4558 if (not include_max) and (Props[0] == max_length):
4561 edges_in_range.append(edge)
4563 if len(edges_in_range) <= 0:
4564 print "No edges found by given criteria"
4567 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
4568 self.UnionList(group_edges, edges_in_range)
4572 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
4573 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
4575 # @ref swig_todo "Example"
4576 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
4577 nb_selected = sg.SelectedCount()
4579 print "Select a shape before calling this function, please."
4582 print "Only one shape must be selected"
4585 id_shape = sg.getSelected(0)
4586 shape = IDToObject( id_shape )
4588 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
4592 if include_min: left_str = " <= "
4593 if include_max: right_str = " <= "
4595 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
4596 + left_str + "length" + right_str + `max_length`)
4598 sg.updateObjBrowser(1)
4605 ## @addtogroup l4_advanced
4608 ## Create a T-shape object with specified caracteristics for the main
4609 # and the incident pipes (radius, width, half-length).
4610 # The extremities of the main pipe are located on junctions points P1 and P2.
4611 # The extremity of the incident pipe is located on junction point P3.
4612 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4613 # the main plane of the T-shape is XOY.
4614 # @param theR1 Internal radius of main pipe
4615 # @param theW1 Width of main pipe
4616 # @param theL1 Half-length of main pipe
4617 # @param theR2 Internal radius of incident pipe (R2 < R1)
4618 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4619 # @param theL2 Half-length of incident pipe
4620 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4621 # @param theP1 1st junction point of main pipe
4622 # @param theP2 2nd junction point of main pipe
4623 # @param theP3 Junction point of incident pipe
4624 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4626 # @ref tui_creation_pipetshape "Example"
4627 def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4628 theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
4629 if (theP1 and theP2 and theP3):
4630 anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3)
4632 anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh)
4633 RaiseIfFailed("MakePipeTShape", self.AdvOp)
4634 if Parameters: anObj[0].SetParameters(Parameters)
4637 ## Create a T-shape object with chamfer and with specified caracteristics for the main
4638 # and the incident pipes (radius, width, half-length). The chamfer is
4639 # created on the junction of the pipes.
4640 # The extremities of the main pipe are located on junctions points P1 and P2.
4641 # The extremity of the incident pipe is located on junction point P3.
4642 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4643 # the main plane of the T-shape is XOY.
4644 # @param theR1 Internal radius of main pipe
4645 # @param theW1 Width of main pipe
4646 # @param theL1 Half-length of main pipe
4647 # @param theR2 Internal radius of incident pipe (R2 < R1)
4648 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4649 # @param theL2 Half-length of incident pipe
4650 # @param theH Height of the chamfer.
4651 # @param theW Width of the chamfer.
4652 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4653 # @param theP1 1st junction point of main pipe
4654 # @param theP2 2nd junction point of main pipe
4655 # @param theP3 Junction point of incident pipe
4656 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4658 # @ref tui_creation_pipetshape "Example"
4659 def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4660 theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW)
4661 if (theP1 and theP2 and theP3):
4662 anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3)
4664 anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh)
4665 RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp)
4666 if Parameters: anObj[0].SetParameters(Parameters)
4669 ## Create a T-shape object with fillet and with specified caracteristics for the main
4670 # and the incident pipes (radius, width, half-length). The fillet is
4671 # created on the junction of the pipes.
4672 # The extremities of the main pipe are located on junctions points P1 and P2.
4673 # The extremity of the incident pipe is located on junction point P3.
4674 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4675 # the main plane of the T-shape is XOY.
4676 # @param theR1 Internal radius of main pipe
4677 # @param theW1 Width of main pipe
4678 # @param theL1 Half-length of main pipe
4679 # @param theR2 Internal radius of incident pipe (R2 < R1)
4680 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4681 # @param theL2 Half-length of incident pipe
4682 # @param theRF Radius of curvature of fillet.
4683 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4684 # @param theP1 1st junction point of main pipe
4685 # @param theP2 2nd junction point of main pipe
4686 # @param theP3 Junction point of incident pipe
4687 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4689 # @ref tui_creation_pipetshape "Example"
4690 def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4691 theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF)
4692 if (theP1 and theP2 and theP3):
4693 anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3)
4695 anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh)
4696 RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp)
4697 if Parameters: anObj[0].SetParameters(Parameters)
4700 #@@ insert new functions before this line @@ do not remove this line @@#
4702 # end of l4_advanced
4705 ## Create a copy of the given object
4706 # @ingroup l1_geompy_auxiliary
4708 # @ref swig_all_advanced "Example"
4709 def MakeCopy(self,theOriginal):
4710 # Example: see GEOM_TestAll.py
4711 anObj = self.InsertOp.MakeCopy(theOriginal)
4712 RaiseIfFailed("MakeCopy", self.InsertOp)
4715 ## Add Path to load python scripts from
4716 # @ingroup l1_geompy_auxiliary
4717 def addPath(self,Path):
4718 if (sys.path.count(Path) < 1):
4719 sys.path.append(Path)
4723 ## Load marker texture from the file
4724 # @param Path a path to the texture file
4725 # @return unique texture identifier
4726 # @ingroup l1_geompy_auxiliary
4727 def LoadTexture(self, Path):
4728 # Example: see GEOM_TestAll.py
4729 ID = self.InsertOp.LoadTexture(Path)
4730 RaiseIfFailed("LoadTexture", self.InsertOp)
4733 ## Get entry of the object
4734 # @param obj geometry object
4735 # @return unique object identifier
4736 # @ingroup l1_geompy_auxiliary
4737 def getObjectID(self, obj):
4739 entry = salome.ObjectToID(obj)
4740 if entry is not None:
4741 lst = entry.split(":")
4743 ID = lst[-1] # -1 means last item in the list
4749 ## Add marker texture. @a Width and @a Height parameters
4750 # specify width and height of the texture in pixels.
4751 # If @a RowData is @c True, @a Texture parameter should represent texture data
4752 # packed into the byte array. If @a RowData is @c False (default), @a Texture
4753 # parameter should be unpacked string, in which '1' symbols represent opaque
4754 # pixels and '0' represent transparent pixels of the texture bitmap.
4756 # @param Width texture width in pixels
4757 # @param Height texture height in pixels
4758 # @param Texture texture data
4759 # @param RowData if @c True, @a Texture data are packed in the byte stream
4760 # @ingroup l1_geompy_auxiliary
4761 def AddTexture(self, Width, Height, Texture, RowData=False):
4762 # Example: see GEOM_TestAll.py
4763 if not RowData: Texture = PackData(Texture)
4764 ID = self.InsertOp.AddTexture(Width, Height, Texture)
4765 RaiseIfFailed("AddTexture", self.InsertOp)
4769 #Register the new proxy for GEOM_Gen
4770 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)