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_access Access to sub-shapes by their unique IDs inside the main shape
55 ## @defgroup l4_obtain Access to subshapes by a criteria
56 ## @defgroup l4_advanced Advanced objects creation functions
61 ## @defgroup l2_transforming Transforming geometrical objects
63 ## @defgroup l3_basic_op Basic Operations
64 ## @defgroup l3_boolean Boolean Operations
65 ## @defgroup l3_transform Transformation Operations
66 ## @defgroup l3_local Local Operations (Fillet and Chamfer)
67 ## @defgroup l3_blocks_op Blocks Operations
68 ## @defgroup l3_healing Repairing Operations
69 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of subshapes
72 ## @defgroup l2_measure Using measurement tools
80 from salome_notebook import *
85 ## Enumeration ShapeType as a dictionary
86 # @ingroup l1_geompy_auxiliary
87 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
89 ## Raise an Error, containing the Method_name, if Operation is Failed
90 ## @ingroup l1_geompy_auxiliary
91 def RaiseIfFailed (Method_name, Operation):
92 if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
93 raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
95 ## Return list of variables value from salome notebook
96 ## @ingroup l1_geompy_auxiliary
97 def ParseParameters(*parameters):
100 for parameter in parameters:
101 if isinstance(parameter, list):
102 lResults = ParseParameters(*parameter)
103 if len(lResults) > 0:
104 Result.append(lResults[:-1])
105 StringResult += lResults[-1].split(":")
109 if isinstance(parameter,str):
110 if notebook.isVariable(parameter):
111 Result.append(notebook.get(parameter))
113 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
116 Result.append(parameter)
118 StringResult.append(str(parameter))
122 Result.append(":".join(StringResult))
124 Result = ":".join(StringResult)
127 ## Return list of variables value from salome notebook
128 ## @ingroup l1_geompy_auxiliary
132 for parameter in list:
133 if isinstance(parameter,str) and notebook.isVariable(parameter):
134 Result.append(str(notebook.get(parameter)))
137 Result.append(str(parameter))
140 StringResult = StringResult + str(parameter)
141 StringResult = StringResult + ":"
143 StringResult = StringResult[:len(StringResult)-1]
144 return Result, StringResult
146 ## Return list of variables value from salome notebook
147 ## @ingroup l1_geompy_auxiliary
148 def ParseSketcherCommand(command):
151 sections = command.split(":")
152 for section in sections:
153 parameters = section.split(" ")
155 for parameter in parameters:
156 if paramIndex > 1 and parameter.find("'") != -1:
157 parameter = parameter.replace("'","")
158 if notebook.isVariable(parameter):
159 Result = Result + str(notebook.get(parameter)) + " "
162 raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
166 Result = Result + str(parameter) + " "
169 StringResult = StringResult + parameter
170 StringResult = StringResult + ":"
172 paramIndex = paramIndex + 1
174 Result = Result[:len(Result)-1] + ":"
176 Result = Result[:len(Result)-1]
177 return Result, StringResult
179 ## Helper function which can be used to pack the passed string to the byte data.
180 ## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
181 ## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
184 ## val = PackData("10001110") # val = 0xAE
185 ## val = PackData("1") # val = 0x80
187 ## @param data unpacked data - a string containing '1' and '0' symbols
188 ## @return data packed to the byte stream
189 ## @ingroup l1_geompy_auxiliary
192 if len(data)%8: bytes += 1
194 for b in range(bytes):
195 d = data[b*8:(b+1)*8]
200 if d[i] == "1": val += 1
202 raise "Invalid symbol %s" % d[i]
209 ## Read bitmap texture from the text file.
210 ## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
211 ## A zero symbol ('0') represents transparent pixel of the texture bitmap.
212 ## The function returns width and height of the pixmap in pixels and byte stream representing
213 ## texture bitmap itself.
215 ## This function can be used to read the texture to the byte stream in order to pass it to
216 ## the AddTexture() function of geompy class.
220 ## geompy.init_geom(salome.myStudy)
221 ## texture = geompy.readtexture('mytexture.dat')
222 ## texture = geompy.AddTexture(*texture)
223 ## obj.SetMarkerTexture(texture)
225 ## @param fname texture file name
226 ## @return sequence of tree values: texture's width, height in pixels and its byte stream
227 ## @ingroup l1_geompy_auxiliary
228 def ReadTexture(fname):
231 lines = [ l.strip() for l in f.readlines()]
234 if lines: maxlen = max([len(x) for x in lines])
236 if maxlen%8: lenbytes += 1
240 lenline = (len(line)/8+1)*8
243 lenline = (len(line)/8)*8
245 for i in range(lenline/8):
248 if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
251 bytedata += PackData(byte)
253 for i in range(lenline/8, lenbytes):
254 bytedata += PackData("0")
256 return lenbytes*8, len(lines), bytedata
261 ## Kinds of shape enumeration
262 # @ingroup l1_geompy_auxiliary
263 kind = GEOM.GEOM_IKindOfShape
265 ## Information about closed/unclosed state of shell or wire
266 # @ingroup l1_geompy_auxiliary
272 class geompyDC(GEOM._objref_GEOM_Gen):
275 GEOM._objref_GEOM_Gen.__init__(self)
276 self.myBuilder = None
295 ## @addtogroup l1_geompy_auxiliary
297 def init_geom(self,theStudy):
298 self.myStudy = theStudy
299 self.myStudyId = self.myStudy._get_StudyId()
300 self.myBuilder = self.myStudy.NewBuilder()
301 self.father = self.myStudy.FindComponent("GEOM")
302 if self.father is None:
303 self.father = self.myBuilder.NewComponent("GEOM")
304 A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
305 FName = A1._narrow(SALOMEDS.AttributeName)
306 FName.SetValue("Geometry")
307 A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
308 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
309 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
310 self.myBuilder.DefineComponentInstance(self.father,self)
312 self.BasicOp = self.GetIBasicOperations (self.myStudyId)
313 self.CurvesOp = self.GetICurvesOperations (self.myStudyId)
314 self.PrimOp = self.GetI3DPrimOperations (self.myStudyId)
315 self.ShapesOp = self.GetIShapesOperations (self.myStudyId)
316 self.HealOp = self.GetIHealingOperations (self.myStudyId)
317 self.InsertOp = self.GetIInsertOperations (self.myStudyId)
318 self.BoolOp = self.GetIBooleanOperations (self.myStudyId)
319 self.TrsfOp = self.GetITransformOperations(self.myStudyId)
320 self.LocalOp = self.GetILocalOperations (self.myStudyId)
321 self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
322 self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
323 self.GroupOp = self.GetIGroupOperations (self.myStudyId)
324 self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
327 ## Get name for sub-shape aSubObj of shape aMainObj
329 # @ref swig_SubShapeAllSorted "Example"
330 def SubShapeName(self,aSubObj, aMainObj):
331 # Example: see GEOM_TestAll.py
333 #aSubId = orb.object_to_string(aSubObj)
334 #aMainId = orb.object_to_string(aMainObj)
335 #index = gg.getIndexTopology(aSubId, aMainId)
336 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
337 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
338 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
341 ## Publish in study aShape with name aName
343 # \param aShape the shape to be published
344 # \param aName the name for the shape
345 # \param doRestoreSubShapes if True, finds and publishes also
346 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
347 # and published sub-shapes of arguments
348 # \param theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes for
349 # these arguments description
350 # \return study entry of the published shape in form of string
352 # @ref swig_MakeQuad4Vertices "Example"
353 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
354 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
355 # Example: see GEOM_TestAll.py
357 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
358 if doRestoreSubShapes:
359 self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
360 theFindMethod, theInheritFirstArg, True )
362 print "addToStudy() failed"
364 return aShape.GetStudyEntry()
366 ## Publish in study aShape with name aName as sub-object of previously published aFather
368 # @ref swig_SubShapeAllSorted "Example"
369 def addToStudyInFather(self, aFather, aShape, aName):
370 # Example: see GEOM_TestAll.py
372 aSObject = self.AddInStudy(self.myStudy, aShape, aName, aFather)
374 print "addToStudyInFather() failed"
376 return aShape.GetStudyEntry()
378 # end of l1_geompy_auxiliary
381 ## @addtogroup l3_restore_ss
384 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
385 # To be used from python scripts out of geompy.addToStudy (non-default usage)
386 # \param theObject published GEOM object, arguments of which will be published
387 # \param theArgs list of GEOM_Object, operation arguments to be published.
388 # If this list is empty, all operation arguments will be published
389 # \param theFindMethod method to search subshapes, corresponding to arguments and
390 # their subshapes. Value from enumeration GEOM::find_shape_method.
391 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
392 # Do not publish subshapes in place of arguments, but only
393 # in place of subshapes of the first argument,
394 # because the whole shape corresponds to the first argument.
395 # Mainly to be used after transformations, but it also can be
396 # usefull after partition with one object shape, and some other
397 # operations, where only the first argument has to be considered.
398 # If theObject has only one argument shape, this flag is automatically
399 # considered as True, not regarding really passed value.
400 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
401 # and prefix "from_subshapes_of_" to names of partially restored subshapes.
402 # \return list of published sub-shapes
404 # @ref tui_restore_prs_params "Example"
405 def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
406 theInheritFirstArg=False, theAddPrefix=True):
407 # Example: see GEOM_TestAll.py
408 return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
409 theFindMethod, theInheritFirstArg, theAddPrefix)
411 # end of l3_restore_ss
414 ## @addtogroup l3_basic_go
417 ## Create point by three coordinates.
418 # @param theX The X coordinate of the point.
419 # @param theY The Y coordinate of the point.
420 # @param theZ The Z coordinate of the point.
421 # @return New GEOM_Object, containing the created point.
423 # @ref tui_creation_point "Example"
424 def MakeVertex(self,theX, theY, theZ):
425 # Example: see GEOM_TestAll.py
426 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
427 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
428 RaiseIfFailed("MakePointXYZ", self.BasicOp)
429 anObj.SetParameters(Parameters)
432 ## Create a point, distant from the referenced point
433 # on the given distances along the coordinate axes.
434 # @param theReference The referenced point.
435 # @param theX Displacement from the referenced point along OX axis.
436 # @param theY Displacement from the referenced point along OY axis.
437 # @param theZ Displacement from the referenced point along OZ axis.
438 # @return New GEOM_Object, containing the created point.
440 # @ref tui_creation_point "Example"
441 def MakeVertexWithRef(self,theReference, theX, theY, theZ):
442 # Example: see GEOM_TestAll.py
443 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
444 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
445 RaiseIfFailed("MakePointWithReference", self.BasicOp)
446 anObj.SetParameters(Parameters)
449 ## Create a point, corresponding to the given parameter on the given curve.
450 # @param theRefCurve The referenced curve.
451 # @param theParameter Value of parameter on the referenced curve.
452 # @return New GEOM_Object, containing the created point.
454 # @ref tui_creation_point "Example"
455 def MakeVertexOnCurve(self,theRefCurve, theParameter):
456 # Example: see GEOM_TestAll.py
457 theParameter, Parameters = ParseParameters(theParameter)
458 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
459 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
460 anObj.SetParameters(Parameters)
463 ## Create a point by projection give coordinates on the given curve
464 # @param theRefCurve The referenced curve.
465 # @param theX X-coordinate in 3D space
466 # @param theY Y-coordinate in 3D space
467 # @param theZ Z-coordinate in 3D space
468 # @return New GEOM_Object, containing the created point.
470 # @ref tui_creation_point "Example"
471 def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ):
472 # Example: see GEOM_TestAll.py
473 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
474 anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
475 RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
476 anObj.SetParameters(Parameters)
479 ## Create a point, corresponding to the given parameters on the
481 # @param theRefSurf The referenced surface.
482 # @param theUParameter Value of U-parameter on the referenced surface.
483 # @param theVParameter Value of V-parameter on the referenced surface.
484 # @return New GEOM_Object, containing the created point.
486 # @ref swig_MakeVertexOnSurface "Example"
487 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
488 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
489 # Example: see GEOM_TestAll.py
490 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
491 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
492 anObj.SetParameters(Parameters);
495 ## Create a point by projection give coordinates on the given surface
496 # @param theRefSurf The referenced surface.
497 # @param theX X-coordinate in 3D space
498 # @param theY Y-coordinate in 3D space
499 # @param theZ Z-coordinate in 3D space
500 # @return New GEOM_Object, containing the created point.
502 # @ref swig_MakeVertexOnSurfaceByCoord "Example"
503 def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ):
504 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
505 # Example: see GEOM_TestAll.py
506 anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
507 RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
508 anObj.SetParameters(Parameters);
511 ## Create a point on intersection of two lines.
512 # @param theRefLine1, theRefLine2 The referenced lines.
513 # @return New GEOM_Object, containing the created point.
515 # @ref swig_MakeVertexOnLinesIntersection "Example"
516 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
517 # Example: see GEOM_TestAll.py
518 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
519 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
522 ## Create a tangent, corresponding to the given parameter on the given curve.
523 # @param theRefCurve The referenced curve.
524 # @param theParameter Value of parameter on the referenced curve.
525 # @return New GEOM_Object, containing the created tangent.
527 # @ref swig_MakeTangentOnCurve "Example"
528 def MakeTangentOnCurve(self, theRefCurve, theParameter):
529 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
530 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
533 ## Create a tangent plane, corresponding to the given parameter on the given face.
534 # @param theFace The face for which tangent plane should be built.
535 # @param theParameterV vertical value of the center point (0.0 - 1.0).
536 # @param theParameterU horisontal value of the center point (0.0 - 1.0).
537 # @param theTrimSize the size of plane.
538 # @return New GEOM_Object, containing the created tangent.
540 # @ref swig_MakeTangentPlaneOnFace "Example"
541 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize):
542 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
543 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
546 ## Create a vector with the given components.
547 # @param theDX X component of the vector.
548 # @param theDY Y component of the vector.
549 # @param theDZ Z component of the vector.
550 # @return New GEOM_Object, containing the created vector.
552 # @ref tui_creation_vector "Example"
553 def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
554 # Example: see GEOM_TestAll.py
555 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
556 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
557 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
558 anObj.SetParameters(Parameters)
561 ## Create a vector between two points.
562 # @param thePnt1 Start point for the vector.
563 # @param thePnt2 End point for the vector.
564 # @return New GEOM_Object, containing the created vector.
566 # @ref tui_creation_vector "Example"
567 def MakeVector(self,thePnt1, thePnt2):
568 # Example: see GEOM_TestAll.py
569 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
570 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
573 ## Create a line, passing through the given point
574 # and parrallel to the given direction
575 # @param thePnt Point. The resulting line will pass through it.
576 # @param theDir Direction. The resulting line will be parallel to it.
577 # @return New GEOM_Object, containing the created line.
579 # @ref tui_creation_line "Example"
580 def MakeLine(self,thePnt, theDir):
581 # Example: see GEOM_TestAll.py
582 anObj = self.BasicOp.MakeLine(thePnt, theDir)
583 RaiseIfFailed("MakeLine", self.BasicOp)
586 ## Create a line, passing through the given points
587 # @param thePnt1 First of two points, defining the line.
588 # @param thePnt2 Second of two points, defining the line.
589 # @return New GEOM_Object, containing the created line.
591 # @ref tui_creation_line "Example"
592 def MakeLineTwoPnt(self,thePnt1, thePnt2):
593 # Example: see GEOM_TestAll.py
594 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
595 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
598 ## Create a line on two faces intersection.
599 # @param theFace1 First of two faces, defining the line.
600 # @param theFace2 Second of two faces, defining the line.
601 # @return New GEOM_Object, containing the created line.
603 # @ref swig_MakeLineTwoFaces "Example"
604 def MakeLineTwoFaces(self, theFace1, theFace2):
605 # Example: see GEOM_TestAll.py
606 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
607 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
610 ## Create a plane, passing through the given point
611 # and normal to the given vector.
612 # @param thePnt Point, the plane has to pass through.
613 # @param theVec Vector, defining the plane normal direction.
614 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
615 # @return New GEOM_Object, containing the created plane.
617 # @ref tui_creation_plane "Example"
618 def MakePlane(self,thePnt, theVec, theTrimSize):
619 # Example: see GEOM_TestAll.py
620 theTrimSize, Parameters = ParseParameters(theTrimSize);
621 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
622 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
623 anObj.SetParameters(Parameters)
626 ## Create a plane, passing through the three given points
627 # @param thePnt1 First of three points, defining the plane.
628 # @param thePnt2 Second of three points, defining the plane.
629 # @param thePnt3 Fird of three points, defining the plane.
630 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
631 # @return New GEOM_Object, containing the created plane.
633 # @ref tui_creation_plane "Example"
634 def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
635 # Example: see GEOM_TestAll.py
636 theTrimSize, Parameters = ParseParameters(theTrimSize);
637 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
638 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
639 anObj.SetParameters(Parameters)
642 ## Create a plane, similar to the existing one, but with another size of representing face.
643 # @param theFace Referenced plane or LCS(Marker).
644 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
645 # @return New GEOM_Object, containing the created plane.
647 # @ref tui_creation_plane "Example"
648 def MakePlaneFace(self,theFace, theTrimSize):
649 # Example: see GEOM_TestAll.py
650 theTrimSize, Parameters = ParseParameters(theTrimSize);
651 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
652 RaiseIfFailed("MakePlaneFace", self.BasicOp)
653 anObj.SetParameters(Parameters)
656 ## Create a plane, passing through the 2 vectors
657 # with center in a start point of the first vector.
658 # @param theVec1 Vector, defining center point and plane direction.
659 # @param theVec2 Vector, defining the plane normal direction.
660 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
661 # @return New GEOM_Object, containing the created plane.
663 # @ref tui_creation_plane "Example"
664 def MakePlane2Vec(self,theVec1, theVec2, theTrimSize):
665 # Example: see GEOM_TestAll.py
666 theTrimSize, Parameters = ParseParameters(theTrimSize);
667 anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
668 RaiseIfFailed("MakePlane2Vec", self.BasicOp)
669 anObj.SetParameters(Parameters)
672 ## Create a plane, based on a Local coordinate system.
673 # @param theLCS coordinate system, defining plane.
674 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
675 # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
676 # @return New GEOM_Object, containing the created plane.
678 # @ref tui_creation_plane "Example"
679 def MakePlaneLCS(self,theLCS, theTrimSize, theOrientation):
680 # Example: see GEOM_TestAll.py
681 theTrimSize, Parameters = ParseParameters(theTrimSize);
682 anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
683 RaiseIfFailed("MakePlaneLCS", self.BasicOp)
684 anObj.SetParameters(Parameters)
687 ## Create a local coordinate system.
688 # @param OX,OY,OZ Three coordinates of coordinate system origin.
689 # @param XDX,XDY,XDZ Three components of OX direction
690 # @param YDX,YDY,YDZ Three components of OY direction
691 # @return New GEOM_Object, containing the created coordinate system.
693 # @ref swig_MakeMarker "Example"
694 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
695 # Example: see GEOM_TestAll.py
696 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
697 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
698 RaiseIfFailed("MakeMarker", self.BasicOp)
699 anObj.SetParameters(Parameters)
702 ## Create a local coordinate system from shape.
703 # @param theShape The initial shape to detect the coordinate system.
704 # @return New GEOM_Object, containing the created coordinate system.
706 # @ref tui_creation_lcs "Example"
707 def MakeMarkerFromShape(self, theShape):
708 anObj = self.BasicOp.MakeMarkerFromShape(theShape)
709 RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
712 ## Create a local coordinate system from point and two vectors.
713 # @param theOrigin Point of coordinate system origin.
714 # @param theXVec Vector of X direction
715 # @param theYVec Vector of Y direction
716 # @return New GEOM_Object, containing the created coordinate system.
718 # @ref tui_creation_lcs "Example"
719 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
720 anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
721 RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
727 ## @addtogroup l4_curves
730 ## Create an arc of circle, passing through three given points.
731 # @param thePnt1 Start point of the arc.
732 # @param thePnt2 Middle point of the arc.
733 # @param thePnt3 End point of the arc.
734 # @return New GEOM_Object, containing the created arc.
736 # @ref swig_MakeArc "Example"
737 def MakeArc(self,thePnt1, thePnt2, thePnt3):
738 # Example: see GEOM_TestAll.py
739 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
740 RaiseIfFailed("MakeArc", self.CurvesOp)
743 ## Create an arc of circle from a center and 2 points.
744 # @param thePnt1 Center of the arc
745 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
746 # @param thePnt3 End point of the arc (Gives also a direction)
747 # @param theSense Orientation of the arc
748 # @return New GEOM_Object, containing the created arc.
750 # @ref swig_MakeArc "Example"
751 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
752 # Example: see GEOM_TestAll.py
753 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
754 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
757 ## Create an arc of ellipse, of center and two points.
758 # @param theCenter Center of the arc.
759 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
760 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
761 # @return New GEOM_Object, containing the created arc.
763 # @ref swig_MakeArc "Example"
764 def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2):
765 # Example: see GEOM_TestAll.py
766 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
767 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
770 ## Create a circle with given center, normal vector and radius.
771 # @param thePnt Circle center.
772 # @param theVec Vector, normal to the plane of the circle.
773 # @param theR Circle radius.
774 # @return New GEOM_Object, containing the created circle.
776 # @ref tui_creation_circle "Example"
777 def MakeCircle(self, thePnt, theVec, theR):
778 # Example: see GEOM_TestAll.py
779 theR, Parameters = ParseParameters(theR)
780 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
781 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
782 anObj.SetParameters(Parameters)
785 ## Create a circle with given radius.
786 # Center of the circle will be in the origin of global
787 # coordinate system and normal vector will be codirected with Z axis
788 # @param theR Circle radius.
789 # @return New GEOM_Object, containing the created circle.
790 def MakeCircleR(self, theR):
791 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
792 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
795 ## Create a circle, passing through three given points
796 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
797 # @return New GEOM_Object, containing the created circle.
799 # @ref tui_creation_circle "Example"
800 def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
801 # Example: see GEOM_TestAll.py
802 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
803 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
806 ## Create a circle, with given point1 as center,
807 # passing through the point2 as radius and laying in the plane,
808 # defined by all three given points.
809 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
810 # @return New GEOM_Object, containing the created circle.
812 # @ref swig_MakeCircle "Example"
813 def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
814 # Example: see GEOM_example6.py
815 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
816 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
819 ## Create an ellipse with given center, normal vector and radiuses.
820 # @param thePnt Ellipse center.
821 # @param theVec Vector, normal to the plane of the ellipse.
822 # @param theRMajor Major ellipse radius.
823 # @param theRMinor Minor ellipse radius.
824 # @param theVecMaj Vector, direction of the ellipse's main axis.
825 # @return New GEOM_Object, containing the created ellipse.
827 # @ref tui_creation_ellipse "Example"
828 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None):
829 # Example: see GEOM_TestAll.py
830 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
831 if theVecMaj is not None:
832 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
834 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
836 RaiseIfFailed("MakeEllipse", self.CurvesOp)
837 anObj.SetParameters(Parameters)
840 ## Create an ellipse with given radiuses.
841 # Center of the ellipse will be in the origin of global
842 # coordinate system and normal vector will be codirected with Z axis
843 # @param theRMajor Major ellipse radius.
844 # @param theRMinor Minor ellipse radius.
845 # @return New GEOM_Object, containing the created ellipse.
846 def MakeEllipseRR(self, theRMajor, theRMinor):
847 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
848 RaiseIfFailed("MakeEllipse", self.CurvesOp)
851 ## Create a polyline on the set of points.
852 # @param thePoints Sequence of points for the polyline.
853 # @return New GEOM_Object, containing the created polyline.
855 # @ref tui_creation_curve "Example"
856 def MakePolyline(self,thePoints):
857 # Example: see GEOM_TestAll.py
858 anObj = self.CurvesOp.MakePolyline(thePoints)
859 RaiseIfFailed("MakePolyline", self.CurvesOp)
862 ## Create bezier curve on the set of points.
863 # @param thePoints Sequence of points for the bezier curve.
864 # @return New GEOM_Object, containing the created bezier curve.
866 # @ref tui_creation_curve "Example"
867 def MakeBezier(self,thePoints):
868 # Example: see GEOM_TestAll.py
869 anObj = self.CurvesOp.MakeSplineBezier(thePoints)
870 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
873 ## Create B-Spline curve on the set of points.
874 # @param thePoints Sequence of points for the B-Spline curve.
875 # @param theIsClosed If True, build a closed curve.
876 # @return New GEOM_Object, containing the created B-Spline curve.
878 # @ref tui_creation_curve "Example"
879 def MakeInterpol(self, thePoints, theIsClosed=False):
880 # Example: see GEOM_TestAll.py
881 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed)
882 RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
888 ## @addtogroup l3_sketcher
891 ## Create a sketcher (wire or face), following the textual description,
892 # passed through <VAR>theCommand</VAR> argument. \n
893 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
894 # Format of the description string have to be the following:
896 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
899 # - x1, y1 are coordinates of the first sketcher point (zero by default),
901 # - "R angle" : Set the direction by angle
902 # - "D dx dy" : Set the direction by DX & DY
905 # - "TT x y" : Create segment by point at X & Y
906 # - "T dx dy" : Create segment by point with DX & DY
907 # - "L length" : Create segment by direction & Length
908 # - "IX x" : Create segment by direction & Intersect. X
909 # - "IY y" : Create segment by direction & Intersect. Y
912 # - "C radius length" : Create arc by direction, radius and length(in degree)
913 # - "AA x y": Create arc by point at X & Y
914 # - "A dx dy" : Create arc by point with DX & DY
917 # - "WW" : Close Wire (to finish)
918 # - "WF" : Close Wire and build face (to finish)
920 # @param theCommand String, defining the sketcher in local
921 # coordinates of the working plane.
922 # @param theWorkingPlane Nine double values, defining origin,
923 # OZ and OX directions of the working plane.
924 # @return New GEOM_Object, containing the created wire.
926 # @ref tui_sketcher_page "Example"
927 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
928 # Example: see GEOM_TestAll.py
929 theCommand,Parameters = ParseSketcherCommand(theCommand)
930 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
931 RaiseIfFailed("MakeSketcher", self.CurvesOp)
932 anObj.SetParameters(Parameters)
935 ## Create a sketcher (wire or face), following the textual description,
936 # passed through <VAR>theCommand</VAR> argument. \n
937 # For format of the description string see the previous method.\n
938 # @param theCommand String, defining the sketcher in local
939 # coordinates of the working plane.
940 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
941 # @return New GEOM_Object, containing the created wire.
943 # @ref tui_sketcher_page "Example"
944 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
945 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
946 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
949 ## Create a sketcher wire, following the numerical description,
950 # passed through <VAR>theCoordinates</VAR> argument. \n
951 # @param theCoordinates double values, defining points to create a wire,
953 # @return New GEOM_Object, containing the created wire.
955 # @ref tui_sketcher_page "Example"
956 def Make3DSketcher(self, theCoordinates):
957 theCoordinates,Parameters = ParseParameters(theCoordinates)
958 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
959 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
960 anObj.SetParameters(Parameters)
966 ## @addtogroup l3_3d_primitives
969 ## Create a box by coordinates of two opposite vertices.
971 # @ref tui_creation_box "Example"
972 def MakeBox(self,x1,y1,z1,x2,y2,z2):
973 # Example: see GEOM_TestAll.py
974 pnt1 = self.MakeVertex(x1,y1,z1)
975 pnt2 = self.MakeVertex(x2,y2,z2)
976 return self.MakeBoxTwoPnt(pnt1,pnt2)
978 ## Create a box with specified dimensions along the coordinate axes
979 # and with edges, parallel to the coordinate axes.
980 # Center of the box will be at point (DX/2, DY/2, DZ/2).
981 # @param theDX Length of Box edges, parallel to OX axis.
982 # @param theDY Length of Box edges, parallel to OY axis.
983 # @param theDZ Length of Box edges, parallel to OZ axis.
984 # @return New GEOM_Object, containing the created box.
986 # @ref tui_creation_box "Example"
987 def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
988 # Example: see GEOM_TestAll.py
989 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
990 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
991 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
992 anObj.SetParameters(Parameters)
995 ## Create a box with two specified opposite vertices,
996 # and with edges, parallel to the coordinate axes
997 # @param thePnt1 First of two opposite vertices.
998 # @param thePnt2 Second of two opposite vertices.
999 # @return New GEOM_Object, containing the created box.
1001 # @ref tui_creation_box "Example"
1002 def MakeBoxTwoPnt(self,thePnt1, thePnt2):
1003 # Example: see GEOM_TestAll.py
1004 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
1005 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
1008 ## Create a face with specified dimensions along OX-OY coordinate axes,
1009 # with edges, parallel to this coordinate axes.
1010 # @param theH height of Face.
1011 # @param theW width of Face.
1012 # @param theOrientation orientation belong axis OXY OYZ OZX
1013 # @return New GEOM_Object, containing the created face.
1015 # @ref tui_creation_face "Example"
1016 def MakeFaceHW(self,theH, theW, theOrientation):
1017 # Example: see GEOM_TestAll.py
1018 theH,theW,Parameters = ParseParameters(theH, theW)
1019 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
1020 RaiseIfFailed("MakeFaceHW", self.PrimOp)
1021 anObj.SetParameters(Parameters)
1024 ## Create a face from another plane and two sizes,
1025 # vertical size and horisontal size.
1026 # @param theObj Normale vector to the creating face or
1028 # @param theH Height (vertical size).
1029 # @param theW Width (horisontal size).
1030 # @return New GEOM_Object, containing the created face.
1032 # @ref tui_creation_face "Example"
1033 def MakeFaceObjHW(self, theObj, theH, theW):
1034 # Example: see GEOM_TestAll.py
1035 theH,theW,Parameters = ParseParameters(theH, theW)
1036 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
1037 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
1038 anObj.SetParameters(Parameters)
1041 ## Create a disk with given center, normal vector and radius.
1042 # @param thePnt Disk center.
1043 # @param theVec Vector, normal to the plane of the disk.
1044 # @param theR Disk radius.
1045 # @return New GEOM_Object, containing the created disk.
1047 # @ref tui_creation_disk "Example"
1048 def MakeDiskPntVecR(self,thePnt, theVec, theR):
1049 # Example: see GEOM_TestAll.py
1050 theR,Parameters = ParseParameters(theR)
1051 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
1052 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
1053 anObj.SetParameters(Parameters)
1056 ## Create a disk, passing through three given points
1057 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
1058 # @return New GEOM_Object, containing the created disk.
1060 # @ref tui_creation_disk "Example"
1061 def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3):
1062 # Example: see GEOM_TestAll.py
1063 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
1064 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
1067 ## Create a disk with specified dimensions along OX-OY coordinate axes.
1068 # @param theR Radius of Face.
1069 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
1070 # @return New GEOM_Object, containing the created disk.
1072 # @ref tui_creation_face "Example"
1073 def MakeDiskR(self,theR, theOrientation):
1074 # Example: see GEOM_TestAll.py
1075 theR,Parameters = ParseParameters(theR)
1076 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
1077 RaiseIfFailed("MakeDiskR", self.PrimOp)
1078 anObj.SetParameters(Parameters)
1081 ## Create a cylinder with given base point, axis, radius and height.
1082 # @param thePnt Central point of cylinder base.
1083 # @param theAxis Cylinder axis.
1084 # @param theR Cylinder radius.
1085 # @param theH Cylinder height.
1086 # @return New GEOM_Object, containing the created cylinder.
1088 # @ref tui_creation_cylinder "Example"
1089 def MakeCylinder(self,thePnt, theAxis, theR, theH):
1090 # Example: see GEOM_TestAll.py
1091 theR,theH,Parameters = ParseParameters(theR, theH)
1092 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
1093 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
1094 anObj.SetParameters(Parameters)
1097 ## Create a cylinder with given radius and height at
1098 # the origin of coordinate system. Axis of the cylinder
1099 # will be collinear to the OZ axis of the coordinate system.
1100 # @param theR Cylinder radius.
1101 # @param theH Cylinder height.
1102 # @return New GEOM_Object, containing the created cylinder.
1104 # @ref tui_creation_cylinder "Example"
1105 def MakeCylinderRH(self,theR, theH):
1106 # Example: see GEOM_TestAll.py
1107 theR,theH,Parameters = ParseParameters(theR, theH)
1108 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
1109 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
1110 anObj.SetParameters(Parameters)
1113 ## Create a sphere with given center and radius.
1114 # @param thePnt Sphere center.
1115 # @param theR Sphere radius.
1116 # @return New GEOM_Object, containing the created sphere.
1118 # @ref tui_creation_sphere "Example"
1119 def MakeSpherePntR(self, thePnt, theR):
1120 # Example: see GEOM_TestAll.py
1121 theR,Parameters = ParseParameters(theR)
1122 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
1123 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
1124 anObj.SetParameters(Parameters)
1127 ## Create a sphere with given center and radius.
1128 # @param x,y,z Coordinates of sphere center.
1129 # @param theR Sphere radius.
1130 # @return New GEOM_Object, containing the created sphere.
1132 # @ref tui_creation_sphere "Example"
1133 def MakeSphere(self, x, y, z, theR):
1134 # Example: see GEOM_TestAll.py
1135 point = self.MakeVertex(x, y, z)
1136 anObj = self.MakeSpherePntR(point, theR)
1139 ## Create a sphere with given radius at the origin of coordinate system.
1140 # @param theR Sphere radius.
1141 # @return New GEOM_Object, containing the created sphere.
1143 # @ref tui_creation_sphere "Example"
1144 def MakeSphereR(self, theR):
1145 # Example: see GEOM_TestAll.py
1146 theR,Parameters = ParseParameters(theR)
1147 anObj = self.PrimOp.MakeSphereR(theR)
1148 RaiseIfFailed("MakeSphereR", self.PrimOp)
1149 anObj.SetParameters(Parameters)
1152 ## Create a cone with given base point, axis, height and radiuses.
1153 # @param thePnt Central point of the first cone base.
1154 # @param theAxis Cone axis.
1155 # @param theR1 Radius of the first cone base.
1156 # @param theR2 Radius of the second cone base.
1157 # \note If both radiuses are non-zero, the cone will be truncated.
1158 # \note If the radiuses are equal, a cylinder will be created instead.
1159 # @param theH Cone height.
1160 # @return New GEOM_Object, containing the created cone.
1162 # @ref tui_creation_cone "Example"
1163 def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
1164 # Example: see GEOM_TestAll.py
1165 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1166 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
1167 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
1168 anObj.SetParameters(Parameters)
1171 ## Create a cone with given height and radiuses at
1172 # the origin of coordinate system. Axis of the cone will
1173 # be collinear to the OZ axis of the coordinate system.
1174 # @param theR1 Radius of the first cone base.
1175 # @param theR2 Radius of the second cone base.
1176 # \note If both radiuses are non-zero, the cone will be truncated.
1177 # \note If the radiuses are equal, a cylinder will be created instead.
1178 # @param theH Cone height.
1179 # @return New GEOM_Object, containing the created cone.
1181 # @ref tui_creation_cone "Example"
1182 def MakeConeR1R2H(self,theR1, theR2, theH):
1183 # Example: see GEOM_TestAll.py
1184 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
1185 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
1186 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
1187 anObj.SetParameters(Parameters)
1190 ## Create a torus with given center, normal vector and radiuses.
1191 # @param thePnt Torus central point.
1192 # @param theVec Torus axis of symmetry.
1193 # @param theRMajor Torus major radius.
1194 # @param theRMinor Torus minor radius.
1195 # @return New GEOM_Object, containing the created torus.
1197 # @ref tui_creation_torus "Example"
1198 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
1199 # Example: see GEOM_TestAll.py
1200 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1201 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
1202 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
1203 anObj.SetParameters(Parameters)
1206 ## Create a torus with given radiuses at the origin of coordinate system.
1207 # @param theRMajor Torus major radius.
1208 # @param theRMinor Torus minor radius.
1209 # @return New GEOM_Object, containing the created torus.
1211 # @ref tui_creation_torus "Example"
1212 def MakeTorusRR(self, theRMajor, theRMinor):
1213 # Example: see GEOM_TestAll.py
1214 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
1215 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
1216 RaiseIfFailed("MakeTorusRR", self.PrimOp)
1217 anObj.SetParameters(Parameters)
1220 # end of l3_3d_primitives
1223 ## @addtogroup l3_complex
1226 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
1227 # @param theBase Base shape to be extruded.
1228 # @param thePoint1 First end of extrusion vector.
1229 # @param thePoint2 Second end of extrusion vector.
1230 # @return New GEOM_Object, containing the created prism.
1232 # @ref tui_creation_prism "Example"
1233 def MakePrism(self, theBase, thePoint1, thePoint2):
1234 # Example: see GEOM_TestAll.py
1235 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
1236 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
1239 ## Create a shape by extrusion of the base shape along the vector,
1240 # i.e. all the space, transfixed by the base shape during its translation
1241 # along the vector on the given distance.
1242 # @param theBase Base shape to be extruded.
1243 # @param theVec Direction of extrusion.
1244 # @param theH Prism dimension along theVec.
1245 # @return New GEOM_Object, containing the created prism.
1247 # @ref tui_creation_prism "Example"
1248 def MakePrismVecH(self, theBase, theVec, theH):
1249 # Example: see GEOM_TestAll.py
1250 theH,Parameters = ParseParameters(theH)
1251 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
1252 RaiseIfFailed("MakePrismVecH", self.PrimOp)
1253 anObj.SetParameters(Parameters)
1256 ## Create a shape by extrusion of the base shape along the vector,
1257 # i.e. all the space, transfixed by the base shape during its translation
1258 # along the vector on the given distance in 2 Ways (forward/backward) .
1259 # @param theBase Base shape to be extruded.
1260 # @param theVec Direction of extrusion.
1261 # @param theH Prism dimension along theVec in forward direction.
1262 # @return New GEOM_Object, containing the created prism.
1264 # @ref tui_creation_prism "Example"
1265 def MakePrismVecH2Ways(self, theBase, theVec, theH):
1266 # Example: see GEOM_TestAll.py
1267 theH,Parameters = ParseParameters(theH)
1268 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
1269 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
1270 anObj.SetParameters(Parameters)
1273 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1274 # @param theBase Base shape to be extruded.
1275 # @param theDX, theDY, theDZ Directions of extrusion.
1276 # @return New GEOM_Object, containing the created prism.
1278 # @ref tui_creation_prism "Example"
1279 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ):
1280 # Example: see GEOM_TestAll.py
1281 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1282 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
1283 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
1284 anObj.SetParameters(Parameters)
1287 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
1288 # i.e. all the space, transfixed by the base shape during its translation
1289 # along the vector on the given distance in 2 Ways (forward/backward) .
1290 # @param theBase Base shape to be extruded.
1291 # @param theDX, theDY, theDZ Directions of extrusion.
1292 # @return New GEOM_Object, containing the created prism.
1294 # @ref tui_creation_prism "Example"
1295 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
1296 # Example: see GEOM_TestAll.py
1297 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1298 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
1299 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
1300 anObj.SetParameters(Parameters)
1303 ## Create a shape by revolution of the base shape around the axis
1304 # on the given angle, i.e. all the space, transfixed by the base
1305 # shape during its rotation around the axis on the given angle.
1306 # @param theBase Base shape to be rotated.
1307 # @param theAxis Rotation axis.
1308 # @param theAngle Rotation angle in radians.
1309 # @return New GEOM_Object, containing the created revolution.
1311 # @ref tui_creation_revolution "Example"
1312 def MakeRevolution(self, theBase, theAxis, theAngle):
1313 # Example: see GEOM_TestAll.py
1314 theAngle,Parameters = ParseParameters(theAngle)
1315 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
1316 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
1317 anObj.SetParameters(Parameters)
1320 ## The Same Revolution but in both ways forward&backward.
1321 def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
1322 theAngle,Parameters = ParseParameters(theAngle)
1323 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
1324 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
1325 anObj.SetParameters(Parameters)
1328 ## Create a filling from the given compound of contours.
1329 # @param theShape the compound of contours
1330 # @param theMinDeg a minimal degree of BSpline surface to create
1331 # @param theMaxDeg a maximal degree of BSpline surface to create
1332 # @param theTol2D a 2d tolerance to be reached
1333 # @param theTol3D a 3d tolerance to be reached
1334 # @param theNbIter a number of iteration of approximation algorithm
1335 # @param theMethod Kind of method to perform filling operation:
1336 # 0 - Default - standard behaviour
1337 # 1 - Use edges orientation - orientation of edges are
1338 # used: if edge is reversed curve from this edge
1339 # is reversed before using in filling algorithm.
1340 # 2 - Auto-correct orientation - change orientation
1341 # of curves using minimization of sum of distances
1342 # between ends points of edges.
1343 # @param isApprox if True, BSpline curves are generated in the process
1344 # of surface construction. By default it is False, that means
1345 # the surface is created using Besier curves. The usage of
1346 # Approximation makes the algorithm work slower, but allows
1347 # building the surface for rather complex cases
1348 # @return New GEOM_Object, containing the created filling surface.
1350 # @ref tui_creation_filling "Example"
1351 def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D,
1352 theTol3D, theNbIter, theMethod=GEOM.FOM_Default, isApprox=0):
1353 # Example: see GEOM_TestAll.py
1354 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
1355 anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
1356 theTol2D, theTol3D, theNbIter,
1357 theMethod, isApprox)
1358 RaiseIfFailed("MakeFilling", self.PrimOp)
1359 anObj.SetParameters(Parameters)
1362 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
1363 # @param theSeqSections - set of specified sections.
1364 # @param theModeSolid - mode defining building solid or shell
1365 # @param thePreci - precision 3D used for smoothing by default 1.e-6
1366 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
1367 # @return New GEOM_Object, containing the created shell or solid.
1369 # @ref swig_todo "Example"
1370 def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
1371 # Example: see GEOM_TestAll.py
1372 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
1373 RaiseIfFailed("MakeThruSections", self.PrimOp)
1376 ## Create a shape by extrusion of the base shape along
1377 # the path shape. The path shape can be a wire or an edge.
1378 # @param theBase Base shape to be extruded.
1379 # @param thePath Path shape to extrude the base shape along it.
1380 # @return New GEOM_Object, containing the created pipe.
1382 # @ref tui_creation_pipe "Example"
1383 def MakePipe(self,theBase, thePath):
1384 # Example: see GEOM_TestAll.py
1385 anObj = self.PrimOp.MakePipe(theBase, thePath)
1386 RaiseIfFailed("MakePipe", self.PrimOp)
1389 ## Create a shape by extrusion of the profile shape along
1390 # the path shape. The path shape can be a wire or an edge.
1391 # the several profiles can be specified in the several locations of path.
1392 # @param theSeqBases - list of Bases shape to be extruded.
1393 # @param theLocations - list of locations on the path corresponding
1394 # specified list of the Bases shapes. Number of locations
1395 # should be equal to number of bases or list of locations can be empty.
1396 # @param thePath - Path shape to extrude the base shape along it.
1397 # @param theWithContact - the mode defining that the section is translated to be in
1398 # contact with the spine.
1399 # @param theWithCorrection - defining that the section is rotated to be
1400 # orthogonal to the spine tangent in the correspondent point
1401 # @return New GEOM_Object, containing the created pipe.
1403 # @ref tui_creation_pipe_with_diff_sec "Example"
1404 def MakePipeWithDifferentSections(self, theSeqBases,
1405 theLocations, thePath,
1406 theWithContact, theWithCorrection):
1407 anObj = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
1408 theLocations, thePath,
1409 theWithContact, theWithCorrection)
1410 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
1413 ## Create a shape by extrusion of the profile shape along
1414 # the path shape. The path shape can be a wire or a edge.
1415 # the several profiles can be specified in the several locations of path.
1416 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
1417 # shell or face. If number of faces in neighbour sections
1418 # aren't coincided result solid between such sections will
1419 # be created using external boundaries of this shells.
1420 # @param theSeqSubBases - list of corresponding subshapes of section shapes.
1421 # This list is used for searching correspondences between
1422 # faces in the sections. Size of this list must be equal
1423 # to size of list of base shapes.
1424 # @param theLocations - list of locations on the path corresponding
1425 # specified list of the Bases shapes. Number of locations
1426 # should be equal to number of bases. First and last
1427 # locations must be coincided with first and last vertexes
1428 # of path correspondingly.
1429 # @param thePath - Path shape to extrude the base shape along it.
1430 # @param theWithContact - the mode defining that the section is translated to be in
1431 # contact with the spine.
1432 # @param theWithCorrection - defining that the section is rotated to be
1433 # orthogonal to the spine tangent in the correspondent point
1434 # @return New GEOM_Object, containing the created solids.
1436 # @ref tui_creation_pipe_with_shell_sec "Example"
1437 def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
1438 theLocations, thePath,
1439 theWithContact, theWithCorrection):
1440 anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
1441 theLocations, thePath,
1442 theWithContact, theWithCorrection)
1443 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1446 ## Create a shape by extrusion of the profile shape along
1447 # the path shape. This function is used only for debug pipe
1448 # functionality - it is a version of previous function
1449 # (MakePipeWithShellSections(...)) which give a possibility to
1450 # recieve information about creating pipe between each pair of
1451 # sections step by step.
1452 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
1453 theLocations, thePath,
1454 theWithContact, theWithCorrection):
1456 nbsect = len(theSeqBases)
1457 nbsubsect = len(theSeqSubBases)
1458 #print "nbsect = ",nbsect
1459 for i in range(1,nbsect):
1461 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
1462 tmpLocations = [ theLocations[i-1], theLocations[i] ]
1464 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
1465 anObj = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
1466 tmpLocations, thePath,
1467 theWithContact, theWithCorrection)
1468 if self.PrimOp.IsDone() == 0:
1469 print "Problems with pipe creation between ",i," and ",i+1," sections"
1470 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
1473 print "Pipe between ",i," and ",i+1," sections is OK"
1478 resc = self.MakeCompound(res)
1479 #resc = self.MakeSewing(res, 0.001)
1480 #print "resc: ",resc
1483 ## Create solids between given sections
1484 # @param theSeqBases - list of sections (shell or face).
1485 # @param theLocations - list of corresponding vertexes
1486 # @return New GEOM_Object, containing the created solids.
1488 # @ref tui_creation_pipe_without_path "Example"
1489 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
1490 anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
1491 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
1494 ## Create a shape by extrusion of the base shape along
1495 # the path shape with constant bi-normal direction along the given vector.
1496 # The path shape can be a wire or an edge.
1497 # @param theBase Base shape to be extruded.
1498 # @param thePath Path shape to extrude the base shape along it.
1499 # @param theVec Vector defines a constant binormal direction to keep the
1500 # same angle beetween the direction and the sections
1501 # along the sweep surface.
1502 # @return New GEOM_Object, containing the created pipe.
1504 # @ref tui_creation_pipe "Example"
1505 def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
1506 # Example: see GEOM_TestAll.py
1507 anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
1508 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
1514 ## @addtogroup l3_advanced
1517 ## Create a linear edge with specified ends.
1518 # @param thePnt1 Point for the first end of edge.
1519 # @param thePnt2 Point for the second end of edge.
1520 # @return New GEOM_Object, containing the created edge.
1522 # @ref tui_creation_edge "Example"
1523 def MakeEdge(self,thePnt1, thePnt2):
1524 # Example: see GEOM_TestAll.py
1525 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
1526 RaiseIfFailed("MakeEdge", self.ShapesOp)
1529 ## Create a wire from the set of edges and wires.
1530 # @param theEdgesAndWires List of edges and/or wires.
1531 # @param theTolerance Maximum distance between vertices, that will be merged.
1532 # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
1533 # @return New GEOM_Object, containing the created wire.
1535 # @ref tui_creation_wire "Example"
1536 def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07):
1537 # Example: see GEOM_TestAll.py
1538 anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
1539 RaiseIfFailed("MakeWire", self.ShapesOp)
1542 ## Create a face on the given wire.
1543 # @param theWire closed Wire or Edge to build the face on.
1544 # @param isPlanarWanted If TRUE, only planar face will be built.
1545 # If impossible, NULL object will be returned.
1546 # @return New GEOM_Object, containing the created face.
1548 # @ref tui_creation_face "Example"
1549 def MakeFace(self,theWire, isPlanarWanted):
1550 # Example: see GEOM_TestAll.py
1551 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
1552 RaiseIfFailed("MakeFace", self.ShapesOp)
1555 ## Create a face on the given wires set.
1556 # @param theWires List of closed wires or edges to build the face on.
1557 # @param isPlanarWanted If TRUE, only planar face will be built.
1558 # If impossible, NULL object will be returned.
1559 # @return New GEOM_Object, containing the created face.
1561 # @ref tui_creation_face "Example"
1562 def MakeFaceWires(self,theWires, isPlanarWanted):
1563 # Example: see GEOM_TestAll.py
1564 anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
1565 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
1568 ## Shortcut to MakeFaceWires()
1570 # @ref tui_creation_face "Example 1"
1571 # \n @ref swig_MakeFaces "Example 2"
1572 def MakeFaces(self,theWires, isPlanarWanted):
1573 # Example: see GEOM_TestOthers.py
1574 anObj = self.MakeFaceWires(theWires, isPlanarWanted)
1577 ## Create a shell from the set of faces and shells.
1578 # @param theFacesAndShells List of faces and/or shells.
1579 # @return New GEOM_Object, containing the created shell.
1581 # @ref tui_creation_shell "Example"
1582 def MakeShell(self,theFacesAndShells):
1583 # Example: see GEOM_TestAll.py
1584 anObj = self.ShapesOp.MakeShell(theFacesAndShells)
1585 RaiseIfFailed("MakeShell", self.ShapesOp)
1588 ## Create a solid, bounded by the given shells.
1589 # @param theShells Sequence of bounding shells.
1590 # @return New GEOM_Object, containing the created solid.
1592 # @ref tui_creation_solid "Example"
1593 def MakeSolid(self,theShells):
1594 # Example: see GEOM_TestAll.py
1595 anObj = self.ShapesOp.MakeSolidShells(theShells)
1596 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
1599 ## Create a compound of the given shapes.
1600 # @param theShapes List of shapes to put in compound.
1601 # @return New GEOM_Object, containing the created compound.
1603 # @ref tui_creation_compound "Example"
1604 def MakeCompound(self,theShapes):
1605 # Example: see GEOM_TestAll.py
1606 anObj = self.ShapesOp.MakeCompound(theShapes)
1607 RaiseIfFailed("MakeCompound", self.ShapesOp)
1610 # end of l3_advanced
1613 ## @addtogroup l2_measure
1616 ## Gives quantity of faces in the given shape.
1617 # @param theShape Shape to count faces of.
1618 # @return Quantity of faces.
1620 # @ref swig_NumberOf "Example"
1621 def NumberOfFaces(self, theShape):
1622 # Example: see GEOM_TestOthers.py
1623 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
1624 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
1627 ## Gives quantity of edges in the given shape.
1628 # @param theShape Shape to count edges of.
1629 # @return Quantity of edges.
1631 # @ref swig_NumberOf "Example"
1632 def NumberOfEdges(self, theShape):
1633 # Example: see GEOM_TestOthers.py
1634 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
1635 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
1638 ## Gives quantity of subshapes of type theShapeType in the given shape.
1639 # @param theShape Shape to count subshapes of.
1640 # @param theShapeType Type of subshapes to count.
1641 # @return Quantity of subshapes of given type.
1643 # @ref swig_NumberOf "Example"
1644 def NumberOfSubShapes(self, theShape, theShapeType):
1645 # Example: see GEOM_TestOthers.py
1646 nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
1647 RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
1650 ## Gives quantity of solids in the given shape.
1651 # @param theShape Shape to count solids in.
1652 # @return Quantity of solids.
1654 # @ref swig_NumberOf "Example"
1655 def NumberOfSolids(self, theShape):
1656 # Example: see GEOM_TestOthers.py
1657 nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["SOLID"])
1658 RaiseIfFailed("NumberOfSolids", self.ShapesOp)
1664 ## @addtogroup l3_healing
1667 ## Reverses an orientation the given shape.
1668 # @param theShape Shape to be reversed.
1669 # @return The reversed copy of theShape.
1671 # @ref swig_ChangeOrientation "Example"
1672 def ChangeOrientation(self,theShape):
1673 # Example: see GEOM_TestAll.py
1674 anObj = self.ShapesOp.ChangeOrientation(theShape)
1675 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
1678 ## Shortcut to ChangeOrientation()
1680 # @ref swig_OrientationChange "Example"
1681 def OrientationChange(self,theShape):
1682 # Example: see GEOM_TestOthers.py
1683 anObj = self.ChangeOrientation(theShape)
1689 ## @addtogroup l4_obtain
1692 ## Retrieve all free faces from the given shape.
1693 # Free face is a face, which is not shared between two shells of the shape.
1694 # @param theShape Shape to find free faces in.
1695 # @return List of IDs of all free faces, contained in theShape.
1697 # @ref tui_measurement_tools_page "Example"
1698 def GetFreeFacesIDs(self,theShape):
1699 # Example: see GEOM_TestOthers.py
1700 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
1701 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
1704 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
1705 # @param theShape1 Shape to find sub-shapes in.
1706 # @param theShape2 Shape to find shared sub-shapes with.
1707 # @param theShapeType Type of sub-shapes to be retrieved.
1708 # @return List of sub-shapes of theShape1, shared with theShape2.
1710 # @ref swig_GetSharedShapes "Example"
1711 def GetSharedShapes(self,theShape1, theShape2, theShapeType):
1712 # Example: see GEOM_TestOthers.py
1713 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
1714 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
1717 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1718 # situated relatively the specified plane by the certain way,
1719 # defined through <VAR>theState</VAR> parameter.
1720 # @param theShape Shape to find sub-shapes of.
1721 # @param theShapeType Type of sub-shapes to be retrieved.
1722 # @param theAx1 Vector (or line, or linear edge), specifying normal
1723 # direction and location of the plane to find shapes on.
1724 # @param theState The state of the subshapes to find. It can be one of
1725 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1726 # @return List of all found sub-shapes.
1728 # @ref swig_GetShapesOnPlane "Example"
1729 def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
1730 # Example: see GEOM_TestOthers.py
1731 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
1732 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
1735 ## Works like the above method, but returns list of sub-shapes indices
1737 # @ref swig_GetShapesOnPlaneIDs "Example"
1738 def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
1739 # Example: see GEOM_TestOthers.py
1740 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
1741 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
1744 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
1745 # situated relatively the specified plane by the certain way,
1746 # defined through <VAR>theState</VAR> parameter.
1747 # @param theShape Shape to find sub-shapes of.
1748 # @param theShapeType Type of sub-shapes to be retrieved.
1749 # @param theAx1 Vector (or line, or linear edge), specifying normal
1750 # direction of the plane to find shapes on.
1751 # @param thePnt Point specifying location of the plane to find shapes on.
1752 # @param theState The state of the subshapes to find. It can be one of
1753 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1754 # @return List of all found sub-shapes.
1756 # @ref swig_GetShapesOnPlaneWithLocation "Example"
1757 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
1758 # Example: see GEOM_TestOthers.py
1759 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
1760 theAx1, thePnt, theState)
1761 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
1764 ## Works like the above method, but returns list of sub-shapes indices
1766 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
1767 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
1768 # Example: see GEOM_TestOthers.py
1769 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
1770 theAx1, thePnt, theState)
1771 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
1774 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1775 # the specified cylinder by the certain way, defined through \a theState parameter.
1776 # @param theShape Shape to find sub-shapes of.
1777 # @param theShapeType Type of sub-shapes to be retrieved.
1778 # @param theAxis Vector (or line, or linear edge), specifying
1779 # axis of the cylinder to find shapes on.
1780 # @param theRadius Radius of the cylinder to find shapes on.
1781 # @param theState The state of the subshapes to find. It can be one of
1782 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1783 # @return List of all found sub-shapes.
1785 # @ref swig_GetShapesOnCylinder "Example"
1786 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
1787 # Example: see GEOM_TestOthers.py
1788 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
1789 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
1792 ## Works like the above method, but returns list of sub-shapes indices
1794 # @ref swig_GetShapesOnCylinderIDs "Example"
1795 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
1796 # Example: see GEOM_TestOthers.py
1797 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
1798 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
1801 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1802 # the specified cylinder by the certain way, defined through \a theState parameter.
1803 # @param theShape Shape to find sub-shapes of.
1804 # @param theShapeType Type of sub-shapes to be retrieved.
1805 # @param theAxis Vector (or line, or linear edge), specifying
1806 # axis of the cylinder to find shapes on.
1807 # @param thePnt Point specifying location of the bottom of the cylinder.
1808 # @param theRadius Radius of the cylinder to find shapes on.
1809 # @param theState The state of the subshapes to find. It can be one of
1810 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1811 # @return List of all found sub-shapes.
1813 # @ref swig_GetShapesOnCylinderWithLocation "Example"
1814 def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
1815 # Example: see GEOM_TestOthers.py
1816 aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
1817 RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
1820 ## Works like the above method, but returns list of sub-shapes indices
1822 # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
1823 def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
1824 # Example: see GEOM_TestOthers.py
1825 aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
1826 RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
1829 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1830 # the specified sphere by the certain way, defined through \a theState parameter.
1831 # @param theShape Shape to find sub-shapes of.
1832 # @param theShapeType Type of sub-shapes to be retrieved.
1833 # @param theCenter Point, specifying center of the sphere to find shapes on.
1834 # @param theRadius Radius of the sphere to find shapes on.
1835 # @param theState The state of the subshapes to find. It can be one of
1836 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1837 # @return List of all found sub-shapes.
1839 # @ref swig_GetShapesOnSphere "Example"
1840 def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
1841 # Example: see GEOM_TestOthers.py
1842 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
1843 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
1846 ## Works like the above method, but returns list of sub-shapes indices
1848 # @ref swig_GetShapesOnSphereIDs "Example"
1849 def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
1850 # Example: see GEOM_TestOthers.py
1851 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
1852 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
1855 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1856 # the specified quadrangle by the certain way, defined through \a theState parameter.
1857 # @param theShape Shape to find sub-shapes of.
1858 # @param theShapeType Type of sub-shapes to be retrieved.
1859 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
1860 # @param theTopRigthPoint Point, specifying top right corner of a quadrangle
1861 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
1862 # @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
1863 # @param theState The state of the subshapes to find. It can be one of
1864 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1865 # @return List of all found sub-shapes.
1867 # @ref swig_GetShapesOnQuadrangle "Example"
1868 def GetShapesOnQuadrangle(self, theShape, theShapeType,
1869 theTopLeftPoint, theTopRigthPoint,
1870 theBottomLeftPoint, theBottomRigthPoint, theState):
1871 # Example: see GEOM_TestOthers.py
1872 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
1873 theTopLeftPoint, theTopRigthPoint,
1874 theBottomLeftPoint, theBottomRigthPoint, theState)
1875 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
1878 ## Works like the above method, but returns list of sub-shapes indices
1880 # @ref swig_GetShapesOnQuadrangleIDs "Example"
1881 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
1882 theTopLeftPoint, theTopRigthPoint,
1883 theBottomLeftPoint, theBottomRigthPoint, theState):
1884 # Example: see GEOM_TestOthers.py
1885 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
1886 theTopLeftPoint, theTopRigthPoint,
1887 theBottomLeftPoint, theBottomRigthPoint, theState)
1888 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
1891 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
1892 # the specified \a theBox by the certain way, defined through \a theState parameter.
1893 # @param theBox Shape for relative comparing.
1894 # @param theShape Shape to find sub-shapes of.
1895 # @param theShapeType Type of sub-shapes to be retrieved.
1896 # @param theState The state of the subshapes to find. It can be one of
1897 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1898 # @return List of all found sub-shapes.
1900 # @ref swig_GetShapesOnBox "Example"
1901 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
1902 # Example: see GEOM_TestOthers.py
1903 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
1904 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
1907 ## Works like the above method, but returns list of sub-shapes indices
1909 # @ref swig_GetShapesOnBoxIDs "Example"
1910 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
1911 # Example: see GEOM_TestOthers.py
1912 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
1913 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
1916 ## Find in \a theShape all sub-shapes of type \a theShapeType,
1917 # situated relatively the specified \a theCheckShape by the
1918 # certain way, defined through \a theState parameter.
1919 # @param theCheckShape Shape for relative comparing. It must be a solid.
1920 # @param theShape Shape to find sub-shapes of.
1921 # @param theShapeType Type of sub-shapes to be retrieved.
1922 # @param theState The state of the subshapes to find. It can be one of
1923 # ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
1924 # @return List of all found sub-shapes.
1926 # @ref swig_GetShapesOnShape "Example"
1927 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
1928 # Example: see GEOM_TestOthers.py
1929 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
1930 theShapeType, theState)
1931 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
1934 ## Works like the above method, but returns result as compound
1936 # @ref swig_GetShapesOnShapeAsCompound "Example"
1937 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
1938 # Example: see GEOM_TestOthers.py
1939 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
1940 theShapeType, theState)
1941 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
1944 ## Works like the above method, but returns list of sub-shapes indices
1946 # @ref swig_GetShapesOnShapeIDs "Example"
1947 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
1948 # Example: see GEOM_TestOthers.py
1949 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
1950 theShapeType, theState)
1951 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
1954 ## Get sub-shape(s) of theShapeWhere, which are
1955 # coincident with \a theShapeWhat or could be a part of it.
1956 # @param theShapeWhere Shape to find sub-shapes of.
1957 # @param theShapeWhat Shape, specifying what to find.
1958 # @return Group of all found sub-shapes or a single found sub-shape.
1960 # @ref swig_GetInPlace "Example"
1961 def GetInPlace(self,theShapeWhere, theShapeWhat):
1962 # Example: see GEOM_TestOthers.py
1963 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
1964 RaiseIfFailed("GetInPlace", self.ShapesOp)
1967 ## Get sub-shape(s) of \a theShapeWhere, which are
1968 # coincident with \a theShapeWhat or could be a part of it.
1970 # Implementation of this method is based on a saved history of an operation,
1971 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
1972 # arguments (an argument shape or a sub-shape of an argument shape).
1973 # The operation could be the Partition or one of boolean operations,
1974 # performed on simple shapes (not on compounds).
1976 # @param theShapeWhere Shape to find sub-shapes of.
1977 # @param theShapeWhat Shape, specifying what to find (must be in the
1978 # building history of the ShapeWhere).
1979 # @return Group of all found sub-shapes or a single found sub-shape.
1981 # @ref swig_GetInPlace "Example"
1982 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
1983 # Example: see GEOM_TestOthers.py
1984 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
1985 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
1988 ## Get sub-shape of theShapeWhere, which is
1989 # equal to \a theShapeWhat.
1990 # @param theShapeWhere Shape to find sub-shape of.
1991 # @param theShapeWhat Shape, specifying what to find.
1992 # @return New GEOM_Object for found sub-shape.
1994 # @ref swig_GetSame "Example"
1995 def GetSame(self,theShapeWhere, theShapeWhat):
1996 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
1997 RaiseIfFailed("GetSame", self.ShapesOp)
2003 ## @addtogroup l4_access
2006 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
2007 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
2009 # @ref swig_all_decompose "Example"
2010 def GetSubShape(self, aShape, ListOfID):
2011 # Example: see GEOM_TestAll.py
2012 anObj = self.AddSubShape(aShape,ListOfID)
2015 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
2017 # @ref swig_all_decompose "Example"
2018 def GetSubShapeID(self, aShape, aSubShape):
2019 # Example: see GEOM_TestAll.py
2020 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
2021 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
2027 ## @addtogroup l4_decompose
2030 ## Explode a shape on subshapes of a given type.
2031 # @param aShape Shape to be exploded.
2032 # @param aType Type of sub-shapes to be retrieved.
2033 # @return List of sub-shapes of type theShapeType, contained in theShape.
2035 # @ref swig_all_decompose "Example"
2036 def SubShapeAll(self, aShape, aType):
2037 # Example: see GEOM_TestAll.py
2038 ListObj = self.ShapesOp.MakeExplode(aShape,aType,0)
2039 RaiseIfFailed("MakeExplode", self.ShapesOp)
2042 ## Explode a shape on subshapes of a given type.
2043 # @param aShape Shape to be exploded.
2044 # @param aType Type of sub-shapes to be retrieved.
2045 # @return List of IDs of sub-shapes.
2047 # @ref swig_all_decompose "Example"
2048 def SubShapeAllIDs(self, aShape, aType):
2049 ListObj = self.ShapesOp.SubShapeAllIDs(aShape,aType,0)
2050 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2053 ## Explode a shape on subshapes of a given type.
2054 # Sub-shapes will be sorted by coordinates of their gravity centers.
2055 # @param aShape Shape to be exploded.
2056 # @param aType Type of sub-shapes to be retrieved.
2057 # @return List of sub-shapes of type theShapeType, contained in theShape.
2059 # @ref swig_SubShapeAllSorted "Example"
2060 def SubShapeAllSorted(self, aShape, aType):
2061 # Example: see GEOM_TestAll.py
2062 ListObj = self.ShapesOp.MakeExplode(aShape,aType,1)
2063 RaiseIfFailed("MakeExplode", self.ShapesOp)
2066 ## Explode a shape on subshapes of a given type.
2067 # Sub-shapes will be sorted by coordinates of their gravity centers.
2068 # @param aShape Shape to be exploded.
2069 # @param aType Type of sub-shapes to be retrieved.
2070 # @return List of IDs of sub-shapes.
2072 # @ref swig_all_decompose "Example"
2073 def SubShapeAllSortedIDs(self, aShape, aType):
2074 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape,aType,1)
2075 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
2078 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2079 # selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
2080 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2082 # @ref swig_all_decompose "Example"
2083 def SubShape(self, aShape, aType, ListOfInd):
2084 # Example: see GEOM_TestAll.py
2086 AllShapeList = self.SubShapeAll(aShape, aType)
2087 for ind in ListOfInd:
2088 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
2089 anObj = self.GetSubShape(aShape, ListOfIDs)
2092 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2093 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
2094 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2096 # @ref swig_all_decompose "Example"
2097 def SubShapeSorted(self,aShape, aType, ListOfInd):
2098 # Example: see GEOM_TestAll.py
2100 AllShapeList = self.SubShapeAllSorted(aShape, aType)
2101 for ind in ListOfInd:
2102 ListOfIDs.append(self.GetSubShapeID(aShape, AllShapeList[ind - 1]))
2103 anObj = self.GetSubShape(aShape, ListOfIDs)
2106 # end of l4_decompose
2109 ## @addtogroup l3_healing
2112 ## Apply a sequence of Shape Healing operators to the given object.
2113 # @param theShape Shape to be processed.
2114 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
2115 # @param theParameters List of names of parameters
2116 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
2117 # @param theValues List of values of parameters, in the same order
2118 # as parameters are listed in <VAR>theParameters</VAR> list.
2119 # @return New GEOM_Object, containing processed shape.
2121 # @ref tui_shape_processing "Example"
2122 def ProcessShape(self, theShape, theOperators, theParameters, theValues):
2123 # Example: see GEOM_TestHealing.py
2124 theValues,Parameters = ParseList(theValues)
2125 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
2126 # To avoid script failure in case of good argument shape
2127 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
2129 RaiseIfFailed("ProcessShape", self.HealOp)
2130 for string in (theOperators + theParameters):
2131 Parameters = ":" + Parameters
2133 anObj.SetParameters(Parameters)
2136 ## Remove faces from the given object (shape).
2137 # @param theObject Shape to be processed.
2138 # @param theFaces Indices of faces to be removed, if EMPTY then the method
2139 # removes ALL faces of the given object.
2140 # @return New GEOM_Object, containing processed shape.
2142 # @ref tui_suppress_faces "Example"
2143 def SuppressFaces(self,theObject, theFaces):
2144 # Example: see GEOM_TestHealing.py
2145 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
2146 RaiseIfFailed("SuppressFaces", self.HealOp)
2149 ## Sewing of some shapes into single shape.
2151 # @ref tui_sewing "Example"
2152 def MakeSewing(self, ListShape, theTolerance):
2153 # Example: see GEOM_TestHealing.py
2154 comp = self.MakeCompound(ListShape)
2155 anObj = self.Sew(comp, theTolerance)
2158 ## Sewing of the given object.
2159 # @param theObject Shape to be processed.
2160 # @param theTolerance Required tolerance value.
2161 # @return New GEOM_Object, containing processed shape.
2162 def Sew(self, theObject, theTolerance):
2163 # Example: see MakeSewing() above
2164 theTolerance,Parameters = ParseParameters(theTolerance)
2165 anObj = self.HealOp.Sew(theObject, theTolerance)
2166 RaiseIfFailed("Sew", self.HealOp)
2167 anObj.SetParameters(Parameters)
2170 ## Remove internal wires and edges from the given object (face).
2171 # @param theObject Shape to be processed.
2172 # @param theWires Indices of wires to be removed, if EMPTY then the method
2173 # removes ALL internal wires of the given object.
2174 # @return New GEOM_Object, containing processed shape.
2176 # @ref tui_suppress_internal_wires "Example"
2177 def SuppressInternalWires(self,theObject, theWires):
2178 # Example: see GEOM_TestHealing.py
2179 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
2180 RaiseIfFailed("RemoveIntWires", self.HealOp)
2183 ## Remove internal closed contours (holes) from the given object.
2184 # @param theObject Shape to be processed.
2185 # @param theWires Indices of wires to be removed, if EMPTY then the method
2186 # removes ALL internal holes of the given object
2187 # @return New GEOM_Object, containing processed shape.
2189 # @ref tui_suppress_holes "Example"
2190 def SuppressHoles(self,theObject, theWires):
2191 # Example: see GEOM_TestHealing.py
2192 anObj = self.HealOp.FillHoles(theObject, theWires)
2193 RaiseIfFailed("FillHoles", self.HealOp)
2196 ## Close an open wire.
2197 # @param theObject Shape to be processed.
2198 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
2199 # if -1, then <VAR>theObject</VAR> itself is a wire.
2200 # @param isCommonVertex If TRUE : closure by creation of a common vertex,
2201 # If FALS : closure by creation of an edge between ends.
2202 # @return New GEOM_Object, containing processed shape.
2204 # @ref tui_close_contour "Example"
2205 def CloseContour(self,theObject, theWires, isCommonVertex):
2206 # Example: see GEOM_TestHealing.py
2207 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
2208 RaiseIfFailed("CloseContour", self.HealOp)
2211 ## Addition of a point to a given edge object.
2212 # @param theObject Shape to be processed.
2213 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
2214 # if -1, then theObject itself is the edge.
2215 # @param theValue Value of parameter on edge or length parameter,
2216 # depending on \a isByParameter.
2217 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
2218 # if FALSE : \a theValue is treated as a length parameter [0..1]
2219 # @return New GEOM_Object, containing processed shape.
2221 # @ref tui_add_point_on_edge "Example"
2222 def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
2223 # Example: see GEOM_TestHealing.py
2224 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
2225 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
2226 RaiseIfFailed("DivideEdge", self.HealOp)
2227 anObj.SetParameters(Parameters)
2230 ## Change orientation of the given object. Updates given shape.
2231 # @param theObject Shape to be processed.
2233 # @ref swig_todo "Example"
2234 def ChangeOrientationShell(self,theObject):
2235 theObject = self.HealOp.ChangeOrientation(theObject)
2236 RaiseIfFailed("ChangeOrientation", self.HealOp)
2239 ## Change orientation of the given object.
2240 # @param theObject Shape to be processed.
2241 # @return New GEOM_Object, containing processed shape.
2243 # @ref swig_todo "Example"
2244 def ChangeOrientationShellCopy(self,theObject):
2245 anObj = self.HealOp.ChangeOrientationCopy(theObject)
2246 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
2249 ## Get a list of wires (wrapped in GEOM_Object-s),
2250 # that constitute a free boundary of the given shape.
2251 # @param theObject Shape to get free boundary of.
2252 # @return [status, theClosedWires, theOpenWires]
2253 # status: FALSE, if an error(s) occured during the method execution.
2254 # theClosedWires: Closed wires on the free boundary of the given shape.
2255 # theOpenWires: Open wires on the free boundary of the given shape.
2257 # @ref tui_measurement_tools_page "Example"
2258 def GetFreeBoundary(self,theObject):
2259 # Example: see GEOM_TestHealing.py
2260 anObj = self.HealOp.GetFreeBoundary(theObject)
2261 RaiseIfFailed("GetFreeBoundary", self.HealOp)
2264 ## Replace coincident faces in theShape by one face.
2265 # @param theShape Initial shape.
2266 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
2267 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2268 # otherwise all initial shapes.
2269 # @return New GEOM_Object, containing a copy of theShape without coincident faces.
2271 # @ref tui_glue_faces "Example"
2272 def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
2273 # Example: see GEOM_Spanner.py
2274 theTolerance,Parameters = ParseParameters(theTolerance)
2275 anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
2277 raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
2278 anObj.SetParameters(Parameters)
2281 ## Find coincident faces in theShape for possible gluing.
2282 # @param theShape Initial shape.
2283 # @param theTolerance Maximum distance between faces,
2284 # which can be considered as coincident.
2287 # @ref swig_todo "Example"
2288 def GetGlueFaces(self, theShape, theTolerance):
2289 # Example: see GEOM_Spanner.py
2290 anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
2291 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
2294 ## Replace coincident faces in theShape by one face
2295 # in compliance with given list of faces
2296 # @param theShape Initial shape.
2297 # @param theTolerance Maximum distance between faces,
2298 # which can be considered as coincident.
2299 # @param theFaces List of faces for gluing.
2300 # @param doKeepNonSolids If FALSE, only solids will present in the result,
2301 # otherwise all initial shapes.
2302 # @return New GEOM_Object, containing a copy of theShape
2303 # without some faces.
2305 # @ref swig_todo "Example"
2306 def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True):
2307 # Example: see GEOM_Spanner.py
2308 anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
2310 raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
2316 ## @addtogroup l3_boolean Boolean Operations
2319 # -----------------------------------------------------------------------------
2320 # Boolean (Common, Cut, Fuse, Section)
2321 # -----------------------------------------------------------------------------
2323 ## Perform one of boolean operations on two given shapes.
2324 # @param theShape1 First argument for boolean operation.
2325 # @param theShape2 Second argument for boolean operation.
2326 # @param theOperation Indicates the operation to be done:
2327 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
2328 # @return New GEOM_Object, containing the result shape.
2330 # @ref tui_fuse "Example"
2331 def MakeBoolean(self,theShape1, theShape2, theOperation):
2332 # Example: see GEOM_TestAll.py
2333 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
2334 RaiseIfFailed("MakeBoolean", self.BoolOp)
2337 ## Shortcut to MakeBoolean(s1, s2, 1)
2339 # @ref tui_common "Example 1"
2340 # \n @ref swig_MakeCommon "Example 2"
2341 def MakeCommon(self, s1, s2):
2342 # Example: see GEOM_TestOthers.py
2343 return self.MakeBoolean(s1, s2, 1)
2345 ## Shortcut to MakeBoolean(s1, s2, 2)
2347 # @ref tui_cut "Example 1"
2348 # \n @ref swig_MakeCommon "Example 2"
2349 def MakeCut(self, s1, s2):
2350 # Example: see GEOM_TestOthers.py
2351 return self.MakeBoolean(s1, s2, 2)
2353 ## Shortcut to MakeBoolean(s1, s2, 3)
2355 # @ref tui_fuse "Example 1"
2356 # \n @ref swig_MakeCommon "Example 2"
2357 def MakeFuse(self, s1, s2):
2358 # Example: see GEOM_TestOthers.py
2359 return self.MakeBoolean(s1, s2, 3)
2361 ## Shortcut to MakeBoolean(s1, s2, 4)
2363 # @ref tui_section "Example 1"
2364 # \n @ref swig_MakeCommon "Example 2"
2365 def MakeSection(self, s1, s2):
2366 # Example: see GEOM_TestOthers.py
2367 return self.MakeBoolean(s1, s2, 4)
2372 ## @addtogroup l3_basic_op
2375 ## Perform partition operation.
2376 # @param ListShapes Shapes to be intersected.
2377 # @param ListTools Shapes to intersect theShapes.
2378 # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
2379 # in order to avoid possible intersection between shapes from
2381 # @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
2382 # @param KeepNonlimitShapes: if this parameter == 0, then only shapes of
2383 # target type (equal to Limit) are kept in the result,
2384 # else standalone shapes of lower dimension
2385 # are kept also (if they exist).
2387 # After implementation new version of PartitionAlgo (October 2006)
2388 # other parameters are ignored by current functionality. They are kept
2389 # in this function only for support old versions.
2390 # Ignored parameters:
2391 # @param ListKeepInside Shapes, outside which the results will be deleted.
2392 # Each shape from theKeepInside must belong to theShapes also.
2393 # @param ListRemoveInside Shapes, inside which the results will be deleted.
2394 # Each shape from theRemoveInside must belong to theShapes also.
2395 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
2396 # @param ListMaterials Material indices for each shape. Make sence,
2397 # only if theRemoveWebs is TRUE.
2399 # @return New GEOM_Object, containing the result shapes.
2401 # @ref tui_partition "Example"
2402 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2403 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
2404 KeepNonlimitShapes=0):
2405 # Example: see GEOM_TestAll.py
2406 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
2407 ListKeepInside, ListRemoveInside,
2408 Limit, RemoveWebs, ListMaterials,
2409 KeepNonlimitShapes);
2410 RaiseIfFailed("MakePartition", self.BoolOp)
2413 ## Perform partition operation.
2414 # This method may be useful if it is needed to make a partition for
2415 # compound contains nonintersected shapes. Performance will be better
2416 # since intersection between shapes from compound is not performed.
2418 # Description of all parameters as in previous method MakePartition()
2420 # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
2421 # have to consist of nonintersecting shapes.
2423 # @return New GEOM_Object, containing the result shapes.
2425 # @ref swig_todo "Example"
2426 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
2427 ListKeepInside=[], ListRemoveInside=[],
2428 Limit=ShapeType["SHAPE"], RemoveWebs=0,
2429 ListMaterials=[], KeepNonlimitShapes=0):
2430 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
2431 ListKeepInside, ListRemoveInside,
2432 Limit, RemoveWebs, ListMaterials,
2433 KeepNonlimitShapes);
2434 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
2437 ## Shortcut to MakePartition()
2439 # @ref tui_partition "Example 1"
2440 # \n @ref swig_Partition "Example 2"
2441 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
2442 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
2443 KeepNonlimitShapes=0):
2444 # Example: see GEOM_TestOthers.py
2445 anObj = self.MakePartition(ListShapes, ListTools,
2446 ListKeepInside, ListRemoveInside,
2447 Limit, RemoveWebs, ListMaterials,
2448 KeepNonlimitShapes);
2451 ## Perform partition of the Shape with the Plane
2452 # @param theShape Shape to be intersected.
2453 # @param thePlane Tool shape, to intersect theShape.
2454 # @return New GEOM_Object, containing the result shape.
2456 # @ref tui_partition "Example"
2457 def MakeHalfPartition(self,theShape, thePlane):
2458 # Example: see GEOM_TestAll.py
2459 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
2460 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
2463 # end of l3_basic_op
2466 ## @addtogroup l3_transform
2469 ## Translate the given object along the vector, specified
2470 # by its end points, creating its copy before the translation.
2471 # @param theObject The object to be translated.
2472 # @param thePoint1 Start point of translation vector.
2473 # @param thePoint2 End point of translation vector.
2474 # @return New GEOM_Object, containing the translated object.
2476 # @ref tui_translation "Example 1"
2477 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
2478 def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
2479 # Example: see GEOM_TestAll.py
2480 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
2481 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
2484 ## Translate the given object along the vector, specified by its components.
2485 # @param theObject The object to be translated.
2486 # @param theDX,theDY,theDZ Components of translation vector.
2487 # @return Translated GEOM_Object.
2489 # @ref tui_translation "Example"
2490 def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ):
2491 # Example: see GEOM_TestAll.py
2492 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2493 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
2494 anObj.SetParameters(Parameters)
2495 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2498 ## Translate the given object along the vector, specified
2499 # by its components, creating its copy before the translation.
2500 # @param theObject The object to be translated.
2501 # @param theDX,theDY,theDZ Components of translation vector.
2502 # @return New GEOM_Object, containing the translated object.
2504 # @ref tui_translation "Example"
2505 def MakeTranslation(self,theObject, theDX, theDY, theDZ):
2506 # Example: see GEOM_TestAll.py
2507 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
2508 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
2509 anObj.SetParameters(Parameters)
2510 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
2513 ## Translate the given object along the given vector,
2514 # creating its copy before the translation.
2515 # @param theObject The object to be translated.
2516 # @param theVector The translation vector.
2517 # @return New GEOM_Object, containing the translated object.
2519 # @ref tui_translation "Example"
2520 def MakeTranslationVector(self,theObject, theVector):
2521 # Example: see GEOM_TestAll.py
2522 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
2523 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
2526 ## Translate the given object along the given vector on given distance.
2527 # @param theObject The object to be translated.
2528 # @param theVector The translation vector.
2529 # @param theDistance The translation distance.
2530 # @param theCopy Flag used to translate object itself or create a copy.
2531 # @return Translated GEOM_Object.
2533 # @ref tui_translation "Example"
2534 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy):
2535 # Example: see GEOM_TestAll.py
2536 theDistance,Parameters = ParseParameters(theDistance)
2537 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
2538 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2539 anObj.SetParameters(Parameters)
2542 ## Translate the given object along the given vector on given distance,
2543 # creating its copy before the translation.
2544 # @param theObject The object to be translated.
2545 # @param theVector The translation vector.
2546 # @param theDistance The translation distance.
2547 # @return New GEOM_Object, containing the translated object.
2549 # @ref tui_translation "Example"
2550 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
2551 # Example: see GEOM_TestAll.py
2552 theDistance,Parameters = ParseParameters(theDistance)
2553 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
2554 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
2555 anObj.SetParameters(Parameters)
2558 ## Rotate the given object around the given axis on the given angle.
2559 # @param theObject The object to be rotated.
2560 # @param theAxis Rotation axis.
2561 # @param theAngle Rotation angle in radians.
2562 # @return Rotated GEOM_Object.
2564 # @ref tui_rotation "Example"
2565 def Rotate(self,theObject, theAxis, theAngle):
2566 # Example: see GEOM_TestAll.py
2568 if isinstance(theAngle,str):
2570 theAngle, Parameters = ParseParameters(theAngle)
2572 theAngle = theAngle*math.pi/180.0
2573 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
2574 RaiseIfFailed("RotateCopy", self.TrsfOp)
2575 anObj.SetParameters(Parameters)
2578 ## Rotate the given object around the given axis
2579 # on the given angle, creating its copy before the rotatation.
2580 # @param theObject The object to be rotated.
2581 # @param theAxis Rotation axis.
2582 # @param theAngle Rotation angle in radians.
2583 # @return New GEOM_Object, containing the rotated object.
2585 # @ref tui_rotation "Example"
2586 def MakeRotation(self,theObject, theAxis, theAngle):
2587 # Example: see GEOM_TestAll.py
2589 if isinstance(theAngle,str):
2591 theAngle, Parameters = ParseParameters(theAngle)
2593 theAngle = theAngle*math.pi/180.0
2594 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
2595 RaiseIfFailed("RotateCopy", self.TrsfOp)
2596 anObj.SetParameters(Parameters)
2599 ## Rotate given object around vector perpendicular to plane
2600 # containing three points, creating its copy before the rotatation.
2601 # @param theObject The object to be rotated.
2602 # @param theCentPoint central point - the axis is the vector perpendicular to the plane
2603 # containing the three points.
2604 # @param thePoint1,thePoint2 - in a perpendicular plane of the axis.
2605 # @return New GEOM_Object, containing the rotated object.
2607 # @ref tui_rotation "Example"
2608 def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
2609 # Example: see GEOM_TestAll.py
2610 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
2611 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
2614 ## Scale the given object by the factor, creating its copy before the scaling.
2615 # @param theObject The object to be scaled.
2616 # @param thePoint Center point for scaling.
2617 # Passing None for it means scaling relatively the origin of global CS.
2618 # @param theFactor Scaling factor value.
2619 # @return New GEOM_Object, containing the scaled shape.
2621 # @ref tui_scale "Example"
2622 def MakeScaleTransform(self, theObject, thePoint, theFactor):
2623 # Example: see GEOM_TestAll.py
2624 theFactor, Parameters = ParseParameters(theFactor)
2625 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
2626 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
2627 anObj.SetParameters(Parameters)
2630 ## Scale the given object by different factors along coordinate axes,
2631 # creating its copy before the scaling.
2632 # @param theObject The object to be scaled.
2633 # @param thePoint Center point for scaling.
2634 # Passing None for it means scaling relatively the origin of global CS.
2635 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
2636 # @return New GEOM_Object, containing the scaled shape.
2638 # @ref swig_scale "Example"
2639 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
2640 # Example: see GEOM_TestAll.py
2641 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
2642 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
2643 theFactorX, theFactorY, theFactorZ)
2644 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
2645 anObj.SetParameters(Parameters)
2648 ## Create an object, symmetrical
2649 # to the given one relatively the given plane.
2650 # @param theObject The object to be mirrored.
2651 # @param thePlane Plane of symmetry.
2652 # @return New GEOM_Object, containing the mirrored shape.
2654 # @ref tui_mirror "Example"
2655 def MakeMirrorByPlane(self,theObject, thePlane):
2656 # Example: see GEOM_TestAll.py
2657 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
2658 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
2661 ## Create an object, symmetrical
2662 # to the given one relatively the given axis.
2663 # @param theObject The object to be mirrored.
2664 # @param theAxis Axis of symmetry.
2665 # @return New GEOM_Object, containing the mirrored shape.
2667 # @ref tui_mirror "Example"
2668 def MakeMirrorByAxis(self,theObject, theAxis):
2669 # Example: see GEOM_TestAll.py
2670 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
2671 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
2674 ## Create an object, symmetrical
2675 # to the given one relatively the given point.
2676 # @param theObject The object to be mirrored.
2677 # @param thePoint Point of symmetry.
2678 # @return New GEOM_Object, containing the mirrored shape.
2680 # @ref tui_mirror "Example"
2681 def MakeMirrorByPoint(self,theObject, thePoint):
2682 # Example: see GEOM_TestAll.py
2683 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
2684 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
2687 ## Modify the Location of the given object by LCS,
2688 # creating its copy before the setting.
2689 # @param theObject The object to be displaced.
2690 # @param theStartLCS Coordinate system to perform displacement from it.
2691 # If \a theStartLCS is NULL, displacement
2692 # will be performed from global CS.
2693 # If \a theObject itself is used as \a theStartLCS,
2694 # its location will be changed to \a theEndLCS.
2695 # @param theEndLCS Coordinate system to perform displacement to it.
2696 # @return New GEOM_Object, containing the displaced shape.
2698 # @ref tui_modify_location "Example"
2699 def MakePosition(self,theObject, theStartLCS, theEndLCS):
2700 # Example: see GEOM_TestAll.py
2701 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
2702 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
2705 ## Modify the Location of the given object by Path,
2706 # @param theObject The object to be displaced.
2707 # @param thePath Wire or Edge along that the object will be translated.
2708 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
2709 # @param theCopy is to create a copy objects if true.
2710 # @param theReverse - 0 for usual direction, 1 to reverse path direction.
2711 # @return New GEOM_Object, containing the displaced shape.
2713 # @ref tui_modify_location "Example"
2714 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
2715 # Example: see GEOM_TestAll.py
2716 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
2717 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
2720 ## Create new object as offset of the given one.
2721 # @param theObject The base object for the offset.
2722 # @param theOffset Offset value.
2723 # @return New GEOM_Object, containing the offset object.
2725 # @ref tui_offset "Example"
2726 def MakeOffset(self,theObject, theOffset):
2727 # Example: see GEOM_TestAll.py
2728 theOffset, Parameters = ParseParameters(theOffset)
2729 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
2730 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
2731 anObj.SetParameters(Parameters)
2734 # -----------------------------------------------------------------------------
2736 # -----------------------------------------------------------------------------
2738 ## Translate the given object along the given vector a given number times
2739 # @param theObject The object to be translated.
2740 # @param theVector Direction of the translation.
2741 # @param theStep Distance to translate on.
2742 # @param theNbTimes Quantity of translations to be done.
2743 # @return New GEOM_Object, containing compound of all
2744 # the shapes, obtained after each translation.
2746 # @ref tui_multi_translation "Example"
2747 def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
2748 # Example: see GEOM_TestAll.py
2749 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
2750 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
2751 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
2752 anObj.SetParameters(Parameters)
2755 ## Conseqently apply two specified translations to theObject specified number of times.
2756 # @param theObject The object to be translated.
2757 # @param theVector1 Direction of the first translation.
2758 # @param theStep1 Step of the first translation.
2759 # @param theNbTimes1 Quantity of translations to be done along theVector1.
2760 # @param theVector2 Direction of the second translation.
2761 # @param theStep2 Step of the second translation.
2762 # @param theNbTimes2 Quantity of translations to be done along theVector2.
2763 # @return New GEOM_Object, containing compound of all
2764 # the shapes, obtained after each translation.
2766 # @ref tui_multi_translation "Example"
2767 def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
2768 theVector2, theStep2, theNbTimes2):
2769 # Example: see GEOM_TestAll.py
2770 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
2771 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
2772 theVector2, theStep2, theNbTimes2)
2773 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
2774 anObj.SetParameters(Parameters)
2777 ## Rotate the given object around the given axis a given number times.
2778 # Rotation angle will be 2*PI/theNbTimes.
2779 # @param theObject The object to be rotated.
2780 # @param theAxis The rotation axis.
2781 # @param theNbTimes Quantity of rotations to be done.
2782 # @return New GEOM_Object, containing compound of all the
2783 # shapes, obtained after each rotation.
2785 # @ref tui_multi_rotation "Example"
2786 def MultiRotate1D(self,theObject, theAxis, theNbTimes):
2787 # Example: see GEOM_TestAll.py
2788 theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
2789 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
2790 RaiseIfFailed("MultiRotate1D", self.TrsfOp)
2791 anObj.SetParameters(Parameters)
2794 ## Rotate the given object around the
2795 # given axis on the given angle a given number
2796 # times and multi-translate each rotation result.
2797 # Translation direction passes through center of gravity
2798 # of rotated shape and its projection on the rotation axis.
2799 # @param theObject The object to be rotated.
2800 # @param theAxis Rotation axis.
2801 # @param theAngle Rotation angle in graduces.
2802 # @param theNbTimes1 Quantity of rotations to be done.
2803 # @param theStep Translation distance.
2804 # @param theNbTimes2 Quantity of translations to be done.
2805 # @return New GEOM_Object, containing compound of all the
2806 # shapes, obtained after each transformation.
2808 # @ref tui_multi_rotation "Example"
2809 def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
2810 # Example: see GEOM_TestAll.py
2811 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
2812 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
2813 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
2814 anObj.SetParameters(Parameters)
2817 ## The same, as MultiRotate1D(), but axis is given by direction and point
2818 # @ref swig_MakeMultiRotation "Example"
2819 def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
2820 # Example: see GEOM_TestOthers.py
2821 aVec = self.MakeLine(aPoint,aDir)
2822 anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
2825 ## The same, as MultiRotate2D(), but axis is given by direction and point
2826 # @ref swig_MakeMultiRotation "Example"
2827 def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
2828 # Example: see GEOM_TestOthers.py
2829 aVec = self.MakeLine(aPoint,aDir)
2830 anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
2833 # end of l3_transform
2836 ## @addtogroup l3_local
2839 ## Perform a fillet on all edges of the given shape.
2840 # @param theShape Shape, to perform fillet on.
2841 # @param theR Fillet radius.
2842 # @return New GEOM_Object, containing the result shape.
2844 # @ref tui_fillet "Example 1"
2845 # \n @ref swig_MakeFilletAll "Example 2"
2846 def MakeFilletAll(self,theShape, theR):
2847 # Example: see GEOM_TestOthers.py
2848 theR,Parameters = ParseParameters(theR)
2849 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
2850 RaiseIfFailed("MakeFilletAll", self.LocalOp)
2851 anObj.SetParameters(Parameters)
2854 ## Perform a fillet on the specified edges/faces of the given shape
2855 # @param theShape Shape, to perform fillet on.
2856 # @param theR Fillet radius.
2857 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR>.
2858 # @param theListShapes Global indices of edges/faces to perform fillet on.
2859 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2860 # @return New GEOM_Object, containing the result shape.
2862 # @ref tui_fillet "Example"
2863 def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
2864 # Example: see GEOM_TestAll.py
2865 theR,Parameters = ParseParameters(theR)
2867 if theShapeType == ShapeType["EDGE"]:
2868 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
2869 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
2871 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
2872 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
2873 anObj.SetParameters(Parameters)
2876 ## The same that MakeFillet but with two Fillet Radius R1 and R2
2877 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
2878 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
2880 if theShapeType == ShapeType["EDGE"]:
2881 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
2882 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
2884 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
2885 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
2886 anObj.SetParameters(Parameters)
2889 ## Perform a fillet on the specified edges of the given shape
2890 # @param theShape - Wire Shape to perform fillet on.
2891 # @param theR - Fillet radius.
2892 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
2893 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2894 # \note The list of vertices could be empty,
2895 # in this case fillet will done done at all vertices in wire
2896 # @return New GEOM_Object, containing the result shape.
2898 # @ref tui_fillet2d "Example"
2899 def MakeFillet1D(self,theShape, theR, theListOfVertexes):
2900 # Example: see GEOM_TestAll.py
2901 anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes)
2902 RaiseIfFailed("MakeFillet1D", self.LocalOp)
2905 ## Perform a fillet on the specified edges/faces of the given shape
2906 # @param theShape - Face Shape to perform fillet on.
2907 # @param theR - Fillet radius.
2908 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
2909 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2910 # @return New GEOM_Object, containing the result shape.
2912 # @ref tui_fillet2d "Example"
2913 def MakeFillet2D(self,theShape, theR, theListOfVertexes):
2914 # Example: see GEOM_TestAll.py
2915 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
2916 RaiseIfFailed("MakeFillet2D", self.LocalOp)
2919 ## Perform a symmetric chamfer on all edges of the given shape.
2920 # @param theShape Shape, to perform chamfer on.
2921 # @param theD Chamfer size along each face.
2922 # @return New GEOM_Object, containing the result shape.
2924 # @ref tui_chamfer "Example 1"
2925 # \n @ref swig_MakeChamferAll "Example 2"
2926 def MakeChamferAll(self,theShape, theD):
2927 # Example: see GEOM_TestOthers.py
2928 theD,Parameters = ParseParameters(theD)
2929 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
2930 RaiseIfFailed("MakeChamferAll", self.LocalOp)
2931 anObj.SetParameters(Parameters)
2934 ## Perform a chamfer on edges, common to the specified faces,
2935 # with distance D1 on the Face1
2936 # @param theShape Shape, to perform chamfer on.
2937 # @param theD1 Chamfer size along \a theFace1.
2938 # @param theD2 Chamfer size along \a theFace2.
2939 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
2940 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2941 # @return New GEOM_Object, containing the result shape.
2943 # @ref tui_chamfer "Example"
2944 def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
2945 # Example: see GEOM_TestAll.py
2946 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2947 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
2948 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
2949 anObj.SetParameters(Parameters)
2952 ## The Same that MakeChamferEdge but with params theD is chamfer length and
2953 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2954 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
2956 if isinstance(theAngle,str):
2958 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2960 theAngle = theAngle*math.pi/180.0
2961 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
2962 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
2963 anObj.SetParameters(Parameters)
2966 ## Perform a chamfer on all edges of the specified faces,
2967 # with distance D1 on the first specified face (if several for one edge)
2968 # @param theShape Shape, to perform chamfer on.
2969 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
2970 # connected to the edge, are in \a theFaces, \a theD1
2971 # will be get along face, which is nearer to \a theFaces beginning.
2972 # @param theD2 Chamfer size along another of two faces, connected to the edge.
2973 # @param theFaces Sequence of global indices of faces of \a theShape.
2974 # \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
2975 # @return New GEOM_Object, containing the result shape.
2977 # @ref tui_chamfer "Example"
2978 def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
2979 # Example: see GEOM_TestAll.py
2980 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
2981 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
2982 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
2983 anObj.SetParameters(Parameters)
2986 ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
2987 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2989 # @ref swig_FilletChamfer "Example"
2990 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
2992 if isinstance(theAngle,str):
2994 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
2996 theAngle = theAngle*math.pi/180.0
2997 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
2998 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
2999 anObj.SetParameters(Parameters)
3002 ## Perform a chamfer on edges,
3003 # with distance D1 on the first specified face (if several for one edge)
3004 # @param theShape Shape, to perform chamfer on.
3005 # @param theD1,theD2 Chamfer size
3006 # @param theEdges Sequence of edges of \a theShape.
3007 # @return New GEOM_Object, containing the result shape.
3009 # @ref swig_FilletChamfer "Example"
3010 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
3011 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
3012 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
3013 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
3014 anObj.SetParameters(Parameters)
3017 ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
3018 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
3019 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
3021 if isinstance(theAngle,str):
3023 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
3025 theAngle = theAngle*math.pi/180.0
3026 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
3027 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
3028 anObj.SetParameters(Parameters)
3031 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
3033 # @ref swig_MakeChamfer "Example"
3034 def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
3035 # Example: see GEOM_TestOthers.py
3037 if aShapeType == ShapeType["EDGE"]:
3038 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
3040 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
3046 ## @addtogroup l3_basic_op
3049 ## Perform an Archimde operation on the given shape with given parameters.
3050 # The object presenting the resulting face is returned.
3051 # @param theShape Shape to be put in water.
3052 # @param theWeight Weight og the shape.
3053 # @param theWaterDensity Density of the water.
3054 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
3055 # @return New GEOM_Object, containing a section of \a theShape
3056 # by a plane, corresponding to water level.
3058 # @ref tui_archimede "Example"
3059 def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
3060 # Example: see GEOM_TestAll.py
3061 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
3062 theWeight,theWaterDensity,theMeshDeflection)
3063 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
3064 RaiseIfFailed("MakeArchimede", self.LocalOp)
3065 anObj.SetParameters(Parameters)
3068 # end of l3_basic_op
3071 ## @addtogroup l2_measure
3074 ## Get point coordinates
3077 # @ref tui_measurement_tools_page "Example"
3078 def PointCoordinates(self,Point):
3079 # Example: see GEOM_TestMeasures.py
3080 aTuple = self.MeasuOp.PointCoordinates(Point)
3081 RaiseIfFailed("PointCoordinates", self.MeasuOp)
3084 ## Get summarized length of all wires,
3085 # area of surface and volume of the given shape.
3086 # @param theShape Shape to define properties of.
3087 # @return [theLength, theSurfArea, theVolume]
3088 # theLength: Summarized length of all wires of the given shape.
3089 # theSurfArea: Area of surface of the given shape.
3090 # theVolume: Volume of the given shape.
3092 # @ref tui_measurement_tools_page "Example"
3093 def BasicProperties(self,theShape):
3094 # Example: see GEOM_TestMeasures.py
3095 aTuple = self.MeasuOp.GetBasicProperties(theShape)
3096 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
3099 ## Get parameters of bounding box of the given shape
3100 # @param theShape Shape to obtain bounding box of.
3101 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
3102 # Xmin,Xmax: Limits of shape along OX axis.
3103 # Ymin,Ymax: Limits of shape along OY axis.
3104 # Zmin,Zmax: Limits of shape along OZ axis.
3106 # @ref tui_measurement_tools_page "Example"
3107 def BoundingBox(self,theShape):
3108 # Example: see GEOM_TestMeasures.py
3109 aTuple = self.MeasuOp.GetBoundingBox(theShape)
3110 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
3113 ## Get inertia matrix and moments of inertia of theShape.
3114 # @param theShape Shape to calculate inertia of.
3115 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
3116 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
3117 # Ix,Iy,Iz: Moments of inertia of the given shape.
3119 # @ref tui_measurement_tools_page "Example"
3120 def Inertia(self,theShape):
3121 # Example: see GEOM_TestMeasures.py
3122 aTuple = self.MeasuOp.GetInertia(theShape)
3123 RaiseIfFailed("GetInertia", self.MeasuOp)
3126 ## Get minimal distance between the given shapes.
3127 # @param theShape1,theShape2 Shapes to find minimal distance between.
3128 # @return Value of the minimal distance between the given shapes.
3130 # @ref tui_measurement_tools_page "Example"
3131 def MinDistance(self, theShape1, theShape2):
3132 # Example: see GEOM_TestMeasures.py
3133 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
3134 RaiseIfFailed("GetMinDistance", self.MeasuOp)
3137 ## Get minimal distance between the given shapes.
3138 # @param theShape1,theShape2 Shapes to find minimal distance between.
3139 # @return Value of the minimal distance between the given shapes.
3141 # @ref swig_all_measure "Example"
3142 def MinDistanceComponents(self, theShape1, theShape2):
3143 # Example: see GEOM_TestMeasures.py
3144 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
3145 RaiseIfFailed("GetMinDistance", self.MeasuOp)
3146 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
3149 ## Get angle between the given shapes in degrees.
3150 # @param theShape1,theShape2 Lines or linear edges to find angle between.
3151 # @return Value of the angle between the given shapes in degrees.
3153 # @ref tui_measurement_tools_page "Example"
3154 def GetAngle(self, theShape1, theShape2):
3155 # Example: see GEOM_TestMeasures.py
3156 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
3157 RaiseIfFailed("GetAngle", self.MeasuOp)
3159 ## Get angle between the given shapes in radians.
3160 # @param theShape1,theShape2 Lines or linear edges to find angle between.
3161 # @return Value of the angle between the given shapes in radians.
3163 # @ref tui_measurement_tools_page "Example"
3164 def GetAngleRadians(self, theShape1, theShape2):
3165 # Example: see GEOM_TestMeasures.py
3166 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
3167 RaiseIfFailed("GetAngle", self.MeasuOp)
3170 ## @name Curve Curvature Measurement
3171 # Methods for receiving radius of curvature of curves
3172 # in the given point
3175 ## Measure curvature of a curve at a point, set by parameter.
3176 # @ref swig_todo "Example"
3177 def CurveCurvatureByParam(self, theCurve, theParam):
3178 # Example: see GEOM_TestMeasures.py
3179 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
3180 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
3184 # @ref swig_todo "Example"
3185 def CurveCurvatureByPoint(self, theCurve, thePoint):
3186 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
3187 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
3191 ## @name Surface Curvature Measurement
3192 # Methods for receiving max and min radius of curvature of surfaces
3193 # in the given point
3197 ## @ref swig_todo "Example"
3198 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
3199 # Example: see GEOM_TestMeasures.py
3200 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
3201 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
3205 ## @ref swig_todo "Example"
3206 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
3207 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
3208 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
3212 ## @ref swig_todo "Example"
3213 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
3214 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
3215 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
3219 ## @ref swig_todo "Example"
3220 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
3221 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
3222 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
3226 ## Get min and max tolerances of sub-shapes of theShape
3227 # @param theShape Shape, to get tolerances of.
3228 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
3229 # FaceMin,FaceMax: Min and max tolerances of the faces.
3230 # EdgeMin,EdgeMax: Min and max tolerances of the edges.
3231 # VertMin,VertMax: Min and max tolerances of the vertices.
3233 # @ref tui_measurement_tools_page "Example"
3234 def Tolerance(self,theShape):
3235 # Example: see GEOM_TestMeasures.py
3236 aTuple = self.MeasuOp.GetTolerance(theShape)
3237 RaiseIfFailed("GetTolerance", self.MeasuOp)
3240 ## Obtain description of the given shape (number of sub-shapes of each type)
3241 # @param theShape Shape to be described.
3242 # @return Description of the given shape.
3244 # @ref tui_measurement_tools_page "Example"
3245 def WhatIs(self,theShape):
3246 # Example: see GEOM_TestMeasures.py
3247 aDescr = self.MeasuOp.WhatIs(theShape)
3248 RaiseIfFailed("WhatIs", self.MeasuOp)
3251 ## Get a point, situated at the centre of mass of theShape.
3252 # @param theShape Shape to define centre of mass of.
3253 # @return New GEOM_Object, containing the created point.
3255 # @ref tui_measurement_tools_page "Example"
3256 def MakeCDG(self,theShape):
3257 # Example: see GEOM_TestMeasures.py
3258 anObj = self.MeasuOp.GetCentreOfMass(theShape)
3259 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
3262 ## Get a vertex subshape by index depended with orientation.
3263 # @param theShape Shape to find subshape.
3264 # @param theIndex Index to find vertex by this index.
3265 # @return New GEOM_Object, containing the created vertex.
3267 # @ref tui_measurement_tools_page "Example"
3268 def GetVertexByIndex(self,theShape, theIndex):
3269 # Example: see GEOM_TestMeasures.py
3270 anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex)
3271 RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
3274 ## Get the first vertex of wire/edge depended orientation.
3275 # @param theShape Shape to find first vertex.
3276 # @return New GEOM_Object, containing the created vertex.
3278 # @ref tui_measurement_tools_page "Example"
3279 def GetFirstVertex(self,theShape):
3280 # Example: see GEOM_TestMeasures.py
3281 anObj = self.GetVertexByIndex(theShape, 0)
3282 RaiseIfFailed("GetFirstVertex", self.MeasuOp)
3285 ## Get the last vertex of wire/edge depended orientation.
3286 # @param theShape Shape to find last vertex.
3287 # @return New GEOM_Object, containing the created vertex.
3289 # @ref tui_measurement_tools_page "Example"
3290 def GetLastVertex(self,theShape):
3291 # Example: see GEOM_TestMeasures.py
3292 nb_vert = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["VERTEX"])
3293 anObj = self.GetVertexByIndex(theShape, (nb_vert-1))
3294 RaiseIfFailed("GetLastVertex", self.MeasuOp)
3297 ## Get a normale to the given face. If the point is not given,
3298 # the normale is calculated at the center of mass.
3299 # @param theFace Face to define normale of.
3300 # @param theOptionalPoint Point to compute the normale at.
3301 # @return New GEOM_Object, containing the created vector.
3303 # @ref swig_todo "Example"
3304 def GetNormal(self, theFace, theOptionalPoint = None):
3305 # Example: see GEOM_TestMeasures.py
3306 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
3307 RaiseIfFailed("GetNormal", self.MeasuOp)
3310 ## Check a topology of the given shape.
3311 # @param theShape Shape to check validity of.
3312 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
3313 # if TRUE, the shape's geometry will be checked also.
3314 # @return TRUE, if the shape "seems to be valid".
3315 # If theShape is invalid, prints a description of problem.
3317 # @ref tui_measurement_tools_page "Example"
3318 def CheckShape(self,theShape, theIsCheckGeom = 0):
3319 # Example: see GEOM_TestMeasures.py
3321 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
3322 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
3324 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
3325 RaiseIfFailed("CheckShape", self.MeasuOp)
3330 ## Get position (LCS) of theShape.
3332 # Origin of the LCS is situated at the shape's center of mass.
3333 # Axes of the LCS are obtained from shape's location or,
3334 # if the shape is a planar face, from position of its plane.
3336 # @param theShape Shape to calculate position of.
3337 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
3338 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
3339 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
3340 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
3342 # @ref swig_todo "Example"
3343 def GetPosition(self,theShape):
3344 # Example: see GEOM_TestMeasures.py
3345 aTuple = self.MeasuOp.GetPosition(theShape)
3346 RaiseIfFailed("GetPosition", self.MeasuOp)
3349 ## Get kind of theShape.
3351 # @param theShape Shape to get a kind of.
3352 # @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
3353 # and a list of parameters, describing the shape.
3354 # @note Concrete meaning of each value, returned via \a theIntegers
3355 # or \a theDoubles list depends on the kind of the shape.
3356 # The full list of possible outputs is:
3358 # - geompy.kind.COMPOUND nb_solids nb_faces nb_edges nb_vertices
3359 # - geompy.kind.COMPSOLID nb_solids nb_faces nb_edges nb_vertices
3361 # - geompy.kind.SHELL geompy.info.CLOSED nb_faces nb_edges nb_vertices
3362 # - geompy.kind.SHELL geompy.info.UNCLOSED nb_faces nb_edges nb_vertices
3364 # - geompy.kind.WIRE geompy.info.CLOSED nb_edges nb_vertices
3365 # - geompy.kind.WIRE geompy.info.UNCLOSED nb_edges nb_vertices
3367 # - geompy.kind.SPHERE xc yc zc R
3368 # - geompy.kind.CYLINDER xb yb zb dx dy dz R H
3369 # - geompy.kind.BOX xc yc zc ax ay az
3370 # - geompy.kind.ROTATED_BOX xc yc zc zx zy zz xx xy xz ax ay az
3371 # - geompy.kind.TORUS xc yc zc dx dy dz R_1 R_2
3372 # - geompy.kind.CONE xb yb zb dx dy dz R_1 R_2 H
3373 # - geompy.kind.POLYHEDRON nb_faces nb_edges nb_vertices
3374 # - geompy.kind.SOLID nb_faces nb_edges nb_vertices
3376 # - geompy.kind.SPHERE2D xc yc zc R
3377 # - geompy.kind.CYLINDER2D xb yb zb dx dy dz R H
3378 # - geompy.kind.TORUS2D xc yc zc dx dy dz R_1 R_2
3379 # - geompy.kind.CONE2D xc yc zc dx dy dz R_1 R_2 H
3380 # - geompy.kind.DISK_CIRCLE xc yc zc dx dy dz R
3381 # - geompy.kind.DISK_ELLIPSE xc yc zc dx dy dz R_1 R_2
3382 # - geompy.kind.POLYGON xo yo zo dx dy dz nb_edges nb_vertices
3383 # - geompy.kind.PLANE xo yo zo dx dy dz
3384 # - geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices
3385 # - geompy.kind.FACE nb_edges nb_vertices
3387 # - geompy.kind.CIRCLE xc yc zc dx dy dz R
3388 # - geompy.kind.ARC_CIRCLE xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2
3389 # - geompy.kind.ELLIPSE xc yc zc dx dy dz R_1 R_2
3390 # - geompy.kind.ARC_ELLIPSE xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2
3391 # - geompy.kind.LINE xo yo zo dx dy dz
3392 # - geompy.kind.SEGMENT x1 y1 z1 x2 y2 z2
3393 # - geompy.kind.EDGE nb_vertices
3395 # - geompy.kind.VERTEX x y z
3397 # @ref swig_todo "Example"
3398 def KindOfShape(self,theShape):
3399 # Example: see GEOM_TestMeasures.py
3400 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
3401 RaiseIfFailed("KindOfShape", self.MeasuOp)
3403 aKind = aRoughTuple[0]
3404 anInts = aRoughTuple[1]
3405 aDbls = aRoughTuple[2]
3407 # Now there is no exception from this rule:
3408 aKindTuple = [aKind] + aDbls + anInts
3410 # If they are we will regroup parameters for such kind of shape.
3412 #if aKind == kind.SOME_KIND:
3413 # # SOME_KIND int int double int double double
3414 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
3421 ## @addtogroup l2_import_export
3424 ## Import a shape from the BREP or IGES or STEP file
3425 # (depends on given format) with given name.
3426 # @param theFileName The file, containing the shape.
3427 # @param theFormatName Specify format for the file reading.
3428 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3429 # If format 'IGES_SCALE' is used instead 'IGES' length unit will be
3430 # set to 'meter' and result model will be scaled.
3431 # @return New GEOM_Object, containing the imported shape.
3433 # @ref swig_Import_Export "Example"
3434 def Import(self,theFileName, theFormatName):
3435 # Example: see GEOM_TestOthers.py
3436 anObj = self.InsertOp.Import(theFileName, theFormatName)
3437 RaiseIfFailed("Import", self.InsertOp)
3440 ## Shortcut to Import() for BREP format
3442 # @ref swig_Import_Export "Example"
3443 def ImportBREP(self,theFileName):
3444 # Example: see GEOM_TestOthers.py
3445 return self.Import(theFileName, "BREP")
3447 ## Shortcut to Import() for IGES format
3449 # @ref swig_Import_Export "Example"
3450 def ImportIGES(self,theFileName):
3451 # Example: see GEOM_TestOthers.py
3452 return self.Import(theFileName, "IGES")
3454 ## Return length unit from given IGES file
3456 # @ref swig_Import_Export "Example"
3457 def GetIGESUnit(self,theFileName):
3458 # Example: see GEOM_TestOthers.py
3459 anObj = self.InsertOp.Import(theFileName, "IGES_UNIT")
3460 #RaiseIfFailed("Import", self.InsertOp)
3461 # recieve name using returned vertex
3463 vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
3465 p = self.PointCoordinates(vertices[0])
3466 if abs(p[0]-0.01) < 1.e-6:
3468 elif abs(p[0]-0.001) < 1.e-6:
3472 ## Shortcut to Import() for STEP format
3474 # @ref swig_Import_Export "Example"
3475 def ImportSTEP(self,theFileName):
3476 # Example: see GEOM_TestOthers.py
3477 return self.Import(theFileName, "STEP")
3479 ## Export the given shape into a file with given name.
3480 # @param theObject Shape to be stored in the file.
3481 # @param theFileName Name of the file to store the given shape in.
3482 # @param theFormatName Specify format for the shape storage.
3483 # Available formats can be obtained with InsertOp.ImportTranslators() method.
3485 # @ref swig_Import_Export "Example"
3486 def Export(self,theObject, theFileName, theFormatName):
3487 # Example: see GEOM_TestOthers.py
3488 self.InsertOp.Export(theObject, theFileName, theFormatName)
3489 if self.InsertOp.IsDone() == 0:
3490 raise RuntimeError, "Export : " + self.InsertOp.GetErrorCode()
3494 ## Shortcut to Export() for BREP format
3496 # @ref swig_Import_Export "Example"
3497 def ExportBREP(self,theObject, theFileName):
3498 # Example: see GEOM_TestOthers.py
3499 return self.Export(theObject, theFileName, "BREP")
3501 ## Shortcut to Export() for IGES format
3503 # @ref swig_Import_Export "Example"
3504 def ExportIGES(self,theObject, theFileName):
3505 # Example: see GEOM_TestOthers.py
3506 return self.Export(theObject, theFileName, "IGES")
3508 ## Shortcut to Export() for STEP format
3510 # @ref swig_Import_Export "Example"
3511 def ExportSTEP(self,theObject, theFileName):
3512 # Example: see GEOM_TestOthers.py
3513 return self.Export(theObject, theFileName, "STEP")
3515 # end of l2_import_export
3518 ## @addtogroup l3_blocks
3521 ## Create a quadrangle face from four edges. Order of Edges is not
3522 # important. It is not necessary that edges share the same vertex.
3523 # @param E1,E2,E3,E4 Edges for the face bound.
3524 # @return New GEOM_Object, containing the created face.
3526 # @ref tui_building_by_blocks_page "Example"
3527 def MakeQuad(self,E1, E2, E3, E4):
3528 # Example: see GEOM_Spanner.py
3529 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
3530 RaiseIfFailed("MakeQuad", self.BlocksOp)
3533 ## Create a quadrangle face on two edges.
3534 # The missing edges will be built by creating the shortest ones.
3535 # @param E1,E2 Two opposite edges for the face.
3536 # @return New GEOM_Object, containing the created face.
3538 # @ref tui_building_by_blocks_page "Example"
3539 def MakeQuad2Edges(self,E1, E2):
3540 # Example: see GEOM_Spanner.py
3541 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
3542 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
3545 ## Create a quadrangle face with specified corners.
3546 # The missing edges will be built by creating the shortest ones.
3547 # @param V1,V2,V3,V4 Corner vertices for the face.
3548 # @return New GEOM_Object, containing the created face.
3550 # @ref tui_building_by_blocks_page "Example 1"
3551 # \n @ref swig_MakeQuad4Vertices "Example 2"
3552 def MakeQuad4Vertices(self,V1, V2, V3, V4):
3553 # Example: see GEOM_Spanner.py
3554 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
3555 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
3558 ## Create a hexahedral solid, bounded by the six given faces. Order of
3559 # faces is not important. It is not necessary that Faces share the same edge.
3560 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
3561 # @return New GEOM_Object, containing the created solid.
3563 # @ref tui_building_by_blocks_page "Example 1"
3564 # \n @ref swig_MakeHexa "Example 2"
3565 def MakeHexa(self,F1, F2, F3, F4, F5, F6):
3566 # Example: see GEOM_Spanner.py
3567 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
3568 RaiseIfFailed("MakeHexa", self.BlocksOp)
3571 ## Create a hexahedral solid between two given faces.
3572 # The missing faces will be built by creating the smallest ones.
3573 # @param F1,F2 Two opposite faces for the hexahedral solid.
3574 # @return New GEOM_Object, containing the created solid.
3576 # @ref tui_building_by_blocks_page "Example 1"
3577 # \n @ref swig_MakeHexa2Faces "Example 2"
3578 def MakeHexa2Faces(self,F1, F2):
3579 # Example: see GEOM_Spanner.py
3580 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
3581 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
3587 ## @addtogroup l3_blocks_op
3590 ## Get a vertex, found in the given shape by its coordinates.
3591 # @param theShape Block or a compound of blocks.
3592 # @param theX,theY,theZ Coordinates of the sought vertex.
3593 # @param theEpsilon Maximum allowed distance between the resulting
3594 # vertex and point with the given coordinates.
3595 # @return New GEOM_Object, containing the found vertex.
3597 # @ref swig_GetPoint "Example"
3598 def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
3599 # Example: see GEOM_TestOthers.py
3600 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
3601 RaiseIfFailed("GetPoint", self.BlocksOp)
3604 ## Get an edge, found in the given shape by two given vertices.
3605 # @param theShape Block or a compound of blocks.
3606 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
3607 # @return New GEOM_Object, containing the found edge.
3609 # @ref swig_todo "Example"
3610 def GetEdge(self,theShape, thePoint1, thePoint2):
3611 # Example: see GEOM_Spanner.py
3612 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
3613 RaiseIfFailed("GetEdge", self.BlocksOp)
3616 ## Find an edge of the given shape, which has minimal distance to the given point.
3617 # @param theShape Block or a compound of blocks.
3618 # @param thePoint Point, close to the desired edge.
3619 # @return New GEOM_Object, containing the found edge.
3621 # @ref swig_GetEdgeNearPoint "Example"
3622 def GetEdgeNearPoint(self,theShape, thePoint):
3623 # Example: see GEOM_TestOthers.py
3624 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
3625 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
3628 ## Returns a face, found in the given shape by four given corner vertices.
3629 # @param theShape Block or a compound of blocks.
3630 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
3631 # @return New GEOM_Object, containing the found face.
3633 # @ref swig_todo "Example"
3634 def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
3635 # Example: see GEOM_Spanner.py
3636 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
3637 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
3640 ## Get a face of block, found in the given shape by two given edges.
3641 # @param theShape Block or a compound of blocks.
3642 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
3643 # @return New GEOM_Object, containing the found face.
3645 # @ref swig_todo "Example"
3646 def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
3647 # Example: see GEOM_Spanner.py
3648 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
3649 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
3652 ## Find a face, opposite to the given one in the given block.
3653 # @param theBlock Must be a hexahedral solid.
3654 # @param theFace Face of \a theBlock, opposite to the desired face.
3655 # @return New GEOM_Object, containing the found face.
3657 # @ref swig_GetOppositeFace "Example"
3658 def GetOppositeFace(self,theBlock, theFace):
3659 # Example: see GEOM_Spanner.py
3660 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
3661 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
3664 ## Find a face of the given shape, which has minimal distance to the given point.
3665 # @param theShape Block or a compound of blocks.
3666 # @param thePoint Point, close to the desired face.
3667 # @return New GEOM_Object, containing the found face.
3669 # @ref swig_GetFaceNearPoint "Example"
3670 def GetFaceNearPoint(self,theShape, thePoint):
3671 # Example: see GEOM_Spanner.py
3672 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
3673 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
3676 ## Find a face of block, whose outside normale has minimal angle with the given vector.
3677 # @param theBlock Block or a compound of blocks.
3678 # @param theVector Vector, close to the normale of the desired face.
3679 # @return New GEOM_Object, containing the found face.
3681 # @ref swig_todo "Example"
3682 def GetFaceByNormale(self, theBlock, theVector):
3683 # Example: see GEOM_Spanner.py
3684 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
3685 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
3688 # end of l3_blocks_op
3691 ## @addtogroup l4_blocks_measure
3694 ## Check, if the compound of blocks is given.
3695 # To be considered as a compound of blocks, the
3696 # given shape must satisfy the following conditions:
3697 # - Each element of the compound should be a Block (6 faces and 12 edges).
3698 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
3699 # - The compound should be connexe.
3700 # - The glue between two quadrangle faces should be applied.
3701 # @param theCompound The compound to check.
3702 # @return TRUE, if the given shape is a compound of blocks.
3703 # If theCompound is not valid, prints all discovered errors.
3705 # @ref tui_measurement_tools_page "Example 1"
3706 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
3707 def CheckCompoundOfBlocks(self,theCompound):
3708 # Example: see GEOM_Spanner.py
3709 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
3710 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
3712 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
3716 ## Remove all seam and degenerated edges from \a theShape.
3717 # Unite faces and edges, sharing one surface. It means that
3718 # this faces must have references to one C++ surface object (handle).
3719 # @param theShape The compound or single solid to remove irregular edges from.
3720 # @param doUnionFaces If True, then unite faces. If False (the default value),
3721 # do not unite faces.
3722 # @return Improved shape.
3724 # @ref swig_RemoveExtraEdges "Example"
3725 def RemoveExtraEdges(self, theShape, doUnionFaces=False):
3726 # Example: see GEOM_TestOthers.py
3727 nbFacesOptimum = -1 # -1 means do not unite faces
3728 if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
3729 anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
3730 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
3733 ## Check, if the given shape is a blocks compound.
3734 # Fix all detected errors.
3735 # \note Single block can be also fixed by this method.
3736 # @param theShape The compound to check and improve.
3737 # @return Improved compound.
3739 # @ref swig_CheckAndImprove "Example"
3740 def CheckAndImprove(self,theShape):
3741 # Example: see GEOM_TestOthers.py
3742 anObj = self.BlocksOp.CheckAndImprove(theShape)
3743 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
3746 # end of l4_blocks_measure
3749 ## @addtogroup l3_blocks_op
3752 ## Get all the blocks, contained in the given compound.
3753 # @param theCompound The compound to explode.
3754 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
3755 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
3756 # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
3757 # @return List of GEOM_Objects, containing the retrieved blocks.
3759 # @ref tui_explode_on_blocks "Example 1"
3760 # \n @ref swig_MakeBlockExplode "Example 2"
3761 def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
3762 # Example: see GEOM_TestOthers.py
3763 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
3764 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
3765 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
3767 anObj.SetParameters(Parameters)
3771 ## Find block, containing the given point inside its volume or on boundary.
3772 # @param theCompound Compound, to find block in.
3773 # @param thePoint Point, close to the desired block. If the point lays on
3774 # boundary between some blocks, we return block with nearest center.
3775 # @return New GEOM_Object, containing the found block.
3777 # @ref swig_todo "Example"
3778 def GetBlockNearPoint(self,theCompound, thePoint):
3779 # Example: see GEOM_Spanner.py
3780 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
3781 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
3784 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
3785 # @param theCompound Compound, to find block in.
3786 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
3787 # @return New GEOM_Object, containing the found block.
3789 # @ref swig_GetBlockByParts "Example"
3790 def GetBlockByParts(self,theCompound, theParts):
3791 # Example: see GEOM_TestOthers.py
3792 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
3793 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
3796 ## Return all blocks, containing all the elements, passed as the parts.
3797 # @param theCompound Compound, to find blocks in.
3798 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
3799 # @return List of GEOM_Objects, containing the found blocks.
3801 # @ref swig_todo "Example"
3802 def GetBlocksByParts(self,theCompound, theParts):
3803 # Example: see GEOM_Spanner.py
3804 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
3805 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
3808 ## Multi-transformate block and glue the result.
3809 # Transformation is defined so, as to superpose direction faces.
3810 # @param Block Hexahedral solid to be multi-transformed.
3811 # @param DirFace1 ID of First direction face.
3812 # @param DirFace2 ID of Second direction face.
3813 # @param NbTimes Quantity of transformations to be done.
3814 # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
3815 # @return New GEOM_Object, containing the result shape.
3817 # @ref tui_multi_transformation "Example"
3818 def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
3819 # Example: see GEOM_Spanner.py
3820 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
3821 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
3822 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
3823 anObj.SetParameters(Parameters)
3826 ## Multi-transformate block and glue the result.
3827 # @param Block Hexahedral solid to be multi-transformed.
3828 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
3829 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
3830 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
3831 # @return New GEOM_Object, containing the result shape.
3833 # @ref tui_multi_transformation "Example"
3834 def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
3835 DirFace1V, DirFace2V, NbTimesV):
3836 # Example: see GEOM_Spanner.py
3837 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
3838 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
3839 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
3840 DirFace1V, DirFace2V, NbTimesV)
3841 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
3842 anObj.SetParameters(Parameters)
3845 ## Build all possible propagation groups.
3846 # Propagation group is a set of all edges, opposite to one (main)
3847 # edge of this group directly or through other opposite edges.
3848 # Notion of Opposite Edge make sence only on quadrangle face.
3849 # @param theShape Shape to build propagation groups on.
3850 # @return List of GEOM_Objects, each of them is a propagation group.
3852 # @ref swig_Propagate "Example"
3853 def Propagate(self,theShape):
3854 # Example: see GEOM_TestOthers.py
3855 listChains = self.BlocksOp.Propagate(theShape)
3856 RaiseIfFailed("Propagate", self.BlocksOp)
3859 # end of l3_blocks_op
3862 ## @addtogroup l3_groups
3865 ## Creates a new group which will store sub shapes of theMainShape
3866 # @param theMainShape is a GEOM object on which the group is selected
3867 # @param theShapeType defines a shape type of the group
3868 # @return a newly created GEOM group
3870 # @ref tui_working_with_groups_page "Example 1"
3871 # \n @ref swig_CreateGroup "Example 2"
3872 def CreateGroup(self,theMainShape, theShapeType):
3873 # Example: see GEOM_TestOthers.py
3874 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
3875 RaiseIfFailed("CreateGroup", self.GroupOp)
3878 ## Adds a sub object with ID theSubShapeId to the group
3879 # @param theGroup is a GEOM group to which the new sub shape is added
3880 # @param theSubShapeID is a sub shape ID in the main object.
3881 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3883 # @ref tui_working_with_groups_page "Example"
3884 def AddObject(self,theGroup, theSubShapeID):
3885 # Example: see GEOM_TestOthers.py
3886 self.GroupOp.AddObject(theGroup, theSubShapeID)
3887 RaiseIfFailed("AddObject", self.GroupOp)
3890 ## Removes a sub object with ID \a theSubShapeId from the group
3891 # @param theGroup is a GEOM group from which the new sub shape is removed
3892 # @param theSubShapeID is a sub shape ID in the main object.
3893 # \note Use method GetSubShapeID() to get an unique ID of the sub shape
3895 # @ref tui_working_with_groups_page "Example"
3896 def RemoveObject(self,theGroup, theSubShapeID):
3897 # Example: see GEOM_TestOthers.py
3898 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
3899 RaiseIfFailed("RemoveObject", self.GroupOp)
3902 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
3903 # @param theGroup is a GEOM group to which the new sub shapes are added.
3904 # @param theSubShapes is a list of sub shapes to be added.
3906 # @ref tui_working_with_groups_page "Example"
3907 def UnionList (self,theGroup, theSubShapes):
3908 # Example: see GEOM_TestOthers.py
3909 self.GroupOp.UnionList(theGroup, theSubShapes)
3910 RaiseIfFailed("UnionList", self.GroupOp)
3913 ## Works like the above method, but argument
3914 # theSubShapes here is a list of sub-shapes indices
3916 # @ref swig_UnionIDs "Example"
3917 def UnionIDs(self,theGroup, theSubShapes):
3918 # Example: see GEOM_TestOthers.py
3919 self.GroupOp.UnionIDs(theGroup, theSubShapes)
3920 RaiseIfFailed("UnionIDs", self.GroupOp)
3923 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
3924 # @param theGroup is a GEOM group from which the sub-shapes are removed.
3925 # @param theSubShapes is a list of sub-shapes to be removed.
3927 # @ref tui_working_with_groups_page "Example"
3928 def DifferenceList (self,theGroup, theSubShapes):
3929 # Example: see GEOM_TestOthers.py
3930 self.GroupOp.DifferenceList(theGroup, theSubShapes)
3931 RaiseIfFailed("DifferenceList", self.GroupOp)
3934 ## Works like the above method, but argument
3935 # theSubShapes here is a list of sub-shapes indices
3937 # @ref swig_DifferenceIDs "Example"
3938 def DifferenceIDs(self,theGroup, theSubShapes):
3939 # Example: see GEOM_TestOthers.py
3940 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
3941 RaiseIfFailed("DifferenceIDs", self.GroupOp)
3944 ## Returns a list of sub objects ID stored in the group
3945 # @param theGroup is a GEOM group for which a list of IDs is requested
3947 # @ref swig_GetObjectIDs "Example"
3948 def GetObjectIDs(self,theGroup):
3949 # Example: see GEOM_TestOthers.py
3950 ListIDs = self.GroupOp.GetObjects(theGroup)
3951 RaiseIfFailed("GetObjects", self.GroupOp)
3954 ## Returns a type of sub objects stored in the group
3955 # @param theGroup is a GEOM group which type is returned.
3957 # @ref swig_GetType "Example"
3958 def GetType(self,theGroup):
3959 # Example: see GEOM_TestOthers.py
3960 aType = self.GroupOp.GetType(theGroup)
3961 RaiseIfFailed("GetType", self.GroupOp)
3964 ## Convert a type of geom object from id to string value
3965 # @param theId is a GEOM obect type id.
3967 # @ref swig_GetType "Example"
3968 def ShapeIdToType(self, theId):
4042 return "FREE_BOUNDS"
4050 return "THRUSECTIONS"
4052 return "COMPOUNDFILTER"
4054 return "SHAPES_ON_SHAPE"
4056 return "ELLIPSE_ARC"
4063 return "Shape Id not exist."
4065 ## Returns a main shape associated with the group
4066 # @param theGroup is a GEOM group for which a main shape object is requested
4067 # @return a GEOM object which is a main shape for theGroup
4069 # @ref swig_GetMainShape "Example"
4070 def GetMainShape(self,theGroup):
4071 # Example: see GEOM_TestOthers.py
4072 anObj = self.GroupOp.GetMainShape(theGroup)
4073 RaiseIfFailed("GetMainShape", self.GroupOp)
4076 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
4077 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
4079 # @ref swig_todo "Example"
4080 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
4081 edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
4084 Props = self.BasicProperties(edge)
4085 if min_length <= Props[0] and Props[0] <= max_length:
4086 if (not include_min) and (min_length == Props[0]):
4089 if (not include_max) and (Props[0] == max_length):
4092 edges_in_range.append(edge)
4094 if len(edges_in_range) <= 0:
4095 print "No edges found by given criteria"
4098 group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
4099 self.UnionList(group_edges, edges_in_range)
4103 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
4104 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
4106 # @ref swig_todo "Example"
4107 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
4108 nb_selected = sg.SelectedCount()
4110 print "Select a shape before calling this function, please."
4113 print "Only one shape must be selected"
4116 id_shape = sg.getSelected(0)
4117 shape = IDToObject( id_shape )
4119 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
4123 if include_min: left_str = " <= "
4124 if include_max: right_str = " <= "
4126 self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
4127 + left_str + "length" + right_str + `max_length`)
4129 sg.updateObjBrowser(1)
4136 ## @addtogroup l4_advanced
4139 ## Create a T-shape object with specified caracteristics for the main
4140 # and the incident pipes (radius, width, half-length).
4141 # The extremities of the main pipe are located on junctions points P1 and P2.
4142 # The extremity of the incident pipe is located on junction point P3.
4143 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4144 # the main plane of the T-shape is XOY.
4145 # @param theR1 Internal radius of main pipe
4146 # @param theW1 Width of main pipe
4147 # @param theL1 Half-length of main pipe
4148 # @param theR2 Internal radius of incident pipe (R2 < R1)
4149 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4150 # @param theL2 Half-length of incident pipe
4151 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4152 # @param theP1 1st junction point of main pipe
4153 # @param theP2 2nd junction point of main pipe
4154 # @param theP3 Junction point of incident pipe
4155 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4157 # @ref tui_creation_pipetshape "Example"
4158 def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4159 theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
4160 if (theP1 and theP2 and theP3):
4161 anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3)
4163 anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh)
4164 RaiseIfFailed("MakePipeTShape", self.AdvOp)
4165 if Parameters: anObj[0].SetParameters(Parameters)
4168 ## Create a T-shape object with chamfer and with specified caracteristics for the main
4169 # and the incident pipes (radius, width, half-length). The chamfer is
4170 # created on the junction of the pipes.
4171 # The extremities of the main pipe are located on junctions points P1 and P2.
4172 # The extremity of the incident pipe is located on junction point P3.
4173 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4174 # the main plane of the T-shape is XOY.
4175 # @param theR1 Internal radius of main pipe
4176 # @param theW1 Width of main pipe
4177 # @param theL1 Half-length of main pipe
4178 # @param theR2 Internal radius of incident pipe (R2 < R1)
4179 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4180 # @param theL2 Half-length of incident pipe
4181 # @param theH Height of the chamfer.
4182 # @param theW Width of the chamfer.
4183 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4184 # @param theP1 1st junction point of main pipe
4185 # @param theP2 2nd junction point of main pipe
4186 # @param theP3 Junction point of incident pipe
4187 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4189 # @ref tui_creation_pipetshape "Example"
4190 def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4191 theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW)
4192 if (theP1 and theP2 and theP3):
4193 anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3)
4195 anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh)
4196 RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp)
4197 if Parameters: anObj[0].SetParameters(Parameters)
4200 ## Create a T-shape object with fillet and with specified caracteristics for the main
4201 # and the incident pipes (radius, width, half-length). The fillet is
4202 # created on the junction of the pipes.
4203 # The extremities of the main pipe are located on junctions points P1 and P2.
4204 # The extremity of the incident pipe is located on junction point P3.
4205 # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and
4206 # the main plane of the T-shape is XOY.
4207 # @param theR1 Internal radius of main pipe
4208 # @param theW1 Width of main pipe
4209 # @param theL1 Half-length of main pipe
4210 # @param theR2 Internal radius of incident pipe (R2 < R1)
4211 # @param theW2 Width of incident pipe (R2+W2 < R1+W1)
4212 # @param theL2 Half-length of incident pipe
4213 # @param theRF Radius of curvature of fillet.
4214 # @param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=True)
4215 # @param theP1 1st junction point of main pipe
4216 # @param theP2 2nd junction point of main pipe
4217 # @param theP3 Junction point of incident pipe
4218 # @return List of GEOM_Objects, containing the created shape and propagation groups.
4220 # @ref tui_creation_pipetshape "Example"
4221 def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None):
4222 theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF)
4223 if (theP1 and theP2 and theP3):
4224 anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3)
4226 anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh)
4227 RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp)
4228 if Parameters: anObj[0].SetParameters(Parameters)
4231 #@@ insert new functions before this line @@ do not remove this line @@#
4233 # end of l4_advanced
4236 ## Create a copy of the given object
4237 # @ingroup l1_geompy_auxiliary
4239 # @ref swig_all_advanced "Example"
4240 def MakeCopy(self,theOriginal):
4241 # Example: see GEOM_TestAll.py
4242 anObj = self.InsertOp.MakeCopy(theOriginal)
4243 RaiseIfFailed("MakeCopy", self.InsertOp)
4246 ## Add Path to load python scripts from
4247 # @ingroup l1_geompy_auxiliary
4248 def addPath(self,Path):
4249 if (sys.path.count(Path) < 1):
4250 sys.path.append(Path)
4254 ## Load marker texture from the file
4255 # @param Path a path to the texture file
4256 # @return unique texture identifier
4257 # @ingroup l1_geompy_auxiliary
4258 def LoadTexture(self, Path):
4259 # Example: see GEOM_TestAll.py
4260 ID = self.InsertOp.LoadTexture(Path)
4261 RaiseIfFailed("LoadTexture", self.InsertOp)
4264 ## Add marker texture. @a Width and @a Height parameters
4265 # specify width and height of the texture in pixels.
4266 # If @a RowData is @c True, @a Texture parameter should represent texture data
4267 # packed into the byte array. If @a RowData is @c False (default), @a Texture
4268 # parameter should be unpacked string, in which '1' symbols represent opaque
4269 # pixels and '0' represent transparent pixels of the texture bitmap.
4271 # @param Width texture width in pixels
4272 # @param Height texture height in pixels
4273 # @param Texture texture data
4274 # @param RowData if @c True, @a Texture data are packed in the byte stream
4275 # @ingroup l1_geompy_auxiliary
4276 def AddTexture(self, Width, Height, Texture, RowData=False):
4277 # Example: see GEOM_TestAll.py
4278 if not RowData: Texture = PackData(Texture)
4279 ID = self.InsertOp.AddTexture(Width, Height, Texture)
4280 RaiseIfFailed("AddTexture", self.InsertOp)
4284 #Register the new proxy for GEOM_Gen
4285 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)