1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
22 # Author : Paul RASCLE, EDF
30 ## @defgroup l1_geompy_auxiliary Auxiliary data structures and methods
32 ## @defgroup l1_geompy_purpose All package methods, grouped by their purpose
34 ## @defgroup l2_import_export Importing/exporting geometrical objects
35 ## @defgroup l2_creating Creating geometrical objects
37 ## @defgroup l3_basic_go Creating Basic Geometric Objects
39 ## @defgroup l4_curves Creating Curves
42 ## @defgroup l3_3d_primitives Creating 3D Primitives
43 ## @defgroup l3_complex Creating Complex Objects
44 ## @defgroup l3_groups Working with groups
45 ## @defgroup l3_blocks Building by blocks
47 ## @defgroup l4_blocks_measure Check and Improve
50 ## @defgroup l3_sketcher Sketcher
51 ## @defgroup l3_advanced Creating Advanced Geometrical Objects
53 ## @defgroup l4_decompose Decompose objects
54 ## @defgroup l4_decompose_d Decompose objects deprecated methods
55 ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
56 ## @defgroup l4_obtain Access to subshapes by a criteria
57 ## @defgroup l4_advanced Advanced objects creation functions
62 ## @defgroup l2_transforming Transforming geometrical objects
64 ## @defgroup l3_basic_op Basic Operations
65 ## @defgroup l3_boolean Boolean Operations
66 ## @defgroup l3_transform Transformation Operations
67 ## @defgroup l3_local Local Operations (Fillet and Chamfer)
68 ## @defgroup l3_blocks_op Blocks Operations
69 ## @defgroup l3_healing Repairing Operations
70 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of subshapes
73 ## @defgroup l2_measure Using measurement tools
81 from salome_notebook import *
86 ## Enumeration ShapeType as a dictionary
87 # @ingroup l1_geompy_auxiliary
88 ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
90 ## Raise an Error, containing the Method_name, if Operation is Failed
91 ## @ingroup l1_geompy_auxiliary
92 def RaiseIfFailed (Method_name, Operation):
93 if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
94 raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
96 ## Return list of variables value from salome notebook
97 ## @ingroup l1_geompy_auxiliary
98 def ParseParameters(*parameters):
101 for parameter in parameters:
102 if isinstance(parameter, list):
103 lResults = ParseParameters(*parameter)
104 if len(lResults) > 0:
105 Result.append(lResults[:-1])
106 StringResult += lResults[-1].split(":")
110 if isinstance(parameter,str):
111 if notebook.isVariable(parameter):
112 Result.append(notebook.get(parameter))
114 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
117 Result.append(parameter)
119 StringResult.append(str(parameter))
123 Result.append(":".join(StringResult))
125 Result = ":".join(StringResult)
128 ## Return list of variables value from salome notebook
129 ## @ingroup l1_geompy_auxiliary
133 for parameter in list:
134 if isinstance(parameter,str) and notebook.isVariable(parameter):
135 Result.append(str(notebook.get(parameter)))
138 Result.append(str(parameter))
141 StringResult = StringResult + str(parameter)
142 StringResult = StringResult + ":"
144 StringResult = StringResult[:len(StringResult)-1]
145 return Result, StringResult
147 ## Return list of variables value from salome notebook
148 ## @ingroup l1_geompy_auxiliary
149 def ParseSketcherCommand(command):
152 sections = command.split(":")
153 for section in sections:
154 parameters = section.split(" ")
156 for parameter in parameters:
157 if paramIndex > 1 and parameter.find("'") != -1:
158 parameter = parameter.replace("'","")
159 if notebook.isVariable(parameter):
160 Result = Result + str(notebook.get(parameter)) + " "
163 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
167 Result = Result + str(parameter) + " "
170 StringResult = StringResult + parameter
171 StringResult = StringResult + ":"
173 paramIndex = paramIndex + 1
175 Result = Result[:len(Result)-1] + ":"
177 Result = Result[:len(Result)-1]
178 return Result, StringResult
180 ## Helper function which can be used to pack the passed string to the byte data.
181 ## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
182 ## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
185 ## val = PackData("10001110") # val = 0xAE
186 ## val = PackData("1") # val = 0x80
188 ## @param data unpacked data - a string containing '1' and '0' symbols
189 ## @return data packed to the byte stream
190 ## @ingroup l1_geompy_auxiliary
193 if len(data)%8: bytes += 1
195 for b in range(bytes):
196 d = data[b*8:(b+1)*8]
201 if d[i] == "1": val += 1
203 raise "Invalid symbol %s" % d[i]
210 ## Read bitmap texture from the text file.
211 ## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
212 ## A zero symbol ('0') represents transparent pixel of the texture bitmap.
213 ## The function returns width and height of the pixmap in pixels and byte stream representing
214 ## texture bitmap itself.
216 ## This function can be used to read the texture to the byte stream in order to pass it to
217 ## the AddTexture() function of geompy class.
221 ## geompy.init_geom(salome.myStudy)
222 ## texture = geompy.readtexture('mytexture.dat')
223 ## texture = geompy.AddTexture(*texture)
224 ## obj.SetMarkerTexture(texture)
226 ## @param fname texture file name
227 ## @return sequence of tree values: texture's width, height in pixels and its byte stream
228 ## @ingroup l1_geompy_auxiliary
229 def ReadTexture(fname):
232 lines = [ l.strip() for l in f.readlines()]
235 if lines: maxlen = max([len(x) for x in lines])
237 if maxlen%8: lenbytes += 1
241 lenline = (len(line)/8+1)*8
244 lenline = (len(line)/8)*8
246 for i in range(lenline/8):
249 if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
252 bytedata += PackData(byte)
254 for i in range(lenline/8, lenbytes):
255 bytedata += PackData("0")
257 return lenbytes*8, len(lines), bytedata
262 ## Returns a long value from enumeration type
263 # Can be used for CORBA enumerator types like GEOM.shape_type
264 # @ingroup l1_geompy_auxiliary
265 def EnumToLong(theItem):
267 if hasattr(theItem, "_v"): ret = theItem._v
270 ## Kinds of shape enumeration
271 # @ingroup l1_geompy_auxiliary
272 kind = GEOM.GEOM_IKindOfShape
274 ## Information about closed/unclosed state of shell or wire
275 # @ingroup l1_geompy_auxiliary
281 class geompyDC(GEOM._objref_GEOM_Gen):
284 GEOM._objref_GEOM_Gen.__init__(self)
285 self.myBuilder = None
304 ## @addtogroup l1_geompy_auxiliary
306 def init_geom(self,theStudy):
307 self.myStudy = theStudy
308 self.myStudyId = self.myStudy._get_StudyId()
309 self.myBuilder = self.myStudy.NewBuilder()
310 self.father = self.myStudy.FindComponent("GEOM")
311 if self.father is None:
312 self.father = self.myBuilder.NewComponent("GEOM")
313 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
314 FName = A1._narrow(SALOMEDS.AttributeName)
315 FName.SetValue("Geometry")
316 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
317 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
318 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
319 self.myBuilder.DefineComponentInstance(self.father,self)
321 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
322 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
323 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
324 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
325 self.HealOp = self.GetIHealingOperations (self.myStudyId)
326 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
327 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
328 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
329 self.LocalOp = self.GetILocalOperations (self.myStudyId)
330 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
331 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
332 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
333 self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
336 ## Get name for sub-shape aSubObj of shape aMainObj
338 # @ref swig_SubShapeAllSorted "Example"
339 def SubShapeName(self,aSubObj, aMainObj):
340 # Example: see GEOM_TestAll.py
342 #aSubId = orb.object_to_string(aSubObj)
343 #aMainId = orb.object_to_string(aMainObj)
344 #index = gg.getIndexTopology(aSubId, aMainId)
345 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
346 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
347 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
350 ## Publish in study aShape with name aName
352 # \param aShape the shape to be published
353 # \param aName the name for the shape
354 # \param doRestoreSubShapes if True, finds and publishes also
355 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
356 # and published sub-shapes of arguments
357 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
358 # these arguments description
359 # \return study entry of the published shape in form of string
361 # @ref swig_MakeQuad4Vertices "Example"
362 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
363 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
364 # Example: see GEOM_TestAll.py
366 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
367 if doRestoreSubShapes:
368 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
369 theFindMethod, theInheritFirstArg, True )
371 print "addToStudy() failed"
373 return aShape.GetStudyEntry()
375 ## Publish in study aShape with name aName as sub-object of previously published aFather
377 # @ref swig_SubShapeAllSorted "Example"
378 def addToStudyInFather(self, aFather, aShape, aName):
379 # Example: see GEOM_TestAll.py
381 aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather)
383 print "addToStudyInFather() failed"
385 return aShape.GetStudyEntry()
387 # end of l1_geompy_auxiliary
390 ## @addtogroup l3_restore_ss
393 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
394 # To be used from python scripts out of geompy.addToStudy (non-default usage)
395 # \param theObject published GEOM object, arguments of which will be published
396 # \param theArgs list of GEOM_Object, operation arguments to be published.
397 # If this list is empty, all operation arguments will be published
398 # \param theFindMethod method to search subshapes, corresponding to arguments and
399 # their subshapes. Value from enumeration GEOM::find_shape_method.
400 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
401 # Do not publish subshapes in place of arguments, but only
402 # in place of subshapes of the first argument,
403 # because the whole shape corresponds to the first argument.
404 # Mainly to be used after transformations, but it also can be
405 # usefull after partition with one object shape, and some other
406 # operations, where only the first argument has to be considered.
407 # If theObject has only one argument shape, this flag is automatically
408 # considered as True, not regarding really passed value.
409 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
410 # and prefix "from_subshapes_of_" to names of partially restored subshapes.
411 # \return list of published sub-shapes
413 # @ref tui_restore_prs_params "Example"
414 def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
415 theInheritFirstArg=False, theAddPrefix=True):
416 # Example: see GEOM_TestAll.py
417 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
418 theFindMethod, theInheritFirstArg, theAddPrefix)
420 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
421 # To be used from python scripts out of geompy.addToStudy (non-default usage)
422 # \param theObject published GEOM object, arguments of which will be published
423 # \param theArgs list of GEOM_Object, operation arguments to be published.
424 # If this list is empty, all operation arguments will be published
425 # \param theFindMethod method to search subshapes, corresponding to arguments and
426 # their subshapes. Value from enumeration GEOM::find_shape_method.
427 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
428 # Do not publish subshapes in place of arguments, but only
429 # in place of subshapes of the first argument,
430 # because the whole shape corresponds to the first argument.
431 # Mainly to be used after transformations, but it also can be
432 # usefull after partition with one object shape, and some other
433 # operations, where only the first argument has to be considered.
434 # If theObject has only one argument shape, this flag is automatically
435 # considered as True, not regarding really passed value.
436 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
437 # and prefix "from_subshapes_of_" to names of partially restored subshapes.
438 # \return list of published sub-shapes
440 # @ref tui_restore_prs_params "Example"
441 def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
442 theInheritFirstArg=False, theAddPrefix=True):
443 # Example: see GEOM_TestAll.py
444 return self.RestoreGivenSubShapesO(self.myStudy, theObject, theArgs,
445 theFindMethod, theInheritFirstArg, theAddPrefix)
447 # end of l3_restore_ss
450 ## @addtogroup l3_basic_go
453 ## Create point by three coordinates.
454 # @param theX The X coordinate of the point.
455 # @param theY The Y coordinate of the point.
456 # @param theZ The Z coordinate of the point.
457 # @return New GEOM_Object, containing the created point.
459 # @ref tui_creation_point "Example"
460 def MakeVertex(self, theX, theY, theZ):
461 # Example: see GEOM_TestAll.py
462 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
463 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
464 RaiseIfFailed("MakePointXYZ", self.BasicOp)
465 anObj.SetParameters(Parameters)
468 ## Create a point, distant from the referenced point
469 # on the given distances along the coordinate axes.
470 # @param theReference The referenced point.
471 # @param theX Displacement from the referenced point along OX axis.
472 # @param theY Displacement from the referenced point along OY axis.
473 # @param theZ Displacement from the referenced point along OZ axis.
474 # @return New GEOM_Object, containing the created point.
476 # @ref tui_creation_point "Example"
477 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
478 # Example: see GEOM_TestAll.py
479 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
480 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
481 RaiseIfFailed("MakePointWithReference", self.BasicOp)
482 anObj.SetParameters(Parameters)
485 ## Create a point, corresponding to the given parameter on the given curve.
486 # @param theRefCurve The referenced curve.
487 # @param theParameter Value of parameter on the referenced curve.
488 # @return New GEOM_Object, containing the created point.
490 # @ref tui_creation_point "Example"
491 def MakeVertexOnCurve(self,theRefCurve, theParameter):
492 # Example: see GEOM_TestAll.py
493 theParameter, Parameters = ParseParameters(theParameter)
494 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
495 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
496 anObj.SetParameters(Parameters)
499 ## Create a point by projection give coordinates on the given curve
500 # @param theRefCurve The referenced curve.
501 # @param theX X-coordinate in 3D space
502 # @param theY Y-coordinate in 3D space
503 # @param theZ Z-coordinate in 3D space
504 # @return New GEOM_Object, containing the created point.
506 # @ref tui_creation_point "Example"
507 def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ):
508 # Example: see GEOM_TestAll.py
509 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
510 anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
511 RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
512 anObj.SetParameters(Parameters)
515 ## Create a point, corresponding to the given length on the given curve.
516 # @param theRefCurve The referenced curve.
517 # @param theLength Length on the referenced curve.
518 # @param theReverse Flag allowing to choose the direction for the calculation of the length (False = forward or True = reversed).
519 # @return New GEOM_Object, containing the created point.
521 # @ref tui_creation_point "Example"
522 def MakeVertexOnCurveByLength(self,theRefCurve, theLength, theReverse = False):
523 # Example: see GEOM_TestAll.py
524 theLength, Parameters = ParseParameters(theLength)
525 anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theReverse)
526 RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
527 anObj.SetParameters(Parameters)
530 ## Create a point, corresponding to the given parameters on the
532 # @param theRefSurf The referenced surface.
533 # @param theUParameter Value of U-parameter on the referenced surface.
534 # @param theVParameter Value of V-parameter on the referenced surface.
535 # @return New GEOM_Object, containing the created point.
537 # @ref swig_MakeVertexOnSurface "Example"
538 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
539 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
540 # Example: see GEOM_TestAll.py
541 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
542 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
543 anObj.SetParameters(Parameters);
546 ## Create a point by projection give coordinates on the given surface
547 # @param theRefSurf The referenced surface.
548 # @param theX X-coordinate in 3D space
549 # @param theY Y-coordinate in 3D space
550 # @param theZ Z-coordinate in 3D space
551 # @return New GEOM_Object, containing the created point.
553 # @ref swig_MakeVertexOnSurfaceByCoord "Example"
554 def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ):
555 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
556 # Example: see GEOM_TestAll.py
557 anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
558 RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
559 anObj.SetParameters(Parameters);
562 ## Create a point on intersection of two lines.
563 # @param theRefLine1, theRefLine2 The referenced lines.
564 # @return New GEOM_Object, containing the created point.
566 # @ref swig_MakeVertexOnLinesIntersection "Example"
567 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
568 # Example: see GEOM_TestAll.py
569 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
570 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
573 ## Create a tangent, corresponding to the given parameter on the given curve.
574 # @param theRefCurve The referenced curve.
575 # @param theParameter Value of parameter on the referenced curve.
576 # @return New GEOM_Object, containing the created tangent.
578 # @ref swig_MakeTangentOnCurve "Example"
579 def MakeTangentOnCurve(self, theRefCurve, theParameter):
580 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
581 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
584 ## Create a tangent plane, corresponding to the given parameter on the given face.
585 # @param theFace The face for which tangent plane should be built.
586 # @param theParameterV vertical value of the center point (0.0 - 1.0).
587 # @param theParameterU horisontal value of the center point (0.0 - 1.0).
588 # @param theTrimSize the size of plane.
589 # @return New GEOM_Object, containing the created tangent.
591 # @ref swig_MakeTangentPlaneOnFace "Example"
592 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize):
593 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
594 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
597 ## Create a vector with the given components.
598 # @param theDX X component of the vector.
599 # @param theDY Y component of the vector.
600 # @param theDZ Z component of the vector.
601 # @return New GEOM_Object, containing the created vector.
603 # @ref tui_creation_vector "Example"
604 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
605 # Example: see GEOM_TestAll.py
606 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
607 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
608 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
609 anObj.SetParameters(Parameters)
612 ## Create a vector between two points.
613 # @param thePnt1 Start point for the vector.
614 # @param thePnt2 End point for the vector.
615 # @return New GEOM_Object, containing the created vector.
617 # @ref tui_creation_vector "Example"
618 def MakeVector(self,thePnt1, thePnt2):
619 # Example: see GEOM_TestAll.py
620 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
621 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
624 ## Create a line, passing through the given point
625 # and parrallel to the given direction
626 # @param thePnt Point. The resulting line will pass through it.
627 # @param theDir Direction. The resulting line will be parallel to it.
628 # @return New GEOM_Object, containing the created line.
630 # @ref tui_creation_line "Example"
631 def MakeLine(self,thePnt, theDir):
632 # Example: see GEOM_TestAll.py
633 anObj = self.BasicOp.MakeLine(thePnt, theDir)
634 RaiseIfFailed("MakeLine", self.BasicOp)
637 ## Create a line, passing through the given points
638 # @param thePnt1 First of two points, defining the line.
639 # @param thePnt2 Second of two points, defining the line.
640 # @return New GEOM_Object, containing the created line.
642 # @ref tui_creation_line "Example"
643 def MakeLineTwoPnt(self,thePnt1, thePnt2):
644 # Example: see GEOM_TestAll.py
645 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
646 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
649 ## Create a line on two faces intersection.
650 # @param theFace1 First of two faces, defining the line.
651 # @param theFace2 Second of two faces, defining the line.
652 # @return New GEOM_Object, containing the created line.
654 # @ref swig_MakeLineTwoFaces "Example"
655 def MakeLineTwoFaces(self, theFace1, theFace2):
656 # Example: see GEOM_TestAll.py
657 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
658 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
661 ## Create a plane, passing through the given point
662 # and normal to the given vector.
663 # @param thePnt Point, the plane has to pass through.
664 # @param theVec Vector, defining the plane normal direction.
665 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
666 # @return New GEOM_Object, containing the created plane.
668 # @ref tui_creation_plane "Example"
669 def MakePlane(self,thePnt, theVec, theTrimSize):
670 # Example: see GEOM_TestAll.py
671 theTrimSize, Parameters = ParseParameters(theTrimSize);
672 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
673 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
674 anObj.SetParameters(Parameters)
677 ## Create a plane, passing through the three given points
678 # @param thePnt1 First of three points, defining the plane.
679 # @param thePnt2 Second of three points, defining the plane.
680 # @param thePnt3 Fird of three points, defining the plane.
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 MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
686 # Example: see GEOM_TestAll.py
687 theTrimSize, Parameters = ParseParameters(theTrimSize);
688 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
689 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
690 anObj.SetParameters(Parameters)
693 ## Create a plane, similar to the existing one, but with another size of representing face.
694 # @param theFace Referenced plane or LCS(Marker).
695 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
696 # @return New GEOM_Object, containing the created plane.
698 # @ref tui_creation_plane "Example"
699 def MakePlaneFace(self,theFace, theTrimSize):
700 # Example: see GEOM_TestAll.py
701 theTrimSize, Parameters = ParseParameters(theTrimSize);
702 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
703 RaiseIfFailed("MakePlaneFace", self.BasicOp)
704 anObj.SetParameters(Parameters)
707 ## Create a plane, passing through the 2 vectors
708 # with center in a start point of the first vector.
709 # @param theVec1 Vector, defining center point and plane direction.
710 # @param theVec2 Vector, defining the plane normal direction.
711 # @param theTrimSize 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 MakePlane2Vec(self,theVec1, theVec2, theTrimSize):
716 # Example: see GEOM_TestAll.py
717 theTrimSize, Parameters = ParseParameters(theTrimSize);
718 anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
719 RaiseIfFailed("MakePlane2Vec", self.BasicOp)
720 anObj.SetParameters(Parameters)
723 ## Create a plane, based on a Local coordinate system.
724 # @param theLCS coordinate system, defining plane.
725 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
726 # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
727 # @return New GEOM_Object, containing the created plane.
729 # @ref tui_creation_plane "Example"
730 def MakePlaneLCS(self,theLCS, theTrimSize, theOrientation):
731 # Example: see GEOM_TestAll.py
732 theTrimSize, Parameters = ParseParameters(theTrimSize);
733 anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
734 RaiseIfFailed("MakePlaneLCS", self.BasicOp)
735 anObj.SetParameters(Parameters)
738 ## Create a local coordinate system.
739 # @param OX,OY,OZ Three coordinates of coordinate system origin.
740 # @param XDX,XDY,XDZ Three components of OX direction
741 # @param YDX,YDY,YDZ Three components of OY direction
742 # @return New GEOM_Object, containing the created coordinate system.
744 # @ref swig_MakeMarker "Example"
745 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
746 # Example: see GEOM_TestAll.py
747 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
748 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
749 RaiseIfFailed("MakeMarker", self.BasicOp)
750 anObj.SetParameters(Parameters)
753 ## Create a local coordinate system from shape.
754 # @param theShape The initial shape to detect the coordinate system.
755 # @return New GEOM_Object, containing the created coordinate system.
757 # @ref tui_creation_lcs "Example"
758 def MakeMarkerFromShape(self, theShape):
759 anObj = self.BasicOp.MakeMarkerFromShape(theShape)
760 RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
763 ## Create a local coordinate system from point and two vectors.
764 # @param theOrigin Point of coordinate system origin.
765 # @param theXVec Vector of X direction
766 # @param theYVec Vector of Y direction
767 # @return New GEOM_Object, containing the created coordinate system.
769 # @ref tui_creation_lcs "Example"
770 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
771 anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
772 RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
778 ## @addtogroup l4_curves
781 ## Create an arc of circle, passing through three given points.
782 # @param thePnt1 Start point of the arc.
783 # @param thePnt2 Middle point of the arc.
784 # @param thePnt3 End point of the arc.
785 # @return New GEOM_Object, containing the created arc.
787 # @ref swig_MakeArc "Example"
788 def MakeArc(self,thePnt1, thePnt2, thePnt3):
789 # Example: see GEOM_TestAll.py
790 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
791 RaiseIfFailed("MakeArc", self.CurvesOp)
794 ## Create an arc of circle from a center and 2 points.
795 # @param thePnt1 Center of the arc
796 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
797 # @param thePnt3 End point of the arc (Gives also a direction)
798 # @param theSense Orientation of the arc
799 # @return New GEOM_Object, containing the created arc.
801 # @ref swig_MakeArc "Example"
802 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
803 # Example: see GEOM_TestAll.py
804 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
805 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
808 ## Create an arc of ellipse, of center and two points.
809 # @param theCenter Center of the arc.
810 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
811 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
812 # @return New GEOM_Object, containing the created arc.
814 # @ref swig_MakeArc "Example"
815 def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2):
816 # Example: see GEOM_TestAll.py
817 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
818 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
821 ## Create a circle with given center, normal vector and radius.
822 # @param thePnt Circle center.
823 # @param theVec Vector, normal to the plane of the circle.
824 # @param theR Circle radius.
825 # @return New GEOM_Object, containing the created circle.
827 # @ref tui_creation_circle "Example"
828 def MakeCircle(self, thePnt, theVec, theR):
829 # Example: see GEOM_TestAll.py
830 theR, Parameters = ParseParameters(theR)
831 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
832 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
833 anObj.SetParameters(Parameters)
836 ## Create a circle with given radius.
837 # Center of the circle will be in the origin of global
838 # coordinate system and normal vector will be codirected with Z axis
839 # @param theR Circle radius.
840 # @return New GEOM_Object, containing the created circle.
841 def MakeCircleR(self, theR):
842 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
843 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
846 ## Create a circle, passing through three given points
847 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
848 # @return New GEOM_Object, containing the created circle.
850 # @ref tui_creation_circle "Example"
851 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
852 # Example: see GEOM_TestAll.py
853 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
854 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
857 ## Create a circle, with given point1 as center,
858 # passing through the point2 as radius and laying in the plane,
859 # defined by all three given points.
860 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
861 # @return New GEOM_Object, containing the created circle.
863 # @ref swig_MakeCircle "Example"
864 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
865 # Example: see GEOM_example6.py
866 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
867 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
870 ## Create an ellipse with given center, normal vector and radiuses.
871 # @param thePnt Ellipse center.
872 # @param theVec Vector, normal to the plane of the ellipse.
873 # @param theRMajor Major ellipse radius.
874 # @param theRMinor Minor ellipse radius.
875 # @param theVecMaj Vector, direction of the ellipse's main axis.
876 # @return New GEOM_Object, containing the created ellipse.
878 # @ref tui_creation_ellipse "Example"
879 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None):
880 # Example: see GEOM_TestAll.py
881 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
882 if theVecMaj is not None:
883 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
885 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
887 RaiseIfFailed("MakeEllipse", self.CurvesOp)
888 anObj.SetParameters(Parameters)
891 ## Create an ellipse with given radiuses.
892 # Center of the ellipse will be in the origin of global
893 # coordinate system and normal vector will be codirected with Z axis
894 # @param theRMajor Major ellipse radius.
895 # @param theRMinor Minor ellipse radius.
896 # @return New GEOM_Object, containing the created ellipse.
897 def MakeEllipseRR(self, theRMajor, theRMinor):
898 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
899 RaiseIfFailed("MakeEllipse", self.CurvesOp)
902 ## Create a polyline on the set of points.
903 # @param thePoints Sequence of points for the polyline.
904 # @param theIsClosed If True, build a closed wire.
905 # @return New GEOM_Object, containing the created polyline.
907 # @ref tui_creation_curve "Example"
908 def MakePolyline(self, thePoints, theIsClosed=False):
909 # Example: see GEOM_TestAll.py
910 anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
911 RaiseIfFailed("MakePolyline", self.CurvesOp)
914 ## Create bezier curve on the set of points.
915 # @param thePoints Sequence of points for the bezier curve.
916 # @param theIsClosed If True, build a closed curve.
917 # @return New GEOM_Object, containing the created bezier curve.
919 # @ref tui_creation_curve "Example"
920 def MakeBezier(self, thePoints, theIsClosed=False):
921 # Example: see GEOM_TestAll.py
922 anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
923 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
926 ## Create B-Spline curve on the set of points.
927 # @param thePoints Sequence of points for the B-Spline curve.
928 # @param theIsClosed If True, build a closed curve.
929 # @param theDoReordering If TRUE, the algo does not follow the order of
930 # \a thePoints but searches for the closest vertex.
931 # @return New GEOM_Object, containing the created B-Spline curve.
933 # @ref tui_creation_curve "Example"
934 def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False):
935 # Example: see GEOM_TestAll.py
936 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
937 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
943 ## @addtogroup l3_sketcher
946 ## Create a sketcher (wire or face), following the textual description,
947 # passed through <VAR>theCommand</VAR> argument. \n
948 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
949 # Format of the description string have to be the following:
951 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
954 # - x1, y1 are coordinates of the first sketcher point (zero by default),
956 # - "R angle" : Set the direction by angle
957 # - "D dx dy" : Set the direction by DX & DY
960 # - "TT x y" : Create segment by point at X & Y
961 # - "T dx dy" : Create segment by point with DX & DY
962 # - "L length" : Create segment by direction & Length
963 # - "IX x" : Create segment by direction & Intersect. X
964 # - "IY y" : Create segment by direction & Intersect. Y
967 # - "C radius length" : Create arc by direction, radius and length(in degree)
968 # - "AA x y": Create arc by point at X & Y
969 # - "A dx dy" : Create arc by point with DX & DY
970 # - "A dx dy" : Create arc by point with DX & DY
971 # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
972 # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
973 # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
974 # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
977 # - "WW" : Close Wire (to finish)
978 # - "WF" : Close Wire and build face (to finish)
981 # - Flag1 (= reverse) is 0 or 2 ...
982 # - if 0 the drawn arc is the one of lower angle (< Pi)
983 # - if 2 the drawn arc ius the one of greater angle (> Pi)
986 # - Flag2 (= control tolerance) is 0 or 1 ...
987 # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
988 # - if 1 the wire is built only if the end point is on the arc
989 # with a tolerance of 10^-7 on the distance else the creation fails
991 # @param theCommand String, defining the sketcher in local
992 # coordinates of the working plane.
993 # @param theWorkingPlane Nine double values, defining origin,
994 # OZ and OX directions of the working plane.
995 # @return New GEOM_Object, containing the created wire.
997 # @ref tui_sketcher_page "Example"
998 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
999 # Example: see GEOM_TestAll.py
1000 theCommand,Parameters = ParseSketcherCommand(theCommand)
1001 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
1002 RaiseIfFailed("MakeSketcher", self.CurvesOp)
1003 anObj.SetParameters(Parameters)
1006 ## Create a sketcher (wire or face), following the textual description,
1007 # passed through <VAR>theCommand</VAR> argument. \n
1008 # For format of the description string see the previous method.\n
1009 # @param theCommand String, defining the sketcher in local
1010 # coordinates of the working plane.
1011 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
1012 # @return New GEOM_Object, containing the created wire.
1014 # @ref tui_sketcher_page "Example"
1015 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
1016 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
1017 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
1020 ## Create a sketcher wire, following the numerical description,
1021 # passed through <VAR>theCoordinates</VAR> argument. \n
1022 # @param theCoordinates double values, defining points to create a wire,
1024 # @return New GEOM_Object, containing the created wire.
1026 # @ref tui_sketcher_page "Example"
1027 def Make3DSketcher(self, theCoordinates):
1028 theCoordinates,Parameters = ParseParameters(theCoordinates)
1029 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
1030 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
1031 anObj.SetParameters(Parameters)
1034 # end of l3_sketcher
1037 ## @addtogroup l3_3d_primitives
1040 ## Create a box by coordinates of two opposite vertices.
1042 # @ref tui_creation_box "Example"
1043 def MakeBox(self,x1,y1,z1,x2,y2,z2):
1044 # Example: see GEOM_TestAll.py
1045 pnt1 = self.MakeVertex(x1,y1,z1)
1046 pnt2 = self.MakeVertex(x2,y2,z2)
1047 return self.MakeBoxTwoPnt(pnt1,pnt2)
1049 ## Create a box with specified dimensions along the coordinate axes
1050 # and with edges, parallel to the coordinate axes.
1051 # Center of the box will be at point (DX/2, DY/2, DZ/2).
1052 # @param theDX Length of Box edges, parallel to OX axis.
1053 # @param theDY Length of Box edges, parallel to OY axis.
1054 # @param theDZ Length of Box edges, parallel to OZ axis.
1055 # @return New GEOM_Object, containing the created box.
1057 # @ref tui_creation_box "Example"
1058 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
1059 # Example: see GEOM_TestAll.py
1060 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1061 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
1062 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
1063 anObj.SetParameters(Parameters)
1066 ## Create a box with two specified opposite vertices,
1067 # and with edges, parallel to the coordinate axes
1068 # @param thePnt1 First of two opposite vertices.
1069 # @param thePnt2 Second of two opposite vertices.
1070 # @return New GEOM_Object, containing the created box.
1072 # @ref tui_creation_box "Example"
1073 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
1074 # Example: see GEOM_TestAll.py
1075 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
1076 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
1079 ## Create a face with specified dimensions along OX-OY coordinate axes,
1080 # with edges, parallel to this coordinate axes.
1081 # @param theH height of Face.
1082 # @param theW width of Face.
1083 # @param theOrientation orientation belong axis OXY OYZ OZX
1084 # @return New GEOM_Object, containing the created face.
1086 # @ref tui_creation_face "Example"
1087 def MakeFaceHW(self,theH, theW, theOrientation):
1088 # Example: see GEOM_TestAll.py
1089 theH,theW,Parameters = ParseParameters(theH, theW)
1090 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
1091 RaiseIfFailed("MakeFaceHW", self.PrimOp)
1092 anObj.SetParameters(Parameters)
1095 ## Create a face from another plane and two sizes,
1096 # vertical size and horisontal size.
1097 # @param theObj Normale vector to the creating face or
1099 # @param theH Height (vertical size).
1100 # @param theW Width (horisontal size).
1101 # @return New GEOM_Object, containing the created face.
1103 # @ref tui_creation_face "Example"
1104 def MakeFaceObjHW(self, theObj, theH, theW):
1105 # Example: see GEOM_TestAll.py
1106 theH,theW,Parameters = ParseParameters(theH, theW)
1107 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
1108 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
1109 anObj.SetParameters(Parameters)
1112 ## Create a disk with given center, normal vector and radius.
1113 # @param thePnt Disk center.
1114 # @param theVec Vector, normal to the plane of the disk.
1115 # @param theR Disk radius.
1116 # @return New GEOM_Object, containing the created disk.
1118 # @ref tui_creation_disk "Example"
1119 def MakeDiskPntVecR(self,thePnt, theVec, theR):
1120 # Example: see GEOM_TestAll.py
1121 theR,Parameters = ParseParameters(theR)
1122 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
1123 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
1124 anObj.SetParameters(Parameters)
1127 ## Create a disk, passing through three given points
1128 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
1129 # @return New GEOM_Object, containing the created disk.
1131 # @ref tui_creation_disk "Example"
1132 def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3):
1133 # Example: see GEOM_TestAll.py
1134 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
1135 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
1138 ## Create a disk with specified dimensions along OX-OY coordinate axes.
1139 # @param theR Radius of Face.
1140 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
1141 # @return New GEOM_Object, containing the created disk.
1143 # @ref tui_creation_face "Example"
1144 def MakeDiskR(self,theR, theOrientation):
1145 # Example: see GEOM_TestAll.py
1146 theR,Parameters = ParseParameters(theR)
1147 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
1148 RaiseIfFailed("MakeDiskR", self.PrimOp)
1149 anObj.SetParameters(Parameters)
1152 ## Create a cylinder with given base point, axis, radius and height.
1153 # @param thePnt Central point of cylinder base.
1154 # @param theAxis Cylinder axis.
1155 # @param theR Cylinder radius.
1156 # @param theH Cylinder height.
1157 # @return New GEOM_Object, containing the created cylinder.
1159 # @ref tui_creation_cylinder "Example"
1160 def MakeCylinder(self,thePnt, theAxis, theR, theH):
1161 # Example: see GEOM_TestAll.py
1162 theR,theH,Parameters = ParseParameters(theR, theH)
1163 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
1164 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
1165 anObj.SetParameters(Parameters)
1168 ## Create a cylinder with given radius and height at
1169 # the origin of coordinate system. Axis of the cylinder
1170 # will be collinear to the OZ axis of the coordinate system.
1171 # @param theR Cylinder radius.
1172 # @param theH Cylinder height.
1173 # @return New GEOM_Object, containing the created cylinder.
1175 # @ref tui_creation_cylinder "Example"
1176 def MakeCylinderRH(self,theR, theH):
1177 # Example: see GEOM_TestAll.py
1178 theR,theH,Parameters = ParseParameters(theR, theH)
1179 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
1180 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
1181 anObj.SetParameters(Parameters)
1184 ## Create a sphere with given center and radius.
1185 # @param thePnt Sphere center.
1186 # @param theR Sphere radius.
1187 # @return New GEOM_Object, containing the created sphere.
1189 # @ref tui_creation_sphere "Example"
1190 def MakeSpherePntR(self, thePnt, theR):
1191 # Example: see GEOM_TestAll.py
1192 theR,Parameters = ParseParameters(theR)
1193 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
1194 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
1195 anObj.SetParameters(Parameters)
1198 ## Create a sphere with given center and radius.
1199 # @param x,y,z Coordinates of sphere center.
1200 # @param theR Sphere radius.
1201 # @return New GEOM_Object, containing the created sphere.
1203 # @ref tui_creation_sphere "Example"
1204 def MakeSphere(self, x, y, z, theR):
1205 # Example: see GEOM_TestAll.py
1206 point = self.MakeVertex(x, y, z)
1207 anObj = self.MakeSpherePntR(point, theR)
1210 ## Create a sphere with given radius at the origin of coordinate system.
1211 # @param theR Sphere radius.
1212 # @return New GEOM_Object, containing the created sphere.
1214 # @ref tui_creation_sphere "Example"
1215 def MakeSphereR(self, theR):
1216 # Example: see GEOM_TestAll.py
1217 theR,Parameters = ParseParameters(theR)
1218 anObj = self.PrimOp.MakeSphereR(theR)
1219 RaiseIfFailed("MakeSphereR", self.PrimOp)
1220 anObj.SetParameters(Parameters)
1223 ## Create a cone with given base point, axis, height and radiuses.
1224 # @param thePnt Central point of the first cone base.
1225 # @param theAxis Cone axis.
1226 # @param theR1 Radius of the first cone base.
1227 # @param theR2 Radius of the second cone base.
1228 # \note If both radiuses are non-zero, the cone will be truncated.
1229 # \note If the radiuses are equal, a cylinder will be created instead.
1230 # @param theH Cone height.
1231 # @return New GEOM_Object, containing the created cone.
1233 # @ref tui_creation_cone "Example"
1234 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
1235 # Example: see GEOM_TestAll.py
1236 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1237 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
1238 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
1239 anObj.SetParameters(Parameters)
1242 ## Create a cone with given height and radiuses at
1243 # the origin of coordinate system. Axis of the cone will
1244 # be collinear to the OZ axis of the coordinate system.
1245 # @param theR1 Radius of the first cone base.
1246 # @param theR2 Radius of the second cone base.
1247 # \note If both radiuses are non-zero, the cone will be truncated.
1248 # \note If the radiuses are equal, a cylinder will be created instead.
1249 # @param theH Cone height.
1250 # @return New GEOM_Object, containing the created cone.
1252 # @ref tui_creation_cone "Example"
1253 def MakeConeR1R2H(self,theR1, theR2, theH):
1254 # Example: see GEOM_TestAll.py
1255 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1256 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
1257 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
1258 anObj.SetParameters(Parameters)
1261 ## Create a torus with given center, normal vector and radiuses.
1262 # @param thePnt Torus central point.
1263 # @param theVec Torus axis of symmetry.
1264 # @param theRMajor Torus major radius.
1265 # @param theRMinor Torus minor radius.
1266 # @return New GEOM_Object, containing the created torus.
1268 # @ref tui_creation_torus "Example"
1269 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
1270 # Example: see GEOM_TestAll.py
1271 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1272 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
1273 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
1274 anObj.SetParameters(Parameters)
1277 ## Create a torus with given radiuses at the origin of coordinate system.
1278 # @param theRMajor Torus major radius.
1279 # @param theRMinor Torus minor radius.
1280 # @return New GEOM_Object, containing the created torus.
1282 # @ref tui_creation_torus "Example"
1283 def MakeTorusRR(self, theRMajor, theRMinor):
1284 # Example: see GEOM_TestAll.py
1285 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1286 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
1287 RaiseIfFailed("MakeTorusRR", self.PrimOp)
1288 anObj.SetParameters(Parameters)
1291 # end of l3_3d_primitives
1294 ## @addtogroup l3_complex
1297 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
1298 # @param theBase Base shape to be extruded.
1299 # @param thePoint1 First end of extrusion vector.
1300 # @param thePoint2 Second end of extrusion vector.
1301 # @param theScaleFactor Use it to make prism with scaled second base.
1302 # Nagative value means not scaled second base.
1303 # @return New GEOM_Object, containing the created prism.
1305 # @ref tui_creation_prism "Example"
1306 def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0):
1307 # Example: see GEOM_TestAll.py
1310 if theScaleFactor > 0:
1311 theScaleFactor,Parameters = ParseParameters(theScaleFactor)
1312 anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor)
1314 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
1315 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1316 anObj.SetParameters(Parameters)
1319 ## Create a shape by extrusion of the base shape along a
1320 # vector, defined by two points, in 2 Ways (forward/backward).
1321 # @param theBase Base shape to be extruded.
1322 # @param thePoint1 First end of extrusion vector.
1323 # @param thePoint2 Second end of extrusion vector.
1324 # @return New GEOM_Object, containing the created prism.
1326 # @ref tui_creation_prism "Example"
1327 def MakePrism2Ways(self, theBase, thePoint1, thePoint2):
1328 # Example: see GEOM_TestAll.py
1329 anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
1330 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1333 ## Create a shape by extrusion of the base shape along the vector,
1334 # i.e. all the space, transfixed by the base shape during its translation
1335 # along the vector on the given distance.
1336 # @param theBase Base shape to be extruded.
1337 # @param theVec Direction of extrusion.
1338 # @param theH Prism dimension along theVec.
1339 # @param theScaleFactor Use it to make prism with scaled second base.
1340 # Nagative value means not scaled second base.
1341 # @return New GEOM_Object, containing the created prism.
1343 # @ref tui_creation_prism "Example"
1344 def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0):
1345 # Example: see GEOM_TestAll.py
1348 if theScaleFactor > 0:
1349 theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor)
1350 anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor)
1352 theH,Parameters = ParseParameters(theH)
1353 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
1354 RaiseIfFailed("MakePrismVecH", self.PrimOp)
1355 anObj.SetParameters(Parameters)
1358 ## Create a shape by extrusion of the base shape along the vector,
1359 # i.e. all the space, transfixed by the base shape during its translation
1360 # along the vector on the given distance in 2 Ways (forward/backward).
1361 # @param theBase Base shape to be extruded.
1362 # @param theVec Direction of extrusion.
1363 # @param theH Prism dimension along theVec in forward direction.
1364 # @return New GEOM_Object, containing the created prism.
1366 # @ref tui_creation_prism "Example"
1367 def MakePrismVecH2Ways(self, theBase, theVec, theH):
1368 # Example: see GEOM_TestAll.py
1369 theH,Parameters = ParseParameters(theH)
1370 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
1371 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
1372 anObj.SetParameters(Parameters)
1375 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1376 # @param theBase Base shape to be extruded.
1377 # @param theDX, theDY, theDZ Directions of extrusion.
1378 # @param theScaleFactor Use it to make prism with scaled second base.
1379 # Nagative value means not scaled second base.
1380 # @return New GEOM_Object, containing the created prism.
1382 # @ref tui_creation_prism "Example"
1383 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0):
1384 # Example: see GEOM_TestAll.py
1387 if theScaleFactor > 0:
1388 theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor)
1389 anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor)
1391 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1392 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
1393 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
1394 anObj.SetParameters(Parameters)
1397 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1398 # i.e. all the space, transfixed by the base shape during its translation
1399 # along the vector on the given distance in 2 Ways (forward/backward).
1400 # @param theBase Base shape to be extruded.
1401 # @param theDX, theDY, theDZ Directions of extrusion.
1402 # @return New GEOM_Object, containing the created prism.
1404 # @ref tui_creation_prism "Example"
1405 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
1406 # Example: see GEOM_TestAll.py
1407 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1408 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
1409 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
1410 anObj.SetParameters(Parameters)
1413 ## Create a shape by revolution of the base shape around the axis
1414 # on the given angle, i.e. all the space, transfixed by the base
1415 # shape during its rotation around the axis on the given angle.
1416 # @param theBase Base shape to be rotated.
1417 # @param theAxis Rotation axis.
1418 # @param theAngle Rotation angle in radians.
1419 # @return New GEOM_Object, containing the created revolution.
1421 # @ref tui_creation_revolution "Example"
1422 def MakeRevolution(self, theBase, theAxis, theAngle):
1423 # Example: see GEOM_TestAll.py
1424 theAngle,Parameters = ParseParameters(theAngle)
1425 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
1426 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
1427 anObj.SetParameters(Parameters)
1430 ## The Same Revolution but in both ways forward&backward.
1431 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
1432 theAngle,Parameters = ParseParameters(theAngle)
1433 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
1434 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
1435 anObj.SetParameters(Parameters)
1438 ## Create a filling from the given compound of contours.
1439 # @param theShape the compound of contours
1440 # @param theMinDeg a minimal degree of BSpline surface to create
1441 # @param theMaxDeg a maximal degree of BSpline surface to create
1442 # @param theTol2D a 2d tolerance to be reached
1443 # @param theTol3D a 3d tolerance to be reached
1444 # @param theNbIter a number of iteration of approximation algorithm
1445 # @param theMethod Kind of method to perform filling operation:
1446 # GEOM.FOM_Default - Default - standard behaviour
1447 # /GEOM.FOM_UseOri - Use edges orientation - orientation of edges is
1448 # used: if the edge is reversed, the curve from this edge
1449 # is reversed before using it in the filling algorithm.
1450 # /GEOM.FOM_AutoCorrect - Auto-correct orientation - changes the orientation
1451 # of the curves using minimization of sum of distances
1452 # between the end points of the edges.
1453 # @param isApprox if True, BSpline curves are generated in the process
1454 # of surface construction. By default it is False, that means
1455 # the surface is created using Besier curves. The usage of
1456 # Approximation makes the algorithm work slower, but allows
1457 # building the surface for rather complex cases
1458 # @return New GEOM_Object, containing the created filling surface.
1460 # @ref tui_creation_filling "Example"
1461 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D,
1462 theTol3D, theNbIter, theMethod=GEOM.FOM_Default, isApprox=0):
1463 # Example: see GEOM_TestAll.py
1464 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
1465 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
1466 theTol2D, theTol3D, theNbIter,
1467 theMethod, isApprox)
1468 RaiseIfFailed("MakeFilling", self.PrimOp)
1469 anObj.SetParameters(Parameters)
1472 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
1473 # @param theSeqSections - set of specified sections.
1474 # @param theModeSolid - mode defining building solid or shell
1475 # @param thePreci - precision 3D used for smoothing by default 1.e-6
1476 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
1477 # @return New GEOM_Object, containing the created shell or solid.
1479 # @ref swig_todo "Example"
1480 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
1481 # Example: see GEOM_TestAll.py
1482 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
1483 RaiseIfFailed("MakeThruSections", self.PrimOp)
1486 ## Create a shape by extrusion of the base shape along
1487 # the path shape. The path shape can be a wire or an edge.
1488 # @param theBase Base shape to be extruded.
1489 # @param thePath Path shape to extrude the base shape along it.
1490 # @return New GEOM_Object, containing the created pipe.
1492 # @ref tui_creation_pipe "Example"
1493 def MakePipe(self,theBase, thePath):
1494 # Example: see GEOM_TestAll.py
1495 anObj = self.PrimOp.MakePipe(theBase, thePath)
1496 RaiseIfFailed("MakePipe", self.PrimOp)
1499 ## Create a shape by extrusion of the profile shape along
1500 # the path shape. The path shape can be a wire or an edge.
1501 # the several profiles can be specified in the several locations of path.
1502 # @param theSeqBases - list of Bases shape to be extruded.
1503 # @param theLocations - list of locations on the path corresponding
1504 # specified list of the Bases shapes. Number of locations
1505 # should be equal to number of bases or list of locations can be empty.
1506 # @param thePath - Path shape to extrude the base shape along it.
1507 # @param theWithContact - the mode defining that the section is translated to be in
1508 # contact with the spine.
1509 # @param theWithCorrection - defining that the section is rotated to be
1510 # orthogonal to the spine tangent in the correspondent point
1511 # @return New GEOM_Object, containing the created pipe.
1513 # @ref tui_creation_pipe_with_diff_sec "Example"
1514 def MakePipeWithDifferentSections(self, theSeqBases,
1515 theLocations, thePath,
1516 theWithContact, theWithCorrection):
1517 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
1518 theLocations, thePath,
1519 theWithContact, theWithCorrection)
1520 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
1523 ## Create a shape by extrusion of the profile shape along
1524 # the path shape. The path shape can be a wire or a edge.
1525 # the several profiles can be specified in the several locations of path.
1526 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
1527 # shell or face. If number of faces in neighbour sections
1528 # aren't coincided result solid between such sections will
1529 # be created using external boundaries of this shells.
1530 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
1531 # This list is used for searching correspondences between
1532 # faces in the sections. Size of this list must be equal
1533 # to size of list of base shapes.
1534 # @param theLocations - list of locations on the path corresponding
1535 # specified list of the Bases shapes. Number of locations
1536 # should be equal to number of bases. First and last
1537 # locations must be coincided with first and last vertexes
1538 # of path correspondingly.
1539 # @param thePath - Path shape to extrude the base shape along it.
1540 # @param theWithContact - the mode defining that the section is translated to be in
1541 # contact with the spine.
1542 # @param theWithCorrection - defining that the section is rotated to be
1543 # orthogonal to the spine tangent in the correspondent point
1544 # @return New GEOM_Object, containing the created solids.
1546 # @ref tui_creation_pipe_with_shell_sec "Example"
1547 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
1548 theLocations, thePath,
1549 theWithContact, theWithCorrection):
1550 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
1551 theLocations, thePath,
1552 theWithContact, theWithCorrection)
1553 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1556 ## Create a shape by extrusion of the profile shape along
1557 # the path shape. This function is used only for debug pipe
1558 # functionality - it is a version of previous function
1559 # (MakePipeWithShellSections(...)) which give a possibility to
1560 # recieve information about creating pipe between each pair of
1561 # sections step by step.
1562 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
1563 theLocations, thePath,
1564 theWithContact, theWithCorrection):
1566 nbsect = len(theSeqBases)
1567 nbsubsect = len(theSeqSubBases)
1568 #print "nbsect = ",nbsect
1569 for i in range(1,nbsect):
1571 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
1572 tmpLocations = [ theLocations[i-1], theLocations[i] ]
1574 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
1575 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
1576 tmpLocations, thePath,
1577 theWithContact, theWithCorrection)
1578 if self.PrimOp.IsDone() == 0:
1579 print "Problems with pipe creation between ",i," and ",i+1," sections"
1580 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1583 print "Pipe between ",i," and ",i+1," sections is OK"
1588 resc = self.MakeCompound(res)
1589 #resc = self.MakeSewing(res, 0.001)
1590 #print "resc: ",resc
1593 ## Create solids between given sections
1594 # @param theSeqBases - list of sections (shell or face).
1595 # @param theLocations - list of corresponding vertexes
1596 # @return New GEOM_Object, containing the created solids.
1598 # @ref tui_creation_pipe_without_path "Example"
1599 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1600 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1601 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1604 ## Create a shape by extrusion of the base shape along
1605 # the path shape with constant bi-normal direction along the given vector.
1606 # The path shape can be a wire or an edge.
1607 # @param theBase Base shape to be extruded.
1608 # @param thePath Path shape to extrude the base shape along it.
1609 # @param theVec Vector defines a constant binormal direction to keep the
1610 # same angle beetween the direction and the sections
1611 # along the sweep surface.
1612 # @return New GEOM_Object, containing the created pipe.
1614 # @ref tui_creation_pipe "Example"
1615 def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
1616 # Example: see GEOM_TestAll.py
1617 anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
1618 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
1624 ## @addtogroup l3_advanced
1627 ## Create a linear edge with specified ends.
1628 # @param thePnt1 Point for the first end of edge.
1629 # @param thePnt2 Point for the second end of edge.
1630 # @return New GEOM_Object, containing the created edge.
1632 # @ref tui_creation_edge "Example"
1633 def MakeEdge(self,thePnt1, thePnt2):
1634 # Example: see GEOM_TestAll.py
1635 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1636 RaiseIfFailed("MakeEdge", self.ShapesOp)
1639 ## Create an edge from specified wire.
1640 # @param theWire source Wire.
1641 # @param theLinearTolerance linear tolerance value.
1642 # @param theAngularTolerance angular tolerance value.
1643 # @return New GEOM_Object, containing the created edge.
1645 # @ref tui_creation_edge "Example"
1646 def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12):
1647 # Example: see GEOM_TestAll.py
1648 anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
1649 RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
1652 ## Create a wire from the set of edges and wires.
1653 # @param theEdgesAndWires List of edges and/or wires.
1654 # @param theTolerance Maximum distance between vertices, that will be merged.
1655 # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
1656 # @return New GEOM_Object, containing the created wire.
1658 # @ref tui_creation_wire "Example"
1659 def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07):
1660 # Example: see GEOM_TestAll.py
1661 anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
1662 RaiseIfFailed("MakeWire", self.ShapesOp)
1665 ## Create a face on the given wire.
1666 # @param theWire closed Wire or Edge to build the face on.
1667 # @param isPlanarWanted If TRUE, only planar face will be built.
1668 # If impossible, NULL object will be returned.
1669 # @return New GEOM_Object, containing the created face.
1671 # @ref tui_creation_face "Example"
1672 def MakeFace(self,theWire, isPlanarWanted):
1673 # Example: see GEOM_TestAll.py
1674 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1675 RaiseIfFailed("MakeFace", self.ShapesOp)
1678 ## Create a face on the given wires set.
1679 # @param theWires List of closed wires or edges to build the face on.
1680 # @param isPlanarWanted If TRUE, only planar face will be built.
1681 # If impossible, NULL object will be returned.
1682 # @return New GEOM_Object, containing the created face.
1684 # @ref tui_creation_face "Example"
1685 def MakeFaceWires(self,theWires, isPlanarWanted):
1686 # Example: see GEOM_TestAll.py
1687 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1688 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1691 ## Shortcut to MakeFaceWires()
1693 # @ref tui_creation_face "Example 1"
1694 # \n @ref swig_MakeFaces "Example 2"
1695 def MakeFaces(self,theWires, isPlanarWanted):
1696 # Example: see GEOM_TestOthers.py
1697 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1700 ## Create a shell from the set of faces and shells.
1701 # @param theFacesAndShells List of faces and/or shells.
1702 # @return New GEOM_Object, containing the created shell.
1704 # @ref tui_creation_shell "Example"
1705 def MakeShell(self,theFacesAndShells):
1706 # Example: see GEOM_TestAll.py
1707 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1708 RaiseIfFailed("MakeShell", self.ShapesOp)
1711 ## Create a solid, bounded by the given shells.
1712 # @param theShells Sequence of bounding shells.
1713 # @return New GEOM_Object, containing the created solid.
1715 # @ref tui_creation_solid "Example"
1716 def MakeSolid(self,theShells):
1717 # Example: see GEOM_TestAll.py
1718 anObj = self.ShapesOp.MakeSolidShells(theShells)
1719 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1722 ## Create a compound of the given shapes.
1723 # @param theShapes List of shapes to put in compound.
1724 # @return New GEOM_Object, containing the created compound.
1726 # @ref tui_creation_compound "Example"
1727 def MakeCompound(self,theShapes):
1728 # Example: see GEOM_TestAll.py
1729 anObj = self.ShapesOp.MakeCompound(theShapes)
1730 RaiseIfFailed("MakeCompound", self.ShapesOp)
1733 # end of l3_advanced
1736 ## @addtogroup l2_measure
1739 ## Gives quantity of faces in the given shape.
1740 # @param theShape Shape to count faces of.
1741 # @return Quantity of faces.
1743 # @ref swig_NumberOf "Example"
1744 def NumberOfFaces(self, theShape):
1745 # Example: see GEOM_TestOthers.py
1746 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1747 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1750 ## Gives quantity of edges in the given shape.
1751 # @param theShape Shape to count edges of.
1752 # @return Quantity of edges.
1754 # @ref swig_NumberOf "Example"
1755 def NumberOfEdges(self, theShape):
1756 # Example: see GEOM_TestOthers.py
1757 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1758 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1761 ## Gives quantity of subshapes of type theShapeType in the given shape.
1762 # @param theShape Shape to count subshapes of.
1763 # @param theShapeType Type of subshapes to count.
1764 # @return Quantity of subshapes of given type.
1766 # @ref swig_NumberOf "Example"
1767 def NumberOfSubShapes(self, theShape, theShapeType):
1768 # Example: see GEOM_TestOthers.py
1769 nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
1770 RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
1773 ## Gives quantity of solids in the given shape.
1774 # @param theShape Shape to count solids in.
1775 # @return Quantity of solids.
1777 # @ref swig_NumberOf "Example"
1778 def NumberOfSolids(self, theShape):
1779 # Example: see GEOM_TestOthers.py
1780 nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["SOLID"])
1781 RaiseIfFailed("NumberOfSolids", self.ShapesOp)
1787 ## @addtogroup l3_healing
1790 ## Reverses an orientation the given shape.
1791 # @param theShape Shape to be reversed.
1792 # @return The reversed copy of theShape.
1794 # @ref swig_ChangeOrientation "Example"
1795 def ChangeOrientation(self,theShape):
1796 # Example: see GEOM_TestAll.py
1797 anObj = self.ShapesOp.ChangeOrientation(theShape)
1798 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1801 ## Shortcut to ChangeOrientation()
1803 # @ref swig_OrientationChange "Example"
1804 def OrientationChange(self,theShape):
1805 # Example: see GEOM_TestOthers.py
1806 anObj = self.ChangeOrientation(theShape)
1812 ## @addtogroup l4_obtain
1815 ## Retrieve all free faces from the given shape.
1816 # Free face is a face, which is not shared between two shells of the shape.
1817 # @param theShape Shape to find free faces in.
1818 # @return List of IDs of all free faces, contained in theShape.
1820 # @ref tui_measurement_tools_page "Example"
1821 def GetFreeFacesIDs(self,theShape):
1822 # Example: see GEOM_TestOthers.py
1823 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1824 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1827 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1828 # @param theShape1 Shape to find sub-shapes in.
1829 # @param theShape2 Shape to find shared sub-shapes with.
1830 # @param theShapeType Type of sub-shapes to be retrieved.
1831 # @return List of sub-shapes of theShape1, shared with theShape2.
1833 # @ref swig_GetSharedShapes "Example"
1834 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1835 # Example: see GEOM_TestOthers.py
1836 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1837 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1840 ## Get all sub-shapes, shared by all shapes in the list <VAR>theShapes</VAR>.
1841 # @param theShapes Shapes to find common sub-shapes of.
1842 # @param theShapeType Type of sub-shapes to be retrieved.
1843 # @return List of objects, that are sub-shapes of all given shapes.
1845 # @ref swig_GetSharedShapes "Example"
1846 def GetSharedShapesMulti(self, theShapes, theShapeType):
1847 # Example: see GEOM_TestOthers.py
1848 aList = self.ShapesOp.GetSharedShapesMulti(theShapes, theShapeType)
1849 RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
1852 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1853 # situated relatively the specified plane by the certain way,
1854 # defined through <VAR>theState</VAR> parameter.
1855 # @param theShape Shape to find sub-shapes of.
1856 # @param theShapeType Type of sub-shapes to be retrieved.
1857 # @param theAx1 Vector (or line, or linear edge), specifying normal
1858 # direction and location of the plane to find shapes on.
1859 # @param theState The state of the subshapes to find. It can be one of
1860 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1861 # @return List of all found sub-shapes.
1863 # @ref swig_GetShapesOnPlane "Example"
1864 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1865 # Example: see GEOM_TestOthers.py
1866 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1867 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1870 ## Works like the above method, but returns list of sub-shapes indices
1872 # @ref swig_GetShapesOnPlaneIDs "Example"
1873 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1874 # Example: see GEOM_TestOthers.py
1875 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1876 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1879 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1880 # situated relatively the specified plane by the certain way,
1881 # defined through <VAR>theState</VAR> parameter.
1882 # @param theShape Shape to find sub-shapes of.
1883 # @param theShapeType Type of sub-shapes to be retrieved.
1884 # @param theAx1 Vector (or line, or linear edge), specifying normal
1885 # direction of the plane to find shapes on.
1886 # @param thePnt Point specifying location of the plane to find shapes on.
1887 # @param theState The state of the subshapes to find. It can be one of
1888 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1889 # @return List of all found sub-shapes.
1891 # @ref swig_GetShapesOnPlaneWithLocation "Example"
1892 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1893 # Example: see GEOM_TestOthers.py
1894 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1895 theAx1, thePnt, theState)
1896 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1899 ## Works like the above method, but returns list of sub-shapes indices
1901 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
1902 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1903 # Example: see GEOM_TestOthers.py
1904 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1905 theAx1, thePnt, theState)
1906 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1909 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1910 # the specified cylinder by the certain way, defined through \a theState parameter.
1911 # @param theShape Shape to find sub-shapes of.
1912 # @param theShapeType Type of sub-shapes to be retrieved.
1913 # @param theAxis Vector (or line, or linear edge), specifying
1914 # axis of the cylinder to find shapes on.
1915 # @param theRadius Radius of the cylinder to find shapes on.
1916 # @param theState The state of the subshapes to find. It can be one of
1917 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1918 # @return List of all found sub-shapes.
1920 # @ref swig_GetShapesOnCylinder "Example"
1921 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1922 # Example: see GEOM_TestOthers.py
1923 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1924 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1927 ## Works like the above method, but returns list of sub-shapes indices
1929 # @ref swig_GetShapesOnCylinderIDs "Example"
1930 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1931 # Example: see GEOM_TestOthers.py
1932 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1933 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1936 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1937 # the specified cylinder by the certain way, defined through \a theState parameter.
1938 # @param theShape Shape to find sub-shapes of.
1939 # @param theShapeType Type of sub-shapes to be retrieved.
1940 # @param theAxis Vector (or line, or linear edge), specifying
1941 # axis of the cylinder to find shapes on.
1942 # @param thePnt Point specifying location of the bottom of the cylinder.
1943 # @param theRadius Radius of the cylinder to find shapes on.
1944 # @param theState The state of the subshapes to find. It can be one of
1945 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1946 # @return List of all found sub-shapes.
1948 # @ref swig_GetShapesOnCylinderWithLocation "Example"
1949 def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
1950 # Example: see GEOM_TestOthers.py
1951 aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
1952 RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
1955 ## Works like the above method, but returns list of sub-shapes indices
1957 # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
1958 def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
1959 # Example: see GEOM_TestOthers.py
1960 aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
1961 RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
1964 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1965 # the specified sphere by the certain way, defined through \a theState parameter.
1966 # @param theShape Shape to find sub-shapes of.
1967 # @param theShapeType Type of sub-shapes to be retrieved.
1968 # @param theCenter Point, specifying center of the sphere to find shapes on.
1969 # @param theRadius Radius of the sphere to find shapes on.
1970 # @param theState The state of the subshapes to find. It can be one of
1971 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1972 # @return List of all found sub-shapes.
1974 # @ref swig_GetShapesOnSphere "Example"
1975 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1976 # Example: see GEOM_TestOthers.py
1977 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1978 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1981 ## Works like the above method, but returns list of sub-shapes indices
1983 # @ref swig_GetShapesOnSphereIDs "Example"
1984 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1985 # Example: see GEOM_TestOthers.py
1986 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1987 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1990 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1991 # the specified quadrangle by the certain way, defined through \a theState parameter.
1992 # @param theShape Shape to find sub-shapes of.
1993 # @param theShapeType Type of sub-shapes to be retrieved.
1994 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1995 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1996 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1997 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1998 # @param theState The state of the subshapes to find. It can be one of
1999 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2000 # @return List of all found sub-shapes.
2002 # @ref swig_GetShapesOnQuadrangle "Example"
2003 def GetShapesOnQuadrangle(self, theShape, theShapeType,
2004 theTopLeftPoint, theTopRigthPoint,
2005 theBottomLeftPoint, theBottomRigthPoint, theState):
2006 # Example: see GEOM_TestOthers.py
2007 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
2008 theTopLeftPoint, theTopRigthPoint,
2009 theBottomLeftPoint, theBottomRigthPoint, theState)
2010 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
2013 ## Works like the above method, but returns list of sub-shapes indices
2015 # @ref swig_GetShapesOnQuadrangleIDs "Example"
2016 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
2017 theTopLeftPoint, theTopRigthPoint,
2018 theBottomLeftPoint, theBottomRigthPoint, theState):
2019 # Example: see GEOM_TestOthers.py
2020 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
2021 theTopLeftPoint, theTopRigthPoint,
2022 theBottomLeftPoint, theBottomRigthPoint, theState)
2023 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
2026 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
2027 # the specified \a theBox by the certain way, defined through \a theState parameter.
2028 # @param theBox Shape for relative comparing.
2029 # @param theShape Shape to find sub-shapes of.
2030 # @param theShapeType Type of sub-shapes to be retrieved.
2031 # @param theState The state of the subshapes to find. It can be one of
2032 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2033 # @return List of all found sub-shapes.
2035 # @ref swig_GetShapesOnBox "Example"
2036 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
2037 # Example: see GEOM_TestOthers.py
2038 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
2039 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
2042 ## Works like the above method, but returns list of sub-shapes indices
2044 # @ref swig_GetShapesOnBoxIDs "Example"
2045 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
2046 # Example: see GEOM_TestOthers.py
2047 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
2048 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
2051 ## Find in \a theShape all sub-shapes of type \a theShapeType,
2052 # situated relatively the specified \a theCheckShape by the
2053 # certain way, defined through \a theState parameter.
2054 # @param theCheckShape Shape for relative comparing. It must be a solid.
2055 # @param theShape Shape to find sub-shapes of.
2056 # @param theShapeType Type of sub-shapes to be retrieved.
2057 # @param theState The state of the subshapes to find. It can be one of
2058 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
2059 # @return List of all found sub-shapes.
2061 # @ref swig_GetShapesOnShape "Example"
2062 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
2063 # Example: see GEOM_TestOthers.py
2064 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
2065 theShapeType, theState)
2066 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
2069 ## Works like the above method, but returns result as compound
2071 # @ref swig_GetShapesOnShapeAsCompound "Example"
2072 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
2073 # Example: see GEOM_TestOthers.py
2074 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
2075 theShapeType, theState)
2076 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
2079 ## Works like the above method, but returns list of sub-shapes indices
2081 # @ref swig_GetShapesOnShapeIDs "Example"
2082 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
2083 # Example: see GEOM_TestOthers.py
2084 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
2085 theShapeType, theState)
2086 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
2089 ## Get sub-shape(s) of theShapeWhere, which are
2090 # coincident with \a theShapeWhat or could be a part of it.
2091 # @param theShapeWhere Shape to find sub-shapes of.
2092 # @param theShapeWhat Shape, specifying what to find.
2093 # @return Group of all found sub-shapes or a single found sub-shape.
2095 # @note This function has a restriction on argument shapes.
2096 # If \a theShapeWhere has curved parts with significantly
2097 # outstanding centres (i.e. the mass centre of a part is closer to
2098 # \a theShapeWhat than to the part), such parts will not be found.
2099 # @image html get_in_place_lost_part.png
2101 # @ref swig_GetInPlace "Example"
2102 def GetInPlace(self, theShapeWhere, theShapeWhat):
2103 # Example: see GEOM_TestOthers.py
2104 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
2105 RaiseIfFailed("GetInPlace", self.ShapesOp)
2108 ## Get sub-shape(s) of \a theShapeWhere, which are
2109 # coincident with \a theShapeWhat or could be a part of it.
2111 # Implementation of this method is based on a saved history of an operation,
2112 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
2113 # arguments (an argument shape or a sub-shape of an argument shape).
2114 # The operation could be the Partition or one of boolean operations,
2115 # performed on simple shapes (not on compounds).
2117 # @param theShapeWhere Shape to find sub-shapes of.
2118 # @param theShapeWhat Shape, specifying what to find (must be in the
2119 # building history of the ShapeWhere).
2120 # @return Group of all found sub-shapes or a single found sub-shape.
2122 # @ref swig_GetInPlace "Example"
2123 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
2124 # Example: see GEOM_TestOthers.py
2125 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
2126 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
2129 ## Get sub-shape of theShapeWhere, which is
2130 # equal to \a theShapeWhat.
2131 # @param theShapeWhere Shape to find sub-shape of.
2132 # @param theShapeWhat Shape, specifying what to find.
2133 # @return New GEOM_Object for found sub-shape.
2135 # @ref swig_GetSame "Example"
2136 def GetSame(self,theShapeWhere, theShapeWhat):
2137 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
2138 RaiseIfFailed("GetSame", self.ShapesOp)
2144 ## @addtogroup l4_access
2147 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
2148 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
2150 # @ref swig_all_decompose "Example"
2151 def GetSubShape(self, aShape, ListOfID):
2152 # Example: see GEOM_TestAll.py
2153 anObj = self.AddSubShape(aShape,ListOfID)
2156 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
2158 # @ref swig_all_decompose "Example"
2159 def GetSubShapeID(self, aShape, aSubShape):
2160 # Example: see GEOM_TestAll.py
2161 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
2162 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
2168 ## @addtogroup l4_decompose
2171 ## Get all sub-shapes and groups of \a theShape,
2172 # that were created already by any other methods.
2173 # @param theShape Any shape.
2174 # @param theGroupsOnly If this parameter is TRUE, only groups will be
2175 # returned, else all found sub-shapes and groups.
2176 # @return List of existing sub-objects of \a theShape.
2178 # @ref swig_all_decompose "Example"
2179 def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
2180 # Example: see GEOM_TestAll.py
2181 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
2182 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
2185 ## Get all groups of \a theShape,
2186 # that were created already by any other methods.
2187 # @param theShape Any shape.
2188 # @return List of existing groups of \a theShape.
2190 # @ref swig_all_decompose "Example"
2191 def GetGroups(self, theShape):
2192 # Example: see GEOM_TestAll.py
2193 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
2194 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
2197 ## Explode a shape on subshapes of a given type.
2198 # If the shape itself matches the type, it is also returned.
2199 # @param aShape Shape to be exploded.
2200 # @param aType Type of sub-shapes to be retrieved.
2201 # @return List of sub-shapes of type theShapeType, contained in theShape.
2203 # @ref swig_all_decompose "Example"
2204 def SubShapeAll(self, aShape, aType):
2205 # Example: see GEOM_TestAll.py
2206 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, False)
2207 RaiseIfFailed("SubShapeAll", self.ShapesOp)
2210 ## Explode a shape on subshapes of a given type.
2211 # @param aShape Shape to be exploded.
2212 # @param aType Type of sub-shapes to be retrieved.
2213 # @return List of IDs of sub-shapes.
2215 # @ref swig_all_decompose "Example"
2216 def SubShapeAllIDs(self, aShape, aType):
2217 ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, False)
2218 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2221 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2222 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
2223 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2225 # @ref swig_all_decompose "Example"
2226 def SubShape(self, aShape, aType, ListOfInd):
2227 # Example: see GEOM_TestAll.py
2229 AllShapeIDsList = self.SubShapeAllIDs(aShape, aType)
2230 for ind in ListOfInd:
2231 ListOfIDs.append(AllShapeIDsList[ind - 1])
2232 anObj = self.GetSubShape(aShape, ListOfIDs)
2235 ## Explode a shape on subshapes of a given type.
2236 # Sub-shapes will be sorted by coordinates of their gravity centers.
2237 # If the shape itself matches the type, it is also returned.
2238 # @param aShape Shape to be exploded.
2239 # @param aType Type of sub-shapes to be retrieved.
2240 # @return List of sub-shapes of type theShapeType, contained in theShape.
2242 # @ref swig_SubShapeAllSorted "Example"
2243 def SubShapeAllSortedCentres(self, aShape, aType):
2244 # Example: see GEOM_TestAll.py
2245 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, aType, True)
2246 RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
2249 ## Explode a shape on subshapes of a given type.
2250 # Sub-shapes will be sorted by coordinates of their gravity centers.
2251 # @param aShape Shape to be exploded.
2252 # @param aType Type of sub-shapes to be retrieved.
2253 # @return List of IDs of sub-shapes.
2255 # @ref swig_all_decompose "Example"
2256 def SubShapeAllSortedCentresIDs(self, aShape, aType):
2257 ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, aType, True)
2258 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2261 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2262 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
2263 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2265 # @ref swig_all_decompose "Example"
2266 def SubShapeSortedCentres(self, aShape, aType, ListOfInd):
2267 # Example: see GEOM_TestAll.py
2269 AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, aType)
2270 for ind in ListOfInd:
2271 ListOfIDs.append(AllShapeIDsList[ind - 1])
2272 anObj = self.GetSubShape(aShape, ListOfIDs)
2275 ## Extract shapes (excluding the main shape) of given type.
2276 # @param aShape The shape.
2277 # @param aType The shape type.
2278 # @param isSorted Boolean flag to switch sorting on/off.
2279 # @return List of sub-shapes of type aType, contained in aShape.
2281 # @ref swig_FilletChamfer "Example"
2282 def ExtractShapes(self, aShape, aType, isSorted = False):
2283 # Example: see GEOM_TestAll.py
2284 ListObj = self.ShapesOp.ExtractSubShapes(aShape, aType, isSorted)
2285 RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
2288 # end of l4_decompose
2291 ## @addtogroup l4_decompose_d
2294 ## Deprecated method
2295 # It works like SubShapeAllSortedCentres, but wrongly
2296 # defines centres of faces, shells and solids.
2297 def SubShapeAllSorted(self, aShape, aType):
2298 ListObj = self.ShapesOp.MakeExplode(aShape, aType, True)
2299 RaiseIfFailed("MakeExplode", self.ShapesOp)
2302 ## Deprecated method
2303 # It works like SubShapeAllSortedCentresIDs, but wrongly
2304 # defines centres of faces, shells and solids.
2305 def SubShapeAllSortedIDs(self, aShape, aType):
2306 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, aType, True)
2307 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2310 ## Deprecated method
2311 # It works like SubShapeSortedCentres, but has a bug
2312 # (wrongly defines centres of faces, shells and solids).
2313 def SubShapeSorted(self, aShape, aType, ListOfInd):
2315 AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, aType)
2316 for ind in ListOfInd:
2317 ListOfIDs.append(AllShapeIDsList[ind - 1])
2318 anObj = self.GetSubShape(aShape, ListOfIDs)
2321 # end of l4_decompose_d
2324 ## @addtogroup l3_healing
2327 ## Apply a sequence of Shape Healing operators to the given object.
2328 # @param theShape Shape to be processed.
2329 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
2330 # @param theParameters List of names of parameters
2331 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
2332 # @param theValues List of values of parameters, in the same order
2333 # as parameters are listed in <VAR>theParameters</VAR> list.
2334 # @return New GEOM_Object, containing processed shape.
2336 # @ref tui_shape_processing "Example"
2337 def ProcessShape(self, theShape, theOperators, theParameters, theValues):
2338 # Example: see GEOM_TestHealing.py
2339 theValues,Parameters = ParseList(theValues)
2340 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
2341 # To avoid script failure in case of good argument shape
2342 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
2344 RaiseIfFailed("ProcessShape", self.HealOp)
2345 for string in (theOperators + theParameters):
2346 Parameters = ":" + Parameters
2348 anObj.SetParameters(Parameters)
2351 ## Remove faces from the given object (shape).
2352 # @param theObject Shape to be processed.
2353 # @param theFaces Indices of faces to be removed, if EMPTY then the method
2354 # removes ALL faces of the given object.
2355 # @return New GEOM_Object, containing processed shape.
2357 # @ref tui_suppress_faces "Example"
2358 def SuppressFaces(self,theObject, theFaces):
2359 # Example: see GEOM_TestHealing.py
2360 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
2361 RaiseIfFailed("SuppressFaces", self.HealOp)
2364 ## Sewing of some shapes into single shape.
2366 # @ref tui_sewing "Example"
2367 def MakeSewing(self, ListShape, theTolerance):
2368 # Example: see GEOM_TestHealing.py
2369 comp = self.MakeCompound(ListShape)
2370 anObj = self.Sew(comp, theTolerance)
2373 ## Sewing of the given object.
2374 # @param theObject Shape to be processed.
2375 # @param theTolerance Required tolerance value.
2376 # @return New GEOM_Object, containing processed shape.
2377 def Sew(self, theObject, theTolerance):
2378 # Example: see MakeSewing() above
2379 theTolerance,Parameters = ParseParameters(theTolerance)
2380 anObj = self.HealOp.Sew(theObject, theTolerance)
2381 RaiseIfFailed("Sew", self.HealOp)
2382 anObj.SetParameters(Parameters)
2385 ## Remove internal wires and edges from the given object (face).
2386 # @param theObject Shape to be processed.
2387 # @param theWires Indices of wires to be removed, if EMPTY then the method
2388 # removes ALL internal wires of the given object.
2389 # @return New GEOM_Object, containing processed shape.
2391 # @ref tui_suppress_internal_wires "Example"
2392 def SuppressInternalWires(self,theObject, theWires):
2393 # Example: see GEOM_TestHealing.py
2394 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
2395 RaiseIfFailed("RemoveIntWires", self.HealOp)
2398 ## Remove internal closed contours (holes) from the given object.
2399 # @param theObject Shape to be processed.
2400 # @param theWires Indices of wires to be removed, if EMPTY then the method
2401 # removes ALL internal holes of the given object
2402 # @return New GEOM_Object, containing processed shape.
2404 # @ref tui_suppress_holes "Example"
2405 def SuppressHoles(self,theObject, theWires):
2406 # Example: see GEOM_TestHealing.py
2407 anObj = self.HealOp.FillHoles(theObject, theWires)
2408 RaiseIfFailed("FillHoles", self.HealOp)
2411 ## Close an open wire.
2412 # @param theObject Shape to be processed.
2413 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
2414 # if [ ], then <VAR>theObject</VAR> itself is a wire.
2415 # @param isCommonVertex If True : closure by creation of a common vertex,
2416 # If False : closure by creation of an edge between ends.
2417 # @return New GEOM_Object, containing processed shape.
2419 # @ref tui_close_contour "Example"
2420 def CloseContour(self,theObject, theWires, isCommonVertex):
2421 # Example: see GEOM_TestHealing.py
2422 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
2423 RaiseIfFailed("CloseContour", self.HealOp)
2426 ## Addition of a point to a given edge object.
2427 # @param theObject Shape to be processed.
2428 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
2429 # if -1, then theObject itself is the edge.
2430 # @param theValue Value of parameter on edge or length parameter,
2431 # depending on \a isByParameter.
2432 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
2433 # if FALSE : \a theValue is treated as a length parameter [0..1]
2434 # @return New GEOM_Object, containing processed shape.
2436 # @ref tui_add_point_on_edge "Example"
2437 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
2438 # Example: see GEOM_TestHealing.py
2439 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
2440 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
2441 RaiseIfFailed("DivideEdge", self.HealOp)
2442 anObj.SetParameters(Parameters)
2445 ## Change orientation of the given object. Updates given shape.
2446 # @param theObject Shape to be processed.
2448 # @ref swig_todo "Example"
2449 def ChangeOrientationShell(self,theObject):
2450 theObject = self.HealOp.ChangeOrientation(theObject)
2451 RaiseIfFailed("ChangeOrientation", self.HealOp)
2454 ## Change orientation of the given object.
2455 # @param theObject Shape to be processed.
2456 # @return New GEOM_Object, containing processed shape.
2458 # @ref swig_todo "Example"
2459 def ChangeOrientationShellCopy(self, theObject):
2460 anObj = self.HealOp.ChangeOrientationCopy(theObject)
2461 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
2464 ## Try to limit tolerance of the given object by value \a theTolerance.
2465 # @param theObject Shape to be processed.
2466 # @param theTolerance Required tolerance value.
2467 # @return New GEOM_Object, containing processed shape.
2469 # @ref tui_limit_tolerance "Example"
2470 def LimitTolerance(self, theObject, theTolerance = 1e-07):
2471 anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
2472 RaiseIfFailed("LimitTolerance", self.HealOp)
2475 ## Get a list of wires (wrapped in GEOM_Object-s),
2476 # that constitute a free boundary of the given shape.
2477 # @param theObject Shape to get free boundary of.
2478 # @return [status, theClosedWires, theOpenWires]
2479 # status: FALSE, if an error(s) occured during the method execution.
2480 # theClosedWires: Closed wires on the free boundary of the given shape.
2481 # theOpenWires: Open wires on the free boundary of the given shape.
2483 # @ref tui_measurement_tools_page "Example"
2484 def GetFreeBoundary(self, theObject):
2485 # Example: see GEOM_TestHealing.py
2486 anObj = self.HealOp.GetFreeBoundary(theObject)
2487 RaiseIfFailed("GetFreeBoundary", self.HealOp)
2490 ## Replace coincident faces in theShape by one face.
2491 # @param theShape Initial shape.
2492 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
2493 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2494 # otherwise all initial shapes.
2495 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
2497 # @ref tui_glue_faces "Example"
2498 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
2499 # Example: see GEOM_Spanner.py
2500 theTolerance,Parameters = ParseParameters(theTolerance)
2501 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
2503 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
2504 anObj.SetParameters(Parameters)
2507 ## Find coincident faces in theShape for possible gluing.
2508 # @param theShape Initial shape.
2509 # @param theTolerance Maximum distance between faces,
2510 # which can be considered as coincident.
2513 # @ref swig_todo "Example"
2514 def GetGlueFaces(self, theShape, theTolerance):
2515 # Example: see GEOM_Spanner.py
2516 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
2517 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
2520 ## Replace coincident faces in theShape by one face
2521 # in compliance with given list of faces
2522 # @param theShape Initial shape.
2523 # @param theTolerance Maximum distance between faces,
2524 # which can be considered as coincident.
2525 # @param theFaces List of faces for gluing.
2526 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2527 # otherwise all initial shapes.
2528 # @return New GEOM_Object, containing a copy of theShape
2529 # without some faces.
2531 # @ref swig_todo "Example"
2532 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
2533 # Example: see GEOM_Spanner.py
2534 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
2536 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
2542 ## @addtogroup l3_boolean Boolean Operations
2545 # -----------------------------------------------------------------------------
2546 # Boolean (Common, Cut, Fuse, Section)
2547 # -----------------------------------------------------------------------------
2549 ## Perform one of boolean operations on two given shapes.
2550 # @param theShape1 First argument for boolean operation.
2551 # @param theShape2 Second argument for boolean operation.
2552 # @param theOperation Indicates the operation to be done:
2553 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
2554 # @return New GEOM_Object, containing the result shape.
2556 # @ref tui_fuse "Example"
2557 def MakeBoolean(self,theShape1, theShape2, theOperation):
2558 # Example: see GEOM_TestAll.py
2559 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
2560 RaiseIfFailed("MakeBoolean", self.BoolOp)
2563 ## Shortcut to MakeBoolean(s1, s2, 1)
2565 # @ref tui_common "Example 1"
2566 # \n @ref swig_MakeCommon "Example 2"
2567 def MakeCommon(self, s1, s2):
2568 # Example: see GEOM_TestOthers.py
2569 return self.MakeBoolean(s1, s2, 1)
2571 ## Shortcut to MakeBoolean(s1, s2, 2)
2573 # @ref tui_cut "Example 1"
2574 # \n @ref swig_MakeCommon "Example 2"
2575 def MakeCut(self, s1, s2):
2576 # Example: see GEOM_TestOthers.py
2577 return self.MakeBoolean(s1, s2, 2)
2579 ## Shortcut to MakeBoolean(s1, s2, 3)
2581 # @ref tui_fuse "Example 1"
2582 # \n @ref swig_MakeCommon "Example 2"
2583 def MakeFuse(self, s1, s2):
2584 # Example: see GEOM_TestOthers.py
2585 return self.MakeBoolean(s1, s2, 3)
2587 ## Shortcut to MakeBoolean(s1, s2, 4)
2589 # @ref tui_section "Example 1"
2590 # \n @ref swig_MakeCommon "Example 2"
2591 def MakeSection(self, s1, s2):
2592 # Example: see GEOM_TestOthers.py
2593 return self.MakeBoolean(s1, s2, 4)
2598 ## @addtogroup l3_basic_op
2601 ## Perform partition operation.
2602 # @param ListShapes Shapes to be intersected.
2603 # @param ListTools Shapes to intersect theShapes.
2604 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
2605 # in order to avoid possible intersection between shapes from
2607 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
2608 # If this parameter is set to -1 ("Auto"), most appropriate shape limit
2609 # type will be detected automatically.
2610 # @param KeepNonlimitShapes: if this parameter == 0, then only shapes of
2611 # target type (equal to Limit) are kept in the result,
2612 # else standalone shapes of lower dimension
2613 # are kept also (if they exist).
2615 # After implementation new version of PartitionAlgo (October 2006)
2616 # other parameters are ignored by current functionality. They are kept
2617 # in this function only for support old versions.
2618 # Ignored parameters:
2619 # @param ListKeepInside Shapes, outside which the results will be deleted.
2620 # Each shape from theKeepInside must belong to theShapes also.
2621 # @param ListRemoveInside Shapes, inside which the results will be deleted.
2622 # Each shape from theRemoveInside must belong to theShapes also.
2623 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
2624 # @param ListMaterials Material indices for each shape. Make sence,
2625 # only if theRemoveWebs is TRUE.
2627 # @return New GEOM_Object, containing the result shapes.
2629 # @ref tui_partition "Example"
2630 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2631 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
2632 KeepNonlimitShapes=0):
2633 # Example: see GEOM_TestAll.py
2634 if Limit == ShapeType["AUTO"]:
2635 # automatic detection of the most appropriate shape limit type
2637 for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
2638 Limit = EnumToLong(lim)
2640 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
2641 ListKeepInside, ListRemoveInside,
2642 Limit, RemoveWebs, ListMaterials,
2643 KeepNonlimitShapes);
2644 RaiseIfFailed("MakePartition", self.BoolOp)
2647 ## Perform partition operation.
2648 # This method may be useful if it is needed to make a partition for
2649 # compound contains nonintersected shapes. Performance will be better
2650 # since intersection between shapes from compound is not performed.
2652 # Description of all parameters as in previous method MakePartition()
2654 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
2655 # have to consist of nonintersecting shapes.
2657 # @return New GEOM_Object, containing the result shapes.
2659 # @ref swig_todo "Example"
2660 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
2661 ListKeepInside=[], ListRemoveInside=[],
2662 Limit=ShapeType["AUTO"], RemoveWebs=0,
2663 ListMaterials=[], KeepNonlimitShapes=0):
2664 if Limit == ShapeType["AUTO"]:
2665 # automatic detection of the most appropriate shape limit type
2667 for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
2668 Limit = EnumToLong(lim)
2670 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
2671 ListKeepInside, ListRemoveInside,
2672 Limit, RemoveWebs, ListMaterials,
2673 KeepNonlimitShapes);
2674 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
2677 ## Shortcut to MakePartition()
2679 # @ref tui_partition "Example 1"
2680 # \n @ref swig_Partition "Example 2"
2681 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2682 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
2683 KeepNonlimitShapes=0):
2684 # Example: see GEOM_TestOthers.py
2685 anObj = self.MakePartition(ListShapes, ListTools,
2686 ListKeepInside, ListRemoveInside,
2687 Limit, RemoveWebs, ListMaterials,
2688 KeepNonlimitShapes);
2691 ## Perform partition of the Shape with the Plane
2692 # @param theShape Shape to be intersected.
2693 # @param thePlane Tool shape, to intersect theShape.
2694 # @return New GEOM_Object, containing the result shape.
2696 # @ref tui_partition "Example"
2697 def MakeHalfPartition(self,theShape, thePlane):
2698 # Example: see GEOM_TestAll.py
2699 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
2700 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
2703 # end of l3_basic_op
2706 ## @addtogroup l3_transform
2709 ## Translate the given object along the vector, specified
2710 # by its end points, creating its copy before the translation.
2711 # @param theObject The object to be translated.
2712 # @param thePoint1 Start point of translation vector.
2713 # @param thePoint2 End point of translation vector.
2714 # @return New GEOM_Object, containing the translated object.
2716 # @ref tui_translation "Example 1"
2717 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
2718 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
2719 # Example: see GEOM_TestAll.py
2720 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
2721 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
2724 ## Translate the given object along the vector, specified by its components.
2725 # @param theObject The object to be translated.
2726 # @param theDX,theDY,theDZ Components of translation vector.
2727 # @return Translated GEOM_Object.
2729 # @ref tui_translation "Example"
2730 def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ):
2731 # Example: see GEOM_TestAll.py
2732 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2733 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
2734 anObj.SetParameters(Parameters)
2735 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2738 ## Translate the given object along the vector, specified
2739 # by its components, creating its copy before the translation.
2740 # @param theObject The object to be translated.
2741 # @param theDX,theDY,theDZ Components of translation vector.
2742 # @return New GEOM_Object, containing the translated object.
2744 # @ref tui_translation "Example"
2745 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
2746 # Example: see GEOM_TestAll.py
2747 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2748 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
2749 anObj.SetParameters(Parameters)
2750 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2753 ## Translate the given object along the given vector,
2754 # creating its copy before the translation.
2755 # @param theObject The object to be translated.
2756 # @param theVector The translation vector.
2757 # @return New GEOM_Object, containing the translated object.
2759 # @ref tui_translation "Example"
2760 def MakeTranslationVector(self,theObject, theVector):
2761 # Example: see GEOM_TestAll.py
2762 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
2763 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
2766 ## Translate the given object along the given vector on given distance.
2767 # @param theObject The object to be translated.
2768 # @param theVector The translation vector.
2769 # @param theDistance The translation distance.
2770 # @param theCopy Flag used to translate object itself or create a copy.
2771 # @return Translated GEOM_Object.
2773 # @ref tui_translation "Example"
2774 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy):
2775 # Example: see GEOM_TestAll.py
2776 theDistance,Parameters = ParseParameters(theDistance)
2777 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
2778 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2779 anObj.SetParameters(Parameters)
2782 ## Translate the given object along the given vector on given distance,
2783 # creating its copy before the translation.
2784 # @param theObject The object to be translated.
2785 # @param theVector The translation vector.
2786 # @param theDistance The translation distance.
2787 # @return New GEOM_Object, containing the translated object.
2789 # @ref tui_translation "Example"
2790 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
2791 # Example: see GEOM_TestAll.py
2792 theDistance,Parameters = ParseParameters(theDistance)
2793 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
2794 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2795 anObj.SetParameters(Parameters)
2798 ## Rotate the given object around the given axis on the given angle.
2799 # @param theObject The object to be rotated.
2800 # @param theAxis Rotation axis.
2801 # @param theAngle Rotation angle in radians.
2802 # @return Rotated GEOM_Object.
2804 # @ref tui_rotation "Example"
2805 def Rotate(self,theObject, theAxis, theAngle):
2806 # Example: see GEOM_TestAll.py
2808 if isinstance(theAngle,str):
2810 theAngle, Parameters = ParseParameters(theAngle)
2812 theAngle = theAngle*math.pi/180.0
2813 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
2814 RaiseIfFailed("RotateCopy", self.TrsfOp)
2815 anObj.SetParameters(Parameters)
2818 ## Rotate the given object around the given axis
2819 # on the given angle, creating its copy before the rotatation.
2820 # @param theObject The object to be rotated.
2821 # @param theAxis Rotation axis.
2822 # @param theAngle Rotation angle in radians.
2823 # @return New GEOM_Object, containing the rotated object.
2825 # @ref tui_rotation "Example"
2826 def MakeRotation(self,theObject, theAxis, theAngle):
2827 # Example: see GEOM_TestAll.py
2829 if isinstance(theAngle,str):
2831 theAngle, Parameters = ParseParameters(theAngle)
2833 theAngle = theAngle*math.pi/180.0
2834 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
2835 RaiseIfFailed("RotateCopy", self.TrsfOp)
2836 anObj.SetParameters(Parameters)
2839 ## Rotate given object around vector perpendicular to plane
2840 # containing three points, creating its copy before the rotatation.
2841 # @param theObject The object to be rotated.
2842 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
2843 # containing the three points.
2844 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
2845 # @return New GEOM_Object, containing the rotated object.
2847 # @ref tui_rotation "Example"
2848 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
2849 # Example: see GEOM_TestAll.py
2850 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
2851 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
2854 ## Scale the given object by the factor, creating its copy before the scaling.
2855 # @param theObject The object to be scaled.
2856 # @param thePoint Center point for scaling.
2857 # Passing None for it means scaling relatively the origin of global CS.
2858 # @param theFactor Scaling factor value.
2859 # @return New GEOM_Object, containing the scaled shape.
2861 # @ref tui_scale "Example"
2862 def MakeScaleTransform(self, theObject, thePoint, theFactor):
2863 # Example: see GEOM_TestAll.py
2864 theFactor, Parameters = ParseParameters(theFactor)
2865 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
2866 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
2867 anObj.SetParameters(Parameters)
2870 ## Scale the given object by different factors along coordinate axes,
2871 # creating its copy before the scaling.
2872 # @param theObject The object to be scaled.
2873 # @param thePoint Center point for scaling.
2874 # Passing None for it means scaling relatively the origin of global CS.
2875 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
2876 # @return New GEOM_Object, containing the scaled shape.
2878 # @ref swig_scale "Example"
2879 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
2880 # Example: see GEOM_TestAll.py
2881 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
2882 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
2883 theFactorX, theFactorY, theFactorZ)
2884 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
2885 anObj.SetParameters(Parameters)
2888 ## Create an object, symmetrical
2889 # to the given one relatively the given plane.
2890 # @param theObject The object to be mirrored.
2891 # @param thePlane Plane of symmetry.
2892 # @return New GEOM_Object, containing the mirrored shape.
2894 # @ref tui_mirror "Example"
2895 def MakeMirrorByPlane(self,theObject, thePlane):
2896 # Example: see GEOM_TestAll.py
2897 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
2898 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
2901 ## Create an object, symmetrical
2902 # to the given one relatively the given axis.
2903 # @param theObject The object to be mirrored.
2904 # @param theAxis Axis of symmetry.
2905 # @return New GEOM_Object, containing the mirrored shape.
2907 # @ref tui_mirror "Example"
2908 def MakeMirrorByAxis(self,theObject, theAxis):
2909 # Example: see GEOM_TestAll.py
2910 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
2911 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
2914 ## Create an object, symmetrical
2915 # to the given one relatively the given point.
2916 # @param theObject The object to be mirrored.
2917 # @param thePoint Point of symmetry.
2918 # @return New GEOM_Object, containing the mirrored shape.
2920 # @ref tui_mirror "Example"
2921 def MakeMirrorByPoint(self,theObject, thePoint):
2922 # Example: see GEOM_TestAll.py
2923 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
2924 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
2927 ## Modify the Location of the given object by LCS,
2928 # creating its copy before the setting.
2929 # @param theObject The object to be displaced.
2930 # @param theStartLCS Coordinate system to perform displacement from it.
2931 # If \a theStartLCS is NULL, displacement
2932 # will be performed from global CS.
2933 # If \a theObject itself is used as \a theStartLCS,
2934 # its location will be changed to \a theEndLCS.
2935 # @param theEndLCS Coordinate system to perform displacement to it.
2936 # @return New GEOM_Object, containing the displaced shape.
2938 # @ref tui_modify_location "Example"
2939 def MakePosition(self,theObject, theStartLCS, theEndLCS):
2940 # Example: see GEOM_TestAll.py
2941 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
2942 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
2945 ## Modify the Location of the given object by Path,
2946 # @param theObject The object to be displaced.
2947 # @param thePath Wire or Edge along that the object will be translated.
2948 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
2949 # @param theCopy is to create a copy objects if true.
2950 # @param theReverse - 0 for usual direction, 1 to reverse path direction.
2951 # @return New GEOM_Object, containing the displaced shape.
2953 # @ref tui_modify_location "Example"
2954 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
2955 # Example: see GEOM_TestAll.py
2956 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
2957 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
2960 ## Create new object as offset of the given one.
2961 # @param theObject The base object for the offset.
2962 # @param theOffset Offset value.
2963 # @return New GEOM_Object, containing the offset object.
2965 # @ref tui_offset "Example"
2966 def MakeOffset(self,theObject, theOffset):
2967 # Example: see GEOM_TestAll.py
2968 theOffset, Parameters = ParseParameters(theOffset)
2969 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
2970 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
2971 anObj.SetParameters(Parameters)
2974 # -----------------------------------------------------------------------------
2976 # -----------------------------------------------------------------------------
2978 ## Translate the given object along the given vector a given number times
2979 # @param theObject The object to be translated.
2980 # @param theVector Direction of the translation.
2981 # @param theStep Distance to translate on.
2982 # @param theNbTimes Quantity of translations to be done.
2983 # @return New GEOM_Object, containing compound of all
2984 # the shapes, obtained after each translation.
2986 # @ref tui_multi_translation "Example"
2987 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
2988 # Example: see GEOM_TestAll.py
2989 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
2990 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
2991 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
2992 anObj.SetParameters(Parameters)
2995 ## Conseqently apply two specified translations to theObject specified number of times.
2996 # @param theObject The object to be translated.
2997 # @param theVector1 Direction of the first translation.
2998 # @param theStep1 Step of the first translation.
2999 # @param theNbTimes1 Quantity of translations to be done along theVector1.
3000 # @param theVector2 Direction of the second translation.
3001 # @param theStep2 Step of the second translation.
3002 # @param theNbTimes2 Quantity of translations to be done along theVector2.
3003 # @return New GEOM_Object, containing compound of all
3004 # the shapes, obtained after each translation.
3006 # @ref tui_multi_translation "Example"
3007 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
3008 theVector2, theStep2, theNbTimes2):
3009 # Example: see GEOM_TestAll.py
3010 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
3011 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
3012 theVector2, theStep2, theNbTimes2)
3013 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
3014 anObj.SetParameters(Parameters)
3017 ## Rotate the given object around the given axis a given number times.
3018 # Rotation angle will be 2*PI/theNbTimes.
3019 # @param theObject The object to be rotated.
3020 # @param theAxis The rotation axis.
3021 # @param theNbTimes Quantity of rotations to be done.
3022 # @return New GEOM_Object, containing compound of all the
3023 # shapes, obtained after each rotation.
3025 # @ref tui_multi_rotation "Example"
3026 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
3027 # Example: see GEOM_TestAll.py
3028 theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
3029 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
3030 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
3031 anObj.SetParameters(Parameters)
3034 ## Rotate the given object around the
3035 # given axis on the given angle a given number
3036 # times and multi-translate each rotation result.
3037 # Translation direction passes through center of gravity
3038 # of rotated shape and its projection on the rotation axis.
3039 # @param theObject The object to be rotated.
3040 # @param theAxis Rotation axis.
3041 # @param theAngle Rotation angle in graduces.
3042 # @param theNbTimes1 Quantity of rotations to be done.
3043 # @param theStep Translation distance.
3044 # @param theNbTimes2 Quantity of translations to be done.
3045 # @return New GEOM_Object, containing compound of all the
3046 # shapes, obtained after each transformation.
3048 # @ref tui_multi_rotation "Example"
3049 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
3050 # Example: see GEOM_TestAll.py
3051 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
3052 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
3053 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
3054 anObj.SetParameters(Parameters)
3057 ## The same, as MultiRotate1D(), but axis is given by direction and point
3058 # @ref swig_MakeMultiRotation "Example"
3059 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
3060 # Example: see GEOM_TestOthers.py
3061 aVec = self.MakeLine(aPoint,aDir)
3062 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
3065 ## The same, as MultiRotate2D(), but axis is given by direction and point
3066 # @ref swig_MakeMultiRotation "Example"
3067 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
3068 # Example: see GEOM_TestOthers.py
3069 aVec = self.MakeLine(aPoint,aDir)
3070 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
3073 # end of l3_transform
3076 ## @addtogroup l3_local
3079 ## Perform a fillet on all edges of the given shape.
3080 # @param theShape Shape, to perform fillet on.
3081 # @param theR Fillet radius.
3082 # @return New GEOM_Object, containing the result shape.
3084 # @ref tui_fillet "Example 1"
3085 # \n @ref swig_MakeFilletAll "Example 2"
3086 def MakeFilletAll(self,theShape, theR):
3087 # Example: see GEOM_TestOthers.py
3088 theR,Parameters = ParseParameters(theR)
3089 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
3090 RaiseIfFailed("MakeFilletAll", self.LocalOp)
3091 anObj.SetParameters(Parameters)
3094 ## Perform a fillet on the specified edges/faces of the given shape
3095 # @param theShape Shape, to perform fillet on.
3096 # @param theR Fillet radius.
3097 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
3098 # @param theListShapes Global indices of edges/faces to perform fillet on.
3099 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3100 # @return New GEOM_Object, containing the result shape.
3102 # @ref tui_fillet "Example"
3103 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
3104 # Example: see GEOM_TestAll.py
3105 theR,Parameters = ParseParameters(theR)
3107 if theShapeType == ShapeType["EDGE"]:
3108 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
3109 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
3111 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
3112 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
3113 anObj.SetParameters(Parameters)
3116 ## The same that MakeFillet but with two Fillet Radius R1 and R2
3117 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
3118 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
3120 if theShapeType == ShapeType["EDGE"]:
3121 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
3122 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
3124 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
3125 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
3126 anObj.SetParameters(Parameters)
3129 ## Perform a fillet on the specified edges of the given shape
3130 # @param theShape - Wire Shape to perform fillet on.
3131 # @param theR - Fillet radius.
3132 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
3133 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3134 # \note The list of vertices could be empty,
3135 # in this case fillet will done done at all vertices in wire
3136 # @return New GEOM_Object, containing the result shape.
3138 # @ref tui_fillet2d "Example"
3139 def MakeFillet1D(self,theShape, theR, theListOfVertexes):
3140 # Example: see GEOM_TestAll.py
3141 theR,Parameters = ParseParameters(theR)
3142 anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes)
3143 RaiseIfFailed("MakeFillet1D", self.LocalOp)
3144 anObj.SetParameters(Parameters)
3147 ## Perform a fillet on the specified edges/faces of the given shape
3148 # @param theShape - Face Shape to perform fillet on.
3149 # @param theR - Fillet radius.
3150 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
3151 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3152 # @return New GEOM_Object, containing the result shape.
3154 # @ref tui_fillet2d "Example"
3155 def MakeFillet2D(self,theShape, theR, theListOfVertexes):
3156 # Example: see GEOM_TestAll.py
3157 theR,Parameters = ParseParameters(theR)
3158 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
3159 RaiseIfFailed("MakeFillet2D", self.LocalOp)
3160 anObj.SetParameters(Parameters)
3163 ## Perform a symmetric chamfer on all edges of the given shape.
3164 # @param theShape Shape, to perform chamfer on.
3165 # @param theD Chamfer size along each face.
3166 # @return New GEOM_Object, containing the result shape.
3168 # @ref tui_chamfer "Example 1"
3169 # \n @ref swig_MakeChamferAll "Example 2"
3170 def MakeChamferAll(self,theShape, theD):
3171 # Example: see GEOM_TestOthers.py
3172 theD,Parameters = ParseParameters(theD)
3173 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
3174 RaiseIfFailed("MakeChamferAll", self.LocalOp)
3175 anObj.SetParameters(Parameters)
3178 ## Perform a chamfer on edges, common to the specified faces,
3179 # with distance D1 on the Face1
3180 # @param theShape Shape, to perform chamfer on.
3181 # @param theD1 Chamfer size along \a theFace1.
3182 # @param theD2 Chamfer size along \a theFace2.
3183 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
3184 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3185 # @return New GEOM_Object, containing the result shape.
3187 # @ref tui_chamfer "Example"
3188 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
3189 # Example: see GEOM_TestAll.py
3190 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3191 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
3192 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
3193 anObj.SetParameters(Parameters)
3196 ## The Same that MakeChamferEdge but with params theD is chamfer length and
3197 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3198 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
3200 if isinstance(theAngle,str):
3202 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3204 theAngle = theAngle*math.pi/180.0
3205 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
3206 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
3207 anObj.SetParameters(Parameters)
3210 ## Perform a chamfer on all edges of the specified faces,
3211 # with distance D1 on the first specified face (if several for one edge)
3212 # @param theShape Shape, to perform chamfer on.
3213 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
3214 # connected to the edge, are in \a theFaces, \a theD1
3215 # will be get along face, which is nearer to \a theFaces beginning.
3216 # @param theD2 Chamfer size along another of two faces, connected to the edge.
3217 # @param theFaces Sequence of global indices of faces of \a theShape.
3218 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
3219 # @return New GEOM_Object, containing the result shape.
3221 # @ref tui_chamfer "Example"
3222 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
3223 # Example: see GEOM_TestAll.py
3224 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3225 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
3226 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
3227 anObj.SetParameters(Parameters)
3230 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
3231 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3233 # @ref swig_FilletChamfer "Example"
3234 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
3236 if isinstance(theAngle,str):
3238 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3240 theAngle = theAngle*math.pi/180.0
3241 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
3242 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
3243 anObj.SetParameters(Parameters)
3246 ## Perform a chamfer on edges,
3247 # with distance D1 on the first specified face (if several for one edge)
3248 # @param theShape Shape, to perform chamfer on.
3249 # @param theD1,theD2 Chamfer size
3250 # @param theEdges Sequence of edges of \a theShape.
3251 # @return New GEOM_Object, containing the result shape.
3253 # @ref swig_FilletChamfer "Example"
3254 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
3255 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3256 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
3257 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
3258 anObj.SetParameters(Parameters)
3261 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
3262 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3263 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
3265 if isinstance(theAngle,str):
3267 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3269 theAngle = theAngle*math.pi/180.0
3270 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
3271 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
3272 anObj.SetParameters(Parameters)
3275 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
3277 # @ref swig_MakeChamfer "Example"
3278 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
3279 # Example: see GEOM_TestOthers.py
3281 if aShapeType == ShapeType["EDGE"]:
3282 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
3284 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
3290 ## @addtogroup l3_basic_op
3293 ## Perform an Archimde operation on the given shape with given parameters.
3294 # The object presenting the resulting face is returned.
3295 # @param theShape Shape to be put in water.
3296 # @param theWeight Weight og the shape.
3297 # @param theWaterDensity Density of the water.
3298 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
3299 # @return New GEOM_Object, containing a section of \a theShape
3300 # by a plane, corresponding to water level.
3302 # @ref tui_archimede "Example"
3303 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
3304 # Example: see GEOM_TestAll.py
3305 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
3306 theWeight,theWaterDensity,theMeshDeflection)
3307 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
3308 RaiseIfFailed("MakeArchimede", self.LocalOp)
3309 anObj.SetParameters(Parameters)
3312 # end of l3_basic_op
3315 ## @addtogroup l2_measure
3318 ## Get point coordinates
3321 # @ref tui_measurement_tools_page "Example"
3322 def PointCoordinates(self,Point):
3323 # Example: see GEOM_TestMeasures.py
3324 aTuple = self.MeasuOp.PointCoordinates(Point)
3325 RaiseIfFailed("PointCoordinates", self.MeasuOp)
3328 ## Get summarized length of all wires,
3329 # area of surface and volume of the given shape.
3330 # @param theShape Shape to define properties of.
3331 # @return [theLength, theSurfArea, theVolume]
3332 # theLength: Summarized length of all wires of the given shape.
3333 # theSurfArea: Area of surface of the given shape.
3334 # theVolume: Volume of the given shape.
3336 # @ref tui_measurement_tools_page "Example"
3337 def BasicProperties(self,theShape):
3338 # Example: see GEOM_TestMeasures.py
3339 aTuple = self.MeasuOp.GetBasicProperties(theShape)
3340 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
3343 ## Get parameters of bounding box of the given shape
3344 # @param theShape Shape to obtain bounding box of.
3345 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
3346 # Xmin,Xmax: Limits of shape along OX axis.
3347 # Ymin,Ymax: Limits of shape along OY axis.
3348 # Zmin,Zmax: Limits of shape along OZ axis.
3350 # @ref tui_measurement_tools_page "Example"
3351 def BoundingBox(self,theShape):
3352 # Example: see GEOM_TestMeasures.py
3353 aTuple = self.MeasuOp.GetBoundingBox(theShape)
3354 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
3357 ## Get inertia matrix and moments of inertia of theShape.
3358 # @param theShape Shape to calculate inertia of.
3359 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
3360 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
3361 # Ix,Iy,Iz: Moments of inertia of the given shape.
3363 # @ref tui_measurement_tools_page "Example"
3364 def Inertia(self,theShape):
3365 # Example: see GEOM_TestMeasures.py
3366 aTuple = self.MeasuOp.GetInertia(theShape)
3367 RaiseIfFailed("GetInertia", self.MeasuOp)
3370 ## Get if coords are included in the shape (ST_IN or ST_ON)
3371 # @param theShape Shape
3372 # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
3373 # @param tolerance to be used (default is 1.0e-7)
3374 # @return list_of_boolean = [res1, res2, ...]
3375 def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
3376 return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
3378 ## Get minimal distance between the given shapes.
3379 # @param theShape1,theShape2 Shapes to find minimal distance between.
3380 # @return Value of the minimal distance between the given shapes.
3382 # @ref tui_measurement_tools_page "Example"
3383 def MinDistance(self, theShape1, theShape2):
3384 # Example: see GEOM_TestMeasures.py
3385 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
3386 RaiseIfFailed("GetMinDistance", self.MeasuOp)
3389 ## Get minimal distance between the given shapes.
3390 # @param theShape1,theShape2 Shapes to find minimal distance between.
3391 # @return Value of the minimal distance between the given shapes.
3393 # @ref swig_all_measure "Example"
3394 def MinDistanceComponents(self, theShape1, theShape2):
3395 # Example: see GEOM_TestMeasures.py
3396 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
3397 RaiseIfFailed("GetMinDistance", self.MeasuOp)
3398 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
3401 ## Get angle between the given shapes in degrees.
3402 # @param theShape1,theShape2 Lines or linear edges to find angle between.
3403 # @return Value of the angle between the given shapes in degrees.
3405 # @ref tui_measurement_tools_page "Example"
3406 def GetAngle(self, theShape1, theShape2):
3407 # Example: see GEOM_TestMeasures.py
3408 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
3409 RaiseIfFailed("GetAngle", self.MeasuOp)
3411 ## Get angle between the given shapes in radians.
3412 # @param theShape1,theShape2 Lines or linear edges to find angle between.
3413 # @return Value of the angle between the given shapes in radians.
3415 # @ref tui_measurement_tools_page "Example"
3416 def GetAngleRadians(self, theShape1, theShape2):
3417 # Example: see GEOM_TestMeasures.py
3418 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
3419 RaiseIfFailed("GetAngle", self.MeasuOp)
3422 ## @name Curve Curvature Measurement
3423 # Methods for receiving radius of curvature of curves
3424 # in the given point
3427 ## Measure curvature of a curve at a point, set by parameter.
3428 # @ref swig_todo "Example"
3429 def CurveCurvatureByParam(self, theCurve, theParam):
3430 # Example: see GEOM_TestMeasures.py
3431 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
3432 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
3436 # @ref swig_todo "Example"
3437 def CurveCurvatureByPoint(self, theCurve, thePoint):
3438 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
3439 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
3443 ## @name Surface Curvature Measurement
3444 # Methods for receiving max and min radius of curvature of surfaces
3445 # in the given point
3449 ## @ref swig_todo "Example"
3450 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
3451 # Example: see GEOM_TestMeasures.py
3452 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
3453 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
3457 ## @ref swig_todo "Example"
3458 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
3459 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
3460 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
3464 ## @ref swig_todo "Example"
3465 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
3466 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
3467 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
3471 ## @ref swig_todo "Example"
3472 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
3473 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
3474 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
3478 ## Get min and max tolerances of sub-shapes of theShape
3479 # @param theShape Shape, to get tolerances of.
3480 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
3481 # FaceMin,FaceMax: Min and max tolerances of the faces.
3482 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
3483 # VertMin,VertMax: Min and max tolerances of the vertices.
3485 # @ref tui_measurement_tools_page "Example"
3486 def Tolerance(self,theShape):
3487 # Example: see GEOM_TestMeasures.py
3488 aTuple = self.MeasuOp.GetTolerance(theShape)
3489 RaiseIfFailed("GetTolerance", self.MeasuOp)
3492 ## Obtain description of the given shape (number of sub-shapes of each type)
3493 # @param theShape Shape to be described.
3494 # @return Description of the given shape.
3496 # @ref tui_measurement_tools_page "Example"
3497 def WhatIs(self,theShape):
3498 # Example: see GEOM_TestMeasures.py
3499 aDescr = self.MeasuOp.WhatIs(theShape)
3500 RaiseIfFailed("WhatIs", self.MeasuOp)
3503 ## Obtain quantity of shapes of the given type in \a theShape.
3504 # If \a theShape is of type \a theType, it is also counted.
3505 # @param theShape Shape to be described.
3506 # @return Quantity of shapes of type \a theType in \a theShape.
3508 # @ref tui_measurement_tools_page "Example"
3509 def NbShapes (self, theShape, theType):
3510 # Example: see GEOM_TestMeasures.py
3511 listSh = self.SubShapeAllIDs(theShape, theType)
3513 t = EnumToLong(theShape.GetShapeType())
3514 theType = EnumToLong(theType)
3520 ## Obtain quantity of shapes of each type in \a theShape.
3521 # The \a theShape is also counted.
3522 # @param theShape Shape to be described.
3523 # @return Dictionary of shape types with bound quantities of shapes.
3525 # @ref tui_measurement_tools_page "Example"
3526 def ShapeInfo (self, theShape):
3527 # Example: see GEOM_TestMeasures.py
3529 for typeSh in ShapeType:
3530 if typeSh in ( "AUTO", "SHAPE" ): continue
3531 listSh = self.SubShapeAllIDs(theShape, ShapeType[typeSh])
3533 if EnumToLong(theShape.GetShapeType()) == ShapeType[typeSh]:
3540 ## Get a point, situated at the centre of mass of theShape.
3541 # @param theShape Shape to define centre of mass of.
3542 # @return New GEOM_Object, containing the created point.
3544 # @ref tui_measurement_tools_page "Example"
3545 def MakeCDG(self,theShape):
3546 # Example: see GEOM_TestMeasures.py
3547 anObj = self.MeasuOp.GetCentreOfMass(theShape)
3548 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
3551 ## Get a vertex subshape by index depended with orientation.
3552 # @param theShape Shape to find subshape.
3553 # @param theIndex Index to find vertex by this index.
3554 # @return New GEOM_Object, containing the created vertex.
3556 # @ref tui_measurement_tools_page "Example"
3557 def GetVertexByIndex(self,theShape, theIndex):
3558 # Example: see GEOM_TestMeasures.py
3559 anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex)
3560 RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
3563 ## Get the first vertex of wire/edge depended orientation.
3564 # @param theShape Shape to find first vertex.
3565 # @return New GEOM_Object, containing the created vertex.
3567 # @ref tui_measurement_tools_page "Example"
3568 def GetFirstVertex(self,theShape):
3569 # Example: see GEOM_TestMeasures.py
3570 anObj = self.GetVertexByIndex(theShape, 0)
3571 RaiseIfFailed("GetFirstVertex", self.MeasuOp)
3574 ## Get the last vertex of wire/edge depended orientation.
3575 # @param theShape Shape to find last vertex.
3576 # @return New GEOM_Object, containing the created vertex.
3578 # @ref tui_measurement_tools_page "Example"
3579 def GetLastVertex(self,theShape):
3580 # Example: see GEOM_TestMeasures.py
3581 nb_vert = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["VERTEX"])
3582 anObj = self.GetVertexByIndex(theShape, (nb_vert-1))
3583 RaiseIfFailed("GetLastVertex", self.MeasuOp)
3586 ## Get a normale to the given face. If the point is not given,
3587 # the normale is calculated at the center of mass.
3588 # @param theFace Face to define normale of.
3589 # @param theOptionalPoint Point to compute the normale at.
3590 # @return New GEOM_Object, containing the created vector.
3592 # @ref swig_todo "Example"
3593 def GetNormal(self, theFace, theOptionalPoint = None):
3594 # Example: see GEOM_TestMeasures.py
3595 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
3596 RaiseIfFailed("GetNormal", self.MeasuOp)
3599 ## Check a topology of the given shape.
3600 # @param theShape Shape to check validity of.
3601 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
3602 # if TRUE, the shape's geometry will be checked also.
3603 # @return TRUE, if the shape "seems to be valid".
3604 # If theShape is invalid, prints a description of problem.
3606 # @ref tui_measurement_tools_page "Example"
3607 def CheckShape(self,theShape, theIsCheckGeom = 0):
3608 # Example: see GEOM_TestMeasures.py
3610 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
3611 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
3613 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
3614 RaiseIfFailed("CheckShape", self.MeasuOp)
3619 ## Get position (LCS) of theShape.
3621 # Origin of the LCS is situated at the shape's center of mass.
3622 # Axes of the LCS are obtained from shape's location or,
3623 # if the shape is a planar face, from position of its plane.
3625 # @param theShape Shape to calculate position of.
3626 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
3627 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
3628 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
3629 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
3631 # @ref swig_todo "Example"
3632 def GetPosition(self,theShape):
3633 # Example: see GEOM_TestMeasures.py
3634 aTuple = self.MeasuOp.GetPosition(theShape)
3635 RaiseIfFailed("GetPosition", self.MeasuOp)
3638 ## Get kind of theShape.
3640 # @param theShape Shape to get a kind of.
3641 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
3642 # and a list of parameters, describing the shape.
3643 # @note Concrete meaning of each value, returned via \a theIntegers
3644 # or \a theDoubles list depends on the kind of the shape.
3645 # The full list of possible outputs is:
3647 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
3648 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
3650 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
3651 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
3653 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
3654 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
3656 # - geompy.kind.SPHERE xc yc zc R
3657 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
3658 # - geompy.kind.BOX xc yc zc ax ay az
3659 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
3660 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
3661 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
3662 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
3663 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
3665 # - geompy.kind.SPHERE2D xc yc zc R
3666 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
3667 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
3668 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
3669 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
3670 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
3671 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
3672 # - geompy.kind.PLANE xo yo zo dx dy dz
3673 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
3674 # - geompy.kind.FACE nb_edges nb_vertices
3676 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
3677 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
3678 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
3679 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
3680 # - geompy.kind.LINE xo yo zo dx dy dz
3681 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
3682 # - geompy.kind.EDGE nb_vertices
3684 # - geompy.kind.VERTEX x y z
3686 # @ref swig_todo "Example"
3687 def KindOfShape(self,theShape):
3688 # Example: see GEOM_TestMeasures.py
3689 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
3690 RaiseIfFailed("KindOfShape", self.MeasuOp)
3692 aKind = aRoughTuple[0]
3693 anInts = aRoughTuple[1]
3694 aDbls = aRoughTuple[2]
3696 # Now there is no exception from this rule:
3697 aKindTuple = [aKind] + aDbls + anInts
3699 # If they are we will regroup parameters for such kind of shape.
3701 #if aKind == kind.SOME_KIND:
3702 # # SOME_KIND int int double int double double
3703 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
3710 ## @addtogroup l2_import_export
3713 ## Import a shape from the BREP or IGES or STEP file
3714 # (depends on given format) with given name.
3715 # @param theFileName The file, containing the shape.
3716 # @param theFormatName Specify format for the file reading.
3717 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3718 # If format 'IGES_SCALE' is used instead 'IGES' length unit will be
3719 # set to 'meter' and result model will be scaled.
3720 # @return New GEOM_Object, containing the imported shape.
3722 # @ref swig_Import_Export "Example"
3723 def Import(self,theFileName, theFormatName):
3724 # Example: see GEOM_TestOthers.py
3725 anObj = self.InsertOp.Import(theFileName, theFormatName)
3726 RaiseIfFailed("Import", self.InsertOp)
3729 ## Shortcut to Import() for BREP format
3731 # @ref swig_Import_Export "Example"
3732 def ImportBREP(self,theFileName):
3733 # Example: see GEOM_TestOthers.py
3734 return self.Import(theFileName, "BREP")
3736 ## Shortcut to Import() for IGES format
3738 # @ref swig_Import_Export "Example"
3739 def ImportIGES(self,theFileName):
3740 # Example: see GEOM_TestOthers.py
3741 return self.Import(theFileName, "IGES")
3743 ## Return length unit from given IGES file
3745 # @ref swig_Import_Export "Example"
3746 def GetIGESUnit(self,theFileName):
3747 # Example: see GEOM_TestOthers.py
3748 anObj = self.InsertOp.Import(theFileName, "IGES_UNIT")
3749 #RaiseIfFailed("Import", self.InsertOp)
3750 # recieve name using returned vertex
3752 if anObj.GetShapeType() == GEOM.VERTEX:
3755 vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
3757 p = self.PointCoordinates(vertices[0])
3758 if abs(p[0]-0.01) < 1.e-6:
3760 elif abs(p[0]-0.001) < 1.e-6:
3764 ## Shortcut to Import() for STEP format
3766 # @ref swig_Import_Export "Example"
3767 def ImportSTEP(self,theFileName):
3768 # Example: see GEOM_TestOthers.py
3769 return self.Import(theFileName, "STEP")
3771 ## Export the given shape into a file with given name.
3772 # @param theObject Shape to be stored in the file.
3773 # @param theFileName Name of the file to store the given shape in.
3774 # @param theFormatName Specify format for the shape storage.
3775 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3777 # @ref swig_Import_Export "Example"
3778 def Export(self,theObject, theFileName, theFormatName):
3779 # Example: see GEOM_TestOthers.py
3780 self.InsertOp.Export(theObject, theFileName, theFormatName)
3781 if self.InsertOp.IsDone() == 0:
3782 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
3786 ## Shortcut to Export() for BREP format
3788 # @ref swig_Import_Export "Example"
3789 def ExportBREP(self,theObject, theFileName):
3790 # Example: see GEOM_TestOthers.py
3791 return self.Export(theObject, theFileName, "BREP")
3793 ## Shortcut to Export() for IGES format
3795 # @ref swig_Import_Export "Example"
3796 def ExportIGES(self,theObject, theFileName):
3797 # Example: see GEOM_TestOthers.py
3798 return self.Export(theObject, theFileName, "IGES")
3800 ## Shortcut to Export() for STEP format
3802 # @ref swig_Import_Export "Example"
3803 def ExportSTEP(self,theObject, theFileName):
3804 # Example: see GEOM_TestOthers.py
3805 return self.Export(theObject, theFileName, "STEP")
3807 # end of l2_import_export
3810 ## @addtogroup l3_blocks
3813 ## Create a quadrangle face from four edges. Order of Edges is not
3814 # important. It is not necessary that edges share the same vertex.
3815 # @param E1,E2,E3,E4 Edges for the face bound.
3816 # @return New GEOM_Object, containing the created face.
3818 # @ref tui_building_by_blocks_page "Example"
3819 def MakeQuad(self,E1, E2, E3, E4):
3820 # Example: see GEOM_Spanner.py
3821 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
3822 RaiseIfFailed("MakeQuad", self.BlocksOp)
3825 ## Create a quadrangle face on two edges.
3826 # The missing edges will be built by creating the shortest ones.
3827 # @param E1,E2 Two opposite edges for the face.
3828 # @return New GEOM_Object, containing the created face.
3830 # @ref tui_building_by_blocks_page "Example"
3831 def MakeQuad2Edges(self,E1, E2):
3832 # Example: see GEOM_Spanner.py
3833 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
3834 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
3837 ## Create a quadrangle face with specified corners.
3838 # The missing edges will be built by creating the shortest ones.
3839 # @param V1,V2,V3,V4 Corner vertices for the face.
3840 # @return New GEOM_Object, containing the created face.
3842 # @ref tui_building_by_blocks_page "Example 1"
3843 # \n @ref swig_MakeQuad4Vertices "Example 2"
3844 def MakeQuad4Vertices(self,V1, V2, V3, V4):
3845 # Example: see GEOM_Spanner.py
3846 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
3847 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
3850 ## Create a hexahedral solid, bounded by the six given faces. Order of
3851 # faces is not important. It is not necessary that Faces share the same edge.
3852 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
3853 # @return New GEOM_Object, containing the created solid.
3855 # @ref tui_building_by_blocks_page "Example 1"
3856 # \n @ref swig_MakeHexa "Example 2"
3857 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
3858 # Example: see GEOM_Spanner.py
3859 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
3860 RaiseIfFailed("MakeHexa", self.BlocksOp)
3863 ## Create a hexahedral solid between two given faces.
3864 # The missing faces will be built by creating the smallest ones.
3865 # @param F1,F2 Two opposite faces for the hexahedral solid.
3866 # @return New GEOM_Object, containing the created solid.
3868 # @ref tui_building_by_blocks_page "Example 1"
3869 # \n @ref swig_MakeHexa2Faces "Example 2"
3870 def MakeHexa2Faces(self,F1, F2):
3871 # Example: see GEOM_Spanner.py
3872 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
3873 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
3879 ## @addtogroup l3_blocks_op
3882 ## Get a vertex, found in the given shape by its coordinates.
3883 # @param theShape Block or a compound of blocks.
3884 # @param theX,theY,theZ Coordinates of the sought vertex.
3885 # @param theEpsilon Maximum allowed distance between the resulting
3886 # vertex and point with the given coordinates.
3887 # @return New GEOM_Object, containing the found vertex.
3889 # @ref swig_GetPoint "Example"
3890 def GetPoint(self, theShape, theX, theY, theZ, theEpsilon):
3891 # Example: see GEOM_TestOthers.py
3892 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
3893 RaiseIfFailed("GetPoint", self.BlocksOp)
3896 ## Find a vertex of the given shape, which has minimal distance to the given point.
3897 # @param theShape Any shape.
3898 # @param thePoint Point, close to the desired vertex.
3899 # @return New GEOM_Object, containing the found vertex.
3901 # @ref swig_GetVertexNearPoint "Example"
3902 def GetVertexNearPoint(self, theShape, thePoint):
3903 # Example: see GEOM_TestOthers.py
3904 anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
3905 RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
3908 ## Get an edge, found in the given shape by two given vertices.
3909 # @param theShape Block or a compound of blocks.
3910 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
3911 # @return New GEOM_Object, containing the found edge.
3913 # @ref swig_GetEdge "Example"
3914 def GetEdge(self, theShape, thePoint1, thePoint2):
3915 # Example: see GEOM_Spanner.py
3916 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
3917 RaiseIfFailed("GetEdge", self.BlocksOp)
3920 ## Find an edge of the given shape, which has minimal distance to the given point.
3921 # @param theShape Block or a compound of blocks.
3922 # @param thePoint Point, close to the desired edge.
3923 # @return New GEOM_Object, containing the found edge.
3925 # @ref swig_GetEdgeNearPoint "Example"
3926 def GetEdgeNearPoint(self, theShape, thePoint):
3927 # Example: see GEOM_TestOthers.py
3928 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
3929 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
3932 ## Returns a face, found in the given shape by four given corner vertices.
3933 # @param theShape Block or a compound of blocks.
3934 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
3935 # @return New GEOM_Object, containing the found face.
3937 # @ref swig_todo "Example"
3938 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
3939 # Example: see GEOM_Spanner.py
3940 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
3941 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
3944 ## Get a face of block, found in the given shape by two given edges.
3945 # @param theShape Block or a compound of blocks.
3946 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
3947 # @return New GEOM_Object, containing the found face.
3949 # @ref swig_todo "Example"
3950 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
3951 # Example: see GEOM_Spanner.py
3952 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
3953 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
3956 ## Find a face, opposite to the given one in the given block.
3957 # @param theBlock Must be a hexahedral solid.
3958 # @param theFace Face of \a theBlock, opposite to the desired face.
3959 # @return New GEOM_Object, containing the found face.
3961 # @ref swig_GetOppositeFace "Example"
3962 def GetOppositeFace(self,theBlock, theFace):
3963 # Example: see GEOM_Spanner.py
3964 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
3965 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
3968 ## Find a face of the given shape, which has minimal distance to the given point.
3969 # @param theShape Block or a compound of blocks.
3970 # @param thePoint Point, close to the desired face.
3971 # @return New GEOM_Object, containing the found face.
3973 # @ref swig_GetFaceNearPoint "Example"
3974 def GetFaceNearPoint(self, theShape, thePoint):
3975 # Example: see GEOM_Spanner.py
3976 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
3977 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
3980 ## Find a face of block, whose outside normale has minimal angle with the given vector.
3981 # @param theBlock Block or a compound of blocks.
3982 # @param theVector Vector, close to the normale of the desired face.
3983 # @return New GEOM_Object, containing the found face.
3985 # @ref swig_todo "Example"
3986 def GetFaceByNormale(self, theBlock, theVector):
3987 # Example: see GEOM_Spanner.py
3988 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
3989 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
3992 ## Find all subshapes of type \a theShapeType of the given shape,
3993 # which have minimal distance to the given point.
3994 # @param theShape Any shape.
3995 # @param thePoint Point, close to the desired shape.
3996 # @param theShapeType Defines what kind of subshapes is searched.
3997 # @param theTolerance The tolerance for distances comparison. All shapes
3998 # with distances to the given point in interval
3999 # [minimal_distance, minimal_distance + theTolerance] will be gathered.
4000 # @return New GEOM_Object, containing a group of all found shapes.
4002 # @ref swig_GetShapesNearPoint "Example"
4003 def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07):
4004 # Example: see GEOM_TestOthers.py
4005 anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
4006 RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
4009 # end of l3_blocks_op
4012 ## @addtogroup l4_blocks_measure
4015 ## Check, if the compound of blocks is given.
4016 # To be considered as a compound of blocks, the
4017 # given shape must satisfy the following conditions:
4018 # - Each element of the compound should be a Block (6 faces and 12 edges).
4019 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
4020 # - The compound should be connexe.
4021 # - The glue between two quadrangle faces should be applied.
4022 # @param theCompound The compound to check.
4023 # @return TRUE, if the given shape is a compound of blocks.
4024 # If theCompound is not valid, prints all discovered errors.
4026 # @ref tui_measurement_tools_page "Example 1"
4027 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
4028 def CheckCompoundOfBlocks(self,theCompound):
4029 # Example: see GEOM_Spanner.py
4030 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
4031 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
4033 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
4037 ## Remove all seam and degenerated edges from \a theShape.
4038 # Unite faces and edges, sharing one surface. It means that
4039 # this faces must have references to one C++ surface object (handle).
4040 # @param theShape The compound or single solid to remove irregular edges from.
4041 # @param doUnionFaces If True, then unite faces. If False (the default value),
4042 # do not unite faces.
4043 # @return Improved shape.
4045 # @ref swig_RemoveExtraEdges "Example"
4046 def RemoveExtraEdges(self, theShape, doUnionFaces=False):
4047 # Example: see GEOM_TestOthers.py
4048 nbFacesOptimum = -1 # -1 means do not unite faces
4049 if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
4050 anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
4051 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
4054 ## Check, if the given shape is a blocks compound.
4055 # Fix all detected errors.
4056 # \note Single block can be also fixed by this method.
4057 # @param theShape The compound to check and improve.
4058 # @return Improved compound.
4060 # @ref swig_CheckAndImprove "Example"
4061 def CheckAndImprove(self,theShape):
4062 # Example: see GEOM_TestOthers.py
4063 anObj = self.BlocksOp.CheckAndImprove(theShape)
4064 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
4067 # end of l4_blocks_measure
4070 ## @addtogroup l3_blocks_op
4073 ## Get all the blocks, contained in the given compound.
4074 # @param theCompound The compound to explode.
4075 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
4076 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
4077 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
4078 # @return List of GEOM_Objects, containing the retrieved blocks.
4080 # @ref tui_explode_on_blocks "Example 1"
4081 # \n @ref swig_MakeBlockExplode "Example 2"
4082 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
4083 # Example: see GEOM_TestOthers.py
4084 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
4085 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
4086 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
4088 anObj.SetParameters(Parameters)
4092 ## Find block, containing the given point inside its volume or on boundary.
4093 # @param theCompound Compound, to find block in.
4094 # @param thePoint Point, close to the desired block. If the point lays on
4095 # boundary between some blocks, we return block with nearest center.
4096 # @return New GEOM_Object, containing the found block.
4098 # @ref swig_todo "Example"
4099 def GetBlockNearPoint(self,theCompound, thePoint):
4100 # Example: see GEOM_Spanner.py
4101 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
4102 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
4105 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
4106 # @param theCompound Compound, to find block in.
4107 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
4108 # @return New GEOM_Object, containing the found block.
4110 # @ref swig_GetBlockByParts "Example"
4111 def GetBlockByParts(self,theCompound, theParts):
4112 # Example: see GEOM_TestOthers.py
4113 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
4114 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
4117 ## Return all blocks, containing all the elements, passed as the parts.
4118 # @param theCompound Compound, to find blocks in.
4119 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
4120 # @return List of GEOM_Objects, containing the found blocks.
4122 # @ref swig_todo "Example"
4123 def GetBlocksByParts(self,theCompound, theParts):
4124 # Example: see GEOM_Spanner.py
4125 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
4126 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
4129 ## Multi-transformate block and glue the result.
4130 # Transformation is defined so, as to superpose direction faces.
4131 # @param Block Hexahedral solid to be multi-transformed.
4132 # @param DirFace1 ID of First direction face.
4133 # @param DirFace2 ID of Second direction face.
4134 # @param NbTimes Quantity of transformations to be done.
4135 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
4136 # @return New GEOM_Object, containing the result shape.
4138 # @ref tui_multi_transformation "Example"
4139 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
4140 # Example: see GEOM_Spanner.py
4141 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
4142 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
4143 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
4144 anObj.SetParameters(Parameters)
4147 ## Multi-transformate block and glue the result.
4148 # @param Block Hexahedral solid to be multi-transformed.
4149 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
4150 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
4151 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
4152 # @return New GEOM_Object, containing the result shape.
4154 # @ref tui_multi_transformation "Example"
4155 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
4156 DirFace1V, DirFace2V, NbTimesV):
4157 # Example: see GEOM_Spanner.py
4158 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
4159 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
4160 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
4161 DirFace1V, DirFace2V, NbTimesV)
4162 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
4163 anObj.SetParameters(Parameters)
4166 ## Build all possible propagation groups.
4167 # Propagation group is a set of all edges, opposite to one (main)
4168 # edge of this group directly or through other opposite edges.
4169 # Notion of Opposite Edge make sence only on quadrangle face.
4170 # @param theShape Shape to build propagation groups on.
4171 # @return List of GEOM_Objects, each of them is a propagation group.
4173 # @ref swig_Propagate "Example"
4174 def Propagate(self,theShape):
4175 # Example: see GEOM_TestOthers.py
4176 listChains = self.BlocksOp.Propagate(theShape)
4177 RaiseIfFailed("Propagate", self.BlocksOp)
4180 # end of l3_blocks_op
4183 ## @addtogroup l3_groups
4186 ## Creates a new group which will store sub shapes of theMainShape
4187 # @param theMainShape is a GEOM object on which the group is selected
4188 # @param theShapeType defines a shape type of the group
4189 # @return a newly created GEOM group
4191 # @ref tui_working_with_groups_page "Example 1"
4192 # \n @ref swig_CreateGroup "Example 2"
4193 def CreateGroup(self,theMainShape, theShapeType):
4194 # Example: see GEOM_TestOthers.py
4195 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
4196 RaiseIfFailed("CreateGroup", self.GroupOp)
4199 ## Adds a sub object with ID theSubShapeId to the group
4200 # @param theGroup is a GEOM group to which the new sub shape is added
4201 # @param theSubShapeID is a sub shape ID in the main object.
4202 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
4204 # @ref tui_working_with_groups_page "Example"
4205 def AddObject(self,theGroup, theSubShapeID):
4206 # Example: see GEOM_TestOthers.py
4207 self.GroupOp.AddObject(theGroup, theSubShapeID)
4208 if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT":
4209 RaiseIfFailed("AddObject", self.GroupOp)
4213 ## Removes a sub object with ID \a theSubShapeId from the group
4214 # @param theGroup is a GEOM group from which the new sub shape is removed
4215 # @param theSubShapeID is a sub shape ID in the main object.
4216 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
4218 # @ref tui_working_with_groups_page "Example"
4219 def RemoveObject(self,theGroup, theSubShapeID):
4220 # Example: see GEOM_TestOthers.py
4221 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
4222 RaiseIfFailed("RemoveObject", self.GroupOp)
4225 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
4226 # @param theGroup is a GEOM group to which the new sub shapes are added.
4227 # @param theSubShapes is a list of sub shapes to be added.
4229 # @ref tui_working_with_groups_page "Example"
4230 def UnionList (self,theGroup, theSubShapes):
4231 # Example: see GEOM_TestOthers.py
4232 self.GroupOp.UnionList(theGroup, theSubShapes)
4233 RaiseIfFailed("UnionList", self.GroupOp)
4236 ## Works like the above method, but argument
4237 # theSubShapes here is a list of sub-shapes indices
4239 # @ref swig_UnionIDs "Example"
4240 def UnionIDs(self,theGroup, theSubShapes):
4241 # Example: see GEOM_TestOthers.py
4242 self.GroupOp.UnionIDs(theGroup, theSubShapes)
4243 RaiseIfFailed("UnionIDs", self.GroupOp)
4246 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
4247 # @param theGroup is a GEOM group from which the sub-shapes are removed.
4248 # @param theSubShapes is a list of sub-shapes to be removed.
4250 # @ref tui_working_with_groups_page "Example"
4251 def DifferenceList (self,theGroup, theSubShapes):
4252 # Example: see GEOM_TestOthers.py
4253 self.GroupOp.DifferenceList(theGroup, theSubShapes)
4254 RaiseIfFailed("DifferenceList", self.GroupOp)
4257 ## Works like the above method, but argument
4258 # theSubShapes here is a list of sub-shapes indices
4260 # @ref swig_DifferenceIDs "Example"
4261 def DifferenceIDs(self,theGroup, theSubShapes):
4262 # Example: see GEOM_TestOthers.py
4263 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
4264 RaiseIfFailed("DifferenceIDs", self.GroupOp)
4267 ## Returns a list of sub objects ID stored in the group
4268 # @param theGroup is a GEOM group for which a list of IDs is requested
4270 # @ref swig_GetObjectIDs "Example"
4271 def GetObjectIDs(self,theGroup):
4272 # Example: see GEOM_TestOthers.py
4273 ListIDs = self.GroupOp.GetObjects(theGroup)
4274 RaiseIfFailed("GetObjects", self.GroupOp)
4277 ## Returns a type of sub objects stored in the group
4278 # @param theGroup is a GEOM group which type is returned.
4280 # @ref swig_GetType "Example"
4281 def GetType(self,theGroup):
4282 # Example: see GEOM_TestOthers.py
4283 aType = self.GroupOp.GetType(theGroup)
4284 RaiseIfFailed("GetType", self.GroupOp)
4287 ## Convert a type of geom object from id to string value
4288 # @param theId is a GEOM obect type id.
4290 # @ref swig_GetType "Example"
4291 def ShapeIdToType(self, theId):
4365 return "FREE_BOUNDS"
4373 return "THRUSECTIONS"
4375 return "COMPOUNDFILTER"
4377 return "SHAPES_ON_SHAPE"
4379 return "ELLIPSE_ARC"
4386 return "Shape Id not exist."
4388 ## Returns a main shape associated with the group
4389 # @param theGroup is a GEOM group for which a main shape object is requested
4390 # @return a GEOM object which is a main shape for theGroup
4392 # @ref swig_GetMainShape "Example"
4393 def GetMainShape(self,theGroup):
4394 # Example: see GEOM_TestOthers.py
4395 anObj = self.GroupOp.GetMainShape(theGroup)
4396 RaiseIfFailed("GetMainShape", self.GroupOp)
4399 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
4400 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
4402 # @ref swig_todo "Example"
4403 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
4404 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
4407 Props = self.BasicProperties(edge)
4408 if min_length <= Props[0] and Props[0] <= max_length:
4409 if (not include_min) and (min_length == Props[0]):
4412 if (not include_max) and (Props[0] == max_length):
4415 edges_in_range.append(edge)
4417 if len(edges_in_range) <= 0:
4418 print "No edges found by given criteria"
4421 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
4422 self.UnionList(group_edges, edges_in_range)
4426 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
4427 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
4429 # @ref swig_todo "Example"
4430 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
4431 nb_selected = sg.SelectedCount()
4433 print "Select a shape before calling this function, please."
4436 print "Only one shape must be selected"
4439 id_shape = sg.getSelected(0)
4440 shape = IDToObject( id_shape )
4442 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
4446 if include_min: left_str = " <= "
4447 if include_max: right_str = " <= "
4449 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
4450 + left_str + "length" + right_str + `max_length`)
4452 sg.updateObjBrowser(1)
4459 ## @addtogroup l4_advanced
4462 ## Create a T-shape object with specified caracteristics for the main
4463 # and the incident pipes (radius, width, half-length).
4464 # The extremities of the main pipe are located on junctions points P1 and P2.
4465 # The extremity of the incident pipe is located on junction point P3.
4466 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4467 # the main plane of the T-shape is XOY.
4468 # @param theR1 Internal radius of main pipe
4469 # @param theW1 Width of main pipe
4470 # @param theL1 Half-length of main pipe
4471 # @param theR2 Internal radius of incident pipe (R2 < R1)
4472 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4473 # @param theL2 Half-length of incident pipe
4474 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4475 # @param theP1 1st junction point of main pipe
4476 # @param theP2 2nd junction point of main pipe
4477 # @param theP3 Junction point of incident pipe
4478 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4480 # @ref tui_creation_pipetshape "Example"
4481 def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4482 theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
4483 if (theP1 and theP2 and theP3):
4484 anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3)
4486 anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh)
4487 RaiseIfFailed("MakePipeTShape", self.AdvOp)
4488 if Parameters: anObj[0].SetParameters(Parameters)
4491 ## Create a T-shape object with chamfer and with specified caracteristics for the main
4492 # and the incident pipes (radius, width, half-length). The chamfer is
4493 # created on the junction of the pipes.
4494 # The extremities of the main pipe are located on junctions points P1 and P2.
4495 # The extremity of the incident pipe is located on junction point P3.
4496 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4497 # the main plane of the T-shape is XOY.
4498 # @param theR1 Internal radius of main pipe
4499 # @param theW1 Width of main pipe
4500 # @param theL1 Half-length of main pipe
4501 # @param theR2 Internal radius of incident pipe (R2 < R1)
4502 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4503 # @param theL2 Half-length of incident pipe
4504 # @param theH Height of the chamfer.
4505 # @param theW Width of the chamfer.
4506 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4507 # @param theP1 1st junction point of main pipe
4508 # @param theP2 2nd junction point of main pipe
4509 # @param theP3 Junction point of incident pipe
4510 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4512 # @ref tui_creation_pipetshape "Example"
4513 def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4514 theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW)
4515 if (theP1 and theP2 and theP3):
4516 anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3)
4518 anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh)
4519 RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp)
4520 if Parameters: anObj[0].SetParameters(Parameters)
4523 ## Create a T-shape object with fillet and with specified caracteristics for the main
4524 # and the incident pipes (radius, width, half-length). The fillet is
4525 # created on the junction of the pipes.
4526 # The extremities of the main pipe are located on junctions points P1 and P2.
4527 # The extremity of the incident pipe is located on junction point P3.
4528 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4529 # the main plane of the T-shape is XOY.
4530 # @param theR1 Internal radius of main pipe
4531 # @param theW1 Width of main pipe
4532 # @param theL1 Half-length of main pipe
4533 # @param theR2 Internal radius of incident pipe (R2 < R1)
4534 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4535 # @param theL2 Half-length of incident pipe
4536 # @param theRF Radius of curvature of fillet.
4537 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4538 # @param theP1 1st junction point of main pipe
4539 # @param theP2 2nd junction point of main pipe
4540 # @param theP3 Junction point of incident pipe
4541 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4543 # @ref tui_creation_pipetshape "Example"
4544 def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4545 theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF)
4546 if (theP1 and theP2 and theP3):
4547 anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3)
4549 anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh)
4550 RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp)
4551 if Parameters: anObj[0].SetParameters(Parameters)
4554 #@@ insert new functions before this line @@ do not remove this line @@#
4556 # end of l4_advanced
4559 ## Create a copy of the given object
4560 # @ingroup l1_geompy_auxiliary
4562 # @ref swig_all_advanced "Example"
4563 def MakeCopy(self,theOriginal):
4564 # Example: see GEOM_TestAll.py
4565 anObj = self.InsertOp.MakeCopy(theOriginal)
4566 RaiseIfFailed("MakeCopy", self.InsertOp)
4569 ## Add Path to load python scripts from
4570 # @ingroup l1_geompy_auxiliary
4571 def addPath(self,Path):
4572 if (sys.path.count(Path) < 1):
4573 sys.path.append(Path)
4577 ## Load marker texture from the file
4578 # @param Path a path to the texture file
4579 # @return unique texture identifier
4580 # @ingroup l1_geompy_auxiliary
4581 def LoadTexture(self, Path):
4582 # Example: see GEOM_TestAll.py
4583 ID = self.InsertOp.LoadTexture(Path)
4584 RaiseIfFailed("LoadTexture", self.InsertOp)
4587 ## Add marker texture. @a Width and @a Height parameters
4588 # specify width and height of the texture in pixels.
4589 # If @a RowData is @c True, @a Texture parameter should represent texture data
4590 # packed into the byte array. If @a RowData is @c False (default), @a Texture
4591 # parameter should be unpacked string, in which '1' symbols represent opaque
4592 # pixels and '0' represent transparent pixels of the texture bitmap.
4594 # @param Width texture width in pixels
4595 # @param Height texture height in pixels
4596 # @param Texture texture data
4597 # @param RowData if @c True, @a Texture data are packed in the byte stream
4598 # @ingroup l1_geompy_auxiliary
4599 def AddTexture(self, Width, Height, Texture, RowData=False):
4600 # Example: see GEOM_TestAll.py
4601 if not RowData: Texture = PackData(Texture)
4602 ID = self.InsertOp.AddTexture(Width, Height, Texture)
4603 RaiseIfFailed("AddTexture", self.InsertOp)
4607 #Register the new proxy for GEOM_Gen
4608 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)