1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2022 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, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # GEOM GEOM_SWIG : binding of C++ implementation with Python
22 # File : geomBuilder.py
23 # Author : Paul RASCLE, EDF
27 \namespace geomBuilder
28 \brief Module geomBuilder
32 ## @defgroup geomBuilder geomBuilder Python module
37 ## By default, all functions of geomBuilder Python module do not publish
38 ## resulting geometrical objects. This can be done in the Python script
39 ## by means of \ref geomBuilder.geomBuilder.addToStudy() "addToStudy()"
40 ## or \ref geomBuilder.geomBuilder.addToStudyInFather() "addToStudyInFather()"
43 ## However, it is possible to publish result data in the study
44 ## automatically. For this, almost each function of
45 ## \ref geomBuilder.geomBuilder "geomBuilder" class has
46 ## an additional @a theName parameter (@c None by default).
47 ## As soon as non-empty string value is passed to this parameter,
48 ## the result object is published in the study automatically.
50 ## For example, consider the following Python script:
54 ## from salome.geom import geomBuilder
55 ## geompy = geomBuilder.New()
56 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100) # box is not published in the study yet
57 ## geompy.addToStudy(box, "box") # explicit publishing
60 ## Last two lines can be replaced by one-line instruction:
63 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100, theName="box") # box is published in the study with "box" name
69 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100, "box") # box is published in the study with "box" name
72 ## Note, that some functions produce more than one geometrical objects. For example,
73 ## \ref geomBuilder.geomBuilder.GetNonBlocks() "GetNonBlocks()" function returns two objects:
74 ## group of all non-hexa solids and group of all non-quad faces.
75 ## For such functions it is possible to specify separate names for results.
80 ## # create and publish cylinder
81 ## cyl = geompy.MakeCylinderRH(100, 100, "cylinder")
82 ## # get non blocks from cylinder
83 ## g1, g2 = geompy.GetNonBlocks(cyl, theName="nonblock")
86 ## Above example will publish both result compounds (first with non-hexa solids and
87 ## second with non-quad faces) as two items, both named "nonblock".
88 ## However, if second command is invoked as
91 ## g1, g2 = geompy.GetNonBlocks(cyl, theName=("nonhexa", "nonquad"))
94 ## ... the first compound will be published with "nonhexa" name, and second will be named "nonquad".
96 ## Automatic publication of all results can be also enabled/disabled by means of the function
97 ## \ref geomBuilder.geomBuilder.addToStudyAuto() "addToStudyAuto()". The automatic publishing
98 ## is managed by the numeric parameter passed to this function:
99 ## - if @a maxNbSubShapes = 0, automatic publishing is disabled.
100 ## - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
101 ## maximum number of sub-shapes allowed for publishing is unlimited; any negative
102 ## value passed as parameter has the same effect.
103 ## - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
104 ## maximum number of sub-shapes allowed for publishing is set to specified value.
106 ## When automatic publishing is enabled, you even do not need to pass @a theName parameter
107 ## to the functions creating objects, instead default names will be used. However, you
108 ## can always change the behavior, by passing explicit name to the @a theName parameter
109 ## and it will be used instead default one.
110 ## The publishing of the collections of objects will be done according to the above
111 ## mentioned rules (maximum allowed number of sub-shapes).
117 ## from salome.geom import geomBuilder
118 ## geompy = geomBuilder.New()
119 ## geompy.addToStudyAuto() # enable automatic publication
120 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100)
121 ## # the box is created and published in the study with default name
122 ## geompy.addToStudyAuto(5) # set max allowed number of sub-shapes to 5
123 ## vertices = geompy.SubShapeAll(box, geomBuilder.ShapeType['VERTEX'])
124 ## # only 5 first vertices will be published, with default names
125 ## print len(vertices)
126 ## # note, that result value still contains all 8 vertices
127 ## geompy.addToStudyAuto(-1) # disable automatic publication
130 ## This feature can be used, for example, for debugging purposes.
133 ## - Use automatic publication feature with caution. When it is enabled, any function of
134 ## \ref geomBuilder.geomBuilder "geomBuilder" class publishes the results in the study,
135 ## that can lead to the huge size of the study data tree.
136 ## For example, repeating call of \ref geomBuilder.geomBuilder.SubShapeAll() "SubShapeAll()"
137 ## command on the same main shape each time will publish all child objects, that will lead
138 ## to a lot of duplicated items in the study.
139 ## - Sub-shapes are automatically published as child items of the parent main shape in the study if main
140 ## shape was also published before. Otherwise, sub-shapes are published as top-level objects.
141 ## - Some functions of \ref geomBuilder.geomBuilder "geomBuilder" class do not have
142 ## \a theName parameter (and, thus, do not support automatic publication).
143 ## For example, some transformation operations like
144 ## \ref geomBuilder.geomBuilder.TranslateDXDYDZ() "TranslateDXDYDZ()".
145 ## Refer to the documentation to check if some function has such possibility.
147 ## It is possible to customize the representation of the geometrical
148 ## data in the data tree; this can be done by using folders. A folder can
149 ## be created in the study tree using function
150 ## \ref geomBuilder.geomBuilder.NewFolder() "NewFolder()"
151 ## (by default it is created under the "Geometry" root object).
152 ## As soon as folder is created, any published geometry object
153 ## can be moved into it.
159 ## from salome.geom import geomBuilder
160 ## geompy = geomBuilder.New()
161 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100, "Box")
162 ## # the box was created and published in the study
163 ## folder = geompy.NewFolder("Primitives")
164 ## # an empty "Primitives" folder was created under default "Geometry" root object
165 ## geompy.PutToFolder(box, folder)
166 ## # the box was moved into "Primitives" folder
169 ## Subfolders are also can be created by specifying another folder as a parent:
172 ## subfolder = geompy.NewFolder("3D", folder)
173 ## # "3D" folder was created under "Primitives" folder
177 ## - Folder container is just a representation layer object that
178 ## deals with already published objects only. So, any geometry object
179 ## should be published in the study (for example, with
180 ## \ref geomBuilder.geomBuilder.PutToFolder() "addToStudy()" function)
181 ## BEFORE moving it into any existing folder.
182 ## - \ref geomBuilder.geomBuilder.PutToFolder() "PutToFolder()" function
183 ## does not change physical position of geometry object in the study tree,
184 ## it only affects on the representation of the data tree.
185 ## - It is impossible to publish geometry object using any folder as father.
187 ## \defgroup l1_publish_data
188 ## \defgroup l1_geomBuilder_auxiliary
189 ## \defgroup l1_geomBuilder_purpose
192 ## @defgroup l1_publish_data Publishing results in SALOME study
194 ## @defgroup l1_geomBuilder_auxiliary Auxiliary data structures and methods
196 ## @defgroup l1_geomBuilder_purpose All package methods, grouped by their purpose
198 ## @defgroup l2_import_export Importing/exporting geometrical objects
199 ## @defgroup l2_creating Creating geometrical objects
201 ## @defgroup l3_basic_go Creating Basic Geometric Objects
203 ## @defgroup l4_curves Creating Curves
206 ## @defgroup l3_3d_primitives Creating 3D Primitives
207 ## @defgroup l3_complex Creating Complex Objects
208 ## @defgroup l3_groups Working with groups
209 ## @defgroup l3_blocks Building by blocks
211 ## @defgroup l4_blocks_measure Check and Improve
214 ## @defgroup l3_sketcher Sketcher
215 ## @defgroup l3_advanced Creating Advanced Geometrical Objects
217 ## @defgroup l4_decompose Decompose objects
218 ## @defgroup l4_decompose_d Decompose objects deprecated methods
219 ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
220 ## @defgroup l4_obtain Access to sub-shapes by a criteria
221 ## @defgroup l4_advanced Advanced objects creation functions
226 ## @defgroup l2_transforming Transforming geometrical objects
228 ## @defgroup l3_basic_op Basic Operations
229 ## @defgroup l3_boolean Boolean Operations
230 ## @defgroup l3_transform Transformation Operations
231 ## @defgroup l3_transform_d Transformation Operations deprecated methods
232 ## @defgroup l3_local Local Operations (Fillet, Chamfer and other Features)
233 ## @defgroup l3_blocks_op Blocks Operations
234 ## @defgroup l3_healing Repairing Operations
235 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of sub-shapes
238 ## @defgroup l2_measure Using measurement tools
239 ## @defgroup l2_field Field on Geometry
240 ## @defgroup l2_testing Testing
246 # initialize SALOME session in try/except block
247 # to avoid problems in some cases, e.g. when generating documentation
255 from salome_notebook import *
262 from salome.geom.gsketcher import Sketcher3D, Sketcher2D, Polyline2D
263 from salome.geom.canonicalrecognition import CanonicalRecognition
264 from salome.geom.conformity import CheckConformity
265 from salome.geom.proximity import ShapeProximity
267 # In case the omniORBpy EnumItem class does not fully support Python 3
268 # (for instance in version 4.2.1-2), the comparison ordering methods must be
272 GEOM.COMPOUND < GEOM.SOLID
274 def enumitem_eq(self, other):
276 if isinstance(other, omniORB.EnumItem):
277 if other._parent_id == self._parent_id:
278 return self._v == other._v
280 return self._parent_id == other._parent_id
282 return id(self) == id(other)
284 return id(self) == id(other)
286 def enumitem_lt(self, other):
288 if isinstance(other, omniORB.EnumItem):
289 if other._parent_id == self._parent_id:
290 return self._v < other._v
292 return self._parent_id < other._parent_id
294 return id(self) < id(other)
296 return id(self) < id(other)
298 def enumitem_le(self, other):
300 if isinstance(other, omniORB.EnumItem):
301 if other._parent_id == self._parent_id:
302 return self._v <= other._v
304 return self._parent_id <= other._parent_id
306 return id(self) <= id(other)
308 return id(self) <= id(other)
310 def enumitem_gt(self, other):
312 if isinstance(other, omniORB.EnumItem):
313 if other._parent_id == self._parent_id:
314 return self._v > other._v
316 return self._parent_id > other._parent_id
318 return id(self) > id(other)
320 return id(self) > id(other)
322 def enumitem_ge(self, other):
324 if isinstance(other, omniORB.EnumItem):
325 if other._parent_id == self._parent_id:
326 return self._v >= other._v
328 return self._parent_id >= other._parent_id
330 return id(self) >= id(other)
332 return id(self) >= id(other)
334 GEOM.omniORB.EnumItem.__eq__ = enumitem_eq
335 GEOM.omniORB.EnumItem.__lt__ = enumitem_lt
336 GEOM.omniORB.EnumItem.__le__ = enumitem_le
337 GEOM.omniORB.EnumItem.__gt__ = enumitem_gt
338 GEOM.omniORB.EnumItem.__ge__ = enumitem_ge
339 omniORB.EnumItem.__eq__ = enumitem_eq
340 omniORB.EnumItem.__lt__ = enumitem_lt
341 omniORB.EnumItem.__le__ = enumitem_le
342 omniORB.EnumItem.__gt__ = enumitem_gt
343 omniORB.EnumItem.__ge__ = enumitem_ge
346 def _toListOfNames(_names, _size=-1):
349 if type(_names) in [list, tuple]:
350 for i in _names: l.append(i)
353 if l and len(l) < _size:
354 for i in range(len(l), _size): l.append("%s_%d"%(l[0],i))
357 # Decorator function to manage transactions for all geometric operations.
358 def ManageTransactions(theOpeName):
359 def MTDecorator(theFunction):
360 # To keep the original function name an documentation.
361 @functools.wraps(theFunction)
362 def OpenCallClose(self, *args, **kwargs):
364 anOperation = getattr(self, theOpeName)
365 anOperation.StartOperation()
368 res = theFunction(self, *args, **kwargs)
370 anOperation.FinishOperation()
374 anOperation.AbortOperation()
379 ## Raise an Error, containing the Method_name, if Operation is Failed
380 ## @ingroup l1_geomBuilder_auxiliary
381 def RaiseIfFailed (Method_name, Operation):
382 if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
383 raise RuntimeError(Method_name + " : " + Operation.GetErrorCode())
385 def PrintOrRaise(message, raiseException=False):
387 raise RuntimeError(message)
391 ## Return list of variables value from salome notebook
392 ## @ingroup l1_geomBuilder_auxiliary
393 def ParseParameters(*parameters):
396 for parameter in parameters:
397 if isinstance(parameter, list):
398 lResults = ParseParameters(*parameter)
399 if len(lResults) > 0:
400 Result.append(lResults[:-1])
401 StringResult += lResults[-1].split(":")
405 if isinstance(parameter,str):
406 if notebook.isVariable(parameter):
407 Result.append(notebook.get(parameter))
409 raise RuntimeError("Variable with name '" + parameter + "' doesn't exist!!!")
412 Result.append(parameter)
414 StringResult.append(str(parameter))
418 Result.append(":".join(StringResult))
420 Result = ":".join(StringResult)
423 ## Return list of variables value from salome notebook
424 ## @ingroup l1_geomBuilder_auxiliary
428 for parameter in list:
429 if isinstance(parameter,str) and notebook.isVariable(parameter):
430 Result.append(str(notebook.get(parameter)))
433 Result.append(str(parameter))
436 StringResult = StringResult + str(parameter)
437 StringResult = StringResult + ":"
439 StringResult = StringResult[:len(StringResult)-1]
440 return Result, StringResult
442 ## Return list of variables value from salome notebook
443 ## @ingroup l1_geomBuilder_auxiliary
444 def ParseSketcherCommand(command):
447 sections = command.split(":")
448 for section in sections:
449 parameters = section.split(" ")
451 for parameter in parameters:
452 if paramIndex > 1 and parameter.find("'") != -1:
453 parameter = parameter.replace("'","")
454 if notebook.isVariable(parameter):
455 Result = Result + str(notebook.get(parameter)) + " "
458 raise RuntimeError("Variable with name '" + parameter + "' doesn't exist!!!")
462 Result = Result + str(parameter) + " "
465 StringResult = StringResult + parameter
466 StringResult = StringResult + ":"
468 paramIndex = paramIndex + 1
470 Result = Result[:len(Result)-1] + ":"
472 Result = Result[:len(Result)-1]
473 return Result, StringResult
475 ## Helper function which can be used to pack the passed string to the byte data.
476 ## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
477 ## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
480 ## val = PackData("10001110") # val = 0xAE
481 ## val = PackData("1") # val = 0x80
483 ## @param data unpacked data - a string containing '1' and '0' symbols
484 ## @return data packed to the byte stream
485 ## @ingroup l1_geomBuilder_auxiliary
488 Helper function which can be used to pack the passed string to the byte data.
489 Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
490 If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
493 data unpacked data - a string containing '1' and '0' symbols
496 data packed to the byte stream
499 val = PackData("10001110") # val = 0xAE
500 val = PackData("1") # val = 0x80
503 if len(data)%8: bytes += 1
505 for b in range(bytes):
506 d = data[b*8:(b+1)*8]
511 if d[i] == "1": val += 1
513 raise "Invalid symbol %s" % d[i]
520 ## Read bitmap texture from the text file.
521 ## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
522 ## A zero symbol ('0') represents transparent pixel of the texture bitmap.
523 ## The function returns width and height of the pixmap in pixels and byte stream representing
524 ## texture bitmap itself.
526 ## This function can be used to read the texture to the byte stream in order to pass it to
527 ## the AddTexture() function of geomBuilder class.
530 ## from salome.geom import geomBuilder
531 ## geompy = geomBuilder.New()
532 ## texture = geompy.readtexture('mytexture.dat')
533 ## texture = geompy.AddTexture(*texture)
534 ## obj.SetMarkerTexture(texture)
536 ## @param fname texture file name
537 ## @return sequence of tree values: texture's width, height in pixels and its byte stream
538 ## @ingroup l1_geomBuilder_auxiliary
539 def ReadTexture(fname):
541 Read bitmap texture from the text file.
542 In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
543 A zero symbol ('0') represents transparent pixel of the texture bitmap.
544 The function returns width and height of the pixmap in pixels and byte stream representing
545 texture bitmap itself.
546 This function can be used to read the texture to the byte stream in order to pass it to
547 the AddTexture() function of geomBuilder class.
550 fname texture file name
553 sequence of tree values: texture's width, height in pixels and its byte stream
556 from salome.geom import geomBuilder
557 geompy = geomBuilder.New()
558 texture = geompy.readtexture('mytexture.dat')
559 texture = geompy.AddTexture(*texture)
560 obj.SetMarkerTexture(texture)
564 lines = [ l.strip() for l in f.readlines()]
567 if lines: maxlen = max([len(x) for x in lines])
569 if maxlen%8: lenbytes += 1
573 lenline = (len(line)/8+1)*8
576 lenline = (len(line)/8)*8
578 for i in range(lenline/8):
581 if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
584 bytedata += PackData(byte)
586 for i in range(lenline/8, lenbytes):
587 bytedata += PackData("0")
589 return lenbytes*8, len(lines), bytedata
594 ## Returns a long value from enumeration type
595 # Can be used for CORBA enumerator types like GEOM.shape_type
596 # @param theItem enumeration type
597 # @ingroup l1_geomBuilder_auxiliary
598 def EnumToLong(theItem):
600 Returns a long value from enumeration type
601 Can be used for CORBA enumerator types like geomBuilder.ShapeType
604 theItem enumeration type
607 if hasattr(theItem, "_v"): ret = theItem._v
610 ## Pack an argument into a list
612 if isinstance( arg, list ):
614 if hasattr( arg, "__getitem__" ):
618 ## Information about closed/unclosed state of shell or wire
619 # @ingroup l1_geomBuilder_auxiliary
622 Information about closed/unclosed state of shell or wire
628 ## Private class used to bind calls of plugin operations to geomBuilder
629 class PluginOperation:
630 def __init__(self, operation, function):
631 self.operation = operation
632 self.function = function
635 @ManageTransactions("operation")
636 def __call__(self, *args):
637 res = self.function(self.operation, *args)
638 RaiseIfFailed(self.function.__name__, self.operation)
641 # Warning: geom is a singleton
647 class geomBuilder(GEOM._objref_GEOM_Gen):
649 ## Enumeration ShapeType as a dictionary. \n
650 ## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details.
651 # @ingroup l1_geomBuilder_auxiliary
652 ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8, "FLAT":9}
654 ## Kinds of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
655 # and a list of parameters, describing the shape.
656 # List of parameters, describing the shape:
657 # - COMPOUND: [nb_solids nb_faces nb_edges nb_vertices]
658 # - COMPSOLID: [nb_solids nb_faces nb_edges nb_vertices]
660 # - SHELL: [info.CLOSED / info.UNCLOSED nb_faces nb_edges nb_vertices]
662 # - WIRE: [info.CLOSED / info.UNCLOSED nb_edges nb_vertices]
664 # - SPHERE: [xc yc zc R]
665 # - CYLINDER: [xb yb zb dx dy dz R H]
666 # - BOX: [xc yc zc ax ay az]
667 # - ROTATED_BOX: [xc yc zc zx zy zz xx xy xz ax ay az]
668 # - TORUS: [xc yc zc dx dy dz R_1 R_2]
669 # - CONE: [xb yb zb dx dy dz R_1 R_2 H]
670 # - POLYHEDRON: [nb_faces nb_edges nb_vertices]
671 # - SOLID: [nb_faces nb_edges nb_vertices]
673 # - SPHERE2D: [xc yc zc R]
674 # - CYLINDER2D: [xb yb zb dx dy dz R H]
675 # - TORUS2D: [xc yc zc dx dy dz R_1 R_2]
676 # - CONE2D: [xc yc zc dx dy dz R_1 R_2 H]
677 # - DISK_CIRCLE: [xc yc zc dx dy dz R]
678 # - DISK_ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
679 # - POLYGON: [xo yo zo dx dy dz nb_edges nb_vertices]
680 # - PLANE: [xo yo zo dx dy dz]
681 # - PLANAR: [xo yo zo dx dy dz nb_edges nb_vertices]
682 # - FACE: [nb_edges nb_vertices]
684 # - CIRCLE: [xc yc zc dx dy dz R]
685 # - ARC_CIRCLE: [xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2]
686 # - ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
687 # - ARC_ELLIPSE: [xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2]
688 # - LINE: [xo yo zo dx dy dz]
689 # - SEGMENT: [x1 y1 z1 x2 y2 z2]
690 # - EDGE: [nb_vertices]
694 # - LCS: [x y z xx xy xz yx yy yz zx zy zz]
695 # @ingroup l1_geomBuilder_auxiliary
696 kind = GEOM.GEOM_IKindOfShape
698 def __new__(cls, *args):
703 #print "==== __new__ ", engine, geom, doLcc, created
705 # geom engine is either retrieved from engine, or created
707 # Following test avoids a recursive loop
710 # geom engine not created: existing engine found
712 if doLcc and not created:
714 # FindOrLoadComponent called:
715 # 1. CORBA resolution of server
716 # 2. the __new__ method is called again
717 #print "==== FindOrLoadComponent ", engine, geom, doLcc, created
718 geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" )
721 # FindOrLoadComponent not called
723 # geomBuilder instance is created from lcc.FindOrLoadComponent
724 #print "==== super ", engine, geom, doLcc, created
725 geom = super(geomBuilder,cls).__new__(cls)
728 # geom engine not created: existing engine found
729 #print "==== existing ", engine, geom, doLcc, created
731 #print "return geom 1 ", geom
734 #print "return geom 2 ", geom
737 def __init__(self, *args):
739 #print "-------- geomBuilder __init__ --- ", created, self
742 GEOM._objref_GEOM_Gen.__init__(self, *args)
743 self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
744 self.myBuilder = None
761 ## Process object publication in the study, as follows:
762 # - if @a theName is specified (not None), the object is published in the study
763 # with this name, not taking into account "auto-publishing" option;
764 # - if @a theName is NOT specified, the object is published in the study
765 # (using default name, which can be customized using @a theDefaultName parameter)
766 # only if auto-publishing is switched on.
768 # @param theObj object, a subject for publishing
769 # @param theName object name for study
770 # @param theDefaultName default name for the auto-publishing
772 # @sa addToStudyAuto()
773 def _autoPublish(self, theObj, theName, theDefaultName="noname"):
775 def _item_name(_names, _defname, _idx=-1):
776 if not _names: _names = _defname
777 if type(_names) in [list, tuple]:
779 if _idx >= len(_names) or not _names[_idx]:
780 if type(_defname) not in [list, tuple]:
781 _name = "%s_%d"%(_defname, _idx+1)
782 elif len(_defname) > 0 and _idx >= 0 and _idx < len(_defname):
783 _name = _defname[_idx]
785 _name = "%noname_%d"%(dn, _idx+1)
791 # must be wrong usage
796 _name = "%s_%d"%(_names, _idx+1)
802 def _publish( _name, _obj ):
804 if isinstance( _obj, GEOM._objref_GEOM_Field ):
805 fatherObj = _obj.GetShape()
806 elif isinstance( _obj, GEOM._objref_GEOM_FieldStep ):
807 fatherObj = _obj.GetField()
808 elif not _obj.IsMainShape():
809 fatherObj = _obj.GetMainShape()
811 if fatherObj and fatherObj.GetStudyEntry():
812 self.addToStudyInFather(fatherObj, _obj, _name)
814 self.addToStudy(_obj, _name)
820 if not theName and not self.myMaxNbSubShapesAllowed:
821 return # nothing to do: auto-publishing is disabled
822 if not theName and not theDefaultName:
823 return # neither theName nor theDefaultName is given
825 if type(theObj) in [list, tuple]:
826 # list of objects is being published
829 if not obj: continue # bad object
830 name = _item_name(theName, theDefaultName, idx)
831 _publish( name, obj )
833 if not theName and idx == self.myMaxNbSubShapesAllowed: break
837 # single object is published
838 name = _item_name(theName, theDefaultName)
839 _publish( name, theObj )
842 ## @addtogroup l1_geomBuilder_auxiliary
845 self.myStudy = salome.myStudy
846 self.myBuilder = self.myStudy.NewBuilder()
848 # load data from the study file, if necessary
849 component = self.myStudy.FindComponent("GEOM")
851 self.myBuilder.LoadWith(component, self)
853 self.BasicOp = self.GetIBasicOperations ()
854 self.CurvesOp = self.GetICurvesOperations ()
855 self.PrimOp = self.GetI3DPrimOperations ()
856 self.ShapesOp = self.GetIShapesOperations ()
857 self.HealOp = self.GetIHealingOperations ()
858 self.InsertOp = self.GetIInsertOperations ()
859 self.BoolOp = self.GetIBooleanOperations ()
860 self.TrsfOp = self.GetITransformOperations()
861 self.LocalOp = self.GetILocalOperations ()
862 self.MeasuOp = self.GetIMeasureOperations ()
863 self.BlocksOp = self.GetIBlocksOperations ()
864 self.GroupOp = self.GetIGroupOperations ()
865 self.FieldOp = self.GetIFieldOperations ()
866 self.TestOp = self.GetITestOperations ()
868 notebook.myStudy = self.myStudy
871 def GetPluginOperations(self, libraryName):
872 op = GEOM._objref_GEOM_Gen.GetPluginOperations(self, libraryName)
875 ## Enable / disable results auto-publishing
877 # The automatic publishing is managed in the following way:
878 # - if @a maxNbSubShapes = 0, automatic publishing is disabled.
879 # - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
880 # maximum number of sub-shapes allowed for publishing is unlimited; any negative
881 # value passed as parameter has the same effect.
882 # - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
883 # maximum number of sub-shapes allowed for publishing is set to specified value.
885 # @param maxNbSubShapes maximum number of sub-shapes allowed for publishing.
886 # @ingroup l1_publish_data
887 def addToStudyAuto(self, maxNbSubShapes=-1):
889 Enable / disable results auto-publishing
891 The automatic publishing is managed in the following way:
892 - if @a maxNbSubShapes = 0, automatic publishing is disabled;
893 - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
894 maximum number of sub-shapes allowed for publishing is unlimited; any negative
895 value passed as parameter has the same effect.
896 - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
897 maximum number of sub-shapes allowed for publishing is set to this value.
900 maxNbSubShapes maximum number of sub-shapes allowed for publishing.
903 geompy.addToStudyAuto() # enable auto-publishing
904 geompy.MakeBoxDXDYDZ(100) # box is created and published with default name
905 geompy.addToStudyAuto(0) # disable auto-publishing
907 self.myMaxNbSubShapesAllowed = max(-1, maxNbSubShapes)
910 ## Dump component to the Python script
911 # This method overrides IDL function to allow default values for the parameters.
912 def DumpPython(self, theIsPublished=True, theIsMultiFile=True):
914 Dump component to the Python script
915 This method overrides IDL function to allow default values for the parameters.
917 return GEOM._objref_GEOM_Gen.DumpPython(self, theIsPublished, theIsMultiFile)
919 ## Get name for sub-shape aSubObj of shape aMainObj
921 # @ref swig_SubShapeName "Example"
922 @ManageTransactions("ShapesOp")
923 def SubShapeName(self,aSubObj, aMainObj):
925 Get name for sub-shape aSubObj of shape aMainObj
927 # Example: see GEOM_TestAll.py
929 #aSubId = orb.object_to_string(aSubObj)
930 #aMainId = orb.object_to_string(aMainObj)
931 #index = gg.getIndexTopology(aSubId, aMainId)
932 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
933 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
934 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
937 ## Publish in study aShape with name aName
939 # \param aShape the shape to be published
940 # \param aName the name for the shape
941 # \param doRestoreSubShapes if True, finds and publishes also
942 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
943 # and published sub-shapes of arguments
944 # \param theArgs,theFindMethod,theInheritFirstArg see RestoreSubShapes() for
945 # these arguments description
946 # \return study entry of the published shape in form of string
948 # @ingroup l1_publish_data
949 # @ref swig_all_addtostudy "Example"
950 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
951 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
953 Publish in study aShape with name aName
956 aShape the shape to be published
957 aName the name for the shape
958 doRestoreSubShapes if True, finds and publishes also
959 sub-shapes of aShape, corresponding to its arguments
960 and published sub-shapes of arguments
961 theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes() for
962 these arguments description
965 study entry of the published shape in form of string
968 id_block1 = geompy.addToStudy(Block1, "Block 1")
970 # Example: see GEOM_TestAll.py
972 aSObject = self.AddInStudy(aShape, aName, None)
973 if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
974 if doRestoreSubShapes:
975 self.RestoreSubShapesSO(aSObject, theArgs,
976 theFindMethod, theInheritFirstArg, True )
978 print("addToStudy() failed")
980 return aShape.GetStudyEntry()
982 ## Publish in study aShape with name aName as sub-object of previously published aFather
983 # \param aFather previously published object
984 # \param aShape the shape to be published as sub-object of <VAR>aFather</VAR>
985 # \param aName the name for the shape
987 # \return study entry of the published shape in form of string
989 # @ingroup l1_publish_data
990 # @ref swig_all_addtostudyInFather "Example"
991 def addToStudyInFather(self, aFather, aShape, aName):
993 Publish in study aShape with name aName as sub-object of previously published aFather
996 aFather previously published object
997 aShape the shape to be published as sub-object of aFather
998 aName the name for the shape
1001 study entry of the published shape in form of string
1003 # Example: see GEOM_TestAll.py
1005 aSObject = self.AddInStudy(aShape, aName, aFather)
1006 if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
1008 print("addToStudyInFather() failed")
1010 return aShape.GetStudyEntry()
1012 ## Unpublish object in study
1014 # \param obj the object to be unpublished
1015 def hideInStudy(self, obj):
1017 Unpublish object in study
1020 obj the object to be unpublished
1022 ior = salome.orb.object_to_string(obj)
1023 aSObject = self.myStudy.FindObjectIOR(ior)
1024 if aSObject is not None:
1025 genericAttribute = self.myBuilder.FindOrCreateAttribute(aSObject, "AttributeDrawable")
1026 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
1027 drwAttribute.SetDrawable(False)
1028 # hide references if any
1029 vso = self.myStudy.FindDependances(aSObject);
1031 genericAttribute = self.myBuilder.FindOrCreateAttribute(refObj, "AttributeDrawable")
1032 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
1033 drwAttribute.SetDrawable(False)
1037 # end of l1_geomBuilder_auxiliary
1040 ## @addtogroup l3_restore_ss
1043 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
1044 # To be used from python scripts out of addToStudy() (non-default usage)
1045 # \param theObject published GEOM.GEOM_Object, arguments of which will be published
1046 # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1047 # If this list is empty, all operation arguments will be published
1048 # \param theFindMethod method to search sub-shapes, corresponding to arguments and
1049 # their sub-shapes. Value from enumeration GEOM.find_shape_method.
1050 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
1051 # Do not publish sub-shapes in place of arguments, but only
1052 # in place of sub-shapes of the first argument,
1053 # because the whole shape corresponds to the first argument.
1054 # Mainly to be used after transformations, but it also can be
1055 # useful after partition with one object shape, and some other
1056 # operations, where only the first argument has to be considered.
1057 # If theObject has only one argument shape, this flag is automatically
1058 # considered as True, not regarding really passed value.
1059 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
1060 # and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1061 # \return list of published sub-shapes
1063 # @ref tui_restore_prs_params "Example"
1064 def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
1065 theInheritFirstArg=False, theAddPrefix=True):
1067 Publish sub-shapes, standing for arguments and sub-shapes of arguments
1068 To be used from python scripts out of geompy.addToStudy (non-default usage)
1071 theObject published GEOM.GEOM_Object, arguments of which will be published
1072 theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1073 If this list is empty, all operation arguments will be published
1074 theFindMethod method to search sub-shapes, corresponding to arguments and
1075 their sub-shapes. Value from enumeration GEOM.find_shape_method.
1076 theInheritFirstArg set properties of the first argument for theObject.
1077 Do not publish sub-shapes in place of arguments, but only
1078 in place of sub-shapes of the first argument,
1079 because the whole shape corresponds to the first argument.
1080 Mainly to be used after transformations, but it also can be
1081 useful after partition with one object shape, and some other
1082 operations, where only the first argument has to be considered.
1083 If theObject has only one argument shape, this flag is automatically
1084 considered as True, not regarding really passed value.
1085 theAddPrefix add prefix "from_" to names of restored sub-shapes,
1086 and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1088 list of published sub-shapes
1090 # Example: see GEOM_TestAll.py
1091 return self.RestoreSubShapesO(theObject, theArgs,
1092 theFindMethod, theInheritFirstArg, theAddPrefix)
1094 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
1095 # To be used from python scripts out of addToStudy() (non-default usage)
1096 # \param theObject published GEOM.GEOM_Object, arguments of which will be published
1097 # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1098 # If this list is empty, all operation arguments will be published
1099 # \param theFindMethod method to search sub-shapes, corresponding to arguments and
1100 # their sub-shapes. Value from enumeration GEOM::find_shape_method.
1101 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
1102 # Do not publish sub-shapes in place of arguments, but only
1103 # in place of sub-shapes of the first argument,
1104 # because the whole shape corresponds to the first argument.
1105 # Mainly to be used after transformations, but it also can be
1106 # useful after partition with one object shape, and some other
1107 # operations, where only the first argument has to be considered.
1108 # If theObject has only one argument shape, this flag is automatically
1109 # considered as True, not regarding really passed value.
1110 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
1111 # and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1112 # \return list of published sub-shapes
1114 # @ref tui_restore_prs_params "Example"
1115 def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
1116 theInheritFirstArg=False, theAddPrefix=True):
1118 Publish sub-shapes, standing for arguments and sub-shapes of arguments
1119 To be used from python scripts out of geompy.addToStudy() (non-default usage)
1122 theObject published GEOM.GEOM_Object, arguments of which will be published
1123 theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1124 If this list is empty, all operation arguments will be published
1125 theFindMethod method to search sub-shapes, corresponding to arguments and
1126 their sub-shapes. Value from enumeration GEOM::find_shape_method.
1127 theInheritFirstArg set properties of the first argument for theObject.
1128 Do not publish sub-shapes in place of arguments, but only
1129 in place of sub-shapes of the first argument,
1130 because the whole shape corresponds to the first argument.
1131 Mainly to be used after transformations, but it also can be
1132 useful after partition with one object shape, and some other
1133 operations, where only the first argument has to be considered.
1134 If theObject has only one argument shape, this flag is automatically
1135 considered as True, not regarding really passed value.
1136 theAddPrefix add prefix "from_" to names of restored sub-shapes,
1137 and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1140 list of published sub-shapes
1142 # Example: see GEOM_TestAll.py
1143 return self.RestoreGivenSubShapesO(theObject, theArgs,
1144 theFindMethod, theInheritFirstArg, theAddPrefix)
1146 # end of l3_restore_ss
1149 ## @addtogroup l3_basic_go
1152 ## Create point by three coordinates.
1153 # @param theX The X coordinate of the point.
1154 # @param theY The Y coordinate of the point.
1155 # @param theZ The Z coordinate of the point.
1156 # @param theName Object name; when specified, this parameter is used
1157 # for result publication in the study. Otherwise, if automatic
1158 # publication is switched on, default value is used for result name.
1160 # @return New GEOM.GEOM_Object, containing the created point.
1162 # @ref tui_creation_point "Example"
1163 @ManageTransactions("BasicOp")
1164 def MakeVertex(self, theX, theY, theZ, theName=None):
1166 Create point by three coordinates.
1169 theX The X coordinate of the point.
1170 theY The Y coordinate of the point.
1171 theZ The Z coordinate of the point.
1172 theName Object name; when specified, this parameter is used
1173 for result publication in the study. Otherwise, if automatic
1174 publication is switched on, default value is used for result name.
1177 New GEOM.GEOM_Object, containing the created point.
1179 # Example: see GEOM_TestAll.py
1180 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
1181 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
1182 RaiseIfFailed("MakePointXYZ", self.BasicOp)
1183 anObj.SetParameters(Parameters)
1184 self._autoPublish(anObj, theName, "vertex")
1187 ## Create a point, distant from the referenced point
1188 # on the given distances along the coordinate axes.
1189 # @param theReference The referenced point.
1190 # @param theX Displacement from the referenced point along OX axis.
1191 # @param theY Displacement from the referenced point along OY axis.
1192 # @param theZ Displacement from the referenced point along OZ axis.
1193 # @param theName Object name; when specified, this parameter is used
1194 # for result publication in the study. Otherwise, if automatic
1195 # publication is switched on, default value is used for result name.
1197 # @return New GEOM.GEOM_Object, containing the created point.
1199 # @ref tui_creation_point "Example"
1200 @ManageTransactions("BasicOp")
1201 def MakeVertexWithRef(self, theReference, theX, theY, theZ, theName=None):
1203 Create a point, distant from the referenced point
1204 on the given distances along the coordinate axes.
1207 theReference The referenced point.
1208 theX Displacement from the referenced point along OX axis.
1209 theY Displacement from the referenced point along OY axis.
1210 theZ Displacement from the referenced point along OZ axis.
1211 theName Object name; when specified, this parameter is used
1212 for result publication in the study. Otherwise, if automatic
1213 publication is switched on, default value is used for result name.
1216 New GEOM.GEOM_Object, containing the created point.
1218 # Example: see GEOM_TestAll.py
1219 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
1220 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
1221 RaiseIfFailed("MakePointWithReference", self.BasicOp)
1222 anObj.SetParameters(Parameters)
1223 self._autoPublish(anObj, theName, "vertex")
1226 ## Create a point, corresponding to the given parameter on the given curve.
1227 # @param theRefCurve The referenced curve.
1228 # @param theParameter Value of parameter on the referenced curve.
1229 # @param takeOrientationIntoAccount flag that tells if it is necessary
1230 # to take the curve's orientation into account for the
1231 # operation. I.e. if this flag is set, the results for the same
1232 # parameters (except the value 0.5) is different for forward
1233 # and reversed curves. If it is not set the result is the same.
1234 # @param theName Object name; when specified, this parameter is used
1235 # for result publication in the study. Otherwise, if automatic
1236 # publication is switched on, default value is used for result name.
1238 # @return New GEOM.GEOM_Object, containing the created point.
1240 # @ref tui_creation_point "Example"
1241 @ManageTransactions("BasicOp")
1242 def MakeVertexOnCurve(self, theRefCurve, theParameter,
1243 takeOrientationIntoAccount=False, theName=None):
1245 Create a point, corresponding to the given parameter on the given curve.
1248 theRefCurve The referenced curve.
1249 theParameter Value of parameter on the referenced curve.
1250 takeOrientationIntoAccount flag that tells if it is necessary
1251 to take the curve's orientation into account for the
1252 operation. I.e. if this flag is set, the results for
1253 the same parameters (except the value 0.5) is different
1254 for forward and reversed curves. If it is not set
1255 the result is the same.
1256 theName Object name; when specified, this parameter is used
1257 for result publication in the study. Otherwise, if automatic
1258 publication is switched on, default value is used for result name.
1261 New GEOM.GEOM_Object, containing the created point.
1264 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
1266 # Example: see GEOM_TestAll.py
1267 theParameter, takeOrientationIntoAccount, Parameters = ParseParameters(
1268 theParameter, takeOrientationIntoAccount)
1269 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter,
1270 takeOrientationIntoAccount)
1271 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
1272 anObj.SetParameters(Parameters)
1273 self._autoPublish(anObj, theName, "vertex")
1276 ## Create a point by projection give coordinates on the given curve
1277 # @param theRefCurve The referenced curve.
1278 # @param theX X-coordinate in 3D space
1279 # @param theY Y-coordinate in 3D space
1280 # @param theZ Z-coordinate in 3D space
1281 # @param theName Object name; when specified, this parameter is used
1282 # for result publication in the study. Otherwise, if automatic
1283 # publication is switched on, default value is used for result name.
1285 # @return New GEOM.GEOM_Object, containing the created point.
1287 # @ref tui_creation_point "Example"
1288 @ManageTransactions("BasicOp")
1289 def MakeVertexOnCurveByCoord(self, theRefCurve, theX, theY, theZ, theName=None):
1291 Create a point by projection give coordinates on the given curve
1294 theRefCurve The referenced curve.
1295 theX X-coordinate in 3D space
1296 theY Y-coordinate in 3D space
1297 theZ Z-coordinate in 3D space
1298 theName Object name; when specified, this parameter is used
1299 for result publication in the study. Otherwise, if automatic
1300 publication is switched on, default value is used for result name.
1303 New GEOM.GEOM_Object, containing the created point.
1306 p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
1308 # Example: see GEOM_TestAll.py
1309 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
1310 anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
1311 RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
1312 anObj.SetParameters(Parameters)
1313 self._autoPublish(anObj, theName, "vertex")
1316 ## Create a point, corresponding to the given length on the given curve.
1317 # @param theRefCurve The referenced curve.
1318 # @param theLength Length on the referenced curve. It can be negative.
1319 # @param theStartPoint Point allowing to choose the direction for the calculation
1320 # of the length. If None, start from the first point of theRefCurve.
1321 # @param theName Object name; when specified, this parameter is used
1322 # for result publication in the study. Otherwise, if automatic
1323 # publication is switched on, default value is used for result name.
1325 # @return New GEOM.GEOM_Object, containing the created point.
1327 # @ref tui_creation_point "Example"
1328 @ManageTransactions("BasicOp")
1329 def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
1331 Create a point, corresponding to the given length on the given curve.
1334 theRefCurve The referenced curve.
1335 theLength Length on the referenced curve. It can be negative.
1336 theStartPoint Point allowing to choose the direction for the calculation
1337 of the length. If None, start from the first point of theRefCurve.
1338 theName Object name; when specified, this parameter is used
1339 for result publication in the study. Otherwise, if automatic
1340 publication is switched on, default value is used for result name.
1343 New GEOM.GEOM_Object, containing the created point.
1345 # Example: see GEOM_TestAll.py
1346 theLength, Parameters = ParseParameters(theLength)
1347 anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
1348 RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
1349 anObj.SetParameters(Parameters)
1350 self._autoPublish(anObj, theName, "vertex")
1353 ## Create a point, corresponding to the given parameters on the
1355 # @param theRefSurf The referenced surface.
1356 # @param theUParameter Value of U-parameter on the referenced surface.
1357 # @param theVParameter Value of V-parameter on the referenced surface.
1358 # @param theName Object name; when specified, this parameter is used
1359 # for result publication in the study. Otherwise, if automatic
1360 # publication is switched on, default value is used for result name.
1362 # @return New GEOM.GEOM_Object, containing the created point.
1364 # @ref swig_MakeVertexOnSurface "Example"
1365 @ManageTransactions("BasicOp")
1366 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter, theName=None):
1368 Create a point, corresponding to the given parameters on the
1372 theRefSurf The referenced surface.
1373 theUParameter Value of U-parameter on the referenced surface.
1374 theVParameter Value of V-parameter on the referenced surface.
1375 theName Object name; when specified, this parameter is used
1376 for result publication in the study. Otherwise, if automatic
1377 publication is switched on, default value is used for result name.
1380 New GEOM.GEOM_Object, containing the created point.
1383 p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8)
1385 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
1386 # Example: see GEOM_TestAll.py
1387 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
1388 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
1389 anObj.SetParameters(Parameters);
1390 self._autoPublish(anObj, theName, "vertex")
1393 ## Create a point by projection give coordinates on the given surface
1394 # @param theRefSurf The referenced surface.
1395 # @param theX X-coordinate in 3D space
1396 # @param theY Y-coordinate in 3D space
1397 # @param theZ Z-coordinate in 3D space
1398 # @param theName Object name; when specified, this parameter is used
1399 # for result publication in the study. Otherwise, if automatic
1400 # publication is switched on, default value is used for result name.
1402 # @return New GEOM.GEOM_Object, containing the created point.
1404 # @ref swig_MakeVertexOnSurfaceByCoord "Example"
1405 @ManageTransactions("BasicOp")
1406 def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ, theName=None):
1408 Create a point by projection give coordinates on the given surface
1411 theRefSurf The referenced surface.
1412 theX X-coordinate in 3D space
1413 theY Y-coordinate in 3D space
1414 theZ Z-coordinate in 3D space
1415 theName Object name; when specified, this parameter is used
1416 for result publication in the study. Otherwise, if automatic
1417 publication is switched on, default value is used for result name.
1420 New GEOM.GEOM_Object, containing the created point.
1423 p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.)
1425 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
1426 # Example: see GEOM_TestAll.py
1427 anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
1428 RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
1429 anObj.SetParameters(Parameters);
1430 self._autoPublish(anObj, theName, "vertex")
1433 ## Create a point, which lays on the given face.
1434 # The point will lay in arbitrary place of the face.
1435 # The only condition on it is a non-zero distance to the face boundary.
1436 # Such point can be used to uniquely identify the face inside any
1437 # shape in case, when the shape does not contain overlapped faces.
1438 # @param theFace The referenced face.
1439 # @param theName Object name; when specified, this parameter is used
1440 # for result publication in the study. Otherwise, if automatic
1441 # publication is switched on, default value is used for result name.
1443 # @return New GEOM.GEOM_Object, containing the created point.
1445 # @ref swig_MakeVertexInsideFace "Example"
1446 @ManageTransactions("BasicOp")
1447 def MakeVertexInsideFace (self, theFace, theNumberOfPnts=1, theName=None):
1449 Create a point, which lays on the given face.
1450 The point will lay in arbitrary place of the face.
1451 The only condition on it is a non-zero distance to the face boundary.
1452 Such point can be used to uniquely identify the face inside any
1453 shape in case, when the shape does not contain overlapped faces.
1456 theFace The referenced face.
1457 theNumberOfPnts The number of points we want to get, 1 by default.
1458 theName Object name; when specified, this parameter is used
1459 for result publication in the study. Otherwise, if automatic
1460 publication is switched on, default value is used for result name.
1463 New GEOM.GEOM_Object, containing the created point.
1466 p_on_face = geompy.MakeVertexInsideFace(Face)
1468 # Example: see GEOM_TestAll.py
1469 anObj = self.BasicOp.MakePointOnFace(theFace, theNumberOfPnts)
1470 RaiseIfFailed("MakeVertexInsideFace", self.BasicOp)
1471 self._autoPublish(anObj, theName, "vertex")
1474 ## Create a point on intersection of two lines.
1475 # @param theRefLine1, theRefLine2 The referenced lines.
1476 # @param theName Object name; when specified, this parameter is used
1477 # for result publication in the study. Otherwise, if automatic
1478 # publication is switched on, default value is used for result name.
1480 # @return New GEOM.GEOM_Object, containing the created point.
1482 # @ref swig_MakeVertexOnLinesIntersection "Example"
1483 @ManageTransactions("BasicOp")
1484 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2, theName=None):
1486 Create a point on intersection of two lines.
1489 theRefLine1, theRefLine2 The referenced lines.
1490 theName Object name; when specified, this parameter is used
1491 for result publication in the study. Otherwise, if automatic
1492 publication is switched on, default value is used for result name.
1495 New GEOM.GEOM_Object, containing the created point.
1497 # Example: see GEOM_TestAll.py
1498 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
1499 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
1500 self._autoPublish(anObj, theName, "vertex")
1503 ## Create a tangent, corresponding to the given parameter on the given curve.
1504 # @param theRefCurve The referenced curve.
1505 # @param theParameter Value of parameter on the referenced curve.
1506 # @param theName Object name; when specified, this parameter is used
1507 # for result publication in the study. Otherwise, if automatic
1508 # publication is switched on, default value is used for result name.
1510 # @return New GEOM.GEOM_Object, containing the created tangent.
1512 # @ref swig_MakeTangentOnCurve "Example"
1513 @ManageTransactions("BasicOp")
1514 def MakeTangentOnCurve(self, theRefCurve, theParameter, theName=None):
1516 Create a tangent, corresponding to the given parameter on the given curve.
1519 theRefCurve The referenced curve.
1520 theParameter Value of parameter on the referenced curve.
1521 theName Object name; when specified, this parameter is used
1522 for result publication in the study. Otherwise, if automatic
1523 publication is switched on, default value is used for result name.
1526 New GEOM.GEOM_Object, containing the created tangent.
1529 tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7)
1531 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
1532 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
1533 self._autoPublish(anObj, theName, "tangent")
1536 ## Create a tangent plane, corresponding to the given parameter on the given face.
1537 # @param theFace The face for which tangent plane should be built.
1538 # @param theParameterV vertical value of the center point (0.0 - 1.0).
1539 # @param theParameterU horisontal value of the center point (0.0 - 1.0).
1540 # @param theTrimSize the size of plane.
1541 # @param theName Object name; when specified, this parameter is used
1542 # for result publication in the study. Otherwise, if automatic
1543 # publication is switched on, default value is used for result name.
1545 # @return New GEOM.GEOM_Object, containing the created tangent.
1547 # @ref swig_MakeTangentPlaneOnFace "Example"
1548 @ManageTransactions("BasicOp")
1549 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize, theName=None):
1551 Create a tangent plane, corresponding to the given parameter on the given face.
1554 theFace The face for which tangent plane should be built.
1555 theParameterV vertical value of the center point (0.0 - 1.0).
1556 theParameterU horisontal value of the center point (0.0 - 1.0).
1557 theTrimSize the size of plane.
1558 theName Object name; when specified, this parameter is used
1559 for result publication in the study. Otherwise, if automatic
1560 publication is switched on, default value is used for result name.
1563 New GEOM.GEOM_Object, containing the created tangent.
1566 an_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
1568 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
1569 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
1570 self._autoPublish(anObj, theName, "tangent")
1573 ## Create a vector with the given components.
1574 # @param theDX X component of the vector.
1575 # @param theDY Y component of the vector.
1576 # @param theDZ Z component of the vector.
1577 # @param theName Object name; when specified, this parameter is used
1578 # for result publication in the study. Otherwise, if automatic
1579 # publication is switched on, default value is used for result name.
1581 # @return New GEOM.GEOM_Object, containing the created vector.
1583 # @ref tui_creation_vector "Example"
1584 @ManageTransactions("BasicOp")
1585 def MakeVectorDXDYDZ(self, theDX, theDY, theDZ, theName=None):
1587 Create a vector with the given components.
1590 theDX X component of the vector.
1591 theDY Y component of the vector.
1592 theDZ Z component of the vector.
1593 theName Object name; when specified, this parameter is used
1594 for result publication in the study. Otherwise, if automatic
1595 publication is switched on, default value is used for result name.
1598 New GEOM.GEOM_Object, containing the created vector.
1600 # Example: see GEOM_TestAll.py
1601 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1602 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
1603 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
1604 anObj.SetParameters(Parameters)
1605 self._autoPublish(anObj, theName, "vector")
1608 ## Create a vector between two points.
1609 # @param thePnt1 Start point for the vector.
1610 # @param thePnt2 End point for the vector.
1611 # @param theName Object name; when specified, this parameter is used
1612 # for result publication in the study. Otherwise, if automatic
1613 # publication is switched on, default value is used for result name.
1615 # @return New GEOM.GEOM_Object, containing the created vector.
1617 # @ref tui_creation_vector "Example"
1618 @ManageTransactions("BasicOp")
1619 def MakeVector(self, thePnt1, thePnt2, theName=None):
1621 Create a vector between two points.
1624 thePnt1 Start point for the vector.
1625 thePnt2 End point for the vector.
1626 theName Object name; when specified, this parameter is used
1627 for result publication in the study. Otherwise, if automatic
1628 publication is switched on, default value is used for result name.
1631 New GEOM.GEOM_Object, containing the created vector.
1633 # Example: see GEOM_TestAll.py
1634 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
1635 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
1636 self._autoPublish(anObj, theName, "vector")
1639 ## Create a line, passing through the given point
1640 # and parallel to the given direction
1641 # @param thePnt Point. The resulting line will pass through it.
1642 # @param theDir Direction. The resulting line will be parallel to it.
1643 # @param theName Object name; when specified, this parameter is used
1644 # for result publication in the study. Otherwise, if automatic
1645 # publication is switched on, default value is used for result name.
1647 # @return New GEOM.GEOM_Object, containing the created line.
1649 # @ref tui_creation_line "Example"
1650 @ManageTransactions("BasicOp")
1651 def MakeLine(self, thePnt, theDir, theName=None):
1653 Create a line, passing through the given point
1654 and parallel to the given direction
1657 thePnt Point. The resulting line will pass through it.
1658 theDir Direction. The resulting line will be parallel to it.
1659 theName Object name; when specified, this parameter is used
1660 for result publication in the study. Otherwise, if automatic
1661 publication is switched on, default value is used for result name.
1664 New GEOM.GEOM_Object, containing the created line.
1666 # Example: see GEOM_TestAll.py
1667 anObj = self.BasicOp.MakeLine(thePnt, theDir)
1668 RaiseIfFailed("MakeLine", self.BasicOp)
1669 self._autoPublish(anObj, theName, "line")
1672 ## Create a line, passing through the given points
1673 # @param thePnt1 First of two points, defining the line.
1674 # @param thePnt2 Second of two points, defining the line.
1675 # @param theName Object name; when specified, this parameter is used
1676 # for result publication in the study. Otherwise, if automatic
1677 # publication is switched on, default value is used for result name.
1679 # @return New GEOM.GEOM_Object, containing the created line.
1681 # @ref tui_creation_line "Example"
1682 @ManageTransactions("BasicOp")
1683 def MakeLineTwoPnt(self, thePnt1, thePnt2, theName=None):
1685 Create a line, passing through the given points
1688 thePnt1 First of two points, defining the line.
1689 thePnt2 Second of two points, defining the line.
1690 theName Object name; when specified, this parameter is used
1691 for result publication in the study. Otherwise, if automatic
1692 publication is switched on, default value is used for result name.
1695 New GEOM.GEOM_Object, containing the created line.
1697 # Example: see GEOM_TestAll.py
1698 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
1699 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
1700 self._autoPublish(anObj, theName, "line")
1703 ## Create a line on two faces intersection.
1704 # @param theFace1 First of two faces, defining the line.
1705 # @param theFace2 Second of two faces, defining the line.
1706 # @param theName Object name; when specified, this parameter is used
1707 # for result publication in the study. Otherwise, if automatic
1708 # publication is switched on, default value is used for result name.
1710 # @return New GEOM.GEOM_Object, containing the created line.
1712 # @ref swig_MakeLineTwoFaces "Example"
1713 @ManageTransactions("BasicOp")
1714 def MakeLineTwoFaces(self, theFace1, theFace2, theName=None):
1716 Create a line on two faces intersection.
1719 theFace1 First of two faces, defining the line.
1720 theFace2 Second of two faces, defining the line.
1721 theName Object name; when specified, this parameter is used
1722 for result publication in the study. Otherwise, if automatic
1723 publication is switched on, default value is used for result name.
1726 New GEOM.GEOM_Object, containing the created line.
1728 # Example: see GEOM_TestAll.py
1729 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
1730 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
1731 self._autoPublish(anObj, theName, "line")
1734 ## Create a plane, passing through the given point
1735 # and normal to the given vector.
1736 # @param thePnt Point, the plane has to pass through.
1737 # @param theVec Vector, defining the plane normal direction.
1738 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1739 # @param theName Object name; when specified, this parameter is used
1740 # for result publication in the study. Otherwise, if automatic
1741 # publication is switched on, default value is used for result name.
1743 # @return New GEOM.GEOM_Object, containing the created plane.
1745 # @ref tui_creation_plane "Example"
1746 @ManageTransactions("BasicOp")
1747 def MakePlane(self, thePnt, theVec, theTrimSize, theName=None):
1749 Create a plane, passing through the given point
1750 and normal to the given vector.
1753 thePnt Point, the plane has to pass through.
1754 theVec Vector, defining the plane normal direction.
1755 theTrimSize Half size of a side of quadrangle face, representing the plane.
1756 theName Object name; when specified, this parameter is used
1757 for result publication in the study. Otherwise, if automatic
1758 publication is switched on, default value is used for result name.
1761 New GEOM.GEOM_Object, containing the created plane.
1763 # Example: see GEOM_TestAll.py
1764 theTrimSize, Parameters = ParseParameters(theTrimSize);
1765 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
1766 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
1767 anObj.SetParameters(Parameters)
1768 self._autoPublish(anObj, theName, "plane")
1771 ## Create a plane, passing through the three given points
1772 # @param thePnt1 First of three points, defining the plane.
1773 # @param thePnt2 Second of three points, defining the plane.
1774 # @param thePnt3 Third of three points, defining the plane.
1775 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1776 # @param theName Object name; when specified, this parameter is used
1777 # for result publication in the study. Otherwise, if automatic
1778 # publication is switched on, default value is used for result name.
1780 # @return New GEOM.GEOM_Object, containing the created plane.
1782 # @ref tui_creation_plane "Example"
1783 @ManageTransactions("BasicOp")
1784 def MakePlaneThreePnt(self, thePnt1, thePnt2, thePnt3, theTrimSize, theName=None):
1786 Create a plane, passing through the three given points
1789 thePnt1 First of three points, defining the plane.
1790 thePnt2 Second of three points, defining the plane.
1791 thePnt3 Third of three points, defining the plane.
1792 theTrimSize Half size of a side of quadrangle face, representing the plane.
1793 theName Object name; when specified, this parameter is used
1794 for result publication in the study. Otherwise, if automatic
1795 publication is switched on, default value is used for result name.
1798 New GEOM.GEOM_Object, containing the created plane.
1800 # Example: see GEOM_TestAll.py
1801 theTrimSize, Parameters = ParseParameters(theTrimSize);
1802 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
1803 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
1804 anObj.SetParameters(Parameters)
1805 self._autoPublish(anObj, theName, "plane")
1808 ## Create a plane, similar to the existing one, but with another size of representing face.
1809 # @param theFace Referenced plane or LCS(Marker).
1810 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
1811 # @param theName Object name; when specified, this parameter is used
1812 # for result publication in the study. Otherwise, if automatic
1813 # publication is switched on, default value is used for result name.
1815 # @return New GEOM.GEOM_Object, containing the created plane.
1817 # @ref tui_creation_plane "Example"
1818 @ManageTransactions("BasicOp")
1819 def MakePlaneFace(self, theFace, theTrimSize, theName=None):
1821 Create a plane, similar to the existing one, but with another size of representing face.
1824 theFace Referenced plane or LCS(Marker).
1825 theTrimSize New half size of a side of quadrangle face, representing the plane.
1826 theName Object name; when specified, this parameter is used
1827 for result publication in the study. Otherwise, if automatic
1828 publication is switched on, default value is used for result name.
1831 New GEOM.GEOM_Object, containing the created plane.
1833 # Example: see GEOM_TestAll.py
1834 theTrimSize, Parameters = ParseParameters(theTrimSize);
1835 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
1836 RaiseIfFailed("MakePlaneFace", self.BasicOp)
1837 anObj.SetParameters(Parameters)
1838 self._autoPublish(anObj, theName, "plane")
1841 ## Create a plane, passing through the 2 vectors
1842 # with center in a start point of the first vector.
1843 # @param theVec1 Vector, defining center point and plane direction.
1844 # @param theVec2 Vector, defining the plane normal direction.
1845 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1846 # @param theName Object name; when specified, this parameter is used
1847 # for result publication in the study. Otherwise, if automatic
1848 # publication is switched on, default value is used for result name.
1850 # @return New GEOM.GEOM_Object, containing the created plane.
1852 # @ref tui_creation_plane "Example"
1853 @ManageTransactions("BasicOp")
1854 def MakePlane2Vec(self, theVec1, theVec2, theTrimSize, theName=None):
1856 Create a plane, passing through the 2 vectors
1857 with center in a start point of the first vector.
1860 theVec1 Vector, defining center point and plane direction.
1861 theVec2 Vector, defining the plane normal direction.
1862 theTrimSize Half size of a side of quadrangle face, representing the plane.
1863 theName Object name; when specified, this parameter is used
1864 for result publication in the study. Otherwise, if automatic
1865 publication is switched on, default value is used for result name.
1868 New GEOM.GEOM_Object, containing the created plane.
1870 # Example: see GEOM_TestAll.py
1871 theTrimSize, Parameters = ParseParameters(theTrimSize);
1872 anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
1873 RaiseIfFailed("MakePlane2Vec", self.BasicOp)
1874 anObj.SetParameters(Parameters)
1875 self._autoPublish(anObj, theName, "plane")
1878 ## Create a plane, based on a Local coordinate system.
1879 # @param theLCS coordinate system, defining plane.
1880 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1881 # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
1882 # @param theName Object name; when specified, this parameter is used
1883 # for result publication in the study. Otherwise, if automatic
1884 # publication is switched on, default value is used for result name.
1886 # @return New GEOM.GEOM_Object, containing the created plane.
1888 # @ref tui_creation_plane "Example"
1889 @ManageTransactions("BasicOp")
1890 def MakePlaneLCS(self, theLCS, theTrimSize, theOrientation, theName=None):
1892 Create a plane, based on a Local coordinate system.
1895 theLCS coordinate system, defining plane.
1896 theTrimSize Half size of a side of quadrangle face, representing the plane.
1897 theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
1898 theName Object name; when specified, this parameter is used
1899 for result publication in the study. Otherwise, if automatic
1900 publication is switched on, default value is used for result name.
1903 New GEOM.GEOM_Object, containing the created plane.
1905 # Example: see GEOM_TestAll.py
1906 theTrimSize, Parameters = ParseParameters(theTrimSize);
1907 anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
1908 RaiseIfFailed("MakePlaneLCS", self.BasicOp)
1909 anObj.SetParameters(Parameters)
1910 self._autoPublish(anObj, theName, "plane")
1913 ## Create a local coordinate system.
1914 # @param OX,OY,OZ Three coordinates of coordinate system origin.
1915 # @param XDX,XDY,XDZ Three components of OX direction
1916 # @param YDX,YDY,YDZ Three components of OY direction
1917 # @param theName Object name; when specified, this parameter is used
1918 # for result publication in the study. Otherwise, if automatic
1919 # publication is switched on, default value is used for result name.
1921 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1923 # @ref swig_MakeMarker "Example"
1924 @ManageTransactions("BasicOp")
1925 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, theName=None):
1927 Create a local coordinate system.
1930 OX,OY,OZ Three coordinates of coordinate system origin.
1931 XDX,XDY,XDZ Three components of OX direction
1932 YDX,YDY,YDZ Three components of OY direction
1933 theName Object name; when specified, this parameter is used
1934 for result publication in the study. Otherwise, if automatic
1935 publication is switched on, default value is used for result name.
1938 New GEOM.GEOM_Object, containing the created coordinate system.
1940 # Example: see GEOM_TestAll.py
1941 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
1942 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
1943 RaiseIfFailed("MakeMarker", self.BasicOp)
1944 anObj.SetParameters(Parameters)
1945 self._autoPublish(anObj, theName, "lcs")
1948 ## Create a local coordinate system from shape.
1949 # @param theShape The initial shape to detect the coordinate system.
1950 # @param theName Object name; when specified, this parameter is used
1951 # for result publication in the study. Otherwise, if automatic
1952 # publication is switched on, default value is used for result name.
1954 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1956 # @ref tui_creation_lcs "Example"
1957 @ManageTransactions("BasicOp")
1958 def MakeMarkerFromShape(self, theShape, theName=None):
1960 Create a local coordinate system from shape.
1963 theShape The initial shape to detect the coordinate system.
1964 theName Object name; when specified, this parameter is used
1965 for result publication in the study. Otherwise, if automatic
1966 publication is switched on, default value is used for result name.
1969 New GEOM.GEOM_Object, containing the created coordinate system.
1971 anObj = self.BasicOp.MakeMarkerFromShape(theShape)
1972 RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
1973 self._autoPublish(anObj, theName, "lcs")
1976 ## Create a local coordinate system from point and two vectors.
1977 # @param theOrigin Point of coordinate system origin.
1978 # @param theXVec Vector of X direction
1979 # @param theYVec Vector of Y direction
1980 # @param theName Object name; when specified, this parameter is used
1981 # for result publication in the study. Otherwise, if automatic
1982 # publication is switched on, default value is used for result name.
1984 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1986 # @ref tui_creation_lcs "Example"
1987 @ManageTransactions("BasicOp")
1988 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec, theName=None):
1990 Create a local coordinate system from point and two vectors.
1993 theOrigin Point of coordinate system origin.
1994 theXVec Vector of X direction
1995 theYVec Vector of Y direction
1996 theName Object name; when specified, this parameter is used
1997 for result publication in the study. Otherwise, if automatic
1998 publication is switched on, default value is used for result name.
2001 New GEOM.GEOM_Object, containing the created coordinate system.
2004 anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
2005 RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
2006 self._autoPublish(anObj, theName, "lcs")
2009 # end of l3_basic_go
2012 ## @addtogroup l4_curves
2015 ## Create an arc of circle, passing through three given points.
2016 # @param thePnt1 Start point of the arc.
2017 # @param thePnt2 Middle point of the arc.
2018 # @param thePnt3 End point of the arc.
2019 # @param theName Object name; when specified, this parameter is used
2020 # for result publication in the study. Otherwise, if automatic
2021 # publication is switched on, default value is used for result name.
2023 # @return New GEOM.GEOM_Object, containing the created arc.
2025 # @ref swig_MakeArc "Example"
2026 @ManageTransactions("CurvesOp")
2027 def MakeArc(self, thePnt1, thePnt2, thePnt3, theName=None):
2029 Create an arc of circle, passing through three given points.
2032 thePnt1 Start point of the arc.
2033 thePnt2 Middle point of the arc.
2034 thePnt3 End point of the arc.
2035 theName Object name; when specified, this parameter is used
2036 for result publication in the study. Otherwise, if automatic
2037 publication is switched on, default value is used for result name.
2040 New GEOM.GEOM_Object, containing the created arc.
2042 # Example: see GEOM_TestAll.py
2043 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
2044 RaiseIfFailed("MakeArc", self.CurvesOp)
2045 self._autoPublish(anObj, theName, "arc")
2048 ## Create an arc of circle from a center and 2 points.
2049 # @param thePnt1 Center of the arc
2050 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
2051 # @param thePnt3 End point of the arc (Gives also a direction)
2052 # @param theSense Orientation of the arc
2053 # @param theName Object name; when specified, this parameter is used
2054 # for result publication in the study. Otherwise, if automatic
2055 # publication is switched on, default value is used for result name.
2057 # @return New GEOM.GEOM_Object, containing the created arc.
2059 # @ref swig_MakeArc "Example"
2060 @ManageTransactions("CurvesOp")
2061 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False, theName=None):
2063 Create an arc of circle from a center and 2 points.
2066 thePnt1 Center of the arc
2067 thePnt2 Start point of the arc. (Gives also the radius of the arc)
2068 thePnt3 End point of the arc (Gives also a direction)
2069 theSense Orientation of the arc
2070 theName Object name; when specified, this parameter is used
2071 for result publication in the study. Otherwise, if automatic
2072 publication is switched on, default value is used for result name.
2075 New GEOM.GEOM_Object, containing the created arc.
2077 # Example: see GEOM_TestAll.py
2078 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
2079 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
2080 self._autoPublish(anObj, theName, "arc")
2083 ## Create an arc of ellipse, of center and two points.
2084 # @param theCenter Center of the arc.
2085 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
2086 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2087 # @param theName Object name; when specified, this parameter is used
2088 # for result publication in the study. Otherwise, if automatic
2089 # publication is switched on, default value is used for result name.
2091 # @return New GEOM.GEOM_Object, containing the created arc.
2093 # @ref swig_MakeArc "Example"
2094 @ManageTransactions("CurvesOp")
2095 def MakeArcOfEllipse(self, theCenter, thePnt1, thePnt2, theName=None):
2097 Create an arc of ellipse, of center and two points.
2100 theCenter Center of the arc.
2101 thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
2102 thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2103 theName Object name; when specified, this parameter is used
2104 for result publication in the study. Otherwise, if automatic
2105 publication is switched on, default value is used for result name.
2108 New GEOM.GEOM_Object, containing the created arc.
2110 # Example: see GEOM_TestAll.py
2111 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
2112 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
2113 self._autoPublish(anObj, theName, "arc")
2116 ## Create a circle with given center, normal vector and radius.
2117 # @param thePnt Circle center.
2118 # @param theVec Vector, normal to the plane of the circle.
2119 # @param theR Circle radius.
2120 # @param theName Object name; when specified, this parameter is used
2121 # for result publication in the study. Otherwise, if automatic
2122 # publication is switched on, default value is used for result name.
2124 # @return New GEOM.GEOM_Object, containing the created circle.
2126 # @ref tui_creation_circle "Example"
2127 @ManageTransactions("CurvesOp")
2128 def MakeCircle(self, thePnt, theVec, theR, theName=None):
2130 Create a circle with given center, normal vector and radius.
2133 thePnt Circle center.
2134 theVec Vector, normal to the plane of the circle.
2136 theName Object name; when specified, this parameter is used
2137 for result publication in the study. Otherwise, if automatic
2138 publication is switched on, default value is used for result name.
2141 New GEOM.GEOM_Object, containing the created circle.
2143 # Example: see GEOM_TestAll.py
2144 theR, Parameters = ParseParameters(theR)
2145 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
2146 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
2147 anObj.SetParameters(Parameters)
2148 self._autoPublish(anObj, theName, "circle")
2151 ## Create a circle with given radius.
2152 # Center of the circle will be in the origin of global
2153 # coordinate system and normal vector will be codirected with Z axis
2154 # @param theR Circle radius.
2155 # @param theName Object name; when specified, this parameter is used
2156 # for result publication in the study. Otherwise, if automatic
2157 # publication is switched on, default value is used for result name.
2159 # @return New GEOM.GEOM_Object, containing the created circle.
2160 @ManageTransactions("CurvesOp")
2161 def MakeCircleR(self, theR, theName=None):
2163 Create a circle with given radius.
2164 Center of the circle will be in the origin of global
2165 coordinate system and normal vector will be codirected with Z axis
2169 theName Object name; when specified, this parameter is used
2170 for result publication in the study. Otherwise, if automatic
2171 publication is switched on, default value is used for result name.
2174 New GEOM.GEOM_Object, containing the created circle.
2176 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
2177 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
2178 self._autoPublish(anObj, theName, "circle")
2181 ## Create a circle, passing through three given points
2182 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2183 # @param theName Object name; when specified, this parameter is used
2184 # for result publication in the study. Otherwise, if automatic
2185 # publication is switched on, default value is used for result name.
2187 # @return New GEOM.GEOM_Object, containing the created circle.
2189 # @ref tui_creation_circle "Example"
2190 @ManageTransactions("CurvesOp")
2191 def MakeCircleThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
2193 Create a circle, passing through three given points
2196 thePnt1,thePnt2,thePnt3 Points, defining the circle.
2197 theName Object name; when specified, this parameter is used
2198 for result publication in the study. Otherwise, if automatic
2199 publication is switched on, default value is used for result name.
2202 New GEOM.GEOM_Object, containing the created circle.
2204 # Example: see GEOM_TestAll.py
2205 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
2206 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
2207 self._autoPublish(anObj, theName, "circle")
2210 ## Create a circle, with given point1 as center,
2211 # passing through the point2 as radius and laying in the plane,
2212 # defined by all three given points.
2213 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2214 # @param theName Object name; when specified, this parameter is used
2215 # for result publication in the study. Otherwise, if automatic
2216 # publication is switched on, default value is used for result name.
2218 # @return New GEOM.GEOM_Object, containing the created circle.
2220 # @ref swig_MakeCircle "Example"
2221 @ManageTransactions("CurvesOp")
2222 def MakeCircleCenter2Pnt(self, thePnt1, thePnt2, thePnt3, theName=None):
2224 Create a circle, with given point1 as center,
2225 passing through the point2 as radius and laying in the plane,
2226 defined by all three given points.
2229 thePnt1,thePnt2,thePnt3 Points, defining the circle.
2230 theName Object name; when specified, this parameter is used
2231 for result publication in the study. Otherwise, if automatic
2232 publication is switched on, default value is used for result name.
2235 New GEOM.GEOM_Object, containing the created circle.
2237 # Example: see GEOM_example6.py
2238 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
2239 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
2240 self._autoPublish(anObj, theName, "circle")
2243 ## Create an ellipse with given center, normal vector and radiuses.
2244 # @param thePnt Ellipse center.
2245 # @param theVec Vector, normal to the plane of the ellipse.
2246 # @param theRMajor Major ellipse radius.
2247 # @param theRMinor Minor ellipse radius.
2248 # @param theVecMaj Vector, direction of the ellipse's main axis.
2249 # @param theName Object name; when specified, this parameter is used
2250 # for result publication in the study. Otherwise, if automatic
2251 # publication is switched on, default value is used for result name.
2253 # @return New GEOM.GEOM_Object, containing the created ellipse.
2255 # @ref tui_creation_ellipse "Example"
2256 @ManageTransactions("CurvesOp")
2257 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None, theName=None):
2259 Create an ellipse with given center, normal vector and radiuses.
2262 thePnt Ellipse center.
2263 theVec Vector, normal to the plane of the ellipse.
2264 theRMajor Major ellipse radius.
2265 theRMinor Minor ellipse radius.
2266 theVecMaj Vector, direction of the ellipse's main axis.
2267 theName Object name; when specified, this parameter is used
2268 for result publication in the study. Otherwise, if automatic
2269 publication is switched on, default value is used for result name.
2272 New GEOM.GEOM_Object, containing the created ellipse.
2274 # Example: see GEOM_TestAll.py
2275 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
2276 if theVecMaj is not None:
2277 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
2279 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
2281 RaiseIfFailed("MakeEllipse", self.CurvesOp)
2282 anObj.SetParameters(Parameters)
2283 self._autoPublish(anObj, theName, "ellipse")
2286 ## Create an ellipse with given radiuses.
2287 # Center of the ellipse will be in the origin of global
2288 # coordinate system and normal vector will be codirected with Z axis
2289 # @param theRMajor Major ellipse radius.
2290 # @param theRMinor Minor ellipse radius.
2291 # @param theName Object name; when specified, this parameter is used
2292 # for result publication in the study. Otherwise, if automatic
2293 # publication is switched on, default value is used for result name.
2295 # @return New GEOM.GEOM_Object, containing the created ellipse.
2296 @ManageTransactions("CurvesOp")
2297 def MakeEllipseRR(self, theRMajor, theRMinor, theName=None):
2299 Create an ellipse with given radiuses.
2300 Center of the ellipse will be in the origin of global
2301 coordinate system and normal vector will be codirected with Z axis
2304 theRMajor Major ellipse radius.
2305 theRMinor Minor ellipse radius.
2306 theName Object name; when specified, this parameter is used
2307 for result publication in the study. Otherwise, if automatic
2308 publication is switched on, default value is used for result name.
2311 New GEOM.GEOM_Object, containing the created ellipse.
2313 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
2314 RaiseIfFailed("MakeEllipse", self.CurvesOp)
2315 self._autoPublish(anObj, theName, "ellipse")
2318 ## Create a polyline on the set of points.
2319 # @param thePoints Sequence of points for the polyline.
2320 # @param theIsClosed If True, build a closed wire.
2321 # @param theName Object name; when specified, this parameter is used
2322 # for result publication in the study. Otherwise, if automatic
2323 # publication is switched on, default value is used for result name.
2325 # @return New GEOM.GEOM_Object, containing the created polyline.
2327 # @ref tui_creation_curve "Example"
2328 @ManageTransactions("CurvesOp")
2329 def MakePolyline(self, thePoints, theIsClosed=False, theName=None):
2331 Create a polyline on the set of points.
2334 thePoints Sequence of points for the polyline.
2335 theIsClosed If True, build a closed wire.
2336 theName Object name; when specified, this parameter is used
2337 for result publication in the study. Otherwise, if automatic
2338 publication is switched on, default value is used for result name.
2341 New GEOM.GEOM_Object, containing the created polyline.
2343 # Example: see GEOM_TestAll.py
2344 anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
2345 RaiseIfFailed("MakePolyline", self.CurvesOp)
2346 self._autoPublish(anObj, theName, "polyline")
2349 ## Create bezier curve on the set of points.
2350 # @param thePoints Sequence of points for the bezier curve.
2351 # @param theIsClosed If True, build a closed curve.
2352 # @param theName Object name; when specified, this parameter is used
2353 # for result publication in the study. Otherwise, if automatic
2354 # publication is switched on, default value is used for result name.
2356 # @return New GEOM.GEOM_Object, containing the created bezier curve.
2358 # @ref tui_creation_curve "Example"
2359 @ManageTransactions("CurvesOp")
2360 def MakeBezier(self, thePoints, theIsClosed=False, theName=None):
2362 Create bezier curve on the set of points.
2365 thePoints Sequence of points for the bezier curve.
2366 theIsClosed If True, build a closed curve.
2367 theName Object name; when specified, this parameter is used
2368 for result publication in the study. Otherwise, if automatic
2369 publication is switched on, default value is used for result name.
2372 New GEOM.GEOM_Object, containing the created bezier curve.
2374 # Example: see GEOM_TestAll.py
2375 anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
2376 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
2377 self._autoPublish(anObj, theName, "bezier")
2380 ## Create B-Spline curve on the set of points.
2381 # @param thePoints Sequence of points for the B-Spline curve.
2382 # @param theIsClosed If True, build a closed curve.
2383 # @param theDoReordering If TRUE, the algo does not follow the order of
2384 # \a thePoints but searches for the closest vertex.
2385 # @param theName Object name; when specified, this parameter is used
2386 # for result publication in the study. Otherwise, if automatic
2387 # publication is switched on, default value is used for result name.
2389 # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2391 # @ref tui_creation_curve "Example"
2392 @ManageTransactions("CurvesOp")
2393 def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False, theName=None):
2395 Create B-Spline curve on the set of points.
2398 thePoints Sequence of points for the B-Spline curve.
2399 theIsClosed If True, build a closed curve.
2400 theDoReordering If True, the algo does not follow the order of
2401 thePoints but searches for the closest vertex.
2402 theName Object name; when specified, this parameter is used
2403 for result publication in the study. Otherwise, if automatic
2404 publication is switched on, default value is used for result name.
2407 New GEOM.GEOM_Object, containing the created B-Spline curve.
2409 # Example: see GEOM_TestAll.py
2410 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
2411 RaiseIfFailed("MakeInterpol", self.CurvesOp)
2412 self._autoPublish(anObj, theName, "bspline")
2415 ## Create B-Spline curve on the set of points.
2416 # @param thePoints Sequence of points for the B-Spline curve.
2417 # @param theFirstVec Vector object, defining the curve direction at its first point.
2418 # @param theLastVec Vector object, defining the curve direction at its last point.
2419 # @param theName Object name; when specified, this parameter is used
2420 # for result publication in the study. Otherwise, if automatic
2421 # publication is switched on, default value is used for result name.
2423 # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2425 # @ref tui_creation_curve "Example"
2426 @ManageTransactions("CurvesOp")
2427 def MakeInterpolWithTangents(self, thePoints, theFirstVec, theLastVec, theName=None):
2429 Create B-Spline curve on the set of points.
2432 thePoints Sequence of points for the B-Spline curve.
2433 theFirstVec Vector object, defining the curve direction at its first point.
2434 theLastVec Vector object, defining the curve direction at its last point.
2435 theName Object name; when specified, this parameter is used
2436 for result publication in the study. Otherwise, if automatic
2437 publication is switched on, default value is used for result name.
2440 New GEOM.GEOM_Object, containing the created B-Spline curve.
2442 # Example: see GEOM_TestAll.py
2443 anObj = self.CurvesOp.MakeSplineInterpolWithTangents(thePoints, theFirstVec, theLastVec)
2444 RaiseIfFailed("MakeInterpolWithTangents", self.CurvesOp)
2445 self._autoPublish(anObj, theName, "bspline")
2448 ## Creates a curve using the parametric definition of the basic points.
2449 # @param thexExpr parametric equation of the coordinates X.
2450 # @param theyExpr parametric equation of the coordinates Y.
2451 # @param thezExpr parametric equation of the coordinates Z.
2452 # @param theParamMin the minimal value of the parameter.
2453 # @param theParamMax the maximum value of the parameter.
2454 # @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2455 # @param theCurveType the type of the curve,
2456 # one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2457 # @param theNewMethod flag for switching to the new method if the flag is set to false a deprecated method is used which can lead to a bug.
2458 # @param theName Object name; when specified, this parameter is used
2459 # for result publication in the study. Otherwise, if automatic
2460 # publication is switched on, default value is used for result name.
2462 # @return New GEOM.GEOM_Object, containing the created curve.
2464 # @ref tui_creation_curve "Example"
2465 @ManageTransactions("CurvesOp")
2466 def MakeCurveParametric(self, thexExpr, theyExpr, thezExpr,
2467 theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False, theName=None ):
2469 Creates a curve using the parametric definition of the basic points.
2472 thexExpr parametric equation of the coordinates X.
2473 theyExpr parametric equation of the coordinates Y.
2474 thezExpr parametric equation of the coordinates Z.
2475 theParamMin the minimal value of the parameter.
2476 theParamMax the maximum value of the parameter.
2477 theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2478 theCurveType the type of the curve,
2479 one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2480 theNewMethod flag for switching to the new method if the flag is set to false a deprecated
2481 method is used which can lead to a bug.
2482 theName Object name; when specified, this parameter is used
2483 for result publication in the study. Otherwise, if automatic
2484 publication is switched on, default value is used for result name.
2487 New GEOM.GEOM_Object, containing the created curve.
2489 theParamMin,theParamMax,theParamStep,Parameters = ParseParameters(theParamMin,theParamMax,theParamStep)
2491 anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
2493 anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
2494 RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
2495 anObj.SetParameters(Parameters)
2496 self._autoPublish(anObj, theName, "curve")
2499 ## Create an isoline curve on a face.
2500 # @param theFace the face for which an isoline is created.
2501 # @param IsUIsoline True for U-isoline creation; False for V-isoline
2503 # @param theParameter the U parameter for U-isoline or V parameter
2505 # @param theName Object name; when specified, this parameter is used
2506 # for result publication in the study. Otherwise, if automatic
2507 # publication is switched on, default value is used for result name.
2509 # @return New GEOM.GEOM_Object, containing the created isoline edge or
2510 # a compound of edges.
2512 # @ref tui_creation_curve "Example"
2513 @ManageTransactions("CurvesOp")
2514 def MakeIsoline(self, theFace, IsUIsoline, theParameter, theName=None):
2516 Create an isoline curve on a face.
2519 theFace the face for which an isoline is created.
2520 IsUIsoline True for U-isoline creation; False for V-isoline
2522 theParameter the U parameter for U-isoline or V parameter
2524 theName Object name; when specified, this parameter is used
2525 for result publication in the study. Otherwise, if automatic
2526 publication is switched on, default value is used for result name.
2529 New GEOM.GEOM_Object, containing the created isoline edge or a
2532 # Example: see GEOM_TestAll.py
2533 anObj = self.CurvesOp.MakeIsoline(theFace, IsUIsoline, theParameter)
2534 RaiseIfFailed("MakeIsoline", self.CurvesOp)
2536 self._autoPublish(anObj, theName, "U-Isoline")
2538 self._autoPublish(anObj, theName, "V-Isoline")
2544 ## @addtogroup l3_sketcher
2547 ## Create a sketcher (wire or face), following the textual description,
2548 # passed through <VAR>theCommand</VAR> argument. \n
2549 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
2550 # Format of the description string have to be the following:
2552 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
2555 # - x1, y1 are coordinates of the first sketcher point (zero by default),
2557 # - "R angle" : Set the direction by angle
2558 # - "D dx dy" : Set the direction by DX & DY
2561 # - "TT x y" : Create segment by point at X & Y
2562 # - "T dx dy" : Create segment by point with DX & DY
2563 # - "L length" : Create segment by direction & Length
2564 # - "IX x" : Create segment by direction & Intersect. X
2565 # - "IY y" : Create segment by direction & Intersect. Y
2568 # - "C radius length" : Create arc by direction, radius and length(in degree)
2569 # - "AA x y": Create arc by point at X & Y
2570 # - "A dx dy" : Create arc by point with DX & DY
2571 # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
2572 # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
2573 # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
2574 # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2577 # - "WW" : Close Wire (to finish)
2578 # - "WF" : Close Wire and build face (to finish)
2581 # - Flag1 (= reverse) is 0 or 2 ...
2582 # - if 0 the drawn arc is the one of lower angle (< Pi)
2583 # - if 2 the drawn arc ius the one of greater angle (> Pi)
2586 # - Flag2 (= control tolerance) is 0 or 1 ...
2587 # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
2588 # - if 1 the wire is built only if the end point is on the arc
2589 # with a tolerance of 10^-7 on the distance else the creation fails
2591 # @param theCommand String, defining the sketcher in local
2592 # coordinates of the working plane.
2593 # @param theWorkingPlane Nine double values, defining origin,
2594 # OZ and OX directions of the working plane.
2595 # @param theName Object name; when specified, this parameter is used
2596 # for result publication in the study. Otherwise, if automatic
2597 # publication is switched on, default value is used for result name.
2599 # @return New GEOM.GEOM_Object, containing the created wire.
2601 # @ref tui_sketcher_page "Example"
2602 @ManageTransactions("CurvesOp")
2603 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0], theName=None):
2605 Create a sketcher (wire or face), following the textual description, passed
2606 through theCommand argument.
2607 Edges of the resulting wire or face will be arcs of circles and/or linear segments.
2608 Format of the description string have to be the following:
2609 "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
2611 - x1, y1 are coordinates of the first sketcher point (zero by default),
2613 - "R angle" : Set the direction by angle
2614 - "D dx dy" : Set the direction by DX & DY
2616 - "TT x y" : Create segment by point at X & Y
2617 - "T dx dy" : Create segment by point with DX & DY
2618 - "L length" : Create segment by direction & Length
2619 - "IX x" : Create segment by direction & Intersect. X
2620 - "IY y" : Create segment by direction & Intersect. Y
2622 - "C radius length" : Create arc by direction, radius and length(in degree)
2623 - "AA x y": Create arc by point at X & Y
2624 - "A dx dy" : Create arc by point with DX & DY
2625 - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
2626 - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
2627 - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
2628 - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2630 - "WW" : Close Wire (to finish)
2631 - "WF" : Close Wire and build face (to finish)
2633 - Flag1 (= reverse) is 0 or 2 ...
2634 - if 0 the drawn arc is the one of lower angle (< Pi)
2635 - if 2 the drawn arc ius the one of greater angle (> Pi)
2637 - Flag2 (= control tolerance) is 0 or 1 ...
2638 - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
2639 - if 1 the wire is built only if the end point is on the arc
2640 with a tolerance of 10^-7 on the distance else the creation fails
2643 theCommand String, defining the sketcher in local
2644 coordinates of the working plane.
2645 theWorkingPlane Nine double values, defining origin,
2646 OZ and OX directions of the working plane.
2647 theName Object name; when specified, this parameter is used
2648 for result publication in the study. Otherwise, if automatic
2649 publication is switched on, default value is used for result name.
2652 New GEOM.GEOM_Object, containing the created wire.
2654 # Example: see GEOM_TestAll.py
2655 theCommand,Parameters = ParseSketcherCommand(theCommand)
2656 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
2657 RaiseIfFailed("MakeSketcher", self.CurvesOp)
2658 anObj.SetParameters(Parameters)
2659 self._autoPublish(anObj, theName, "wire")
2662 ## Create a sketcher (wire or face), following the textual description,
2663 # passed through <VAR>theCommand</VAR> argument. \n
2664 # For format of the description string see MakeSketcher() method.\n
2665 # @param theCommand String, defining the sketcher in local
2666 # coordinates of the working plane.
2667 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2668 # @param theName Object name; when specified, this parameter is used
2669 # for result publication in the study. Otherwise, if automatic
2670 # publication is switched on, default value is used for result name.
2672 # @return New GEOM.GEOM_Object, containing the created wire.
2674 # @ref tui_sketcher_page "Example"
2675 @ManageTransactions("CurvesOp")
2676 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane, theName=None):
2678 Create a sketcher (wire or face), following the textual description,
2679 passed through theCommand argument.
2680 For format of the description string see geompy.MakeSketcher() method.
2683 theCommand String, defining the sketcher in local
2684 coordinates of the working plane.
2685 theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2686 theName Object name; when specified, this parameter is used
2687 for result publication in the study. Otherwise, if automatic
2688 publication is switched on, default value is used for result name.
2691 New GEOM.GEOM_Object, containing the created wire.
2693 theCommand,Parameters = ParseSketcherCommand(theCommand)
2694 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
2695 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
2696 anObj.SetParameters(Parameters)
2697 self._autoPublish(anObj, theName, "wire")
2700 ## Obtain a 2D sketcher interface
2701 # @return An instance of @ref gsketcher.Sketcher2D "Sketcher2D" interface
2702 def Sketcher2D (self):
2704 Obtain a 2D sketcher interface.
2707 sk = geompy.Sketcher2D()
2709 sk.addSegmentRelative(15, 70)
2710 sk.addSegmentPerpY(50)
2711 sk.addArcRadiusRelative(25, 15, 14.5, 0)
2712 sk.addArcCenterAbsolute(1, 1, 50, 50, 0, 0)
2713 sk.addArcDirectionRadiusLength(20, 20, 101, 162.13)
2715 Sketch_1 = sk.wire(geomObj_1)
2717 sk = Sketcher2D (self)
2720 ## Create a sketcher wire, following the numerical description,
2721 # passed through <VAR>theCoordinates</VAR> argument. \n
2722 # @param theCoordinates double values, defining points to create a wire,
2724 # @param theName Object name; when specified, this parameter is used
2725 # for result publication in the study. Otherwise, if automatic
2726 # publication is switched on, default value is used for result name.
2728 # @return New GEOM.GEOM_Object, containing the created wire.
2730 # @ref tui_3dsketcher_page "Example"
2731 @ManageTransactions("CurvesOp")
2732 def Make3DSketcher(self, theCoordinates, theName=None):
2734 Create a sketcher wire, following the numerical description,
2735 passed through theCoordinates argument.
2738 theCoordinates double values, defining points to create a wire,
2740 theName Object name; when specified, this parameter is used
2741 for result publication in the study. Otherwise, if automatic
2742 publication is switched on, default value is used for result name.
2745 New GEOM_Object, containing the created wire.
2747 theCoordinates,Parameters = ParseParameters(theCoordinates)
2748 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
2749 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
2750 anObj.SetParameters(Parameters)
2751 self._autoPublish(anObj, theName, "wire")
2754 ## Obtain a 3D sketcher interface
2755 # @return An instance of @ref gsketcher.Sketcher3D "Sketcher3D" interface
2757 # @ref tui_3dsketcher_page "Example"
2758 def Sketcher3D (self):
2760 Obtain a 3D sketcher interface.
2763 sk = geompy.Sketcher3D()
2764 sk.addPointsAbsolute(0,0,0, 70,0,0)
2765 sk.addPointsRelative(0, 0, 130)
2766 sk.addPointAnglesLength("OXY", 50, 0, 100)
2767 sk.addPointAnglesLength("OXZ", 30, 80, 130)
2769 a3D_Sketcher_1 = sk.wire()
2771 sk = Sketcher3D (self)
2774 ## Obtain a 2D polyline creation interface
2775 # @return An instance of @ref gsketcher.Polyline2D "Polyline2D" interface
2777 # @ref tui_3dsketcher_page "Example"
2778 def Polyline2D (self):
2780 Obtain a 2D polyline creation interface.
2783 pl = geompy.Polyline2D()
2784 pl.addSection("section 1", GEOM.Polyline, True)
2785 pl.addPoints(0, 0, 10, 0, 10, 10)
2786 pl.addSection("section 2", GEOM.Interpolation, False)
2787 pl.addPoints(20, 0, 30, 0, 30, 10)
2788 resultObj = pl.result(WorkingPlane)
2790 pl = Polyline2D (self)
2793 # end of l3_sketcher
2796 ## @addtogroup l3_3d_primitives
2799 ## Create a box by coordinates of two opposite vertices.
2801 # @param x1,y1,z1 double values, defining first point it.
2802 # @param x2,y2,z2 double values, defining first point it.
2803 # @param theName Object name; when specified, this parameter is used
2804 # for result publication in the study. Otherwise, if automatic
2805 # publication is switched on, default value is used for result name.
2807 # @return New GEOM.GEOM_Object, containing the created box.
2809 # @ref tui_creation_box "Example"
2810 def MakeBox(self, x1, y1, z1, x2, y2, z2, theName=None):
2812 Create a box by coordinates of two opposite vertices.
2815 x1,y1,z1 double values, defining first point.
2816 x2,y2,z2 double values, defining second point.
2817 theName Object name; when specified, this parameter is used
2818 for result publication in the study. Otherwise, if automatic
2819 publication is switched on, default value is used for result name.
2822 New GEOM.GEOM_Object, containing the created box.
2824 # Example: see GEOM_TestAll.py
2825 pnt1 = self.MakeVertex(x1,y1,z1)
2826 pnt2 = self.MakeVertex(x2,y2,z2)
2827 # note: auto-publishing is done in self.MakeBoxTwoPnt()
2828 return self.MakeBoxTwoPnt(pnt1, pnt2, theName)
2830 ## Create a box with specified dimensions along the coordinate axes
2831 # and with edges, parallel to the coordinate axes.
2832 # Center of the box will be at point (DX/2, DY/2, DZ/2).
2833 # @param theDX Length of Box edges, parallel to OX axis.
2834 # @param theDY Length of Box edges, parallel to OY axis.
2835 # @param theDZ Length of Box edges, parallel to OZ axis.
2836 # @param theName Object name; when specified, this parameter is used
2837 # for result publication in the study. Otherwise, if automatic
2838 # publication is switched on, default value is used for result name.
2840 # @return New GEOM.GEOM_Object, containing the created box.
2842 # @ref tui_creation_box "Example"
2843 @ManageTransactions("PrimOp")
2844 def MakeBoxDXDYDZ(self, theDX, theDY, theDZ, theName=None):
2846 Create a box with specified dimensions along the coordinate axes
2847 and with edges, parallel to the coordinate axes.
2848 Center of the box will be at point (DX/2, DY/2, DZ/2).
2851 theDX Length of Box edges, parallel to OX axis.
2852 theDY Length of Box edges, parallel to OY axis.
2853 theDZ Length of Box edges, parallel to OZ axis.
2854 theName Object name; when specified, this parameter is used
2855 for result publication in the study. Otherwise, if automatic
2856 publication is switched on, default value is used for result name.
2859 New GEOM.GEOM_Object, containing the created box.
2861 # Example: see GEOM_TestAll.py
2862 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
2863 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
2864 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
2865 anObj.SetParameters(Parameters)
2866 self._autoPublish(anObj, theName, "box")
2869 ## Create a box with two specified opposite vertices,
2870 # and with edges, parallel to the coordinate axes
2871 # @param thePnt1 First of two opposite vertices.
2872 # @param thePnt2 Second of two opposite vertices.
2873 # @param theName Object name; when specified, this parameter is used
2874 # for result publication in the study. Otherwise, if automatic
2875 # publication is switched on, default value is used for result name.
2877 # @return New GEOM.GEOM_Object, containing the created box.
2879 # @ref tui_creation_box "Example"
2880 @ManageTransactions("PrimOp")
2881 def MakeBoxTwoPnt(self, thePnt1, thePnt2, theName=None):
2883 Create a box with two specified opposite vertices,
2884 and with edges, parallel to the coordinate axes
2887 thePnt1 First of two opposite vertices.
2888 thePnt2 Second of two opposite vertices.
2889 theName Object name; when specified, this parameter is used
2890 for result publication in the study. Otherwise, if automatic
2891 publication is switched on, default value is used for result name.
2894 New GEOM.GEOM_Object, containing the created box.
2896 # Example: see GEOM_TestAll.py
2897 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
2898 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
2899 self._autoPublish(anObj, theName, "box")
2902 ## Create a face with specified dimensions with edges parallel to coordinate axes.
2903 # @param theH height of Face.
2904 # @param theW width of Face.
2905 # @param theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2906 # @param theName Object name; when specified, this parameter is used
2907 # for result publication in the study. Otherwise, if automatic
2908 # publication is switched on, default value is used for result name.
2910 # @return New GEOM.GEOM_Object, containing the created face.
2912 # @ref tui_creation_face "Example"
2913 @ManageTransactions("PrimOp")
2914 def MakeFaceHW(self, theH, theW, theOrientation, theName=None):
2916 Create a face with specified dimensions with edges parallel to coordinate axes.
2919 theH height of Face.
2921 theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2922 theName Object name; when specified, this parameter is used
2923 for result publication in the study. Otherwise, if automatic
2924 publication is switched on, default value is used for result name.
2927 New GEOM.GEOM_Object, containing the created face.
2929 # Example: see GEOM_TestAll.py
2930 theH,theW,Parameters = ParseParameters(theH, theW)
2931 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
2932 RaiseIfFailed("MakeFaceHW", self.PrimOp)
2933 anObj.SetParameters(Parameters)
2934 self._autoPublish(anObj, theName, "rectangle")
2937 ## Create a face from another plane and two sizes,
2938 # vertical size and horisontal size.
2939 # @param theObj Normale vector to the creating face or
2941 # @param theH Height (vertical size).
2942 # @param theW Width (horisontal size).
2943 # @param theName Object name; when specified, this parameter is used
2944 # for result publication in the study. Otherwise, if automatic
2945 # publication is switched on, default value is used for result name.
2947 # @return New GEOM.GEOM_Object, containing the created face.
2949 # @ref tui_creation_face "Example"
2950 @ManageTransactions("PrimOp")
2951 def MakeFaceObjHW(self, theObj, theH, theW, theName=None):
2953 Create a face from another plane and two sizes,
2954 vertical size and horisontal size.
2957 theObj Normale vector to the creating face or
2959 theH Height (vertical size).
2960 theW Width (horisontal size).
2961 theName Object name; when specified, this parameter is used
2962 for result publication in the study. Otherwise, if automatic
2963 publication is switched on, default value is used for result name.
2966 New GEOM_Object, containing the created face.
2968 # Example: see GEOM_TestAll.py
2969 theH,theW,Parameters = ParseParameters(theH, theW)
2970 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
2971 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
2972 anObj.SetParameters(Parameters)
2973 self._autoPublish(anObj, theName, "rectangle")
2976 ## Create a disk with given center, normal vector and radius.
2977 # @param thePnt Disk center.
2978 # @param theVec Vector, normal to the plane of the disk.
2979 # @param theR Disk radius.
2980 # @param theName Object name; when specified, this parameter is used
2981 # for result publication in the study. Otherwise, if automatic
2982 # publication is switched on, default value is used for result name.
2984 # @return New GEOM.GEOM_Object, containing the created disk.
2986 # @ref tui_creation_disk "Example"
2987 @ManageTransactions("PrimOp")
2988 def MakeDiskPntVecR(self, thePnt, theVec, theR, theName=None):
2990 Create a disk with given center, normal vector and radius.
2994 theVec Vector, normal to the plane of the disk.
2996 theName Object name; when specified, this parameter is used
2997 for result publication in the study. Otherwise, if automatic
2998 publication is switched on, default value is used for result name.
3001 New GEOM.GEOM_Object, containing the created disk.
3003 # Example: see GEOM_TestAll.py
3004 theR,Parameters = ParseParameters(theR)
3005 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
3006 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
3007 anObj.SetParameters(Parameters)
3008 self._autoPublish(anObj, theName, "disk")
3011 ## Create a disk, passing through three given points
3012 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
3013 # @param theName Object name; when specified, this parameter is used
3014 # for result publication in the study. Otherwise, if automatic
3015 # publication is switched on, default value is used for result name.
3017 # @return New GEOM.GEOM_Object, containing the created disk.
3019 # @ref tui_creation_disk "Example"
3020 @ManageTransactions("PrimOp")
3021 def MakeDiskThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
3023 Create a disk, passing through three given points
3026 thePnt1,thePnt2,thePnt3 Points, defining the disk.
3027 theName Object name; when specified, this parameter is used
3028 for result publication in the study. Otherwise, if automatic
3029 publication is switched on, default value is used for result name.
3032 New GEOM.GEOM_Object, containing the created disk.
3034 # Example: see GEOM_TestAll.py
3035 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
3036 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
3037 self._autoPublish(anObj, theName, "disk")
3040 ## Create a disk with specified dimensions along OX-OY coordinate axes.
3041 # @param theR Radius of Face.
3042 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
3043 # @param theName Object name; when specified, this parameter is used
3044 # for result publication in the study. Otherwise, if automatic
3045 # publication is switched on, default value is used for result name.
3047 # @return New GEOM.GEOM_Object, containing the created disk.
3049 # @ref tui_creation_face "Example"
3050 @ManageTransactions("PrimOp")
3051 def MakeDiskR(self, theR, theOrientation, theName=None):
3053 Create a disk with specified dimensions along OX-OY coordinate axes.
3056 theR Radius of Face.
3057 theOrientation set the orientation belong axis OXY or OYZ or OZX
3058 theName Object name; when specified, this parameter is used
3059 for result publication in the study. Otherwise, if automatic
3060 publication is switched on, default value is used for result name.
3063 New GEOM.GEOM_Object, containing the created disk.
3066 Disk3 = geompy.MakeDiskR(100., 1)
3068 # Example: see GEOM_TestAll.py
3069 theR,Parameters = ParseParameters(theR)
3070 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
3071 RaiseIfFailed("MakeDiskR", self.PrimOp)
3072 anObj.SetParameters(Parameters)
3073 self._autoPublish(anObj, theName, "disk")
3076 ## Create a cylinder with given base point, axis, radius and height.
3077 # @param thePnt Central point of cylinder base.
3078 # @param theAxis Cylinder axis.
3079 # @param theR Cylinder radius.
3080 # @param theH Cylinder height.
3081 # @param theName Object name; when specified, this parameter is used
3082 # for result publication in the study. Otherwise, if automatic
3083 # publication is switched on, default value is used for result name.
3085 # @return New GEOM.GEOM_Object, containing the created cylinder.
3087 # @ref tui_creation_cylinder "Example"
3088 @ManageTransactions("PrimOp")
3089 def MakeCylinder(self, thePnt, theAxis, theR, theH, theName=None):
3091 Create a cylinder with given base point, axis, radius and height.
3094 thePnt Central point of cylinder base.
3095 theAxis Cylinder axis.
3096 theR Cylinder radius.
3097 theH Cylinder height.
3098 theName Object name; when specified, this parameter is used
3099 for result publication in the study. Otherwise, if automatic
3100 publication is switched on, default value is used for result name.
3103 New GEOM.GEOM_Object, containing the created cylinder.
3105 # Example: see GEOM_TestAll.py
3106 theR,theH,Parameters = ParseParameters(theR, theH)
3107 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
3108 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
3109 anObj.SetParameters(Parameters)
3110 self._autoPublish(anObj, theName, "cylinder")
3113 ## Create a portion of cylinder with given base point, axis, radius, height and angle.
3114 # @param thePnt Central point of cylinder base.
3115 # @param theAxis Cylinder axis.
3116 # @param theR Cylinder radius.
3117 # @param theH Cylinder height.
3118 # @param theA Cylinder angle in radians.
3119 # @param theName Object name; when specified, this parameter is used
3120 # for result publication in the study. Otherwise, if automatic
3121 # publication is switched on, default value is used for result name.
3123 # @return New GEOM.GEOM_Object, containing the created cylinder.
3125 # @ref tui_creation_cylinder "Example"
3126 @ManageTransactions("PrimOp")
3127 def MakeCylinderA(self, thePnt, theAxis, theR, theH, theA, theName=None):
3129 Create a portion of cylinder with given base point, axis, radius, height and angle.
3132 thePnt Central point of cylinder base.
3133 theAxis Cylinder axis.
3134 theR Cylinder radius.
3135 theH Cylinder height.
3136 theA Cylinder angle in radians.
3137 theName Object name; when specified, this parameter is used
3138 for result publication in the study. Otherwise, if automatic
3139 publication is switched on, default value is used for result name.
3142 New GEOM.GEOM_Object, containing the created cylinder.
3144 # Example: see GEOM_TestAll.py
3146 if isinstance(theA,str):
3148 theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
3150 theA = theA*math.pi/180.
3151 if theA<=0. or theA>=2*math.pi:
3152 raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
3153 anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
3154 RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
3155 anObj.SetParameters(Parameters)
3156 self._autoPublish(anObj, theName, "cylinder")
3159 ## Create a cylinder with given radius and height at
3160 # the origin of coordinate system. Axis of the cylinder
3161 # will be collinear to the OZ axis of the coordinate system.
3162 # @param theR Cylinder radius.
3163 # @param theH Cylinder height.
3164 # @param theName Object name; when specified, this parameter is used
3165 # for result publication in the study. Otherwise, if automatic
3166 # publication is switched on, default value is used for result name.
3168 # @return New GEOM.GEOM_Object, containing the created cylinder.
3170 # @ref tui_creation_cylinder "Example"
3171 @ManageTransactions("PrimOp")
3172 def MakeCylinderRH(self, theR, theH, theName=None):
3174 Create a cylinder with given radius and height at
3175 the origin of coordinate system. Axis of the cylinder
3176 will be collinear to the OZ axis of the coordinate system.
3179 theR Cylinder radius.
3180 theH Cylinder height.
3181 theName Object name; when specified, this parameter is used
3182 for result publication in the study. Otherwise, if automatic
3183 publication is switched on, default value is used for result name.
3186 New GEOM.GEOM_Object, containing the created cylinder.
3188 # Example: see GEOM_TestAll.py
3189 theR,theH,Parameters = ParseParameters(theR, theH)
3190 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
3191 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
3192 anObj.SetParameters(Parameters)
3193 self._autoPublish(anObj, theName, "cylinder")
3196 ## Create a portion of cylinder with given radius, height and angle at
3197 # the origin of coordinate system. Axis of the cylinder
3198 # will be collinear to the OZ axis of the coordinate system.
3199 # @param theR Cylinder radius.
3200 # @param theH Cylinder height.
3201 # @param theA Cylinder angle in radians.
3202 # @param theName Object name; when specified, this parameter is used
3203 # for result publication in the study. Otherwise, if automatic
3204 # publication is switched on, default value is used for result name.
3206 # @return New GEOM.GEOM_Object, containing the created cylinder.
3208 # @ref tui_creation_cylinder "Example"
3209 @ManageTransactions("PrimOp")
3210 def MakeCylinderRHA(self, theR, theH, theA, theName=None):
3212 Create a portion of cylinder with given radius, height and angle at
3213 the origin of coordinate system. Axis of the cylinder
3214 will be collinear to the OZ axis of the coordinate system.
3217 theR Cylinder radius.
3218 theH Cylinder height.
3219 theA Cylinder angle in radians.
3220 theName Object name; when specified, this parameter is used
3221 for result publication in the study. Otherwise, if automatic
3222 publication is switched on, default value is used for result name.
3225 New GEOM.GEOM_Object, containing the created cylinder.
3227 # Example: see GEOM_TestAll.py
3229 if isinstance(theA,str):
3231 theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
3233 theA = theA*math.pi/180.
3234 if theA<=0. or theA>=2*math.pi:
3235 raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
3236 anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
3237 RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
3238 anObj.SetParameters(Parameters)
3239 self._autoPublish(anObj, theName, "cylinder")
3242 ## Create a sphere with given center and radius.
3243 # @param thePnt Sphere center.
3244 # @param theR Sphere radius.
3245 # @param theName Object name; when specified, this parameter is used
3246 # for result publication in the study. Otherwise, if automatic
3247 # publication is switched on, default value is used for result name.
3249 # @return New GEOM.GEOM_Object, containing the created sphere.
3251 # @ref tui_creation_sphere "Example"
3252 @ManageTransactions("PrimOp")
3253 def MakeSpherePntR(self, thePnt, theR, theName=None):
3255 Create a sphere with given center and radius.
3258 thePnt Sphere center.
3260 theName Object name; when specified, this parameter is used
3261 for result publication in the study. Otherwise, if automatic
3262 publication is switched on, default value is used for result name.
3265 New GEOM.GEOM_Object, containing the created sphere.
3267 # Example: see GEOM_TestAll.py
3268 theR,Parameters = ParseParameters(theR)
3269 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
3270 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
3271 anObj.SetParameters(Parameters)
3272 self._autoPublish(anObj, theName, "sphere")
3275 ## Create a sphere with given center and radius.
3276 # @param x,y,z Coordinates of sphere center.
3277 # @param theR Sphere radius.
3278 # @param theName Object name; when specified, this parameter is used
3279 # for result publication in the study. Otherwise, if automatic
3280 # publication is switched on, default value is used for result name.
3282 # @return New GEOM.GEOM_Object, containing the created sphere.
3284 # @ref tui_creation_sphere "Example"
3285 def MakeSphere(self, x, y, z, theR, theName=None):
3287 Create a sphere with given center and radius.
3290 x,y,z Coordinates of sphere center.
3292 theName Object name; when specified, this parameter is used
3293 for result publication in the study. Otherwise, if automatic
3294 publication is switched on, default value is used for result name.
3297 New GEOM.GEOM_Object, containing the created sphere.
3299 # Example: see GEOM_TestAll.py
3300 point = self.MakeVertex(x, y, z)
3301 # note: auto-publishing is done in self.MakeSpherePntR()
3302 anObj = self.MakeSpherePntR(point, theR, theName)
3305 ## Create a sphere with given radius at the origin of coordinate system.
3306 # @param theR Sphere radius.
3307 # @param theName Object name; when specified, this parameter is used
3308 # for result publication in the study. Otherwise, if automatic
3309 # publication is switched on, default value is used for result name.
3311 # @return New GEOM.GEOM_Object, containing the created sphere.
3313 # @ref tui_creation_sphere "Example"
3314 @ManageTransactions("PrimOp")
3315 def MakeSphereR(self, theR, theName=None):
3317 Create a sphere with given radius at the origin of coordinate system.
3321 theName Object name; when specified, this parameter is used
3322 for result publication in the study. Otherwise, if automatic
3323 publication is switched on, default value is used for result name.
3326 New GEOM.GEOM_Object, containing the created sphere.
3328 # Example: see GEOM_TestAll.py
3329 theR,Parameters = ParseParameters(theR)
3330 anObj = self.PrimOp.MakeSphereR(theR)
3331 RaiseIfFailed("MakeSphereR", self.PrimOp)
3332 anObj.SetParameters(Parameters)
3333 self._autoPublish(anObj, theName, "sphere")
3336 ## Create a cone with given base point, axis, height and radiuses.
3337 # @param thePnt Central point of the first cone base.
3338 # @param theAxis Cone axis.
3339 # @param theR1 Radius of the first cone base.
3340 # @param theR2 Radius of the second cone base.
3341 # \note If both radiuses are non-zero, the cone will be truncated.
3342 # \note If the radiuses are equal, a cylinder will be created instead.
3343 # @param theH Cone height.
3344 # @param theName Object name; when specified, this parameter is used
3345 # for result publication in the study. Otherwise, if automatic
3346 # publication is switched on, default value is used for result name.
3348 # @return New GEOM.GEOM_Object, containing the created cone.
3350 # @ref tui_creation_cone "Example"
3351 @ManageTransactions("PrimOp")
3352 def MakeCone(self, thePnt, theAxis, theR1, theR2, theH, theName=None):
3354 Create a cone with given base point, axis, height and radiuses.
3357 thePnt Central point of the first cone base.
3359 theR1 Radius of the first cone base.
3360 theR2 Radius of the second cone base.
3362 theName Object name; when specified, this parameter is used
3363 for result publication in the study. Otherwise, if automatic
3364 publication is switched on, default value is used for result name.
3367 If both radiuses are non-zero, the cone will be truncated.
3368 If the radiuses are equal, a cylinder will be created instead.
3371 New GEOM.GEOM_Object, containing the created cone.
3373 # Example: see GEOM_TestAll.py
3374 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
3375 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
3376 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
3377 anObj.SetParameters(Parameters)
3378 self._autoPublish(anObj, theName, "cone")
3381 ## Create a cone with given height and radiuses at
3382 # the origin of coordinate system. Axis of the cone will
3383 # be collinear to the OZ axis of the coordinate system.
3384 # @param theR1 Radius of the first cone base.
3385 # @param theR2 Radius of the second cone base.
3386 # \note If both radiuses are non-zero, the cone will be truncated.
3387 # \note If the radiuses are equal, a cylinder will be created instead.
3388 # @param theH Cone height.
3389 # @param theName Object name; when specified, this parameter is used
3390 # for result publication in the study. Otherwise, if automatic
3391 # publication is switched on, default value is used for result name.
3393 # @return New GEOM.GEOM_Object, containing the created cone.
3395 # @ref tui_creation_cone "Example"
3396 @ManageTransactions("PrimOp")
3397 def MakeConeR1R2H(self, theR1, theR2, theH, theName=None):
3399 Create a cone with given height and radiuses at
3400 the origin of coordinate system. Axis of the cone will
3401 be collinear to the OZ axis of the coordinate system.
3404 theR1 Radius of the first cone base.
3405 theR2 Radius of the second cone base.
3407 theName Object name; when specified, this parameter is used
3408 for result publication in the study. Otherwise, if automatic
3409 publication is switched on, default value is used for result name.
3412 If both radiuses are non-zero, the cone will be truncated.
3413 If the radiuses are equal, a cylinder will be created instead.
3416 New GEOM.GEOM_Object, containing the created cone.
3418 # Example: see GEOM_TestAll.py
3419 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
3420 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
3421 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
3422 anObj.SetParameters(Parameters)
3423 self._autoPublish(anObj, theName, "cone")
3426 ## Create a torus with given center, normal vector and radiuses.
3427 # @param thePnt Torus central point.
3428 # @param theVec Torus axis of symmetry.
3429 # @param theRMajor Torus major radius.
3430 # @param theRMinor Torus minor radius.
3431 # @param theName Object name; when specified, this parameter is used
3432 # for result publication in the study. Otherwise, if automatic
3433 # publication is switched on, default value is used for result name.
3435 # @return New GEOM.GEOM_Object, containing the created torus.
3437 # @ref tui_creation_torus "Example"
3438 @ManageTransactions("PrimOp")
3439 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor, theName=None):
3441 Create a torus with given center, normal vector and radiuses.
3444 thePnt Torus central point.
3445 theVec Torus axis of symmetry.
3446 theRMajor Torus major radius.
3447 theRMinor Torus minor radius.
3448 theName Object name; when specified, this parameter is used
3449 for result publication in the study. Otherwise, if automatic
3450 publication is switched on, default value is used for result name.
3453 New GEOM.GEOM_Object, containing the created torus.
3455 # Example: see GEOM_TestAll.py
3456 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
3457 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
3458 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
3459 anObj.SetParameters(Parameters)
3460 self._autoPublish(anObj, theName, "torus")
3463 ## Create a torus with given radiuses at the origin of coordinate system.
3464 # @param theRMajor Torus major radius.
3465 # @param theRMinor Torus minor radius.
3466 # @param theName Object name; when specified, this parameter is used
3467 # for result publication in the study. Otherwise, if automatic
3468 # publication is switched on, default value is used for result name.
3470 # @return New GEOM.GEOM_Object, containing the created torus.
3472 # @ref tui_creation_torus "Example"
3473 @ManageTransactions("PrimOp")
3474 def MakeTorusRR(self, theRMajor, theRMinor, theName=None):
3476 Create a torus with given radiuses at the origin of coordinate system.
3479 theRMajor Torus major radius.
3480 theRMinor Torus minor radius.
3481 theName Object name; when specified, this parameter is used
3482 for result publication in the study. Otherwise, if automatic
3483 publication is switched on, default value is used for result name.
3486 New GEOM.GEOM_Object, containing the created torus.
3488 # Example: see GEOM_TestAll.py
3489 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
3490 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
3491 RaiseIfFailed("MakeTorusRR", self.PrimOp)
3492 anObj.SetParameters(Parameters)
3493 self._autoPublish(anObj, theName, "torus")
3496 # end of l3_3d_primitives
3499 ## @addtogroup l3_complex
3502 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
3503 # @param theBase Base shape to be extruded.
3504 # @param thePoint1 First end of extrusion vector.
3505 # @param thePoint2 Second end of extrusion vector.
3506 # @param theScaleFactor Use it to make prism with scaled second base.
3507 # Nagative value means not scaled second base.
3508 # @param theName Object name; when specified, this parameter is used
3509 # for result publication in the study. Otherwise, if automatic
3510 # publication is switched on, default value is used for result name.
3512 # @return New GEOM.GEOM_Object, containing the created prism.
3514 # @ref tui_creation_prism "Example"
3515 @ManageTransactions("PrimOp")
3516 def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0, theName=None):
3518 Create a shape by extrusion of the base shape along a vector, defined by two points.
3521 theBase Base shape to be extruded.
3522 thePoint1 First end of extrusion vector.
3523 thePoint2 Second end of extrusion vector.
3524 theScaleFactor Use it to make prism with scaled second base.
3525 Nagative value means not scaled second base.
3526 theName Object name; when specified, this parameter is used
3527 for result publication in the study. Otherwise, if automatic
3528 publication is switched on, default value is used for result name.
3531 New GEOM.GEOM_Object, containing the created prism.
3533 # Example: see GEOM_TestAll.py
3536 if theScaleFactor > 0:
3537 theScaleFactor,Parameters = ParseParameters(theScaleFactor)
3538 anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor)
3540 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
3541 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
3542 anObj.SetParameters(Parameters)
3543 self._autoPublish(anObj, theName, "prism")
3546 ## Create a shape by extrusion of the base shape along a
3547 # vector, defined by two points, in 2 Ways (forward/backward).
3548 # @param theBase Base shape to be extruded.
3549 # @param thePoint1 First end of extrusion vector.
3550 # @param thePoint2 Second end of extrusion vector.
3551 # @param theName Object name; when specified, this parameter is used
3552 # for result publication in the study. Otherwise, if automatic
3553 # publication is switched on, default value is used for result name.
3555 # @return New GEOM.GEOM_Object, containing the created prism.
3557 # @ref tui_creation_prism "Example"
3558 @ManageTransactions("PrimOp")
3559 def MakePrism2Ways(self, theBase, thePoint1, thePoint2, theName=None):
3561 Create a shape by extrusion of the base shape along a
3562 vector, defined by two points, in 2 Ways (forward/backward).
3565 theBase Base shape to be extruded.
3566 thePoint1 First end of extrusion vector.
3567 thePoint2 Second end of extrusion vector.
3568 theName Object name; when specified, this parameter is used
3569 for result publication in the study. Otherwise, if automatic
3570 publication is switched on, default value is used for result name.
3573 New GEOM.GEOM_Object, containing the created prism.
3575 # Example: see GEOM_TestAll.py
3576 anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
3577 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
3578 self._autoPublish(anObj, theName, "prism")
3581 ## Create a shape by extrusion of the base shape along the vector,
3582 # i.e. all the space, transfixed by the base shape during its translation
3583 # along the vector on the given distance.
3584 # @param theBase Base shape to be extruded.
3585 # @param theVec Direction of extrusion.
3586 # @param theH Prism dimension along theVec.
3587 # @param theScaleFactor Use it to make prism with scaled second base.
3588 # Negative value means not scaled second base.
3589 # @param theName Object name; when specified, this parameter is used
3590 # for result publication in the study. Otherwise, if automatic
3591 # publication is switched on, default value is used for result name.
3593 # @return New GEOM.GEOM_Object, containing the created prism.
3595 # @ref tui_creation_prism "Example"
3596 @ManageTransactions("PrimOp")
3597 def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0, theName=None):
3599 Create a shape by extrusion of the base shape along the vector,
3600 i.e. all the space, transfixed by the base shape during its translation
3601 along the vector on the given distance.
3604 theBase Base shape to be extruded.
3605 theVec Direction of extrusion.
3606 theH Prism dimension along theVec.
3607 theScaleFactor Use it to make prism with scaled second base.
3608 Negative value means not scaled second base.
3609 theName Object name; when specified, this parameter is used
3610 for result publication in the study. Otherwise, if automatic
3611 publication is switched on, default value is used for result name.
3614 New GEOM.GEOM_Object, containing the created prism.
3616 # Example: see GEOM_TestAll.py
3619 if theScaleFactor > 0:
3620 theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor)
3621 anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor)
3623 theH,Parameters = ParseParameters(theH)
3624 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
3625 RaiseIfFailed("MakePrismVecH", self.PrimOp)
3626 anObj.SetParameters(Parameters)
3627 self._autoPublish(anObj, theName, "prism")
3630 ## Create a shape by extrusion of the base shape along the vector,
3631 # i.e. all the space, transfixed by the base shape during its translation
3632 # along the vector on the given distance in 2 Ways (forward/backward).
3633 # @param theBase Base shape to be extruded.
3634 # @param theVec Direction of extrusion.
3635 # @param theH Prism dimension along theVec in forward direction.
3636 # @param theName Object name; when specified, this parameter is used
3637 # for result publication in the study. Otherwise, if automatic
3638 # publication is switched on, default value is used for result name.
3640 # @return New GEOM.GEOM_Object, containing the created prism.
3642 # @ref tui_creation_prism "Example"
3643 @ManageTransactions("PrimOp")
3644 def MakePrismVecH2Ways(self, theBase, theVec, theH, theName=None):
3646 Create a shape by extrusion of the base shape along the vector,
3647 i.e. all the space, transfixed by the base shape during its translation
3648 along the vector on the given distance in 2 Ways (forward/backward).
3651 theBase Base shape to be extruded.
3652 theVec Direction of extrusion.
3653 theH Prism dimension along theVec in forward direction.
3654 theName Object name; when specified, this parameter is used
3655 for result publication in the study. Otherwise, if automatic
3656 publication is switched on, default value is used for result name.
3659 New GEOM.GEOM_Object, containing the created prism.
3661 # Example: see GEOM_TestAll.py
3662 theH,Parameters = ParseParameters(theH)
3663 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
3664 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
3665 anObj.SetParameters(Parameters)
3666 self._autoPublish(anObj, theName, "prism")
3669 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
3670 # @param theBase Base shape to be extruded.
3671 # @param theDX, theDY, theDZ Directions of extrusion.
3672 # @param theScaleFactor Use it to make prism with scaled second base.
3673 # Nagative value means not scaled second base.
3674 # @param theName Object name; when specified, this parameter is used
3675 # for result publication in the study. Otherwise, if automatic
3676 # publication is switched on, default value is used for result name.
3678 # @return New GEOM.GEOM_Object, containing the created prism.
3680 # @ref tui_creation_prism "Example"
3681 @ManageTransactions("PrimOp")
3682 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0, theName=None):
3684 Create a shape by extrusion of the base shape along the dx, dy, dz direction
3687 theBase Base shape to be extruded.
3688 theDX, theDY, theDZ Directions of extrusion.
3689 theScaleFactor Use it to make prism with scaled second base.
3690 Nagative value means not scaled second base.
3691 theName Object name; when specified, this parameter is used
3692 for result publication in the study. Otherwise, if automatic
3693 publication is switched on, default value is used for result name.
3696 New GEOM.GEOM_Object, containing the created prism.
3698 # Example: see GEOM_TestAll.py
3701 if theScaleFactor > 0:
3702 theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor)
3703 anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor)
3705 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
3706 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
3707 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
3708 anObj.SetParameters(Parameters)
3709 self._autoPublish(anObj, theName, "prism")
3712 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
3713 # i.e. all the space, transfixed by the base shape during its translation
3714 # along the vector on the given distance in 2 Ways (forward/backward).
3715 # @param theBase Base shape to be extruded.
3716 # @param theDX, theDY, theDZ Directions of extrusion.
3717 # @param theName Object name; when specified, this parameter is used
3718 # for result publication in the study. Otherwise, if automatic
3719 # publication is switched on, default value is used for result name.
3721 # @return New GEOM.GEOM_Object, containing the created prism.
3723 # @ref tui_creation_prism "Example"
3724 @ManageTransactions("PrimOp")
3725 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ, theName=None):
3727 Create a shape by extrusion of the base shape along the dx, dy, dz direction
3728 i.e. all the space, transfixed by the base shape during its translation
3729 along the vector on the given distance in 2 Ways (forward/backward).
3732 theBase Base shape to be extruded.
3733 theDX, theDY, theDZ Directions of extrusion.
3734 theName Object name; when specified, this parameter is used
3735 for result publication in the study. Otherwise, if automatic
3736 publication is switched on, default value is used for result name.
3739 New GEOM.GEOM_Object, containing the created prism.
3741 # Example: see GEOM_TestAll.py
3742 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
3743 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
3744 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
3745 anObj.SetParameters(Parameters)
3746 self._autoPublish(anObj, theName, "prism")
3749 ## Create a shape by revolution of the base shape around the axis
3750 # on the given angle, i.e. all the space, transfixed by the base
3751 # shape during its rotation around the axis on the given angle.
3752 # @param theBase Base shape to be rotated.
3753 # @param theAxis Rotation axis.
3754 # @param theAngle Rotation angle in radians.
3755 # @param theName Object name; when specified, this parameter is used
3756 # for result publication in the study. Otherwise, if automatic
3757 # publication is switched on, default value is used for result name.
3759 # @return New GEOM.GEOM_Object, containing the created revolution.
3761 # @ref tui_creation_revolution "Example"
3762 @ManageTransactions("PrimOp")
3763 def MakeRevolution(self, theBase, theAxis, theAngle, theName=None):
3765 Create a shape by revolution of the base shape around the axis
3766 on the given angle, i.e. all the space, transfixed by the base
3767 shape during its rotation around the axis on the given angle.
3770 theBase Base shape to be rotated.
3771 theAxis Rotation axis.
3772 theAngle Rotation angle in radians.
3773 theName Object name; when specified, this parameter is used
3774 for result publication in the study. Otherwise, if automatic
3775 publication is switched on, default value is used for result name.
3778 New GEOM.GEOM_Object, containing the created revolution.
3780 # Example: see GEOM_TestAll.py
3781 theAngle,Parameters = ParseParameters(theAngle)
3782 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
3783 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
3784 anObj.SetParameters(Parameters)
3785 self._autoPublish(anObj, theName, "revolution")
3788 ## Create a shape by revolution of the base shape around the axis
3789 # on the given angle, i.e. all the space, transfixed by the base
3790 # shape during its rotation around the axis on the given angle in
3791 # both directions (forward/backward)
3792 # @param theBase Base shape to be rotated.
3793 # @param theAxis Rotation axis.
3794 # @param theAngle Rotation angle in radians.
3795 # @param theName Object name; when specified, this parameter is used
3796 # for result publication in the study. Otherwise, if automatic
3797 # publication is switched on, default value is used for result name.
3799 # @return New GEOM.GEOM_Object, containing the created revolution.
3801 # @ref tui_creation_revolution "Example"
3802 @ManageTransactions("PrimOp")
3803 def MakeRevolution2Ways(self, theBase, theAxis, theAngle, theName=None):
3805 Create a shape by revolution of the base shape around the axis
3806 on the given angle, i.e. all the space, transfixed by the base
3807 shape during its rotation around the axis on the given angle in
3808 both directions (forward/backward).
3811 theBase Base shape to be rotated.
3812 theAxis Rotation axis.
3813 theAngle Rotation angle in radians.
3814 theName Object name; when specified, this parameter is used
3815 for result publication in the study. Otherwise, if automatic
3816 publication is switched on, default value is used for result name.
3819 New GEOM.GEOM_Object, containing the created revolution.
3821 theAngle,Parameters = ParseParameters(theAngle)
3822 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
3823 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
3824 anObj.SetParameters(Parameters)
3825 self._autoPublish(anObj, theName, "revolution")
3828 ## Create a face from a given set of contours.
3829 # @param theContours either a list or a compound of edges/wires.
3830 # @param theMinDeg a minimal degree of BSpline surface to create.
3831 # @param theMaxDeg a maximal degree of BSpline surface to create.
3832 # @param theTol2D a 2d tolerance to be reached.
3833 # @param theTol3D a 3d tolerance to be reached.
3834 # @param theNbIter a number of iteration of approximation algorithm.
3835 # @param theMethod Kind of method to perform filling operation
3836 # (see GEOM.filling_oper_method enum).
3837 # @param isApprox if True, BSpline curves are generated in the process
3838 # of surface construction. By default it is False, that means
3839 # the surface is created using given curves. The usage of
3840 # Approximation makes the algorithm work slower, but allows
3841 # building the surface for rather complex cases.
3842 # @param theName Object name; when specified, this parameter is used
3843 # for result publication in the study. Otherwise, if automatic
3844 # publication is switched on, default value is used for result name.
3846 # @return New GEOM.GEOM_Object (face), containing the created filling surface.
3848 # @ref tui_creation_filling "Example"
3849 @ManageTransactions("PrimOp")
3850 def MakeFilling(self, theContours, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001,
3851 theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0, theName=None):
3853 Create a face from a given set of contours.
3856 theContours either a list or a compound of edges/wires.
3857 theMinDeg a minimal degree of BSpline surface to create.
3858 theMaxDeg a maximal degree of BSpline surface to create.
3859 theTol2D a 2d tolerance to be reached.
3860 theTol3D a 3d tolerance to be reached.
3861 theNbIter a number of iteration of approximation algorithm.
3862 theMethod Kind of method to perform filling operation
3863 (see GEOM.filling_oper_method enum).
3864 isApprox if True, BSpline curves are generated in the process
3865 of surface construction. By default it is False, that means
3866 the surface is created using given curves. The usage of
3867 Approximation makes the algorithm work slower, but allows
3868 building the surface for rather complex cases.
3869 theName Object name; when specified, this parameter is used
3870 for result publication in the study. Otherwise, if automatic
3871 publication is switched on, default value is used for result name.
3874 New GEOM.GEOM_Object (face), containing the created filling surface.
3877 filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5)
3879 # Example: see GEOM_TestAll.py
3880 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
3881 anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
3882 theTol2D, theTol3D, theNbIter,
3883 theMethod, isApprox)
3884 RaiseIfFailed("MakeFilling", self.PrimOp)
3885 anObj.SetParameters(Parameters)
3886 self._autoPublish(anObj, theName, "filling")
3890 ## Create a face from a given set of contours.
3891 # This method corresponds to MakeFilling() with isApprox=True.
3892 # @param theContours either a list or a compound of edges/wires.
3893 # @param theMinDeg a minimal degree of BSpline surface to create.
3894 # @param theMaxDeg a maximal degree of BSpline surface to create.
3895 # @param theTol3D a 3d tolerance to be reached.
3896 # @param theName Object name; when specified, this parameter is used
3897 # for result publication in the study. Otherwise, if automatic
3898 # publication is switched on, default value is used for result name.
3900 # @return New GEOM.GEOM_Object (face), containing the created filling surface.
3902 # @ref tui_creation_filling "Example"
3903 @ManageTransactions("PrimOp")
3904 def MakeFillingNew(self, theContours, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None):
3906 Create a filling from the given compound of contours.
3907 This method corresponds to MakeFilling() with isApprox=True.
3910 theContours either a list or a compound of edges/wires.
3911 theMinDeg a minimal degree of BSpline surface to create.
3912 theMaxDeg a maximal degree of BSpline surface to create.
3913 theTol3D a 3d tolerance to be reached.
3914 theName Object name; when specified, this parameter is used
3915 for result publication in the study. Otherwise, if automatic
3916 publication is switched on, default value is used for result name.
3919 New GEOM.GEOM_Object (face), containing the created filling surface.
3922 filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001)
3924 # Example: see GEOM_TestAll.py
3925 theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D)
3926 anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
3927 0, theTol3D, 0, GEOM.FOM_Default, True)
3928 RaiseIfFailed("MakeFillingNew", self.PrimOp)
3929 anObj.SetParameters(Parameters)
3930 self._autoPublish(anObj, theName, "filling")
3933 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
3934 # @param theSeqSections - set of specified sections.
3935 # @param theModeSolid - mode defining building solid or shell
3936 # @param thePreci - precision 3D used for smoothing
3937 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
3938 # @param theName Object name; when specified, this parameter is used
3939 # for result publication in the study. Otherwise, if automatic
3940 # publication is switched on, default value is used for result name.
3942 # @return New GEOM.GEOM_Object, containing the created shell or solid.
3944 # @ref swig_todo "Example"
3945 @ManageTransactions("PrimOp")
3946 def MakeThruSections(self, theSeqSections, theModeSolid, thePreci, theRuled, theName=None):
3948 Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
3951 theSeqSections - set of specified sections.
3952 theModeSolid - mode defining building solid or shell
3953 thePreci - precision 3D used for smoothing
3954 theRuled - mode defining type of the result surfaces (ruled or smoothed).
3955 theName Object name; when specified, this parameter is used
3956 for result publication in the study. Otherwise, if automatic
3957 publication is switched on, default value is used for result name.
3960 New GEOM.GEOM_Object, containing the created shell or solid.
3962 # Example: see GEOM_TestAll.py
3963 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
3964 RaiseIfFailed("MakeThruSections", self.PrimOp)
3965 self._autoPublish(anObj, theName, "filling")
3968 ## Create a shape by extrusion of the base shape along
3969 # the path shape. The path shape can be a wire or an edge. It is
3970 # possible to generate groups along with the result by means of
3971 # setting the flag \a IsGenerateGroups.<BR>
3972 # If \a thePath is a closed edge or wire and \a IsGenerateGroups is
3973 # set, an error is occurred. If \a thePath is not closed edge/wire,
3974 # the following groups are returned:
3975 # - If \a theBase is unclosed edge or wire: "Down", "Up", "Side1",
3977 # - If \a theBase is closed edge or wire, face or shell: "Down", "Up",
3980 # "Down" and "Up" groups contain:
3981 # - Edges if \a theBase is edge or wire;
3982 # - Faces if \a theBase is face or shell.<BR>
3984 # "Side1" and "Side2" groups contain edges generated from the first
3985 # and last vertices of \a theBase. The first and last vertices are
3986 # determined taking into account edge/wire orientation.<BR>
3987 # "Other" group represents faces generated from the bounding edges of
3990 # @param theBase Base shape to be extruded.
3991 # @param thePath Path shape to extrude the base shape along it.
3992 # @param IsGenerateGroups flag that tells if it is necessary to
3993 # create groups. It is equal to False by default.
3994 # @param theName Object name; when specified, this parameter is used
3995 # for result publication in the study. Otherwise, if automatic
3996 # publication is switched on, default value is used for result name.
3998 # @return New GEOM.GEOM_Object, containing the created pipe if
3999 # \a IsGenerateGroups is not set. Otherwise it returns a
4000 # list of GEOM.GEOM_Object. Its first element is the created pipe, the
4001 # remaining ones are created groups.
4003 # @ref tui_creation_pipe "Example"
4004 @ManageTransactions("PrimOp")
4005 def MakePipe(self, theBase, thePath,
4006 IsGenerateGroups=False, theName=None):
4008 Create a shape by extrusion of the base shape along
4009 the path shape. The path shape can be a wire or an edge. It is
4010 possible to generate groups along with the result by means of
4011 setting the flag IsGenerateGroups.
4012 If thePath is a closed edge or wire and IsGenerateGroups is
4013 set, an error is occurred. If thePath is not closed edge/wire,
4014 the following groups are returned:
4015 - If theBase is unclosed edge or wire: "Down", "Up", "Side1",
4017 - If theBase is closed edge or wire, face or shell: "Down", "Up",
4019 "Down" and "Up" groups contain:
4020 - Edges if theBase is edge or wire;
4021 - Faces if theBase is face or shell.
4022 "Side1" and "Side2" groups contain edges generated from the first
4023 and last vertices of theBase. The first and last vertices are
4024 determined taking into account edge/wire orientation.
4025 "Other" group represents faces generated from the bounding edges of
4029 theBase Base shape to be extruded.
4030 thePath Path shape to extrude the base shape along it.
4031 IsGenerateGroups flag that tells if it is necessary to
4032 create groups. It is equal to False by default.
4033 theName Object name; when specified, this parameter is used
4034 for result publication in the study. Otherwise, if automatic
4035 publication is switched on, default value is used for result name.
4038 New GEOM.GEOM_Object, containing the created pipe if
4039 IsGenerateGroups is not set. Otherwise it returns a
4040 list of GEOM.GEOM_Object. Its first element is the created pipe, the
4041 remaining ones are created groups.
4043 # Example: see GEOM_TestAll.py
4044 aList = self.PrimOp.MakePipe(theBase, thePath, IsGenerateGroups)
4045 RaiseIfFailed("MakePipe", self.PrimOp)
4047 if IsGenerateGroups:
4048 self._autoPublish(aList, theName, "pipe")
4051 self._autoPublish(aList[0], theName, "pipe")
4054 ## Create a shape by extrusion of the profile shape along
4055 # the path shape. The path shape can be a wire or an edge.
4056 # the several profiles can be specified in the several locations of path.
4057 # It is possible to generate groups along with the result by means of
4058 # setting the flag \a IsGenerateGroups. For detailed information on
4059 # groups that can be created please see the method MakePipe().
4060 # @param theSeqBases - list of Bases shape to be extruded.
4061 # @param theLocations - list of locations on the path corresponding
4062 # specified list of the Bases shapes. Number of locations
4063 # should be equal to number of bases or list of locations can be empty.
4064 # @param thePath - Path shape to extrude the base shape along it.
4065 # @param theWithContact - the mode defining that the section is translated to be in
4066 # contact with the spine.
4067 # @param theWithCorrection - defining that the section is rotated to be
4068 # orthogonal to the spine tangent in the correspondent point
4069 # @param IsGenerateGroups - flag that tells if it is necessary to
4070 # create groups. It is equal to False by default.
4071 # @param theName Object name; when specified, this parameter is used
4072 # for result publication in the study. Otherwise, if automatic
4073 # publication is switched on, default value is used for result name.
4075 # @return New GEOM.GEOM_Object, containing the created pipe if
4076 # \a IsGenerateGroups is not set. Otherwise it returns new
4077 # GEOM.ListOfGO. Its first element is the created pipe, the
4078 # remaining ones are created groups.
4080 # @ref tui_creation_pipe_with_diff_sec "Example"
4081 @ManageTransactions("PrimOp")
4082 def MakePipeWithDifferentSections(self, theSeqBases,
4083 theLocations, thePath,
4084 theWithContact, theWithCorrection,
4085 IsGenerateGroups=False, theName=None):
4087 Create a shape by extrusion of the profile shape along
4088 the path shape. The path shape can be a wire or an edge.
4089 the several profiles can be specified in the several locations of path.
4090 It is possible to generate groups along with the result by means of
4091 setting the flag IsGenerateGroups. For detailed information on
4092 groups that can be created please see the method geompy.MakePipe().
4095 theSeqBases - list of Bases shape to be extruded.
4096 theLocations - list of locations on the path corresponding
4097 specified list of the Bases shapes. Number of locations
4098 should be equal to number of bases or list of locations can be empty.
4099 thePath - Path shape to extrude the base shape along it.
4100 theWithContact - the mode defining that the section is translated to be in
4101 contact with the spine(0/1)
4102 theWithCorrection - defining that the section is rotated to be
4103 orthogonal to the spine tangent in the correspondent point (0/1)
4104 IsGenerateGroups - flag that tells if it is necessary to
4105 create groups. It is equal to False by default.
4106 theName Object name; when specified, this parameter is used
4107 for result publication in the study. Otherwise, if automatic
4108 publication is switched on, default value is used for result name.
4111 New GEOM.GEOM_Object, containing the created pipe if
4112 IsGenerateGroups is not set. Otherwise it returns new
4113 GEOM.ListOfGO. Its first element is the created pipe, the
4114 remaining ones are created groups.
4116 aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
4117 theLocations, thePath,
4118 theWithContact, theWithCorrection,
4119 False, IsGenerateGroups)
4120 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
4122 if IsGenerateGroups:
4123 self._autoPublish(aList, theName, "pipe")
4126 self._autoPublish(aList[0], theName, "pipe")
4129 ## Create a shape by extrusion of the profile shape along
4130 # the path shape. This function is a version of
4131 # MakePipeWithDifferentSections() with the same parameters, except
4132 # eliminated theWithContact and theWithCorrection. So it is
4133 # possible to find the description of all parameters is in this
4134 # method. The difference is that this method performs the operation
4135 # step by step, i.e. it creates pipes between each pair of neighbor
4136 # sections and fuses them into a single shape.
4138 # @ref tui_creation_pipe_with_diff_sec "Example"
4139 @ManageTransactions("PrimOp")
4140 def MakePipeWithDifferentSectionsBySteps(self, theSeqBases,
4141 theLocations, thePath,
4142 IsGenerateGroups=False, theName=None):
4144 Create a shape by extrusion of the profile shape along
4145 the path shape. This function is a version of
4146 MakePipeWithDifferentSections() with the same parameters, except
4147 eliminated theWithContact and theWithCorrection. So it is
4148 possible to find the description of all parameters is in this
4149 method. The difference is that this method performs the operation
4150 step by step, i.e. it creates pipes between each pair of neighbor
4151 sections and fuses them into a single shape.
4153 aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
4154 theLocations, thePath,
4156 True, IsGenerateGroups)
4157 RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp)
4159 if IsGenerateGroups:
4160 self._autoPublish(aList, theName, "pipe")
4163 self._autoPublish(aList[0], theName, "pipe")
4166 ## Create a shape by extrusion of the profile shape along
4167 # the path shape. The path shape can be a wire or an edge.
4168 # the several profiles can be specified in the several locations of path.
4169 # It is possible to generate groups along with the result by means of
4170 # setting the flag \a IsGenerateGroups. For detailed information on
4171 # groups that can be created please see the method MakePipe().
4172 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
4173 # shell or face. If number of faces in neighbour sections
4174 # aren't coincided result solid between such sections will
4175 # be created using external boundaries of this shells.
4176 # @param theSeqSubBases - list of corresponding sub-shapes of section shapes.
4177 # This list is used for searching correspondences between
4178 # faces in the sections. Size of this list must be equal
4179 # to size of list of base shapes.
4180 # @param theLocations - list of locations on the path corresponding
4181 # specified list of the Bases shapes. Number of locations
4182 # should be equal to number of bases. First and last
4183 # locations must be coincided with first and last vertexes
4184 # of path correspondingly.
4185 # @param thePath - Path shape to extrude the base shape along it.
4186 # @param theWithContact - the mode defining that the section is translated to be in
4187 # contact with the spine.
4188 # @param theWithCorrection - defining that the section is rotated to be
4189 # orthogonal to the spine tangent in the correspondent point
4190 # @param IsGenerateGroups - flag that tells if it is necessary to
4191 # create groups. It is equal to False by default.
4192 # @param theName Object name; when specified, this parameter is used
4193 # for result publication in the study. Otherwise, if automatic
4194 # publication is switched on, default value is used for result name.
4196 # @return New GEOM.GEOM_Object, containing the created solids if
4197 # \a IsGenerateGroups is not set. Otherwise it returns new
4198 # GEOM.ListOfGO. Its first element is the created solids, the
4199 # remaining ones are created groups.
4201 # @ref tui_creation_pipe_with_shell_sec "Example"
4202 @ManageTransactions("PrimOp")
4203 def MakePipeWithShellSections(self, theSeqBases, theSeqSubBases,
4204 theLocations, thePath,
4205 theWithContact, theWithCorrection,
4206 IsGenerateGroups=False, theName=None):
4208 Create a shape by extrusion of the profile shape along
4209 the path shape. The path shape can be a wire or an edge.
4210 the several profiles can be specified in the several locations of path.
4211 It is possible to generate groups along with the result by means of
4212 setting the flag IsGenerateGroups. For detailed information on
4213 groups that can be created please see the method geompy.MakePipe().
4216 theSeqBases - list of Bases shape to be extruded. Base shape must be
4217 shell or face. If number of faces in neighbour sections
4218 aren't coincided result solid between such sections will
4219 be created using external boundaries of this shells.
4220 theSeqSubBases - list of corresponding sub-shapes of section shapes.
4221 This list is used for searching correspondences between
4222 faces in the sections. Size of this list must be equal
4223 to size of list of base shapes.
4224 theLocations - list of locations on the path corresponding
4225 specified list of the Bases shapes. Number of locations
4226 should be equal to number of bases. First and last
4227 locations must be coincided with first and last vertexes
4228 of path correspondingly.
4229 thePath - Path shape to extrude the base shape along it.
4230 theWithContact - the mode defining that the section is translated to be in
4231 contact with the spine (0/1)
4232 theWithCorrection - defining that the section is rotated to be
4233 orthogonal to the spine tangent in the correspondent point (0/1)
4234 IsGenerateGroups - flag that tells if it is necessary to
4235 create groups. It is equal to False by default.
4236 theName Object name; when specified, this parameter is used
4237 for result publication in the study. Otherwise, if automatic
4238 publication is switched on, default value is used for result name.
4241 New GEOM.GEOM_Object, containing the created solids if
4242 IsGenerateGroups is not set. Otherwise it returns new
4243 GEOM.ListOfGO. Its first element is the created solids, the
4244 remaining ones are created groups.
4246 aList = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
4247 theLocations, thePath,
4248 theWithContact, theWithCorrection,
4250 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
4252 if IsGenerateGroups:
4253 self._autoPublish(aList, theName, "pipe")
4256 self._autoPublish(aList[0], theName, "pipe")
4259 ## Create a shape by extrusion of the profile shape along
4260 # the path shape. This function is used only for debug pipe
4261 # functionality - it is a version of function MakePipeWithShellSections()
4262 # which give a possibility to receive information about
4263 # creating pipe between each pair of sections step by step.
4264 @ManageTransactions("PrimOp")
4265 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
4266 theLocations, thePath,
4267 theWithContact, theWithCorrection,
4268 IsGenerateGroups=False, theName=None):
4270 Create a shape by extrusion of the profile shape along
4271 the path shape. This function is used only for debug pipe
4272 functionality - it is a version of previous function
4273 geompy.MakePipeWithShellSections() which give a possibility to
4274 receive information about creating pipe between each pair of
4275 sections step by step.
4278 nbsect = len(theSeqBases)
4279 nbsubsect = len(theSeqSubBases)
4280 #print "nbsect = ",nbsect
4281 for i in range(1,nbsect):
4283 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
4284 tmpLocations = [ theLocations[i-1], theLocations[i] ]
4286 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
4287 aList = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
4288 tmpLocations, thePath,
4289 theWithContact, theWithCorrection,
4291 if self.PrimOp.IsDone() == 0:
4292 print("Problems with pipe creation between ",i," and ",i+1," sections")
4293 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
4296 print("Pipe between ",i," and ",i+1," sections is OK")
4297 res.append(aList[0])
4301 resc = self.MakeCompound(res)
4302 #resc = self.MakeSewing(res, 0.001)
4303 #print "resc: ",resc
4304 self._autoPublish(resc, theName, "pipe")
4307 ## Create solids between given sections.
4308 # It is possible to generate groups along with the result by means of
4309 # setting the flag \a IsGenerateGroups. For detailed information on
4310 # groups that can be created please see the method MakePipe().
4311 # @param theSeqBases - list of sections (shell or face).
4312 # @param theLocations - list of corresponding vertexes
4313 # @param IsGenerateGroups - flag that tells if it is necessary to
4314 # create groups. It is equal to False by default.
4315 # @param theName Object name; when specified, this parameter is used
4316 # for result publication in the study. Otherwise, if automatic
4317 # publication is switched on, default value is used for result name.
4319 # @return New GEOM.GEOM_Object, containing the created solids if
4320 # \a IsGenerateGroups is not set. Otherwise it returns new
4321 # GEOM.ListOfGO. Its first element is the created solids, the
4322 # remaining ones are created groups.
4324 # @ref tui_creation_pipe_without_path "Example"
4325 @ManageTransactions("PrimOp")
4326 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations,
4327 IsGenerateGroups=False, theName=None):
4329 Create solids between given sections.
4330 It is possible to generate groups along with the result by means of
4331 setting the flag IsGenerateGroups. For detailed information on
4332 groups that can be created please see the method geompy.MakePipe().
4335 theSeqBases - list of sections (shell or face).
4336 theLocations - list of corresponding vertexes
4337 IsGenerateGroups - flag that tells if it is necessary to
4338 create groups. It is equal to False by default.
4339 theName Object name; when specified, this parameter is used
4340 for result publication in the study. Otherwise, if automatic
4341 publication is switched on, default value is used for result name.
4344 New GEOM.GEOM_Object, containing the created solids if
4345 IsGenerateGroups is not set. Otherwise it returns new
4346 GEOM.ListOfGO. Its first element is the created solids, the
4347 remaining ones are created groups.
4349 aList = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations,
4351 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
4353 if IsGenerateGroups:
4354 self._autoPublish(aList, theName, "pipe")
4357 self._autoPublish(aList[0], theName, "pipe")
4360 ## Create a shape by extrusion of the base shape along
4361 # the path shape with constant bi-normal direction along the given vector.
4362 # The path shape can be a wire or an edge.
4363 # It is possible to generate groups along with the result by means of
4364 # setting the flag \a IsGenerateGroups. For detailed information on
4365 # groups that can be created please see the method MakePipe().
4366 # @param theBase Base shape to be extruded.
4367 # @param thePath Path shape to extrude the base shape along it.
4368 # @param theVec Vector defines a constant binormal direction to keep the
4369 # same angle between the direction and the sections
4370 # along the sweep surface.
4371 # @param IsGenerateGroups flag that tells if it is necessary to
4372 # create groups. It is equal to False by default.
4373 # @param theName Object name; when specified, this parameter is used
4374 # for result publication in the study. Otherwise, if automatic
4375 # publication is switched on, default value is used for result name.
4377 # @return New GEOM.GEOM_Object, containing the created pipe if
4378 # \a IsGenerateGroups is not set. Otherwise it returns new
4379 # GEOM.ListOfGO. Its first element is the created pipe, the
4380 # remaining ones are created groups.
4382 # @ref tui_creation_pipe "Example"
4383 @ManageTransactions("PrimOp")
4384 def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec,
4385 IsGenerateGroups=False, theName=None):
4387 Create a shape by extrusion of the base shape along
4388 the path shape with constant bi-normal direction along the given vector.
4389 The path shape can be a wire or an edge.
4390 It is possible to generate groups along with the result by means of
4391 setting the flag IsGenerateGroups. For detailed information on
4392 groups that can be created please see the method geompy.MakePipe().
4395 theBase Base shape to be extruded.
4396 thePath Path shape to extrude the base shape along it.
4397 theVec Vector defines a constant binormal direction to keep the
4398 same angle between the direction and the sections
4399 along the sweep surface.
4400 IsGenerateGroups flag that tells if it is necessary to
4401 create groups. It is equal to False by default.
4402 theName Object name; when specified, this parameter is used
4403 for result publication in the study. Otherwise, if automatic
4404 publication is switched on, default value is used for result name.
4407 New GEOM.GEOM_Object, containing the created pipe if
4408 IsGenerateGroups is not set. Otherwise it returns new
4409 GEOM.ListOfGO. Its first element is the created pipe, the
4410 remaining ones are created groups.
4412 # Example: see GEOM_TestAll.py
4413 aList = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath,
4414 theVec, IsGenerateGroups)
4415 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
4417 if IsGenerateGroups:
4418 self._autoPublish(aList, theName, "pipe")
4421 self._autoPublish(aList[0], theName, "pipe")
4424 ## Makes a thick solid from a shape. If the input is a surface shape
4425 # (face or shell) the result is a thick solid. If an input shape is
4426 # a solid the result is a hollowed solid with removed faces.
4427 # @param theShape Face or Shell to get thick solid or solid to get
4429 # @param theThickness Thickness of the resulting solid
4430 # @param theFacesIDs the list of face IDs to be removed from the
4431 # result. It is ignored if \a theShape is a face or a shell.
4432 # It is empty by default.
4433 # @param theInside If true the thickness is applied towards inside
4434 # @param theName Object name; when specified, this parameter is used
4435 # for result publication in the study. Otherwise, if automatic
4436 # publication is switched on, default value is used for result name.
4438 # @return New GEOM.GEOM_Object, containing the created solid
4440 # @ref tui_creation_thickness "Example"
4441 @ManageTransactions("PrimOp")
4442 def MakeThickSolid(self, theShape, theThickness,
4443 theFacesIDs=[], theInside=False, theName=None):
4445 Make a thick solid from a shape. If the input is a surface shape
4446 (face or shell) the result is a thick solid. If an input shape is
4447 a solid the result is a hollowed solid with removed faces.
4450 theShape Face or Shell to get thick solid or solid to get
4452 theThickness Thickness of the resulting solid
4453 theFacesIDs the list of face IDs to be removed from the
4454 result. It is ignored if theShape is a face or a
4455 shell. It is empty by default.
4456 theInside If true the thickness is applied towards inside
4457 theName Object name; when specified, this parameter is used
4458 for result publication in the study. Otherwise, if automatic
4459 publication is switched on, default value is used for result name.
4462 New GEOM.GEOM_Object, containing the created solid
4464 # Example: see GEOM_TestAll.py
4465 theThickness,Parameters = ParseParameters(theThickness)
4466 anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
4467 theThickness, True, theInside)
4468 RaiseIfFailed("MakeThickSolid", self.PrimOp)
4469 anObj.SetParameters(Parameters)
4470 self._autoPublish(anObj, theName, "thickSolid")
4474 ## Modifies a shape to make it a thick solid. If the input is a surface
4475 # shape (face or shell) the result is a thick solid. If an input shape
4476 # is a solid the result is a hollowed solid with removed faces.
4477 # @param theShape Face or Shell to get thick solid or solid to get
4479 # @param theThickness Thickness of the resulting solid
4480 # @param theFacesIDs the list of face IDs to be removed from the
4481 # result. It is ignored if \a theShape is a face or a shell.
4482 # It is empty by default.
4483 # @param theInside If true the thickness is applied towards inside
4485 # @return The modified shape
4487 # @ref tui_creation_thickness "Example"
4488 @ManageTransactions("PrimOp")
4489 def Thicken(self, theShape, theThickness, theFacesIDs=[], theInside=False):
4491 Modifies a shape to make it a thick solid. If the input is a
4492 surface shape (face or shell) the result is a thick solid. If
4493 an input shape is a solid the result is a hollowed solid with
4497 theShape Face or Shell to get thick solid or solid to get
4499 theThickness Thickness of the resulting solid
4500 theFacesIDs the list of face IDs to be removed from the
4501 result. It is ignored if \a theShape is a face or
4502 a shell. It is empty by default.
4503 theInside If true the thickness is applied towards inside
4508 # Example: see GEOM_TestAll.py
4509 theThickness,Parameters = ParseParameters(theThickness)
4510 anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
4511 theThickness, False, theInside)
4512 RaiseIfFailed("Thicken", self.PrimOp)
4513 anObj.SetParameters(Parameters)
4516 ## Build a middle path of a pipe-like shape.
4517 # The path shape can be a wire or an edge.
4518 # @param theShape It can be closed or unclosed pipe-like shell
4519 # or a pipe-like solid.
4520 # @param theBase1, theBase2 Two bases of the supposed pipe. This
4521 # should be wires or faces of theShape.
4522 # @param theName Object name; when specified, this parameter is used
4523 # for result publication in the study. Otherwise, if automatic
4524 # publication is switched on, default value is used for result name.
4526 # @note It is not assumed that exact or approximate copy of theShape
4527 # can be obtained by applying existing Pipe operation on the
4528 # resulting "Path" wire taking theBase1 as the base - it is not
4529 # always possible; though in some particular cases it might work
4530 # it is not guaranteed. Thus, RestorePath function should not be
4531 # considered as an exact reverse operation of the Pipe.
4533 # @return New GEOM.GEOM_Object, containing an edge or wire that represent
4534 # source pipe's "path".
4536 # @ref tui_creation_pipe_path "Example"
4537 @ManageTransactions("PrimOp")
4538 def RestorePath (self, theShape, theBase1, theBase2, theName=None):
4540 Build a middle path of a pipe-like shape.
4541 The path shape can be a wire or an edge.
4544 theShape It can be closed or unclosed pipe-like shell
4545 or a pipe-like solid.
4546 theBase1, theBase2 Two bases of the supposed pipe. This
4547 should be wires or faces of theShape.
4548 theName Object name; when specified, this parameter is used
4549 for result publication in the study. Otherwise, if automatic
4550 publication is switched on, default value is used for result name.
4553 New GEOM_Object, containing an edge or wire that represent
4556 anObj = self.PrimOp.RestorePath(theShape, theBase1, theBase2)
4557 RaiseIfFailed("RestorePath", self.PrimOp)
4558 self._autoPublish(anObj, theName, "path")
4561 ## Build a middle path of a pipe-like shape.
4562 # The path shape can be a wire or an edge.
4563 # @param theShape It can be closed or unclosed pipe-like shell
4564 # or a pipe-like solid.
4565 # @param listEdges1, listEdges2 Two bases of the supposed pipe. This
4566 # should be lists of edges of theShape.
4567 # @param theName Object name; when specified, this parameter is used
4568 # for result publication in the study. Otherwise, if automatic
4569 # publication is switched on, default value is used for result name.
4571 # @note It is not assumed that exact or approximate copy of theShape
4572 # can be obtained by applying existing Pipe operation on the
4573 # resulting "Path" wire taking theBase1 as the base - it is not
4574 # always possible; though in some particular cases it might work
4575 # it is not guaranteed. Thus, RestorePath function should not be
4576 # considered as an exact reverse operation of the Pipe.
4578 # @return New GEOM.GEOM_Object, containing an edge or wire that represent
4579 # source pipe's "path".
4581 # @ref tui_creation_pipe_path "Example"
4582 @ManageTransactions("PrimOp")
4583 def RestorePathEdges (self, theShape, listEdges1, listEdges2, theName=None):
4585 Build a middle path of a pipe-like shape.
4586 The path shape can be a wire or an edge.
4589 theShape It can be closed or unclosed pipe-like shell
4590 or a pipe-like solid.
4591 listEdges1, listEdges2 Two bases of the supposed pipe. This
4592 should be lists of edges of theShape.
4593 theName Object name; when specified, this parameter is used
4594 for result publication in the study. Otherwise, if automatic
4595 publication is switched on, default value is used for result name.
4598 New GEOM_Object, containing an edge or wire that represent
4601 anObj = self.PrimOp.RestorePathEdges(theShape, listEdges1, listEdges2)
4602 RaiseIfFailed("RestorePath", self.PrimOp)
4603 self._autoPublish(anObj, theName, "path")
4609 ## @addtogroup l3_basic_go
4612 ## Create a linear edge with specified ends.
4613 # @param thePnt1 Point for the first end of edge.
4614 # @param thePnt2 Point for the second end of edge.
4615 # @param theName Object name; when specified, this parameter is used
4616 # for result publication in the study. Otherwise, if automatic
4617 # publication is switched on, default value is used for result name.
4619 # @return New GEOM.GEOM_Object, containing the created edge.
4621 # @ref tui_creation_edge "Example"
4622 @ManageTransactions("ShapesOp")
4623 def MakeEdge(self, thePnt1, thePnt2, theName=None):
4625 Create a linear edge with specified ends.
4628 thePnt1 Point for the first end of edge.
4629 thePnt2 Point for the second end of edge.
4630 theName Object name; when specified, this parameter is used
4631 for result publication in the study. Otherwise, if automatic
4632 publication is switched on, default value is used for result name.
4635 New GEOM.GEOM_Object, containing the created edge.
4637 # Example: see GEOM_TestAll.py
4638 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
4639 RaiseIfFailed("MakeEdge", self.ShapesOp)
4640 self._autoPublish(anObj, theName, "edge")
4643 ## Create a new edge, corresponding to the given length on the given curve.
4644 # @param theRefCurve The referenced curve (edge).
4645 # @param theLength Length on the referenced curve. It can be negative.
4646 # @param theStartPoint Any point can be selected for it, the new edge will begin
4647 # at the end of \a theRefCurve, close to the selected point.
4648 # If None, start from the first point of \a theRefCurve.
4649 # @param theName Object name; when specified, this parameter is used
4650 # for result publication in the study. Otherwise, if automatic
4651 # publication is switched on, default value is used for result name.
4653 # @return New GEOM.GEOM_Object, containing the created edge.
4655 # @ref tui_creation_edge "Example"
4656 @ManageTransactions("ShapesOp")
4657 def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
4659 Create a new edge, corresponding to the given length on the given curve.
4662 theRefCurve The referenced curve (edge).
4663 theLength Length on the referenced curve. It can be negative.
4664 theStartPoint Any point can be selected for it, the new edge will begin
4665 at the end of theRefCurve, close to the selected point.
4666 If None, start from the first point of theRefCurve.
4667 theName Object name; when specified, this parameter is used
4668 for result publication in the study. Otherwise, if automatic
4669 publication is switched on, default value is used for result name.
4672 New GEOM.GEOM_Object, containing the created edge.
4674 # Example: see GEOM_TestAll.py
4675 theLength, Parameters = ParseParameters(theLength)
4676 anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
4677 RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp)
4678 anObj.SetParameters(Parameters)
4679 self._autoPublish(anObj, theName, "edge")
4682 ## Create an edge from specified wire.
4683 # @param theWire source Wire
4684 # @param theLinearTolerance linear tolerance value (default = 1e-07)
4685 # @param theAngularTolerance angular tolerance value (default = 1e-12)
4686 # @param theName Object name; when specified, this parameter is used
4687 # for result publication in the study. Otherwise, if automatic
4688 # publication is switched on, default value is used for result name.
4690 # @return New GEOM.GEOM_Object, containing the created edge.
4692 # @ref tui_creation_edge "Example"
4693 @ManageTransactions("ShapesOp")
4694 def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12, theName=None):
4696 Create an edge from specified wire.
4700 theLinearTolerance linear tolerance value (default = 1e-07)
4701 theAngularTolerance angular tolerance value (default = 1e-12)
4702 theName Object name; when specified, this parameter is used
4703 for result publication in the study. Otherwise, if automatic
4704 publication is switched on, default value is used for result name.
4707 New GEOM.GEOM_Object, containing the created edge.
4709 # Example: see GEOM_TestAll.py
4710 anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
4711 RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
4712 self._autoPublish(anObj, theName, "edge")
4715 ## Create a wire from the set of edges and wires.
4716 # @param theEdgesAndWires List of edges and/or wires.
4717 # @param theTolerance Maximum distance between vertices, that will be merged.
4718 # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion())
4719 # @param theName Object name; when specified, this parameter is used
4720 # for result publication in the study. Otherwise, if automatic
4721 # publication is switched on, default value is used for result name.
4723 # @return New GEOM.GEOM_Object, containing the created wire.
4725 # @ref tui_creation_wire "Example"
4726 @ManageTransactions("ShapesOp")
4727 def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07, theName=None):
4729 Create a wire from the set of edges and wires.
4732 theEdgesAndWires List of edges and/or wires.
4733 theTolerance Maximum distance between vertices, that will be merged.
4734 Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
4735 theName Object name; when specified, this parameter is used
4736 for result publication in the study. Otherwise, if automatic
4737 publication is switched on, default value is used for result name.
4740 New GEOM.GEOM_Object, containing the created wire.
4742 # Example: see GEOM_TestAll.py
4743 anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
4744 RaiseIfFailed("MakeWire", self.ShapesOp)
4745 self._autoPublish(anObj, theName, "wire")
4748 ## Create a face on the given wire.
4749 # @param theWire closed Wire or Edge to build the face on.
4750 # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4751 # If the tolerance of the obtained planar face is less
4752 # than 1e-06, this face will be returned, otherwise the
4753 # algorithm tries to build any suitable face on the given
4754 # wire and prints a warning message.
4755 # @param theName Object name; when specified, this parameter is used
4756 # for result publication in the study. Otherwise, if automatic
4757 # publication is switched on, default value is used for result name.
4759 # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
4761 # @ref tui_creation_face "Example"
4762 @ManageTransactions("ShapesOp")
4763 def MakeFace(self, theWire, isPlanarWanted, theName=None, raiseException=False):
4765 Create a face on the given wire.
4768 theWire closed Wire or Edge to build the face on.
4769 isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4770 If the tolerance of the obtained planar face is less
4771 than 1e-06, this face will be returned, otherwise the
4772 algorithm tries to build any suitable face on the given
4773 wire and prints a warning message.
4774 theName Object name; when specified, this parameter is used
4775 for result publication in the study. Otherwise, if automatic
4776 publication is switched on, default value is used for result name.
4779 New GEOM.GEOM_Object, containing the created face (compound of faces).
4781 # Example: see GEOM_TestAll.py
4782 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
4783 if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
4784 PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
4786 RaiseIfFailed("MakeFace", self.ShapesOp)
4787 self._autoPublish(anObj, theName, "face")
4790 ## Create a face on the given wires set.
4791 # @param theWires List of closed wires or edges to build the face on.
4792 # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4793 # If the tolerance of the obtained planar face is less
4794 # than 1e-06, this face will be returned, otherwise the
4795 # algorithm tries to build any suitable face on the given
4796 # wire and prints a warning message.
4797 # @param theName Object name; when specified, this parameter is used
4798 # for result publication in the study. Otherwise, if automatic
4799 # publication is switched on, default value is used for result name.
4801 # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
4803 # @ref tui_creation_face "Example"
4804 @ManageTransactions("ShapesOp")
4805 def MakeFaceWires(self, theWires, isPlanarWanted, theName=None, raiseException=False):
4807 Create a face on the given wires set.
4810 theWires List of closed wires or edges to build the face on.
4811 isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4812 If the tolerance of the obtained planar face is less
4813 than 1e-06, this face will be returned, otherwise the
4814 algorithm tries to build any suitable face on the given
4815 wire and prints a warning message.
4816 theName Object name; when specified, this parameter is used
4817 for result publication in the study. Otherwise, if automatic
4818 publication is switched on, default value is used for result name.
4821 New GEOM.GEOM_Object, containing the created face (compound of faces).
4823 # Example: see GEOM_TestAll.py
4824 anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
4825 if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
4826 PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
4828 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
4829 self._autoPublish(anObj, theName, "face")
4832 ## See MakeFaceWires() method for details.
4834 # @ref tui_creation_face "Example 1"
4835 # \n @ref swig_MakeFaces "Example 2"
4836 def MakeFaces(self, theWires, isPlanarWanted, theName=None):
4838 See geompy.MakeFaceWires() method for details.
4840 # Example: see GEOM_TestOthers.py
4841 # note: auto-publishing is done in self.MakeFaceWires()
4842 anObj = self.MakeFaceWires(theWires, isPlanarWanted, theName)
4845 ## Create a face based on a surface from given face bounded
4847 # @param theFace the face whose surface is used to create a new face.
4848 # @param theWire the wire that will bound a new face.
4849 # @param theName Object name; when specified, this parameter is used
4850 # for result publication in the study. Otherwise, if automatic
4851 # publication is switched on, default value is used for result name.
4853 # @return New GEOM.GEOM_Object, containing the created face.
4855 # @ref tui_creation_face "Example"
4856 @ManageTransactions("ShapesOp")
4857 def MakeFaceFromSurface(self, theFace, theWire, theName=None):
4859 Create a face based on a surface from given face bounded
4863 theFace the face whose surface is used to create a new face.
4864 theWire the wire that will bound a new face.
4865 theName Object name; when specified, this parameter is used
4866 for result publication in the study. Otherwise, if automatic
4867 publication is switched on, default value is used for result name.
4870 New GEOM.GEOM_Object, containing the created face.
4872 # Example: see GEOM_TestAll.py
4873 anObj = self.ShapesOp.MakeFaceFromSurface(theFace, theWire)
4874 RaiseIfFailed("MakeFaceFromSurface", self.ShapesOp)
4875 self._autoPublish(anObj, theName, "face")
4878 ## Create a face from a set of edges with the given constraints.
4879 # @param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
4880 # - edges should form a closed wire;
4881 # - for each edge, constraint face is optional: if a constraint face is missing
4882 # for some edge, this means that there no constraint associated with this edge.
4883 # @param theName Object name; when specified, this parameter is used
4884 # for result publication in the study. Otherwise, if automatic
4885 # publication is switched on, default value is used for result name.
4887 # @return New GEOM.GEOM_Object, containing the created face.
4889 # @ref tui_creation_face "Example"
4890 @ManageTransactions("ShapesOp")
4891 def MakeFaceWithConstraints(self, theConstraints, theName=None):
4893 Create a face from a set of edges with the given constraints.
4896 theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
4897 - edges should form a closed wire;
4898 - for each edge, constraint face is optional: if a constraint face is missing
4899 for some edge, this means that there no constraint associated with this edge.
4900 theName Object name; when specified, this parameter is used
4901 for result publication in the study. Otherwise, if automatic
4902 publication is switched on, default value is used for result name.
4905 New GEOM.GEOM_Object, containing the created face.
4907 # Example: see GEOM_TestAll.py
4908 anObj = self.ShapesOp.MakeFaceWithConstraints(theConstraints)
4910 RaiseIfFailed("MakeFaceWithConstraints", self.ShapesOp)
4911 self._autoPublish(anObj, theName, "face")
4914 ## Create a shell from the set of faces, shells and/or compounds of faces.
4915 # @param theFacesAndShells List of faces, shells and/or compounds of faces.
4916 # @param theName Object name; when specified, this parameter is used
4917 # for result publication in the study. Otherwise, if automatic
4918 # publication is switched on, default value is used for result name.
4920 # @return New GEOM.GEOM_Object, containing the created shell (compound of shells).
4922 # @ref tui_creation_shell "Example"
4923 @ManageTransactions("ShapesOp")
4924 def MakeShell(self, theFacesAndShells, theName=None):
4926 Create a shell from the set of faces and shells.
4929 theFacesAndShells List of faces and/or shells.
4930 theName Object name; when specified, this parameter is used
4931 for result publication in the study. Otherwise, if automatic
4932 publication is switched on, default value is used for result name.
4935 New GEOM.GEOM_Object, containing the created shell (compound of shells).
4937 # Example: see GEOM_TestAll.py
4938 anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells ))
4939 RaiseIfFailed("MakeShell", self.ShapesOp)
4940 self._autoPublish(anObj, theName, "shell")
4943 ## Create a solid, bounded by the given shells.
4944 # @param theShells Sequence of bounding shells.
4945 # @param theName Object name; when specified, this parameter is used
4946 # for result publication in the study. Otherwise, if automatic
4947 # publication is switched on, default value is used for result name.
4949 # @return New GEOM.GEOM_Object, containing the created solid.
4951 # @ref tui_creation_solid "Example"
4952 @ManageTransactions("ShapesOp")
4953 def MakeSolid(self, theShells, theName=None):
4955 Create a solid, bounded by the given shells.
4958 theShells Sequence of bounding shells.
4959 theName Object name; when specified, this parameter is used
4960 for result publication in the study. Otherwise, if automatic
4961 publication is switched on, default value is used for result name.
4964 New GEOM.GEOM_Object, containing the created solid.
4966 # Example: see GEOM_TestAll.py
4967 theShells = ToList(theShells)
4968 if len(theShells) == 1:
4969 descr = self._IsGoodForSolid(theShells[0])
4971 # raise RuntimeError, "MakeSolidShells : " + descr
4972 if descr == "WRN_SHAPE_UNCLOSED":
4973 raise RuntimeError("MakeSolidShells : Unable to create solid from unclosed shape")
4974 anObj = self.ShapesOp.MakeSolidShells(theShells)
4975 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
4976 self._autoPublish(anObj, theName, "solid")
4979 ## Create a compound of the given shapes.
4980 # @param theShapes List of shapes to put in compound.
4981 # @param theName Object name; when specified, this parameter is used
4982 # for result publication in the study. Otherwise, if automatic
4983 # publication is switched on, default value is used for result name.
4985 # @return New GEOM.GEOM_Object, containing the created compound.
4987 # @ref tui_creation_compound "Example"
4988 @ManageTransactions("ShapesOp")
4989 def MakeCompound(self, theShapes, theName=None):
4991 Create a compound of the given shapes.
4994 theShapes List of shapes to put in compound.
4995 theName Object name; when specified, this parameter is used
4996 for result publication in the study. Otherwise, if automatic
4997 publication is switched on, default value is used for result name.
5000 New GEOM.GEOM_Object, containing the created compound.
5002 # Example: see GEOM_TestAll.py
5003 anObj = self.ShapesOp.MakeCompound(ToList(theShapes))
5004 RaiseIfFailed("MakeCompound", self.ShapesOp)
5005 self._autoPublish(anObj, theName, "compound")
5008 ## Create a solid (or solids) from the set of faces and/or shells.
5009 # @param theFacesOrShells List of faces and/or shells.
5010 # @param isIntersect If TRUE, forces performing intersections
5011 # between arguments; otherwise (default) intersection is not performed.
5012 # @param theName Object name; when specified, this parameter is used
5013 # for result publication in the study. Otherwise, if automatic
5014 # publication is switched on, default value is used for result name.
5016 # @return New GEOM.GEOM_Object, containing the created solid (or compound of solids).
5018 # @ref tui_creation_solid_from_faces "Example"
5019 @ManageTransactions("ShapesOp")
5020 def MakeSolidFromConnectedFaces(self, theFacesOrShells, isIntersect = False, theName=None):
5022 Create a solid (or solids) from the set of connected faces and/or shells.
5025 theFacesOrShells List of faces and/or shells.
5026 isIntersect If TRUE, forces performing intersections
5027 between arguments; otherwise (default) intersection is not performed
5028 theName Object name; when specified, this parameter is used.
5029 for result publication in the study. Otherwise, if automatic
5030 publication is switched on, default value is used for result name.
5033 New GEOM.GEOM_Object, containing the created solid (or compound of solids).
5035 # Example: see GEOM_TestAll.py
5036 anObj = self.ShapesOp.MakeSolidFromConnectedFaces(theFacesOrShells, isIntersect)
5037 RaiseIfFailed("MakeSolidFromConnectedFaces", self.ShapesOp)
5038 self._autoPublish(anObj, theName, "solid")
5041 # end of l3_basic_go
5044 ## @addtogroup l2_measure
5047 ## Gives quantity of faces in the given shape.
5048 # @param theShape Shape to count faces of.
5049 # @return Quantity of faces.
5051 # @ref swig_NumberOf "Example"
5052 @ManageTransactions("ShapesOp")
5053 def NumberOfFaces(self, theShape):
5055 Gives quantity of faces in the given shape.
5058 theShape Shape to count faces of.
5063 # Example: see GEOM_TestOthers.py
5064 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
5065 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
5068 ## Gives quantity of edges in the given shape.
5069 # @param theShape Shape to count edges of.
5070 # @return Quantity of edges.
5072 # @ref swig_NumberOf "Example"
5073 @ManageTransactions("ShapesOp")
5074 def NumberOfEdges(self, theShape):
5076 Gives quantity of edges in the given shape.
5079 theShape Shape to count edges of.
5084 # Example: see GEOM_TestOthers.py
5085 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
5086 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
5089 ## Gives quantity of sub-shapes of type theShapeType in the given shape.
5090 # @param theShape Shape to count sub-shapes of.
5091 # @param theShapeType Type of sub-shapes to count (see ShapeType())
5092 # @return Quantity of sub-shapes of given type.
5094 # @ref swig_NumberOf "Example"
5095 @ManageTransactions("ShapesOp")
5096 def NumberOfSubShapes(self, theShape, theShapeType):
5098 Gives quantity of sub-shapes of type theShapeType in the given shape.
5101 theShape Shape to count sub-shapes of.
5102 theShapeType Type of sub-shapes to count (see geompy.ShapeType)
5105 Quantity of sub-shapes of given type.
5107 # Example: see GEOM_TestOthers.py
5108 nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
5109 RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
5112 ## Gives quantity of solids in the given shape.
5113 # @param theShape Shape to count solids in.
5114 # @return Quantity of solids.
5116 # @ref swig_NumberOf "Example"
5117 @ManageTransactions("ShapesOp")
5118 def NumberOfSolids(self, theShape):
5120 Gives quantity of solids in the given shape.
5123 theShape Shape to count solids in.
5128 # Example: see GEOM_TestOthers.py
5129 nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, self.ShapeType["SOLID"])
5130 RaiseIfFailed("NumberOfSolids", self.ShapesOp)
5136 ## @addtogroup l3_healing
5139 ## Reverses an orientation the given shape.
5140 # @param theShape Shape to be reversed.
5141 # @param theName Object name; when specified, this parameter is used
5142 # for result publication in the study. Otherwise, if automatic
5143 # publication is switched on, default value is used for result name.
5145 # @return The reversed copy of theShape.
5147 # @ref swig_ChangeOrientation "Example"
5148 @ManageTransactions("ShapesOp")
5149 def ChangeOrientation(self, theShape, theName=None):
5151 Reverses an orientation the given shape.
5154 theShape Shape to be reversed.
5155 theName Object name; when specified, this parameter is used
5156 for result publication in the study. Otherwise, if automatic
5157 publication is switched on, default value is used for result name.
5160 The reversed copy of theShape.
5162 # Example: see GEOM_TestAll.py
5163 anObj = self.ShapesOp.ChangeOrientation(theShape)
5164 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
5165 self._autoPublish(anObj, theName, "reversed")
5168 ## See ChangeOrientation() method for details.
5170 # @ref swig_OrientationChange "Example"
5171 def OrientationChange(self, theShape, theName=None):
5173 See geompy.ChangeOrientation method for details.
5175 # Example: see GEOM_TestOthers.py
5176 # note: auto-publishing is done in self.ChangeOrientation()
5177 anObj = self.ChangeOrientation(theShape, theName)
5183 ## @addtogroup l4_obtain
5186 ## Retrieve all free faces from the given shape.
5187 # Free face is a face, which is not shared between two shells of the shape.
5188 # @param theShape Shape to find free faces in.
5189 # @return List of IDs of all free faces, contained in theShape.
5191 # @ref tui_free_faces_page "Example"
5192 @ManageTransactions("ShapesOp")
5193 def GetFreeFacesIDs(self,theShape):
5195 Retrieve all free faces from the given shape.
5196 Free face is a face, which is not shared between two shells of the shape.
5199 theShape Shape to find free faces in.
5202 List of IDs of all free faces, contained in theShape.
5204 # Example: see GEOM_TestOthers.py
5205 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
5206 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
5209 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
5210 # @param theShape1 Shape to find sub-shapes in.
5211 # @param theShape2 Shape to find shared sub-shapes with.
5212 # @param theShapeType Type of sub-shapes to be retrieved.
5213 # @param theName Object name; when specified, this parameter is used
5214 # for result publication in the study. Otherwise, if automatic
5215 # publication is switched on, default value is used for result name.
5217 # @return List of sub-shapes of theShape1, shared with theShape2.
5219 # @ref swig_GetSharedShapes "Example"
5220 @ManageTransactions("ShapesOp")
5221 def GetSharedShapes(self, theShape1, theShape2, theShapeType, theName=None):
5223 Get all sub-shapes of theShape1 of the given type, shared with theShape2.
5226 theShape1 Shape to find sub-shapes in.
5227 theShape2 Shape to find shared sub-shapes with.
5228 theShapeType Type of sub-shapes to be retrieved.
5229 theName Object name; when specified, this parameter is used
5230 for result publication in the study. Otherwise, if automatic
5231 publication is switched on, default value is used for result name.
5234 List of sub-shapes of theShape1, shared with theShape2.
5236 # Example: see GEOM_TestOthers.py
5237 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
5238 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
5239 self._autoPublish(aList, theName, "shared")
5242 ## Get sub-shapes, shared by input shapes.
5243 # @param theShapes Either a list or compound of shapes to find common sub-shapes of.
5244 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()).
5245 # @param theMultiShare Specifies what type of shares should be checked:
5246 # - @c True (default): search sub-shapes from 1st input shape shared with all other input shapes;
5247 # - @c False: causes to search sub-shapes shared between couples of input shapes.
5248 # @param theName Object name; when specified, this parameter is used
5249 # for result publication in the study. Otherwise, if automatic
5250 # publication is switched on, default value is used for result name.
5252 # @note If @a theShapes contains single compound, the shares between all possible couples of
5253 # its top-level shapes are returned; otherwise, only shares between 1st input shape
5254 # and all rest input shapes are returned.
5256 # @return List of all found sub-shapes.
5259 # - @ref tui_shared_shapes "Example 1"
5260 # - @ref swig_GetSharedShapes "Example 2"
5261 @ManageTransactions("ShapesOp")
5262 def GetSharedShapesMulti(self, theShapes, theShapeType, theMultiShare=True, theName=None):
5264 Get sub-shapes, shared by input shapes.
5267 theShapes Either a list or compound of shapes to find common sub-shapes of.
5268 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType).
5269 theMultiShare Specifies what type of shares should be checked:
5270 - True (default): search sub-shapes from 1st input shape shared with all other input shapes;
5271 - False: causes to search sub-shapes shared between couples of input shapes.
5272 theName Object name; when specified, this parameter is used
5273 for result publication in the study. Otherwise, if automatic
5274 publication is switched on, default value is used for result name.
5276 Note: if theShapes contains single compound, the shares between all possible couples of
5277 its top-level shapes are returned; otherwise, only shares between 1st input shape
5278 and all rest input shapes are returned.
5281 List of all found sub-shapes.
5283 # Example: see GEOM_TestOthers.py
5284 aList = self.ShapesOp.GetSharedShapesMulti(ToList(theShapes), theShapeType, theMultiShare)
5285 RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
5286 self._autoPublish(aList, theName, "shared")
5289 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5290 # situated relatively the specified plane by the certain way,
5291 # defined through <VAR>theState</VAR> parameter.
5292 # @param theShape Shape to find sub-shapes of.
5293 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5294 # @param theAx1 Vector (or line, or linear edge), specifying normal
5295 # direction and location of the plane to find shapes on.
5296 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5297 # @param theName Object name; when specified, this parameter is used
5298 # for result publication in the study. Otherwise, if automatic
5299 # publication is switched on, default value is used for result name.
5301 # @return List of all found sub-shapes.
5303 # @ref swig_GetShapesOnPlane "Example"
5304 @ManageTransactions("ShapesOp")
5305 def GetShapesOnPlane(self, theShape, theShapeType, theAx1, theState, theName=None):
5307 Find in theShape all sub-shapes of type theShapeType,
5308 situated relatively the specified plane by the certain way,
5309 defined through theState parameter.
5312 theShape Shape to find sub-shapes of.
5313 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5314 theAx1 Vector (or line, or linear edge), specifying normal
5315 direction and location of the plane to find shapes on.
5316 theState The state of the sub-shapes to find (see GEOM::shape_state)
5317 theName Object name; when specified, this parameter is used
5318 for result publication in the study. Otherwise, if automatic
5319 publication is switched on, default value is used for result name.
5322 List of all found sub-shapes.
5324 # Example: see GEOM_TestOthers.py
5325 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
5326 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
5327 self._autoPublish(aList, theName, "shapeOnPlane")
5330 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5331 # situated relatively the specified plane by the certain way,
5332 # defined through <VAR>theState</VAR> parameter.
5333 # @param theShape Shape to find sub-shapes of.
5334 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5335 # @param theAx1 Vector (or line, or linear edge), specifying normal
5336 # direction and location of the plane to find shapes on.
5337 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5339 # @return List of all found sub-shapes indices.
5341 # @ref swig_GetShapesOnPlaneIDs "Example"
5342 @ManageTransactions("ShapesOp")
5343 def GetShapesOnPlaneIDs(self, theShape, theShapeType, theAx1, theState):
5345 Find in theShape all sub-shapes of type theShapeType,
5346 situated relatively the specified plane by the certain way,
5347 defined through theState parameter.
5350 theShape Shape to find sub-shapes of.
5351 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5352 theAx1 Vector (or line, or linear edge), specifying normal
5353 direction and location of the plane to find shapes on.
5354 theState The state of the sub-shapes to find (see GEOM::shape_state)
5357 List of all found sub-shapes indices.
5359 # Example: see GEOM_TestOthers.py
5360 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
5361 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
5364 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5365 # situated relatively the specified plane by the certain way,
5366 # defined through <VAR>theState</VAR> parameter.
5367 # @param theShape Shape to find sub-shapes of.
5368 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5369 # @param theAx1 Vector (or line, or linear edge), specifying normal
5370 # direction of the plane to find shapes on.
5371 # @param thePnt Point specifying location of the plane to find shapes on.
5372 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5373 # @param theName Object name; when specified, this parameter is used
5374 # for result publication in the study. Otherwise, if automatic
5375 # publication is switched on, default value is used for result name.
5377 # @return List of all found sub-shapes.
5379 # @ref swig_GetShapesOnPlaneWithLocation "Example"
5380 @ManageTransactions("ShapesOp")
5381 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState, theName=None):
5383 Find in theShape all sub-shapes of type theShapeType,
5384 situated relatively the specified plane by the certain way,
5385 defined through theState parameter.
5388 theShape Shape to find sub-shapes of.
5389 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5390 theAx1 Vector (or line, or linear edge), specifying normal
5391 direction and location of the plane to find shapes on.
5392 thePnt Point specifying location of the plane to find shapes on.
5393 theState The state of the sub-shapes to find (see GEOM::shape_state)
5394 theName Object name; when specified, this parameter is used
5395 for result publication in the study. Otherwise, if automatic
5396 publication is switched on, default value is used for result name.
5399 List of all found sub-shapes.
5401 # Example: see GEOM_TestOthers.py
5402 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
5403 theAx1, thePnt, theState)
5404 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
5405 self._autoPublish(aList, theName, "shapeOnPlane")
5408 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5409 # situated relatively the specified plane by the certain way,
5410 # defined through <VAR>theState</VAR> parameter.
5411 # @param theShape Shape to find sub-shapes of.
5412 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5413 # @param theAx1 Vector (or line, or linear edge), specifying normal
5414 # direction of the plane to find shapes on.
5415 # @param thePnt Point specifying location of the plane to find shapes on.
5416 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5418 # @return List of all found sub-shapes indices.
5420 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
5421 @ManageTransactions("ShapesOp")
5422 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
5424 Find in theShape all sub-shapes of type theShapeType,
5425 situated relatively the specified plane by the certain way,
5426 defined through theState parameter.
5429 theShape Shape to find sub-shapes of.
5430 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5431 theAx1 Vector (or line, or linear edge), specifying normal
5432 direction and location of the plane to find shapes on.
5433 thePnt Point specifying location of the plane to find shapes on.
5434 theState The state of the sub-shapes to find (see GEOM::shape_state)
5437 List of all found sub-shapes indices.
5439 # Example: see GEOM_TestOthers.py
5440 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
5441 theAx1, thePnt, theState)
5442 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
5445 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5446 # the specified cylinder by the certain way, defined through \a theState parameter.
5447 # @param theShape Shape to find sub-shapes of.
5448 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5449 # @param theAxis Vector (or line, or linear edge), specifying
5450 # axis of the cylinder to find shapes on.
5451 # @param theRadius Radius of the cylinder to find shapes on.
5452 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5453 # @param theName Object name; when specified, this parameter is used
5454 # for result publication in the study. Otherwise, if automatic
5455 # publication is switched on, default value is used for result name.
5457 # @return List of all found sub-shapes.
5459 # @ref swig_GetShapesOnCylinder "Example"
5460 @ManageTransactions("ShapesOp")
5461 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState, theName=None):
5463 Find in theShape all sub-shapes of type theShapeType, situated relatively
5464 the specified cylinder by the certain way, defined through theState parameter.
5467 theShape Shape to find sub-shapes of.
5468 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5469 theAxis Vector (or line, or linear edge), specifying
5470 axis of the cylinder to find shapes on.
5471 theRadius Radius of the cylinder to find shapes on.
5472 theState The state of the sub-shapes to find (see GEOM::shape_state)
5473 theName Object name; when specified, this parameter is used
5474 for result publication in the study. Otherwise, if automatic
5475 publication is switched on, default value is used for result name.
5478 List of all found sub-shapes.
5480 # Example: see GEOM_TestOthers.py
5481 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
5482 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
5483 self._autoPublish(aList, theName, "shapeOnCylinder")
5486 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5487 # the specified cylinder by the certain way, defined through \a theState parameter.
5488 # @param theShape Shape to find sub-shapes of.
5489 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5490 # @param theAxis Vector (or line, or linear edge), specifying
5491 # axis of the cylinder to find shapes on.
5492 # @param theRadius Radius of the cylinder to find shapes on.
5493 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5495 # @return List of all found sub-shapes indices.
5497 # @ref swig_GetShapesOnCylinderIDs "Example"
5498 @ManageTransactions("ShapesOp")
5499 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
5501 Find in theShape all sub-shapes of type theShapeType, situated relatively
5502 the specified cylinder by the certain way, defined through theState parameter.
5505 theShape Shape to find sub-shapes of.
5506 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5507 theAxis Vector (or line, or linear edge), specifying
5508 axis of the cylinder to find shapes on.
5509 theRadius Radius of the cylinder to find shapes on.
5510 theState The state of the sub-shapes to find (see GEOM::shape_state)
5513 List of all found sub-shapes indices.
5515 # Example: see GEOM_TestOthers.py
5516 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
5517 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
5520 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5521 # the specified cylinder by the certain way, defined through \a theState parameter.
5522 # @param theShape Shape to find sub-shapes of.
5523 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5524 # @param theAxis Vector (or line, or linear edge), specifying
5525 # axis of the cylinder to find shapes on.
5526 # @param thePnt Point specifying location of the bottom of the cylinder.
5527 # @param theRadius Radius of the cylinder to find shapes on.
5528 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5529 # @param theName Object name; when specified, this parameter is used
5530 # for result publication in the study. Otherwise, if automatic
5531 # publication is switched on, default value is used for result name.
5533 # @return List of all found sub-shapes.
5535 # @ref swig_GetShapesOnCylinderWithLocation "Example"
5536 @ManageTransactions("ShapesOp")
5537 def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState, theName=None):
5539 Find in theShape all sub-shapes of type theShapeType, situated relatively
5540 the specified cylinder by the certain way, defined through theState parameter.
5543 theShape Shape to find sub-shapes of.
5544 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5545 theAxis Vector (or line, or linear edge), specifying
5546 axis of the cylinder to find shapes on.
5547 theRadius Radius of the cylinder to find shapes on.
5548 theState The state of the sub-shapes to find (see GEOM::shape_state)
5549 theName Object name; when specified, this parameter is used
5550 for result publication in the study. Otherwise, if automatic
5551 publication is switched on, default value is used for result name.
5554 List of all found sub-shapes.
5556 # Example: see GEOM_TestOthers.py
5557 aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
5558 RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
5559 self._autoPublish(aList, theName, "shapeOnCylinder")
5562 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5563 # the specified cylinder by the certain way, defined through \a theState parameter.
5564 # @param theShape Shape to find sub-shapes of.
5565 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5566 # @param theAxis Vector (or line, or linear edge), specifying
5567 # axis of the cylinder to find shapes on.
5568 # @param thePnt Point specifying location of the bottom of the cylinder.
5569 # @param theRadius Radius of the cylinder to find shapes on.
5570 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5572 # @return List of all found sub-shapes indices
5574 # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
5575 @ManageTransactions("ShapesOp")
5576 def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
5578 Find in theShape all sub-shapes of type theShapeType, situated relatively
5579 the specified cylinder by the certain way, defined through theState parameter.
5582 theShape Shape to find sub-shapes of.
5583 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5584 theAxis Vector (or line, or linear edge), specifying
5585 axis of the cylinder to find shapes on.
5586 theRadius Radius of the cylinder to find shapes on.
5587 theState The state of the sub-shapes to find (see GEOM::shape_state)
5590 List of all found sub-shapes indices.
5592 # Example: see GEOM_TestOthers.py
5593 aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
5594 RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
5597 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5598 # the specified sphere by the certain way, defined through \a theState parameter.
5599 # @param theShape Shape to find sub-shapes of.
5600 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5601 # @param theCenter Point, specifying center of the sphere to find shapes on.
5602 # @param theRadius Radius of the sphere to find shapes on.
5603 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5604 # @param theName Object name; when specified, this parameter is used
5605 # for result publication in the study. Otherwise, if automatic
5606 # publication is switched on, default value is used for result name.
5608 # @return List of all found sub-shapes.
5610 # @ref swig_GetShapesOnSphere "Example"
5611 @ManageTransactions("ShapesOp")
5612 def GetShapesOnSphere(self, theShape, theShapeType, theCenter, theRadius, theState, theName=None):
5614 Find in theShape all sub-shapes of type theShapeType, situated relatively
5615 the specified sphere by the certain way, defined through theState parameter.
5618 theShape Shape to find sub-shapes of.
5619 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5620 theCenter Point, specifying center of the sphere to find shapes on.
5621 theRadius Radius of the sphere to find shapes on.
5622 theState The state of the sub-shapes to find (see GEOM::shape_state)
5623 theName Object name; when specified, this parameter is used
5624 for result publication in the study. Otherwise, if automatic
5625 publication is switched on, default value is used for result name.
5628 List of all found sub-shapes.
5630 # Example: see GEOM_TestOthers.py
5631 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
5632 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
5633 self._autoPublish(aList, theName, "shapeOnSphere")
5636 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5637 # the specified sphere by the certain way, defined through \a theState parameter.
5638 # @param theShape Shape to find sub-shapes of.
5639 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5640 # @param theCenter Point, specifying center of the sphere to find shapes on.
5641 # @param theRadius Radius of the sphere to find shapes on.
5642 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5644 # @return List of all found sub-shapes indices.
5646 # @ref swig_GetShapesOnSphereIDs "Example"
5647 @ManageTransactions("ShapesOp")
5648 def GetShapesOnSphereIDs(self, theShape, theShapeType, theCenter, theRadius, theState):
5650 Find in theShape all sub-shapes of type theShapeType, situated relatively
5651 the specified sphere by the certain way, defined through theState parameter.
5654 theShape Shape to find sub-shapes of.
5655 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5656 theCenter Point, specifying center of the sphere to find shapes on.
5657 theRadius Radius of the sphere to find shapes on.
5658 theState The state of the sub-shapes to find (see GEOM::shape_state)
5661 List of all found sub-shapes indices.
5663 # Example: see GEOM_TestOthers.py
5664 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
5665 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
5668 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5669 # the specified quadrangle by the certain way, defined through \a theState parameter.
5670 # @param theShape Shape to find sub-shapes of.
5671 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5672 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
5673 # @param theTopRightPoint Point, specifying top right corner of a quadrangle
5674 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5675 # @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5676 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5677 # @param theName Object name; when specified, this parameter is used
5678 # for result publication in the study. Otherwise, if automatic
5679 # publication is switched on, default value is used for result name.
5681 # @return List of all found sub-shapes.
5683 # @ref swig_GetShapesOnQuadrangle "Example"
5684 @ManageTransactions("ShapesOp")
5685 def GetShapesOnQuadrangle(self, theShape, theShapeType,
5686 theTopLeftPoint, theTopRightPoint,
5687 theBottomLeftPoint, theBottomRightPoint, theState, theName=None):
5689 Find in theShape all sub-shapes of type theShapeType, situated relatively
5690 the specified quadrangle by the certain way, defined through theState parameter.
5693 theShape Shape to find sub-shapes of.
5694 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5695 theTopLeftPoint Point, specifying top left corner of a quadrangle
5696 theTopRightPoint Point, specifying top right corner of a quadrangle
5697 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5698 theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5699 theState The state of the sub-shapes to find (see GEOM::shape_state)
5700 theName Object name; when specified, this parameter is used
5701 for result publication in the study. Otherwise, if automatic
5702 publication is switched on, default value is used for result name.
5705 List of all found sub-shapes.
5707 # Example: see GEOM_TestOthers.py
5708 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
5709 theTopLeftPoint, theTopRightPoint,
5710 theBottomLeftPoint, theBottomRightPoint, theState)
5711 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
5712 self._autoPublish(aList, theName, "shapeOnQuadrangle")
5715 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5716 # the specified quadrangle by the certain way, defined through \a theState parameter.
5717 # @param theShape Shape to find sub-shapes of.
5718 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5719 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
5720 # @param theTopRightPoint Point, specifying top right corner of a quadrangle
5721 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5722 # @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5723 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5725 # @return List of all found sub-shapes indices.
5727 # @ref swig_GetShapesOnQuadrangleIDs "Example"
5728 @ManageTransactions("ShapesOp")
5729 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
5730 theTopLeftPoint, theTopRightPoint,
5731 theBottomLeftPoint, theBottomRightPoint, theState):
5733 Find in theShape all sub-shapes of type theShapeType, situated relatively
5734 the specified quadrangle by the certain way, defined through theState parameter.
5737 theShape Shape to find sub-shapes of.
5738 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5739 theTopLeftPoint Point, specifying top left corner of a quadrangle
5740 theTopRightPoint Point, specifying top right corner of a quadrangle
5741 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5742 theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5743 theState The state of the sub-shapes to find (see GEOM::shape_state)
5746 List of all found sub-shapes indices.
5749 # Example: see GEOM_TestOthers.py
5750 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
5751 theTopLeftPoint, theTopRightPoint,
5752 theBottomLeftPoint, theBottomRightPoint, theState)
5753 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
5756 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5757 # the specified \a theBox by the certain way, defined through \a theState parameter.
5758 # @param theBox Shape for relative comparing.
5759 # @param theShape Shape to find sub-shapes of.
5760 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5761 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5762 # @param theName Object name; when specified, this parameter is used
5763 # for result publication in the study. Otherwise, if automatic
5764 # publication is switched on, default value is used for result name.
5766 # @return List of all found sub-shapes.
5768 # @ref swig_GetShapesOnBox "Example"
5769 @ManageTransactions("ShapesOp")
5770 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState, theName=None):
5772 Find in theShape all sub-shapes of type theShapeType, situated relatively
5773 the specified theBox by the certain way, defined through theState parameter.
5776 theBox Shape for relative comparing.
5777 theShape Shape to find sub-shapes of.
5778 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5779 theState The state of the sub-shapes to find (see GEOM::shape_state)
5780 theName Object name; when specified, this parameter is used
5781 for result publication in the study. Otherwise, if automatic
5782 publication is switched on, default value is used for result name.
5785 List of all found sub-shapes.
5787 # Example: see GEOM_TestOthers.py
5788 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
5789 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
5790 self._autoPublish(aList, theName, "shapeOnBox")
5793 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5794 # the specified \a theBox by the certain way, defined through \a theState parameter.
5795 # @param theBox Shape for relative comparing.
5796 # @param theShape Shape to find sub-shapes of.
5797 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5798 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5800 # @return List of all found sub-shapes indices.
5802 # @ref swig_GetShapesOnBoxIDs "Example"
5803 @ManageTransactions("ShapesOp")
5804 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
5806 Find in theShape all sub-shapes of type theShapeType, situated relatively
5807 the specified theBox by the certain way, defined through theState parameter.
5810 theBox Shape for relative comparing.
5811 theShape Shape to find sub-shapes of.
5812 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5813 theState The state of the sub-shapes to find (see GEOM::shape_state)
5816 List of all found sub-shapes indices.
5818 # Example: see GEOM_TestOthers.py
5819 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
5820 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
5823 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5824 # situated relatively the specified \a theCheckShape by the
5825 # certain way, defined through \a theState parameter.
5826 # @param theCheckShape Shape for relative comparing. It must be a solid.
5827 # @param theShape Shape to find sub-shapes of.
5828 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5829 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5830 # @param theName Object name; when specified, this parameter is used
5831 # for result publication in the study. Otherwise, if automatic
5832 # publication is switched on, default value is used for result name.
5834 # @return List of all found sub-shapes.
5836 # @ref swig_GetShapesOnShape "Example"
5837 @ManageTransactions("ShapesOp")
5838 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theName=None):
5840 Find in theShape all sub-shapes of type theShapeType,
5841 situated relatively the specified theCheckShape by the
5842 certain way, defined through theState parameter.
5845 theCheckShape Shape for relative comparing. It must be a solid.
5846 theShape Shape to find sub-shapes of.
5847 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5848 theState The state of the sub-shapes to find (see GEOM::shape_state)
5849 theName Object name; when specified, this parameter is used
5850 for result publication in the study. Otherwise, if automatic
5851 publication is switched on, default value is used for result name.
5854 List of all found sub-shapes.
5856 # Example: see GEOM_TestOthers.py
5857 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
5858 theShapeType, theState)
5859 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
5860 self._autoPublish(aList, theName, "shapeOnShape")
5863 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5864 # situated relatively the specified \a theCheckShape by the
5865 # certain way, defined through \a theState parameter.
5866 # @param theCheckShape Shape for relative comparing. It must be a solid.
5867 # @param theShape Shape to find sub-shapes of.
5868 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5869 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5870 # @param theName Object name; when specified, this parameter is used
5871 # for result publication in the study. Otherwise, if automatic
5872 # publication is switched on, default value is used for result name.
5874 # @return All found sub-shapes as compound.
5876 # @ref swig_GetShapesOnShapeAsCompound "Example"
5877 @ManageTransactions("ShapesOp")
5878 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theName=None):
5880 Find in theShape all sub-shapes of type theShapeType,
5881 situated relatively the specified theCheckShape by the
5882 certain way, defined through theState parameter.
5885 theCheckShape Shape for relative comparing. It must be a solid.
5886 theShape Shape to find sub-shapes of.
5887 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5888 theState The state of the sub-shapes to find (see GEOM::shape_state)
5889 theName Object name; when specified, this parameter is used
5890 for result publication in the study. Otherwise, if automatic
5891 publication is switched on, default value is used for result name.
5894 All found sub-shapes as compound.
5896 # Example: see GEOM_TestOthers.py
5897 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
5898 theShapeType, theState)
5899 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
5900 self._autoPublish(anObj, theName, "shapeOnShape")
5903 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5904 # situated relatively the specified \a theCheckShape by the
5905 # certain way, defined through \a theState parameter.
5906 # @param theCheckShape Shape for relative comparing. It must be a solid.
5907 # @param theShape Shape to find sub-shapes of.
5908 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5909 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5911 # @return List of all found sub-shapes indices.
5913 # @ref swig_GetShapesOnShapeIDs "Example"
5914 @ManageTransactions("ShapesOp")
5915 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
5917 Find in theShape all sub-shapes of type theShapeType,
5918 situated relatively the specified theCheckShape by the
5919 certain way, defined through theState parameter.
5922 theCheckShape Shape for relative comparing. It must be a solid.
5923 theShape Shape to find sub-shapes of.
5924 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5925 theState The state of the sub-shapes to find (see GEOM::shape_state)
5928 List of all found sub-shapes indices.
5930 # Example: see GEOM_TestOthers.py
5931 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
5932 theShapeType, theState)
5933 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
5936 ## Get sub-shape(s) of theShapeWhere, which are
5937 # coincident with \a theShapeWhat or could be a part of it.
5938 # @param theShapeWhere Shape to find sub-shapes of.
5939 # @param theShapeWhat Shape, specifying what to find.
5940 # @param isNewImplementation implementation of GetInPlace functionality
5941 # (default = False, old alghorithm based on shape properties)
5942 # @param theName Object name; when specified, this parameter is used
5943 # for result publication in the study. Otherwise, if automatic
5944 # publication is switched on, default value is used for result name.
5946 # @return Compound which includes all found sub-shapes if they have different types;
5947 # or group of all found shapes of the equal type; or a single found sub-shape.
5949 # @note This function has a restriction on argument shapes.
5950 # If \a theShapeWhere has curved parts with significantly
5951 # outstanding centres (i.e. the mass centre of a part is closer to
5952 # \a theShapeWhat than to the part), such parts will not be found.
5953 # @image html get_in_place_lost_part.png
5955 # @ref swig_GetInPlace "Example"
5956 @ManageTransactions("ShapesOp")
5957 def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False, theName=None):
5959 Get sub-shape(s) of theShapeWhere, which are
5960 coincident with theShapeWhat or could be a part of it.
5963 theShapeWhere Shape to find sub-shapes of.
5964 theShapeWhat Shape, specifying what to find.
5965 isNewImplementation Implementation of GetInPlace functionality
5966 (default = False, old alghorithm based on shape properties)
5967 theName Object name; when specified, this parameter is used
5968 for result publication in the study. Otherwise, if automatic
5969 publication is switched on, default value is used for result name.
5972 Compound which includes all found sub-shapes if they have different types;
5973 or group of all found shapes of the equal type; or a single found sub-shape.
5977 This function has a restriction on argument shapes.
5978 If theShapeWhere has curved parts with significantly
5979 outstanding centres (i.e. the mass centre of a part is closer to
5980 theShapeWhat than to the part), such parts will not be found.
5982 # Example: see GEOM_TestOthers.py
5984 if isNewImplementation:
5985 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
5987 anObj = self.ShapesOp.GetInPlaceOld(theShapeWhere, theShapeWhat)
5989 RaiseIfFailed("GetInPlace", self.ShapesOp)
5990 self._autoPublish(anObj, theName, "inplace")
5993 ## Get sub-shape(s) of \a theShapeWhere, which are
5994 # coincident with \a theShapeWhat or could be a part of it.
5996 # Implementation of this method is based on a saved history of an operation,
5997 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
5998 # arguments (an argument shape or a sub-shape of an argument shape).
5999 # The operation could be the Partition or one of boolean operations,
6000 # performed on simple shapes (not on compounds).
6002 # @param theShapeWhere Shape to find sub-shapes of.
6003 # @param theShapeWhat Shape, specifying what to find (must be in the
6004 # building history of the ShapeWhere).
6005 # @param theName Object name; when specified, this parameter is used
6006 # for result publication in the study. Otherwise, if automatic
6007 # publication is switched on, default value is used for result name.
6009 # @return Compound which includes all found sub-shapes if they have different types;
6010 # or group of all found shapes of the equal type; or a single found sub-shape.
6012 # @ref swig_GetInPlace "Example"
6013 @ManageTransactions("ShapesOp")
6014 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat, theName=None):
6016 Implementation of this method is based on a saved history of an operation,
6017 produced theShapeWhere. The theShapeWhat must be among this operation's
6018 arguments (an argument shape or a sub-shape of an argument shape).
6019 The operation could be the Partition or one of boolean operations,
6020 performed on simple shapes (not on compounds).
6023 theShapeWhere Shape to find sub-shapes of.
6024 theShapeWhat Shape, specifying what to find (must be in the
6025 building history of the ShapeWhere).
6026 theName Object name; when specified, this parameter is used
6027 for result publication in the study. Otherwise, if automatic
6028 publication is switched on, default value is used for result name.
6031 Compound which includes all found sub-shapes if they have different types;
6032 or group of all found shapes of the equal type; or a single found sub-shape.
6034 # Example: see GEOM_TestOthers.py
6035 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
6036 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
6037 self._autoPublish(anObj, theName, "inplace")
6040 ## A sort of GetInPlace functionality, returning IDs of sub-shapes.
6041 # For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
6042 # IDs of @a theShapeWhere.
6043 # For example, if theShapeWhat is a box and theShapeWhere is this box cut into
6044 # two parts by a plane, then the result can be as this:
6045 # len( result_list ) = 35,
6046 # result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
6047 # solids with IDs 2 and 36 within theShapeWhere
6049 # @param theShapeWhere Shape to find sub-shapes of.
6050 # @param theShapeWhat Shape, specifying what to find.
6051 # @return List of lists of sub-shape IDS of theShapeWhere.
6052 def GetInPlaceMap(self, theShapeWhere, theShapeWhat):
6054 A sort of GetInPlace functionality, returning IDs of sub-shapes.
6055 For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
6056 IDs of @a theShapeWhere.
6057 For example, if theShapeWhat is a box and theShapeWhere is this box cut into
6058 two parts by a plane, then the result can be as this:
6059 len( result_list ) = 35,
6060 result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
6061 solids with IDs 2 and 36 within theShapeWhere
6064 theShapeWhere Shape to find sub-shapes of.
6065 theShapeWhat Shape, specifying what to find.
6068 List of lists of sub-shape IDS of theShapeWhere.
6070 return self.ShapesOp.GetInPlaceMap(theShapeWhere, theShapeWhat)
6072 ## Get sub-shape of theShapeWhere, which is
6073 # equal to \a theShapeWhat.
6074 # @param theShapeWhere Shape to find sub-shape of.
6075 # @param theShapeWhat Shape, specifying what to find.
6076 # @param theName Object name; when specified, this parameter is used
6077 # for result publication in the study. Otherwise, if automatic
6078 # publication is switched on, default value is used for result name.
6080 # @return New GEOM.GEOM_Object for found sub-shape.
6082 # @ref swig_GetSame "Example"
6083 @ManageTransactions("ShapesOp")
6084 def GetSame(self, theShapeWhere, theShapeWhat, theName=None):
6086 Get sub-shape of theShapeWhere, which is
6087 equal to theShapeWhat.
6090 theShapeWhere Shape to find sub-shape of.
6091 theShapeWhat Shape, specifying what to find.
6092 theName Object name; when specified, this parameter is used
6093 for result publication in the study. Otherwise, if automatic
6094 publication is switched on, default value is used for result name.
6097 New GEOM.GEOM_Object for found sub-shape.
6099 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
6100 RaiseIfFailed("GetSame", self.ShapesOp)
6101 self._autoPublish(anObj, theName, "sameShape")
6105 ## Get sub-shape indices of theShapeWhere, which is
6106 # equal to \a theShapeWhat.
6107 # @param theShapeWhere Shape to find sub-shape of.
6108 # @param theShapeWhat Shape, specifying what to find.
6109 # @return List of all found sub-shapes indices.
6111 # @ref swig_GetSame "Example"
6112 @ManageTransactions("ShapesOp")
6113 def GetSameIDs(self, theShapeWhere, theShapeWhat):
6115 Get sub-shape indices of theShapeWhere, which is
6116 equal to theShapeWhat.
6119 theShapeWhere Shape to find sub-shape of.
6120 theShapeWhat Shape, specifying what to find.
6123 List of all found sub-shapes indices.
6125 anObj = self.ShapesOp.GetSameIDs(theShapeWhere, theShapeWhat)
6126 RaiseIfFailed("GetSameIDs", self.ShapesOp)
6129 ## Resize the input edge with the new Min and Max parameters.
6130 # The input edge parameters range is [0, 1]. If theMin parameter is
6131 # negative, the input edge is extended, otherwise it is shrinked by
6132 # theMin parameter. If theMax is greater than 1, the edge is extended,
6133 # otherwise it is shrinked by theMax parameter.
6134 # @param theEdge the input edge to be resized.
6135 # @param theMin the minimal parameter value.
6136 # @param theMax the maximal parameter value.
6137 # @param theName Object name; when specified, this parameter is used
6138 # for result publication in the study. Otherwise, if automatic
6139 # publication is switched on, default value is used for result name.
6140 # @return New GEOM.GEOM_Object, containing the created edge.
6142 # @ref tui_extend "Example"
6143 @ManageTransactions("ShapesOp")
6144 def ExtendEdge(self, theEdge, theMin, theMax, theName=None):
6146 Resize the input edge with the new Min and Max parameters.
6147 The input edge parameters range is [0, 1]. If theMin parameter is
6148 negative, the input edge is extended, otherwise it is shrinked by
6149 theMin parameter. If theMax is greater than 1, the edge is extended,
6150 otherwise it is shrinked by theMax parameter.
6153 theEdge the input edge to be resized.
6154 theMin the minimal parameter value.
6155 theMax the maximal parameter value.
6156 theName Object name; when specified, this parameter is used
6157 for result publication in the study. Otherwise, if automatic
6158 publication is switched on, default value is used for result name.
6161 New GEOM.GEOM_Object, containing the created edge.
6163 theMin, theMax, Parameters = ParseParameters(theMin, theMax)
6164 anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax)
6165 RaiseIfFailed("ExtendEdge", self.ShapesOp)
6166 anObj.SetParameters(Parameters)
6167 self._autoPublish(anObj, theName, "edge")
6170 ## Resize the input face with the new UMin, UMax, VMin and VMax
6171 # parameters. The input face U and V parameters range is [0, 1]. If
6172 # theUMin parameter is negative, the input face is extended, otherwise
6173 # it is shrinked along U direction by theUMin parameter. If theUMax is
6174 # greater than 1, the face is extended, otherwise it is shrinked along
6175 # U direction by theUMax parameter. So as for theVMin, theVMax and
6176 # V direction of the input face.
6177 # @param theFace the input face to be resized.
6178 # @param theUMin the minimal U parameter value.
6179 # @param theUMax the maximal U parameter value.
6180 # @param theVMin the minimal V parameter value.
6181 # @param theVMax the maximal V parameter value.
6182 # @param theName Object name; when specified, this parameter is used
6183 # for result publication in the study. Otherwise, if automatic
6184 # publication is switched on, default value is used for result name.
6185 # @return New GEOM.GEOM_Object, containing the created face.
6187 # @ref tui_extend "Example"
6188 @ManageTransactions("ShapesOp")
6189 def ExtendFace(self, theFace, theUMin, theUMax,
6190 theVMin, theVMax, theName=None):
6192 Resize the input face with the new UMin, UMax, VMin and VMax
6193 parameters. The input face U and V parameters range is [0, 1]. If
6194 theUMin parameter is negative, the input face is extended, otherwise
6195 it is shrinked along U direction by theUMin parameter. If theUMax is
6196 greater than 1, the face is extended, otherwise it is shrinked along
6197 U direction by theUMax parameter. So as for theVMin, theVMax and
6198 V direction of the input face.
6201 theFace the input face to be resized.
6202 theUMin the minimal U parameter value.
6203 theUMax the maximal U parameter value.
6204 theVMin the minimal V parameter value.
6205 theVMax the maximal V parameter value.
6206 theName Object name; when specified, this parameter is used
6207 for result publication in the study. Otherwise, if automatic
6208 publication is switched on, default value is used for result name.
6211 New GEOM.GEOM_Object, containing the created face.
6213 theUMin, theUMax, theVMin, theVMax, Parameters = ParseParameters(theUMin, theUMax, theVMin, theVMax)
6214 anObj = self.ShapesOp.ExtendFace(theFace, theUMin, theUMax,
6216 RaiseIfFailed("ExtendFace", self.ShapesOp)
6217 anObj.SetParameters(Parameters)
6218 self._autoPublish(anObj, theName, "face")
6221 ## This function takes some face as input parameter and creates new
6222 # GEOM_Object, i.e. topological shape by extracting underlying surface
6223 # of the source face and limiting it by the Umin, Umax, Vmin, Vmax
6224 # parameters of the source face (in the parametrical space).
6225 # @param theFace the input face.
6226 # @param theName Object name; when specified, this parameter is used
6227 # for result publication in the study. Otherwise, if automatic
6228 # publication is switched on, default value is used for result name.
6229 # @return New GEOM.GEOM_Object, containing the created face.
6231 # @ref tui_creation_surface "Example"
6232 @ManageTransactions("ShapesOp")
6233 def MakeSurfaceFromFace(self, theFace, theName=None):
6235 This function takes some face as input parameter and creates new
6236 GEOM_Object, i.e. topological shape by extracting underlying surface
6237 of the source face and limiting it by the Umin, Umax, Vmin, Vmax
6238 parameters of the source face (in the parametrical space).
6241 theFace the input face.
6242 theName Object name; when specified, this parameter is used
6243 for result publication in the study. Otherwise, if automatic
6244 publication is switched on, default value is used for result name.
6247 New GEOM.GEOM_Object, containing the created face.
6249 anObj = self.ShapesOp.MakeSurfaceFromFace(theFace)
6250 RaiseIfFailed("MakeSurfaceFromFace", self.ShapesOp)
6251 self._autoPublish(anObj, theName, "surface")
6257 ## @addtogroup l4_access
6260 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
6261 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
6262 # @param aShape Shape to get sub-shape of.
6263 # @param ListOfID List of sub-shapes indices.
6264 # @param theName Object name; when specified, this parameter is used
6265 # for result publication in the study. Otherwise, if automatic
6266 # publication is switched on, default value is used for result name.
6268 # @return Found sub-shape.
6270 # @ref swig_all_decompose "Example"
6271 def GetSubShape(self, aShape, ListOfID, theName=None):
6273 Obtain a composite sub-shape of aShape, composed from sub-shapes
6274 of aShape, selected by their unique IDs inside aShape
6277 aShape Shape to get sub-shape of.
6278 ListOfID List of sub-shapes indices.
6279 theName Object name; when specified, this parameter is used
6280 for result publication in the study. Otherwise, if automatic
6281 publication is switched on, default value is used for result name.
6286 # Example: see GEOM_TestAll.py
6287 anObj = self.AddSubShape(aShape,ListOfID)
6288 self._autoPublish(anObj, theName, "subshape")
6291 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
6292 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
6293 # @param aShape Shape to get sub-shape of.
6294 # @param aSubShape Sub-shapes of aShape.
6295 # @return ID of found sub-shape.
6297 # @ref swig_all_decompose "Example"
6298 @ManageTransactions("LocalOp")
6299 def GetSubShapeID(self, aShape, aSubShape):
6301 Obtain unique ID of sub-shape aSubShape inside aShape
6302 of aShape, selected by their unique IDs inside aShape
6305 aShape Shape to get sub-shape of.
6306 aSubShape Sub-shapes of aShape.
6309 ID of found sub-shape.
6311 # Example: see GEOM_TestAll.py
6312 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
6313 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
6316 ## Obtain unique IDs of sub-shapes <VAR>aSubShapes</VAR> inside <VAR>aShape</VAR>
6317 # This function is provided for performance purpose. The complexity is O(n) with n
6318 # the number of subobjects of aShape
6319 # @param aShape Shape to get sub-shape of.
6320 # @param aSubShapes Sub-shapes of aShape.
6321 # @return list of IDs of found sub-shapes.
6323 # @ref swig_all_decompose "Example"
6324 @ManageTransactions("ShapesOp")
6325 def GetSubShapesIDs(self, aShape, aSubShapes):
6327 Obtain a list of IDs of sub-shapes aSubShapes inside aShape
6328 This function is provided for performance purpose. The complexity is O(n) with n
6329 the number of subobjects of aShape
6332 aShape Shape to get sub-shape of.
6333 aSubShapes Sub-shapes of aShape.
6336 List of IDs of found sub-shape.
6338 # Example: see GEOM_TestAll.py
6339 anIDs = self.ShapesOp.GetSubShapesIndices(aShape, aSubShapes)
6340 RaiseIfFailed("GetSubShapesIndices", self.ShapesOp)
6346 ## @addtogroup l4_decompose
6349 ## Get all sub-shapes and groups of \a theShape,
6350 # that were created already by any other methods.
6351 # @param theShape Any shape.
6352 # @param theGroupsOnly If this parameter is TRUE, only groups will be
6353 # returned, else all found sub-shapes and groups.
6354 # @return List of existing sub-objects of \a theShape.
6356 # @ref swig_all_decompose "Example"
6357 @ManageTransactions("ShapesOp")
6358 def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
6360 Get all sub-shapes and groups of theShape,
6361 that were created already by any other methods.
6365 theGroupsOnly If this parameter is TRUE, only groups will be
6366 returned, else all found sub-shapes and groups.
6369 List of existing sub-objects of theShape.
6371 # Example: see GEOM_TestAll.py
6372 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
6373 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
6376 ## Get all groups of \a theShape,
6377 # that were created already by any other methods.
6378 # @param theShape Any shape.
6379 # @return List of existing groups of \a theShape.
6381 # @ref swig_all_decompose "Example"
6382 @ManageTransactions("ShapesOp")
6383 def GetGroups(self, theShape):
6385 Get all groups of theShape,
6386 that were created already by any other methods.
6392 List of existing groups of theShape.
6394 # Example: see GEOM_TestAll.py
6395 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
6396 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
6399 ## Explode a shape on sub-shapes of a given type.
6400 # If the shape itself matches the type, it is also returned.
6401 # @param aShape Shape to be exploded.
6402 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6403 # @param theName Object name; when specified, this parameter is used
6404 # for result publication in the study. Otherwise, if automatic
6405 # publication is switched on, default value is used for result name.
6407 # @return List of sub-shapes of type theShapeType, contained in theShape.
6409 # @ref swig_all_decompose "Example"
6410 @ManageTransactions("ShapesOp")
6411 def SubShapeAll(self, aShape, aType, theName=None):
6413 Explode a shape on sub-shapes of a given type.
6414 If the shape itself matches the type, it is also returned.
6417 aShape Shape to be exploded.
6418 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6419 theName Object name; when specified, this parameter is used
6420 for result publication in the study. Otherwise, if automatic
6421 publication is switched on, default value is used for result name.
6424 List of sub-shapes of type theShapeType, contained in theShape.
6426 # Example: see GEOM_TestAll.py
6427 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), False)
6428 RaiseIfFailed("SubShapeAll", self.ShapesOp)
6429 self._autoPublish(ListObj, theName, "subshape")
6432 ## Explode a shape on sub-shapes of a given type.
6433 # @param aShape Shape to be exploded.
6434 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6435 # @return List of IDs of sub-shapes.
6437 # @ref swig_all_decompose "Example"
6438 @ManageTransactions("ShapesOp")
6439 def SubShapeAllIDs(self, aShape, aType):
6441 Explode a shape on sub-shapes of a given type.
6444 aShape Shape to be exploded (see geompy.ShapeType)
6445 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6448 List of IDs of sub-shapes.
6450 ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), False)
6451 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6454 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
6455 # selected by their indices in list of all sub-shapes of type <VAR>aType</VAR>.
6456 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6457 # @param aShape Shape to get sub-shape of.
6458 # @param ListOfInd List of sub-shapes indices.
6459 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6460 # @param theName Object name; when specified, this parameter is used
6461 # for result publication in the study. Otherwise, if automatic
6462 # publication is switched on, default value is used for result name.
6464 # @return A compound of sub-shapes of aShape.
6466 # @ref swig_all_decompose "Example"
6467 def SubShape(self, aShape, aType, ListOfInd, theName=None):
6469 Obtain a compound of sub-shapes of aShape,
6470 selected by their indices in list of all sub-shapes of type aType.
6471 Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6474 aShape Shape to get sub-shape of.
6475 ListOfID List of sub-shapes indices.
6476 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6477 theName Object name; when specified, this parameter is used
6478 for result publication in the study. Otherwise, if automatic
6479 publication is switched on, default value is used for result name.
6482 A compound of sub-shapes of aShape.
6484 # Example: see GEOM_TestAll.py
6486 AllShapeIDsList = self.SubShapeAllIDs(aShape, EnumToLong( aType ))
6487 for ind in ListOfInd:
6488 ListOfIDs.append(AllShapeIDsList[ind - 1])
6489 # note: auto-publishing is done in self.GetSubShape()
6490 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6493 ## Explode a shape on sub-shapes of a given type.
6494 # Sub-shapes will be sorted taking into account their gravity centers,
6495 # to provide stable order of sub-shapes. Please see
6496 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6497 # If the shape itself matches the type, it is also returned.
6498 # @param aShape Shape to be exploded.
6499 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6500 # @param theName Object name; when specified, this parameter is used
6501 # for result publication in the study. Otherwise, if automatic
6502 # publication is switched on, default value is used for result name.
6504 # @return List of sub-shapes of type theShapeType, contained in theShape.
6506 # @ref swig_SubShapeAllSorted "Example"
6507 @ManageTransactions("ShapesOp")
6508 def SubShapeAllSortedCentres(self, aShape, aType, theName=None):
6510 Explode a shape on sub-shapes of a given type.
6511 Sub-shapes will be sorted taking into account their gravity centers,
6512 to provide stable order of sub-shapes.
6513 If the shape itself matches the type, it is also returned.
6516 aShape Shape to be exploded.
6517 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6518 theName Object name; when specified, this parameter is used
6519 for result publication in the study. Otherwise, if automatic
6520 publication is switched on, default value is used for result name.
6523 List of sub-shapes of type theShapeType, contained in theShape.
6525 # Example: see GEOM_TestAll.py
6526 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), True)
6527 RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
6528 self._autoPublish(ListObj, theName, "subshape")
6531 ## Explode a shape on sub-shapes of a given type.
6532 # Sub-shapes will be sorted taking into account their gravity centers,
6533 # to provide stable order of sub-shapes. Please see
6534 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6535 # @param aShape Shape to be exploded.
6536 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6537 # @return List of IDs of sub-shapes.
6539 # @ref swig_all_decompose "Example"
6540 @ManageTransactions("ShapesOp")
6541 def SubShapeAllSortedCentresIDs(self, aShape, aType):
6543 Explode a shape on sub-shapes of a given type.
6544 Sub-shapes will be sorted taking into account their gravity centers,
6545 to provide stable order of sub-shapes.
6548 aShape Shape to be exploded.
6549 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6552 List of IDs of sub-shapes.
6554 ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), True)
6555 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6558 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
6559 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
6560 # Please see @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6561 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6562 # @param aShape Shape to get sub-shape of.
6563 # @param ListOfInd List of sub-shapes indices.
6564 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6565 # @param theName Object name; when specified, this parameter is used
6566 # for result publication in the study. Otherwise, if automatic
6567 # publication is switched on, default value is used for result name.
6569 # @return A compound of sub-shapes of aShape.
6571 # @ref swig_all_decompose "Example"
6572 def SubShapeSortedCentres(self, aShape, aType, ListOfInd, theName=None):
6574 Obtain a compound of sub-shapes of aShape,
6575 selected by they indices in sorted list of all sub-shapes of type aType.
6576 Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6579 aShape Shape to get sub-shape of.
6580 ListOfID List of sub-shapes indices.
6581 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6582 theName Object name; when specified, this parameter is used
6583 for result publication in the study. Otherwise, if automatic
6584 publication is switched on, default value is used for result name.
6587 A compound of sub-shapes of aShape.
6589 # Example: see GEOM_TestAll.py
6591 AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, EnumToLong( aType ))
6592 for ind in ListOfInd:
6593 ListOfIDs.append(AllShapeIDsList[ind - 1])
6594 # note: auto-publishing is done in self.GetSubShape()
6595 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6598 ## Extract shapes (excluding the main shape) of given type.
6599 # @param aShape The shape.
6600 # @param aType The shape type (see ShapeType())
6601 # @param isSorted Boolean flag to switch sorting on/off. Please see
6602 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6603 # @param theName Object name; when specified, this parameter is used
6604 # for result publication in the study. Otherwise, if automatic
6605 # publication is switched on, default value is used for result name.
6607 # @return List of sub-shapes of type aType, contained in aShape.
6609 # @ref swig_FilletChamfer "Example"
6610 @ManageTransactions("ShapesOp")
6611 def ExtractShapes(self, aShape, aType, isSorted = False, theName=None):
6613 Extract shapes (excluding the main shape) of given type.
6617 aType The shape type (see geompy.ShapeType)
6618 isSorted Boolean flag to switch sorting on/off.
6619 theName Object name; when specified, this parameter is used
6620 for result publication in the study. Otherwise, if automatic
6621 publication is switched on, default value is used for result name.
6624 List of sub-shapes of type aType, contained in aShape.
6626 # Example: see GEOM_TestAll.py
6627 ListObj = self.ShapesOp.ExtractSubShapes(aShape, EnumToLong( aType ), isSorted)
6628 RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
6629 self._autoPublish(ListObj, theName, "subshape")
6632 ## Get a set of sub-shapes defined by their unique IDs inside <VAR>aShape</VAR>
6633 # @param aShape Main shape.
6634 # @param anIDs List of unique IDs of sub-shapes inside <VAR>aShape</VAR>.
6635 # @param theName Object name; when specified, this parameter is used
6636 # for result publication in the study. Otherwise, if automatic
6637 # publication is switched on, default value is used for result name.
6638 # @return List of GEOM.GEOM_Object, corresponding to found sub-shapes.
6640 # @ref swig_all_decompose "Example"
6641 @ManageTransactions("ShapesOp")
6642 def SubShapes(self, aShape, anIDs, theName=None):
6644 Get a set of sub-shapes defined by their unique IDs inside theMainShape
6648 anIDs List of unique IDs of sub-shapes inside theMainShape.
6649 theName Object name; when specified, this parameter is used
6650 for result publication in the study. Otherwise, if automatic
6651 publication is switched on, default value is used for result name.
6654 List of GEOM.GEOM_Object, corresponding to found sub-shapes.
6656 # Example: see GEOM_TestAll.py
6657 ListObj = self.ShapesOp.MakeSubShapes(aShape, anIDs)
6658 RaiseIfFailed("SubShapes", self.ShapesOp)
6659 self._autoPublish(ListObj, theName, "subshape")
6662 ## Explode a shape into edges sorted in a row from a starting point.
6663 # @param theShape the shape to be exploded on edges.
6664 # @param theStartPoint the starting point.
6665 # @param theName Object name; when specified, this parameter is used
6666 # for result publication in the study. Otherwise, if automatic
6667 # publication is switched on, default value is used for result name.
6668 # @return List of GEOM.GEOM_Object that is actually an ordered list
6669 # of edges sorted in a row from a starting point.
6671 # @ref swig_GetSubShapeEdgeSorted "Example"
6672 @ManageTransactions("ShapesOp")
6673 def GetSubShapeEdgeSorted(self, theShape, theStartPoint, theName=None):
6675 Explode a shape into edges sorted in a row from a starting point.
6678 theShape the shape to be exploded on edges.
6679 theStartPoint the starting point.
6680 theName Object name; when specified, this parameter is used
6681 for result publication in the study. Otherwise, if automatic
6682 publication is switched on, default value is used for result name.
6685 List of GEOM.GEOM_Object that is actually an ordered list
6686 of edges sorted in a row from a starting point.
6688 # Example: see GEOM_TestAll.py
6689 ListObj = self.ShapesOp.GetSubShapeEdgeSorted(theShape, theStartPoint)
6690 RaiseIfFailed("GetSubShapeEdgeSorted", self.ShapesOp)
6691 self._autoPublish(ListObj, theName, "SortedEdges")
6695 # Return the list of subshapes that satisfies a certain tolerance
6696 # criterion. The user defines the type of shapes to be returned, the
6697 # condition and the tolerance value. The operation is defined for
6698 # faces, edges and vertices only. E.g. for theShapeType FACE,
6699 # theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
6700 # all faces of theShape that have tolerances greater then 1.e7.
6702 # @param theShape the shape to be exploded
6703 # @param theShapeType the type of sub-shapes to be returned (see
6704 # ShapeType()). Can have the values FACE, EDGE and VERTEX only.
6705 # @param theCondition the condition type (see GEOM::comparison_condition).
6706 # @param theTolerance the tolerance filter.
6707 # @param theName Object name; when specified, this parameter is used
6708 # for result publication in the study. Otherwise, if automatic
6709 # publication is switched on, default value is used for result name.
6710 # @return the list of shapes that satisfy the conditions.
6712 # @ref swig_GetSubShapesWithTolerance "Example"
6713 @ManageTransactions("ShapesOp")
6714 def GetSubShapesWithTolerance(self, theShape, theShapeType,
6715 theCondition, theTolerance, theName=None):
6717 Return the list of subshapes that satisfies a certain tolerance
6718 criterion. The user defines the type of shapes to be returned, the
6719 condition and the tolerance value. The operation is defined for
6720 faces, edges and vertices only. E.g. for theShapeType FACE,
6721 theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
6722 all faces of theShape that have tolerances greater then 1.e7.
6725 theShape the shape to be exploded
6726 theShapeType the type of sub-shapes to be returned (see
6727 ShapeType()). Can have the values FACE,
6728 EDGE and VERTEX only.
6729 theCondition the condition type (see GEOM::comparison_condition).
6730 theTolerance the tolerance filter.
6731 theName Object name; when specified, this parameter is used
6732 for result publication in the study. Otherwise, if automatic
6733 publication is switched on, default value is used for result name.
6736 The list of shapes that satisfy the conditions.
6738 # Example: see GEOM_TestAll.py
6739 ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
6740 theCondition, theTolerance)
6741 RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
6742 self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
6745 ## Check if the object is a sub-object of another GEOM object.
6746 # @param aSubObject Checked sub-object (or its parent object, in case if
6747 # \a theSubObjectIndex is non-zero).
6748 # @param anObject An object that is checked for ownership (or its parent object,
6749 # in case if \a theObjectIndex is non-zero).
6750 # @param aSubObjectIndex When non-zero, specifies a sub-shape index that
6751 # identifies a sub-object within its parent specified via \a theSubObject.
6752 # @param anObjectIndex When non-zero, specifies a sub-shape index that
6753 # identifies an object within its parent specified via \a theObject.
6754 # @return TRUE, if the given object contains sub-object.
6755 @ManageTransactions("ShapesOp")
6756 def IsSubShapeBelongsTo(self, aSubObject, anObject, aSubObjectIndex = 0, anObjectIndex = 0):
6758 Check if the object is a sub-object of another GEOM object.
6761 aSubObject Checked sub-object (or its parent object, in case if
6762 \a theSubObjectIndex is non-zero).
6763 anObject An object that is checked for ownership (or its parent object,
6764 in case if \a theObjectIndex is non-zero).
6765 aSubObjectIndex When non-zero, specifies a sub-shape index that
6766 identifies a sub-object within its parent specified via \a theSubObject.
6767 anObjectIndex When non-zero, specifies a sub-shape index that
6768 identifies an object within its parent specified via \a theObject.
6771 TRUE, if the given object contains sub-object.
6773 IsOk = self.ShapesOp.IsSubShapeBelongsTo(aSubObject, aSubObjectIndex, anObject, anObjectIndex)
6774 RaiseIfFailed("IsSubShapeBelongsTo", self.ShapesOp)
6777 ## Perform extraction of sub-shapes from the main shape.
6779 # @param theShape the main shape
6780 # @param theListOfID the list of sub-shape IDs to be extracted from
6782 # @return New GEOM.GEOM_Object, containing the shape without
6783 # extracted sub-shapes.
6785 # @ref swig_MakeExtraction "Example"
6786 @ManageTransactions("ShapesOp")
6787 def MakeExtraction(self, theShape, theListOfID, theName=None):
6789 Perform extraction of sub-shapes from the main shape.
6792 theShape the main shape
6793 theListOfID the list of sub-shape IDs to be extracted from
6797 New GEOM.GEOM_Object, containing the shape without
6798 extracted sub-shapes.
6800 # Example: see GEOM_TestAll.py
6801 (anObj, aStat) = self.ShapesOp.MakeExtraction(theShape, theListOfID)
6802 RaiseIfFailed("MakeExtraction", self.ShapesOp)
6803 self._autoPublish(anObj, theName, "Extraction")
6806 # end of l4_decompose
6809 ## @addtogroup l4_decompose_d
6812 ## Deprecated method
6813 # It works like SubShapeAllSortedCentres(), but wrongly
6814 # defines centres of faces, shells and solids.
6815 @ManageTransactions("ShapesOp")
6816 def SubShapeAllSorted(self, aShape, aType, theName=None):
6819 It works like geompy.SubShapeAllSortedCentres, but wrongly
6820 defines centres of faces, shells and solids.
6822 ListObj = self.ShapesOp.MakeExplode(aShape, EnumToLong( aType ), True)
6823 RaiseIfFailed("MakeExplode", self.ShapesOp)
6824 self._autoPublish(ListObj, theName, "subshape")
6827 ## Deprecated method
6828 # It works like SubShapeAllSortedCentresIDs(), but wrongly
6829 # defines centres of faces, shells and solids.
6830 @ManageTransactions("ShapesOp")
6831 def SubShapeAllSortedIDs(self, aShape, aType):
6834 It works like geompy.SubShapeAllSortedCentresIDs, but wrongly
6835 defines centres of faces, shells and solids.
6837 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, EnumToLong( aType ), True)
6838 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6841 ## Deprecated method
6842 # It works like SubShapeSortedCentres(), but has a bug
6843 # (wrongly defines centres of faces, shells and solids).
6844 def SubShapeSorted(self, aShape, aType, ListOfInd, theName=None):
6847 It works like geompy.SubShapeSortedCentres, but has a bug
6848 (wrongly defines centres of faces, shells and solids).
6851 AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, EnumToLong( aType ))
6852 for ind in ListOfInd:
6853 ListOfIDs.append(AllShapeIDsList[ind - 1])
6854 # note: auto-publishing is done in self.GetSubShape()
6855 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6858 # end of l4_decompose_d
6861 ## @addtogroup l3_healing
6864 ## Apply a sequence of Shape Healing operators to the given object.
6865 # @param theShape Shape to be processed.
6866 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
6867 # @param theParameters List of names of parameters
6868 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
6869 # @param theValues List of values of parameters, in the same order
6870 # as parameters are listed in <VAR>theParameters</VAR> list.
6871 # @param theName Object name; when specified, this parameter is used
6872 # for result publication in the study. Otherwise, if automatic
6873 # publication is switched on, default value is used for result name.
6875 # <b> Operators and Parameters: </b> \n
6877 # * \b FixShape - corrects invalid shapes. \n
6878 # - \b FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them. \n
6879 # - \b FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction. \n
6881 # * \b FixFaceSize - removes small faces, such as spots and strips.\n
6882 # - \b FixFaceSize.Tolerance - defines minimum possible face size. \n
6883 # - \b DropSmallEdges - removes edges, which merge with neighbouring edges. \n
6884 # - \b DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.\n
6885 # - \b DropSmallSolids - either removes small solids or merges them with neighboring ones. \n
6886 # - \b DropSmallSolids.WidthFactorThreshold - defines maximum value of <em>2V/S</em> of a solid which is considered small, where \a V is volume and \a S is surface area of the solid. \n
6887 # - \b DropSmallSolids.VolumeThreshold - defines maximum volume of a solid which is considered small. If the both tolerances are privided a solid is considered small if it meets the both criteria. \n
6888 # - \b DropSmallSolids.MergeSolids - if "1", small solids are removed; if "0" small solids are merged to adjacent non-small solids or left untouched if cannot be merged. \n
6890 # * \b SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical
6891 # surfaces in segments using a certain angle. \n
6892 # - \b SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
6893 # if Angle=180, four if Angle=90, etc). \n
6894 # - \b SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.\n
6896 # * \b SplitClosedFaces - splits closed faces in segments.
6897 # The number of segments depends on the number of splitting points.\n
6898 # - \b SplitClosedFaces.NbSplitPoints - the number of splitting points.\n
6900 # * \b SplitContinuity - splits shapes to reduce continuities of curves and surfaces.\n
6901 # - \b SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.\n
6902 # - \b SplitContinuity.SurfaceContinuity - required continuity for surfaces.\n
6903 # - \b SplitContinuity.CurveContinuity - required continuity for curves.\n
6904 # This and the previous parameters can take the following values:\n
6905 # \b Parametric \b Continuity \n
6906 # \b C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces
6907 # are coincidental. The curves or surfaces may still meet at an angle, giving rise to a sharp corner or edge).\n
6908 # \b C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces are parallel,
6909 # ruling out sharp edges).\n
6910 # \b C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves or surfaces
6911 # are of the same magnitude).\n
6912 # \b CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of curves
6913 # or surfaces (d/du C(u)) are the same at junction. \n
6914 # \b Geometric \b Continuity \n
6915 # \b G1: first derivatives are proportional at junction.\n
6916 # The curve tangents thus have the same direction, but not necessarily the same magnitude.
6917 # i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).\n
6918 # \b G2: first and second derivatives are proportional at junction.
6919 # As the names imply, geometric continuity requires the geometry to be continuous, while parametric
6920 # continuity requires that the underlying parameterization was continuous as well.
6921 # Parametric continuity of order n implies geometric continuity of order n, but not vice-versa.\n
6923 # * \b BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:\n
6924 # - \b BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.\n
6925 # - \b BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.\n
6926 # - \b BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.\n
6927 # - \b BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation
6928 # with the specified parameters.\n
6929 # - \b BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation
6930 # with the specified parameters.\n
6931 # - \b BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.\n
6932 # - \b BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.\n
6933 # - \b BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.\n
6934 # - \b BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.\n
6936 # * \b ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.\n
6937 # - \b ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.\n
6938 # - \b ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.\n
6939 # - \b ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.\n
6940 # - \b ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.\n
6942 # * \b SameParameter - fixes edges of 2D and 3D curves not having the same parameter.\n
6943 # - \b SameParameter.Tolerance3d - defines tolerance for fixing of edges.\n
6946 # @return New GEOM.GEOM_Object, containing processed shape.
6948 # \n @ref tui_shape_processing "Example"
6949 @ManageTransactions("HealOp")
6950 def ProcessShape(self, theShape, theOperators, theParameters, theValues, theName=None):
6952 Apply a sequence of Shape Healing operators to the given object.
6955 theShape Shape to be processed.
6956 theValues List of values of parameters, in the same order
6957 as parameters are listed in theParameters list.
6958 theOperators List of names of operators ('FixShape', 'SplitClosedFaces', etc.).
6959 theParameters List of names of parameters
6960 ('FixShape.Tolerance3d', 'SplitClosedFaces.NbSplitPoints', etc.).
6961 theName Object name; when specified, this parameter is used
6962 for result publication in the study. Otherwise, if automatic
6963 publication is switched on, default value is used for result name.
6965 Operators and Parameters:
6967 * FixShape - corrects invalid shapes.
6968 * FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them.
6969 * FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction.
6970 * FixFaceSize - removes small faces, such as spots and strips.
6971 * FixFaceSize.Tolerance - defines minimum possible face size.
6972 * DropSmallEdges - removes edges, which merge with neighbouring edges.
6973 * DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.
6974 * DropSmallSolids - either removes small solids or merges them with neighboring ones.
6975 * DropSmallSolids.WidthFactorThreshold - defines maximum value of 2V/S of a solid which is considered small, where V is volume and S is surface area of the solid.
6976 * DropSmallSolids.VolumeThreshold - defines maximum volume of a solid which is considered small. If the both tolerances are privided a solid is considered small if it meets the both criteria.
6977 * DropSmallSolids.MergeSolids - if '1', small solids are removed; if '0' small solids are merged to adjacent non-small solids or left untouched if cannot be merged.
6979 * SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical surfaces
6980 in segments using a certain angle.
6981 * SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
6982 if Angle=180, four if Angle=90, etc).
6983 * SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.
6984 * SplitClosedFaces - splits closed faces in segments. The number of segments depends on the number of
6986 * SplitClosedFaces.NbSplitPoints - the number of splitting points.
6987 * SplitContinuity - splits shapes to reduce continuities of curves and surfaces.
6988 * SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.
6989 * SplitContinuity.SurfaceContinuity - required continuity for surfaces.
6990 * SplitContinuity.CurveContinuity - required continuity for curves.
6991 This and the previous parameters can take the following values:
6993 Parametric Continuity:
6994 C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces are
6995 coincidental. The curves or surfaces may still meet at an angle,
6996 giving rise to a sharp corner or edge).
6997 C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces
6998 are parallel, ruling out sharp edges).
6999 C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves
7000 or surfaces are of the same magnitude).
7001 CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of
7002 curves or surfaces (d/du C(u)) are the same at junction.
7004 Geometric Continuity:
7005 G1: first derivatives are proportional at junction.
7006 The curve tangents thus have the same direction, but not necessarily the same magnitude.
7007 i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).
7008 G2: first and second derivatives are proportional at junction. As the names imply,
7009 geometric continuity requires the geometry to be continuous, while parametric continuity requires
7010 that the underlying parameterization was continuous as well. Parametric continuity of order n implies
7011 geometric continuity of order n, but not vice-versa.
7012 * BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:
7013 * BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.
7014 * BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.
7015 * BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.
7016 * BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation with
7017 the specified parameters.
7018 * BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation with
7019 the specified parameters.
7020 * BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.
7021 * BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.
7022 * BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.
7023 * BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.
7024 * ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.
7025 * ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.
7026 * ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.
7027 * ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.
7028 * ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.
7029 * SameParameter - fixes edges of 2D and 3D curves not having the same parameter.
7030 * SameParameter.Tolerance3d - defines tolerance for fixing of edges.
7033 New GEOM.GEOM_Object, containing processed shape.
7035 Note: For more information look through SALOME Geometry User's Guide->
7036 -> Introduction to Geometry-> Repairing Operations-> Shape Processing
7038 # Example: see GEOM_TestHealing.py
7039 theValues,Parameters = ParseList(theValues)
7040 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
7041 # To avoid script failure in case of good argument shape
7042 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
7044 RaiseIfFailed("ProcessShape", self.HealOp)
7045 for string in (theOperators + theParameters):
7046 Parameters = ":" + Parameters
7048 anObj.SetParameters(Parameters)
7049 self._autoPublish(anObj, theName, "healed")
7052 ## Remove faces from the given object (shape).
7053 # @param theObject Shape to be processed.
7054 # @param theFaces Indices of faces to be removed, if EMPTY then the method
7055 # removes ALL faces of the given object.
7056 # @param theName Object name; when specified, this parameter is used
7057 # for result publication in the study. Otherwise, if automatic
7058 # publication is switched on, default value is used for result name.
7060 # @return New GEOM.GEOM_Object, containing processed shape.
7062 # @ref tui_suppress_faces "Example"
7063 @ManageTransactions("HealOp")
7064 def SuppressFaces(self, theObject, theFaces, theName=None):
7066 Remove faces from the given object (shape).
7069 theObject Shape to be processed.
7070 theFaces Indices of faces to be removed, if EMPTY then the method
7071 removes ALL faces of the given object.
7072 theName Object name; when specified, this parameter is used
7073 for result publication in the study. Otherwise, if automatic
7074 publication is switched on, default value is used for result name.
7077 New GEOM.GEOM_Object, containing processed shape.
7079 # Example: see GEOM_TestHealing.py
7080 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
7081 RaiseIfFailed("SuppressFaces", self.HealOp)
7082 self._autoPublish(anObj, theName, "suppressFaces")
7085 ## Sewing of faces into a single shell.
7086 # @param ListShape Shapes to be processed.
7087 # @param theTolerance Required tolerance value.
7088 # @param AllowNonManifold Flag that allows non-manifold sewing.
7089 # @param theName Object name; when specified, this parameter is used
7090 # for result publication in the study. Otherwise, if automatic
7091 # publication is switched on, default value is used for result name.
7093 # @return New GEOM.GEOM_Object, containing a result shell.
7095 # @ref tui_sewing "Example"
7096 def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
7098 Sewing of faces into a single shell.
7101 ListShape Shapes to be processed.
7102 theTolerance Required tolerance value.
7103 AllowNonManifold Flag that allows non-manifold sewing.
7104 theName Object name; when specified, this parameter is used
7105 for result publication in the study. Otherwise, if automatic
7106 publication is switched on, default value is used for result name.
7109 New GEOM.GEOM_Object, containing containing a result shell.
7111 # Example: see GEOM_TestHealing.py
7112 # note: auto-publishing is done in self.Sew()
7113 anObj = self.Sew(ListShape, theTolerance, AllowNonManifold, theName)
7116 ## Sewing of faces into a single shell.
7117 # @param ListShape Shapes to be processed.
7118 # @param theTolerance Required tolerance value.
7119 # @param AllowNonManifold Flag that allows non-manifold sewing.
7120 # @param theName Object name; when specified, this parameter is used
7121 # for result publication in the study. Otherwise, if automatic
7122 # publication is switched on, default value is used for result name.
7124 # @return New GEOM.GEOM_Object, containing a result shell.
7125 @ManageTransactions("HealOp")
7126 def Sew(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
7128 Sewing of faces into a single shell.
7131 ListShape Shapes to be processed.
7132 theTolerance Required tolerance value.
7133 AllowNonManifold Flag that allows non-manifold sewing.
7134 theName Object name; when specified, this parameter is used
7135 for result publication in the study. Otherwise, if automatic
7136 publication is switched on, default value is used for result name.
7139 New GEOM.GEOM_Object, containing a result shell.
7141 # Example: see MakeSewing() above
7142 theTolerance,Parameters = ParseParameters(theTolerance)
7143 if AllowNonManifold:
7144 anObj = self.HealOp.SewAllowNonManifold( ToList( ListShape ), theTolerance)
7146 anObj = self.HealOp.Sew( ToList( ListShape ), theTolerance)
7147 # To avoid script failure in case of good argument shape
7148 # (Fix of test cases geom/bugs11/L7,L8)
7149 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
7151 RaiseIfFailed("Sew", self.HealOp)
7152 anObj.SetParameters(Parameters)
7153 self._autoPublish(anObj, theName, "sewed")
7156 ## Rebuild the topology of theSolids by removing
7157 # the faces that are shared by several solids.
7158 # @param theSolids A compound or a list of solids to be processed.
7159 # @param theName Object name; when specified, this parameter is used
7160 # for result publication in the study. Otherwise, if automatic
7161 # publication is switched on, default value is used for result name.
7163 # @return New GEOM.GEOM_Object, containing processed shape.
7165 # @ref tui_remove_webs "Example"
7166 @ManageTransactions("HealOp")
7167 def RemoveInternalFaces (self, theSolids, theName=None):
7169 Rebuild the topology of theSolids by removing
7170 the faces that are shared by several solids.
7173 theSolids A compound or a list of solids to be processed.
7174 theName Object name; when specified, this parameter is used
7175 for result publication in the study. Otherwise, if automatic
7176 publication is switched on, default value is used for result name.
7179 New GEOM.GEOM_Object, containing processed shape.
7181 # Example: see GEOM_TestHealing.py
7182 anObj = self.HealOp.RemoveInternalFaces(ToList(theSolids))
7183 RaiseIfFailed("RemoveInternalFaces", self.HealOp)
7184 self._autoPublish(anObj, theName, "removeWebs")
7187 ## Remove internal wires and edges from the given object (face).
7188 # @param theObject Shape to be processed.
7189 # @param theWires Indices of wires to be removed, if EMPTY then the method
7190 # removes ALL internal wires of the given object.
7191 # @param theName Object name; when specified, this parameter is used
7192 # for result publication in the study. Otherwise, if automatic
7193 # publication is switched on, default value is used for result name.
7195 # @return New GEOM.GEOM_Object, containing processed shape.
7197 # @ref tui_suppress_internal_wires "Example"
7198 @ManageTransactions("HealOp")
7199 def SuppressInternalWires(self, theObject, theWires, theName=None):
7201 Remove internal wires and edges from the given object (face).
7204 theObject Shape to be processed.
7205 theWires Indices of wires to be removed, if EMPTY then the method
7206 removes ALL internal wires of the given object.
7207 theName Object name; when specified, this parameter is used
7208 for result publication in the study. Otherwise, if automatic
7209 publication is switched on, default value is used for result name.
7212 New GEOM.GEOM_Object, containing processed shape.
7214 # Example: see GEOM_TestHealing.py
7215 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
7216 RaiseIfFailed("RemoveIntWires", self.HealOp)
7217 self._autoPublish(anObj, theName, "suppressWires")
7220 ## Remove internal closed contours (holes) from the given object.
7221 # @param theObject Shape to be processed.
7222 # @param theWires Indices of wires to be removed, if EMPTY then the method
7223 # removes ALL internal holes of the given object
7224 # @param theName Object name; when specified, this parameter is used
7225 # for result publication in the study. Otherwise, if automatic
7226 # publication is switched on, default value is used for result name.
7228 # @return New GEOM.GEOM_Object, containing processed shape.
7230 # @ref tui_suppress_holes "Example"
7231 @ManageTransactions("HealOp")
7232 def SuppressHoles(self, theObject, theWires, theName=None):
7234 Remove internal closed contours (holes) from the given object.
7237 theObject Shape to be processed.
7238 theWires Indices of wires to be removed, if EMPTY then the method
7239 removes ALL internal holes of the given object
7240 theName Object name; when specified, this parameter is used
7241 for result publication in the study. Otherwise, if automatic
7242 publication is switched on, default value is used for result name.
7245 New GEOM.GEOM_Object, containing processed shape.
7247 # Example: see GEOM_TestHealing.py
7248 anObj = self.HealOp.FillHoles(theObject, theWires)
7249 RaiseIfFailed("FillHoles", self.HealOp)
7250 self._autoPublish(anObj, theName, "suppressHoles")
7253 ## Close an open wire.
7254 # @param theObject Shape to be processed.
7255 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
7256 # if [ ], then <VAR>theObject</VAR> itself is a wire.
7257 # @param isCommonVertex If True : closure by creation of a common vertex,
7258 # If False : closure by creation of an edge between ends.
7259 # @param theName Object name; when specified, this parameter is used
7260 # for result publication in the study. Otherwise, if automatic
7261 # publication is switched on, default value is used for result name.
7263 # @return New GEOM.GEOM_Object, containing processed shape.
7265 # @ref tui_close_contour "Example"
7266 @ManageTransactions("HealOp")
7267 def CloseContour(self,theObject, theWires, isCommonVertex, theName=None):
7272 theObject Shape to be processed.
7273 theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape,
7274 if [ ], then theObject itself is a wire.
7275 isCommonVertex If True : closure by creation of a common vertex,
7276 If False : closure by creation of an edge between ends.
7277 theName Object name; when specified, this parameter is used
7278 for result publication in the study. Otherwise, if automatic
7279 publication is switched on, default value is used for result name.
7282 New GEOM.GEOM_Object, containing processed shape.
7284 # Example: see GEOM_TestHealing.py
7285 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
7286 RaiseIfFailed("CloseContour", self.HealOp)
7287 self._autoPublish(anObj, theName, "closeContour")
7290 ## Addition of a point to a given edge object.
7291 # @param theObject Shape to be processed.
7292 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
7293 # if -1, then theObject itself is the edge.
7294 # @param theValue Value of parameter on edge or length parameter,
7295 # depending on \a isByParameter.
7296 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], \n
7297 # if FALSE : \a theValue is treated as a length parameter [0..1]
7298 # @param theName Object name; when specified, this parameter is used
7299 # for result publication in the study. Otherwise, if automatic
7300 # publication is switched on, default value is used for result name.
7302 # @return New GEOM.GEOM_Object, containing processed shape.
7304 # @ref tui_add_point_on_edge "Example"
7305 @ManageTransactions("HealOp")
7306 def DivideEdge(self, theObject, theEdgeIndex, theValue, isByParameter, theName=None):
7308 Addition of a point to a given edge object.
7311 theObject Shape to be processed.
7312 theEdgeIndex Index of edge to be divided within theObject's shape,
7313 if -1, then theObject itself is the edge.
7314 theValue Value of parameter on edge or length parameter,
7315 depending on isByParameter.
7316 isByParameter If TRUE : theValue is treated as a curve parameter [0..1],
7317 if FALSE : theValue is treated as a length parameter [0..1]
7318 theName Object name; when specified, this parameter is used
7319 for result publication in the study. Otherwise, if automatic
7320 publication is switched on, default value is used for result name.
7323 New GEOM.GEOM_Object, containing processed shape.
7325 # Example: see GEOM_TestHealing.py
7326 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
7327 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
7328 RaiseIfFailed("DivideEdge", self.HealOp)
7329 anObj.SetParameters(Parameters)
7330 self._autoPublish(anObj, theName, "divideEdge")
7333 ## Addition of points to a given edge of \a theObject by projecting
7334 # other points to the given edge.
7335 # @param theObject Shape to be processed.
7336 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
7337 # if -1, then theObject itself is the edge.
7338 # @param thePoints List of points to project to theEdgeIndex-th edge.
7339 # @param theName Object name; when specified, this parameter is used
7340 # for result publication in the study. Otherwise, if automatic
7341 # publication is switched on, default value is used for result name.
7343 # @return New GEOM.GEOM_Object, containing processed shape.
7345 # @ref tui_add_point_on_edge "Example"
7346 @ManageTransactions("HealOp")
7347 def DivideEdgeByPoint(self, theObject, theEdgeIndex, thePoints, theName=None):
7349 Addition of points to a given edge of \a theObject by projecting
7350 other points to the given edge.
7353 theObject Shape to be processed.
7354 theEdgeIndex The edge or its index to be divided within theObject's shape,
7355 if -1, then theObject itself is the edge.
7356 thePoints List of points to project to theEdgeIndex-th edge.
7357 theName Object name; when specified, this parameter is used
7358 for result publication in the study. Otherwise, if automatic
7359 publication is switched on, default value is used for result name.
7362 New GEOM.GEOM_Object, containing processed shape.
7364 # Example: see GEOM_TestHealing.py
7365 if isinstance( theEdgeIndex, GEOM._objref_GEOM_Object ):
7366 theEdgeIndex = self.GetSubShapeID( theObject, theEdgeIndex )
7367 anObj = self.HealOp.DivideEdgeByPoint(theObject, theEdgeIndex, ToList( thePoints ))
7368 RaiseIfFailed("DivideEdgeByPoint", self.HealOp)
7369 self._autoPublish(anObj, theName, "divideEdge")
7372 ## Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
7373 # @param theWire Wire to minimize the number of C1 continuous edges in.
7374 # @param theVertices A list of vertices to suppress. If the list
7375 # is empty, all vertices in a wire will be assumed.
7376 # @param theName Object name; when specified, this parameter is used
7377 # for result publication in the study. Otherwise, if automatic
7378 # publication is switched on, default value is used for result name.
7380 # @return New GEOM.GEOM_Object with modified wire.
7382 # @ref tui_fuse_collinear_edges "Example"
7383 @ManageTransactions("HealOp")
7384 def FuseCollinearEdgesWithinWire(self, theWire, theVertices = [], theName=None):
7386 Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
7389 theWire Wire to minimize the number of C1 continuous edges in.
7390 theVertices A list of vertices to suppress. If the list
7391 is empty, all vertices in a wire will be assumed.
7392 theName Object name; when specified, this parameter is used
7393 for result publication in the study. Otherwise, if automatic
7394 publication is switched on, default value is used for result name.
7397 New GEOM.GEOM_Object with modified wire.
7399 anObj = self.HealOp.FuseCollinearEdgesWithinWire(theWire, theVertices)
7400 RaiseIfFailed("FuseCollinearEdgesWithinWire", self.HealOp)
7401 self._autoPublish(anObj, theName, "fuseEdges")
7404 ## Change orientation of the given object. Updates given shape.
7405 # @param theObject Shape to be processed.
7406 # @return Updated <var>theObject</var>
7408 # @ref swig_todo "Example"
7409 @ManageTransactions("HealOp")
7410 def ChangeOrientationShell(self,theObject):
7412 Change orientation of the given object. Updates given shape.
7415 theObject Shape to be processed.
7420 theObject = self.HealOp.ChangeOrientation(theObject)
7421 RaiseIfFailed("ChangeOrientation", self.HealOp)
7424 ## Change orientation of the given object.
7425 # @param theObject Shape to be processed.
7426 # @param theName Object name; when specified, this parameter is used
7427 # for result publication in the study. Otherwise, if automatic
7428 # publication is switched on, default value is used for result name.
7430 # @return New GEOM.GEOM_Object, containing processed shape.
7432 # @ref swig_todo "Example"
7433 @ManageTransactions("HealOp")
7434 def ChangeOrientationShellCopy(self, theObject, theName=None):
7436 Change orientation of the given object.
7439 theObject Shape to be processed.
7440 theName Object name; when specified, this parameter is used
7441 for result publication in the study. Otherwise, if automatic
7442 publication is switched on, default value is used for result name.
7445 New GEOM.GEOM_Object, containing processed shape.
7447 anObj = self.HealOp.ChangeOrientationCopy(theObject)
7448 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
7449 self._autoPublish(anObj, theName, "reversed")
7452 ## Try to limit tolerance of the given object by value \a theTolerance.
7453 # @param theObject Shape to be processed.
7454 # @param theTolerance Required tolerance value.
7455 # @param theName Object name; when specified, this parameter is used
7456 # for result publication in the study. Otherwise, if automatic
7457 # publication is switched on, default value is used for result name.
7459 # @return New GEOM.GEOM_Object, containing processed shape.
7461 # @ref tui_limit_tolerance "Example"
7462 @ManageTransactions("HealOp")
7463 def LimitTolerance(self, theObject, theTolerance = 1e-07, theName=None):
7465 Try to limit tolerance of the given object by value theTolerance.
7468 theObject Shape to be processed.
7469 theTolerance Required tolerance value.
7470 theName Object name; when specified, this parameter is used
7471 for result publication in the study. Otherwise, if automatic
7472 publication is switched on, default value is used for result name.
7475 New GEOM.GEOM_Object, containing processed shape.
7477 anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
7478 RaiseIfFailed("LimitTolerance", self.HealOp)
7479 self._autoPublish(anObj, theName, "limitTolerance")
7482 ## Get a list of wires (wrapped in GEOM.GEOM_Object-s),
7483 # that constitute a free boundary of the given shape.
7484 # @param theObject Shape to get free boundary of.
7485 # @param theName Object name; when specified, this parameter is used
7486 # for result publication in the study. Otherwise, if automatic
7487 # publication is switched on, default value is used for result name.
7489 # @return [\a status, \a theClosedWires, \a theOpenWires]
7490 # \n \a status: FALSE, if an error(s) occurred during the method execution.
7491 # \n \a theClosedWires: Closed wires on the free boundary of the given shape.
7492 # \n \a theOpenWires: Open wires on the free boundary of the given shape.
7494 # @ref tui_free_boundaries_page "Example"
7495 @ManageTransactions("HealOp")
7496 def GetFreeBoundary(self, theObject, theName=None):
7498 Get a list of wires (wrapped in GEOM.GEOM_Object-s),
7499 that constitute a free boundary of the given shape.
7502 theObject Shape to get free boundary of.
7503 theName Object name; when specified, this parameter is used
7504 for result publication in the study. Otherwise, if automatic
7505 publication is switched on, default value is used for result name.
7508 [status, theClosedWires, theOpenWires]
7509 status: FALSE, if an error(s) occurred during the method execution.
7510 theClosedWires: Closed wires on the free boundary of the given shape.
7511 theOpenWires: Open wires on the free boundary of the given shape.
7513 # Example: see GEOM_TestHealing.py
7514 anObj = self.HealOp.GetFreeBoundary( ToList( theObject ))
7515 RaiseIfFailed("GetFreeBoundary", self.HealOp)
7516 self._autoPublish(anObj[1], theName, "closedWire")
7517 self._autoPublish(anObj[2], theName, "openWire")
7520 ## Replace coincident faces in \a theShapes by one face.
7521 # @param theShapes Initial shapes, either a list or compound of shapes.
7522 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
7523 # @param doKeepNonSolids If FALSE, only solids will present in the result,
7524 # otherwise all initial shapes.
7525 # @param theName Object name; when specified, this parameter is used
7526 # for result publication in the study. Otherwise, if automatic
7527 # publication is switched on, default value is used for result name.
7529 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7531 # @ref tui_glue_faces "Example"
7532 @ManageTransactions("ShapesOp")
7533 def MakeGlueFaces(self, theShapes, theTolerance, doKeepNonSolids=True, theName=None):
7535 Replace coincident faces in theShapes by one face.
7538 theShapes Initial shapes, either a list or compound of shapes.
7539 theTolerance Maximum distance between faces, which can be considered as coincident.
7540 doKeepNonSolids If FALSE, only solids will present in the result,
7541 otherwise all initial shapes.
7542 theName Object name; when specified, this parameter is used
7543 for result publication in the study. Otherwise, if automatic
7544 publication is switched on, default value is used for result name.
7547 New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7549 # Example: see GEOM_Spanner.py
7550 theTolerance,Parameters = ParseParameters(theTolerance)
7551 anObj = self.ShapesOp.MakeGlueFaces(ToList(theShapes), theTolerance, doKeepNonSolids)
7553 raise RuntimeError("MakeGlueFaces : " + self.ShapesOp.GetErrorCode())
7554 anObj.SetParameters(Parameters)
7555 self._autoPublish(anObj, theName, "glueFaces")
7558 ## Find coincident faces in \a theShapes for possible gluing.
7559 # @param theShapes Initial shapes, either a list or compound of shapes.
7560 # @param theTolerance Maximum distance between faces,
7561 # which can be considered as coincident.
7562 # @param theName Object name; when specified, this parameter is used
7563 # for result publication in the study. Otherwise, if automatic
7564 # publication is switched on, default value is used for result name.
7566 # @return GEOM.ListOfGO
7568 # @ref tui_glue_faces "Example"
7569 @ManageTransactions("ShapesOp")
7570 def GetGlueFaces(self, theShapes, theTolerance, theName=None):
7572 Find coincident faces in theShapes for possible gluing.
7575 theShapes Initial shapes, either a list or compound of shapes.
7576 theTolerance Maximum distance between faces,
7577 which can be considered as coincident.
7578 theName Object name; when specified, this parameter is used
7579 for result publication in the study. Otherwise, if automatic
7580 publication is switched on, default value is used for result name.
7585 anObj = self.ShapesOp.GetGlueFaces(ToList(theShapes), theTolerance)
7586 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
7587 self._autoPublish(anObj, theName, "facesToGlue")
7590 ## Replace coincident faces in \a theShapes by one face
7591 # in compliance with given list of faces
7592 # @param theShapes Initial shapes, either a list or compound of shapes.
7593 # @param theTolerance Maximum distance between faces,
7594 # which can be considered as coincident.
7595 # @param theFaces List of faces for gluing.
7596 # @param doKeepNonSolids If FALSE, only solids will present in the result,
7597 # otherwise all initial shapes.
7598 # @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
7599 # will be glued, otherwise only the edges,
7600 # belonging to <VAR>theFaces</VAR>.
7601 # @param theName Object name; when specified, this parameter is used
7602 # for result publication in the study. Otherwise, if automatic
7603 # publication is switched on, default value is used for result name.
7605 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7607 # @ref tui_glue_faces "Example"
7608 @ManageTransactions("ShapesOp")
7609 def MakeGlueFacesByList(self, theShapes, theTolerance, theFaces,
7610 doKeepNonSolids=True, doGlueAllEdges=True, theName=None):
7612 Replace coincident faces in theShapes by one face
7613 in compliance with given list of faces
7616 theShapes theShapes Initial shapes, either a list or compound of shapes.
7617 theTolerance Maximum distance between faces,
7618 which can be considered as coincident.
7619 theFaces List of faces for gluing.
7620 doKeepNonSolids If FALSE, only solids will present in the result,
7621 otherwise all initial shapes.
7622 doGlueAllEdges If TRUE, all coincident edges of theShape
7623 will be glued, otherwise only the edges,
7624 belonging to theFaces.
7625 theName Object name; when specified, this parameter is used
7626 for result publication in the study. Otherwise, if automatic
7627 publication is switched on, default value is used for result name.
7630 New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7632 anObj = self.ShapesOp.MakeGlueFacesByList(ToList(theShapes), theTolerance, ToList(theFaces),
7633 doKeepNonSolids, doGlueAllEdges)
7635 raise RuntimeError("MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode())
7636 self._autoPublish(anObj, theName, "glueFaces")
7639 ## Replace coincident edges in \a theShapes by one edge.
7640 # @param theShapes Initial shapes, either a list or compound of shapes.
7641 # @param theTolerance Maximum distance between edges, which can be considered as coincident.
7642 # @param theName Object name; when specified, this parameter is used
7643 # for result publication in the study. Otherwise, if automatic
7644 # publication is switched on, default value is used for result name.
7646 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7648 # @ref tui_glue_edges "Example"
7649 @ManageTransactions("ShapesOp")
7650 def MakeGlueEdges(self, theShapes, theTolerance, theName=None):
7652 Replace coincident edges in theShapes by one edge.
7655 theShapes Initial shapes, either a list or compound of shapes.
7656 theTolerance Maximum distance between edges, which can be considered as coincident.
7657 theName Object name; when specified, this parameter is used
7658 for result publication in the study. Otherwise, if automatic
7659 publication is switched on, default value is used for result name.
7662 New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7664 theTolerance,Parameters = ParseParameters(theTolerance)
7665 anObj = self.ShapesOp.MakeGlueEdges(ToList(theShapes), theTolerance)
7667 raise RuntimeError("MakeGlueEdges : " + self.ShapesOp.GetErrorCode())
7668 anObj.SetParameters(Parameters)
7669 self._autoPublish(anObj, theName, "glueEdges")
7672 ## Find coincident edges in \a theShapes for possible gluing.
7673 # @param theShapes Initial shapes, either a list or compound of shapes.
7674 # @param theTolerance Maximum distance between edges,
7675 # which can be considered as coincident.
7676 # @param theName Object name; when specified, this parameter is used
7677 # for result publication in the study. Otherwise, if automatic
7678 # publication is switched on, default value is used for result name.
7680 # @return GEOM.ListOfGO
7682 # @ref tui_glue_edges "Example"
7683 @ManageTransactions("ShapesOp")
7684 def GetGlueEdges(self, theShapes, theTolerance, theName=None):
7686 Find coincident edges in theShapes for possible gluing.
7689 theShapes Initial shapes, either a list or compound of shapes.
7690 theTolerance Maximum distance between edges,
7691 which can be considered as coincident.
7692 theName Object name; when specified, this parameter is used
7693 for result publication in the study. Otherwise, if automatic
7694 publication is switched on, default value is used for result name.
7699 anObj = self.ShapesOp.GetGlueEdges(ToList(theShapes), theTolerance)
7700 RaiseIfFailed("GetGlueEdges", self.ShapesOp)
7701 self._autoPublish(anObj, theName, "edgesToGlue")
7704 ## Replace coincident edges in theShapes by one edge
7705 # in compliance with given list of edges.
7706 # @param theShapes Initial shapes, either a list or compound of shapes.
7707 # @param theTolerance Maximum distance between edges,
7708 # which can be considered as coincident.
7709 # @param theEdges List of edges for gluing.
7710 # @param theName Object name; when specified, this parameter is used
7711 # for result publication in the study. Otherwise, if automatic
7712 # publication is switched on, default value is used for result name.
7714 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7716 # @ref tui_glue_edges "Example"
7717 @ManageTransactions("ShapesOp")
7718 def MakeGlueEdgesByList(self, theShapes, theTolerance, theEdges, theName=None):
7720 Replace coincident edges in theShapes by one edge
7721 in compliance with given list of edges.
7724 theShapes Initial shapes, either a list or compound of shapes.
7725 theTolerance Maximum distance between edges,
7726 which can be considered as coincident.
7727 theEdges List of edges for gluing.
7728 theName Object name; when specified, this parameter is used
7729 for result publication in the study. Otherwise, if automatic
7730 publication is switched on, default value is used for result name.
7733 New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7735 anObj = self.ShapesOp.MakeGlueEdgesByList(ToList(theShapes), theTolerance, theEdges)
7737 raise RuntimeError("MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode())
7738 self._autoPublish(anObj, theName, "glueEdges")
7744 ## @addtogroup l3_boolean Boolean Operations
7747 # -----------------------------------------------------------------------------
7748 # Boolean (Common, Cut, Fuse, Section)
7749 # -----------------------------------------------------------------------------
7751 ## Perform one of boolean operations on two given shapes.
7752 # @param theShape1 First argument for boolean operation.
7753 # @param theShape2 Second argument for boolean operation.
7754 # @param theOperation Indicates the operation to be done:\n
7755 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
7756 # @param checkSelfInte The flag that tells if the arguments should
7757 # be checked for self-intersection prior to the operation.
7758 # @param theName Object name; when specified, this parameter is used
7759 # for result publication in the study. Otherwise, if automatic
7760 # publication is switched on, default value is used for result name.
7762 # @note This algorithm doesn't find all types of self-intersections.
7763 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7764 # vertex/face and edge/face intersections. Face/face
7765 # intersections detection is switched off as it is a
7766 # time-consuming operation that gives an impact on performance.
7767 # To find all self-intersections please use
7768 # CheckSelfIntersections() method.
7770 # @return New GEOM.GEOM_Object, containing the result shape.
7772 # @ref tui_fuse "Example"
7773 @ManageTransactions("BoolOp")
7774 def MakeBoolean(self, theShape1, theShape2, theOperation, checkSelfInte=False, theName=None):
7776 Perform one of boolean operations on two given shapes.
7779 theShape1 First argument for boolean operation.
7780 theShape2 Second argument for boolean operation.
7781 theOperation Indicates the operation to be done:
7782 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
7783 checkSelfInte The flag that tells if the arguments should
7784 be checked for self-intersection prior to
7786 theName Object name; when specified, this parameter is used
7787 for result publication in the study. Otherwise, if automatic
7788 publication is switched on, default value is used for result name.
7791 This algorithm doesn't find all types of self-intersections.
7792 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7793 vertex/face and edge/face intersections. Face/face
7794 intersections detection is switched off as it is a
7795 time-consuming operation that gives an impact on performance.
7796 To find all self-intersections please use
7797 CheckSelfIntersections() method.
7800 New GEOM.GEOM_Object, containing the result shape.
7802 # Example: see GEOM_TestAll.py
7803 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation, checkSelfInte)
7804 RaiseIfFailed("MakeBoolean", self.BoolOp)
7805 def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" }
7806 self._autoPublish(anObj, theName, def_names[theOperation])
7809 ## Perform Common boolean operation on two given shapes.
7810 # @param theShape1 First argument for boolean operation.
7811 # @param theShape2 Second argument for boolean operation.
7812 # @param checkSelfInte The flag that tells if the arguments should
7813 # be checked for self-intersection prior to the operation.
7814 # @param theName Object name; when specified, this parameter is used
7815 # for result publication in the study. Otherwise, if automatic
7816 # publication is switched on, default value is used for result name.
7818 # @note This algorithm doesn't find all types of self-intersections.
7819 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7820 # vertex/face and edge/face intersections. Face/face
7821 # intersections detection is switched off as it is a
7822 # time-consuming operation that gives an impact on performance.
7823 # To find all self-intersections please use
7824 # CheckSelfIntersections() method.
7826 # @return New GEOM.GEOM_Object, containing the result shape.
7828 # @ref tui_common "Example 1"
7829 # \n @ref swig_MakeCommon "Example 2"
7830 def MakeCommon(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7832 Perform Common boolean operation on two given shapes.
7835 theShape1 First argument for boolean operation.
7836 theShape2 Second argument for boolean operation.
7837 checkSelfInte The flag that tells if the arguments should
7838 be checked for self-intersection prior to
7840 theName Object name; when specified, this parameter is used
7841 for result publication in the study. Otherwise, if automatic
7842 publication is switched on, default value is used for result name.
7845 This algorithm doesn't find all types of self-intersections.
7846 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7847 vertex/face and edge/face intersections. Face/face
7848 intersections detection is switched off as it is a
7849 time-consuming operation that gives an impact on performance.
7850 To find all self-intersections please use
7851 CheckSelfIntersections() method.
7854 New GEOM.GEOM_Object, containing the result shape.
7856 # Example: see GEOM_TestOthers.py
7857 # note: auto-publishing is done in self.MakeBoolean()
7858 return self.MakeBoolean(theShape1, theShape2, 1, checkSelfInte, theName)
7860 ## Perform Cut boolean operation on two given shapes.
7861 # @param theShape1 First argument for boolean operation.
7862 # @param theShape2 Second argument for boolean operation.
7863 # @param checkSelfInte The flag that tells if the arguments should
7864 # be checked for self-intersection prior to the operation.
7865 # @param theName Object name; when specified, this parameter is used
7866 # for result publication in the study. Otherwise, if automatic
7867 # publication is switched on, default value is used for result name.
7869 # @note This algorithm doesn't find all types of self-intersections.
7870 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7871 # vertex/face and edge/face intersections. Face/face
7872 # intersections detection is switched off as it is a
7873 # time-consuming operation that gives an impact on performance.
7874 # To find all self-intersections please use
7875 # CheckSelfIntersections() method.
7877 # @return New GEOM.GEOM_Object, containing the result shape.
7879 # @ref tui_cut "Example 1"
7880 # \n @ref swig_MakeCommon "Example 2"
7881 def MakeCut(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7883 Perform Cut boolean operation on two given shapes.
7886 theShape1 First argument for boolean operation.
7887 theShape2 Second argument for boolean operation.
7888 checkSelfInte The flag that tells if the arguments should
7889 be checked for self-intersection prior to
7891 theName Object name; when specified, this parameter is used
7892 for result publication in the study. Otherwise, if automatic
7893 publication is switched on, default value is used for result name.
7896 This algorithm doesn't find all types of self-intersections.
7897 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7898 vertex/face and edge/face intersections. Face/face
7899 intersections detection is switched off as it is a
7900 time-consuming operation that gives an impact on performance.
7901 To find all self-intersections please use
7902 CheckSelfIntersections() method.
7905 New GEOM.GEOM_Object, containing the result shape.
7908 # Example: see GEOM_TestOthers.py
7909 # note: auto-publishing is done in self.MakeBoolean()
7910 return self.MakeBoolean(theShape1, theShape2, 2, checkSelfInte, theName)
7912 ## Perform Fuse boolean operation on two given shapes.
7913 # @param theShape1 First argument for boolean operation.
7914 # @param theShape2 Second argument for boolean operation.
7915 # @param checkSelfInte The flag that tells if the arguments should
7916 # be checked for self-intersection prior to the operation.
7917 # @param rmExtraEdges The flag that tells if Remove Extra Edges
7918 # operation should be performed during the operation.
7919 # @param theName Object name; when specified, this parameter is used
7920 # for result publication in the study. Otherwise, if automatic
7921 # publication is switched on, default value is used for result name.
7923 # @note This algorithm doesn't find all types of self-intersections.
7924 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7925 # vertex/face and edge/face intersections. Face/face
7926 # intersections detection is switched off as it is a
7927 # time-consuming operation that gives an impact on performance.
7928 # To find all self-intersections please use
7929 # CheckSelfIntersections() method.
7931 # @return New GEOM.GEOM_Object, containing the result shape.
7933 # @ref tui_fuse "Example 1"
7934 # \n @ref swig_MakeCommon "Example 2"
7935 @ManageTransactions("BoolOp")
7936 def MakeFuse(self, theShape1, theShape2, checkSelfInte=False,
7937 rmExtraEdges=False, theName=None):
7939 Perform Fuse boolean operation on two given shapes.
7942 theShape1 First argument for boolean operation.
7943 theShape2 Second argument for boolean operation.
7944 checkSelfInte The flag that tells if the arguments should
7945 be checked for self-intersection prior to
7947 rmExtraEdges The flag that tells if Remove Extra Edges
7948 operation should be performed during the operation.
7949 theName Object name; when specified, this parameter is used
7950 for result publication in the study. Otherwise, if automatic
7951 publication is switched on, default value is used for result name.
7954 This algorithm doesn't find all types of self-intersections.
7955 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7956 vertex/face and edge/face intersections. Face/face
7957 intersections detection is switched off as it is a
7958 time-consuming operation that gives an impact on performance.
7959 To find all self-intersections please use
7960 CheckSelfIntersections() method.
7963 New GEOM.GEOM_Object, containing the result shape.
7966 # Example: see GEOM_TestOthers.py
7967 anObj = self.BoolOp.MakeFuse(theShape1, theShape2,
7968 checkSelfInte, rmExtraEdges)
7969 RaiseIfFailed("MakeFuse", self.BoolOp)
7970 self._autoPublish(anObj, theName, "fuse")
7973 ## Perform Section boolean operation on two given shapes.
7974 # @param theShape1 First argument for boolean operation.
7975 # @param theShape2 Second argument for boolean operation.
7976 # @param checkSelfInte The flag that tells if the arguments should
7977 # be checked for self-intersection prior to the operation.
7978 # If a self-intersection detected the operation fails.
7979 # @param theName Object name; when specified, this parameter is used
7980 # for result publication in the study. Otherwise, if automatic
7981 # publication is switched on, default value is used for result name.
7982 # @return New GEOM.GEOM_Object, containing the result shape.
7984 # @ref tui_section "Example 1"
7985 # \n @ref swig_MakeCommon "Example 2"
7986 def MakeSection(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7988 Perform Section boolean operation on two given shapes.
7991 theShape1 First argument for boolean operation.
7992 theShape2 Second argument for boolean operation.
7993 checkSelfInte The flag that tells if the arguments should
7994 be checked for self-intersection prior to the operation.
7995 If a self-intersection detected the operation fails.
7996 theName Object name; when specified, this parameter is used
7997 for result publication in the study. Otherwise, if automatic
7998 publication is switched on, default value is used for result name.
8000 New GEOM.GEOM_Object, containing the result shape.
8003 # Example: see GEOM_TestOthers.py
8004 # note: auto-publishing is done in self.MakeBoolean()
8005 return self.MakeBoolean(theShape1, theShape2, 4, checkSelfInte, theName)
8007 ## Perform Fuse boolean operation on the list of shapes.
8008 # @param theShapesList Shapes to be fused.
8009 # @param checkSelfInte The flag that tells if the arguments should
8010 # be checked for self-intersection prior to the operation.
8011 # @param rmExtraEdges The flag that tells if Remove Extra Edges
8012 # operation should be performed during the operation.
8013 # @param theName Object name; when specified, this parameter is used
8014 # for result publication in the study. Otherwise, if automatic
8015 # publication is switched on, default value is used for result name.
8017 # @note This algorithm doesn't find all types of self-intersections.
8018 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8019 # vertex/face and edge/face intersections. Face/face
8020 # intersections detection is switched off as it is a
8021 # time-consuming operation that gives an impact on performance.
8022 # To find all self-intersections please use
8023 # CheckSelfIntersections() method.
8025 # @return New GEOM.GEOM_Object, containing the result shape.
8027 # @ref tui_fuse "Example 1"
8028 # \n @ref swig_MakeCommon "Example 2"
8029 @ManageTransactions("BoolOp")
8030 def MakeFuseList(self, theShapesList, checkSelfInte=False,
8031 rmExtraEdges=False, theName=None):
8033 Perform Fuse boolean operation on the list of shapes.
8036 theShapesList Shapes to be fused.
8037 checkSelfInte The flag that tells if the arguments should
8038 be checked for self-intersection prior to
8040 rmExtraEdges The flag that tells if Remove Extra Edges
8041 operation should be performed during the operation.
8042 theName Object name; when specified, this parameter is used
8043 for result publication in the study. Otherwise, if automatic
8044 publication is switched on, default value is used for result name.
8047 This algorithm doesn't find all types of self-intersections.
8048 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8049 vertex/face and edge/face intersections. Face/face
8050 intersections detection is switched off as it is a
8051 time-consuming operation that gives an impact on performance.
8052 To find all self-intersections please use
8053 CheckSelfIntersections() method.
8056 New GEOM.GEOM_Object, containing the result shape.
8059 # Example: see GEOM_TestOthers.py
8060 anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte,
8062 RaiseIfFailed("MakeFuseList", self.BoolOp)
8063 self._autoPublish(anObj, theName, "fuse")
8066 ## Perform Common boolean operation on the list of shapes.
8067 # @param theShapesList Shapes for Common operation.
8068 # @param checkSelfInte The flag that tells if the arguments should
8069 # be checked for self-intersection prior to the operation.
8070 # @param theName Object name; when specified, this parameter is used
8071 # for result publication in the study. Otherwise, if automatic
8072 # publication is switched on, default value is used for result name.
8074 # @note This algorithm doesn't find all types of self-intersections.
8075 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8076 # vertex/face and edge/face intersections. Face/face
8077 # intersections detection is switched off as it is a
8078 # time-consuming operation that gives an impact on performance.
8079 # To find all self-intersections please use
8080 # CheckSelfIntersections() method.
8082 # @return New GEOM.GEOM_Object, containing the result shape.
8084 # @ref tui_common "Example 1"
8085 # \n @ref swig_MakeCommon "Example 2"
8086 @ManageTransactions("BoolOp")
8087 def MakeCommonList(self, theShapesList, checkSelfInte=False, theName=None):
8089 Perform Common boolean operation on the list of shapes.
8092 theShapesList Shapes for Common operation.
8093 checkSelfInte The flag that tells if the arguments should
8094 be checked for self-intersection prior to
8096 theName Object name; when specified, this parameter is used
8097 for result publication in the study. Otherwise, if automatic
8098 publication is switched on, default value is used for result name.
8101 This algorithm doesn't find all types of self-intersections.
8102 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8103 vertex/face and edge/face intersections. Face/face
8104 intersections detection is switched off as it is a
8105 time-consuming operation that gives an impact on performance.
8106 To find all self-intersections please use
8107 CheckSelfIntersections() method.
8110 New GEOM.GEOM_Object, containing the result shape.
8113 # Example: see GEOM_TestOthers.py
8114 anObj = self.BoolOp.MakeCommonList(theShapesList, checkSelfInte)
8115 RaiseIfFailed("MakeCommonList", self.BoolOp)
8116 self._autoPublish(anObj, theName, "common")
8119 ## Perform Cut boolean operation on one object and the list of tools.
8120 # @param theMainShape The object of the operation.
8121 # @param theShapesList The list of tools of the operation.
8122 # @param checkSelfInte The flag that tells if the arguments should
8123 # be checked for self-intersection prior to the operation.
8124 # @param theName Object name; when specified, this parameter is used
8125 # for result publication in the study. Otherwise, if automatic
8126 # publication is switched on, default value is used for result name.
8128 # @note This algorithm doesn't find all types of self-intersections.
8129 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8130 # vertex/face and edge/face intersections. Face/face
8131 # intersections detection is switched off as it is a
8132 # time-consuming operation that gives an impact on performance.
8133 # To find all self-intersections please use
8134 # CheckSelfIntersections() method.
8136 # @return New GEOM.GEOM_Object, containing the result shape.
8138 # @ref tui_cut "Example 1"
8139 # \n @ref swig_MakeCommon "Example 2"
8140 @ManageTransactions("BoolOp")
8141 def MakeCutList(self, theMainShape, theShapesList, checkSelfInte=False, theName=None):
8143 Perform Cut boolean operation on one object and the list of tools.
8146 theMainShape The object of the operation.
8147 theShapesList The list of tools of the operation.
8148 checkSelfInte The flag that tells if the arguments should
8149 be checked for self-intersection prior to
8151 theName Object name; when specified, this parameter is used
8152 for result publication in the study. Otherwise, if automatic
8153 publication is switched on, default value is used for result name.
8156 This algorithm doesn't find all types of self-intersections.
8157 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8158 vertex/face and edge/face intersections. Face/face
8159 intersections detection is switched off as it is a
8160 time-consuming operation that gives an impact on performance.
8161 To find all self-intersections please use
8162 CheckSelfIntersections() method.
8165 New GEOM.GEOM_Object, containing the result shape.
8168 # Example: see GEOM_TestOthers.py
8169 anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList, checkSelfInte)
8170 RaiseIfFailed("MakeCutList", self.BoolOp)
8171 self._autoPublish(anObj, theName, "cut")
8177 ## @addtogroup l3_basic_op
8180 ## Perform partition operation.
8181 # @param ListShapes Shapes to be intersected.
8182 # @param ListTools Shapes to intersect theShapes.
8183 # @param Limit Type of resulting shapes (see ShapeType()).\n
8184 # If this parameter is set to -1 ("Auto"), most appropriate shape limit
8185 # type will be detected automatically.
8186 # @param KeepNonlimitShapes if this parameter == 0, then only shapes of
8187 # target type (equal to Limit) are kept in the result,
8188 # else standalone shapes of lower dimension
8189 # are kept also (if they exist).
8191 # @param theName Object name; when specified, this parameter is used
8192 # for result publication in the study. Otherwise, if automatic
8193 # publication is switched on, default value is used for result name.
8195 # @note Each compound from ListShapes and ListTools will be exploded
8196 # in order to avoid possible intersection between shapes from this compound.
8198 # After implementation new version of PartitionAlgo (October 2006)
8199 # other parameters are ignored by current functionality. They are kept
8200 # in this function only for support old versions.
8201 # @param ListKeepInside Shapes, outside which the results will be deleted.
8202 # Each shape from theKeepInside must belong to theShapes also.
8203 # @param ListRemoveInside Shapes, inside which the results will be deleted.
8204 # Each shape from theRemoveInside must belong to theShapes also.
8205 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
8206 # @param ListMaterials Material indices for each shape. Make sense,
8207 # only if theRemoveWebs is TRUE.
8209 # @return New GEOM.GEOM_Object, containing the result shapes.
8211 # @ref tui_partition "Example"
8212 @ManageTransactions("BoolOp")
8213 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
8214 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
8215 KeepNonlimitShapes=0, theName=None):
8217 Perform partition operation.
8220 ListShapes Shapes to be intersected.
8221 ListTools Shapes to intersect theShapes.
8222 Limit Type of resulting shapes (see geompy.ShapeType)
8223 If this parameter is set to -1 ("Auto"), most appropriate shape limit
8224 type will be detected automatically.
8225 KeepNonlimitShapes if this parameter == 0, then only shapes of
8226 target type (equal to Limit) are kept in the result,
8227 else standalone shapes of lower dimension
8228 are kept also (if they exist).
8230 theName Object name; when specified, this parameter is used
8231 for result publication in the study. Otherwise, if automatic
8232 publication is switched on, default value is used for result name.
8234 Each compound from ListShapes and ListTools will be exploded
8235 in order to avoid possible intersection between shapes from
8238 After implementation new version of PartitionAlgo (October 2006) other
8239 parameters are ignored by current functionality. They are kept in this
8240 function only for support old versions.
8243 ListKeepInside Shapes, outside which the results will be deleted.
8244 Each shape from theKeepInside must belong to theShapes also.
8245 ListRemoveInside Shapes, inside which the results will be deleted.
8246 Each shape from theRemoveInside must belong to theShapes also.
8247 RemoveWebs If TRUE, perform Glue 3D algorithm.
8248 ListMaterials Material indices for each shape. Make sense, only if theRemoveWebs is TRUE.
8251 New GEOM.GEOM_Object, containing the result shapes.
8253 # Example: see GEOM_TestAll.py
8254 if Limit == self.ShapeType["AUTO"]:
8255 # automatic detection of the most appropriate shape limit type
8257 for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
8258 Limit = EnumToLong(lim)
8260 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
8261 ListKeepInside, ListRemoveInside,
8262 Limit, RemoveWebs, ListMaterials,
8263 KeepNonlimitShapes);
8264 RaiseIfFailed("MakePartition", self.BoolOp)
8265 self._autoPublish(anObj, theName, "partition")
8268 ## Perform partition operation.
8269 # This method may be useful if it is needed to make a partition for
8270 # compound contains nonintersected shapes. Performance will be better
8271 # since intersection between shapes from compound is not performed.
8273 # Description of all parameters as in previous method MakePartition().
8274 # One additional parameter is provided:
8275 # @param checkSelfInte The flag that tells if the arguments should
8276 # be checked for self-intersection prior to the operation.
8278 # @note This algorithm doesn't find all types of self-intersections.
8279 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8280 # vertex/face and edge/face intersections. Face/face
8281 # intersections detection is switched off as it is a
8282 # time-consuming operation that gives an impact on performance.
8283 # To find all self-intersections please use
8284 # CheckSelfIntersections() method.
8286 # @note Passed compounds (via ListShapes or via ListTools)
8287 # have to consist of nonintersecting shapes.
8289 # @return New GEOM.GEOM_Object, containing the result shapes.
8291 # @ref swig_todo "Example"
8292 @ManageTransactions("BoolOp")
8293 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
8294 ListKeepInside=[], ListRemoveInside=[],
8295 Limit=ShapeType["AUTO"], RemoveWebs=0,
8296 ListMaterials=[], KeepNonlimitShapes=0,
8297 checkSelfInte=False, theName=None):
8299 Perform partition operation.
8300 This method may be useful if it is needed to make a partition for
8301 compound contains nonintersected shapes. Performance will be better
8302 since intersection between shapes from compound is not performed.
8305 Description of all parameters as in method geompy.MakePartition.
8306 One additional parameter is provided:
8307 checkSelfInte The flag that tells if the arguments should
8308 be checked for self-intersection prior to
8312 This algorithm doesn't find all types of self-intersections.
8313 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8314 vertex/face and edge/face intersections. Face/face
8315 intersections detection is switched off as it is a
8316 time-consuming operation that gives an impact on performance.
8317 To find all self-intersections please use
8318 CheckSelfIntersections() method.
8321 Passed compounds (via ListShapes or via ListTools)
8322 have to consist of nonintersecting shapes.
8325 New GEOM.GEOM_Object, containing the result shapes.
8327 if Limit == self.ShapeType["AUTO"]:
8328 # automatic detection of the most appropriate shape limit type
8330 for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
8331 Limit = EnumToLong(lim)
8333 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
8334 ListKeepInside, ListRemoveInside,
8335 Limit, RemoveWebs, ListMaterials,
8336 KeepNonlimitShapes, checkSelfInte);
8337 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
8338 self._autoPublish(anObj, theName, "partition")
8341 ## See method MakePartition() for more information.
8343 # @ref tui_partition "Example 1"
8344 # \n @ref swig_Partition "Example 2"
8345 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
8346 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
8347 KeepNonlimitShapes=0, theName=None):
8349 See method geompy.MakePartition for more information.
8351 # Example: see GEOM_TestOthers.py
8352 # note: auto-publishing is done in self.MakePartition()
8353 anObj = self.MakePartition(ListShapes, ListTools,
8354 ListKeepInside, ListRemoveInside,
8355 Limit, RemoveWebs, ListMaterials,
8356 KeepNonlimitShapes, theName);
8359 ## Perform partition of the Shape with the Plane
8360 # @param theShape Shape to be intersected.
8361 # @param thePlane Tool shape, to intersect theShape.
8362 # @param theName Object name; when specified, this parameter is used
8363 # for result publication in the study. Otherwise, if automatic
8364 # publication is switched on, default value is used for result name.
8366 # @return New GEOM.GEOM_Object, containing the result shape.
8368 # @note This operation is a shortcut to the more general @ref MakePartition
8369 # operation, where @a theShape specifies single "object" (shape being partitioned)
8370 # and @a thePlane specifies single "tool" (intersector shape). Other parameters of
8371 # @ref MakePartition operation have default values:
8372 # - @a Limit: GEOM::SHAPE (shape limit corresponds to the type of @a theShape)
8373 # - @a KeepNonlimitShapes: 0
8374 # - @a KeepInside, @a RemoveInside, @a RemoveWebs,
8375 # @a Materials (obsolete parameters): empty
8377 # @note I.e. the following two operations are equivalent:
8379 # Result = geompy.MakeHalfPartition(Object, Plane)
8380 # Result = geompy.MakePartition([Object], [Plane])
8383 # @sa MakePartition, MakePartitionNonSelfIntersectedShape
8385 # @ref tui_partition "Example"
8386 @ManageTransactions("BoolOp")
8387 def MakeHalfPartition(self, theShape, thePlane, theName=None):
8389 Perform partition of the Shape with the Plane
8392 theShape Shape to be intersected.
8393 thePlane Tool shape, to intersect theShape.
8394 theName Object name; when specified, this parameter is used
8395 for result publication in the study. Otherwise, if automatic
8396 publication is switched on, default value is used for result name.
8399 New GEOM.GEOM_Object, containing the result shape.
8401 Note: This operation is a shortcut to the more general MakePartition
8402 operation, where theShape specifies single "object" (shape being partitioned)
8403 and thePlane specifies single "tool" (intersector shape). Other parameters of
8404 MakePartition operation have default values:
8405 - Limit: GEOM::SHAPE (shape limit corresponds to the type of theShape)
8406 - KeepNonlimitShapes: 0
8407 - KeepInside, RemoveInside, RemoveWebs, Materials (obsolete parameters): empty
8409 I.e. the following two operations are equivalent:
8410 Result = geompy.MakeHalfPartition(Object, Plane)
8411 Result = geompy.MakePartition([Object], [Plane])
8413 # Example: see GEOM_TestAll.py
8414 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
8415 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
8416 self._autoPublish(anObj, theName, "partition")
8419 # end of l3_basic_op
8422 ## @addtogroup l3_transform
8425 ## Translate the given object along the vector, specified
8426 # by its end points.
8427 # @param theObject The object to be translated.
8428 # @param thePoint1 Start point of translation vector.
8429 # @param thePoint2 End point of translation vector.
8430 # @param theCopy Flag used to translate object itself or create a copy.
8431 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8432 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8433 @ManageTransactions("TrsfOp")
8434 def TranslateTwoPoints(self, theObject, thePoint1, thePoint2, theCopy=False):
8436 Translate the given object along the vector, specified by its end points.
8439 theObject The object to be translated.
8440 thePoint1 Start point of translation vector.
8441 thePoint2 End point of translation vector.
8442 theCopy Flag used to translate object itself or create a copy.
8445 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8446 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8449 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
8451 anObj = self.TrsfOp.TranslateTwoPoints(theObject, thePoint1, thePoint2)
8452 RaiseIfFailed("TranslateTwoPoints", self.TrsfOp)
8455 ## Translate the given object along the vector, specified
8456 # by its end points, creating its copy before the translation.
8457 # @param theObject The object to be translated.
8458 # @param thePoint1 Start point of translation vector.
8459 # @param thePoint2 End point of translation vector.
8460 # @param theName Object name; when specified, this parameter is used
8461 # for result publication in the study. Otherwise, if automatic
8462 # publication is switched on, default value is used for result name.
8464 # @return New GEOM.GEOM_Object, containing the translated object.
8466 # @ref tui_translation "Example 1"
8467 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
8468 @ManageTransactions("TrsfOp")
8469 def MakeTranslationTwoPoints(self, theObject, thePoint1, thePoint2, theName=None):
8471 Translate the given object along the vector, specified
8472 by its end points, creating its copy before the translation.
8475 theObject The object to be translated.
8476 thePoint1 Start point of translation vector.
8477 thePoint2 End point of translation vector.
8478 theName Object name; when specified, this parameter is used
8479 for result publication in the study. Otherwise, if automatic
8480 publication is switched on, default value is used for result name.
8483 New GEOM.GEOM_Object, containing the translated object.
8485 # Example: see GEOM_TestAll.py
8486 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
8487 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
8488 self._autoPublish(anObj, theName, "translated")
8491 ## Translate the given object along the vector, specified by its components.
8492 # @param theObject The object to be translated.
8493 # @param theDX,theDY,theDZ Components of translation vector.
8494 # @param theCopy Flag used to translate object itself or create a copy.
8495 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8496 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8498 # @ref tui_translation "Example"
8499 @ManageTransactions("TrsfOp")
8500 def TranslateDXDYDZ(self, theObject, theDX, theDY, theDZ, theCopy=False):
8502 Translate the given object along the vector, specified by its components.
8505 theObject The object to be translated.
8506 theDX,theDY,theDZ Components of translation vector.
8507 theCopy Flag used to translate object itself or create a copy.
8510 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8511 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8513 # Example: see GEOM_TestAll.py
8514 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
8516 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
8518 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
8519 anObj.SetParameters(Parameters)
8520 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
8523 ## Translate the given object along the vector, specified
8524 # by its components, creating its copy before the translation.
8525 # @param theObject The object to be translated.
8526 # @param theDX,theDY,theDZ Components of translation vector.
8527 # @param theName Object name; when specified, this parameter is used
8528 # for result publication in the study. Otherwise, if automatic
8529 # publication is switched on, default value is used for result name.
8531 # @return New GEOM.GEOM_Object, containing the translated object.
8533 # @ref tui_translation "Example"
8534 @ManageTransactions("TrsfOp")
8535 def MakeTranslation(self,theObject, theDX, theDY, theDZ, theName=None):
8537 Translate the given object along the vector, specified
8538 by its components, creating its copy before the translation.
8541 theObject The object to be translated.
8542 theDX,theDY,theDZ Components of translation vector.
8543 theName Object name; when specified, this parameter is used
8544 for result publication in the study. Otherwise, if automatic
8545 publication is switched on, default value is used for result name.
8548 New GEOM.GEOM_Object, containing the translated object.
8550 # Example: see GEOM_TestAll.py
8551 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
8552 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
8553 anObj.SetParameters(Parameters)
8554 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
8555 self._autoPublish(anObj, theName, "translated")
8558 ## Translate the given object along the given vector.
8559 # @param theObject The object to be translated.
8560 # @param theVector The translation vector.
8561 # @param theCopy Flag used to translate object itself or create a copy.
8562 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8563 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8564 @ManageTransactions("TrsfOp")
8565 def TranslateVector(self, theObject, theVector, theCopy=False):
8567 Translate the given object along the given vector.
8570 theObject The object to be translated.
8571 theVector The translation vector.
8572 theCopy Flag used to translate object itself or create a copy.
8575 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8576 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8579 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
8581 anObj = self.TrsfOp.TranslateVector(theObject, theVector)
8582 RaiseIfFailed("TranslateVector", self.TrsfOp)
8585 ## Translate the given object along the given vector,
8586 # creating its copy before the translation.
8587 # @param theObject The object to be translated.
8588 # @param theVector The translation vector.
8589 # @param theName Object name; when specified, this parameter is used
8590 # for result publication in the study. Otherwise, if automatic
8591 # publication is switched on, default value is used for result name.
8593 # @return New GEOM.GEOM_Object, containing the translated object.
8595 # @ref tui_translation "Example"
8596 @ManageTransactions("TrsfOp")
8597 def MakeTranslationVector(self, theObject, theVector, theName=None):
8599 Translate the given object along the given vector,
8600 creating its copy before the translation.
8603 theObject The object to be translated.
8604 theVector The translation vector.
8605 theName Object name; when specified, this parameter is used
8606 for result publication in the study. Otherwise, if automatic
8607 publication is switched on, default value is used for result name.
8610 New GEOM.GEOM_Object, containing the translated object.
8612 # Example: see GEOM_TestAll.py
8613 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
8614 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
8615 self._autoPublish(anObj, theName, "translated")
8618 ## Translate the given object along the given vector on given distance.
8619 # @param theObject The object to be translated.
8620 # @param theVector The translation vector.
8621 # @param theDistance The translation distance.
8622 # @param theCopy Flag used to translate object itself or create a copy.
8623 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8624 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8626 # @ref tui_translation "Example"
8627 @ManageTransactions("TrsfOp")
8628 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy=False):
8630 Translate the given object along the given vector on given distance.
8633 theObject The object to be translated.
8634 theVector The translation vector.
8635 theDistance The translation distance.
8636 theCopy Flag used to translate object itself or create a copy.
8639 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8640 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8642 # Example: see GEOM_TestAll.py
8643 theDistance,Parameters = ParseParameters(theDistance)
8644 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
8645 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
8646 anObj.SetParameters(Parameters)
8649 ## Translate the given object along the given vector on given distance,
8650 # creating its copy before the translation.
8651 # @param theObject The object to be translated.
8652 # @param theVector The translation vector.
8653 # @param theDistance The translation distance.
8654 # @param theName Object name; when specified, this parameter is used
8655 # for result publication in the study. Otherwise, if automatic
8656 # publication is switched on, default value is used for result name.
8658 # @return New GEOM.GEOM_Object, containing the translated object.
8660 # @ref tui_translation "Example"
8661 @ManageTransactions("TrsfOp")
8662 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance, theName=None):
8664 Translate the given object along the given vector on given distance,
8665 creating its copy before the translation.
8668 theObject The object to be translated.
8669 theVector The translation vector.
8670 theDistance The translation distance.
8671 theName Object name; when specified, this parameter is used
8672 for result publication in the study. Otherwise, if automatic
8673 publication is switched on, default value is used for result name.
8676 New GEOM.GEOM_Object, containing the translated object.
8678 # Example: see GEOM_TestAll.py
8679 theDistance,Parameters = ParseParameters(theDistance)
8680 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
8681 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
8682 anObj.SetParameters(Parameters)
8683 self._autoPublish(anObj, theName, "translated")
8686 ## Rotate the given object around the given axis on the given angle.
8687 # @param theObject The object to be rotated.
8688 # @param theAxis Rotation axis.
8689 # @param theAngle Rotation angle in radians.
8690 # @param theCopy Flag used to rotate object itself or create a copy.
8692 # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8693 # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
8695 # @ref tui_rotation "Example"
8696 @ManageTransactions("TrsfOp")
8697 def Rotate(self, theObject, theAxis, theAngle, theCopy=False):
8699 Rotate the given object around the given axis on the given angle.
8702 theObject The object to be rotated.
8703 theAxis Rotation axis.
8704 theAngle Rotation angle in radians.
8705 theCopy Flag used to rotate object itself or create a copy.
8708 Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8709 new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
8711 # Example: see GEOM_TestAll.py
8713 if isinstance(theAngle,str):
8715 theAngle, Parameters = ParseParameters(theAngle)
8717 theAngle = theAngle*math.pi/180.0
8719 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
8721 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
8722 RaiseIfFailed("Rotate", self.TrsfOp)
8723 anObj.SetParameters(Parameters)
8726 ## Rotate the given object around the given axis
8727 # on the given angle, creating its copy before the rotation.
8728 # @param theObject The object to be rotated.
8729 # @param theAxis Rotation axis.
8730 # @param theAngle Rotation angle in radians.
8731 # @param theName Object name; when specified, this parameter is used
8732 # for result publication in the study. Otherwise, if automatic
8733 # publication is switched on, default value is used for result name.
8735 # @return New GEOM.GEOM_Object, containing the rotated object.
8737 # @ref tui_rotation "Example"
8738 @ManageTransactions("TrsfOp")
8739 def MakeRotation(self, theObject, theAxis, theAngle, theName=None):
8741 Rotate the given object around the given axis
8742 on the given angle, creating its copy before the rotatation.
8745 theObject The object to be rotated.
8746 theAxis Rotation axis.
8747 theAngle Rotation angle in radians.
8748 theName Object name; when specified, this parameter is used
8749 for result publication in the study. Otherwise, if automatic
8750 publication is switched on, default value is used for result name.
8753 New GEOM.GEOM_Object, containing the rotated object.
8755 # Example: see GEOM_TestAll.py
8757 if isinstance(theAngle,str):
8759 theAngle, Parameters = ParseParameters(theAngle)
8761 theAngle = theAngle*math.pi/180.0
8762 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
8763 RaiseIfFailed("RotateCopy", self.TrsfOp)
8764 anObj.SetParameters(Parameters)
8765 self._autoPublish(anObj, theName, "rotated")
8768 ## Rotate given object around vector perpendicular to plane
8769 # containing three points.
8770 # @param theObject The object to be rotated.
8771 # @param theCentPoint central point the axis is the vector perpendicular to the plane
8772 # containing the three points.
8773 # @param thePoint1,thePoint2 points in a perpendicular plane of the axis.
8774 # @param theCopy Flag used to rotate object itself or create a copy.
8775 # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8776 # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
8777 @ManageTransactions("TrsfOp")
8778 def RotateThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theCopy=False):
8780 Rotate given object around vector perpendicular to plane
8781 containing three points.
8784 theObject The object to be rotated.
8785 theCentPoint central point the axis is the vector perpendicular to the plane
8786 containing the three points.
8787 thePoint1,thePoint2 points in a perpendicular plane of the axis.
8788 theCopy Flag used to rotate object itself or create a copy.
8791 Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8792 new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
8795 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
8797 anObj = self.TrsfOp.RotateThreePoints(theObject, theCentPoint, thePoint1, thePoint2)
8798 RaiseIfFailed("RotateThreePoints", self.TrsfOp)
8801 ## Rotate given object around vector perpendicular to plane
8802 # containing three points, creating its copy before the rotatation.
8803 # @param theObject The object to be rotated.
8804 # @param theCentPoint central point the axis is the vector perpendicular to the plane
8805 # containing the three points.
8806 # @param thePoint1,thePoint2 in a perpendicular plane of the axis.
8807 # @param theName Object name; when specified, this parameter is used
8808 # for result publication in the study. Otherwise, if automatic
8809 # publication is switched on, default value is used for result name.
8811 # @return New GEOM.GEOM_Object, containing the rotated object.
8813 # @ref tui_rotation "Example"
8814 @ManageTransactions("TrsfOp")
8815 def MakeRotationThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theName=None):
8817 Rotate given object around vector perpendicular to plane
8818 containing three points, creating its copy before the rotatation.
8821 theObject The object to be rotated.
8822 theCentPoint central point the axis is the vector perpendicular to the plane
8823 containing the three points.
8824 thePoint1,thePoint2 in a perpendicular plane of the axis.
8825 theName Object name; when specified, this parameter is used
8826 for result publication in the study. Otherwise, if automatic
8827 publication is switched on, default value is used for result name.
8830 New GEOM.GEOM_Object, containing the rotated object.
8832 # Example: see GEOM_TestAll.py
8833 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
8834 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
8835 self._autoPublish(anObj, theName, "rotated")
8838 ## Scale the given object by the specified factor.
8839 # @param theObject The object to be scaled.
8840 # @param thePoint Center point for scaling.
8841 # Passing None for it means scaling relatively the origin of global CS.
8842 # @param theFactor Scaling factor value.
8843 # @param theCopy Flag used to scale object itself or create a copy.
8844 # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8845 # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
8846 @ManageTransactions("TrsfOp")
8847 def Scale(self, theObject, thePoint, theFactor, theCopy=False):
8849 Scale the given object by the specified factor.
8852 theObject The object to be scaled.
8853 thePoint Center point for scaling.
8854 Passing None for it means scaling relatively the origin of global CS.
8855 theFactor Scaling factor value.
8856 theCopy Flag used to scale object itself or create a copy.
8859 Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8860 new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
8862 # Example: see GEOM_TestAll.py
8863 theFactor, Parameters = ParseParameters(theFactor)
8865 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
8867 anObj = self.TrsfOp.ScaleShape(theObject, thePoint, theFactor)
8868 RaiseIfFailed("Scale", self.TrsfOp)
8869 anObj.SetParameters(Parameters)
8872 ## Scale the given object by the factor, creating its copy before the scaling.
8873 # @param theObject The object to be scaled.
8874 # @param thePoint Center point for scaling.
8875 # Passing None for it means scaling relatively the origin of global CS.
8876 # @param theFactor Scaling factor value.
8877 # @param theName Object name; when specified, this parameter is used
8878 # for result publication in the study. Otherwise, if automatic
8879 # publication is switched on, default value is used for result name.
8881 # @return New GEOM.GEOM_Object, containing the scaled shape.
8883 # @ref tui_scale "Example"
8884 @ManageTransactions("TrsfOp")
8885 def MakeScaleTransform(self, theObject, thePoint, theFactor, theName=None):
8887 Scale the given object by the factor, creating its copy before the scaling.
8890 theObject The object to be scaled.
8891 thePoint Center point for scaling.
8892 Passing None for it means scaling relatively the origin of global CS.
8893 theFactor Scaling factor value.
8894 theName Object name; when specified, this parameter is used
8895 for result publication in the study. Otherwise, if automatic
8896 publication is switched on, default value is used for result name.
8899 New GEOM.GEOM_Object, containing the scaled shape.
8901 # Example: see GEOM_TestAll.py
8902 theFactor, Parameters = ParseParameters(theFactor)
8903 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
8904 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
8905 anObj.SetParameters(Parameters)
8906 self._autoPublish(anObj, theName, "scaled")
8909 ## Scale the given object by different factors along coordinate axes.
8910 # @param theObject The object to be scaled.
8911 # @param thePoint Center point for scaling.
8912 # Passing None for it means scaling relatively the origin of global CS.
8913 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8914 # @param theCopy Flag used to scale object itself or create a copy.
8915 # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8916 # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
8917 @ManageTransactions("TrsfOp")
8918 def ScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theCopy=False):
8920 Scale the given object by different factors along coordinate axes.
8923 theObject The object to be scaled.
8924 thePoint Center point for scaling.
8925 Passing None for it means scaling relatively the origin of global CS.
8926 theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8927 theCopy Flag used to scale object itself or create a copy.
8930 Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8931 new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
8933 # Example: see GEOM_TestAll.py
8934 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
8936 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
8937 theFactorX, theFactorY, theFactorZ)
8939 anObj = self.TrsfOp.ScaleShapeAlongAxes(theObject, thePoint,
8940 theFactorX, theFactorY, theFactorZ)
8941 RaiseIfFailed("ScaleAlongAxes", self.TrsfOp)
8942 anObj.SetParameters(Parameters)
8945 ## Scale the given object by different factors along coordinate axes,
8946 # creating its copy before the scaling.
8947 # @param theObject The object to be scaled.
8948 # @param thePoint Center point for scaling.
8949 # Passing None for it means scaling relatively the origin of global CS.
8950 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8951 # @param theName Object name; when specified, this parameter is used
8952 # for result publication in the study. Otherwise, if automatic
8953 # publication is switched on, default value is used for result name.
8955 # @return New GEOM.GEOM_Object, containing the scaled shape.
8957 # @ref swig_scale "Example"
8958 @ManageTransactions("TrsfOp")
8959 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theName=None):
8961 Scale the given object by different factors along coordinate axes,
8962 creating its copy before the scaling.
8965 theObject The object to be scaled.
8966 thePoint Center point for scaling.
8967 Passing None for it means scaling relatively the origin of global CS.
8968 theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8969 theName Object name; when specified, this parameter is used
8970 for result publication in the study. Otherwise, if automatic
8971 publication is switched on, default value is used for result name.
8974 New GEOM.GEOM_Object, containing the scaled shape.
8976 # Example: see GEOM_TestAll.py
8977 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
8978 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
8979 theFactorX, theFactorY, theFactorZ)
8980 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
8981 anObj.SetParameters(Parameters)
8982 self._autoPublish(anObj, theName, "scaled")
8985 ## Mirror an object relatively the given plane.
8986 # @param theObject The object to be mirrored.
8987 # @param thePlane Plane of symmetry.
8988 # @param theCopy Flag used to mirror object itself or create a copy.
8989 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8990 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
8991 @ManageTransactions("TrsfOp")
8992 def MirrorByPlane(self, theObject, thePlane, theCopy=False):
8994 Mirror an object relatively the given plane.
8997 theObject The object to be mirrored.
8998 thePlane Plane of symmetry.
8999 theCopy Flag used to mirror object itself or create a copy.
9002 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9003 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9006 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
9008 anObj = self.TrsfOp.MirrorPlane(theObject, thePlane)
9009 RaiseIfFailed("MirrorByPlane", self.TrsfOp)
9012 ## Create an object, symmetrical
9013 # to the given one relatively the given plane.
9014 # @param theObject The object to be mirrored.
9015 # @param thePlane Plane of symmetry.
9016 # @param theName Object name; when specified, this parameter is used
9017 # for result publication in the study. Otherwise, if automatic
9018 # publication is switched on, default value is used for result name.
9020 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9022 # @ref tui_mirror "Example"
9023 @ManageTransactions("TrsfOp")
9024 def MakeMirrorByPlane(self, theObject, thePlane, theName=None):
9026 Create an object, symmetrical to the given one relatively the given plane.
9029 theObject The object to be mirrored.
9030 thePlane Plane of symmetry.
9031 theName Object name; when specified, this parameter is used
9032 for result publication in the study. Otherwise, if automatic
9033 publication is switched on, default value is used for result name.
9036 New GEOM.GEOM_Object, containing the mirrored shape.
9038 # Example: see GEOM_TestAll.py
9039 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
9040 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
9041 self._autoPublish(anObj, theName, "mirrored")
9044 ## Mirror an object relatively the given axis.
9045 # @param theObject The object to be mirrored.
9046 # @param theAxis Axis of symmetry.
9047 # @param theCopy Flag used to mirror object itself or create a copy.
9048 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9049 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
9050 @ManageTransactions("TrsfOp")
9051 def MirrorByAxis(self, theObject, theAxis, theCopy=False):
9053 Mirror an object relatively the given axis.
9056 theObject The object to be mirrored.
9057 theAxis Axis of symmetry.
9058 theCopy Flag used to mirror object itself or create a copy.
9061 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9062 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9065 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
9067 anObj = self.TrsfOp.MirrorAxis(theObject, theAxis)
9068 RaiseIfFailed("MirrorByAxis", self.TrsfOp)
9071 ## Create an object, symmetrical
9072 # to the given one relatively the given axis.
9073 # @param theObject The object to be mirrored.
9074 # @param theAxis Axis of symmetry.
9075 # @param theName Object name; when specified, this parameter is used
9076 # for result publication in the study. Otherwise, if automatic
9077 # publication is switched on, default value is used for result name.
9079 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9081 # @ref tui_mirror "Example"
9082 @ManageTransactions("TrsfOp")
9083 def MakeMirrorByAxis(self, theObject, theAxis, theName=None):
9085 Create an object, symmetrical to the given one relatively the given axis.
9088 theObject The object to be mirrored.
9089 theAxis Axis of symmetry.
9090 theName Object name; when specified, this parameter is used
9091 for result publication in the study. Otherwise, if automatic
9092 publication is switched on, default value is used for result name.
9095 New GEOM.GEOM_Object, containing the mirrored shape.
9097 # Example: see GEOM_TestAll.py
9098 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
9099 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
9100 self._autoPublish(anObj, theName, "mirrored")
9103 ## Mirror an object relatively the given point.
9104 # @param theObject The object to be mirrored.
9105 # @param thePoint Point of symmetry.
9106 # @param theCopy Flag used to mirror object itself or create a copy.
9107 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9108 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
9109 @ManageTransactions("TrsfOp")
9110 def MirrorByPoint(self, theObject, thePoint, theCopy=False):
9112 Mirror an object relatively the given point.
9115 theObject The object to be mirrored.
9116 thePoint Point of symmetry.
9117 theCopy Flag used to mirror object itself or create a copy.
9120 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9121 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9123 # Example: see GEOM_TestAll.py
9125 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
9127 anObj = self.TrsfOp.MirrorPoint(theObject, thePoint)
9128 RaiseIfFailed("MirrorByPoint", self.TrsfOp)
9131 ## Create an object, symmetrical
9132 # to the given one relatively the given point.
9133 # @param theObject The object to be mirrored.
9134 # @param thePoint Point of symmetry.
9135 # @param theName Object name; when specified, this parameter is used
9136 # for result publication in the study. Otherwise, if automatic
9137 # publication is switched on, default value is used for result name.
9139 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9141 # @ref tui_mirror "Example"
9142 @ManageTransactions("TrsfOp")
9143 def MakeMirrorByPoint(self, theObject, thePoint, theName=None):
9145 Create an object, symmetrical
9146 to the given one relatively the given point.
9149 theObject The object to be mirrored.
9150 thePoint Point of symmetry.
9151 theName Object name; when specified, this parameter is used
9152 for result publication in the study. Otherwise, if automatic
9153 publication is switched on, default value is used for result name.
9156 New GEOM.GEOM_Object, containing the mirrored shape.
9158 # Example: see GEOM_TestAll.py
9159 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
9160 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
9161 self._autoPublish(anObj, theName, "mirrored")
9164 ## Modify the location of the given object.
9165 # @param theObject The object to be displaced.
9166 # @param theStartLCS Coordinate system to perform displacement from it.\n
9167 # If \a theStartLCS is NULL, displacement
9168 # will be performed from global CS.\n
9169 # If \a theObject itself is used as \a theStartLCS,
9170 # its location will be changed to \a theEndLCS.
9171 # @param theEndLCS Coordinate system to perform displacement to it.
9172 # @param theCopy Flag used to displace object itself or create a copy.
9173 # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9174 # new GEOM.GEOM_Object, containing the displaced object if @a theCopy flag is @c True.
9175 @ManageTransactions("TrsfOp")
9176 def Position(self, theObject, theStartLCS, theEndLCS, theCopy=False):
9178 Modify the Location of the given object by LCS, creating its copy before the setting.
9181 theObject The object to be displaced.
9182 theStartLCS Coordinate system to perform displacement from it.
9183 If theStartLCS is NULL, displacement
9184 will be performed from global CS.
9185 If theObject itself is used as theStartLCS,
9186 its location will be changed to theEndLCS.
9187 theEndLCS Coordinate system to perform displacement to it.
9188 theCopy Flag used to displace object itself or create a copy.
9191 Displaced theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9192 new GEOM.GEOM_Object, containing the displaced object if theCopy flag is True.
9194 # Example: see GEOM_TestAll.py
9196 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
9198 anObj = self.TrsfOp.PositionShape(theObject, theStartLCS, theEndLCS)
9199 RaiseIfFailed("Displace", self.TrsfOp)
9202 ## Modify the Location of the given object by LCS,
9203 # creating its copy before the setting.
9204 # @param theObject The object to be displaced.
9205 # @param theStartLCS Coordinate system to perform displacement from it.\n
9206 # If \a theStartLCS is NULL, displacement
9207 # will be performed from global CS.\n
9208 # If \a theObject itself is used as \a theStartLCS,
9209 # its location will be changed to \a theEndLCS.
9210 # @param theEndLCS Coordinate system to perform displacement to it.
9211 # @param theName Object name; when specified, this parameter is used
9212 # for result publication in the study. Otherwise, if automatic
9213 # publication is switched on, default value is used for result name.
9215 # @return New GEOM.GEOM_Object, containing the displaced shape.
9217 # @ref tui_modify_location "Example"
9218 @ManageTransactions("TrsfOp")
9219 def MakePosition(self, theObject, theStartLCS, theEndLCS, theName=None):
9221 Modify the Location of the given object by LCS, creating its copy before the setting.
9224 theObject The object to be displaced.
9225 theStartLCS Coordinate system to perform displacement from it.
9226 If theStartLCS is NULL, displacement
9227 will be performed from global CS.
9228 If theObject itself is used as theStartLCS,
9229 its location will be changed to theEndLCS.
9230 theEndLCS Coordinate system to perform displacement to it.
9231 theName Object name; when specified, this parameter is used
9232 for result publication in the study. Otherwise, if automatic
9233 publication is switched on, default value is used for result name.
9236 New GEOM.GEOM_Object, containing the displaced shape.
9239 # create local coordinate systems
9240 cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
9241 cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
9242 # modify the location of the given object
9243 position = geompy.MakePosition(cylinder, cs1, cs2)
9245 # Example: see GEOM_TestAll.py
9246 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
9247 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
9248 self._autoPublish(anObj, theName, "displaced")
9251 ## Modify the Location of the given object by Path.
9252 # @param theObject The object to be displaced.
9253 # @param thePath Wire or Edge along that the object will be translated.
9254 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
9255 # @param theCopy is to create a copy objects if true.
9256 # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
9257 # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy is @c False or
9258 # new GEOM.GEOM_Object, containing the displaced shape if @a theCopy is @c True.
9260 # @ref tui_modify_location "Example"
9261 @ManageTransactions("TrsfOp")
9262 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
9264 Modify the Location of the given object by Path.
9267 theObject The object to be displaced.
9268 thePath Wire or Edge along that the object will be translated.
9269 theDistance progress of Path (0 = start location, 1 = end of path location).
9270 theCopy is to create a copy objects if true.
9271 theReverse 0 - for usual direction, 1 - to reverse path direction.
9274 Displaced theObject (GEOM.GEOM_Object) if theCopy is False or
9275 new GEOM.GEOM_Object, containing the displaced shape if theCopy is True.
9278 position = geompy.PositionAlongPath(cylinder, circle, 0.75, 1, 1)
9280 # Example: see GEOM_TestAll.py
9281 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
9282 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
9285 ## Modify the Location of the given object by Path, creating its copy before the operation.
9286 # @param theObject The object to be displaced.
9287 # @param thePath Wire or Edge along that the object will be translated.
9288 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
9289 # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
9290 # @param theName Object name; when specified, this parameter is used
9291 # for result publication in the study. Otherwise, if automatic
9292 # publication is switched on, default value is used for result name.
9294 # @return New GEOM.GEOM_Object, containing the displaced shape.
9295 @ManageTransactions("TrsfOp")
9296 def MakePositionAlongPath(self, theObject, thePath, theDistance, theReverse, theName=None):
9298 Modify the Location of the given object by Path, creating its copy before the operation.
9301 theObject The object to be displaced.
9302 thePath Wire or Edge along that the object will be translated.
9303 theDistance progress of Path (0 = start location, 1 = end of path location).
9304 theReverse 0 - for usual direction, 1 - to reverse path direction.
9305 theName Object name; when specified, this parameter is used
9306 for result publication in the study. Otherwise, if automatic
9307 publication is switched on, default value is used for result name.
9310 New GEOM.GEOM_Object, containing the displaced shape.
9312 # Example: see GEOM_TestAll.py
9313 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, 1, theReverse)
9314 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
9315 self._autoPublish(anObj, theName, "displaced")
9318 ## Offset given shape.
9319 # @param theObject The base object for the offset.
9320 # @param theOffset Offset value.
9321 # @param theCopy Flag used to offset object itself or create a copy.
9322 # @return Modified @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9323 # new GEOM.GEOM_Object, containing the result of offset operation if @a theCopy flag is @c True.
9324 @ManageTransactions("TrsfOp")
9325 def Offset(self, theObject, theOffset, theCopy=False):
9330 theObject The base object for the offset.
9331 theOffset Offset value.
9332 theCopy Flag used to offset object itself or create a copy.
9335 Modified theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9336 new GEOM.GEOM_Object, containing the result of offset operation if theCopy flag is True.
9338 theOffset, Parameters = ParseParameters(theOffset)
9340 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset, True)
9342 anObj = self.TrsfOp.OffsetShape(theObject, theOffset, True)
9343 RaiseIfFailed("Offset", self.TrsfOp)
9344 anObj.SetParameters(Parameters)
9347 ## Create new object as offset of the given one. Gap between two adjacent
9348 # offset surfaces is filled by a pipe.
9349 # @param theObject The base object for the offset.
9350 # @param theOffset Offset value.
9351 # @param theName Object name; when specified, this parameter is used
9352 # for result publication in the study. Otherwise, if automatic
9353 # publication is switched on, default value is used for result name.
9355 # @return New GEOM.GEOM_Object, containing the offset object.
9357 # @sa MakeOffsetIntersectionJoin
9358 # @ref tui_offset "Example"
9359 @ManageTransactions("TrsfOp")
9360 def MakeOffset(self, theObject, theOffset, theName=None):
9362 Create new object as offset of the given one. Gap between adjacent
9363 offset surfaces is filled by a pipe.
9366 theObject The base object for the offset.
9367 theOffset Offset value.
9368 theName Object name; when specified, this parameter is used
9369 for result publication in the study. Otherwise, if automatic
9370 publication is switched on, default value is used for result name.
9373 New GEOM.GEOM_Object, containing the offset object.
9376 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
9377 # create a new object as offset of the given object
9378 offset = geompy.MakeOffset(box, 70.)
9380 # Example: see GEOM_TestAll.py
9381 theOffset, Parameters = ParseParameters(theOffset)
9382 anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, True )
9383 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
9384 anObj.SetParameters(Parameters)
9385 self._autoPublish(anObj, theName, "offset")
9388 ## Create new object as offset of the given one. Gap between adjacent
9389 # offset surfaces is filled by extending and intersecting them.
9390 # @param theObject The base object for the offset.
9391 # @param theOffset Offset value.
9392 # @param theName Object name; when specified, this parameter is used
9393 # for result publication in the study. Otherwise, if automatic
9394 # publication is switched on, default value is used for result name.
9396 # @return New GEOM.GEOM_Object, containing the offset object.
9399 # @ref tui_offset "Example"
9400 @ManageTransactions("TrsfOp")
9401 def MakeOffsetIntersectionJoin(self, theObject, theOffset, theName=None):
9403 Create new object as offset of the given one. Gap between adjacent
9404 offset surfaces is filled by extending and intersecting them.
9407 theObject The base object for the offset.
9408 theOffset Offset value.
9409 theName Object name; when specified, this parameter is used
9410 for result publication in the study. Otherwise, if automatic
9411 publication is switched on, default value is used for result name.
9414 New GEOM.GEOM_Object, containing the offset object.
9417 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
9418 # create a new box extended by 70
9419 offset = geompy.MakeOffsetIntersectionJoin(box, 70.)
9421 # Example: see GEOM_TestAll.py
9422 theOffset, Parameters = ParseParameters( theOffset )
9423 anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, False )
9424 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
9425 anObj.SetParameters(Parameters)
9426 self._autoPublish(anObj, theName, "offset")
9429 ## Create new object as projection of the given one on another.
9430 # @param theSource The source object for the projection. It can be a point, edge or wire.
9431 # Edge and wire are acceptable if @a theTarget is a face.
9432 # @param theTarget The target object. It can be planar or cylindrical face, edge or wire.
9433 # @param theName Object name; when specified, this parameter is used
9434 # for result publication in the study. Otherwise, if automatic
9435 # publication is switched on, default value is used for result name.
9437 # @return New GEOM.GEOM_Object, containing the projection.
9439 # @ref tui_projection "Example"
9440 @ManageTransactions("TrsfOp")
9441 def MakeProjection(self, theSource, theTarget, theName=None):
9443 Create new object as projection of the given one on another.
9446 theSource The source object for the projection. It can be a point, edge or wire.
9447 Edge and wire are acceptable if theTarget is a face.
9448 theTarget The target object. It can be planar or cylindrical face, edge or wire.
9449 theName Object name; when specified, this parameter is used
9450 for result publication in the study. Otherwise, if automatic
9451 publication is switched on, default value is used for result name.
9454 New GEOM.GEOM_Object, containing the projection.
9456 # Example: see GEOM_TestAll.py
9457 anObj = self.TrsfOp.ProjectShapeCopy(theSource, theTarget)
9458 RaiseIfFailed("ProjectShapeCopy", self.TrsfOp)
9459 self._autoPublish(anObj, theName, "projection")
9462 ## Create a projection of the given point on a wire or an edge.
9463 # If there are no solutions or there are 2 or more solutions It throws an
9465 # @param thePoint the point to be projected.
9466 # @param theWire the wire. The edge is accepted as well.
9467 # @param theName Object name; when specified, this parameter is used
9468 # for result publication in the study. Otherwise, if automatic
9469 # publication is switched on, default value is used for result name.
9471 # @return [\a u, \a PointOnEdge, \a EdgeInWireIndex]
9472 # \n \a u: The parameter of projection point on edge.
9473 # \n \a PointOnEdge: The projection point.
9474 # \n \a EdgeInWireIndex: The index of an edge in a wire.
9476 # @ref tui_projection "Example"
9477 @ManageTransactions("TrsfOp")
9478 def MakeProjectionOnWire(self, thePoint, theWire, theName=None):
9480 Create a projection of the given point on a wire or an edge.
9481 If there are no solutions or there are 2 or more solutions It throws an
9485 thePoint the point to be projected.
9486 theWire the wire. The edge is accepted as well.
9487 theName Object name; when specified, this parameter is used
9488 for result publication in the study. Otherwise, if automatic
9489 publication is switched on, default value is used for result name.
9492 [u, PointOnEdge, EdgeInWireIndex]
9493 u: The parameter of projection point on edge.
9494 PointOnEdge: The projection point.
9495 EdgeInWireIndex: The index of an edge in a wire.
9497 # Example: see GEOM_TestAll.py
9498 anObj = self.TrsfOp.ProjectPointOnWire(thePoint, theWire)
9499 RaiseIfFailed("ProjectPointOnWire", self.TrsfOp)
9500 self._autoPublish(anObj[1], theName, "projection")
9503 # -----------------------------------------------------------------------------
9505 # -----------------------------------------------------------------------------
9507 ## Translate the given object along the given vector a given number times
9508 # @param theObject The object to be translated.
9509 # @param theVector Direction of the translation. DX if None.
9510 # @param theStep Distance to translate on.
9511 # @param theNbTimes Quantity of translations to be done.
9512 # @param theName Object name; when specified, this parameter is used
9513 # for result publication in the study. Otherwise, if automatic
9514 # publication is switched on, default value is used for result name.
9516 # @return New GEOM.GEOM_Object, containing compound of all
9517 # the shapes, obtained after each translation.
9519 # @ref tui_multi_translation "Example"
9520 @ManageTransactions("TrsfOp")
9521 def MakeMultiTranslation1D(self, theObject, theVector, theStep, theNbTimes, theName=None):
9523 Translate the given object along the given vector a given number times
9526 theObject The object to be translated.
9527 theVector Direction of the translation. DX if None.
9528 theStep Distance to translate on.
9529 theNbTimes Quantity of translations to be done.
9530 theName Object name; when specified, this parameter is used
9531 for result publication in the study. Otherwise, if automatic
9532 publication is switched on, default value is used for result name.
9535 New GEOM.GEOM_Object, containing compound of all
9536 the shapes, obtained after each translation.
9539 r1d = geompy.MakeMultiTranslation1D(prism, vect, 20, 4)
9541 # Example: see GEOM_TestAll.py
9542 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
9543 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
9544 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
9545 anObj.SetParameters(Parameters)
9546 self._autoPublish(anObj, theName, "multitranslation")
9549 ## Conseqently apply two specified translations to theObject specified number of times.
9550 # @param theObject The object to be translated.
9551 # @param theVector1 Direction of the first translation. DX if None.
9552 # @param theStep1 Step of the first translation.
9553 # @param theNbTimes1 Quantity of translations to be done along theVector1.
9554 # @param theVector2 Direction of the second translation. DY if None.
9555 # @param theStep2 Step of the second translation.
9556 # @param theNbTimes2 Quantity of translations to be done along theVector2.
9557 # @param theName Object name; when specified, this parameter is used
9558 # for result publication in the study. Otherwise, if automatic
9559 # publication is switched on, default value is used for result name.
9561 # @return New GEOM.GEOM_Object, containing compound of all
9562 # the shapes, obtained after each translation.
9564 # @ref tui_multi_translation "Example"
9565 @ManageTransactions("TrsfOp")
9566 def MakeMultiTranslation2D(self, theObject, theVector1, theStep1, theNbTimes1,
9567 theVector2, theStep2, theNbTimes2, theName=None):
9569 Conseqently apply two specified translations to theObject specified number of times.
9572 theObject The object to be translated.
9573 theVector1 Direction of the first translation. DX if None.
9574 theStep1 Step of the first translation.
9575 theNbTimes1 Quantity of translations to be done along theVector1.
9576 theVector2 Direction of the second translation. DY if None.
9577 theStep2 Step of the second translation.
9578 theNbTimes2 Quantity of translations to be done along theVector2.
9579 theName Object name; when specified, this parameter is used
9580 for result publication in the study. Otherwise, if automatic
9581 publication is switched on, default value is used for result name.
9584 New GEOM.GEOM_Object, containing compound of all
9585 the shapes, obtained after each translation.
9588 tr2d = geompy.MakeMultiTranslation2D(prism, vect1, 20, 4, vect2, 80, 3)
9590 # Example: see GEOM_TestAll.py
9591 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
9592 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
9593 theVector2, theStep2, theNbTimes2)
9594 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
9595 anObj.SetParameters(Parameters)
9596 self._autoPublish(anObj, theName, "multitranslation")
9599 ## Rotate the given object around the given axis a given number times.
9600 # Rotation angle will be 2*PI/theNbTimes.
9601 # @param theObject The object to be rotated.
9602 # @param theAxis The rotation axis. DZ if None.
9603 # @param theNbTimes Quantity of rotations to be done.
9604 # @param theName Object name; when specified, this parameter is used
9605 # for result publication in the study. Otherwise, if automatic
9606 # publication is switched on, default value is used for result name.
9608 # @return New GEOM.GEOM_Object, containing compound of all the
9609 # shapes, obtained after each rotation.
9611 # @ref tui_multi_rotation "Example"
9612 @ManageTransactions("TrsfOp")
9613 def MultiRotate1DNbTimes (self, theObject, theAxis, theNbTimes, theName=None):
9615 Rotate the given object around the given axis a given number times.
9616 Rotation angle will be 2*PI/theNbTimes.
9619 theObject The object to be rotated.
9620 theAxis The rotation axis. DZ if None.
9621 theNbTimes Quantity of rotations to be done.
9622 theName Object name; when specified, this parameter is used
9623 for result publication in the study. Otherwise, if automatic
9624 publication is switched on, default value is used for result name.
9627 New GEOM.GEOM_Object, containing compound of all the
9628 shapes, obtained after each rotation.
9631 rot1d = geompy.MultiRotate1DNbTimes(prism, vect, 4)
9633 # Example: see GEOM_TestAll.py
9634 theNbTimes, Parameters = ParseParameters(theNbTimes)
9635 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
9636 RaiseIfFailed("MultiRotate1DNbTimes", self.TrsfOp)
9637 anObj.SetParameters(Parameters)
9638 self._autoPublish(anObj, theName, "multirotation")
9641 ## Rotate the given object around the given axis
9642 # a given number times on the given angle.
9643 # @param theObject The object to be rotated.
9644 # @param theAxis The rotation axis. DZ if None.
9645 # @param theAngleStep Rotation angle in radians.
9646 # @param theNbTimes Quantity of rotations to be done.
9647 # @param theName Object name; when specified, this parameter is used
9648 # for result publication in the study. Otherwise, if automatic
9649 # publication is switched on, default value is used for result name.
9651 # @return New GEOM.GEOM_Object, containing compound of all the
9652 # shapes, obtained after each rotation.
9654 # @ref tui_multi_rotation "Example"
9655 @ManageTransactions("TrsfOp")
9656 def MultiRotate1DByStep(self, theObject, theAxis, theAngleStep, theNbTimes, theName=None):
9658 Rotate the given object around the given axis
9659 a given number times on the given angle.
9662 theObject The object to be rotated.
9663 theAxis The rotation axis. DZ if None.
9664 theAngleStep Rotation angle in radians.
9665 theNbTimes Quantity of rotations to be done.
9666 theName Object name; when specified, this parameter is used
9667 for result publication in the study. Otherwise, if automatic
9668 publication is switched on, default value is used for result name.
9671 New GEOM.GEOM_Object, containing compound of all the
9672 shapes, obtained after each rotation.
9675 rot1d = geompy.MultiRotate1DByStep(prism, vect, math.pi/4, 4)
9677 # Example: see GEOM_TestAll.py
9678 theAngleStep, theNbTimes, Parameters = ParseParameters(theAngleStep, theNbTimes)
9679 anObj = self.TrsfOp.MultiRotate1DByStep(theObject, theAxis, theAngleStep, theNbTimes)
9680 RaiseIfFailed("MultiRotate1DByStep", self.TrsfOp)
9681 anObj.SetParameters(Parameters)
9682 self._autoPublish(anObj, theName, "multirotation")
9685 ## Rotate the given object around the given axis a given
9686 # number times and multi-translate each rotation result.
9687 # Rotation angle will be 2*PI/theNbTimes1.
9688 # Translation direction passes through center of gravity
9689 # of rotated shape and its projection on the rotation axis.
9690 # @param theObject The object to be rotated.
9691 # @param theAxis Rotation axis. DZ if None.
9692 # @param theNbTimes1 Quantity of rotations to be done.
9693 # @param theRadialStep Translation distance.
9694 # @param theNbTimes2 Quantity of translations to be done.
9695 # @param theName Object name; when specified, this parameter is used
9696 # for result publication in the study. Otherwise, if automatic
9697 # publication is switched on, default value is used for result name.
9699 # @return New GEOM.GEOM_Object, containing compound of all the
9700 # shapes, obtained after each transformation.
9702 # @ref tui_multi_rotation "Example"
9703 @ManageTransactions("TrsfOp")
9704 def MultiRotate2DNbTimes(self, theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
9706 Rotate the given object around the
9707 given axis on the given angle a given number
9708 times and multi-translate each rotation result.
9709 Translation direction passes through center of gravity
9710 of rotated shape and its projection on the rotation axis.
9713 theObject The object to be rotated.
9714 theAxis Rotation axis. DZ if None.
9715 theNbTimes1 Quantity of rotations to be done.
9716 theRadialStep Translation distance.
9717 theNbTimes2 Quantity of translations to be done.
9718 theName Object name; when specified, this parameter is used
9719 for result publication in the study. Otherwise, if automatic
9720 publication is switched on, default value is used for result name.
9723 New GEOM.GEOM_Object, containing compound of all the
9724 shapes, obtained after each transformation.
9727 rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
9729 # Example: see GEOM_TestAll.py
9730 theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theNbTimes1, theRadialStep, theNbTimes2)
9731 anObj = self.TrsfOp.MultiRotate2DNbTimes(theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2)
9732 RaiseIfFailed("MultiRotate2DNbTimes", self.TrsfOp)
9733 anObj.SetParameters(Parameters)
9734 self._autoPublish(anObj, theName, "multirotation")
9737 ## Rotate the given object around the
9738 # given axis on the given angle a given number
9739 # times and multi-translate each rotation result.
9740 # Translation direction passes through center of gravity
9741 # of rotated shape and its projection on the rotation axis.
9742 # @param theObject The object to be rotated.
9743 # @param theAxis Rotation axis. DZ if None.
9744 # @param theAngleStep Rotation angle in radians.
9745 # @param theNbTimes1 Quantity of rotations to be done.
9746 # @param theRadialStep Translation distance.
9747 # @param theNbTimes2 Quantity of translations to be done.
9748 # @param theName Object name; when specified, this parameter is used
9749 # for result publication in the study. Otherwise, if automatic
9750 # publication is switched on, default value is used for result name.
9752 # @return New GEOM.GEOM_Object, containing compound of all the
9753 # shapes, obtained after each transformation.
9755 # @ref tui_multi_rotation "Example"
9756 @ManageTransactions("TrsfOp")
9757 def MultiRotate2DByStep (self, theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
9759 Rotate the given object around the
9760 given axis on the given angle a given number
9761 times and multi-translate each rotation result.
9762 Translation direction passes through center of gravity
9763 of rotated shape and its projection on the rotation axis.
9766 theObject The object to be rotated.
9767 theAxis Rotation axis. DZ if None.
9768 theAngleStep Rotation angle in radians.
9769 theNbTimes1 Quantity of rotations to be done.
9770 theRadialStep Translation distance.
9771 theNbTimes2 Quantity of translations to be done.
9772 theName Object name; when specified, this parameter is used
9773 for result publication in the study. Otherwise, if automatic
9774 publication is switched on, default value is used for result name.
9777 New GEOM.GEOM_Object, containing compound of all the
9778 shapes, obtained after each transformation.
9781 rot2d = geompy.MultiRotate2D(prism, vect, math.pi/3, 4, 50, 5)
9783 # Example: see GEOM_TestAll.py
9784 theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
9785 anObj = self.TrsfOp.MultiRotate2DByStep(theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
9786 RaiseIfFailed("MultiRotate2DByStep", self.TrsfOp)
9787 anObj.SetParameters(Parameters)
9788 self._autoPublish(anObj, theName, "multirotation")
9791 ## The same, as MultiRotate1DNbTimes(), but axis is given by direction and point
9793 # @ref swig_MakeMultiRotation "Example"
9794 def MakeMultiRotation1DNbTimes(self, aShape, aDir, aPoint, aNbTimes, theName=None):
9796 The same, as geompy.MultiRotate1DNbTimes, but axis is given by direction and point
9799 pz = geompy.MakeVertex(0, 0, 100)
9800 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9801 MultiRot1D = geompy.MakeMultiRotation1DNbTimes(prism, vy, pz, 6)
9803 # Example: see GEOM_TestOthers.py
9804 aVec = self.MakeLine(aPoint,aDir)
9805 # note: auto-publishing is done in self.MultiRotate1D()
9806 anObj = self.MultiRotate1DNbTimes(aShape, aVec, aNbTimes, theName)
9809 ## The same, as MultiRotate1DByStep(), but axis is given by direction and point
9811 # @ref swig_MakeMultiRotation "Example"
9812 def MakeMultiRotation1DByStep(self, aShape, aDir, aPoint, anAngle, aNbTimes, theName=None):
9814 The same, as geompy.MultiRotate1D, but axis is given by direction and point
9817 pz = geompy.MakeVertex(0, 0, 100)
9818 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9819 MultiRot1D = geompy.MakeMultiRotation1DByStep(prism, vy, pz, math.pi/3, 6)
9821 # Example: see GEOM_TestOthers.py
9822 aVec = self.MakeLine(aPoint,aDir)
9823 # note: auto-publishing is done in self.MultiRotate1D()
9824 anObj = self.MultiRotate1DByStep(aShape, aVec, anAngle, aNbTimes, theName)
9827 ## The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
9829 # @ref swig_MakeMultiRotation "Example"
9830 def MakeMultiRotation2DNbTimes(self, aShape, aDir, aPoint, nbtimes1, aStep, nbtimes2, theName=None):
9832 The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
9835 pz = geompy.MakeVertex(0, 0, 100)
9836 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9837 MultiRot2D = geompy.MakeMultiRotation2DNbTimes(f12, vy, pz, 6, 30, 3)
9839 # Example: see GEOM_TestOthers.py
9840 aVec = self.MakeLine(aPoint,aDir)
9841 # note: auto-publishing is done in self.MultiRotate2DNbTimes()
9842 anObj = self.MultiRotate2DNbTimes(aShape, aVec, nbtimes1, aStep, nbtimes2, theName)
9845 ## The same, as MultiRotate2DByStep(), but axis is given by direction and point
9847 # @ref swig_MakeMultiRotation "Example"
9848 def MakeMultiRotation2DByStep(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
9850 The same, as MultiRotate2DByStep(), but axis is given by direction and point
9853 pz = geompy.MakeVertex(0, 0, 100)
9854 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9855 MultiRot2D = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4, 6, 30, 3)
9857 # Example: see GEOM_TestOthers.py
9858 aVec = self.MakeLine(aPoint,aDir)
9859 # note: auto-publishing is done in self.MultiRotate2D()
9860 anObj = self.MultiRotate2DByStep(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
9864 # Compute a wire or a face that represents a projection of the source
9865 # shape onto cylinder. The cylinder's coordinate system is the same
9866 # as the global coordinate system.
9868 # @param theObject The object to be projected. It can be either
9869 # a planar wire or a face.
9870 # @param theRadius The radius of the cylinder.
9871 # @param theStartAngle The starting angle in radians from
9872 # the cylinder's X axis around Z axis. The angle from which
9873 # the projection is started.
9874 # @param theAngleLength The projection length angle in radians.
9875 # The angle in which to project the total length of the wire.
9876 # If it is negative the projection is not scaled and natural
9877 # wire length is kept for the projection.
9878 # @param theAngleRotation The desired angle in radians between
9879 # the tangent vector to the first curve at the first point of
9880 # the theObject's projection in 2D space and U-direction of
9881 # cylinder's 2D space.
9882 # @param theName Object name; when specified, this parameter is used
9883 # for result publication in the study. Otherwise, if automatic
9884 # publication is switched on, default value is used for result name.
9886 # @return New GEOM.GEOM_Object, containing the result shape. The result
9887 # represents a wire or a face that represents a projection of
9888 # the source shape onto a cylinder.
9890 # @ref tui_projection "Example"
9891 def MakeProjectionOnCylinder (self, theObject, theRadius,
9892 theStartAngle=0.0, theAngleLength=-1.0,
9893 theAngleRotation=0.0,
9896 Compute a wire or a face that represents a projection of the source
9897 shape onto cylinder. The cylinder's coordinate system is the same
9898 as the global coordinate system.
9901 theObject The object to be projected. It can be either
9902 a planar wire or a face.
9903 theRadius The radius of the cylinder.
9904 theStartAngle The starting angle in radians from the cylinder's X axis
9905 around Z axis. The angle from which the projection is started.
9906 theAngleLength The projection length angle in radians. The angle in which
9907 to project the total length of the wire. If it is negative the
9908 projection is not scaled and natural wire length is kept for
9910 theAngleRotation The desired angle in radians between
9911 the tangent vector to the first curve at the first
9912 point of the theObject's projection in 2D space and
9913 U-direction of cylinder's 2D space.
9914 theName Object name; when specified, this parameter is used
9915 for result publication in the study. Otherwise, if automatic
9916 publication is switched on, default value is used for result name.
9919 New GEOM.GEOM_Object, containing the result shape. The result
9920 represents a wire or a face that represents a projection of
9921 the source shape onto a cylinder.
9923 # Example: see GEOM_TestAll.py
9924 flagStartAngle = False
9925 if isinstance(theStartAngle,str):
9926 flagStartAngle = True
9927 flagAngleLength = False
9928 if isinstance(theAngleLength,str):
9929 flagAngleLength = True
9930 flagAngleRotation = False
9931 if isinstance(theAngleRotation,str):
9932 flagAngleRotation = True
9933 theRadius, theStartAngle, theAngleLength, theAngleRotation, Parameters = ParseParameters(
9934 theRadius, theStartAngle, theAngleLength, theAngleRotation)
9936 theStartAngle = theStartAngle*math.pi/180.
9938 theAngleLength = theAngleLength*math.pi/180.
9939 if flagAngleRotation:
9940 theAngleRotation = theAngleRotation*math.pi/180.
9941 anObj = self.TrsfOp.MakeProjectionOnCylinder(theObject, theRadius,
9942 theStartAngle, theAngleLength, theAngleRotation)
9943 RaiseIfFailed("MakeProjectionOnCylinder", self.TrsfOp)
9944 anObj.SetParameters(Parameters)
9945 self._autoPublish(anObj, theName, "projection")
9948 # end of l3_transform
9951 ## @addtogroup l3_transform_d
9954 ## Deprecated method. Use MultiRotate1DNbTimes instead.
9955 def MultiRotate1D(self, theObject, theAxis, theNbTimes, theName=None):
9957 Deprecated method. Use MultiRotate1DNbTimes instead.
9959 print("The method MultiRotate1D is DEPRECATED. Use MultiRotate1DNbTimes instead.")
9960 return self.MultiRotate1DNbTimes(theObject, theAxis, theNbTimes, theName)
9962 ## The same, as MultiRotate2DByStep(), but theAngle is in degrees.
9963 # This method is DEPRECATED. Use MultiRotate2DByStep() instead.
9964 @ManageTransactions("TrsfOp")
9965 def MultiRotate2D(self, theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2, theName=None):
9967 The same, as MultiRotate2DByStep(), but theAngle is in degrees.
9968 This method is DEPRECATED. Use MultiRotate2DByStep() instead.
9971 rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
9973 print("The method MultiRotate2D is DEPRECATED. Use MultiRotate2DByStep instead.")
9974 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
9975 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
9976 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
9977 anObj.SetParameters(Parameters)
9978 self._autoPublish(anObj, theName, "multirotation")
9981 ## The same, as MultiRotate1D(), but axis is given by direction and point
9982 # This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
9983 def MakeMultiRotation1D(self, aShape, aDir, aPoint, aNbTimes, theName=None):
9985 The same, as geompy.MultiRotate1D, but axis is given by direction and point.
9986 This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
9989 pz = geompy.MakeVertex(0, 0, 100)
9990 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9991 MultiRot1D = geompy.MakeMultiRotation1D(prism, vy, pz, 6)
9993 print("The method MakeMultiRotation1D is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.")
9994 aVec = self.MakeLine(aPoint,aDir)
9995 # note: auto-publishing is done in self.MultiRotate1D()
9996 anObj = self.MultiRotate1D(aShape, aVec, aNbTimes, theName)
9999 ## The same, as MultiRotate2D(), but axis is given by direction and point
10000 # This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
10001 def MakeMultiRotation2D(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
10003 The same, as MultiRotate2D(), but axis is given by direction and point
10004 This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
10007 pz = geompy.MakeVertex(0, 0, 100)
10008 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
10009 MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
10011 print("The method MakeMultiRotation2D is DEPRECATED. Use MakeMultiRotation2DByStep instead.")
10012 aVec = self.MakeLine(aPoint,aDir)
10013 # note: auto-publishing is done in self.MultiRotate2D()
10014 anObj = self.MultiRotate2D(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
10017 # end of l3_transform_d
10020 ## @addtogroup l3_local
10023 ## Perform a fillet on all edges of the given shape.
10024 # @param theShape Shape, to perform fillet on.
10025 # @param theR Fillet radius.
10026 # @param theName Object name; when specified, this parameter is used
10027 # for result publication in the study. Otherwise, if automatic
10028 # publication is switched on, default value is used for result name.
10030 # @return New GEOM.GEOM_Object, containing the result shape.
10032 # @ref tui_fillet "Example 1"
10033 # \n @ref swig_MakeFilletAll "Example 2"
10034 @ManageTransactions("LocalOp")
10035 def MakeFilletAll(self, theShape, theR, theName=None):
10037 Perform a fillet on all edges of the given shape.
10040 theShape Shape, to perform fillet on.
10041 theR Fillet radius.
10042 theName Object name; when specified, this parameter is used
10043 for result publication in the study. Otherwise, if automatic
10044 publication is switched on, default value is used for result name.
10047 New GEOM.GEOM_Object, containing the result shape.
10050 filletall = geompy.MakeFilletAll(prism, 10.)
10052 # Example: see GEOM_TestOthers.py
10053 theR,Parameters = ParseParameters(theR)
10054 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
10055 RaiseIfFailed("MakeFilletAll", self.LocalOp)
10056 anObj.SetParameters(Parameters)
10057 self._autoPublish(anObj, theName, "fillet")
10060 ## Perform a fillet on the specified edges/faces of the given shape
10061 # @param theShape Shape, to perform fillet on.
10062 # @param theR Fillet radius.
10063 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR> (see ShapeType())
10064 # @param theListShapes Global indices of edges/faces to perform fillet on.
10065 # @param theName Object name; when specified, this parameter is used
10066 # for result publication in the study. Otherwise, if automatic
10067 # publication is switched on, default value is used for result name.
10069 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10071 # @return New GEOM.GEOM_Object, containing the result shape.
10073 # @ref tui_fillet "Example"
10074 @ManageTransactions("LocalOp")
10075 def MakeFillet(self, theShape, theR, theShapeType, theListShapes, theName=None):
10077 Perform a fillet on the specified edges/faces of the given shape
10080 theShape Shape, to perform fillet on.
10081 theR Fillet radius.
10082 theShapeType Type of shapes in theListShapes (see geompy.ShapeTypes)
10083 theListShapes Global indices of edges/faces to perform fillet on.
10084 theName Object name; when specified, this parameter is used
10085 for result publication in the study. Otherwise, if automatic
10086 publication is switched on, default value is used for result name.
10089 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10092 New GEOM.GEOM_Object, containing the result shape.
10095 # get the list of IDs (IDList) for the fillet
10096 prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"])
10098 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
10099 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
10100 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
10101 # make a fillet on the specified edges of the given shape
10102 fillet = geompy.MakeFillet(prism, 10., geompy.ShapeType["EDGE"], IDlist_e)
10104 # Example: see GEOM_TestAll.py
10105 theR,Parameters = ParseParameters(theR)
10107 if theShapeType == self.ShapeType["EDGE"]:
10108 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
10109 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
10111 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
10112 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
10113 anObj.SetParameters(Parameters)
10114 self._autoPublish(anObj, theName, "fillet")
10117 ## The same that MakeFillet() but with two Fillet Radius R1 and R2
10118 @ManageTransactions("LocalOp")
10119 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes, theName=None):
10121 The same that geompy.MakeFillet but with two Fillet Radius R1 and R2
10124 # get the list of IDs (IDList) for the fillet
10125 prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"])
10127 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
10128 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
10129 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
10130 # make a fillet on the specified edges of the given shape
10131 fillet = geompy.MakeFillet(prism, 10., 15., geompy.ShapeType["EDGE"], IDlist_e)
10133 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
10135 if theShapeType == self.ShapeType["EDGE"]:
10136 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
10137 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
10139 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
10140 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
10141 anObj.SetParameters(Parameters)
10142 self._autoPublish(anObj, theName, "fillet")
10145 ## Perform a fillet on the specified edges of the given shape
10146 # @param theShape Wire Shape to perform fillet on.
10147 # @param theR Fillet radius.
10148 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
10149 # \note Global index of sub-shape can be obtained, using method GetSubShapeID()
10150 # \note The list of vertices could be empty,
10151 # in this case fillet will done done at all vertices in wire
10152 # @param doIgnoreSecantVertices If FALSE, fillet radius is always limited
10153 # by the length of the edges, nearest to the fillet vertex.
10154 # But sometimes the next edge is C1 continuous with the one, nearest to
10155 # the fillet point, and such two (or more) edges can be united to allow
10156 # bigger radius. Set this flag to TRUE to allow collinear edges union,
10157 # thus ignoring the secant vertex (vertices).
10158 # @param theName Object name; when specified, this parameter is used
10159 # for result publication in the study. Otherwise, if automatic
10160 # publication is switched on, default value is used for result name.
10162 # @return New GEOM.GEOM_Object, containing the result shape.
10164 # @ref tui_fillet2d "Example"
10165 @ManageTransactions("LocalOp")
10166 def MakeFillet1D(self, theShape, theR, theListOfVertexes, doIgnoreSecantVertices = True, theName=None):
10168 Perform a fillet on the specified edges of the given shape
10171 theShape Wire Shape to perform fillet on.
10172 theR Fillet radius.
10173 theListOfVertexes Global indices of vertexes to perform fillet on.
10174 doIgnoreSecantVertices If FALSE, fillet radius is always limited
10175 by the length of the edges, nearest to the fillet vertex.
10176 But sometimes the next edge is C1 continuous with the one, nearest to
10177 the fillet point, and such two (or more) edges can be united to allow
10178 bigger radius. Set this flag to TRUE to allow collinear edges union,
10179 thus ignoring the secant vertex (vertices).
10180 theName Object name; when specified, this parameter is used
10181 for result publication in the study. Otherwise, if automatic
10182 publication is switched on, default value is used for result name.
10184 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10186 The list of vertices could be empty,in this case fillet will done done at all vertices in wire
10189 New GEOM.GEOM_Object, containing the result shape.
10193 Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
10194 # make fillet at given wire vertices with giver radius
10195 Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
10197 # Example: see GEOM_TestAll.py
10198 theR,doIgnoreSecantVertices,Parameters = ParseParameters(theR,doIgnoreSecantVertices)
10199 anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes, doIgnoreSecantVertices)
10200 RaiseIfFailed("MakeFillet1D", self.LocalOp)
10201 anObj.SetParameters(Parameters)
10202 self._autoPublish(anObj, theName, "fillet")
10205 ## Perform a fillet at the specified vertices of the given face/shell.
10206 # @param theShape Face or Shell shape to perform fillet on.
10207 # @param theR Fillet radius.
10208 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
10209 # @param theName Object name; when specified, this parameter is used
10210 # for result publication in the study. Otherwise, if automatic
10211 # publication is switched on, default value is used for result name.
10213 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10215 # @return New GEOM.GEOM_Object, containing the result shape.
10217 # @ref tui_fillet2d "Example"
10218 @ManageTransactions("LocalOp")
10219 def MakeFillet2D(self, theShape, theR, theListOfVertexes, theName=None):
10221 Perform a fillet at the specified vertices of the given face/shell.
10224 theShape Face or Shell shape to perform fillet on.
10225 theR Fillet radius.
10226 theListOfVertexes Global indices of vertexes to perform fillet on.
10227 theName Object name; when specified, this parameter is used
10228 for result publication in the study. Otherwise, if automatic
10229 publication is switched on, default value is used for result name.
10231 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10234 New GEOM.GEOM_Object, containing the result shape.
10237 face = geompy.MakeFaceHW(100, 100, 1)
10238 fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
10240 # Example: see GEOM_TestAll.py
10241 theR,Parameters = ParseParameters(theR)
10242 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
10243 RaiseIfFailed("MakeFillet2D", self.LocalOp)
10244 anObj.SetParameters(Parameters)
10245 self._autoPublish(anObj, theName, "fillet")
10248 ## Perform a symmetric chamfer on all edges of the given shape.
10249 # @param theShape Shape, to perform chamfer on.
10250 # @param theD Chamfer size along each face.
10251 # @param theName Object name; when specified, this parameter is used
10252 # for result publication in the study. Otherwise, if automatic
10253 # publication is switched on, default value is used for result name.
10255 # @return New GEOM.GEOM_Object, containing the result shape.
10257 # @ref tui_chamfer "Example 1"
10258 # \n @ref swig_MakeChamferAll "Example 2"
10259 @ManageTransactions("LocalOp")
10260 def MakeChamferAll(self, theShape, theD, theName=None):
10262 Perform a symmetric chamfer on all edges of the given shape.
10265 theShape Shape, to perform chamfer on.
10266 theD Chamfer size along each face.
10267 theName Object name; when specified, this parameter is used
10268 for result publication in the study. Otherwise, if automatic
10269 publication is switched on, default value is used for result name.
10272 New GEOM.GEOM_Object, containing the result shape.
10275 chamfer_all = geompy.MakeChamferAll(prism, 10.)
10277 # Example: see GEOM_TestOthers.py
10278 theD,Parameters = ParseParameters(theD)
10279 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
10280 RaiseIfFailed("MakeChamferAll", self.LocalOp)
10281 anObj.SetParameters(Parameters)
10282 self._autoPublish(anObj, theName, "chamfer")
10285 ## Perform a chamfer on edges, common to the specified faces,
10286 # with distance D1 on the Face1
10287 # @param theShape Shape, to perform chamfer on.
10288 # @param theD1 Chamfer size along \a theFace1.
10289 # @param theD2 Chamfer size along \a theFace2.
10290 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
10291 # @param theName Object name; when specified, this parameter is used
10292 # for result publication in the study. Otherwise, if automatic
10293 # publication is switched on, default value is used for result name.
10295 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10297 # @return New GEOM.GEOM_Object, containing the result shape.
10299 # @ref tui_chamfer "Example"
10300 @ManageTransactions("LocalOp")
10301 def MakeChamferEdge(self, theShape, theD1, theD2, theFace1, theFace2, theName=None):
10303 Perform a chamfer on edges, common to the specified faces,
10304 with distance D1 on the Face1
10307 theShape Shape, to perform chamfer on.
10308 theD1 Chamfer size along theFace1.
10309 theD2 Chamfer size along theFace2.
10310 theFace1,theFace2 Global indices of two faces of theShape.
10311 theName Object name; when specified, this parameter is used
10312 for result publication in the study. Otherwise, if automatic
10313 publication is switched on, default value is used for result name.
10316 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10319 New GEOM.GEOM_Object, containing the result shape.
10322 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
10323 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
10324 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
10325 chamfer_e = geompy.MakeChamferEdge(prism, 10., 10., f_ind_1, f_ind_2)
10327 # Example: see GEOM_TestAll.py
10328 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10329 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
10330 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
10331 anObj.SetParameters(Parameters)
10332 self._autoPublish(anObj, theName, "chamfer")
10335 ## Perform a chamfer on edges
10336 # @param theShape Shape, to perform chamfer on.
10337 # @param theD Chamfer length
10338 # @param theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10339 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
10340 # @param theName Object name; when specified, this parameter is used
10341 # for result publication in the study. Otherwise, if automatic
10342 # publication is switched on, default value is used for result name.
10344 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10346 # @return New GEOM.GEOM_Object, containing the result shape.
10347 @ManageTransactions("LocalOp")
10348 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2, theName=None):
10350 Perform a chamfer on edges
10353 theShape Shape, to perform chamfer on.
10354 theD1 Chamfer size along theFace1.
10355 theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees).
10356 theFace1,theFace2 Global indices of two faces of theShape.
10357 theName Object name; when specified, this parameter is used
10358 for result publication in the study. Otherwise, if automatic
10359 publication is switched on, default value is used for result name.
10362 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10365 New GEOM.GEOM_Object, containing the result shape.
10368 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
10369 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
10370 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
10372 chamfer_e = geompy.MakeChamferEdge(prism, 10., ang, f_ind_1, f_ind_2)
10375 if isinstance(theAngle,str):
10377 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10379 theAngle = theAngle*math.pi/180.0
10380 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
10381 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
10382 anObj.SetParameters(Parameters)
10383 self._autoPublish(anObj, theName, "chamfer")
10386 ## Perform a chamfer on all edges of the specified faces,
10387 # with distance D1 on the first specified face (if several for one edge)
10388 # @param theShape Shape, to perform chamfer on.
10389 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
10390 # connected to the edge, are in \a theFaces, \a theD1
10391 # will be get along face, which is nearer to \a theFaces beginning.
10392 # @param theD2 Chamfer size along another of two faces, connected to the edge.
10393 # @param theFaces Sequence of global indices of faces of \a theShape.
10394 # @param theName Object name; when specified, this parameter is used
10395 # for result publication in the study. Otherwise, if automatic
10396 # publication is switched on, default value is used for result name.
10398 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10400 # @return New GEOM.GEOM_Object, containing the result shape.
10402 # @ref tui_chamfer "Example"
10403 @ManageTransactions("LocalOp")
10404 def MakeChamferFaces(self, theShape, theD1, theD2, theFaces, theName=None):
10406 Perform a chamfer on all edges of the specified faces,
10407 with distance D1 on the first specified face (if several for one edge)
10410 theShape Shape, to perform chamfer on.
10411 theD1 Chamfer size along face from theFaces. If both faces,
10412 connected to the edge, are in theFaces, theD1
10413 will be get along face, which is nearer to theFaces beginning.
10414 theD2 Chamfer size along another of two faces, connected to the edge.
10415 theFaces Sequence of global indices of faces of theShape.
10416 theName Object name; when specified, this parameter is used
10417 for result publication in the study. Otherwise, if automatic
10418 publication is switched on, default value is used for result name.
10420 Note: Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
10423 New GEOM.GEOM_Object, containing the result shape.
10425 # Example: see GEOM_TestAll.py
10426 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10427 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
10428 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
10429 anObj.SetParameters(Parameters)
10430 self._autoPublish(anObj, theName, "chamfer")
10433 ## The Same that MakeChamferFaces() but with params theD is chamfer length and
10434 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10436 # @ref swig_FilletChamfer "Example"
10437 @ManageTransactions("LocalOp")
10438 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces, theName=None):
10440 The Same that geompy.MakeChamferFaces but with params theD is chamfer length and
10441 theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10444 if isinstance(theAngle,str):
10446 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10448 theAngle = theAngle*math.pi/180.0
10449 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
10450 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
10451 anObj.SetParameters(Parameters)
10452 self._autoPublish(anObj, theName, "chamfer")
10455 ## Perform a chamfer on edges,
10456 # with distance D1 on the first specified face (if several for one edge)
10457 # @param theShape Shape, to perform chamfer on.
10458 # @param theD1,theD2 Chamfer size
10459 # @param theEdges Sequence of edges of \a theShape.
10460 # @param theName Object name; when specified, this parameter is used
10461 # for result publication in the study. Otherwise, if automatic
10462 # publication is switched on, default value is used for result name.
10464 # @return New GEOM.GEOM_Object, containing the result shape.
10466 # @ref swig_FilletChamfer "Example"
10467 @ManageTransactions("LocalOp")
10468 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges, theName=None):
10470 Perform a chamfer on edges,
10471 with distance D1 on the first specified face (if several for one edge)
10474 theShape Shape, to perform chamfer on.
10475 theD1,theD2 Chamfer size
10476 theEdges Sequence of edges of theShape.
10477 theName Object name; when specified, this parameter is used
10478 for result publication in the study. Otherwise, if automatic
10479 publication is switched on, default value is used for result name.
10482 New GEOM.GEOM_Object, containing the result shape.
10484 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10485 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
10486 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
10487 anObj.SetParameters(Parameters)
10488 self._autoPublish(anObj, theName, "chamfer")
10491 ## The Same that MakeChamferEdges() but with params theD is chamfer length and
10492 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10493 @ManageTransactions("LocalOp")
10494 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges, theName=None):
10496 The Same that geompy.MakeChamferEdges but with params theD is chamfer length and
10497 theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10500 if isinstance(theAngle,str):
10502 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10504 theAngle = theAngle*math.pi/180.0
10505 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
10506 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
10507 anObj.SetParameters(Parameters)
10508 self._autoPublish(anObj, theName, "chamfer")
10511 ## @sa MakeChamferEdge(), MakeChamferFaces()
10513 # @ref swig_MakeChamfer "Example"
10514 def MakeChamfer(self, aShape, d1, d2, aShapeType, ListShape, theName=None):
10516 See geompy.MakeChamferEdge() and geompy.MakeChamferFaces() functions for more information.
10518 # Example: see GEOM_TestOthers.py
10520 # note: auto-publishing is done in self.MakeChamferEdge() or self.MakeChamferFaces()
10521 if aShapeType == self.ShapeType["EDGE"]:
10522 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1],theName)
10524 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape,theName)
10527 ## Remove material from a solid by extrusion of the base shape on the given distance.
10528 # @param theInit Shape to remove material from. It must be a solid or
10529 # a compound made of a single solid.
10530 # @param theBase Closed edge or wire defining the base shape to be extruded.
10531 # @param theH Prism dimension along the normal to theBase
10532 # @param theAngle Draft angle in degrees.
10533 # @param theInvert If true material changes the direction
10534 # @param theName Object name; when specified, this parameter is used
10535 # for result publication in the study. Otherwise, if automatic
10536 # publication is switched on, default value is used for result name.
10538 # @return New GEOM.GEOM_Object, containing the initial shape with removed material
10540 # @ref tui_creation_prism "Example"
10541 @ManageTransactions("PrimOp")
10542 def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
10544 Add material to a solid by extrusion of the base shape on the given distance.
10547 theInit Shape to remove material from. It must be a solid or a compound made of a single solid.
10548 theBase Closed edge or wire defining the base shape to be extruded.
10549 theH Prism dimension along the normal to theBase
10550 theAngle Draft angle in degrees.
10551 theInvert If true material changes the direction.
10552 theName Object name; when specified, this parameter is used
10553 for result publication in the study. Otherwise, if automatic
10554 publication is switched on, default value is used for result name.
10557 New GEOM.GEOM_Object, containing the initial shape with removed material.
10559 # Example: see GEOM_TestAll.py
10560 theH,theAngle,Parameters = ParseParameters(theH,theAngle)
10561 anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False, theInvert)
10562 RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
10563 anObj.SetParameters(Parameters)
10564 self._autoPublish(anObj, theName, "extrudedCut")
10567 ## Add material to a solid by extrusion of the base shape on the given distance.
10568 # @param theInit Shape to add material to. It must be a solid or
10569 # a compound made of a single solid.
10570 # @param theBase Closed edge or wire defining the base shape to be extruded.
10571 # @param theH Prism dimension along the normal to theBase
10572 # @param theAngle Draft angle in degrees.
10573 # @param theInvert If true material changes the direction
10574 # @param theName Object name; when specified, this parameter is used
10575 # for result publication in the study. Otherwise, if automatic
10576 # publication is switched on, default value is used for result name.
10578 # @return New GEOM.GEOM_Object, containing the initial shape with added material
10580 # @ref tui_creation_prism "Example"
10581 @ManageTransactions("PrimOp")
10582 def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
10584 Add material to a solid by extrusion of the base shape on the given distance.
10587 theInit Shape to add material to. It must be a solid or a compound made of a single solid.
10588 theBase Closed edge or wire defining the base shape to be extruded.
10589 theH Prism dimension along the normal to theBase
10590 theAngle Draft angle in degrees.
10591 theInvert If true material changes the direction.
10592 theName Object name; when specified, this parameter is used
10593 for result publication in the study. Otherwise, if automatic
10594 publication is switched on, default value is used for result name.
10597 New GEOM.GEOM_Object, containing the initial shape with added material.
10599 # Example: see GEOM_TestAll.py
10600 theH,theAngle,Parameters = ParseParameters(theH,theAngle)
10601 anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True, theInvert)
10602 RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
10603 anObj.SetParameters(Parameters)
10604 self._autoPublish(anObj, theName, "extrudedBoss")
10610 ## @addtogroup l3_basic_op
10613 ## Perform an Archimde operation on the given shape with given parameters.
10614 # The object presenting the resulting face is returned.
10615 # @param theShape Shape to be put in water.
10616 # @param theWeight Weight of the shape.
10617 # @param theWaterDensity Density of the water.
10618 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
10619 # @param theName Object name; when specified, this parameter is used
10620 # for result publication in the study. Otherwise, if automatic
10621 # publication is switched on, default value is used for result name.
10623 # @return New GEOM.GEOM_Object, containing a section of \a theShape
10624 # by a plane, corresponding to water level.
10626 # @ref tui_archimede "Example"
10627 @ManageTransactions("LocalOp")
10628 def Archimede(self, theShape, theWeight, theWaterDensity, theMeshDeflection, theName=None):
10630 Perform an Archimde operation on the given shape with given parameters.
10631 The object presenting the resulting face is returned.
10634 theShape Shape to be put in water.
10635 theWeight Weight of the shape.
10636 theWaterDensity Density of the water.
10637 theMeshDeflection Deflection of the mesh, using to compute the section.
10638 theName Object name; when specified, this parameter is used
10639 for result publication in the study. Otherwise, if automatic
10640 publication is switched on, default value is used for result name.
10643 New GEOM.GEOM_Object, containing a section of theShape
10644 by a plane, corresponding to water level.
10646 # Example: see GEOM_TestAll.py
10647 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
10648 theWeight,theWaterDensity,theMeshDeflection)
10649 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
10650 RaiseIfFailed("MakeArchimede", self.LocalOp)
10651 anObj.SetParameters(Parameters)
10652 self._autoPublish(anObj, theName, "archimede")
10655 # end of l3_basic_op
10658 ## @addtogroup l2_measure
10661 ## Get point coordinates
10662 # @return [x, y, z]
10664 # @ref tui_point_coordinates_page "Example"
10665 @ManageTransactions("MeasuOp")
10666 def PointCoordinates(self,Point):
10668 Get point coordinates
10673 # Example: see GEOM_TestMeasures.py
10674 aTuple = self.MeasuOp.PointCoordinates(Point)
10675 RaiseIfFailed("PointCoordinates", self.MeasuOp)
10678 ## Get vector coordinates
10679 # @return [x, y, z]
10681 # @ref tui_measurement_tools_page "Example"
10682 def VectorCoordinates(self,Vector):
10684 Get vector coordinates
10690 p1=self.GetFirstVertex(Vector)
10691 p2=self.GetLastVertex(Vector)
10693 X1=self.PointCoordinates(p1)
10694 X2=self.PointCoordinates(p2)
10696 return (X2[0]-X1[0],X2[1]-X1[1],X2[2]-X1[2])
10699 ## Compute cross product
10700 # @return vector w=u^v
10702 # @ref tui_measurement_tools_page "Example"
10703 def CrossProduct(self, Vector1, Vector2):
10705 Compute cross product
10707 Returns: vector w=u^v
10709 u=self.VectorCoordinates(Vector1)
10710 v=self.VectorCoordinates(Vector2)
10711 w=self.MakeVectorDXDYDZ(u[1]*v[2]-u[2]*v[1], u[2]*v[0]-u[0]*v[2], u[0]*v[1]-u[1]*v[0])
10715 ## Compute cross product
10716 # @return dot product p=u.v
10718 # @ref tui_measurement_tools_page "Example"
10719 def DotProduct(self, Vector1, Vector2):
10721 Compute cross product
10723 Returns: dot product p=u.v
10725 u=self.VectorCoordinates(Vector1)
10726 v=self.VectorCoordinates(Vector2)
10727 p=u[0]*v[0]+u[1]*v[1]+u[2]*v[2]
10732 ## Get summarized length of all wires,
10733 # area of surface and volume of the given shape.
10734 # @param theShape Shape to define properties of.
10735 # @param theTolerance maximal relative error of area
10736 # and volume computation.
10737 # @return [theLength, theSurfArea, theVolume]\n
10738 # theLength: Summarized length of all wires of the given shape.\n
10739 # theSurfArea: Area of surface of the given shape.\n
10740 # theVolume: Volume of the given shape.
10742 # @ref tui_basic_properties_page "Example"
10743 @ManageTransactions("MeasuOp")
10744 def BasicProperties(self,theShape, theTolerance=1.e-6):
10746 Get summarized length of all wires,
10747 area of surface and volume of the given shape.
10750 theShape Shape to define properties of.
10751 theTolerance maximal relative error of area
10752 and volume computation.
10755 [theLength, theSurfArea, theVolume]
10756 theLength: Summarized length of all wires of the given shape.
10757 theSurfArea: Area of surface of the given shape.
10758 theVolume: Volume of the given shape.
10760 # Example: see GEOM_TestMeasures.py
10761 aTuple = self.MeasuOp.GetBasicProperties(theShape, theTolerance)
10762 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
10765 ## Get parameters of bounding box of the given shape
10766 # @param theShape Shape to obtain bounding box of.
10767 # @param precise TRUE for precise computation; FALSE for fast one.
10768 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
10769 # Xmin,Xmax: Limits of shape along OX axis.
10770 # Ymin,Ymax: Limits of shape along OY axis.
10771 # Zmin,Zmax: Limits of shape along OZ axis.
10773 # @ref tui_bounding_box_page "Example"
10774 @ManageTransactions("MeasuOp")
10775 def BoundingBox (self, theShape, precise=False):
10777 Get parameters of bounding box of the given shape
10780 theShape Shape to obtain bounding box of.
10781 precise TRUE for precise computation; FALSE for fast one.
10784 [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
10785 Xmin,Xmax: Limits of shape along OX axis.
10786 Ymin,Ymax: Limits of shape along OY axis.
10787 Zmin,Zmax: Limits of shape along OZ axis.
10789 # Example: see GEOM_TestMeasures.py
10790 aTuple = self.MeasuOp.GetBoundingBox(theShape, precise)
10791 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
10794 ## Get bounding box of the given shape
10795 # @param theShape Shape to obtain bounding box of.
10796 # @param precise TRUE for precise computation; FALSE for fast one.
10797 # @param theName Object name; when specified, this parameter is used
10798 # for result publication in the study. Otherwise, if automatic
10799 # publication is switched on, default value is used for result name.
10801 # @return New GEOM.GEOM_Object, containing the created box.
10803 # @ref tui_bounding_box_page "Example"
10804 @ManageTransactions("MeasuOp")
10805 def MakeBoundingBox (self, theShape, precise=False, theName=None):
10807 Get bounding box of the given shape
10810 theShape Shape to obtain bounding box of.
10811 precise TRUE for precise computation; FALSE for fast one.
10812 theName Object name; when specified, this parameter is used
10813 for result publication in the study. Otherwise, if automatic
10814 publication is switched on, default value is used for result name.
10817 New GEOM.GEOM_Object, containing the created box.
10819 # Example: see GEOM_TestMeasures.py
10820 anObj = self.MeasuOp.MakeBoundingBox(theShape, precise)
10821 RaiseIfFailed("MakeBoundingBox", self.MeasuOp)
10822 self._autoPublish(anObj, theName, "bndbox")
10825 ## Get inertia matrix and moments of inertia of theShape.
10826 # @param theShape Shape to calculate inertia of.
10827 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
10828 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
10829 # Ix,Iy,Iz: Moments of inertia of the given shape.
10831 # @ref tui_inertia_page "Example"
10832 @ManageTransactions("MeasuOp")
10833 def Inertia(self,theShape):
10835 Get inertia matrix and moments of inertia of theShape.
10838 theShape Shape to calculate inertia of.
10841 [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
10842 I(1-3)(1-3): Components of the inertia matrix of the given shape.
10843 Ix,Iy,Iz: Moments of inertia of the given shape.
10845 # Example: see GEOM_TestMeasures.py
10846 aTuple = self.MeasuOp.GetInertia(theShape)
10847 RaiseIfFailed("GetInertia", self.MeasuOp)
10850 ## Get if coords are included in the shape (ST_IN or ST_ON)
10851 # @param theShape Shape
10852 # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
10853 # @param tolerance to be used (default is 1.0e-7)
10854 # @return list_of_boolean = [res1, res2, ...]
10855 @ManageTransactions("MeasuOp")
10856 def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
10858 Get if coords are included in the shape (ST_IN or ST_ON)
10862 coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
10863 tolerance to be used (default is 1.0e-7)
10866 list_of_boolean = [res1, res2, ...]
10868 return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
10870 ## Get minimal distance between the given shapes.
10871 # @param theShape1,theShape2 Shapes to find minimal distance between.
10872 # @return Value of the minimal distance between the given shapes.
10874 # @ref tui_min_distance_page "Example"
10875 @ManageTransactions("MeasuOp")
10876 def MinDistance(self, theShape1, theShape2):
10878 Get minimal distance between the given shapes.
10881 theShape1,theShape2 Shapes to find minimal distance between.
10884 Value of the minimal distance between the given shapes.
10886 # Example: see GEOM_TestMeasures.py
10887 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
10888 RaiseIfFailed("GetMinDistance", self.MeasuOp)
10891 ## Get minimal distance between the given shapes.
10892 # @param theShape1,theShape2 Shapes to find minimal distance between.
10893 # @return Value of the minimal distance between the given shapes, in form of list
10894 # [Distance, DX, DY, DZ].
10896 # @ref tui_min_distance_page "Example"
10897 @ManageTransactions("MeasuOp")
10898 def MinDistanceComponents(self, theShape1, theShape2):
10900 Get minimal distance between the given shapes.
10903 theShape1,theShape2 Shapes to find minimal distance between.
10906 Value of the minimal distance between the given shapes, in form of list
10907 [Distance, DX, DY, DZ]
10909 # Example: see GEOM_TestMeasures.py
10910 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
10911 RaiseIfFailed("GetMinDistance", self.MeasuOp)
10912 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
10915 ## Get closest points of the given shapes.
10916 # @param theShape1,theShape2 Shapes to find closest points of.
10917 # @return The number of found solutions (-1 in case of infinite number of
10918 # solutions) and a list of (X, Y, Z) coordinates for all couples of points.
10920 # @ref tui_min_distance_page "Example"
10921 @ManageTransactions("MeasuOp")
10922 def ClosestPoints (self, theShape1, theShape2):
10924 Get closest points of the given shapes.
10927 theShape1,theShape2 Shapes to find closest points of.
10930 The number of found solutions (-1 in case of infinite number of
10931 solutions) and a list of (X, Y, Z) coordinates for all couples of points.
10933 # Example: see GEOM_TestMeasures.py
10934 aTuple = self.MeasuOp.ClosestPoints(theShape1, theShape2)
10935 RaiseIfFailed("ClosestPoints", self.MeasuOp)
10938 ## Get angle between the given shapes in degrees.
10939 # @param theShape1,theShape2 Lines or linear edges to find angle between.
10940 # @note If both arguments are vectors, the angle is computed in accordance
10941 # with their orientations, otherwise the minimum angle is computed.
10942 # @return Value of the angle between the given shapes in degrees.
10944 # @ref tui_angle_page "Example"
10945 @ManageTransactions("MeasuOp")
10946 def GetAngle(self, theShape1, theShape2):
10948 Get angle between the given shapes in degrees.
10951 theShape1,theShape2 Lines or linear edges to find angle between.
10954 If both arguments are vectors, the angle is computed in accordance
10955 with their orientations, otherwise the minimum angle is computed.
10958 Value of the angle between the given shapes in degrees.
10960 # Example: see GEOM_TestMeasures.py
10961 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
10962 RaiseIfFailed("GetAngle", self.MeasuOp)
10965 ## Get angle between the given shapes in radians.
10966 # @param theShape1,theShape2 Lines or linear edges to find angle between.
10967 # @note If both arguments are vectors, the angle is computed in accordance
10968 # with their orientations, otherwise the minimum angle is computed.
10969 # @return Value of the angle between the given shapes in radians.
10971 # @ref tui_angle_page "Example"
10972 @ManageTransactions("MeasuOp")
10973 def GetAngleRadians(self, theShape1, theShape2):
10975 Get angle between the given shapes in radians.
10978 theShape1,theShape2 Lines or linear edges to find angle between.
10982 If both arguments are vectors, the angle is computed in accordance
10983 with their orientations, otherwise the minimum angle is computed.
10986 Value of the angle between the given shapes in radians.
10988 # Example: see GEOM_TestMeasures.py
10989 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
10990 RaiseIfFailed("GetAngle", self.MeasuOp)
10993 ## Get angle between the given vectors in degrees.
10994 # @param theShape1,theShape2 Vectors to find angle between.
10995 # @param theFlag If True, the normal vector is defined by the two vectors cross,
10996 # if False, the opposite vector to the normal vector is used.
10997 # @return Value of the angle between the given vectors in degrees.
10999 # @ref tui_angle_page "Example"
11000 @ManageTransactions("MeasuOp")
11001 def GetAngleVectors(self, theShape1, theShape2, theFlag = True):
11003 Get angle between the given vectors in degrees.
11006 theShape1,theShape2 Vectors to find angle between.
11007 theFlag If True, the normal vector is defined by the two vectors cross,
11008 if False, the opposite vector to the normal vector is used.
11011 Value of the angle between the given vectors in degrees.
11013 anAngle = self.MeasuOp.GetAngleBtwVectors(theShape1, theShape2)
11015 anAngle = 360. - anAngle
11016 RaiseIfFailed("GetAngleVectors", self.MeasuOp)
11019 ## The same as GetAngleVectors, but the result is in radians.
11020 def GetAngleRadiansVectors(self, theShape1, theShape2, theFlag = True):
11022 Get angle between the given vectors in radians.
11025 theShape1,theShape2 Vectors to find angle between.
11026 theFlag If True, the normal vector is defined by the two vectors cross,
11027 if False, the opposite vector to the normal vector is used.
11030 Value of the angle between the given vectors in radians.
11032 anAngle = self.GetAngleVectors(theShape1, theShape2, theFlag)*math.pi/180.
11035 ## @name Curve Curvature Measurement
11036 # Methods for receiving radius of curvature of curves
11037 # in the given point
11040 ## Measure curvature of a curve at a point, set by parameter.
11041 # @param theCurve a curve.
11042 # @param theParam parameter.
11043 # @return radius of curvature of \a theCurve.
11045 # @ref swig_todo "Example"
11046 @ManageTransactions("MeasuOp")
11047 def CurveCurvatureByParam(self, theCurve, theParam):
11049 Measure curvature of a curve at a point, set by parameter.
11053 theParam parameter.
11056 radius of curvature of theCurve.
11058 # Example: see GEOM_TestMeasures.py
11059 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
11060 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
11063 ## Measure curvature of a curve at a point.
11064 # @param theCurve a curve.
11065 # @param thePoint given point.
11066 # @return radius of curvature of \a theCurve.
11068 # @ref swig_todo "Example"
11069 @ManageTransactions("MeasuOp")
11070 def CurveCurvatureByPoint(self, theCurve, thePoint):
11072 Measure curvature of a curve at a point.
11076 thePoint given point.
11079 radius of curvature of theCurve.
11081 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
11082 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
11086 ## @name Surface Curvature Measurement
11087 # Methods for receiving max and min radius of curvature of surfaces
11088 # in the given point
11091 ## Measure max radius of curvature of surface.
11092 # @param theSurf the given surface.
11093 # @param theUParam Value of U-parameter on the referenced surface.
11094 # @param theVParam Value of V-parameter on the referenced surface.
11095 # @return max radius of curvature of theSurf.
11097 ## @ref swig_todo "Example"
11098 @ManageTransactions("MeasuOp")
11099 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
11101 Measure max radius of curvature of surface.
11104 theSurf the given surface.
11105 theUParam Value of U-parameter on the referenced surface.
11106 theVParam Value of V-parameter on the referenced surface.
11109 max radius of curvature of theSurf.
11111 # Example: see GEOM_TestMeasures.py
11112 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
11113 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
11116 ## Measure max radius of curvature of surface in the given point
11117 # @param theSurf the given surface.
11118 # @param thePoint given point.
11119 # @return max radius of curvature of theSurf.
11121 ## @ref swig_todo "Example"
11122 @ManageTransactions("MeasuOp")
11123 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
11125 Measure max radius of curvature of surface in the given point.
11128 theSurf the given surface.
11129 thePoint given point.
11132 max radius of curvature of theSurf.
11134 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
11135 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
11138 ## Measure min radius of curvature of surface.
11139 # @param theSurf the given surface.
11140 # @param theUParam Value of U-parameter on the referenced surface.
11141 # @param theVParam Value of V-parameter on the referenced surface.
11142 # @return min radius of curvature of theSurf.
11144 ## @ref swig_todo "Example"
11145 @ManageTransactions("MeasuOp")
11146 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
11148 Measure min radius of curvature of surface.
11151 theSurf the given surface.
11152 theUParam Value of U-parameter on the referenced surface.
11153 theVParam Value of V-parameter on the referenced surface.
11156 Min radius of curvature of theSurf.
11158 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
11159 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
11162 ## Measure min radius of curvature of surface in the given point
11163 # @param theSurf the given surface.
11164 # @param thePoint given point.
11165 # @return min radius of curvature of theSurf.
11167 ## @ref swig_todo "Example"
11168 @ManageTransactions("MeasuOp")
11169 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
11171 Measure min radius of curvature of surface in the given point.
11174 theSurf the given surface.
11175 thePoint given point.
11178 Min radius of curvature of theSurf.
11180 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
11181 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
11185 ## Measure curvature radius of surface in the given point along the given direction.
11186 # @param theSurf the given face.
11187 # @param thePoint given point.
11188 # @param theDirection given direction.
11189 # @param theName Object name; when specified, this parameter is used
11190 # for result publication in the study. Otherwise, if automatic
11191 # publication is switched on, default value is used for result name.
11193 # @return New GEOM.GEOM_Object, containing vector of curvature of theSurf.
11194 # The returned vector is codirectional with the normal to the face
11195 # in the given point in case of positive curvature value
11196 # and opposite to the normal in case of negative curvature.
11197 # The normal of the returned vector is equal to the
11198 # absolute value of the curvature radius.
11199 # Null shape is returned in case of infinite radius
11200 # (zero curvature), for example, in case of flat face.
11202 ## @ref swig_CurvatureOnFace "Example"
11203 @ManageTransactions("MeasuOp")
11204 def CurvatureOnFace(self, theSurf, thePoint, theDirection, theName=None):
11206 Measure curvature radius of surface in the given point along the given direction.
11209 theSurf the given face.
11210 thePoint given point.
11211 theDirection given direction.
11212 theName Object name; when specified, this parameter is used
11213 for result publication in the study. Otherwise, if automatic
11214 publication is switched on, default value is used for result name.
11217 New GEOM.GEOM_Object, containing vector of curvature of theSurf.
11218 The returned vector is codirectional with the normal to the face
11219 in the given point in case of positive curvature value
11220 and opposite to the normal in case of negative curvature.
11221 The normal of the returned vector is equal to the
11222 absolute value of the curvature radius.
11223 Null shape is returned in case of infinite radius
11224 (zero curvature), for example, in case of flat face.
11227 curvature_1 = geompy.CurvatureOnFace(Face_1, Vertex_1, OX)
11229 aVec = self.MeasuOp.SurfaceCurvatureByPointAndDirection(theSurf,thePoint,theDirection)
11230 if self.MeasuOp.GetErrorCode() != "ZERO_CURVATURE":
11231 RaiseIfFailed("CurvatureOnFace", self.MeasuOp)
11232 self._autoPublish(aVec, theName, "curvature")
11235 ## Get min and max tolerances of sub-shapes of theShape
11236 # @param theShape Shape, to get tolerances of.
11237 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]\n
11238 # FaceMin,FaceMax: Min and max tolerances of the faces.\n
11239 # EdgeMin,EdgeMax: Min and max tolerances of the edges.\n
11240 # VertMin,VertMax: Min and max tolerances of the vertices.
11242 # @ref tui_tolerance_page "Example"
11243 @ManageTransactions("MeasuOp")
11244 def Tolerance(self,theShape):
11246 Get min and max tolerances of sub-shapes of theShape
11249 theShape Shape, to get tolerances of.
11252 [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
11253 FaceMin,FaceMax: Min and max tolerances of the faces.
11254 EdgeMin,EdgeMax: Min and max tolerances of the edges.
11255 VertMin,VertMax: Min and max tolerances of the vertices.
11257 # Example: see GEOM_TestMeasures.py
11258 aTuple = self.MeasuOp.GetTolerance(theShape)
11259 RaiseIfFailed("GetTolerance", self.MeasuOp)
11262 ## Obtain description of the given shape (number of sub-shapes of each type)
11263 # @param theShape Shape to be described.
11264 # @return Description of the given shape.
11266 # @ref tui_whatis_page "Example"
11267 @ManageTransactions("MeasuOp")
11268 def WhatIs(self,theShape):
11270 Obtain description of the given shape (number of sub-shapes of each type)
11273 theShape Shape to be described.
11276 Description of the given shape.
11278 # Example: see GEOM_TestMeasures.py
11279 aDescr = self.MeasuOp.WhatIs(theShape)
11280 RaiseIfFailed("WhatIs", self.MeasuOp)
11283 ## Obtain quantity of shapes of the given type in \a theShape.
11284 # If \a theShape is of type \a theType, it is also counted.
11285 # @param theShape Shape to be described.
11286 # @param theType the given ShapeType().
11287 # @return Quantity of shapes of type \a theType in \a theShape.
11289 # @ref tui_measurement_tools_page "Example"
11290 def NbShapes (self, theShape, theType):
11292 Obtain quantity of shapes of the given type in theShape.
11293 If theShape is of type theType, it is also counted.
11296 theShape Shape to be described.
11297 theType the given geompy.ShapeType
11300 Quantity of shapes of type theType in theShape.
11302 # Example: see GEOM_TestMeasures.py
11303 listSh = self.SubShapeAllIDs(theShape, theType)
11307 ## Obtain quantity of shapes of each type in \a theShape.
11308 # The \a theShape is also counted.
11309 # @param theShape Shape to be described.
11310 # @return Dictionary of ShapeType() with bound quantities of shapes.
11312 # @ref tui_measurement_tools_page "Example"
11313 def ShapeInfo (self, theShape):
11315 Obtain quantity of shapes of each type in theShape.
11316 The theShape is also counted.
11319 theShape Shape to be described.
11322 Dictionary of geompy.ShapeType with bound quantities of shapes.
11324 # Example: see GEOM_TestMeasures.py
11326 for typeSh in self.ShapeType:
11327 if typeSh in ( "AUTO", "SHAPE" ): continue
11328 listSh = self.SubShapeAllIDs(theShape, self.ShapeType[typeSh])
11334 def GetCreationInformation(self, theShape):
11336 infos = theShape.GetCreationInformation()
11339 opName = info.operationName
11340 if not opName: opName = "no info available"
11341 if res: res += "\n"
11342 res += "Operation: " + opName
11344 for parVal in info.params:
11345 res += "\n \t%s = %s" % ( parVal.name, parVal.value )
11348 ## Get a point, situated at the centre of mass of theShape.
11349 # @param theShape Shape to define centre of mass of.
11350 # @param theName Object name; when specified, this parameter is used
11351 # for result publication in the study. Otherwise, if automatic
11352 # publication is switched on, default value is used for result name.
11354 # @return New GEOM.GEOM_Object, containing the created point.
11356 # @ref tui_center_of_mass_page "Example"
11357 @ManageTransactions("MeasuOp")
11358 def MakeCDG(self, theShape, theName=None):
11360 Get a point, situated at the centre of mass of theShape.
11363 theShape Shape to define centre of mass of.
11364 theName Object name; when specified, this parameter is used
11365 for result publication in the study. Otherwise, if automatic
11366 publication is switched on, default value is used for result name.
11369 New GEOM.GEOM_Object, containing the created point.
11371 # Example: see GEOM_TestMeasures.py
11372 anObj = self.MeasuOp.GetCentreOfMass(theShape)
11373 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
11374 self._autoPublish(anObj, theName, "centerOfMass")
11377 ## Get a vertex sub-shape by index.
11378 # @param theShape Shape to find sub-shape.
11379 # @param theIndex Index to find vertex by this index (starting from zero)
11380 # @param theUseOri To consider edge/wire orientation or not
11381 # @param theName Object name; when specified, this parameter is used
11382 # for result publication in the study. Otherwise, if automatic
11383 # publication is switched on, default value is used for result name.
11385 # @return New GEOM.GEOM_Object, containing the created vertex.
11387 # @ref tui_measurement_tools_page "Example"
11388 @ManageTransactions("MeasuOp")
11389 def GetVertexByIndex(self, theShape, theIndex, theUseOri=True, theName=None):
11391 Get a vertex sub-shape by index.
11394 theShape Shape to find sub-shape.
11395 theIndex Index to find vertex by this index (starting from zero)
11396 theUseOri To consider edge/wire orientation or not
11397 theName Object name; when specified, this parameter is used
11398 for result publication in the study. Otherwise, if automatic
11399 publication is switched on, default value is used for result name.
11402 New GEOM.GEOM_Object, containing the created vertex.
11404 # Example: see GEOM_TestMeasures.py
11405 if isinstance( theUseOri, str ): # theUseOri was inserted before theName
11406 theUseOri, theName = True, theUseOri
11407 anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex, theUseOri)
11408 RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
11409 self._autoPublish(anObj, theName, "vertex")
11412 ## Get the first vertex of wire/edge depended orientation.
11413 # @param theShape Shape to find first vertex.
11414 # @param theName Object name; when specified, this parameter is used
11415 # for result publication in the study. Otherwise, if automatic
11416 # publication is switched on, default value is used for result name.
11418 # @return New GEOM.GEOM_Object, containing the created vertex.
11420 # @ref tui_measurement_tools_page "Example"
11421 def GetFirstVertex(self, theShape, theName=None):
11423 Get the first vertex of wire/edge depended orientation.
11426 theShape Shape to find first vertex.
11427 theName Object name; when specified, this parameter is used
11428 for result publication in the study. Otherwise, if automatic
11429 publication is switched on, default value is used for result name.
11432 New GEOM.GEOM_Object, containing the created vertex.
11434 # Example: see GEOM_TestMeasures.py
11435 # note: auto-publishing is done in self.GetVertexByIndex()
11436 return self.GetVertexByIndex(theShape, 0, True, theName)
11438 ## Get the last vertex of wire/edge depended orientation.
11439 # @param theShape Shape to find last vertex.
11440 # @param theName Object name; when specified, this parameter is used
11441 # for result publication in the study. Otherwise, if automatic
11442 # publication is switched on, default value is used for result name.
11444 # @return New GEOM.GEOM_Object, containing the created vertex.
11446 # @ref tui_measurement_tools_page "Example"
11447 def GetLastVertex(self, theShape, theName=None):
11449 Get the last vertex of wire/edge depended orientation.
11452 theShape Shape to find last vertex.
11453 theName Object name; when specified, this parameter is used
11454 for result publication in the study. Otherwise, if automatic
11455 publication is switched on, default value is used for result name.
11458 New GEOM.GEOM_Object, containing the created vertex.
11460 # Example: see GEOM_TestMeasures.py
11461 nb_vert = self.NumberOfSubShapes(theShape, self.ShapeType["VERTEX"])
11462 # note: auto-publishing is done in self.GetVertexByIndex()
11463 return self.GetVertexByIndex(theShape, (nb_vert-1), True, theName)
11465 ## Get a normale to the given face. If the point is not given,
11466 # the normale is calculated at the center of mass.
11467 # @param theFace Face to define normale of.
11468 # @param theOptionalPoint Point to compute the normale at.
11469 # @param theName Object name; when specified, this parameter is used
11470 # for result publication in the study. Otherwise, if automatic
11471 # publication is switched on, default value is used for result name.
11473 # @return New GEOM.GEOM_Object, containing the created vector.
11475 # @ref swig_todo "Example"
11476 @ManageTransactions("MeasuOp")
11477 def GetNormal(self, theFace, theOptionalPoint = None, theName=None):
11479 Get a normale to the given face. If the point is not given,
11480 the normale is calculated at the center of mass.
11483 theFace Face to define normale of.
11484 theOptionalPoint Point to compute the normale at.
11485 theName Object name; when specified, this parameter is used
11486 for result publication in the study. Otherwise, if automatic
11487 publication is switched on, default value is used for result name.
11490 New GEOM.GEOM_Object, containing the created vector.
11492 # Example: see GEOM_TestMeasures.py
11493 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
11494 RaiseIfFailed("GetNormal", self.MeasuOp)
11495 self._autoPublish(anObj, theName, "normal")
11498 ## Print shape errors obtained from CheckShape.
11499 # @param theShape Shape that was checked.
11500 # @param theShapeErrors the shape errors obtained by CheckShape.
11501 # @param theReturnStatus If 0 the description of problem is printed.
11502 # If 1 the description of problem is returned.
11503 # @return If theReturnStatus is equal to 1 the description is returned.
11504 # Otherwise doesn't return anything.
11506 # @ref tui_check_shape_page "Example"
11507 @ManageTransactions("MeasuOp")
11508 def PrintShapeErrors(self, theShape, theShapeErrors, theReturnStatus = 0):
11510 Print shape errors obtained from CheckShape.
11513 theShape Shape that was checked.
11514 theShapeErrors the shape errors obtained by CheckShape.
11515 theReturnStatus If 0 the description of problem is printed.
11516 If 1 the description of problem is returned.
11519 If theReturnStatus is equal to 1 the description is returned.
11520 Otherwise doesn't return anything.
11522 # Example: see GEOM_TestMeasures.py
11523 Descr = self.MeasuOp.PrintShapeErrors(theShape, theShapeErrors)
11524 if theReturnStatus == 1:
11529 ## Check a topology of the given shape.
11530 # @param theShape Shape to check validity of.
11531 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked, \n
11532 # if TRUE, the shape's geometry will be checked also.
11533 # @param theReturnStatus If 0 and if theShape is invalid, a description
11534 # of problem is printed.
11535 # If 1 isValid flag and the description of
11536 # problem is returned.
11537 # If 2 isValid flag and the list of error data
11539 # @return TRUE, if the shape "seems to be valid".
11540 # If theShape is invalid, prints a description of problem.
11541 # If theReturnStatus is equal to 1 the description is returned
11542 # along with IsValid flag.
11543 # If theReturnStatus is equal to 2 the list of error data is
11544 # returned along with IsValid flag.
11546 # @ref tui_check_shape_page "Example"
11547 @ManageTransactions("MeasuOp")
11548 def CheckShape(self,theShape, theIsCheckGeom = 0, theReturnStatus = 0):
11550 Check a topology of the given shape.
11553 theShape Shape to check validity of.
11554 theIsCheckGeom If FALSE, only the shape's topology will be checked,
11555 if TRUE, the shape's geometry will be checked also.
11556 theReturnStatus If 0 and if theShape is invalid, a description
11557 of problem is printed.
11558 If 1 IsValid flag and the description of
11559 problem is returned.
11560 If 2 IsValid flag and the list of error data
11564 TRUE, if the shape "seems to be valid".
11565 If theShape is invalid, prints a description of problem.
11566 If theReturnStatus is equal to 1 the description is returned
11567 along with IsValid flag.
11568 If theReturnStatus is equal to 2 the list of error data is
11569 returned along with IsValid flag.
11571 # Example: see GEOM_TestMeasures.py
11573 (IsValid, ShapeErrors) = self.MeasuOp.CheckShapeWithGeometry(theShape)
11574 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
11576 (IsValid, ShapeErrors) = self.MeasuOp.CheckShape(theShape)
11577 RaiseIfFailed("CheckShape", self.MeasuOp)
11579 if theReturnStatus == 0:
11580 Descr = self.MeasuOp.PrintShapeErrors(theShape, ShapeErrors)
11582 if theReturnStatus == 1:
11583 Descr = self.MeasuOp.PrintShapeErrors(theShape, ShapeErrors)
11584 return (IsValid, Descr)
11585 elif theReturnStatus == 2:
11586 return (IsValid, ShapeErrors)
11589 ## Detect self-intersections in the given shape.
11590 # @param theShape Shape to check.
11591 # @param theCheckLevel is the level of self-intersection check.
11592 # Possible input values are:
11593 # - GEOM.SI_V_V(0) - only V/V interferences
11594 # - GEOM.SI_V_E(1) - V/V and V/E interferences
11595 # - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
11596 # - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
11597 # - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
11598 # - GEOM.SI_ALL(5) - all interferences.
11599 # @return TRUE, if the shape contains no self-intersections.
11601 # @ref tui_check_self_intersections_page "Example"
11602 @ManageTransactions("MeasuOp")
11603 def CheckSelfIntersections(self, theShape, theCheckLevel = GEOM.SI_ALL):
11605 Detect self-intersections in the given shape.
11608 theShape Shape to check.
11609 theCheckLevel is the level of self-intersection check.
11610 Possible input values are:
11611 - GEOM.SI_V_V(0) - only V/V interferences
11612 - GEOM.SI_V_E(1) - V/V and V/E interferences
11613 - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
11614 - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
11615 - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
11616 - GEOM.SI_ALL(5) - all interferences.
11619 TRUE, if the shape contains no self-intersections.
11621 # Example: see GEOM_TestMeasures.py
11622 (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape, EnumToLong(theCheckLevel))
11623 RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
11626 ## Detect self-intersections of the given shape with algorithm based on mesh intersections.
11627 # @param theShape Shape to check.
11628 # @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
11629 # - if \a theDeflection <= 0, default deflection 0.001 is used
11630 # @param theTolerance Specifies a distance between sub-shapes used for detecting gaps:
11631 # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
11632 # - if \a theTolerance > 0, algorithm detects gaps
11633 # @return TRUE, if the shape contains no self-intersections.
11635 # @ref tui_check_self_intersections_fast_page "Example"
11636 @ManageTransactions("MeasuOp")
11637 def CheckSelfIntersectionsFast(self, theShape, theDeflection = 0.001, theTolerance = 0.0):
11639 Detect self-intersections of the given shape with algorithm based on mesh intersections.
11642 theShape Shape to check.
11643 theDeflection Linear deflection coefficient that specifies quality of tessellation:
11644 - if theDeflection <= 0, default deflection 0.001 is used
11645 theTolerance Specifies a distance between shapes used for detecting gaps:
11646 - if theTolerance <= 0, algorithm detects intersections (default behavior)
11647 - if theTolerance > 0, algorithm detects gaps
11650 TRUE, if the shape contains no self-intersections.
11652 # Example: see GEOM_TestMeasures.py
11653 (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance)
11654 RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
11657 ## Check boolean and partition operations arguments.
11658 # @param theShape the argument of an operation to be checked
11659 # @return TRUE if the argument is valid for a boolean or partition
11660 # operation; FALSE otherwise.
11661 @ManageTransactions("MeasuOp")
11662 def CheckBOPArguments(self, theShape):
11664 Check boolean and partition operations arguments.
11667 theShape the argument of an operation to be checked
11670 TRUE if the argument is valid for a boolean or partition
11671 operation; FALSE otherwise.
11673 return self.MeasuOp.CheckBOPArguments(theShape)
11675 ## Detect intersections of the given shapes with algorithm based on mesh intersections.
11676 # @param theShape1 First source object
11677 # @param theShape2 Second source object
11678 # @param theTolerance Specifies a distance between shapes used for detecting gaps:
11679 # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
11680 # - if \a theTolerance > 0, algorithm detects gaps
11681 # @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
11682 # - if \a theDeflection <= 0, default deflection 0.001 is used
11683 # @return TRUE, if there are intersections (gaps) between source shapes
11684 # @return List of sub-shapes IDs from 1st shape that localize intersection.
11685 # @return List of sub-shapes IDs from 2nd shape that localize intersection.
11687 # @ref tui_fast_intersection_page "Example"
11688 @ManageTransactions("MeasuOp")
11689 def FastIntersect(self, theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001):
11691 Detect intersections of the given shapes with algorithm based on mesh intersections.
11694 theShape1 First source object
11695 theShape2 Second source object
11696 theTolerance Specifies a distance between shapes used for detecting gaps:
11697 - if theTolerance <= 0, algorithm detects intersections (default behavior)
11698 - if theTolerance > 0, algorithm detects gaps
11699 theDeflection Linear deflection coefficient that specifies quality of tessellation:
11700 - if theDeflection <= 0, default deflection 0.001 is used
11703 TRUE, if there are intersections (gaps) between source shapes
11704 List of sub-shapes IDs from 1st shape that localize intersection.
11705 List of sub-shapes IDs from 2nd shape that localize intersection.
11707 # Example: see GEOM_TestMeasures.py
11708 IsOk, Res1, Res2 = self.MeasuOp.FastIntersect(theShape1, theShape2, theTolerance, theDeflection)
11709 RaiseIfFailed("FastIntersect", self.MeasuOp)
11710 return IsOk, Res1, Res2
11712 ## Get position (LCS) of theShape.
11714 # Origin of the LCS is situated at the shape's center of mass.
11715 # Axes of the LCS are obtained from shape's location or,
11716 # if the shape is a planar face, from position of its plane.
11718 # @param theShape Shape to calculate position of.
11719 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
11720 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
11721 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
11722 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
11724 # @ref swig_todo "Example"
11725 @ManageTransactions("MeasuOp")
11726 def GetPosition(self,theShape):
11728 Get position (LCS) of theShape.
11729 Origin of the LCS is situated at the shape's center of mass.
11730 Axes of the LCS are obtained from shape's location or,
11731 if the shape is a planar face, from position of its plane.
11734 theShape Shape to calculate position of.
11737 [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
11738 Ox,Oy,Oz: Coordinates of shape's LCS origin.
11739 Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
11740 Xx,Xy,Xz: Coordinates of shape's LCS X direction.
11742 # Example: see GEOM_TestMeasures.py
11743 aTuple = self.MeasuOp.GetPosition(theShape)
11744 RaiseIfFailed("GetPosition", self.MeasuOp)
11747 ## Get kind of theShape.
11749 # @param theShape Shape to get a kind of.
11750 # @return Returns a kind of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
11751 # and a list of parameters, describing the shape.
11752 # @note Concrete meaning of each value, returned via \a theIntegers
11753 # or \a theDoubles list depends on the kind() of the shape.
11755 # @ref swig_todo "Example"
11756 @ManageTransactions("MeasuOp")
11757 def KindOfShape(self,theShape):
11759 Get kind of theShape.
11762 theShape Shape to get a kind of.
11765 a kind of shape in terms of GEOM_IKindOfShape.shape_kind enumeration
11766 and a list of parameters, describing the shape.
11768 Concrete meaning of each value, returned via theIntegers
11769 or theDoubles list depends on the geompy.kind of the shape
11771 # Example: see GEOM_TestMeasures.py
11772 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
11773 RaiseIfFailed("KindOfShape", self.MeasuOp)
11775 aKind = aRoughTuple[0]
11776 anInts = aRoughTuple[1]
11777 aDbls = aRoughTuple[2]
11779 # Now there is no exception from this rule:
11780 aKindTuple = [aKind] + aDbls + anInts
11782 # If they are we will regroup parameters for such kind of shape.
11784 #if aKind == kind.SOME_KIND:
11785 # # SOME_KIND int int double int double double
11786 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
11790 ## The function takes a single face with holes and returns a list of faces,
11791 # first of them is the original face without holes, and the other faces are placed
11792 # on the same surface as the original face but bounded by each hole wire.
11793 # If the original face has no holes, it will be returned as an output
11794 # @param theShape Face to perform operation on.
11796 # @return GEOM.ListOfGO, list created faces, where first of them is the original face without holes
11797 @ManageTransactions("MeasuOp")
11798 def PatchFace(self, theShape):
11800 The function takes a single face with holes and returns a list of faces,
11801 first of them is the original face without holes, and the other faces are placed
11802 on the same surface as the original face but bounded by each hole wire.
11803 If the original face has no holes, it will be returned as an output
11806 theShape Face to perform operation on.
11809 GEOM.ListOfGO, list created faces, where first of them is the original face without holes
11812 Circle_1 = geompy.MakeCircle(None, None, 190)
11813 Circle_2 = geompy.MakeCircle(None, None, 100)
11814 Face_1 = geompy.MakeFaceWires([Circle_1], 1)
11815 Face_2 = geompy.MakeFaceWires([Circle_2], 1)
11816 Cut_1 = geompy.MakeCutList(Face_1, [Face_2], True)
11817 faces = geompy.PatchFace(Cut_1)
11819 aList = self.MeasuOp.PatchFace(theShape)
11820 RaiseIfFailed("PatchFace", self.MeasuOp)
11823 ## Returns the string that describes if the shell is good for solid.
11824 # This is a support method for MakeSolid.
11826 # @param theShell the shell to be checked.
11827 # @return Returns a string that describes the shell validity for
11828 # solid construction.
11829 @ManageTransactions("MeasuOp")
11830 def _IsGoodForSolid(self, theShell):
11832 Returns the string that describes if the shell is good for solid.
11833 This is a support method for MakeSolid.
11836 theShell the shell to be checked.
11839 Returns a string that describes the shell validity for
11840 solid construction.
11842 aDescr = self.MeasuOp.IsGoodForSolid(theShell)
11845 ## Obtain a canonical recognition interface.
11846 # @return An instance of
11847 # @ref canonicalrecognition.CanonicalRecognition "CanonicalRecognition" interface
11849 # @ref tui_3dsketcher_page "Example"
11850 def CanonicalRecognition (self):
11852 Obtain a canonical recognition interface.
11855 cr = geompy.CanonicalRecognition()
11856 cr.isLine(aLine, tolerance)
11858 cr = CanonicalRecognition (self)
11861 # end of l2_measure
11864 ## @addtogroup l2_import_export
11867 ## Import a shape from the BREP, IGES, STEP or other file
11868 # (depends on given format) with given name.
11870 # Note: this function is deprecated, it is kept for backward compatibility only
11871 # Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
11873 # @param theFileName The file, containing the shape.
11874 # @param theFormatName Specify format for the file reading.
11875 # Available formats can be obtained with InsertOp.ImportTranslators() method.
11876 # If format 'IGES_SCALE' is used instead of 'IGES' or
11877 # format 'STEP_SCALE' is used instead of 'STEP',
11878 # length unit will be set to 'meter' and result model will be scaled.
11879 # @param theName Object name; when specified, this parameter is used
11880 # for result publication in the study. Otherwise, if automatic
11881 # publication is switched on, default value is used for result name.
11883 # @return New GEOM.GEOM_Object, containing the imported shape.
11884 # If material names are imported it returns the list of
11885 # objects. The first one is the imported object followed by
11887 # @note Auto publishing is allowed for the shape itself. Imported
11888 # material groups are not automatically published.
11890 # @ref swig_Import_Export "Example"
11891 @ManageTransactions("InsertOp")
11892 def ImportFile(self, theFileName, theFormatName, theName=None):
11894 Import a shape from the BREP, IGES, STEP or other file
11895 (depends on given format) with given name.
11897 Note: this function is deprecated, it is kept for backward compatibility only
11898 Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
11901 theFileName The file, containing the shape.
11902 theFormatName Specify format for the file reading.
11903 Available formats can be obtained with geompy.InsertOp.ImportTranslators() method.
11904 If format 'IGES_SCALE' is used instead of 'IGES' or
11905 format 'STEP_SCALE' is used instead of 'STEP',
11906 length unit will be set to 'meter' and result model will be scaled.
11907 theName Object name; when specified, this parameter is used
11908 for result publication in the study. Otherwise, if automatic
11909 publication is switched on, default value is used for result name.
11912 New GEOM.GEOM_Object, containing the imported shape.
11913 If material names are imported it returns the list of
11914 objects. The first one is the imported object followed by
11917 Auto publishing is allowed for the shape itself. Imported
11918 material groups are not automatically published.
11920 # Example: see GEOM_TestOthers.py
11922 WARNING: Function ImportFile is deprecated, use Import<FormatName> instead,
11923 where <FormatName> is a name of desirable format for importing.
11925 aListObj = self.InsertOp.ImportFile(theFileName, theFormatName)
11926 RaiseIfFailed("ImportFile", self.InsertOp)
11927 aNbObj = len(aListObj)
11929 self._autoPublish(aListObj[0], theName, "imported")
11934 ## Deprecated analog of ImportFile()
11935 def Import(self, theFileName, theFormatName, theName=None):
11937 Deprecated analog of geompy.ImportFile, kept for backward compatibility only.
11939 # note: auto-publishing is done in self.ImportFile()
11940 return self.ImportFile(theFileName, theFormatName, theName)
11942 ## Read a shape from the binary stream, containing its bounding representation (BRep).
11944 # @note As the byte-stream representing the shape data can be quite large, this method
11945 # is not automatically dumped to the Python script with the DumpStudy functionality;
11946 # so please use this method carefully, only for strong reasons.
11948 # @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's
11951 # @param theStream The BRep binary stream.
11952 # @param theName Object name; when specified, this parameter is used
11953 # for result publication in the study. Otherwise, if automatic
11954 # publication is switched on, default value is used for result name.
11956 # @return New GEOM_Object, containing the shape, read from theStream.
11958 # @ref swig_Import_Export "Example"
11959 @ManageTransactions("InsertOp")
11960 def RestoreShape (self, theStream, theName=None):
11962 Read a shape from the binary stream, containing its bounding representation (BRep).
11965 shape.GetShapeStream() method can be used to obtain the shape's BRep stream.
11968 theStream The BRep binary stream.
11969 theName Object name; when specified, this parameter is used
11970 for result publication in the study. Otherwise, if automatic
11971 publication is switched on, default value is used for result name.
11974 New GEOM_Object, containing the shape, read from theStream.
11976 # Example: see GEOM_TestOthers.py
11978 # this is the workaround to ignore invalid case when data stream is empty
11979 if int(os.getenv("GEOM_IGNORE_RESTORE_SHAPE", "0")) > 0:
11980 print("WARNING: Result of RestoreShape is a NULL shape!")
11982 anObj = self.InsertOp.RestoreShape(theStream)
11983 RaiseIfFailed("RestoreShape", self.InsertOp)
11984 self._autoPublish(anObj, theName, "restored")
11987 ## Export the given shape into a file with given name.
11989 # Note: this function is deprecated, it is kept for backward compatibility only
11990 # Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
11992 # @param theObject Shape to be stored in the file.
11993 # @param theFileName Name of the file to store the given shape in.
11994 # @param theFormatName Specify format for the shape storage.
11995 # Available formats can be obtained with
11996 # geompy.InsertOp.ExportTranslators()[0] method.
11998 # @ref swig_Import_Export "Example"
11999 @ManageTransactions("InsertOp")
12000 def Export(self, theObject, theFileName, theFormatName):
12002 Export the given shape into a file with given name.
12004 Note: this function is deprecated, it is kept for backward compatibility only
12005 Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
12008 theObject Shape to be stored in the file.
12009 theFileName Name of the file to store the given shape in.
12010 theFormatName Specify format for the shape storage.
12011 Available formats can be obtained with
12012 geompy.InsertOp.ExportTranslators()[0] method.
12014 # Example: see GEOM_TestOthers.py
12016 WARNING: Function Export is deprecated, use Export<FormatName> instead,
12017 where <FormatName> is a name of desirable format for exporting.
12019 self.InsertOp.Export(theObject, theFileName, theFormatName)
12020 if self.InsertOp.IsDone() == 0:
12021 raise RuntimeError("Export : " + self.InsertOp.GetErrorCode())
12025 # end of l2_import_export
12028 ## @addtogroup l3_blocks
12031 ## Create a quadrangle face from four edges. Order of Edges is not
12032 # important. It is not necessary that edges share the same vertex.
12033 # @param E1,E2,E3,E4 Edges for the face bound.
12034 # @param theName Object name; when specified, this parameter is used
12035 # for result publication in the study. Otherwise, if automatic
12036 # publication is switched on, default value is used for result name.
12038 # @return New GEOM.GEOM_Object, containing the created face.
12040 # @ref tui_building_by_blocks_page "Example"
12041 @ManageTransactions("BlocksOp")
12042 def MakeQuad(self, E1, E2, E3, E4, theName=None):
12044 Create a quadrangle face from four edges. Order of Edges is not
12045 important. It is not necessary that edges share the same vertex.
12048 E1,E2,E3,E4 Edges for the face bound.
12049 theName Object name; when specified, this parameter is used
12050 for result publication in the study. Otherwise, if automatic
12051 publication is switched on, default value is used for result name.
12054 New GEOM.GEOM_Object, containing the created face.
12057 qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
12059 # Example: see GEOM_Spanner.py
12060 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
12061 RaiseIfFailed("MakeQuad", self.BlocksOp)
12062 self._autoPublish(anObj, theName, "quad")
12065 ## Create a quadrangle face on two edges.
12066 # The missing edges will be built by creating the shortest ones.
12067 # @param E1,E2 Two opposite edges for the face.
12068 # @param theName Object name; when specified, this parameter is used
12069 # for result publication in the study. Otherwise, if automatic
12070 # publication is switched on, default value is used for result name.
12072 # @return New GEOM.GEOM_Object, containing the created face.
12074 # @ref tui_building_by_blocks_page "Example"
12075 @ManageTransactions("BlocksOp")
12076 def MakeQuad2Edges(self, E1, E2, theName=None):
12078 Create a quadrangle face on two edges.
12079 The missing edges will be built by creating the shortest ones.
12082 E1,E2 Two opposite edges for the face.
12083 theName Object name; when specified, this parameter is used
12084 for result publication in the study. Otherwise, if automatic
12085 publication is switched on, default value is used for result name.
12088 New GEOM.GEOM_Object, containing the created face.
12092 p1 = geompy.MakeVertex( 0., 0., 0.)
12093 p2 = geompy.MakeVertex(150., 30., 0.)
12094 p3 = geompy.MakeVertex( 0., 120., 50.)
12095 p4 = geompy.MakeVertex( 0., 40., 70.)
12097 edge1 = geompy.MakeEdge(p1, p2)
12098 edge2 = geompy.MakeEdge(p3, p4)
12099 # create a quadrangle face from two edges
12100 qface2 = geompy.MakeQuad2Edges(edge1, edge2)
12102 # Example: see GEOM_Spanner.py
12103 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
12104 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
12105 self._autoPublish(anObj, theName, "quad")
12108 ## Create a quadrangle face with specified corners.
12109 # The missing edges will be built by creating the shortest ones.
12110 # @param V1,V2,V3,V4 Corner vertices for the face.
12111 # @param theName Object name; when specified, this parameter is used
12112 # for result publication in the study. Otherwise, if automatic
12113 # publication is switched on, default value is used for result name.
12115 # @return New GEOM.GEOM_Object, containing the created face.
12117 # @ref tui_building_by_blocks_page "Example 1"
12118 # \n @ref swig_MakeQuad4Vertices "Example 2"
12119 @ManageTransactions("BlocksOp")
12120 def MakeQuad4Vertices(self, V1, V2, V3, V4, theName=None):
12122 Create a quadrangle face with specified corners.
12123 The missing edges will be built by creating the shortest ones.
12126 V1,V2,V3,V4 Corner vertices for the face.
12127 theName Object name; when specified, this parameter is used
12128 for result publication in the study. Otherwise, if automatic
12129 publication is switched on, default value is used for result name.
12132 New GEOM.GEOM_Object, containing the created face.
12136 p1 = geompy.MakeVertex( 0., 0., 0.)
12137 p2 = geompy.MakeVertex(150., 30., 0.)
12138 p3 = geompy.MakeVertex( 0., 120., 50.)
12139 p4 = geompy.MakeVertex( 0., 40., 70.)
12140 # create a quadrangle from four points in its corners
12141 qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
12143 # Example: see GEOM_Spanner.py
12144 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
12145 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
12146 self._autoPublish(anObj, theName, "quad")
12149 ## Create a hexahedral solid, bounded by the six given faces. Order of
12150 # faces is not important. It is not necessary that Faces share the same edge.
12151 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
12152 # @param theName Object name; when specified, this parameter is used
12153 # for result publication in the study. Otherwise, if automatic
12154 # publication is switched on, default value is used for result name.
12156 # @return New GEOM.GEOM_Object, containing the created solid.
12158 # @ref tui_building_by_blocks_page "Example 1"
12159 # \n @ref swig_MakeHexa "Example 2"
12160 @ManageTransactions("BlocksOp")
12161 def MakeHexa(self, F1, F2, F3, F4, F5, F6, theName=None):
12163 Create a hexahedral solid, bounded by the six given faces. Order of
12164 faces is not important. It is not necessary that Faces share the same edge.
12167 F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
12168 theName Object name; when specified, this parameter is used
12169 for result publication in the study. Otherwise, if automatic
12170 publication is switched on, default value is used for result name.
12173 New GEOM.GEOM_Object, containing the created solid.
12176 solid = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
12178 # Example: see GEOM_Spanner.py
12179 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
12180 RaiseIfFailed("MakeHexa", self.BlocksOp)
12181 self._autoPublish(anObj, theName, "hexa")
12184 ## Create a hexahedral solid between two given faces.
12185 # The missing faces will be built by creating the smallest ones.
12186 # @param F1,F2 Two opposite faces for the hexahedral solid.
12187 # @param theName Object name; when specified, this parameter is used
12188 # for result publication in the study. Otherwise, if automatic
12189 # publication is switched on, default value is used for result name.
12191 # @return New GEOM.GEOM_Object, containing the created solid.
12193 # @ref tui_building_by_blocks_page "Example 1"
12194 # \n @ref swig_MakeHexa2Faces "Example 2"
12195 @ManageTransactions("BlocksOp")
12196 def MakeHexa2Faces(self, F1, F2, theName=None):
12198 Create a hexahedral solid between two given faces.
12199 The missing faces will be built by creating the smallest ones.
12202 F1,F2 Two opposite faces for the hexahedral solid.
12203 theName Object name; when specified, this parameter is used
12204 for result publication in the study. Otherwise, if automatic
12205 publication is switched on, default value is used for result name.
12208 New GEOM.GEOM_Object, containing the created solid.
12211 solid1 = geompy.MakeHexa2Faces(qface1, qface2)
12213 # Example: see GEOM_Spanner.py
12214 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
12215 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
12216 self._autoPublish(anObj, theName, "hexa")
12222 ## @addtogroup l3_blocks_op
12225 ## Get a vertex, found in the given shape by its coordinates.
12226 # @param theShape Block or a compound of blocks.
12227 # @param theX,theY,theZ Coordinates of the sought vertex.
12228 # @param theEpsilon Maximum allowed distance between the resulting
12229 # vertex and point with the given coordinates.
12230 # @param theName Object name; when specified, this parameter is used
12231 # for result publication in the study. Otherwise, if automatic
12232 # publication is switched on, default value is used for result name.
12234 # @return New GEOM.GEOM_Object, containing the found vertex.
12236 # @ref swig_GetPoint "Example"
12237 @ManageTransactions("BlocksOp")
12238 def GetPoint(self, theShape, theX, theY, theZ, theEpsilon, theName=None):
12240 Get a vertex, found in the given shape by its coordinates.
12243 theShape Block or a compound of blocks.
12244 theX,theY,theZ Coordinates of the sought vertex.
12245 theEpsilon Maximum allowed distance between the resulting
12246 vertex and point with the given coordinates.
12247 theName Object name; when specified, this parameter is used
12248 for result publication in the study. Otherwise, if automatic
12249 publication is switched on, default value is used for result name.
12252 New GEOM.GEOM_Object, containing the found vertex.
12255 pnt = geompy.GetPoint(shape, -50, 50, 50, 0.01)
12257 # Example: see GEOM_TestOthers.py
12258 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
12259 RaiseIfFailed("GetPoint", self.BlocksOp)
12260 self._autoPublish(anObj, theName, "vertex")
12263 ## Find a vertex of the given shape, which has minimal distance to the given point.
12264 # @param theShape Any shape.
12265 # @param thePoint Point, close to the desired vertex.
12266 # @param theName Object name; when specified, this parameter is used
12267 # for result publication in the study. Otherwise, if automatic
12268 # publication is switched on, default value is used for result name.
12270 # @return New GEOM.GEOM_Object, containing the found vertex.
12272 # @ref swig_GetVertexNearPoint "Example"
12273 @ManageTransactions("BlocksOp")
12274 def GetVertexNearPoint(self, theShape, thePoint, theName=None):
12276 Find a vertex of the given shape, which has minimal distance to the given point.
12279 theShape Any shape.
12280 thePoint Point, close to the desired vertex.
12281 theName Object name; when specified, this parameter is used
12282 for result publication in the study. Otherwise, if automatic
12283 publication is switched on, default value is used for result name.
12286 New GEOM.GEOM_Object, containing the found vertex.
12289 pmidle = geompy.MakeVertex(50, 0, 50)
12290 edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
12292 # Example: see GEOM_TestOthers.py
12293 anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
12294 RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
12295 self._autoPublish(anObj, theName, "vertex")
12298 ## Get an edge, found in the given shape by two given vertices.
12299 # @param theShape Block or a compound of blocks.
12300 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
12301 # @param theName Object name; when specified, this parameter is used
12302 # for result publication in the study. Otherwise, if automatic
12303 # publication is switched on, default value is used for result name.
12305 # @return New GEOM.GEOM_Object, containing the found edge.
12307 # @ref swig_GetEdge "Example"
12308 @ManageTransactions("BlocksOp")
12309 def GetEdge(self, theShape, thePoint1, thePoint2, theName=None):
12311 Get an edge, found in the given shape by two given vertices.
12314 theShape Block or a compound of blocks.
12315 thePoint1,thePoint2 Points, close to the ends of the desired edge.
12316 theName Object name; when specified, this parameter is used
12317 for result publication in the study. Otherwise, if automatic
12318 publication is switched on, default value is used for result name.
12321 New GEOM.GEOM_Object, containing the found edge.
12323 # Example: see GEOM_Spanner.py
12324 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
12325 RaiseIfFailed("GetEdge", self.BlocksOp)
12326 self._autoPublish(anObj, theName, "edge")
12329 ## Find an edge of the given shape, which has minimal distance to the given point.
12330 # @param theShape Block or a compound of blocks.
12331 # @param thePoint Point, close to the desired edge.
12332 # @param theName Object name; when specified, this parameter is used
12333 # for result publication in the study. Otherwise, if automatic
12334 # publication is switched on, default value is used for result name.
12336 # @return New GEOM.GEOM_Object, containing the found edge.
12338 # @ref swig_GetEdgeNearPoint "Example"
12339 @ManageTransactions("BlocksOp")
12340 def GetEdgeNearPoint(self, theShape, thePoint, theName=None):
12342 Find an edge of the given shape, which has minimal distance to the given point.
12345 theShape Block or a compound of blocks.
12346 thePoint Point, close to the desired edge.
12347 theName Object name; when specified, this parameter is used
12348 for result publication in the study. Otherwise, if automatic
12349 publication is switched on, default value is used for result name.
12352 New GEOM.GEOM_Object, containing the found edge.
12354 # Example: see GEOM_TestOthers.py
12355 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
12356 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
12357 self._autoPublish(anObj, theName, "edge")
12360 ## Returns a face, found in the given shape by four given corner vertices.
12361 # @param theShape Block or a compound of blocks.
12362 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
12363 # @param theName Object name; when specified, this parameter is used
12364 # for result publication in the study. Otherwise, if automatic
12365 # publication is switched on, default value is used for result name.
12367 # @return New GEOM.GEOM_Object, containing the found face.
12369 # @ref swig_todo "Example"
12370 @ManageTransactions("BlocksOp")
12371 def GetFaceByPoints(self, theShape, thePoint1, thePoint2, thePoint3, thePoint4, theName=None):
12373 Returns a face, found in the given shape by four given corner vertices.
12376 theShape Block or a compound of blocks.
12377 thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
12378 theName Object name; when specified, this parameter is used
12379 for result publication in the study. Otherwise, if automatic
12380 publication is switched on, default value is used for result name.
12383 New GEOM.GEOM_Object, containing the found face.
12385 # Example: see GEOM_Spanner.py
12386 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
12387 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
12388 self._autoPublish(anObj, theName, "face")
12391 ## Get a face of block, found in the given shape by two given edges.
12392 # @param theShape Block or a compound of blocks.
12393 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
12394 # @param theName Object name; when specified, this parameter is used
12395 # for result publication in the study. Otherwise, if automatic
12396 # publication is switched on, default value is used for result name.
12398 # @return New GEOM.GEOM_Object, containing the found face.
12400 # @ref swig_todo "Example"
12401 @ManageTransactions("BlocksOp")
12402 def GetFaceByEdges(self, theShape, theEdge1, theEdge2, theName=None):
12404 Get a face of block, found in the given shape by two given edges.
12407 theShape Block or a compound of blocks.
12408 theEdge1,theEdge2 Edges, close to the edges of the desired face.
12409 theName Object name; when specified, this parameter is used
12410 for result publication in the study. Otherwise, if automatic
12411 publication is switched on, default value is used for result name.
12414 New GEOM.GEOM_Object, containing the found face.
12416 # Example: see GEOM_Spanner.py
12417 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
12418 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
12419 self._autoPublish(anObj, theName, "face")
12422 ## Find a face, opposite to the given one in the given block.
12423 # @param theBlock Must be a hexahedral solid.
12424 # @param theFace Face of \a theBlock, opposite to the desired face.
12425 # @param theName Object name; when specified, this parameter is used
12426 # for result publication in the study. Otherwise, if automatic
12427 # publication is switched on, default value is used for result name.
12429 # @return New GEOM.GEOM_Object, containing the found face.
12431 # @ref swig_GetOppositeFace "Example"
12432 @ManageTransactions("BlocksOp")
12433 def GetOppositeFace(self, theBlock, theFace, theName=None):
12435 Find a face, opposite to the given one in the given block.
12438 theBlock Must be a hexahedral solid.
12439 theFace Face of theBlock, opposite to the desired face.
12440 theName Object name; when specified, this parameter is used
12441 for result publication in the study. Otherwise, if automatic
12442 publication is switched on, default value is used for result name.
12445 New GEOM.GEOM_Object, containing the found face.
12447 # Example: see GEOM_Spanner.py
12448 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
12449 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
12450 self._autoPublish(anObj, theName, "face")
12453 ## Find a face of the given shape, which has minimal distance to the given point.
12454 # @param theShape Block or a compound of blocks.
12455 # @param thePoint Point, close to the desired face.
12456 # @param theName Object name; when specified, this parameter is used
12457 # for result publication in the study. Otherwise, if automatic
12458 # publication is switched on, default value is used for result name.
12460 # @return New GEOM.GEOM_Object, containing the found face.
12462 # @ref swig_GetFaceNearPoint "Example"
12463 @ManageTransactions("BlocksOp")
12464 def GetFaceNearPoint(self, theShape, thePoint, theName=None):
12466 Find a face of the given shape, which has minimal distance to the given point.
12469 theShape Block or a compound of blocks.
12470 thePoint Point, close to the desired face.
12471 theName Object name; when specified, this parameter is used
12472 for result publication in the study. Otherwise, if automatic
12473 publication is switched on, default value is used for result name.
12476 New GEOM.GEOM_Object, containing the found face.
12478 # Example: see GEOM_Spanner.py
12479 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
12480 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
12481 self._autoPublish(anObj, theName, "face")
12484 ## Find a face of block, whose outside normale has minimal angle with the given vector.
12485 # @param theBlock Block or a compound of blocks.
12486 # @param theVector Vector, close to the normale of the desired face.
12487 # @param theName Object name; when specified, this parameter is used
12488 # for result publication in the study. Otherwise, if automatic
12489 # publication is switched on, default value is used for result name.
12491 # @return New GEOM.GEOM_Object, containing the found face.
12493 # @ref swig_todo "Example"
12494 @ManageTransactions("BlocksOp")
12495 def GetFaceByNormale(self, theBlock, theVector, theName=None):
12497 Find a face of block, whose outside normale has minimal angle with the given vector.
12500 theBlock Block or a compound of blocks.
12501 theVector Vector, close to the normale of the desired face.
12502 theName Object name; when specified, this parameter is used
12503 for result publication in the study. Otherwise, if automatic
12504 publication is switched on, default value is used for result name.
12507 New GEOM.GEOM_Object, containing the found face.
12509 # Example: see GEOM_Spanner.py
12510 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
12511 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
12512 self._autoPublish(anObj, theName, "face")
12515 ## Find all sub-shapes of type \a theShapeType of the given shape,
12516 # which have minimal distance to the given point.
12517 # @param theShape Any shape.
12518 # @param thePoint Point, close to the desired shape.
12519 # @param theShapeType Defines what kind of sub-shapes is searched GEOM::shape_type
12520 # @param theTolerance The tolerance for distances comparison. All shapes
12521 # with distances to the given point in interval
12522 # [minimal_distance, minimal_distance + theTolerance] will be gathered.
12523 # @param theName Object name; when specified, this parameter is used
12524 # for result publication in the study. Otherwise, if automatic
12525 # publication is switched on, default value is used for result name.
12527 # @return New GEOM_Object, containing a group of all found shapes.
12529 # @ref swig_GetShapesNearPoint "Example"
12530 @ManageTransactions("BlocksOp")
12531 def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07, theName=None):
12533 Find all sub-shapes of type theShapeType of the given shape,
12534 which have minimal distance to the given point.
12537 theShape Any shape.
12538 thePoint Point, close to the desired shape.
12539 theShapeType Defines what kind of sub-shapes is searched (see GEOM::shape_type)
12540 theTolerance The tolerance for distances comparison. All shapes
12541 with distances to the given point in interval
12542 [minimal_distance, minimal_distance + theTolerance] will be gathered.
12543 theName Object name; when specified, this parameter is used
12544 for result publication in the study. Otherwise, if automatic
12545 publication is switched on, default value is used for result name.
12548 New GEOM_Object, containing a group of all found shapes.
12550 # Example: see GEOM_TestOthers.py
12551 anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
12552 RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
12553 self._autoPublish(anObj, theName, "group")
12556 # end of l3_blocks_op
12559 ## @addtogroup l4_blocks_measure
12562 ## Check, if the compound of blocks is given.
12563 # To be considered as a compound of blocks, the
12564 # given shape must satisfy the following conditions:
12565 # - Each element of the compound should be a Block (6 faces).
12566 # - Each face should be a quadrangle, i.e. it should have only 1 wire
12567 # with 4 edges. If <VAR>theIsUseC1</VAR> is set to True and
12568 # there are more than 4 edges in the only wire of a face,
12569 # this face is considered to be quadrangle if it has 4 bounds
12570 # (1 or more edge) of C1 continuity.
12571 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
12572 # - The compound should be connexe.
12573 # - The glue between two quadrangle faces should be applied.
12574 # @param theCompound The compound to check.
12575 # @param theIsUseC1 Flag to check if there are 4 bounds on a face
12576 # taking into account C1 continuity.
12577 # @param theAngTolerance the angular tolerance to check if two neighbor
12578 # edges are codirectional in the common vertex with this
12579 # tolerance. This parameter is used only if
12580 # <VAR>theIsUseC1</VAR> is set to True.
12581 # @return TRUE, if the given shape is a compound of blocks.
12582 # If theCompound is not valid, prints all discovered errors.
12584 # @ref tui_check_compound_of_blocks_page "Example 1"
12585 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
12586 @ManageTransactions("BlocksOp")
12587 def CheckCompoundOfBlocks(self,theCompound, theIsUseC1 = False,
12588 theAngTolerance = 1.e-12):
12590 Check, if the compound of blocks is given.
12591 To be considered as a compound of blocks, the
12592 given shape must satisfy the following conditions:
12593 - Each element of the compound should be a Block (6 faces).
12594 - Each face should be a quadrangle, i.e. it should have only 1 wire
12595 with 4 edges. If theIsUseC1 is set to True and
12596 there are more than 4 edges in the only wire of a face,
12597 this face is considered to be quadrangle if it has 4 bounds
12598 (1 or more edge) of C1 continuity.
12599 - A connection between two Blocks should be an entire quadrangle face or an entire edge.
12600 - The compound should be connexe.
12601 - The glue between two quadrangle faces should be applied.
12604 theCompound The compound to check.
12605 theIsUseC1 Flag to check if there are 4 bounds on a face
12606 taking into account C1 continuity.
12607 theAngTolerance the angular tolerance to check if two neighbor
12608 edges are codirectional in the common vertex with this
12609 tolerance. This parameter is used only if
12610 theIsUseC1 is set to True.
12613 TRUE, if the given shape is a compound of blocks.
12614 If theCompound is not valid, prints all discovered errors.
12616 # Example: see GEOM_Spanner.py
12619 aTolerance = theAngTolerance
12620 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound, aTolerance)
12621 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
12623 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
12627 ## Retrieve all non blocks solids and faces from \a theShape.
12628 # @param theShape The shape to explore.
12629 # @param theIsUseC1 Flag to check if there are 4 bounds on a face
12630 # taking into account C1 continuity.
12631 # @param theAngTolerance the angular tolerance to check if two neighbor
12632 # edges are codirectional in the common vertex with this
12633 # tolerance. This parameter is used only if
12634 # <VAR>theIsUseC1</VAR> is set to True.
12635 # @param theName Object name; when specified, this parameter is used
12636 # for result publication in the study. Otherwise, if automatic
12637 # publication is switched on, default value is used for result name.
12639 # @return A tuple of two GEOM_Objects. The first object is a group of all
12640 # non block solids (= not 6 faces, or with 6 faces, but with the
12641 # presence of non-quadrangular faces). The second object is a
12642 # group of all non quadrangular faces (= faces with more then
12643 # 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
12644 # with 1 wire with not 4 edges that do not form 4 bounds of
12647 # @ref tui_get_non_blocks_page "Example 1"
12648 # \n @ref swig_GetNonBlocks "Example 2"
12649 @ManageTransactions("BlocksOp")
12650 def GetNonBlocks (self, theShape, theIsUseC1 = False,
12651 theAngTolerance = 1.e-12, theName=None):
12653 Retrieve all non blocks solids and faces from theShape.
12656 theShape The shape to explore.
12657 theIsUseC1 Flag to check if there are 4 bounds on a face
12658 taking into account C1 continuity.
12659 theAngTolerance the angular tolerance to check if two neighbor
12660 edges are codirectional in the common vertex with this
12661 tolerance. This parameter is used only if
12662 theIsUseC1 is set to True.
12663 theName Object name; when specified, this parameter is used
12664 for result publication in the study. Otherwise, if automatic
12665 publication is switched on, default value is used for result name.
12668 A tuple of two GEOM_Objects. The first object is a group of all
12669 non block solids (= not 6 faces, or with 6 faces, but with the
12670 presence of non-quadrangular faces). The second object is a
12671 group of all non quadrangular faces (= faces with more then
12672 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
12673 with 1 wire with not 4 edges that do not form 4 bounds of
12677 (res_sols, res_faces) = geompy.GetNonBlocks(myShape1)
12679 # Example: see GEOM_Spanner.py
12682 aTolerance = theAngTolerance
12683 aTuple = self.BlocksOp.GetNonBlocks(theShape, aTolerance)
12684 RaiseIfFailed("GetNonBlocks", self.BlocksOp)
12685 self._autoPublish(aTuple, theName, ("groupNonHexas", "groupNonQuads"))
12688 ## Remove all seam and degenerated edges from \a theShape.
12689 # Unite faces and edges, sharing one surface. It means that
12690 # this faces must have references to one C++ surface object (handle).
12691 # @param theShape The compound or single solid to remove irregular edges from.
12692 # @param doUnionFaces If True, then unite faces. If False (the default value),
12693 # do not unite faces.
12694 # @param theName Object name; when specified, this parameter is used
12695 # for result publication in the study. Otherwise, if automatic
12696 # publication is switched on, default value is used for result name.
12698 # @return Improved shape.
12700 # @ref swig_RemoveExtraEdges "Example"
12701 @ManageTransactions("BlocksOp")
12702 def RemoveExtraEdges(self, theShape, doUnionFaces=False, theName=None):
12704 Remove all seam and degenerated edges from theShape.
12705 Unite faces and edges, sharing one surface. It means that
12706 this faces must have references to one C++ surface object (handle).
12709 theShape The compound or single solid to remove irregular edges from.
12710 doUnionFaces If True, then unite faces. If False (the default value),
12711 do not unite faces.
12712 theName Object name; when specified, this parameter is used
12713 for result publication in the study. Otherwise, if automatic
12714 publication is switched on, default value is used for result name.
12719 # Example: see GEOM_TestOthers.py
12720 nbFacesOptimum = -1 # -1 means do not unite faces
12721 if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
12722 anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
12723 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
12724 self._autoPublish(anObj, theName, "removeExtraEdges")
12727 ## Performs union faces of \a theShape
12728 # Unite faces sharing one surface. It means that
12729 # these faces must have references to one C++ surface object (handle).
12730 # @param theShape The compound or single solid that contains faces
12731 # to perform union.
12732 # @param theName Object name; when specified, this parameter is used
12733 # for result publication in the study. Otherwise, if automatic
12734 # publication is switched on, default value is used for result name.
12736 # @return Improved shape.
12738 # @ref swig_UnionFaces "Example"
12739 @ManageTransactions("BlocksOp")
12740 def UnionFaces(self, theShape, theName=None):
12742 Performs union faces of theShape.
12743 Unite faces sharing one surface. It means that
12744 these faces must have references to one C++ surface object (handle).
12747 theShape The compound or single solid that contains faces
12749 theName Object name; when specified, this parameter is used
12750 for result publication in the study. Otherwise, if automatic
12751 publication is switched on, default value is used for result name.
12756 # Example: see GEOM_TestOthers.py
12757 anObj = self.BlocksOp.UnionFaces(theShape)
12758 RaiseIfFailed("UnionFaces", self.BlocksOp)
12759 self._autoPublish(anObj, theName, "unionFaces")
12762 ## Check, if the given shape is a blocks compound.
12763 # Fix all detected errors.
12764 # \note Single block can be also fixed by this method.
12765 # @param theShape The compound to check and improve.
12766 # @param theName Object name; when specified, this parameter is used
12767 # for result publication in the study. Otherwise, if automatic
12768 # publication is switched on, default value is used for result name.
12770 # @return Improved compound.
12772 # @ref swig_CheckAndImprove "Example"
12773 @ManageTransactions("BlocksOp")
12774 def CheckAndImprove(self, theShape, theName=None):
12776 Check, if the given shape is a blocks compound.
12777 Fix all detected errors.
12780 Single block can be also fixed by this method.
12783 theShape The compound to check and improve.
12784 theName Object name; when specified, this parameter is used
12785 for result publication in the study. Otherwise, if automatic
12786 publication is switched on, default value is used for result name.
12791 # Example: see GEOM_TestOthers.py
12792 anObj = self.BlocksOp.CheckAndImprove(theShape)
12793 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
12794 self._autoPublish(anObj, theName, "improved")
12797 # end of l4_blocks_measure
12800 ## @addtogroup l3_blocks_op
12803 ## Get all the blocks, contained in the given compound.
12804 # @param theCompound The compound to explode.
12805 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
12806 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
12807 # @param theName Object name; when specified, this parameter is used
12808 # for result publication in the study. Otherwise, if automatic
12809 # publication is switched on, default value is used for result name.
12811 # @note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
12813 # @return List of GEOM.GEOM_Object, containing the retrieved blocks.
12815 # @ref tui_explode_on_blocks "Example 1"
12816 # \n @ref swig_MakeBlockExplode "Example 2"
12817 @ManageTransactions("BlocksOp")
12818 def MakeBlockExplode(self, theCompound, theMinNbFaces, theMaxNbFaces, theName=None):
12820 Get all the blocks, contained in the given compound.
12823 theCompound The compound to explode.
12824 theMinNbFaces If solid has lower number of faces, it is not a block.
12825 theMaxNbFaces If solid has higher number of faces, it is not a block.
12826 theName Object name; when specified, this parameter is used
12827 for result publication in the study. Otherwise, if automatic
12828 publication is switched on, default value is used for result name.
12831 If theMaxNbFaces = 0, the maximum number of faces is not restricted.
12834 List of GEOM.GEOM_Object, containing the retrieved blocks.
12836 # Example: see GEOM_TestOthers.py
12837 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
12838 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
12839 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
12840 for anObj in aList:
12841 anObj.SetParameters(Parameters)
12843 self._autoPublish(aList, theName, "block")
12846 ## Find block, containing the given point inside its volume or on boundary.
12847 # @param theCompound Compound, to find block in.
12848 # @param thePoint Point, close to the desired block. If the point lays on
12849 # boundary between some blocks, we return block with nearest center.
12850 # @param theName Object name; when specified, this parameter is used
12851 # for result publication in the study. Otherwise, if automatic
12852 # publication is switched on, default value is used for result name.
12854 # @return New GEOM.GEOM_Object, containing the found block.
12856 # @ref swig_todo "Example"
12857 @ManageTransactions("BlocksOp")
12858 def GetBlockNearPoint(self, theCompound, thePoint, theName=None):
12860 Find block, containing the given point inside its volume or on boundary.
12863 theCompound Compound, to find block in.
12864 thePoint Point, close to the desired block. If the point lays on
12865 boundary between some blocks, we return block with nearest center.
12866 theName Object name; when specified, this parameter is used
12867 for result publication in the study. Otherwise, if automatic
12868 publication is switched on, default value is used for result name.
12871 New GEOM.GEOM_Object, containing the found block.
12873 # Example: see GEOM_Spanner.py
12874 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
12875 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
12876 self._autoPublish(anObj, theName, "block")
12879 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
12880 # @param theCompound Compound, to find block in.
12881 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
12882 # @param theName Object name; when specified, this parameter is used
12883 # for result publication in the study. Otherwise, if automatic
12884 # publication is switched on, default value is used for result name.
12886 # @return New GEOM.GEOM_Object, containing the found block.
12888 # @ref swig_GetBlockByParts "Example"
12889 @ManageTransactions("BlocksOp")
12890 def GetBlockByParts(self, theCompound, theParts, theName=None):
12892 Find block, containing all the elements, passed as the parts, or maximum quantity of them.
12895 theCompound Compound, to find block in.
12896 theParts List of faces and/or edges and/or vertices to be parts of the found block.
12897 theName Object name; when specified, this parameter is used
12898 for result publication in the study. Otherwise, if automatic
12899 publication is switched on, default value is used for result name.
12902 New GEOM_Object, containing the found block.
12904 # Example: see GEOM_TestOthers.py
12905 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
12906 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
12907 self._autoPublish(anObj, theName, "block")
12910 ## Return all blocks, containing all the elements, passed as the parts.
12911 # @param theCompound Compound, to find blocks in.
12912 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
12913 # @param theName Object name; when specified, this parameter is used
12914 # for result publication in the study. Otherwise, if automatic
12915 # publication is switched on, default value is used for result name.
12917 # @return List of GEOM.GEOM_Object, containing the found blocks.
12919 # @ref swig_todo "Example"
12920 @ManageTransactions("BlocksOp")
12921 def GetBlocksByParts(self, theCompound, theParts, theName=None):
12923 Return all blocks, containing all the elements, passed as the parts.
12926 theCompound Compound, to find blocks in.
12927 theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
12928 theName Object name; when specified, this parameter is used
12929 for result publication in the study. Otherwise, if automatic
12930 publication is switched on, default value is used for result name.
12933 List of GEOM.GEOM_Object, containing the found blocks.
12935 # Example: see GEOM_Spanner.py
12936 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
12937 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
12938 self._autoPublish(aList, theName, "block")
12941 ## Multi-transformate block and glue the result.
12942 # Transformation is defined so, as to superpose direction faces.
12943 # @param Block Hexahedral solid to be multi-transformed.
12944 # @param DirFace1 ID of First direction face.
12945 # @param DirFace2 ID of Second direction face.
12946 # @param NbTimes Quantity of transformations to be done.
12947 # @param theName Object name; when specified, this parameter is used
12948 # for result publication in the study. Otherwise, if automatic
12949 # publication is switched on, default value is used for result name.
12951 # @note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
12953 # @return New GEOM.GEOM_Object, containing the result shape.
12955 # @ref tui_multi_transformation "Example"
12956 @ManageTransactions("BlocksOp")
12957 def MakeMultiTransformation1D(self, Block, DirFace1, DirFace2, NbTimes, theName=None):
12959 Multi-transformate block and glue the result.
12960 Transformation is defined so, as to superpose direction faces.
12963 Block Hexahedral solid to be multi-transformed.
12964 DirFace1 ID of First direction face.
12965 DirFace2 ID of Second direction face.
12966 NbTimes Quantity of transformations to be done.
12967 theName Object name; when specified, this parameter is used
12968 for result publication in the study. Otherwise, if automatic
12969 publication is switched on, default value is used for result name.
12972 Unique ID of sub-shape can be obtained, using method GetSubShapeID().
12975 New GEOM.GEOM_Object, containing the result shape.
12977 # Example: see GEOM_Spanner.py
12978 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
12979 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
12980 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
12981 anObj.SetParameters(Parameters)
12982 self._autoPublish(anObj, theName, "transformed")
12985 ## Multi-transformate block and glue the result.
12986 # @param Block Hexahedral solid to be multi-transformed.
12987 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
12988 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
12989 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
12990 # @param theName Object name; when specified, this parameter is used
12991 # for result publication in the study. Otherwise, if automatic
12992 # publication is switched on, default value is used for result name.
12994 # @return New GEOM.GEOM_Object, containing the result shape.
12996 # @ref tui_multi_transformation "Example"
12997 @ManageTransactions("BlocksOp")
12998 def MakeMultiTransformation2D(self, Block, DirFace1U, DirFace2U, NbTimesU,
12999 DirFace1V, DirFace2V, NbTimesV, theName=None):
13001 Multi-transformate block and glue the result.
13004 Block Hexahedral solid to be multi-transformed.
13005 DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
13006 DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
13007 NbTimesU,NbTimesV Quantity of transformations to be done.
13008 theName Object name; when specified, this parameter is used
13009 for result publication in the study. Otherwise, if automatic
13010 publication is switched on, default value is used for result name.
13013 New GEOM.GEOM_Object, containing the result shape.
13015 # Example: see GEOM_Spanner.py
13016 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
13017 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
13018 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
13019 DirFace1V, DirFace2V, NbTimesV)
13020 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
13021 anObj.SetParameters(Parameters)
13022 self._autoPublish(anObj, theName, "transformed")
13025 ## Build all possible propagation groups.
13026 # Propagation group is a set of all edges, opposite to one (main)
13027 # edge of this group directly or through other opposite edges.
13028 # Notion of Opposite Edge make sense only on quadrangle face.
13029 # @param theShape Shape to build propagation groups on.
13030 # @param theName Object name; when specified, this parameter is used
13031 # for result publication in the study. Otherwise, if automatic
13032 # publication is switched on, default value is used for result name.
13034 # @return List of GEOM.GEOM_Object, each of them is a propagation group.
13036 # @ref swig_Propagate "Example"
13037 @ManageTransactions("BlocksOp")
13038 def Propagate(self, theShape, theName=None):
13040 Build all possible propagation groups.
13041 Propagation group is a set of all edges, opposite to one (main)
13042 edge of this group directly or through other opposite edges.
13043 Notion of Opposite Edge make sense only on quadrangle face.
13046 theShape Shape to build propagation groups on.
13047 theName Object name; when specified, this parameter is used
13048 for result publication in the study. Otherwise, if automatic
13049 publication is switched on, default value is used for result name.
13052 List of GEOM.GEOM_Object, each of them is a propagation group.
13054 # Example: see GEOM_TestOthers.py
13055 listChains = self.BlocksOp.Propagate(theShape)
13056 RaiseIfFailed("Propagate", self.BlocksOp)
13057 self._autoPublish(listChains, theName, "propagate")
13060 # end of l3_blocks_op
13063 ## @addtogroup l3_groups
13066 ## Creates a new group which will store sub-shapes of theMainShape
13067 # @param theMainShape is a GEOM object on which the group is selected
13068 # @param theShapeType defines a shape type of the group (see GEOM::shape_type)
13069 # @param theName Object name; when specified, this parameter is used
13070 # for result publication in the study. Otherwise, if automatic
13071 # publication is switched on, default value is used for result name.
13073 # @return a newly created GEOM group (GEOM.GEOM_Object)
13075 # @ref tui_working_with_groups_page "Example 1"
13076 # \n @ref swig_CreateGroup "Example 2"
13077 @ManageTransactions("GroupOp")
13078 def CreateGroup(self, theMainShape, theShapeType, theName=None):
13080 Creates a new group which will store sub-shapes of theMainShape
13083 theMainShape is a GEOM object on which the group is selected
13084 theShapeType defines a shape type of the group:"COMPOUND", "COMPSOLID",
13085 "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX", "SHAPE".
13086 theName Object name; when specified, this parameter is used
13087 for result publication in the study. Otherwise, if automatic
13088 publication is switched on, default value is used for result name.
13091 a newly created GEOM group
13094 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
13097 # Example: see GEOM_TestOthers.py
13098 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
13099 RaiseIfFailed("CreateGroup", self.GroupOp)
13100 self._autoPublish(anObj, theName, "group")
13103 ## Adds a sub-object with ID theSubShapeId to the group
13104 # @param theGroup is a GEOM group to which the new sub-shape is added
13105 # @param theSubShapeID is a sub-shape ID in the main object.
13106 # \note Use method GetSubShapeID() to get an unique ID of the sub-shape
13108 # @ref tui_working_with_groups_page "Example"
13109 @ManageTransactions("GroupOp")
13110 def AddObject(self,theGroup, theSubShapeID):
13112 Adds a sub-object with ID theSubShapeId to the group
13115 theGroup is a GEOM group to which the new sub-shape is added
13116 theSubShapeID is a sub-shape ID in the main object.
13119 Use method GetSubShapeID() to get an unique ID of the sub-shape
13121 # Example: see GEOM_TestOthers.py
13122 self.GroupOp.AddObject(theGroup, theSubShapeID)
13123 if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT":
13124 RaiseIfFailed("AddObject", self.GroupOp)
13128 ## Removes a sub-object with ID \a theSubShapeId from the group
13129 # @param theGroup is a GEOM group from which the new sub-shape is removed
13130 # @param theSubShapeID is a sub-shape ID in the main object.
13131 # \note Use method GetSubShapeID() to get an unique ID of the sub-shape
13133 # @ref tui_working_with_groups_page "Example"
13134 @ManageTransactions("GroupOp")
13135 def RemoveObject(self,theGroup, theSubShapeID):
13137 Removes a sub-object with ID theSubShapeId from the group
13140 theGroup is a GEOM group from which the new sub-shape is removed
13141 theSubShapeID is a sub-shape ID in the main object.
13144 Use method GetSubShapeID() to get an unique ID of the sub-shape
13146 # Example: see GEOM_TestOthers.py
13147 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
13148 RaiseIfFailed("RemoveObject", self.GroupOp)
13151 ## Adds to the group all the given shapes. No errors, if some shapes are already included.
13152 # @param theGroup is a GEOM group to which the new sub-shapes are added.
13153 # @param theSubShapes is a list of sub-shapes to be added.
13155 # @ref tui_working_with_groups_page "Example"
13156 @ManageTransactions("GroupOp")
13157 def UnionList (self,theGroup, theSubShapes):
13159 Adds to the group all the given shapes. No errors, if some shapes are already included.
13162 theGroup is a GEOM group to which the new sub-shapes are added.
13163 theSubShapes is a list of sub-shapes to be added.
13165 # Example: see GEOM_TestOthers.py
13166 self.GroupOp.UnionList(theGroup, theSubShapes)
13167 RaiseIfFailed("UnionList", self.GroupOp)
13170 ## Adds to the group all the given shapes. No errors, if some shapes are already included.
13171 # @param theGroup is a GEOM group to which the new sub-shapes are added.
13172 # @param theSubShapes is a list of indices of sub-shapes to be added.
13174 # @ref swig_UnionIDs "Example"
13175 @ManageTransactions("GroupOp")
13176 def UnionIDs(self,theGroup, theSubShapes):
13178 Adds to the group all the given shapes. No errors, if some shapes are already included.
13181 theGroup is a GEOM group to which the new sub-shapes are added.
13182 theSubShapes is a list of indices of sub-shapes to be added.
13184 # Example: see GEOM_TestOthers.py
13185 self.GroupOp.UnionIDs(theGroup, theSubShapes)
13186 RaiseIfFailed("UnionIDs", self.GroupOp)
13189 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
13190 # @param theGroup is a GEOM group from which the sub-shapes are removed.
13191 # @param theSubShapes is a list of sub-shapes to be removed.
13193 # @ref tui_working_with_groups_page "Example"
13194 @ManageTransactions("GroupOp")
13195 def DifferenceList (self,theGroup, theSubShapes):
13197 Removes from the group all the given shapes. No errors, if some shapes are not included.
13200 theGroup is a GEOM group from which the sub-shapes are removed.
13201 theSubShapes is a list of sub-shapes to be removed.
13203 # Example: see GEOM_TestOthers.py
13204 self.GroupOp.DifferenceList(theGroup, theSubShapes)
13205 RaiseIfFailed("DifferenceList", self.GroupOp)
13208 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
13209 # @param theGroup is a GEOM group from which the sub-shapes are removed.
13210 # @param theSubShapes is a list of indices of sub-shapes to be removed.
13212 # @ref swig_DifferenceIDs "Example"
13213 @ManageTransactions("GroupOp")
13214 def DifferenceIDs(self,theGroup, theSubShapes):
13216 Removes from the group all the given shapes. No errors, if some shapes are not included.
13219 theGroup is a GEOM group from which the sub-shapes are removed.
13220 theSubShapes is a list of indices of sub-shapes to be removed.
13222 # Example: see GEOM_TestOthers.py
13223 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
13224 RaiseIfFailed("DifferenceIDs", self.GroupOp)
13227 ## Union of two groups.
13228 # New group is created. It will contain all entities
13229 # which are present in groups theGroup1 and theGroup2.
13230 # @param theGroup1, theGroup2 are the initial GEOM groups
13231 # to create the united group from.
13232 # @param theName Object name; when specified, this parameter is used
13233 # for result publication in the study. Otherwise, if automatic
13234 # publication is switched on, default value is used for result name.
13236 # @return a newly created GEOM group.
13238 # @ref tui_union_groups_anchor "Example"
13239 @ManageTransactions("GroupOp")
13240 def UnionGroups (self, theGroup1, theGroup2, theName=None):
13242 Union of two groups.
13243 New group is created. It will contain all entities
13244 which are present in groups theGroup1 and theGroup2.
13247 theGroup1, theGroup2 are the initial GEOM groups
13248 to create the united group from.
13249 theName Object name; when specified, this parameter is used
13250 for result publication in the study. Otherwise, if automatic
13251 publication is switched on, default value is used for result name.
13254 a newly created GEOM group.
13256 # Example: see GEOM_TestOthers.py
13257 aGroup = self.GroupOp.UnionGroups(theGroup1, theGroup2)
13258 RaiseIfFailed("UnionGroups", self.GroupOp)
13259 self._autoPublish(aGroup, theName, "group")
13262 ## Intersection of two groups.
13263 # New group is created. It will contain only those entities
13264 # which are present in both groups theGroup1 and theGroup2.
13265 # @param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
13266 # @param theName Object name; when specified, this parameter is used
13267 # for result publication in the study. Otherwise, if automatic
13268 # publication is switched on, default value is used for result name.
13270 # @return a newly created GEOM group.
13272 # @ref tui_intersect_groups_anchor "Example"
13273 @ManageTransactions("GroupOp")
13274 def IntersectGroups (self, theGroup1, theGroup2, theName=None):
13276 Intersection of two groups.
13277 New group is created. It will contain only those entities
13278 which are present in both groups theGroup1 and theGroup2.
13281 theGroup1, theGroup2 are the initial GEOM groups to get common part of.
13282 theName Object name; when specified, this parameter is used
13283 for result publication in the study. Otherwise, if automatic
13284 publication is switched on, default value is used for result name.
13287 a newly created GEOM group.
13289 # Example: see GEOM_TestOthers.py
13290 aGroup = self.GroupOp.IntersectGroups(theGroup1, theGroup2)
13291 RaiseIfFailed("IntersectGroups", self.GroupOp)
13292 self._autoPublish(aGroup, theName, "group")
13295 ## Cut of two groups.
13296 # New group is created. It will contain entities which are
13297 # present in group theGroup1 but are not present in group theGroup2.
13298 # @param theGroup1 is a GEOM group to include elements of.
13299 # @param theGroup2 is a GEOM group to exclude elements of.
13300 # @param theName Object name; when specified, this parameter is used
13301 # for result publication in the study. Otherwise, if automatic
13302 # publication is switched on, default value is used for result name.
13304 # @return a newly created GEOM group.
13306 # @ref tui_cut_groups_anchor "Example"
13307 @ManageTransactions("GroupOp")
13308 def CutGroups (self, theGroup1, theGroup2, theName=None):
13311 New group is created. It will contain entities which are
13312 present in group theGroup1 but are not present in group theGroup2.
13315 theGroup1 is a GEOM group to include elements of.
13316 theGroup2 is a GEOM group to exclude elements of.
13317 theName Object name; when specified, this parameter is used
13318 for result publication in the study. Otherwise, if automatic
13319 publication is switched on, default value is used for result name.
13322 a newly created GEOM group.
13324 # Example: see GEOM_TestOthers.py
13325 aGroup = self.GroupOp.CutGroups(theGroup1, theGroup2)
13326 RaiseIfFailed("CutGroups", self.GroupOp)
13327 self._autoPublish(aGroup, theName, "group")
13330 ## Union of list of groups.
13331 # New group is created. It will contain all entities that are
13332 # present in groups listed in theGList.
13333 # @param theGList is a list of GEOM groups to create the united group from.
13334 # @param theName Object name; when specified, this parameter is used
13335 # for result publication in the study. Otherwise, if automatic
13336 # publication is switched on, default value is used for result name.
13338 # @return a newly created GEOM group.
13340 # @ref tui_union_groups_anchor "Example"
13341 @ManageTransactions("GroupOp")
13342 def UnionListOfGroups (self, theGList, theName=None):
13344 Union of list of groups.
13345 New group is created. It will contain all entities that are
13346 present in groups listed in theGList.
13349 theGList is a list of GEOM groups to create the united group from.
13350 theName Object name; when specified, this parameter is used
13351 for result publication in the study. Otherwise, if automatic
13352 publication is switched on, default value is used for result name.
13355 a newly created GEOM group.
13357 # Example: see GEOM_TestOthers.py
13358 aGroup = self.GroupOp.UnionListOfGroups(theGList)
13359 RaiseIfFailed("UnionListOfGroups", self.GroupOp)
13360 self._autoPublish(aGroup, theName, "group")
13363 ## Cut of lists of groups.
13364 # New group is created. It will contain only entities
13365 # which are present in groups listed in theGList.
13366 # @param theGList is a list of GEOM groups to include elements of.
13367 # @param theName Object name; when specified, this parameter is used
13368 # for result publication in the study. Otherwise, if automatic
13369 # publication is switched on, default value is used for result name.
13371 # @return a newly created GEOM group.
13373 # @ref tui_intersect_groups_anchor "Example"
13374 @ManageTransactions("GroupOp")
13375 def IntersectListOfGroups (self, theGList, theName=None):
13377 Cut of lists of groups.
13378 New group is created. It will contain only entities
13379 which are present in groups listed in theGList.
13382 theGList is a list of GEOM groups to include elements of.
13383 theName Object name; when specified, this parameter is used
13384 for result publication in the study. Otherwise, if automatic
13385 publication is switched on, default value is used for result name.
13388 a newly created GEOM group.
13390 # Example: see GEOM_TestOthers.py
13391 aGroup = self.GroupOp.IntersectListOfGroups(theGList)
13392 RaiseIfFailed("IntersectListOfGroups", self.GroupOp)
13393 self._autoPublish(aGroup, theName, "group")
13396 ## Cut of lists of groups.
13397 # New group is created. It will contain only entities
13398 # which are present in groups listed in theGList1 but
13399 # are not present in groups from theGList2.
13400 # @param theGList1 is a list of GEOM groups to include elements of.
13401 # @param theGList2 is a list of GEOM groups to exclude elements of.
13402 # @param theName Object name; when specified, this parameter is used
13403 # for result publication in the study. Otherwise, if automatic
13404 # publication is switched on, default value is used for result name.
13406 # @return a newly created GEOM group.
13408 # @ref tui_cut_groups_anchor "Example"
13409 @ManageTransactions("GroupOp")
13410 def CutListOfGroups (self, theGList1, theGList2, theName=None):
13412 Cut of lists of groups.
13413 New group is created. It will contain only entities
13414 which are present in groups listed in theGList1 but
13415 are not present in groups from theGList2.
13418 theGList1 is a list of GEOM groups to include elements of.
13419 theGList2 is a list of GEOM groups to exclude elements of.
13420 theName Object name; when specified, this parameter is used
13421 for result publication in the study. Otherwise, if automatic
13422 publication is switched on, default value is used for result name.
13425 a newly created GEOM group.
13427 # Example: see GEOM_TestOthers.py
13428 aGroup = self.GroupOp.CutListOfGroups(theGList1, theGList2)
13429 RaiseIfFailed("CutListOfGroups", self.GroupOp)
13430 self._autoPublish(aGroup, theName, "group")
13433 ## Returns a list of sub-objects ID stored in the group
13434 # @param theGroup is a GEOM group for which a list of IDs is requested
13436 # @ref swig_GetObjectIDs "Example"
13437 @ManageTransactions("GroupOp")
13438 def GetObjectIDs(self,theGroup):
13440 Returns a list of sub-objects ID stored in the group
13443 theGroup is a GEOM group for which a list of IDs is requested
13445 # Example: see GEOM_TestOthers.py
13446 ListIDs = self.GroupOp.GetObjects(theGroup)
13447 RaiseIfFailed("GetObjects", self.GroupOp)
13450 ## Returns a type of sub-objects stored in the group
13451 # @param theGroup is a GEOM group which type is returned.
13453 # @ref swig_GetType "Example"
13454 @ManageTransactions("GroupOp")
13455 def GetType(self,theGroup):
13457 Returns a type of sub-objects stored in the group
13460 theGroup is a GEOM group which type is returned.
13462 # Example: see GEOM_TestOthers.py
13463 aType = self.GroupOp.GetType(theGroup)
13464 RaiseIfFailed("GetType", self.GroupOp)
13467 ## Convert a type of geom object from id to string value
13468 # @param theId is a GEOM object type id.
13469 # @return type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
13470 # @ref swig_GetType "Example"
13471 def ShapeIdToType(self, theId):
13473 Convert a type of geom object from id to string value
13476 theId is a GEOM object type id.
13479 type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
13506 return "REVOLUTION"
13554 return "FREE_BOUNDS"
13562 return "THRUSECTIONS"
13564 return "COMPOUNDFILTER"
13566 return "SHAPES_ON_SHAPE"
13568 return "ELLIPSE_ARC"
13570 return "3DSKETCHER"
13576 return "PIPETSHAPE"
13577 return "Shape Id not exist."
13579 ## Returns a main shape associated with the group
13580 # @param theGroup is a GEOM group for which a main shape object is requested
13581 # @return a GEOM object which is a main shape for theGroup
13583 # @ref swig_GetMainShape "Example"
13584 @ManageTransactions("GroupOp")
13585 def GetMainShape(self,theGroup):
13587 Returns a main shape associated with the group
13590 theGroup is a GEOM group for which a main shape object is requested
13593 a GEOM object which is a main shape for theGroup
13595 Example of usage: BoxCopy = geompy.GetMainShape(CreateGroup)
13597 # Example: see GEOM_TestOthers.py
13598 anObj = self.GroupOp.GetMainShape(theGroup)
13599 RaiseIfFailed("GetMainShape", self.GroupOp)
13602 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
13603 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
13604 # @param theShape given shape (see GEOM.GEOM_Object)
13605 # @param min_length minimum length of edges of theShape
13606 # @param max_length maximum length of edges of theShape
13607 # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13608 # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13609 # @param theName Object name; when specified, this parameter is used
13610 # for result publication in the study. Otherwise, if automatic
13611 # publication is switched on, default value is used for result name.
13613 # @return a newly created GEOM group of edges
13615 # @@ref swig_todo "Example"
13616 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1, theName=None):
13618 Create group of edges of theShape, whose length is in range [min_length, max_length].
13619 If include_min/max == 0, edges with length == min/max_length will not be included in result.
13622 theShape given shape
13623 min_length minimum length of edges of theShape
13624 max_length maximum length of edges of theShape
13625 include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13626 include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13627 theName Object name; when specified, this parameter is used
13628 for result publication in the study. Otherwise, if automatic
13629 publication is switched on, default value is used for result name.
13632 a newly created GEOM group of edges.
13634 edges = self.SubShapeAll(theShape, self.ShapeType["EDGE"])
13635 edges_in_range = []
13637 Props = self.BasicProperties(edge)
13638 if min_length <= Props[0] and Props[0] <= max_length:
13639 if (not include_min) and (min_length == Props[0]):
13642 if (not include_max) and (Props[0] == max_length):
13645 edges_in_range.append(edge)
13647 if len(edges_in_range) <= 0:
13648 print("No edges found by given criteria")
13651 # note: auto-publishing is done in self.CreateGroup()
13652 group_edges = self.CreateGroup(theShape, self.ShapeType["EDGE"], theName)
13653 self.UnionList(group_edges, edges_in_range)
13657 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
13658 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
13659 # @param min_length minimum length of edges of selected shape
13660 # @param max_length maximum length of edges of selected shape
13661 # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13662 # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13663 # @return a newly created GEOM group of edges
13664 # @ref swig_todo "Example"
13665 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
13667 Create group of edges of selected shape, whose length is in range [min_length, max_length].
13668 If include_min/max == 0, edges with length == min/max_length will not be included in result.
13671 min_length minimum length of edges of selected shape
13672 max_length maximum length of edges of selected shape
13673 include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13674 include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13677 a newly created GEOM group of edges.
13679 nb_selected = sg.SelectedCount()
13680 if nb_selected < 1:
13681 print("Select a shape before calling this function, please.")
13683 if nb_selected > 1:
13684 print("Only one shape must be selected")
13687 id_shape = sg.getSelected(0)
13688 shape = IDToObject( id_shape )
13690 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
13694 if include_min: left_str = " <= "
13695 if include_max: right_str = " <= "
13697 self.addToStudyInFather(shape, group_edges, "Group of edges with " + repr(min_length)
13698 + left_str + "length" + right_str + repr(max_length))
13700 sg.updateObjBrowser()
13707 #@@ insert new functions before this line @@ do not remove this line @@#
13709 ## Create a copy of the given object
13711 # @param theOriginal geometry object for copy
13712 # @param theName Object name; when specified, this parameter is used
13713 # for result publication in the study. Otherwise, if automatic
13714 # publication is switched on, default value is used for result name.
13716 # @return New GEOM_Object, containing the copied shape.
13718 # @ingroup l1_geomBuilder_auxiliary
13719 # @ref swig_MakeCopy "Example"
13720 @ManageTransactions("InsertOp")
13721 def MakeCopy(self, theOriginal, theName=None):
13723 Create a copy of the given object
13726 theOriginal geometry object for copy
13727 theName Object name; when specified, this parameter is used
13728 for result publication in the study. Otherwise, if automatic
13729 publication is switched on, default value is used for result name.
13732 New GEOM_Object, containing the copied shape.
13734 Example of usage: Copy = geompy.MakeCopy(Box)
13736 # Example: see GEOM_TestAll.py
13737 anObj = self.InsertOp.MakeCopy(theOriginal)
13738 RaiseIfFailed("MakeCopy", self.InsertOp)
13739 self._autoPublish(anObj, theName, "copy")
13742 ## Add Path to load python scripts from
13743 # @param Path a path to load python scripts from
13744 # @ingroup l1_geomBuilder_auxiliary
13745 def addPath(self,Path):
13747 Add Path to load python scripts from
13750 Path a path to load python scripts from
13752 if (sys.path.count(Path) < 1):
13753 sys.path.append(Path)
13757 ## Load marker texture from the file
13758 # @param Path a path to the texture file
13759 # @return unique texture identifier
13760 # @ingroup l1_geomBuilder_auxiliary
13761 @ManageTransactions("InsertOp")
13762 def LoadTexture(self, Path):
13764 Load marker texture from the file
13767 Path a path to the texture file
13770 unique texture identifier
13772 # Example: see GEOM_TestAll.py
13773 ID = self.InsertOp.LoadTexture(Path)
13774 RaiseIfFailed("LoadTexture", self.InsertOp)
13777 ## Get internal name of the object based on its study entry
13778 # @note This method does not provide an unique identifier of the geometry object.
13779 # @note This is internal function of GEOM component, though it can be used outside it for
13780 # appropriate reason (e.g. for identification of geometry object).
13781 # @param obj geometry object
13782 # @return unique object identifier
13783 # @ingroup l1_geomBuilder_auxiliary
13784 def getObjectID(self, obj):
13786 Get internal name of the object based on its study entry.
13787 Note: this method does not provide an unique identifier of the geometry object.
13788 It is an internal function of GEOM component, though it can be used outside GEOM for
13789 appropriate reason (e.g. for identification of geometry object).
13792 obj geometry object
13795 unique object identifier
13798 entry = salome.ObjectToID(obj)
13799 if entry is not None:
13800 lst = entry.split(":")
13802 ID = lst[-1] # -1 means last item in the list
13803 return "GEOM_" + ID
13808 ## Add marker texture. @a Width and @a Height parameters
13809 # specify width and height of the texture in pixels.
13810 # If @a RowData is @c True, @a Texture parameter should represent texture data
13811 # packed into the byte array. If @a RowData is @c False (default), @a Texture
13812 # parameter should be unpacked string, in which '1' symbols represent opaque
13813 # pixels and '0' represent transparent pixels of the texture bitmap.
13815 # @param Width texture width in pixels
13816 # @param Height texture height in pixels
13817 # @param Texture texture data
13818 # @param RowData if @c True, @a Texture data are packed in the byte stream
13819 # @return unique texture identifier
13820 # @ingroup l1_geomBuilder_auxiliary
13821 @ManageTransactions("InsertOp")
13822 def AddTexture(self, Width, Height, Texture, RowData=False):
13824 Add marker texture. Width and Height parameters
13825 specify width and height of the texture in pixels.
13826 If RowData is True, Texture parameter should represent texture data
13827 packed into the byte array. If RowData is False (default), Texture
13828 parameter should be unpacked string, in which '1' symbols represent opaque
13829 pixels and '0' represent transparent pixels of the texture bitmap.
13832 Width texture width in pixels
13833 Height texture height in pixels
13834 Texture texture data
13835 RowData if True, Texture data are packed in the byte stream
13838 return unique texture identifier
13840 if not RowData: Texture = PackData(Texture)
13841 ID = self.InsertOp.AddTexture(Width, Height, Texture)
13842 RaiseIfFailed("AddTexture", self.InsertOp)
13845 ## Transfer not topological data from one GEOM object to another.
13847 # @param theObjectFrom the source object of non-topological data
13848 # @param theObjectTo the destination object of non-topological data
13849 # @param theFindMethod method to search sub-shapes of theObjectFrom
13850 # in shape theObjectTo. Possible values are: GEOM.FSM_GetInPlace,
13851 # GEOM.FSM_GetInPlaceByHistory and GEOM.FSM_GetInPlace_Old.
13852 # Other values of GEOM.find_shape_method are not supported.
13854 # @return True in case of success; False otherwise.
13856 # @ingroup l1_geomBuilder_auxiliary
13858 # @ref swig_TransferData "Example"
13859 @ManageTransactions("InsertOp")
13860 def TransferData(self, theObjectFrom, theObjectTo,
13861 theFindMethod=GEOM.FSM_GetInPlace):
13863 Transfer not topological data from one GEOM object to another.
13866 theObjectFrom the source object of non-topological data
13867 theObjectTo the destination object of non-topological data
13868 theFindMethod method to search sub-shapes of theObjectFrom
13869 in shape theObjectTo. Possible values are:
13870 GEOM.FSM_GetInPlace, GEOM.FSM_GetInPlaceByHistory
13871 and GEOM.FSM_GetInPlace_Old. Other values of
13872 GEOM.find_shape_method are not supported.
13875 True in case of success; False otherwise.
13877 # Example: see GEOM_TestOthers.py
13879 # Example: see GEOM_TestAll.py
13880 isOk = self.InsertOp.TransferData(theObjectFrom,
13881 theObjectTo, theFindMethod)
13882 RaiseIfFailed("TransferData", self.InsertOp)
13885 ## Creates a new folder object. It is a container for any GEOM objects.
13886 # @param Name name of the container
13887 # @param Father parent object. If None,
13888 # folder under 'Geometry' root object will be created.
13889 # @return a new created folder
13890 # @ingroup l1_publish_data
13891 def NewFolder(self, Name, Father=None):
13893 Create a new folder object. It is an auxiliary container for any GEOM objects.
13896 Name name of the container
13897 Father parent object. If None,
13898 folder under 'Geometry' root object will be created.
13901 a new created folder
13903 return self.CreateFolder(Name, Father)
13905 ## Move object to the specified folder
13906 # @param Object object to move
13907 # @param Folder target folder
13908 # @ingroup l1_publish_data
13909 def PutToFolder(self, Object, Folder):
13911 Move object to the specified folder
13914 Object object to move
13915 Folder target folder
13917 self.MoveToFolder(Object, Folder)
13920 ## Move list of objects to the specified folder
13921 # @param ListOfSO list of objects to move
13922 # @param Folder target folder
13923 # @ingroup l1_publish_data
13924 def PutListToFolder(self, ListOfSO, Folder):
13926 Move list of objects to the specified folder
13929 ListOfSO list of objects to move
13930 Folder target folder
13932 self.MoveListToFolder(ListOfSO, Folder)
13935 ## @addtogroup l2_field
13939 # @param shape the shape the field lies on
13940 # @param name the field name
13941 # @param type type of field data: 0 - bool, 1 - int, 2 - double, 3 - string
13942 # @param dimension dimension of the shape the field lies on
13943 # 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
13944 # @param componentNames names of components
13945 # @return a created field
13946 @ManageTransactions("FieldOp")
13947 def CreateField(self, shape, name, type, dimension, componentNames):
13952 shape the shape the field lies on
13953 name the field name
13954 type type of field data
13955 dimension dimension of the shape the field lies on
13956 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
13957 componentNames names of components
13962 if isinstance( type, int ):
13963 if type < 0 or type > 3:
13964 raise RuntimeError("CreateField : Error: data type must be within [0-3] range")
13965 type = [GEOM.FDT_Bool,GEOM.FDT_Int,GEOM.FDT_Double,GEOM.FDT_String][type]
13967 f = self.FieldOp.CreateField( shape, name, type, dimension, componentNames)
13968 RaiseIfFailed("CreateField", self.FieldOp)
13970 geom._autoPublish( f, "", name)
13973 ## Removes a field from the GEOM component
13974 # @param field the field to remove
13975 def RemoveField(self, field):
13976 "Removes a field from the GEOM component"
13978 if isinstance( field, GEOM._objref_GEOM_Field ):
13979 geom.RemoveObject( field )
13980 elif isinstance( field, geomField ):
13981 geom.RemoveObject( field.field )
13983 raise RuntimeError("RemoveField() : the object is not a field")
13986 ## Returns number of fields on a shape
13987 @ManageTransactions("FieldOp")
13988 def CountFields(self, shape):
13989 "Returns number of fields on a shape"
13990 nb = self.FieldOp.CountFields( shape )
13991 RaiseIfFailed("CountFields", self.FieldOp)
13994 ## Returns all fields on a shape
13995 @ManageTransactions("FieldOp")
13996 def GetFields(self, shape):
13997 "Returns all fields on a shape"
13998 ff = self.FieldOp.GetFields( shape )
13999 RaiseIfFailed("GetFields", self.FieldOp)
14002 ## Returns a field on a shape by its name
14003 @ManageTransactions("FieldOp")
14004 def GetField(self, shape, name):
14005 "Returns a field on a shape by its name"
14006 f = self.FieldOp.GetField( shape, name )
14007 RaiseIfFailed("GetField", self.FieldOp)
14013 ## @addtogroup l2_testing
14016 ## Build a mesh on the given shape.
14017 # @param shape the source shape
14018 # @param linear_deflection linear deflection coefficient
14019 # @param is_relative says if given value of deflection is relative to shape's bounding box
14020 # @param angular_deflection angular deflection for edges in degrees
14021 # @return True in case of success; otherwise False.
14022 @ManageTransactions("TestOp")
14023 def Tesselate(self, shape, linear_deflection=0, is_relative=True, angular_deflection=0):
14024 """Build a mesh on the given shape.
14027 shape the source shape
14028 linear_deflection linear deflection coefficient
14029 is_relative says if given value of deflection is relative to shape's bounding box
14030 angular_deflection angular deflection for edges in degrees
14033 True in case of success; otherwise False.
14035 if angular_deflection > 0:
14036 angular_deflection = angular_deflection * math.pi / 180.
14037 r = self.TestOp.Tesselate(shape, linear_deflection, is_relative, angular_deflection)
14038 RaiseIfFailed("Tesselate", self.TestOp)
14041 ## Obtain a shape checker
14042 # @return An instance of @ref conformity.CheckConformity "CheckConformity" interface
14044 # @ref tui_conformity_page "Example"
14045 def CheckConformity (self, shape):
14047 Obtain a shape checker.
14050 conf = geompy.CheckConformity(shape)
14051 valid = conf.isValid()
14052 si2d = conf.selfIntersected2D()
14053 dist = conf.distantShapes()
14054 small = conf.smallEdges()
14055 interfer = cc.interferingSubshapes()
14057 conf = CheckConformity (shape, self)
14060 ## Obtain a shape proximity calculator
14061 # @return An instance of @ref proximity.ShapeProximity "ShapeProximity" interface
14063 # @ref tui_proximity_page "Example"
14064 def ShapeProximity (self):
14066 Obtain a shape proximity calculator.
14069 prox = geompy.ShapeProximity()
14070 value = prox.proximity(shape1, shape2)
14072 prox = ShapeProximity (self)
14075 # end of l2_testing
14079 # Register the new proxy for GEOM_Gen
14080 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geomBuilder)
14083 ## Field on Geometry
14084 # @ingroup l2_field
14085 class geomField( GEOM._objref_GEOM_Field ):
14087 def __init__(self, *args):
14088 GEOM._objref_GEOM_Field.__init__(self, *args)
14089 self.field = GEOM._objref_GEOM_Field
14092 ## Returns the shape the field lies on
14093 def getShape(self):
14094 "Returns the shape the field lies on"
14095 return self.field.GetShape(self)
14097 ## Returns the field name
14099 "Returns the field name"
14100 return self.field.GetName(self)
14102 ## Returns type of field data as integer [0-3]
14104 "Returns type of field data"
14105 return EnumToLong(self.field.GetDataType(self))
14107 ## Returns type of field data:
14108 # one of GEOM.FDT_Bool, GEOM.FDT_Int, GEOM.FDT_Double, GEOM.FDT_String
14109 def getTypeEnum(self):
14110 "Returns type of field data"
14111 return self.field.GetDataType(self)
14113 ## Returns dimension of the shape the field lies on:
14114 # 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
14115 def getDimension(self):
14116 """Returns dimension of the shape the field lies on:
14117 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape"""
14118 return self.field.GetDimension(self)
14120 ## Returns names of components
14121 def getComponents(self):
14122 "Returns names of components"
14123 return self.field.GetComponents(self)
14125 ## Adds a time step to the field
14126 # @param step the time step number further used as the step identifier
14127 # @param stamp the time step time
14128 # @param values the values of the time step
14129 def addStep(self, step, stamp, values):
14130 "Adds a time step to the field"
14131 stp = self.field.AddStep( self, step, stamp )
14133 raise RuntimeError("Field.addStep() : Error: step %s already exists in this field"%step)
14135 geom._autoPublish( stp, "", "Step %s, %s"%(step,stamp))
14136 self.setValues( step, values )
14139 ## Remove a time step from the field
14140 def removeStep(self,step):
14141 "Remove a time step from the field"
14144 stepObj = self.field.GetStep( self, step )
14146 stepSO = geom.myStudy.FindObjectID( stepObj.GetStudyEntry() )
14149 #traceback.print_exc()
14151 self.field.RemoveStep( self, step )
14153 geom.myBuilder.RemoveObjectWithChildren( stepSO )
14156 ## Returns number of time steps in the field
14157 def countSteps(self):
14158 "Returns number of time steps in the field"
14159 return self.field.CountSteps(self)
14161 ## Returns a list of time step IDs in the field
14162 def getSteps(self):
14163 "Returns a list of time step IDs in the field"
14164 return self.field.GetSteps(self)
14166 ## Returns a time step by its ID
14167 def getStep(self,step):
14168 "Returns a time step by its ID"
14169 stp = self.field.GetStep(self, step)
14171 raise RuntimeError("Step %s is missing from this field"%step)
14174 ## Returns the time of the field step
14175 def getStamp(self,step):
14176 "Returns the time of the field step"
14177 return self.getStep(step).GetStamp()
14179 ## Changes the time of the field step
14180 def setStamp(self, step, stamp):
14181 "Changes the time of the field step"
14182 return self.getStep(step).SetStamp(stamp)
14184 ## Returns values of the field step
14185 def getValues(self, step):
14186 "Returns values of the field step"
14187 return self.getStep(step).GetValues()
14189 ## Changes values of the field step
14190 def setValues(self, step, values):
14191 "Changes values of the field step"
14192 stp = self.getStep(step)
14193 errBeg = "Field.setValues(values) : Error: "
14195 ok = stp.SetValues( values )
14196 except Exception as e:
14198 if excStr.find("WrongPythonType") > 0:
14199 raise RuntimeError(errBeg +\
14200 "wrong type of values, %s values are expected"%str(self.getTypeEnum())[4:])
14201 raise RuntimeError(errBeg + str(e))
14203 nbOK = self.field.GetArraySize(self)
14206 raise RuntimeError(errBeg + "len(values) must be %s but not %s"%(nbOK,nbKO))
14208 raise RuntimeError(errBeg + "failed")
14211 pass # end of class geomField
14213 # Register the new proxy for GEOM_Field
14214 omniORB.registerObjref(GEOM._objref_GEOM_Field._NP_RepositoryId, geomField)
14217 ## Create a new geomBuilder instance.The geomBuilder class provides the Python
14218 # interface to GEOM operations.
14223 # salome.salome_init()
14224 # from salome.geom import geomBuilder
14225 # geompy = geomBuilder.New()
14227 # @param instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
14228 # @return geomBuilder instance
14229 def New( instance=None):
14231 Create a new geomBuilder instance.The geomBuilder class provides the Python
14232 interface to GEOM operations.
14236 salome.salome_init()
14237 from salome.geom import geomBuilder
14238 geompy = geomBuilder.New()
14241 instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
14243 geomBuilder instance
14245 #print "New geomBuilder ", study, instance
14249 if instance and isinstance( instance, SALOMEDS._objref_Study ):
14251 sys.stderr.write("Warning: 'study' argument is no more needed in geomBuilder.New(). Consider updating your script!!!\n\n")
14256 geom = geomBuilder()
14257 assert isinstance(geom,geomBuilder), "Geom engine class is %s but should be geomBuilder.geomBuilder. Import geomBuilder before creating the instance."%geom.__class__
14262 # Register methods from the plug-ins in the geomBuilder class
14263 plugins_var = os.environ.get( "GEOM_PluginsList" )
14266 if plugins_var is not None:
14267 plugins = plugins_var.split( ":" )
14268 plugins=[x for x in plugins if len(x)>0]
14269 if plugins is not None:
14270 for pluginName in plugins:
14271 pluginBuilderName = pluginName + "Builder"
14273 exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
14274 except Exception as e:
14275 from salome_utils import verbose
14276 print("Exception while loading %s: %s" % ( pluginBuilderName, e ))
14278 exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
14279 plugin = eval( pluginBuilderName )
14281 # add methods from plugin module to the geomBuilder class
14282 for k in dir( plugin ):
14283 if k[0] == '_': continue
14284 method = getattr( plugin, k )
14285 if type( method ).__name__ == 'function':
14286 if not hasattr( geomBuilder, k ):
14287 setattr( geomBuilder, k, method )