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
266 # In case the omniORBpy EnumItem class does not fully support Python 3
267 # (for instance in version 4.2.1-2), the comparison ordering methods must be
271 GEOM.COMPOUND < GEOM.SOLID
273 def enumitem_eq(self, other):
275 if isinstance(other, omniORB.EnumItem):
276 if other._parent_id == self._parent_id:
277 return self._v == other._v
279 return self._parent_id == other._parent_id
281 return id(self) == id(other)
283 return id(self) == id(other)
285 def enumitem_lt(self, other):
287 if isinstance(other, omniORB.EnumItem):
288 if other._parent_id == self._parent_id:
289 return self._v < other._v
291 return self._parent_id < other._parent_id
293 return id(self) < id(other)
295 return id(self) < id(other)
297 def enumitem_le(self, other):
299 if isinstance(other, omniORB.EnumItem):
300 if other._parent_id == self._parent_id:
301 return self._v <= other._v
303 return self._parent_id <= other._parent_id
305 return id(self) <= id(other)
307 return id(self) <= id(other)
309 def enumitem_gt(self, other):
311 if isinstance(other, omniORB.EnumItem):
312 if other._parent_id == self._parent_id:
313 return self._v > other._v
315 return self._parent_id > other._parent_id
317 return id(self) > id(other)
319 return id(self) > id(other)
321 def enumitem_ge(self, other):
323 if isinstance(other, omniORB.EnumItem):
324 if other._parent_id == self._parent_id:
325 return self._v >= other._v
327 return self._parent_id >= other._parent_id
329 return id(self) >= id(other)
331 return id(self) >= id(other)
333 GEOM.omniORB.EnumItem.__eq__ = enumitem_eq
334 GEOM.omniORB.EnumItem.__lt__ = enumitem_lt
335 GEOM.omniORB.EnumItem.__le__ = enumitem_le
336 GEOM.omniORB.EnumItem.__gt__ = enumitem_gt
337 GEOM.omniORB.EnumItem.__ge__ = enumitem_ge
338 omniORB.EnumItem.__eq__ = enumitem_eq
339 omniORB.EnumItem.__lt__ = enumitem_lt
340 omniORB.EnumItem.__le__ = enumitem_le
341 omniORB.EnumItem.__gt__ = enumitem_gt
342 omniORB.EnumItem.__ge__ = enumitem_ge
345 def _toListOfNames(_names, _size=-1):
348 if type(_names) in [list, tuple]:
349 for i in _names: l.append(i)
352 if l and len(l) < _size:
353 for i in range(len(l), _size): l.append("%s_%d"%(l[0],i))
356 # Decorator function to manage transactions for all geometric operations.
357 def ManageTransactions(theOpeName):
358 def MTDecorator(theFunction):
359 # To keep the original function name an documentation.
360 @functools.wraps(theFunction)
361 def OpenCallClose(self, *args, **kwargs):
363 anOperation = getattr(self, theOpeName)
364 anOperation.StartOperation()
367 res = theFunction(self, *args, **kwargs)
369 anOperation.FinishOperation()
373 anOperation.AbortOperation()
378 ## Raise an Error, containing the Method_name, if Operation is Failed
379 ## @ingroup l1_geomBuilder_auxiliary
380 def RaiseIfFailed (Method_name, Operation):
381 if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
382 raise RuntimeError(Method_name + " : " + Operation.GetErrorCode())
384 def PrintOrRaise(message, raiseException=False):
386 raise RuntimeError(message)
390 ## Return list of variables value from salome notebook
391 ## @ingroup l1_geomBuilder_auxiliary
392 def ParseParameters(*parameters):
395 for parameter in parameters:
396 if isinstance(parameter, list):
397 lResults = ParseParameters(*parameter)
398 if len(lResults) > 0:
399 Result.append(lResults[:-1])
400 StringResult += lResults[-1].split(":")
404 if isinstance(parameter,str):
405 if notebook.isVariable(parameter):
406 Result.append(notebook.get(parameter))
408 raise RuntimeError("Variable with name '" + parameter + "' doesn't exist!!!")
411 Result.append(parameter)
413 StringResult.append(str(parameter))
417 Result.append(":".join(StringResult))
419 Result = ":".join(StringResult)
422 ## Return list of variables value from salome notebook
423 ## @ingroup l1_geomBuilder_auxiliary
427 for parameter in list:
428 if isinstance(parameter,str) and notebook.isVariable(parameter):
429 Result.append(str(notebook.get(parameter)))
432 Result.append(str(parameter))
435 StringResult = StringResult + str(parameter)
436 StringResult = StringResult + ":"
438 StringResult = StringResult[:len(StringResult)-1]
439 return Result, StringResult
441 ## Return list of variables value from salome notebook
442 ## @ingroup l1_geomBuilder_auxiliary
443 def ParseSketcherCommand(command):
446 sections = command.split(":")
447 for section in sections:
448 parameters = section.split(" ")
450 for parameter in parameters:
451 if paramIndex > 1 and parameter.find("'") != -1:
452 parameter = parameter.replace("'","")
453 if notebook.isVariable(parameter):
454 Result = Result + str(notebook.get(parameter)) + " "
457 raise RuntimeError("Variable with name '" + parameter + "' doesn't exist!!!")
461 Result = Result + str(parameter) + " "
464 StringResult = StringResult + parameter
465 StringResult = StringResult + ":"
467 paramIndex = paramIndex + 1
469 Result = Result[:len(Result)-1] + ":"
471 Result = Result[:len(Result)-1]
472 return Result, StringResult
474 ## Helper function which can be used to pack the passed string to the byte data.
475 ## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
476 ## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
479 ## val = PackData("10001110") # val = 0xAE
480 ## val = PackData("1") # val = 0x80
482 ## @param data unpacked data - a string containing '1' and '0' symbols
483 ## @return data packed to the byte stream
484 ## @ingroup l1_geomBuilder_auxiliary
487 Helper function which can be used to pack the passed string to the byte data.
488 Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
489 If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
492 data unpacked data - a string containing '1' and '0' symbols
495 data packed to the byte stream
498 val = PackData("10001110") # val = 0xAE
499 val = PackData("1") # val = 0x80
502 if len(data)%8: bytes += 1
504 for b in range(bytes):
505 d = data[b*8:(b+1)*8]
510 if d[i] == "1": val += 1
512 raise "Invalid symbol %s" % d[i]
519 ## Read bitmap texture from the text file.
520 ## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
521 ## A zero symbol ('0') represents transparent pixel of the texture bitmap.
522 ## The function returns width and height of the pixmap in pixels and byte stream representing
523 ## texture bitmap itself.
525 ## This function can be used to read the texture to the byte stream in order to pass it to
526 ## the AddTexture() function of geomBuilder class.
529 ## from salome.geom import geomBuilder
530 ## geompy = geomBuilder.New()
531 ## texture = geompy.readtexture('mytexture.dat')
532 ## texture = geompy.AddTexture(*texture)
533 ## obj.SetMarkerTexture(texture)
535 ## @param fname texture file name
536 ## @return sequence of tree values: texture's width, height in pixels and its byte stream
537 ## @ingroup l1_geomBuilder_auxiliary
538 def ReadTexture(fname):
540 Read bitmap texture from the text file.
541 In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
542 A zero symbol ('0') represents transparent pixel of the texture bitmap.
543 The function returns width and height of the pixmap in pixels and byte stream representing
544 texture bitmap itself.
545 This function can be used to read the texture to the byte stream in order to pass it to
546 the AddTexture() function of geomBuilder class.
549 fname texture file name
552 sequence of tree values: texture's width, height in pixels and its byte stream
555 from salome.geom import geomBuilder
556 geompy = geomBuilder.New()
557 texture = geompy.readtexture('mytexture.dat')
558 texture = geompy.AddTexture(*texture)
559 obj.SetMarkerTexture(texture)
563 lines = [ l.strip() for l in f.readlines()]
566 if lines: maxlen = max([len(x) for x in lines])
568 if maxlen%8: lenbytes += 1
572 lenline = (len(line)/8+1)*8
575 lenline = (len(line)/8)*8
577 for i in range(lenline/8):
580 if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
583 bytedata += PackData(byte)
585 for i in range(lenline/8, lenbytes):
586 bytedata += PackData("0")
588 return lenbytes*8, len(lines), bytedata
593 ## Returns a long value from enumeration type
594 # Can be used for CORBA enumerator types like GEOM.shape_type
595 # @param theItem enumeration type
596 # @ingroup l1_geomBuilder_auxiliary
597 def EnumToLong(theItem):
599 Returns a long value from enumeration type
600 Can be used for CORBA enumerator types like geomBuilder.ShapeType
603 theItem enumeration type
606 if hasattr(theItem, "_v"): ret = theItem._v
609 ## Pack an argument into a list
611 if isinstance( arg, list ):
613 if hasattr( arg, "__getitem__" ):
617 ## Information about closed/unclosed state of shell or wire
618 # @ingroup l1_geomBuilder_auxiliary
621 Information about closed/unclosed state of shell or wire
627 ## Private class used to bind calls of plugin operations to geomBuilder
628 class PluginOperation:
629 def __init__(self, operation, function):
630 self.operation = operation
631 self.function = function
634 @ManageTransactions("operation")
635 def __call__(self, *args):
636 res = self.function(self.operation, *args)
637 RaiseIfFailed(self.function.__name__, self.operation)
640 # Warning: geom is a singleton
646 class geomBuilder(GEOM._objref_GEOM_Gen):
648 ## Enumeration ShapeType as a dictionary. \n
649 ## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details.
650 # @ingroup l1_geomBuilder_auxiliary
651 ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8, "FLAT":9}
653 ## Kinds of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
654 # and a list of parameters, describing the shape.
655 # List of parameters, describing the shape:
656 # - COMPOUND: [nb_solids nb_faces nb_edges nb_vertices]
657 # - COMPSOLID: [nb_solids nb_faces nb_edges nb_vertices]
659 # - SHELL: [info.CLOSED / info.UNCLOSED nb_faces nb_edges nb_vertices]
661 # - WIRE: [info.CLOSED / info.UNCLOSED nb_edges nb_vertices]
663 # - SPHERE: [xc yc zc R]
664 # - CYLINDER: [xb yb zb dx dy dz R H]
665 # - BOX: [xc yc zc ax ay az]
666 # - ROTATED_BOX: [xc yc zc zx zy zz xx xy xz ax ay az]
667 # - TORUS: [xc yc zc dx dy dz R_1 R_2]
668 # - CONE: [xb yb zb dx dy dz R_1 R_2 H]
669 # - POLYHEDRON: [nb_faces nb_edges nb_vertices]
670 # - SOLID: [nb_faces nb_edges nb_vertices]
672 # - SPHERE2D: [xc yc zc R]
673 # - CYLINDER2D: [xb yb zb dx dy dz R H]
674 # - TORUS2D: [xc yc zc dx dy dz R_1 R_2]
675 # - CONE2D: [xc yc zc dx dy dz R_1 R_2 H]
676 # - DISK_CIRCLE: [xc yc zc dx dy dz R]
677 # - DISK_ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
678 # - POLYGON: [xo yo zo dx dy dz nb_edges nb_vertices]
679 # - PLANE: [xo yo zo dx dy dz]
680 # - PLANAR: [xo yo zo dx dy dz nb_edges nb_vertices]
681 # - FACE: [nb_edges nb_vertices]
683 # - CIRCLE: [xc yc zc dx dy dz R]
684 # - ARC_CIRCLE: [xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2]
685 # - ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
686 # - ARC_ELLIPSE: [xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2]
687 # - LINE: [xo yo zo dx dy dz]
688 # - SEGMENT: [x1 y1 z1 x2 y2 z2]
689 # - EDGE: [nb_vertices]
693 # - LCS: [x y z xx xy xz yx yy yz zx zy zz]
694 # @ingroup l1_geomBuilder_auxiliary
695 kind = GEOM.GEOM_IKindOfShape
697 def __new__(cls, *args):
702 #print "==== __new__ ", engine, geom, doLcc, created
704 # geom engine is either retrieved from engine, or created
706 # Following test avoids a recursive loop
709 # geom engine not created: existing engine found
711 if doLcc and not created:
713 # FindOrLoadComponent called:
714 # 1. CORBA resolution of server
715 # 2. the __new__ method is called again
716 #print "==== FindOrLoadComponent ", engine, geom, doLcc, created
717 geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" )
720 # FindOrLoadComponent not called
722 # geomBuilder instance is created from lcc.FindOrLoadComponent
723 #print "==== super ", engine, geom, doLcc, created
724 geom = super(geomBuilder,cls).__new__(cls)
727 # geom engine not created: existing engine found
728 #print "==== existing ", engine, geom, doLcc, created
730 #print "return geom 1 ", geom
733 #print "return geom 2 ", geom
736 def __init__(self, *args):
738 #print "-------- geomBuilder __init__ --- ", created, self
741 GEOM._objref_GEOM_Gen.__init__(self, *args)
742 self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
743 self.myBuilder = None
760 ## Process object publication in the study, as follows:
761 # - if @a theName is specified (not None), the object is published in the study
762 # with this name, not taking into account "auto-publishing" option;
763 # - if @a theName is NOT specified, the object is published in the study
764 # (using default name, which can be customized using @a theDefaultName parameter)
765 # only if auto-publishing is switched on.
767 # @param theObj object, a subject for publishing
768 # @param theName object name for study
769 # @param theDefaultName default name for the auto-publishing
771 # @sa addToStudyAuto()
772 def _autoPublish(self, theObj, theName, theDefaultName="noname"):
774 def _item_name(_names, _defname, _idx=-1):
775 if not _names: _names = _defname
776 if type(_names) in [list, tuple]:
778 if _idx >= len(_names) or not _names[_idx]:
779 if type(_defname) not in [list, tuple]:
780 _name = "%s_%d"%(_defname, _idx+1)
781 elif len(_defname) > 0 and _idx >= 0 and _idx < len(_defname):
782 _name = _defname[_idx]
784 _name = "%noname_%d"%(dn, _idx+1)
790 # must be wrong usage
795 _name = "%s_%d"%(_names, _idx+1)
801 def _publish( _name, _obj ):
803 if isinstance( _obj, GEOM._objref_GEOM_Field ):
804 fatherObj = _obj.GetShape()
805 elif isinstance( _obj, GEOM._objref_GEOM_FieldStep ):
806 fatherObj = _obj.GetField()
807 elif not _obj.IsMainShape():
808 fatherObj = _obj.GetMainShape()
810 if fatherObj and fatherObj.GetStudyEntry():
811 self.addToStudyInFather(fatherObj, _obj, _name)
813 self.addToStudy(_obj, _name)
819 if not theName and not self.myMaxNbSubShapesAllowed:
820 return # nothing to do: auto-publishing is disabled
821 if not theName and not theDefaultName:
822 return # neither theName nor theDefaultName is given
824 if type(theObj) in [list, tuple]:
825 # list of objects is being published
828 if not obj: continue # bad object
829 name = _item_name(theName, theDefaultName, idx)
830 _publish( name, obj )
832 if not theName and idx == self.myMaxNbSubShapesAllowed: break
836 # single object is published
837 name = _item_name(theName, theDefaultName)
838 _publish( name, theObj )
841 ## @addtogroup l1_geomBuilder_auxiliary
844 self.myStudy = salome.myStudy
845 self.myBuilder = self.myStudy.NewBuilder()
847 # load data from the study file, if necessary
848 component = self.myStudy.FindComponent("GEOM")
850 self.myBuilder.LoadWith(component, self)
852 self.BasicOp = self.GetIBasicOperations ()
853 self.CurvesOp = self.GetICurvesOperations ()
854 self.PrimOp = self.GetI3DPrimOperations ()
855 self.ShapesOp = self.GetIShapesOperations ()
856 self.HealOp = self.GetIHealingOperations ()
857 self.InsertOp = self.GetIInsertOperations ()
858 self.BoolOp = self.GetIBooleanOperations ()
859 self.TrsfOp = self.GetITransformOperations()
860 self.LocalOp = self.GetILocalOperations ()
861 self.MeasuOp = self.GetIMeasureOperations ()
862 self.BlocksOp = self.GetIBlocksOperations ()
863 self.GroupOp = self.GetIGroupOperations ()
864 self.FieldOp = self.GetIFieldOperations ()
865 self.TestOp = self.GetITestOperations ()
867 notebook.myStudy = self.myStudy
870 def GetPluginOperations(self, libraryName):
871 op = GEOM._objref_GEOM_Gen.GetPluginOperations(self, libraryName)
874 ## Enable / disable results auto-publishing
876 # The automatic publishing is managed in the following way:
877 # - if @a maxNbSubShapes = 0, automatic publishing is disabled.
878 # - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
879 # maximum number of sub-shapes allowed for publishing is unlimited; any negative
880 # value passed as parameter has the same effect.
881 # - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
882 # maximum number of sub-shapes allowed for publishing is set to specified value.
884 # @param maxNbSubShapes maximum number of sub-shapes allowed for publishing.
885 # @ingroup l1_publish_data
886 def addToStudyAuto(self, maxNbSubShapes=-1):
888 Enable / disable results auto-publishing
890 The automatic publishing is managed in the following way:
891 - if @a maxNbSubShapes = 0, automatic publishing is disabled;
892 - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
893 maximum number of sub-shapes allowed for publishing is unlimited; any negative
894 value passed as parameter has the same effect.
895 - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
896 maximum number of sub-shapes allowed for publishing is set to this value.
899 maxNbSubShapes maximum number of sub-shapes allowed for publishing.
902 geompy.addToStudyAuto() # enable auto-publishing
903 geompy.MakeBoxDXDYDZ(100) # box is created and published with default name
904 geompy.addToStudyAuto(0) # disable auto-publishing
906 self.myMaxNbSubShapesAllowed = max(-1, maxNbSubShapes)
909 ## Dump component to the Python script
910 # This method overrides IDL function to allow default values for the parameters.
911 def DumpPython(self, theIsPublished=True, theIsMultiFile=True):
913 Dump component to the Python script
914 This method overrides IDL function to allow default values for the parameters.
916 return GEOM._objref_GEOM_Gen.DumpPython(self, theIsPublished, theIsMultiFile)
918 ## Get name for sub-shape aSubObj of shape aMainObj
920 # @ref swig_SubShapeName "Example"
921 @ManageTransactions("ShapesOp")
922 def SubShapeName(self,aSubObj, aMainObj):
924 Get name for sub-shape aSubObj of shape aMainObj
926 # Example: see GEOM_TestAll.py
928 #aSubId = orb.object_to_string(aSubObj)
929 #aMainId = orb.object_to_string(aMainObj)
930 #index = gg.getIndexTopology(aSubId, aMainId)
931 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
932 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
933 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
936 ## Publish in study aShape with name aName
938 # \param aShape the shape to be published
939 # \param aName the name for the shape
940 # \param doRestoreSubShapes if True, finds and publishes also
941 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
942 # and published sub-shapes of arguments
943 # \param theArgs,theFindMethod,theInheritFirstArg see RestoreSubShapes() for
944 # these arguments description
945 # \return study entry of the published shape in form of string
947 # @ingroup l1_publish_data
948 # @ref swig_all_addtostudy "Example"
949 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
950 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
952 Publish in study aShape with name aName
955 aShape the shape to be published
956 aName the name for the shape
957 doRestoreSubShapes if True, finds and publishes also
958 sub-shapes of aShape, corresponding to its arguments
959 and published sub-shapes of arguments
960 theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes() for
961 these arguments description
964 study entry of the published shape in form of string
967 id_block1 = geompy.addToStudy(Block1, "Block 1")
969 # Example: see GEOM_TestAll.py
971 aSObject = self.AddInStudy(aShape, aName, None)
972 if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
973 if doRestoreSubShapes:
974 self.RestoreSubShapesSO(aSObject, theArgs,
975 theFindMethod, theInheritFirstArg, True )
977 print("addToStudy() failed")
979 return aShape.GetStudyEntry()
981 ## Publish in study aShape with name aName as sub-object of previously published aFather
982 # \param aFather previously published object
983 # \param aShape the shape to be published as sub-object of <VAR>aFather</VAR>
984 # \param aName the name for the shape
986 # \return study entry of the published shape in form of string
988 # @ingroup l1_publish_data
989 # @ref swig_all_addtostudyInFather "Example"
990 def addToStudyInFather(self, aFather, aShape, aName):
992 Publish in study aShape with name aName as sub-object of previously published aFather
995 aFather previously published object
996 aShape the shape to be published as sub-object of aFather
997 aName the name for the shape
1000 study entry of the published shape in form of string
1002 # Example: see GEOM_TestAll.py
1004 aSObject = self.AddInStudy(aShape, aName, aFather)
1005 if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
1007 print("addToStudyInFather() failed")
1009 return aShape.GetStudyEntry()
1011 ## Unpublish object in study
1013 # \param obj the object to be unpublished
1014 def hideInStudy(self, obj):
1016 Unpublish object in study
1019 obj the object to be unpublished
1021 ior = salome.orb.object_to_string(obj)
1022 aSObject = self.myStudy.FindObjectIOR(ior)
1023 if aSObject is not None:
1024 genericAttribute = self.myBuilder.FindOrCreateAttribute(aSObject, "AttributeDrawable")
1025 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
1026 drwAttribute.SetDrawable(False)
1027 # hide references if any
1028 vso = self.myStudy.FindDependances(aSObject);
1030 genericAttribute = self.myBuilder.FindOrCreateAttribute(refObj, "AttributeDrawable")
1031 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
1032 drwAttribute.SetDrawable(False)
1036 # end of l1_geomBuilder_auxiliary
1039 ## @addtogroup l3_restore_ss
1042 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
1043 # To be used from python scripts out of addToStudy() (non-default usage)
1044 # \param theObject published GEOM.GEOM_Object, arguments of which will be published
1045 # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1046 # If this list is empty, all operation arguments will be published
1047 # \param theFindMethod method to search sub-shapes, corresponding to arguments and
1048 # their sub-shapes. Value from enumeration GEOM.find_shape_method.
1049 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
1050 # Do not publish sub-shapes in place of arguments, but only
1051 # in place of sub-shapes of the first argument,
1052 # because the whole shape corresponds to the first argument.
1053 # Mainly to be used after transformations, but it also can be
1054 # useful after partition with one object shape, and some other
1055 # operations, where only the first argument has to be considered.
1056 # If theObject has only one argument shape, this flag is automatically
1057 # considered as True, not regarding really passed value.
1058 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
1059 # and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1060 # \return list of published sub-shapes
1062 # @ref tui_restore_prs_params "Example"
1063 def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
1064 theInheritFirstArg=False, theAddPrefix=True):
1066 Publish sub-shapes, standing for arguments and sub-shapes of arguments
1067 To be used from python scripts out of geompy.addToStudy (non-default usage)
1070 theObject published GEOM.GEOM_Object, arguments of which will be published
1071 theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1072 If this list is empty, all operation arguments will be published
1073 theFindMethod method to search sub-shapes, corresponding to arguments and
1074 their sub-shapes. Value from enumeration GEOM.find_shape_method.
1075 theInheritFirstArg set properties of the first argument for theObject.
1076 Do not publish sub-shapes in place of arguments, but only
1077 in place of sub-shapes of the first argument,
1078 because the whole shape corresponds to the first argument.
1079 Mainly to be used after transformations, but it also can be
1080 useful after partition with one object shape, and some other
1081 operations, where only the first argument has to be considered.
1082 If theObject has only one argument shape, this flag is automatically
1083 considered as True, not regarding really passed value.
1084 theAddPrefix add prefix "from_" to names of restored sub-shapes,
1085 and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1087 list of published sub-shapes
1089 # Example: see GEOM_TestAll.py
1090 return self.RestoreSubShapesO(theObject, theArgs,
1091 theFindMethod, theInheritFirstArg, theAddPrefix)
1093 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
1094 # To be used from python scripts out of addToStudy() (non-default usage)
1095 # \param theObject published GEOM.GEOM_Object, arguments of which will be published
1096 # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1097 # If this list is empty, all operation arguments will be published
1098 # \param theFindMethod method to search sub-shapes, corresponding to arguments and
1099 # their sub-shapes. Value from enumeration GEOM::find_shape_method.
1100 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
1101 # Do not publish sub-shapes in place of arguments, but only
1102 # in place of sub-shapes of the first argument,
1103 # because the whole shape corresponds to the first argument.
1104 # Mainly to be used after transformations, but it also can be
1105 # useful after partition with one object shape, and some other
1106 # operations, where only the first argument has to be considered.
1107 # If theObject has only one argument shape, this flag is automatically
1108 # considered as True, not regarding really passed value.
1109 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
1110 # and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1111 # \return list of published sub-shapes
1113 # @ref tui_restore_prs_params "Example"
1114 def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
1115 theInheritFirstArg=False, theAddPrefix=True):
1117 Publish sub-shapes, standing for arguments and sub-shapes of arguments
1118 To be used from python scripts out of geompy.addToStudy() (non-default usage)
1121 theObject published GEOM.GEOM_Object, arguments of which will be published
1122 theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1123 If this list is empty, all operation arguments will be published
1124 theFindMethod method to search sub-shapes, corresponding to arguments and
1125 their sub-shapes. Value from enumeration GEOM::find_shape_method.
1126 theInheritFirstArg set properties of the first argument for theObject.
1127 Do not publish sub-shapes in place of arguments, but only
1128 in place of sub-shapes of the first argument,
1129 because the whole shape corresponds to the first argument.
1130 Mainly to be used after transformations, but it also can be
1131 useful after partition with one object shape, and some other
1132 operations, where only the first argument has to be considered.
1133 If theObject has only one argument shape, this flag is automatically
1134 considered as True, not regarding really passed value.
1135 theAddPrefix add prefix "from_" to names of restored sub-shapes,
1136 and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1139 list of published sub-shapes
1141 # Example: see GEOM_TestAll.py
1142 return self.RestoreGivenSubShapesO(theObject, theArgs,
1143 theFindMethod, theInheritFirstArg, theAddPrefix)
1145 # end of l3_restore_ss
1148 ## @addtogroup l3_basic_go
1151 ## Create point by three coordinates.
1152 # @param theX The X coordinate of the point.
1153 # @param theY The Y coordinate of the point.
1154 # @param theZ The Z coordinate of the point.
1155 # @param theName Object name; when specified, this parameter is used
1156 # for result publication in the study. Otherwise, if automatic
1157 # publication is switched on, default value is used for result name.
1159 # @return New GEOM.GEOM_Object, containing the created point.
1161 # @ref tui_creation_point "Example"
1162 @ManageTransactions("BasicOp")
1163 def MakeVertex(self, theX, theY, theZ, theName=None):
1165 Create point by three coordinates.
1168 theX The X coordinate of the point.
1169 theY The Y coordinate of the point.
1170 theZ The Z coordinate of the point.
1171 theName Object name; when specified, this parameter is used
1172 for result publication in the study. Otherwise, if automatic
1173 publication is switched on, default value is used for result name.
1176 New GEOM.GEOM_Object, containing the created point.
1178 # Example: see GEOM_TestAll.py
1179 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
1180 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
1181 RaiseIfFailed("MakePointXYZ", self.BasicOp)
1182 anObj.SetParameters(Parameters)
1183 self._autoPublish(anObj, theName, "vertex")
1186 ## Create a point, distant from the referenced point
1187 # on the given distances along the coordinate axes.
1188 # @param theReference The referenced point.
1189 # @param theX Displacement from the referenced point along OX axis.
1190 # @param theY Displacement from the referenced point along OY axis.
1191 # @param theZ Displacement from the referenced point along OZ axis.
1192 # @param theName Object name; when specified, this parameter is used
1193 # for result publication in the study. Otherwise, if automatic
1194 # publication is switched on, default value is used for result name.
1196 # @return New GEOM.GEOM_Object, containing the created point.
1198 # @ref tui_creation_point "Example"
1199 @ManageTransactions("BasicOp")
1200 def MakeVertexWithRef(self, theReference, theX, theY, theZ, theName=None):
1202 Create a point, distant from the referenced point
1203 on the given distances along the coordinate axes.
1206 theReference The referenced point.
1207 theX Displacement from the referenced point along OX axis.
1208 theY Displacement from the referenced point along OY axis.
1209 theZ Displacement from the referenced point along OZ axis.
1210 theName Object name; when specified, this parameter is used
1211 for result publication in the study. Otherwise, if automatic
1212 publication is switched on, default value is used for result name.
1215 New GEOM.GEOM_Object, containing the created point.
1217 # Example: see GEOM_TestAll.py
1218 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
1219 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
1220 RaiseIfFailed("MakePointWithReference", self.BasicOp)
1221 anObj.SetParameters(Parameters)
1222 self._autoPublish(anObj, theName, "vertex")
1225 ## Create a point, corresponding to the given parameter on the given curve.
1226 # @param theRefCurve The referenced curve.
1227 # @param theParameter Value of parameter on the referenced curve.
1228 # @param takeOrientationIntoAccount flag that tells if it is necessary
1229 # to take the curve's orientation into account for the
1230 # operation. I.e. if this flag is set, the results for the same
1231 # parameters (except the value 0.5) is different for forward
1232 # and reversed curves. If it is not set the result is the same.
1233 # @param theName Object name; when specified, this parameter is used
1234 # for result publication in the study. Otherwise, if automatic
1235 # publication is switched on, default value is used for result name.
1237 # @return New GEOM.GEOM_Object, containing the created point.
1239 # @ref tui_creation_point "Example"
1240 @ManageTransactions("BasicOp")
1241 def MakeVertexOnCurve(self, theRefCurve, theParameter,
1242 takeOrientationIntoAccount=False, theName=None):
1244 Create a point, corresponding to the given parameter on the given curve.
1247 theRefCurve The referenced curve.
1248 theParameter Value of parameter on the referenced curve.
1249 takeOrientationIntoAccount flag that tells if it is necessary
1250 to take the curve's orientation into account for the
1251 operation. I.e. if this flag is set, the results for
1252 the same parameters (except the value 0.5) is different
1253 for forward and reversed curves. If it is not set
1254 the result is the same.
1255 theName Object name; when specified, this parameter is used
1256 for result publication in the study. Otherwise, if automatic
1257 publication is switched on, default value is used for result name.
1260 New GEOM.GEOM_Object, containing the created point.
1263 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
1265 # Example: see GEOM_TestAll.py
1266 theParameter, takeOrientationIntoAccount, Parameters = ParseParameters(
1267 theParameter, takeOrientationIntoAccount)
1268 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter,
1269 takeOrientationIntoAccount)
1270 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
1271 anObj.SetParameters(Parameters)
1272 self._autoPublish(anObj, theName, "vertex")
1275 ## Create a point by projection give coordinates on the given curve
1276 # @param theRefCurve The referenced curve.
1277 # @param theX X-coordinate in 3D space
1278 # @param theY Y-coordinate in 3D space
1279 # @param theZ Z-coordinate in 3D space
1280 # @param theName Object name; when specified, this parameter is used
1281 # for result publication in the study. Otherwise, if automatic
1282 # publication is switched on, default value is used for result name.
1284 # @return New GEOM.GEOM_Object, containing the created point.
1286 # @ref tui_creation_point "Example"
1287 @ManageTransactions("BasicOp")
1288 def MakeVertexOnCurveByCoord(self, theRefCurve, theX, theY, theZ, theName=None):
1290 Create a point by projection give coordinates on the given curve
1293 theRefCurve The referenced curve.
1294 theX X-coordinate in 3D space
1295 theY Y-coordinate in 3D space
1296 theZ Z-coordinate in 3D space
1297 theName Object name; when specified, this parameter is used
1298 for result publication in the study. Otherwise, if automatic
1299 publication is switched on, default value is used for result name.
1302 New GEOM.GEOM_Object, containing the created point.
1305 p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
1307 # Example: see GEOM_TestAll.py
1308 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
1309 anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
1310 RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
1311 anObj.SetParameters(Parameters)
1312 self._autoPublish(anObj, theName, "vertex")
1315 ## Create a point, corresponding to the given length on the given curve.
1316 # @param theRefCurve The referenced curve.
1317 # @param theLength Length on the referenced curve. It can be negative.
1318 # @param theStartPoint Point allowing to choose the direction for the calculation
1319 # of the length. If None, start from the first point of theRefCurve.
1320 # @param theName Object name; when specified, this parameter is used
1321 # for result publication in the study. Otherwise, if automatic
1322 # publication is switched on, default value is used for result name.
1324 # @return New GEOM.GEOM_Object, containing the created point.
1326 # @ref tui_creation_point "Example"
1327 @ManageTransactions("BasicOp")
1328 def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
1330 Create a point, corresponding to the given length on the given curve.
1333 theRefCurve The referenced curve.
1334 theLength Length on the referenced curve. It can be negative.
1335 theStartPoint Point allowing to choose the direction for the calculation
1336 of the length. If None, start from the first point of theRefCurve.
1337 theName Object name; when specified, this parameter is used
1338 for result publication in the study. Otherwise, if automatic
1339 publication is switched on, default value is used for result name.
1342 New GEOM.GEOM_Object, containing the created point.
1344 # Example: see GEOM_TestAll.py
1345 theLength, Parameters = ParseParameters(theLength)
1346 anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
1347 RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
1348 anObj.SetParameters(Parameters)
1349 self._autoPublish(anObj, theName, "vertex")
1352 ## Create a point, corresponding to the given parameters on the
1354 # @param theRefSurf The referenced surface.
1355 # @param theUParameter Value of U-parameter on the referenced surface.
1356 # @param theVParameter Value of V-parameter on the referenced surface.
1357 # @param theName Object name; when specified, this parameter is used
1358 # for result publication in the study. Otherwise, if automatic
1359 # publication is switched on, default value is used for result name.
1361 # @return New GEOM.GEOM_Object, containing the created point.
1363 # @ref swig_MakeVertexOnSurface "Example"
1364 @ManageTransactions("BasicOp")
1365 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter, theName=None):
1367 Create a point, corresponding to the given parameters on the
1371 theRefSurf The referenced surface.
1372 theUParameter Value of U-parameter on the referenced surface.
1373 theVParameter Value of V-parameter on the referenced surface.
1374 theName Object name; when specified, this parameter is used
1375 for result publication in the study. Otherwise, if automatic
1376 publication is switched on, default value is used for result name.
1379 New GEOM.GEOM_Object, containing the created point.
1382 p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8)
1384 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
1385 # Example: see GEOM_TestAll.py
1386 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
1387 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
1388 anObj.SetParameters(Parameters);
1389 self._autoPublish(anObj, theName, "vertex")
1392 ## Create a point by projection give coordinates on the given surface
1393 # @param theRefSurf The referenced surface.
1394 # @param theX X-coordinate in 3D space
1395 # @param theY Y-coordinate in 3D space
1396 # @param theZ Z-coordinate in 3D space
1397 # @param theName Object name; when specified, this parameter is used
1398 # for result publication in the study. Otherwise, if automatic
1399 # publication is switched on, default value is used for result name.
1401 # @return New GEOM.GEOM_Object, containing the created point.
1403 # @ref swig_MakeVertexOnSurfaceByCoord "Example"
1404 @ManageTransactions("BasicOp")
1405 def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ, theName=None):
1407 Create a point by projection give coordinates on the given surface
1410 theRefSurf The referenced surface.
1411 theX X-coordinate in 3D space
1412 theY Y-coordinate in 3D space
1413 theZ Z-coordinate in 3D space
1414 theName Object name; when specified, this parameter is used
1415 for result publication in the study. Otherwise, if automatic
1416 publication is switched on, default value is used for result name.
1419 New GEOM.GEOM_Object, containing the created point.
1422 p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.)
1424 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
1425 # Example: see GEOM_TestAll.py
1426 anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
1427 RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
1428 anObj.SetParameters(Parameters);
1429 self._autoPublish(anObj, theName, "vertex")
1432 ## Create a point, which lays on the given face.
1433 # The point will lay in arbitrary place of the face.
1434 # The only condition on it is a non-zero distance to the face boundary.
1435 # Such point can be used to uniquely identify the face inside any
1436 # shape in case, when the shape does not contain overlapped faces.
1437 # @param theFace The referenced face.
1438 # @param theName Object name; when specified, this parameter is used
1439 # for result publication in the study. Otherwise, if automatic
1440 # publication is switched on, default value is used for result name.
1442 # @return New GEOM.GEOM_Object, containing the created point.
1444 # @ref swig_MakeVertexInsideFace "Example"
1445 @ManageTransactions("BasicOp")
1446 def MakeVertexInsideFace (self, theFace, theNumberOfPnts=1, theName=None):
1448 Create a point, which lays on the given face.
1449 The point will lay in arbitrary place of the face.
1450 The only condition on it is a non-zero distance to the face boundary.
1451 Such point can be used to uniquely identify the face inside any
1452 shape in case, when the shape does not contain overlapped faces.
1455 theFace The referenced face.
1456 theNumberOfPnts The number of points we want to get, 1 by default.
1457 theName Object name; when specified, this parameter is used
1458 for result publication in the study. Otherwise, if automatic
1459 publication is switched on, default value is used for result name.
1462 New GEOM.GEOM_Object, containing the created point.
1465 p_on_face = geompy.MakeVertexInsideFace(Face)
1467 # Example: see GEOM_TestAll.py
1468 anObj = self.BasicOp.MakePointOnFace(theFace, theNumberOfPnts)
1469 RaiseIfFailed("MakeVertexInsideFace", self.BasicOp)
1470 self._autoPublish(anObj, theName, "vertex")
1473 ## Create a point on intersection of two lines.
1474 # @param theRefLine1, theRefLine2 The referenced lines.
1475 # @param theName Object name; when specified, this parameter is used
1476 # for result publication in the study. Otherwise, if automatic
1477 # publication is switched on, default value is used for result name.
1479 # @return New GEOM.GEOM_Object, containing the created point.
1481 # @ref swig_MakeVertexOnLinesIntersection "Example"
1482 @ManageTransactions("BasicOp")
1483 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2, theName=None):
1485 Create a point on intersection of two lines.
1488 theRefLine1, theRefLine2 The referenced lines.
1489 theName Object name; when specified, this parameter is used
1490 for result publication in the study. Otherwise, if automatic
1491 publication is switched on, default value is used for result name.
1494 New GEOM.GEOM_Object, containing the created point.
1496 # Example: see GEOM_TestAll.py
1497 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
1498 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
1499 self._autoPublish(anObj, theName, "vertex")
1502 ## Create a tangent, corresponding to the given parameter on the given curve.
1503 # @param theRefCurve The referenced curve.
1504 # @param theParameter Value of parameter on the referenced curve.
1505 # @param theName Object name; when specified, this parameter is used
1506 # for result publication in the study. Otherwise, if automatic
1507 # publication is switched on, default value is used for result name.
1509 # @return New GEOM.GEOM_Object, containing the created tangent.
1511 # @ref swig_MakeTangentOnCurve "Example"
1512 @ManageTransactions("BasicOp")
1513 def MakeTangentOnCurve(self, theRefCurve, theParameter, theName=None):
1515 Create a tangent, corresponding to the given parameter on the given curve.
1518 theRefCurve The referenced curve.
1519 theParameter Value of parameter on the referenced curve.
1520 theName Object name; when specified, this parameter is used
1521 for result publication in the study. Otherwise, if automatic
1522 publication is switched on, default value is used for result name.
1525 New GEOM.GEOM_Object, containing the created tangent.
1528 tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7)
1530 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
1531 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
1532 self._autoPublish(anObj, theName, "tangent")
1535 ## Create a tangent plane, corresponding to the given parameter on the given face.
1536 # @param theFace The face for which tangent plane should be built.
1537 # @param theParameterV vertical value of the center point (0.0 - 1.0).
1538 # @param theParameterU horisontal value of the center point (0.0 - 1.0).
1539 # @param theTrimSize the size of plane.
1540 # @param theName Object name; when specified, this parameter is used
1541 # for result publication in the study. Otherwise, if automatic
1542 # publication is switched on, default value is used for result name.
1544 # @return New GEOM.GEOM_Object, containing the created tangent.
1546 # @ref swig_MakeTangentPlaneOnFace "Example"
1547 @ManageTransactions("BasicOp")
1548 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize, theName=None):
1550 Create a tangent plane, corresponding to the given parameter on the given face.
1553 theFace The face for which tangent plane should be built.
1554 theParameterV vertical value of the center point (0.0 - 1.0).
1555 theParameterU horisontal value of the center point (0.0 - 1.0).
1556 theTrimSize the size of plane.
1557 theName Object name; when specified, this parameter is used
1558 for result publication in the study. Otherwise, if automatic
1559 publication is switched on, default value is used for result name.
1562 New GEOM.GEOM_Object, containing the created tangent.
1565 an_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
1567 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
1568 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
1569 self._autoPublish(anObj, theName, "tangent")
1572 ## Create a vector with the given components.
1573 # @param theDX X component of the vector.
1574 # @param theDY Y component of the vector.
1575 # @param theDZ Z component of the vector.
1576 # @param theName Object name; when specified, this parameter is used
1577 # for result publication in the study. Otherwise, if automatic
1578 # publication is switched on, default value is used for result name.
1580 # @return New GEOM.GEOM_Object, containing the created vector.
1582 # @ref tui_creation_vector "Example"
1583 @ManageTransactions("BasicOp")
1584 def MakeVectorDXDYDZ(self, theDX, theDY, theDZ, theName=None):
1586 Create a vector with the given components.
1589 theDX X component of the vector.
1590 theDY Y component of the vector.
1591 theDZ Z component of the vector.
1592 theName Object name; when specified, this parameter is used
1593 for result publication in the study. Otherwise, if automatic
1594 publication is switched on, default value is used for result name.
1597 New GEOM.GEOM_Object, containing the created vector.
1599 # Example: see GEOM_TestAll.py
1600 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1601 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
1602 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
1603 anObj.SetParameters(Parameters)
1604 self._autoPublish(anObj, theName, "vector")
1607 ## Create a vector between two points.
1608 # @param thePnt1 Start point for the vector.
1609 # @param thePnt2 End point for the vector.
1610 # @param theName Object name; when specified, this parameter is used
1611 # for result publication in the study. Otherwise, if automatic
1612 # publication is switched on, default value is used for result name.
1614 # @return New GEOM.GEOM_Object, containing the created vector.
1616 # @ref tui_creation_vector "Example"
1617 @ManageTransactions("BasicOp")
1618 def MakeVector(self, thePnt1, thePnt2, theName=None):
1620 Create a vector between two points.
1623 thePnt1 Start point for the vector.
1624 thePnt2 End point for the vector.
1625 theName Object name; when specified, this parameter is used
1626 for result publication in the study. Otherwise, if automatic
1627 publication is switched on, default value is used for result name.
1630 New GEOM.GEOM_Object, containing the created vector.
1632 # Example: see GEOM_TestAll.py
1633 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
1634 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
1635 self._autoPublish(anObj, theName, "vector")
1638 ## Create a line, passing through the given point
1639 # and parallel to the given direction
1640 # @param thePnt Point. The resulting line will pass through it.
1641 # @param theDir Direction. The resulting line will be parallel to it.
1642 # @param theName Object name; when specified, this parameter is used
1643 # for result publication in the study. Otherwise, if automatic
1644 # publication is switched on, default value is used for result name.
1646 # @return New GEOM.GEOM_Object, containing the created line.
1648 # @ref tui_creation_line "Example"
1649 @ManageTransactions("BasicOp")
1650 def MakeLine(self, thePnt, theDir, theName=None):
1652 Create a line, passing through the given point
1653 and parallel to the given direction
1656 thePnt Point. The resulting line will pass through it.
1657 theDir Direction. The resulting line will be parallel to it.
1658 theName Object name; when specified, this parameter is used
1659 for result publication in the study. Otherwise, if automatic
1660 publication is switched on, default value is used for result name.
1663 New GEOM.GEOM_Object, containing the created line.
1665 # Example: see GEOM_TestAll.py
1666 anObj = self.BasicOp.MakeLine(thePnt, theDir)
1667 RaiseIfFailed("MakeLine", self.BasicOp)
1668 self._autoPublish(anObj, theName, "line")
1671 ## Create a line, passing through the given points
1672 # @param thePnt1 First of two points, defining the line.
1673 # @param thePnt2 Second of two points, defining the line.
1674 # @param theName Object name; when specified, this parameter is used
1675 # for result publication in the study. Otherwise, if automatic
1676 # publication is switched on, default value is used for result name.
1678 # @return New GEOM.GEOM_Object, containing the created line.
1680 # @ref tui_creation_line "Example"
1681 @ManageTransactions("BasicOp")
1682 def MakeLineTwoPnt(self, thePnt1, thePnt2, theName=None):
1684 Create a line, passing through the given points
1687 thePnt1 First of two points, defining the line.
1688 thePnt2 Second of two points, defining the line.
1689 theName Object name; when specified, this parameter is used
1690 for result publication in the study. Otherwise, if automatic
1691 publication is switched on, default value is used for result name.
1694 New GEOM.GEOM_Object, containing the created line.
1696 # Example: see GEOM_TestAll.py
1697 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
1698 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
1699 self._autoPublish(anObj, theName, "line")
1702 ## Create a line on two faces intersection.
1703 # @param theFace1 First of two faces, defining the line.
1704 # @param theFace2 Second of two faces, defining the line.
1705 # @param theName Object name; when specified, this parameter is used
1706 # for result publication in the study. Otherwise, if automatic
1707 # publication is switched on, default value is used for result name.
1709 # @return New GEOM.GEOM_Object, containing the created line.
1711 # @ref swig_MakeLineTwoFaces "Example"
1712 @ManageTransactions("BasicOp")
1713 def MakeLineTwoFaces(self, theFace1, theFace2, theName=None):
1715 Create a line on two faces intersection.
1718 theFace1 First of two faces, defining the line.
1719 theFace2 Second of two faces, defining the line.
1720 theName Object name; when specified, this parameter is used
1721 for result publication in the study. Otherwise, if automatic
1722 publication is switched on, default value is used for result name.
1725 New GEOM.GEOM_Object, containing the created line.
1727 # Example: see GEOM_TestAll.py
1728 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
1729 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
1730 self._autoPublish(anObj, theName, "line")
1733 ## Create a plane, passing through the given point
1734 # and normal to the given vector.
1735 # @param thePnt Point, the plane has to pass through.
1736 # @param theVec Vector, defining the plane normal direction.
1737 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1738 # @param theName Object name; when specified, this parameter is used
1739 # for result publication in the study. Otherwise, if automatic
1740 # publication is switched on, default value is used for result name.
1742 # @return New GEOM.GEOM_Object, containing the created plane.
1744 # @ref tui_creation_plane "Example"
1745 @ManageTransactions("BasicOp")
1746 def MakePlane(self, thePnt, theVec, theTrimSize, theName=None):
1748 Create a plane, passing through the given point
1749 and normal to the given vector.
1752 thePnt Point, the plane has to pass through.
1753 theVec Vector, defining the plane normal direction.
1754 theTrimSize Half size of a side of quadrangle face, representing the plane.
1755 theName Object name; when specified, this parameter is used
1756 for result publication in the study. Otherwise, if automatic
1757 publication is switched on, default value is used for result name.
1760 New GEOM.GEOM_Object, containing the created plane.
1762 # Example: see GEOM_TestAll.py
1763 theTrimSize, Parameters = ParseParameters(theTrimSize);
1764 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
1765 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
1766 anObj.SetParameters(Parameters)
1767 self._autoPublish(anObj, theName, "plane")
1770 ## Create a plane, passing through the three given points
1771 # @param thePnt1 First of three points, defining the plane.
1772 # @param thePnt2 Second of three points, defining the plane.
1773 # @param thePnt3 Third of three points, defining the plane.
1774 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1775 # @param theName Object name; when specified, this parameter is used
1776 # for result publication in the study. Otherwise, if automatic
1777 # publication is switched on, default value is used for result name.
1779 # @return New GEOM.GEOM_Object, containing the created plane.
1781 # @ref tui_creation_plane "Example"
1782 @ManageTransactions("BasicOp")
1783 def MakePlaneThreePnt(self, thePnt1, thePnt2, thePnt3, theTrimSize, theName=None):
1785 Create a plane, passing through the three given points
1788 thePnt1 First of three points, defining the plane.
1789 thePnt2 Second of three points, defining the plane.
1790 thePnt3 Third of three points, defining the plane.
1791 theTrimSize Half size of a side of quadrangle face, representing the plane.
1792 theName Object name; when specified, this parameter is used
1793 for result publication in the study. Otherwise, if automatic
1794 publication is switched on, default value is used for result name.
1797 New GEOM.GEOM_Object, containing the created plane.
1799 # Example: see GEOM_TestAll.py
1800 theTrimSize, Parameters = ParseParameters(theTrimSize);
1801 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
1802 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
1803 anObj.SetParameters(Parameters)
1804 self._autoPublish(anObj, theName, "plane")
1807 ## Create a plane, similar to the existing one, but with another size of representing face.
1808 # @param theFace Referenced plane or LCS(Marker).
1809 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
1810 # @param theName Object name; when specified, this parameter is used
1811 # for result publication in the study. Otherwise, if automatic
1812 # publication is switched on, default value is used for result name.
1814 # @return New GEOM.GEOM_Object, containing the created plane.
1816 # @ref tui_creation_plane "Example"
1817 @ManageTransactions("BasicOp")
1818 def MakePlaneFace(self, theFace, theTrimSize, theName=None):
1820 Create a plane, similar to the existing one, but with another size of representing face.
1823 theFace Referenced plane or LCS(Marker).
1824 theTrimSize New half size of a side of quadrangle face, representing the plane.
1825 theName Object name; when specified, this parameter is used
1826 for result publication in the study. Otherwise, if automatic
1827 publication is switched on, default value is used for result name.
1830 New GEOM.GEOM_Object, containing the created plane.
1832 # Example: see GEOM_TestAll.py
1833 theTrimSize, Parameters = ParseParameters(theTrimSize);
1834 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
1835 RaiseIfFailed("MakePlaneFace", self.BasicOp)
1836 anObj.SetParameters(Parameters)
1837 self._autoPublish(anObj, theName, "plane")
1840 ## Create a plane, passing through the 2 vectors
1841 # with center in a start point of the first vector.
1842 # @param theVec1 Vector, defining center point and plane direction.
1843 # @param theVec2 Vector, defining the plane normal direction.
1844 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1845 # @param theName Object name; when specified, this parameter is used
1846 # for result publication in the study. Otherwise, if automatic
1847 # publication is switched on, default value is used for result name.
1849 # @return New GEOM.GEOM_Object, containing the created plane.
1851 # @ref tui_creation_plane "Example"
1852 @ManageTransactions("BasicOp")
1853 def MakePlane2Vec(self, theVec1, theVec2, theTrimSize, theName=None):
1855 Create a plane, passing through the 2 vectors
1856 with center in a start point of the first vector.
1859 theVec1 Vector, defining center point and plane direction.
1860 theVec2 Vector, defining the plane normal direction.
1861 theTrimSize Half size of a side of quadrangle face, representing the plane.
1862 theName Object name; when specified, this parameter is used
1863 for result publication in the study. Otherwise, if automatic
1864 publication is switched on, default value is used for result name.
1867 New GEOM.GEOM_Object, containing the created plane.
1869 # Example: see GEOM_TestAll.py
1870 theTrimSize, Parameters = ParseParameters(theTrimSize);
1871 anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
1872 RaiseIfFailed("MakePlane2Vec", self.BasicOp)
1873 anObj.SetParameters(Parameters)
1874 self._autoPublish(anObj, theName, "plane")
1877 ## Create a plane, based on a Local coordinate system.
1878 # @param theLCS coordinate system, defining plane.
1879 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1880 # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
1881 # @param theName Object name; when specified, this parameter is used
1882 # for result publication in the study. Otherwise, if automatic
1883 # publication is switched on, default value is used for result name.
1885 # @return New GEOM.GEOM_Object, containing the created plane.
1887 # @ref tui_creation_plane "Example"
1888 @ManageTransactions("BasicOp")
1889 def MakePlaneLCS(self, theLCS, theTrimSize, theOrientation, theName=None):
1891 Create a plane, based on a Local coordinate system.
1894 theLCS coordinate system, defining plane.
1895 theTrimSize Half size of a side of quadrangle face, representing the plane.
1896 theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
1897 theName Object name; when specified, this parameter is used
1898 for result publication in the study. Otherwise, if automatic
1899 publication is switched on, default value is used for result name.
1902 New GEOM.GEOM_Object, containing the created plane.
1904 # Example: see GEOM_TestAll.py
1905 theTrimSize, Parameters = ParseParameters(theTrimSize);
1906 anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
1907 RaiseIfFailed("MakePlaneLCS", self.BasicOp)
1908 anObj.SetParameters(Parameters)
1909 self._autoPublish(anObj, theName, "plane")
1912 ## Create a local coordinate system.
1913 # @param OX,OY,OZ Three coordinates of coordinate system origin.
1914 # @param XDX,XDY,XDZ Three components of OX direction
1915 # @param YDX,YDY,YDZ Three components of OY direction
1916 # @param theName Object name; when specified, this parameter is used
1917 # for result publication in the study. Otherwise, if automatic
1918 # publication is switched on, default value is used for result name.
1920 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1922 # @ref swig_MakeMarker "Example"
1923 @ManageTransactions("BasicOp")
1924 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, theName=None):
1926 Create a local coordinate system.
1929 OX,OY,OZ Three coordinates of coordinate system origin.
1930 XDX,XDY,XDZ Three components of OX direction
1931 YDX,YDY,YDZ Three components of OY direction
1932 theName Object name; when specified, this parameter is used
1933 for result publication in the study. Otherwise, if automatic
1934 publication is switched on, default value is used for result name.
1937 New GEOM.GEOM_Object, containing the created coordinate system.
1939 # Example: see GEOM_TestAll.py
1940 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
1941 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
1942 RaiseIfFailed("MakeMarker", self.BasicOp)
1943 anObj.SetParameters(Parameters)
1944 self._autoPublish(anObj, theName, "lcs")
1947 ## Create a local coordinate system from shape.
1948 # @param theShape The initial shape to detect the coordinate system.
1949 # @param theName Object name; when specified, this parameter is used
1950 # for result publication in the study. Otherwise, if automatic
1951 # publication is switched on, default value is used for result name.
1953 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1955 # @ref tui_creation_lcs "Example"
1956 @ManageTransactions("BasicOp")
1957 def MakeMarkerFromShape(self, theShape, theName=None):
1959 Create a local coordinate system from shape.
1962 theShape The initial shape to detect the coordinate system.
1963 theName Object name; when specified, this parameter is used
1964 for result publication in the study. Otherwise, if automatic
1965 publication is switched on, default value is used for result name.
1968 New GEOM.GEOM_Object, containing the created coordinate system.
1970 anObj = self.BasicOp.MakeMarkerFromShape(theShape)
1971 RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
1972 self._autoPublish(anObj, theName, "lcs")
1975 ## Create a local coordinate system from point and two vectors.
1976 # @param theOrigin Point of coordinate system origin.
1977 # @param theXVec Vector of X direction
1978 # @param theYVec Vector of Y direction
1979 # @param theName Object name; when specified, this parameter is used
1980 # for result publication in the study. Otherwise, if automatic
1981 # publication is switched on, default value is used for result name.
1983 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1985 # @ref tui_creation_lcs "Example"
1986 @ManageTransactions("BasicOp")
1987 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec, theName=None):
1989 Create a local coordinate system from point and two vectors.
1992 theOrigin Point of coordinate system origin.
1993 theXVec Vector of X direction
1994 theYVec Vector of Y direction
1995 theName Object name; when specified, this parameter is used
1996 for result publication in the study. Otherwise, if automatic
1997 publication is switched on, default value is used for result name.
2000 New GEOM.GEOM_Object, containing the created coordinate system.
2003 anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
2004 RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
2005 self._autoPublish(anObj, theName, "lcs")
2008 # end of l3_basic_go
2011 ## @addtogroup l4_curves
2014 ## Create an arc of circle, passing through three given points.
2015 # @param thePnt1 Start point of the arc.
2016 # @param thePnt2 Middle point of the arc.
2017 # @param thePnt3 End point of the arc.
2018 # @param theName Object name; when specified, this parameter is used
2019 # for result publication in the study. Otherwise, if automatic
2020 # publication is switched on, default value is used for result name.
2022 # @return New GEOM.GEOM_Object, containing the created arc.
2024 # @ref swig_MakeArc "Example"
2025 @ManageTransactions("CurvesOp")
2026 def MakeArc(self, thePnt1, thePnt2, thePnt3, theName=None):
2028 Create an arc of circle, passing through three given points.
2031 thePnt1 Start point of the arc.
2032 thePnt2 Middle point of the arc.
2033 thePnt3 End point of the arc.
2034 theName Object name; when specified, this parameter is used
2035 for result publication in the study. Otherwise, if automatic
2036 publication is switched on, default value is used for result name.
2039 New GEOM.GEOM_Object, containing the created arc.
2041 # Example: see GEOM_TestAll.py
2042 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
2043 RaiseIfFailed("MakeArc", self.CurvesOp)
2044 self._autoPublish(anObj, theName, "arc")
2047 ## Create an arc of circle from a center and 2 points.
2048 # @param thePnt1 Center of the arc
2049 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
2050 # @param thePnt3 End point of the arc (Gives also a direction)
2051 # @param theSense Orientation of the arc
2052 # @param theName Object name; when specified, this parameter is used
2053 # for result publication in the study. Otherwise, if automatic
2054 # publication is switched on, default value is used for result name.
2056 # @return New GEOM.GEOM_Object, containing the created arc.
2058 # @ref swig_MakeArc "Example"
2059 @ManageTransactions("CurvesOp")
2060 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False, theName=None):
2062 Create an arc of circle from a center and 2 points.
2065 thePnt1 Center of the arc
2066 thePnt2 Start point of the arc. (Gives also the radius of the arc)
2067 thePnt3 End point of the arc (Gives also a direction)
2068 theSense Orientation of the arc
2069 theName Object name; when specified, this parameter is used
2070 for result publication in the study. Otherwise, if automatic
2071 publication is switched on, default value is used for result name.
2074 New GEOM.GEOM_Object, containing the created arc.
2076 # Example: see GEOM_TestAll.py
2077 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
2078 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
2079 self._autoPublish(anObj, theName, "arc")
2082 ## Create an arc of ellipse, of center and two points.
2083 # @param theCenter Center of the arc.
2084 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
2085 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2086 # @param theName Object name; when specified, this parameter is used
2087 # for result publication in the study. Otherwise, if automatic
2088 # publication is switched on, default value is used for result name.
2090 # @return New GEOM.GEOM_Object, containing the created arc.
2092 # @ref swig_MakeArc "Example"
2093 @ManageTransactions("CurvesOp")
2094 def MakeArcOfEllipse(self, theCenter, thePnt1, thePnt2, theName=None):
2096 Create an arc of ellipse, of center and two points.
2099 theCenter Center of the arc.
2100 thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
2101 thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2102 theName Object name; when specified, this parameter is used
2103 for result publication in the study. Otherwise, if automatic
2104 publication is switched on, default value is used for result name.
2107 New GEOM.GEOM_Object, containing the created arc.
2109 # Example: see GEOM_TestAll.py
2110 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
2111 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
2112 self._autoPublish(anObj, theName, "arc")
2115 ## Create a circle with given center, normal vector and radius.
2116 # @param thePnt Circle center.
2117 # @param theVec Vector, normal to the plane of the circle.
2118 # @param theR Circle radius.
2119 # @param theName Object name; when specified, this parameter is used
2120 # for result publication in the study. Otherwise, if automatic
2121 # publication is switched on, default value is used for result name.
2123 # @return New GEOM.GEOM_Object, containing the created circle.
2125 # @ref tui_creation_circle "Example"
2126 @ManageTransactions("CurvesOp")
2127 def MakeCircle(self, thePnt, theVec, theR, theName=None):
2129 Create a circle with given center, normal vector and radius.
2132 thePnt Circle center.
2133 theVec Vector, normal to the plane of the circle.
2135 theName Object name; when specified, this parameter is used
2136 for result publication in the study. Otherwise, if automatic
2137 publication is switched on, default value is used for result name.
2140 New GEOM.GEOM_Object, containing the created circle.
2142 # Example: see GEOM_TestAll.py
2143 theR, Parameters = ParseParameters(theR)
2144 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
2145 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
2146 anObj.SetParameters(Parameters)
2147 self._autoPublish(anObj, theName, "circle")
2150 ## Create a circle with given radius.
2151 # Center of the circle will be in the origin of global
2152 # coordinate system and normal vector will be codirected with Z axis
2153 # @param theR Circle radius.
2154 # @param theName Object name; when specified, this parameter is used
2155 # for result publication in the study. Otherwise, if automatic
2156 # publication is switched on, default value is used for result name.
2158 # @return New GEOM.GEOM_Object, containing the created circle.
2159 @ManageTransactions("CurvesOp")
2160 def MakeCircleR(self, theR, theName=None):
2162 Create a circle with given radius.
2163 Center of the circle will be in the origin of global
2164 coordinate system and normal vector will be codirected with Z axis
2168 theName Object name; when specified, this parameter is used
2169 for result publication in the study. Otherwise, if automatic
2170 publication is switched on, default value is used for result name.
2173 New GEOM.GEOM_Object, containing the created circle.
2175 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
2176 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
2177 self._autoPublish(anObj, theName, "circle")
2180 ## Create a circle, passing through three given points
2181 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2182 # @param theName Object name; when specified, this parameter is used
2183 # for result publication in the study. Otherwise, if automatic
2184 # publication is switched on, default value is used for result name.
2186 # @return New GEOM.GEOM_Object, containing the created circle.
2188 # @ref tui_creation_circle "Example"
2189 @ManageTransactions("CurvesOp")
2190 def MakeCircleThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
2192 Create a circle, passing through three given points
2195 thePnt1,thePnt2,thePnt3 Points, defining the circle.
2196 theName Object name; when specified, this parameter is used
2197 for result publication in the study. Otherwise, if automatic
2198 publication is switched on, default value is used for result name.
2201 New GEOM.GEOM_Object, containing the created circle.
2203 # Example: see GEOM_TestAll.py
2204 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
2205 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
2206 self._autoPublish(anObj, theName, "circle")
2209 ## Create a circle, with given point1 as center,
2210 # passing through the point2 as radius and laying in the plane,
2211 # defined by all three given points.
2212 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2213 # @param theName Object name; when specified, this parameter is used
2214 # for result publication in the study. Otherwise, if automatic
2215 # publication is switched on, default value is used for result name.
2217 # @return New GEOM.GEOM_Object, containing the created circle.
2219 # @ref swig_MakeCircle "Example"
2220 @ManageTransactions("CurvesOp")
2221 def MakeCircleCenter2Pnt(self, thePnt1, thePnt2, thePnt3, theName=None):
2223 Create a circle, with given point1 as center,
2224 passing through the point2 as radius and laying in the plane,
2225 defined by all three given points.
2228 thePnt1,thePnt2,thePnt3 Points, defining the circle.
2229 theName Object name; when specified, this parameter is used
2230 for result publication in the study. Otherwise, if automatic
2231 publication is switched on, default value is used for result name.
2234 New GEOM.GEOM_Object, containing the created circle.
2236 # Example: see GEOM_example6.py
2237 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
2238 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
2239 self._autoPublish(anObj, theName, "circle")
2242 ## Create an ellipse with given center, normal vector and radiuses.
2243 # @param thePnt Ellipse center.
2244 # @param theVec Vector, normal to the plane of the ellipse.
2245 # @param theRMajor Major ellipse radius.
2246 # @param theRMinor Minor ellipse radius.
2247 # @param theVecMaj Vector, direction of the ellipse's main axis.
2248 # @param theName Object name; when specified, this parameter is used
2249 # for result publication in the study. Otherwise, if automatic
2250 # publication is switched on, default value is used for result name.
2252 # @return New GEOM.GEOM_Object, containing the created ellipse.
2254 # @ref tui_creation_ellipse "Example"
2255 @ManageTransactions("CurvesOp")
2256 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None, theName=None):
2258 Create an ellipse with given center, normal vector and radiuses.
2261 thePnt Ellipse center.
2262 theVec Vector, normal to the plane of the ellipse.
2263 theRMajor Major ellipse radius.
2264 theRMinor Minor ellipse radius.
2265 theVecMaj Vector, direction of the ellipse's main axis.
2266 theName Object name; when specified, this parameter is used
2267 for result publication in the study. Otherwise, if automatic
2268 publication is switched on, default value is used for result name.
2271 New GEOM.GEOM_Object, containing the created ellipse.
2273 # Example: see GEOM_TestAll.py
2274 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
2275 if theVecMaj is not None:
2276 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
2278 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
2280 RaiseIfFailed("MakeEllipse", self.CurvesOp)
2281 anObj.SetParameters(Parameters)
2282 self._autoPublish(anObj, theName, "ellipse")
2285 ## Create an ellipse with given radiuses.
2286 # Center of the ellipse will be in the origin of global
2287 # coordinate system and normal vector will be codirected with Z axis
2288 # @param theRMajor Major ellipse radius.
2289 # @param theRMinor Minor ellipse radius.
2290 # @param theName Object name; when specified, this parameter is used
2291 # for result publication in the study. Otherwise, if automatic
2292 # publication is switched on, default value is used for result name.
2294 # @return New GEOM.GEOM_Object, containing the created ellipse.
2295 @ManageTransactions("CurvesOp")
2296 def MakeEllipseRR(self, theRMajor, theRMinor, theName=None):
2298 Create an ellipse with given radiuses.
2299 Center of the ellipse will be in the origin of global
2300 coordinate system and normal vector will be codirected with Z axis
2303 theRMajor Major ellipse radius.
2304 theRMinor Minor ellipse radius.
2305 theName Object name; when specified, this parameter is used
2306 for result publication in the study. Otherwise, if automatic
2307 publication is switched on, default value is used for result name.
2310 New GEOM.GEOM_Object, containing the created ellipse.
2312 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
2313 RaiseIfFailed("MakeEllipse", self.CurvesOp)
2314 self._autoPublish(anObj, theName, "ellipse")
2317 ## Create a polyline on the set of points.
2318 # @param thePoints Sequence of points for the polyline.
2319 # @param theIsClosed If True, build a closed wire.
2320 # @param theName Object name; when specified, this parameter is used
2321 # for result publication in the study. Otherwise, if automatic
2322 # publication is switched on, default value is used for result name.
2324 # @return New GEOM.GEOM_Object, containing the created polyline.
2326 # @ref tui_creation_curve "Example"
2327 @ManageTransactions("CurvesOp")
2328 def MakePolyline(self, thePoints, theIsClosed=False, theName=None):
2330 Create a polyline on the set of points.
2333 thePoints Sequence of points for the polyline.
2334 theIsClosed If True, build a closed wire.
2335 theName Object name; when specified, this parameter is used
2336 for result publication in the study. Otherwise, if automatic
2337 publication is switched on, default value is used for result name.
2340 New GEOM.GEOM_Object, containing the created polyline.
2342 # Example: see GEOM_TestAll.py
2343 anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
2344 RaiseIfFailed("MakePolyline", self.CurvesOp)
2345 self._autoPublish(anObj, theName, "polyline")
2348 ## Create bezier curve on the set of points.
2349 # @param thePoints Sequence of points for the bezier curve.
2350 # @param theIsClosed If True, build a closed curve.
2351 # @param theName Object name; when specified, this parameter is used
2352 # for result publication in the study. Otherwise, if automatic
2353 # publication is switched on, default value is used for result name.
2355 # @return New GEOM.GEOM_Object, containing the created bezier curve.
2357 # @ref tui_creation_curve "Example"
2358 @ManageTransactions("CurvesOp")
2359 def MakeBezier(self, thePoints, theIsClosed=False, theName=None):
2361 Create bezier curve on the set of points.
2364 thePoints Sequence of points for the bezier curve.
2365 theIsClosed If True, build a closed curve.
2366 theName Object name; when specified, this parameter is used
2367 for result publication in the study. Otherwise, if automatic
2368 publication is switched on, default value is used for result name.
2371 New GEOM.GEOM_Object, containing the created bezier curve.
2373 # Example: see GEOM_TestAll.py
2374 anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
2375 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
2376 self._autoPublish(anObj, theName, "bezier")
2379 ## Create B-Spline curve on the set of points.
2380 # @param thePoints Sequence of points for the B-Spline curve.
2381 # @param theIsClosed If True, build a closed curve.
2382 # @param theDoReordering If TRUE, the algo does not follow the order of
2383 # \a thePoints but searches for the closest vertex.
2384 # @param theName Object name; when specified, this parameter is used
2385 # for result publication in the study. Otherwise, if automatic
2386 # publication is switched on, default value is used for result name.
2388 # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2390 # @ref tui_creation_curve "Example"
2391 @ManageTransactions("CurvesOp")
2392 def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False, theName=None):
2394 Create B-Spline curve on the set of points.
2397 thePoints Sequence of points for the B-Spline curve.
2398 theIsClosed If True, build a closed curve.
2399 theDoReordering If True, the algo does not follow the order of
2400 thePoints but searches for the closest vertex.
2401 theName Object name; when specified, this parameter is used
2402 for result publication in the study. Otherwise, if automatic
2403 publication is switched on, default value is used for result name.
2406 New GEOM.GEOM_Object, containing the created B-Spline curve.
2408 # Example: see GEOM_TestAll.py
2409 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
2410 RaiseIfFailed("MakeInterpol", self.CurvesOp)
2411 self._autoPublish(anObj, theName, "bspline")
2414 ## Create B-Spline curve on the set of points.
2415 # @param thePoints Sequence of points for the B-Spline curve.
2416 # @param theFirstVec Vector object, defining the curve direction at its first point.
2417 # @param theLastVec Vector object, defining the curve direction at its last point.
2418 # @param theName Object name; when specified, this parameter is used
2419 # for result publication in the study. Otherwise, if automatic
2420 # publication is switched on, default value is used for result name.
2422 # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2424 # @ref tui_creation_curve "Example"
2425 @ManageTransactions("CurvesOp")
2426 def MakeInterpolWithTangents(self, thePoints, theFirstVec, theLastVec, theName=None):
2428 Create B-Spline curve on the set of points.
2431 thePoints Sequence of points for the B-Spline curve.
2432 theFirstVec Vector object, defining the curve direction at its first point.
2433 theLastVec Vector object, defining the curve direction at its last point.
2434 theName Object name; when specified, this parameter is used
2435 for result publication in the study. Otherwise, if automatic
2436 publication is switched on, default value is used for result name.
2439 New GEOM.GEOM_Object, containing the created B-Spline curve.
2441 # Example: see GEOM_TestAll.py
2442 anObj = self.CurvesOp.MakeSplineInterpolWithTangents(thePoints, theFirstVec, theLastVec)
2443 RaiseIfFailed("MakeInterpolWithTangents", self.CurvesOp)
2444 self._autoPublish(anObj, theName, "bspline")
2447 ## Creates a curve using the parametric definition of the basic points.
2448 # @param thexExpr parametric equation of the coordinates X.
2449 # @param theyExpr parametric equation of the coordinates Y.
2450 # @param thezExpr parametric equation of the coordinates Z.
2451 # @param theParamMin the minimal value of the parameter.
2452 # @param theParamMax the maximum value of the parameter.
2453 # @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2454 # @param theCurveType the type of the curve,
2455 # one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2456 # @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.
2457 # @param theName Object name; when specified, this parameter is used
2458 # for result publication in the study. Otherwise, if automatic
2459 # publication is switched on, default value is used for result name.
2461 # @return New GEOM.GEOM_Object, containing the created curve.
2463 # @ref tui_creation_curve "Example"
2464 @ManageTransactions("CurvesOp")
2465 def MakeCurveParametric(self, thexExpr, theyExpr, thezExpr,
2466 theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False, theName=None ):
2468 Creates a curve using the parametric definition of the basic points.
2471 thexExpr parametric equation of the coordinates X.
2472 theyExpr parametric equation of the coordinates Y.
2473 thezExpr parametric equation of the coordinates Z.
2474 theParamMin the minimal value of the parameter.
2475 theParamMax the maximum value of the parameter.
2476 theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2477 theCurveType the type of the curve,
2478 one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2479 theNewMethod flag for switching to the new method if the flag is set to false a deprecated
2480 method is used which can lead to a bug.
2481 theName Object name; when specified, this parameter is used
2482 for result publication in the study. Otherwise, if automatic
2483 publication is switched on, default value is used for result name.
2486 New GEOM.GEOM_Object, containing the created curve.
2488 theParamMin,theParamMax,theParamStep,Parameters = ParseParameters(theParamMin,theParamMax,theParamStep)
2490 anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
2492 anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
2493 RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
2494 anObj.SetParameters(Parameters)
2495 self._autoPublish(anObj, theName, "curve")
2498 ## Create an isoline curve on a face.
2499 # @param theFace the face for which an isoline is created.
2500 # @param IsUIsoline True for U-isoline creation; False for V-isoline
2502 # @param theParameter the U parameter for U-isoline or V parameter
2504 # @param theName Object name; when specified, this parameter is used
2505 # for result publication in the study. Otherwise, if automatic
2506 # publication is switched on, default value is used for result name.
2508 # @return New GEOM.GEOM_Object, containing the created isoline edge or
2509 # a compound of edges.
2511 # @ref tui_creation_curve "Example"
2512 @ManageTransactions("CurvesOp")
2513 def MakeIsoline(self, theFace, IsUIsoline, theParameter, theName=None):
2515 Create an isoline curve on a face.
2518 theFace the face for which an isoline is created.
2519 IsUIsoline True for U-isoline creation; False for V-isoline
2521 theParameter the U parameter for U-isoline or V parameter
2523 theName Object name; when specified, this parameter is used
2524 for result publication in the study. Otherwise, if automatic
2525 publication is switched on, default value is used for result name.
2528 New GEOM.GEOM_Object, containing the created isoline edge or a
2531 # Example: see GEOM_TestAll.py
2532 anObj = self.CurvesOp.MakeIsoline(theFace, IsUIsoline, theParameter)
2533 RaiseIfFailed("MakeIsoline", self.CurvesOp)
2535 self._autoPublish(anObj, theName, "U-Isoline")
2537 self._autoPublish(anObj, theName, "V-Isoline")
2543 ## @addtogroup l3_sketcher
2546 ## Create a sketcher (wire or face), following the textual description,
2547 # passed through <VAR>theCommand</VAR> argument. \n
2548 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
2549 # Format of the description string have to be the following:
2551 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
2554 # - x1, y1 are coordinates of the first sketcher point (zero by default),
2556 # - "R angle" : Set the direction by angle
2557 # - "D dx dy" : Set the direction by DX & DY
2560 # - "TT x y" : Create segment by point at X & Y
2561 # - "T dx dy" : Create segment by point with DX & DY
2562 # - "L length" : Create segment by direction & Length
2563 # - "IX x" : Create segment by direction & Intersect. X
2564 # - "IY y" : Create segment by direction & Intersect. Y
2567 # - "C radius length" : Create arc by direction, radius and length(in degree)
2568 # - "AA x y": Create arc by point at X & Y
2569 # - "A dx dy" : Create arc by point with DX & DY
2570 # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
2571 # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
2572 # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
2573 # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2576 # - "WW" : Close Wire (to finish)
2577 # - "WF" : Close Wire and build face (to finish)
2580 # - Flag1 (= reverse) is 0 or 2 ...
2581 # - if 0 the drawn arc is the one of lower angle (< Pi)
2582 # - if 2 the drawn arc ius the one of greater angle (> Pi)
2585 # - Flag2 (= control tolerance) is 0 or 1 ...
2586 # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
2587 # - if 1 the wire is built only if the end point is on the arc
2588 # with a tolerance of 10^-7 on the distance else the creation fails
2590 # @param theCommand String, defining the sketcher in local
2591 # coordinates of the working plane.
2592 # @param theWorkingPlane Nine double values, defining origin,
2593 # OZ and OX directions of the working plane.
2594 # @param theName Object name; when specified, this parameter is used
2595 # for result publication in the study. Otherwise, if automatic
2596 # publication is switched on, default value is used for result name.
2598 # @return New GEOM.GEOM_Object, containing the created wire.
2600 # @ref tui_sketcher_page "Example"
2601 @ManageTransactions("CurvesOp")
2602 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0], theName=None):
2604 Create a sketcher (wire or face), following the textual description, passed
2605 through theCommand argument.
2606 Edges of the resulting wire or face will be arcs of circles and/or linear segments.
2607 Format of the description string have to be the following:
2608 "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
2610 - x1, y1 are coordinates of the first sketcher point (zero by default),
2612 - "R angle" : Set the direction by angle
2613 - "D dx dy" : Set the direction by DX & DY
2615 - "TT x y" : Create segment by point at X & Y
2616 - "T dx dy" : Create segment by point with DX & DY
2617 - "L length" : Create segment by direction & Length
2618 - "IX x" : Create segment by direction & Intersect. X
2619 - "IY y" : Create segment by direction & Intersect. Y
2621 - "C radius length" : Create arc by direction, radius and length(in degree)
2622 - "AA x y": Create arc by point at X & Y
2623 - "A dx dy" : Create arc by point with DX & DY
2624 - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
2625 - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
2626 - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
2627 - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2629 - "WW" : Close Wire (to finish)
2630 - "WF" : Close Wire and build face (to finish)
2632 - Flag1 (= reverse) is 0 or 2 ...
2633 - if 0 the drawn arc is the one of lower angle (< Pi)
2634 - if 2 the drawn arc ius the one of greater angle (> Pi)
2636 - Flag2 (= control tolerance) is 0 or 1 ...
2637 - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
2638 - if 1 the wire is built only if the end point is on the arc
2639 with a tolerance of 10^-7 on the distance else the creation fails
2642 theCommand String, defining the sketcher in local
2643 coordinates of the working plane.
2644 theWorkingPlane Nine double values, defining origin,
2645 OZ and OX directions of the working plane.
2646 theName Object name; when specified, this parameter is used
2647 for result publication in the study. Otherwise, if automatic
2648 publication is switched on, default value is used for result name.
2651 New GEOM.GEOM_Object, containing the created wire.
2653 # Example: see GEOM_TestAll.py
2654 theCommand,Parameters = ParseSketcherCommand(theCommand)
2655 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
2656 RaiseIfFailed("MakeSketcher", self.CurvesOp)
2657 anObj.SetParameters(Parameters)
2658 self._autoPublish(anObj, theName, "wire")
2661 ## Create a sketcher (wire or face), following the textual description,
2662 # passed through <VAR>theCommand</VAR> argument. \n
2663 # For format of the description string see MakeSketcher() method.\n
2664 # @param theCommand String, defining the sketcher in local
2665 # coordinates of the working plane.
2666 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2667 # @param theName Object name; when specified, this parameter is used
2668 # for result publication in the study. Otherwise, if automatic
2669 # publication is switched on, default value is used for result name.
2671 # @return New GEOM.GEOM_Object, containing the created wire.
2673 # @ref tui_sketcher_page "Example"
2674 @ManageTransactions("CurvesOp")
2675 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane, theName=None):
2677 Create a sketcher (wire or face), following the textual description,
2678 passed through theCommand argument.
2679 For format of the description string see geompy.MakeSketcher() method.
2682 theCommand String, defining the sketcher in local
2683 coordinates of the working plane.
2684 theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2685 theName Object name; when specified, this parameter is used
2686 for result publication in the study. Otherwise, if automatic
2687 publication is switched on, default value is used for result name.
2690 New GEOM.GEOM_Object, containing the created wire.
2692 theCommand,Parameters = ParseSketcherCommand(theCommand)
2693 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
2694 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
2695 anObj.SetParameters(Parameters)
2696 self._autoPublish(anObj, theName, "wire")
2699 ## Obtain a 2D sketcher interface
2700 # @return An instance of @ref gsketcher.Sketcher2D "Sketcher2D" interface
2701 def Sketcher2D (self):
2703 Obtain a 2D sketcher interface.
2706 sk = geompy.Sketcher2D()
2708 sk.addSegmentRelative(15, 70)
2709 sk.addSegmentPerpY(50)
2710 sk.addArcRadiusRelative(25, 15, 14.5, 0)
2711 sk.addArcCenterAbsolute(1, 1, 50, 50, 0, 0)
2712 sk.addArcDirectionRadiusLength(20, 20, 101, 162.13)
2714 Sketch_1 = sk.wire(geomObj_1)
2716 sk = Sketcher2D (self)
2719 ## Create a sketcher wire, following the numerical description,
2720 # passed through <VAR>theCoordinates</VAR> argument. \n
2721 # @param theCoordinates double values, defining points to create a wire,
2723 # @param theName Object name; when specified, this parameter is used
2724 # for result publication in the study. Otherwise, if automatic
2725 # publication is switched on, default value is used for result name.
2727 # @return New GEOM.GEOM_Object, containing the created wire.
2729 # @ref tui_3dsketcher_page "Example"
2730 @ManageTransactions("CurvesOp")
2731 def Make3DSketcher(self, theCoordinates, theName=None):
2733 Create a sketcher wire, following the numerical description,
2734 passed through theCoordinates argument.
2737 theCoordinates double values, defining points to create a wire,
2739 theName Object name; when specified, this parameter is used
2740 for result publication in the study. Otherwise, if automatic
2741 publication is switched on, default value is used for result name.
2744 New GEOM_Object, containing the created wire.
2746 theCoordinates,Parameters = ParseParameters(theCoordinates)
2747 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
2748 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
2749 anObj.SetParameters(Parameters)
2750 self._autoPublish(anObj, theName, "wire")
2753 ## Obtain a 3D sketcher interface
2754 # @return An instance of @ref gsketcher.Sketcher3D "Sketcher3D" interface
2756 # @ref tui_3dsketcher_page "Example"
2757 def Sketcher3D (self):
2759 Obtain a 3D sketcher interface.
2762 sk = geompy.Sketcher3D()
2763 sk.addPointsAbsolute(0,0,0, 70,0,0)
2764 sk.addPointsRelative(0, 0, 130)
2765 sk.addPointAnglesLength("OXY", 50, 0, 100)
2766 sk.addPointAnglesLength("OXZ", 30, 80, 130)
2768 a3D_Sketcher_1 = sk.wire()
2770 sk = Sketcher3D (self)
2773 ## Obtain a 2D polyline creation interface
2774 # @return An instance of @ref gsketcher.Polyline2D "Polyline2D" interface
2776 # @ref tui_3dsketcher_page "Example"
2777 def Polyline2D (self):
2779 Obtain a 2D polyline creation interface.
2782 pl = geompy.Polyline2D()
2783 pl.addSection("section 1", GEOM.Polyline, True)
2784 pl.addPoints(0, 0, 10, 0, 10, 10)
2785 pl.addSection("section 2", GEOM.Interpolation, False)
2786 pl.addPoints(20, 0, 30, 0, 30, 10)
2787 resultObj = pl.result(WorkingPlane)
2789 pl = Polyline2D (self)
2792 # end of l3_sketcher
2795 ## @addtogroup l3_3d_primitives
2798 ## Create a box by coordinates of two opposite vertices.
2800 # @param x1,y1,z1 double values, defining first point it.
2801 # @param x2,y2,z2 double values, defining first point it.
2802 # @param theName Object name; when specified, this parameter is used
2803 # for result publication in the study. Otherwise, if automatic
2804 # publication is switched on, default value is used for result name.
2806 # @return New GEOM.GEOM_Object, containing the created box.
2808 # @ref tui_creation_box "Example"
2809 def MakeBox(self, x1, y1, z1, x2, y2, z2, theName=None):
2811 Create a box by coordinates of two opposite vertices.
2814 x1,y1,z1 double values, defining first point.
2815 x2,y2,z2 double values, defining second point.
2816 theName Object name; when specified, this parameter is used
2817 for result publication in the study. Otherwise, if automatic
2818 publication is switched on, default value is used for result name.
2821 New GEOM.GEOM_Object, containing the created box.
2823 # Example: see GEOM_TestAll.py
2824 pnt1 = self.MakeVertex(x1,y1,z1)
2825 pnt2 = self.MakeVertex(x2,y2,z2)
2826 # note: auto-publishing is done in self.MakeBoxTwoPnt()
2827 return self.MakeBoxTwoPnt(pnt1, pnt2, theName)
2829 ## Create a box with specified dimensions along the coordinate axes
2830 # and with edges, parallel to the coordinate axes.
2831 # Center of the box will be at point (DX/2, DY/2, DZ/2).
2832 # @param theDX Length of Box edges, parallel to OX axis.
2833 # @param theDY Length of Box edges, parallel to OY axis.
2834 # @param theDZ Length of Box edges, parallel to OZ axis.
2835 # @param theName Object name; when specified, this parameter is used
2836 # for result publication in the study. Otherwise, if automatic
2837 # publication is switched on, default value is used for result name.
2839 # @return New GEOM.GEOM_Object, containing the created box.
2841 # @ref tui_creation_box "Example"
2842 @ManageTransactions("PrimOp")
2843 def MakeBoxDXDYDZ(self, theDX, theDY, theDZ, theName=None):
2845 Create a box with specified dimensions along the coordinate axes
2846 and with edges, parallel to the coordinate axes.
2847 Center of the box will be at point (DX/2, DY/2, DZ/2).
2850 theDX Length of Box edges, parallel to OX axis.
2851 theDY Length of Box edges, parallel to OY axis.
2852 theDZ Length of Box edges, parallel to OZ axis.
2853 theName Object name; when specified, this parameter is used
2854 for result publication in the study. Otherwise, if automatic
2855 publication is switched on, default value is used for result name.
2858 New GEOM.GEOM_Object, containing the created box.
2860 # Example: see GEOM_TestAll.py
2861 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
2862 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
2863 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
2864 anObj.SetParameters(Parameters)
2865 self._autoPublish(anObj, theName, "box")
2868 ## Create a box with two specified opposite vertices,
2869 # and with edges, parallel to the coordinate axes
2870 # @param thePnt1 First of two opposite vertices.
2871 # @param thePnt2 Second of two opposite vertices.
2872 # @param theName Object name; when specified, this parameter is used
2873 # for result publication in the study. Otherwise, if automatic
2874 # publication is switched on, default value is used for result name.
2876 # @return New GEOM.GEOM_Object, containing the created box.
2878 # @ref tui_creation_box "Example"
2879 @ManageTransactions("PrimOp")
2880 def MakeBoxTwoPnt(self, thePnt1, thePnt2, theName=None):
2882 Create a box with two specified opposite vertices,
2883 and with edges, parallel to the coordinate axes
2886 thePnt1 First of two opposite vertices.
2887 thePnt2 Second of two opposite vertices.
2888 theName Object name; when specified, this parameter is used
2889 for result publication in the study. Otherwise, if automatic
2890 publication is switched on, default value is used for result name.
2893 New GEOM.GEOM_Object, containing the created box.
2895 # Example: see GEOM_TestAll.py
2896 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
2897 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
2898 self._autoPublish(anObj, theName, "box")
2901 ## Create a face with specified dimensions with edges parallel to coordinate axes.
2902 # @param theH height of Face.
2903 # @param theW width of Face.
2904 # @param theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2905 # @param theName Object name; when specified, this parameter is used
2906 # for result publication in the study. Otherwise, if automatic
2907 # publication is switched on, default value is used for result name.
2909 # @return New GEOM.GEOM_Object, containing the created face.
2911 # @ref tui_creation_face "Example"
2912 @ManageTransactions("PrimOp")
2913 def MakeFaceHW(self, theH, theW, theOrientation, theName=None):
2915 Create a face with specified dimensions with edges parallel to coordinate axes.
2918 theH height of Face.
2920 theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2921 theName Object name; when specified, this parameter is used
2922 for result publication in the study. Otherwise, if automatic
2923 publication is switched on, default value is used for result name.
2926 New GEOM.GEOM_Object, containing the created face.
2928 # Example: see GEOM_TestAll.py
2929 theH,theW,Parameters = ParseParameters(theH, theW)
2930 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
2931 RaiseIfFailed("MakeFaceHW", self.PrimOp)
2932 anObj.SetParameters(Parameters)
2933 self._autoPublish(anObj, theName, "rectangle")
2936 ## Create a face from another plane and two sizes,
2937 # vertical size and horisontal size.
2938 # @param theObj Normale vector to the creating face or
2940 # @param theH Height (vertical size).
2941 # @param theW Width (horisontal size).
2942 # @param theName Object name; when specified, this parameter is used
2943 # for result publication in the study. Otherwise, if automatic
2944 # publication is switched on, default value is used for result name.
2946 # @return New GEOM.GEOM_Object, containing the created face.
2948 # @ref tui_creation_face "Example"
2949 @ManageTransactions("PrimOp")
2950 def MakeFaceObjHW(self, theObj, theH, theW, theName=None):
2952 Create a face from another plane and two sizes,
2953 vertical size and horisontal size.
2956 theObj Normale vector to the creating face or
2958 theH Height (vertical size).
2959 theW Width (horisontal size).
2960 theName Object name; when specified, this parameter is used
2961 for result publication in the study. Otherwise, if automatic
2962 publication is switched on, default value is used for result name.
2965 New GEOM_Object, containing the created face.
2967 # Example: see GEOM_TestAll.py
2968 theH,theW,Parameters = ParseParameters(theH, theW)
2969 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
2970 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
2971 anObj.SetParameters(Parameters)
2972 self._autoPublish(anObj, theName, "rectangle")
2975 ## Create a disk with given center, normal vector and radius.
2976 # @param thePnt Disk center.
2977 # @param theVec Vector, normal to the plane of the disk.
2978 # @param theR Disk radius.
2979 # @param theName Object name; when specified, this parameter is used
2980 # for result publication in the study. Otherwise, if automatic
2981 # publication is switched on, default value is used for result name.
2983 # @return New GEOM.GEOM_Object, containing the created disk.
2985 # @ref tui_creation_disk "Example"
2986 @ManageTransactions("PrimOp")
2987 def MakeDiskPntVecR(self, thePnt, theVec, theR, theName=None):
2989 Create a disk with given center, normal vector and radius.
2993 theVec Vector, normal to the plane of the disk.
2995 theName Object name; when specified, this parameter is used
2996 for result publication in the study. Otherwise, if automatic
2997 publication is switched on, default value is used for result name.
3000 New GEOM.GEOM_Object, containing the created disk.
3002 # Example: see GEOM_TestAll.py
3003 theR,Parameters = ParseParameters(theR)
3004 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
3005 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
3006 anObj.SetParameters(Parameters)
3007 self._autoPublish(anObj, theName, "disk")
3010 ## Create a disk, passing through three given points
3011 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
3012 # @param theName Object name; when specified, this parameter is used
3013 # for result publication in the study. Otherwise, if automatic
3014 # publication is switched on, default value is used for result name.
3016 # @return New GEOM.GEOM_Object, containing the created disk.
3018 # @ref tui_creation_disk "Example"
3019 @ManageTransactions("PrimOp")
3020 def MakeDiskThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
3022 Create a disk, passing through three given points
3025 thePnt1,thePnt2,thePnt3 Points, defining the disk.
3026 theName Object name; when specified, this parameter is used
3027 for result publication in the study. Otherwise, if automatic
3028 publication is switched on, default value is used for result name.
3031 New GEOM.GEOM_Object, containing the created disk.
3033 # Example: see GEOM_TestAll.py
3034 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
3035 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
3036 self._autoPublish(anObj, theName, "disk")
3039 ## Create a disk with specified dimensions along OX-OY coordinate axes.
3040 # @param theR Radius of Face.
3041 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
3042 # @param theName Object name; when specified, this parameter is used
3043 # for result publication in the study. Otherwise, if automatic
3044 # publication is switched on, default value is used for result name.
3046 # @return New GEOM.GEOM_Object, containing the created disk.
3048 # @ref tui_creation_face "Example"
3049 @ManageTransactions("PrimOp")
3050 def MakeDiskR(self, theR, theOrientation, theName=None):
3052 Create a disk with specified dimensions along OX-OY coordinate axes.
3055 theR Radius of Face.
3056 theOrientation set the orientation belong axis OXY or OYZ or OZX
3057 theName Object name; when specified, this parameter is used
3058 for result publication in the study. Otherwise, if automatic
3059 publication is switched on, default value is used for result name.
3062 New GEOM.GEOM_Object, containing the created disk.
3065 Disk3 = geompy.MakeDiskR(100., 1)
3067 # Example: see GEOM_TestAll.py
3068 theR,Parameters = ParseParameters(theR)
3069 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
3070 RaiseIfFailed("MakeDiskR", self.PrimOp)
3071 anObj.SetParameters(Parameters)
3072 self._autoPublish(anObj, theName, "disk")
3075 ## Create a cylinder with given base point, axis, radius and height.
3076 # @param thePnt Central point of cylinder base.
3077 # @param theAxis Cylinder axis.
3078 # @param theR Cylinder radius.
3079 # @param theH Cylinder height.
3080 # @param theName Object name; when specified, this parameter is used
3081 # for result publication in the study. Otherwise, if automatic
3082 # publication is switched on, default value is used for result name.
3084 # @return New GEOM.GEOM_Object, containing the created cylinder.
3086 # @ref tui_creation_cylinder "Example"
3087 @ManageTransactions("PrimOp")
3088 def MakeCylinder(self, thePnt, theAxis, theR, theH, theName=None):
3090 Create a cylinder with given base point, axis, radius and height.
3093 thePnt Central point of cylinder base.
3094 theAxis Cylinder axis.
3095 theR Cylinder radius.
3096 theH Cylinder height.
3097 theName Object name; when specified, this parameter is used
3098 for result publication in the study. Otherwise, if automatic
3099 publication is switched on, default value is used for result name.
3102 New GEOM.GEOM_Object, containing the created cylinder.
3104 # Example: see GEOM_TestAll.py
3105 theR,theH,Parameters = ParseParameters(theR, theH)
3106 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
3107 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
3108 anObj.SetParameters(Parameters)
3109 self._autoPublish(anObj, theName, "cylinder")
3112 ## Create a portion of cylinder with given base point, axis, radius, height and angle.
3113 # @param thePnt Central point of cylinder base.
3114 # @param theAxis Cylinder axis.
3115 # @param theR Cylinder radius.
3116 # @param theH Cylinder height.
3117 # @param theA Cylinder angle in radians.
3118 # @param theName Object name; when specified, this parameter is used
3119 # for result publication in the study. Otherwise, if automatic
3120 # publication is switched on, default value is used for result name.
3122 # @return New GEOM.GEOM_Object, containing the created cylinder.
3124 # @ref tui_creation_cylinder "Example"
3125 @ManageTransactions("PrimOp")
3126 def MakeCylinderA(self, thePnt, theAxis, theR, theH, theA, theName=None):
3128 Create a portion of cylinder with given base point, axis, radius, height and angle.
3131 thePnt Central point of cylinder base.
3132 theAxis Cylinder axis.
3133 theR Cylinder radius.
3134 theH Cylinder height.
3135 theA Cylinder angle in radians.
3136 theName Object name; when specified, this parameter is used
3137 for result publication in the study. Otherwise, if automatic
3138 publication is switched on, default value is used for result name.
3141 New GEOM.GEOM_Object, containing the created cylinder.
3143 # Example: see GEOM_TestAll.py
3145 if isinstance(theA,str):
3147 theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
3149 theA = theA*math.pi/180.
3150 if theA<=0. or theA>=2*math.pi:
3151 raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
3152 anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
3153 RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
3154 anObj.SetParameters(Parameters)
3155 self._autoPublish(anObj, theName, "cylinder")
3158 ## Create a cylinder with given radius and height at
3159 # the origin of coordinate system. Axis of the cylinder
3160 # will be collinear to the OZ axis of the coordinate system.
3161 # @param theR Cylinder radius.
3162 # @param theH Cylinder height.
3163 # @param theName Object name; when specified, this parameter is used
3164 # for result publication in the study. Otherwise, if automatic
3165 # publication is switched on, default value is used for result name.
3167 # @return New GEOM.GEOM_Object, containing the created cylinder.
3169 # @ref tui_creation_cylinder "Example"
3170 @ManageTransactions("PrimOp")
3171 def MakeCylinderRH(self, theR, theH, theName=None):
3173 Create a cylinder with given radius and height at
3174 the origin of coordinate system. Axis of the cylinder
3175 will be collinear to the OZ axis of the coordinate system.
3178 theR Cylinder radius.
3179 theH Cylinder height.
3180 theName Object name; when specified, this parameter is used
3181 for result publication in the study. Otherwise, if automatic
3182 publication is switched on, default value is used for result name.
3185 New GEOM.GEOM_Object, containing the created cylinder.
3187 # Example: see GEOM_TestAll.py
3188 theR,theH,Parameters = ParseParameters(theR, theH)
3189 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
3190 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
3191 anObj.SetParameters(Parameters)
3192 self._autoPublish(anObj, theName, "cylinder")
3195 ## Create a portion of cylinder with given radius, height and angle at
3196 # the origin of coordinate system. Axis of the cylinder
3197 # will be collinear to the OZ axis of the coordinate system.
3198 # @param theR Cylinder radius.
3199 # @param theH Cylinder height.
3200 # @param theA Cylinder angle in radians.
3201 # @param theName Object name; when specified, this parameter is used
3202 # for result publication in the study. Otherwise, if automatic
3203 # publication is switched on, default value is used for result name.
3205 # @return New GEOM.GEOM_Object, containing the created cylinder.
3207 # @ref tui_creation_cylinder "Example"
3208 @ManageTransactions("PrimOp")
3209 def MakeCylinderRHA(self, theR, theH, theA, theName=None):
3211 Create a portion of cylinder with given radius, height and angle at
3212 the origin of coordinate system. Axis of the cylinder
3213 will be collinear to the OZ axis of the coordinate system.
3216 theR Cylinder radius.
3217 theH Cylinder height.
3218 theA Cylinder angle in radians.
3219 theName Object name; when specified, this parameter is used
3220 for result publication in the study. Otherwise, if automatic
3221 publication is switched on, default value is used for result name.
3224 New GEOM.GEOM_Object, containing the created cylinder.
3226 # Example: see GEOM_TestAll.py
3228 if isinstance(theA,str):
3230 theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
3232 theA = theA*math.pi/180.
3233 if theA<=0. or theA>=2*math.pi:
3234 raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
3235 anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
3236 RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
3237 anObj.SetParameters(Parameters)
3238 self._autoPublish(anObj, theName, "cylinder")
3241 ## Create a sphere with given center and radius.
3242 # @param thePnt Sphere center.
3243 # @param theR Sphere radius.
3244 # @param theName Object name; when specified, this parameter is used
3245 # for result publication in the study. Otherwise, if automatic
3246 # publication is switched on, default value is used for result name.
3248 # @return New GEOM.GEOM_Object, containing the created sphere.
3250 # @ref tui_creation_sphere "Example"
3251 @ManageTransactions("PrimOp")
3252 def MakeSpherePntR(self, thePnt, theR, theName=None):
3254 Create a sphere with given center and radius.
3257 thePnt Sphere center.
3259 theName Object name; when specified, this parameter is used
3260 for result publication in the study. Otherwise, if automatic
3261 publication is switched on, default value is used for result name.
3264 New GEOM.GEOM_Object, containing the created sphere.
3266 # Example: see GEOM_TestAll.py
3267 theR,Parameters = ParseParameters(theR)
3268 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
3269 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
3270 anObj.SetParameters(Parameters)
3271 self._autoPublish(anObj, theName, "sphere")
3274 ## Create a sphere with given center and radius.
3275 # @param x,y,z Coordinates of sphere center.
3276 # @param theR Sphere radius.
3277 # @param theName Object name; when specified, this parameter is used
3278 # for result publication in the study. Otherwise, if automatic
3279 # publication is switched on, default value is used for result name.
3281 # @return New GEOM.GEOM_Object, containing the created sphere.
3283 # @ref tui_creation_sphere "Example"
3284 def MakeSphere(self, x, y, z, theR, theName=None):
3286 Create a sphere with given center and radius.
3289 x,y,z Coordinates of sphere center.
3291 theName Object name; when specified, this parameter is used
3292 for result publication in the study. Otherwise, if automatic
3293 publication is switched on, default value is used for result name.
3296 New GEOM.GEOM_Object, containing the created sphere.
3298 # Example: see GEOM_TestAll.py
3299 point = self.MakeVertex(x, y, z)
3300 # note: auto-publishing is done in self.MakeSpherePntR()
3301 anObj = self.MakeSpherePntR(point, theR, theName)
3304 ## Create a sphere with given radius at the origin of coordinate system.
3305 # @param theR Sphere radius.
3306 # @param theName Object name; when specified, this parameter is used
3307 # for result publication in the study. Otherwise, if automatic
3308 # publication is switched on, default value is used for result name.
3310 # @return New GEOM.GEOM_Object, containing the created sphere.
3312 # @ref tui_creation_sphere "Example"
3313 @ManageTransactions("PrimOp")
3314 def MakeSphereR(self, theR, theName=None):
3316 Create a sphere with given radius at the origin of coordinate system.
3320 theName Object name; when specified, this parameter is used
3321 for result publication in the study. Otherwise, if automatic
3322 publication is switched on, default value is used for result name.
3325 New GEOM.GEOM_Object, containing the created sphere.
3327 # Example: see GEOM_TestAll.py
3328 theR,Parameters = ParseParameters(theR)
3329 anObj = self.PrimOp.MakeSphereR(theR)
3330 RaiseIfFailed("MakeSphereR", self.PrimOp)
3331 anObj.SetParameters(Parameters)
3332 self._autoPublish(anObj, theName, "sphere")
3335 ## Create a cone with given base point, axis, height and radiuses.
3336 # @param thePnt Central point of the first cone base.
3337 # @param theAxis Cone axis.
3338 # @param theR1 Radius of the first cone base.
3339 # @param theR2 Radius of the second cone base.
3340 # \note If both radiuses are non-zero, the cone will be truncated.
3341 # \note If the radiuses are equal, a cylinder will be created instead.
3342 # @param theH Cone height.
3343 # @param theName Object name; when specified, this parameter is used
3344 # for result publication in the study. Otherwise, if automatic
3345 # publication is switched on, default value is used for result name.
3347 # @return New GEOM.GEOM_Object, containing the created cone.
3349 # @ref tui_creation_cone "Example"
3350 @ManageTransactions("PrimOp")
3351 def MakeCone(self, thePnt, theAxis, theR1, theR2, theH, theName=None):
3353 Create a cone with given base point, axis, height and radiuses.
3356 thePnt Central point of the first cone base.
3358 theR1 Radius of the first cone base.
3359 theR2 Radius of the second cone base.
3361 theName Object name; when specified, this parameter is used
3362 for result publication in the study. Otherwise, if automatic
3363 publication is switched on, default value is used for result name.
3366 If both radiuses are non-zero, the cone will be truncated.
3367 If the radiuses are equal, a cylinder will be created instead.
3370 New GEOM.GEOM_Object, containing the created cone.
3372 # Example: see GEOM_TestAll.py
3373 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
3374 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
3375 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
3376 anObj.SetParameters(Parameters)
3377 self._autoPublish(anObj, theName, "cone")
3380 ## Create a cone with given height and radiuses at
3381 # the origin of coordinate system. Axis of the cone will
3382 # be collinear to the OZ axis of the coordinate system.
3383 # @param theR1 Radius of the first cone base.
3384 # @param theR2 Radius of the second cone base.
3385 # \note If both radiuses are non-zero, the cone will be truncated.
3386 # \note If the radiuses are equal, a cylinder will be created instead.
3387 # @param theH Cone height.
3388 # @param theName Object name; when specified, this parameter is used
3389 # for result publication in the study. Otherwise, if automatic
3390 # publication is switched on, default value is used for result name.
3392 # @return New GEOM.GEOM_Object, containing the created cone.
3394 # @ref tui_creation_cone "Example"
3395 @ManageTransactions("PrimOp")
3396 def MakeConeR1R2H(self, theR1, theR2, theH, theName=None):
3398 Create a cone with given height and radiuses at
3399 the origin of coordinate system. Axis of the cone will
3400 be collinear to the OZ axis of the coordinate system.
3403 theR1 Radius of the first cone base.
3404 theR2 Radius of the second cone base.
3406 theName Object name; when specified, this parameter is used
3407 for result publication in the study. Otherwise, if automatic
3408 publication is switched on, default value is used for result name.
3411 If both radiuses are non-zero, the cone will be truncated.
3412 If the radiuses are equal, a cylinder will be created instead.
3415 New GEOM.GEOM_Object, containing the created cone.
3417 # Example: see GEOM_TestAll.py
3418 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
3419 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
3420 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
3421 anObj.SetParameters(Parameters)
3422 self._autoPublish(anObj, theName, "cone")
3425 ## Create a torus with given center, normal vector and radiuses.
3426 # @param thePnt Torus central point.
3427 # @param theVec Torus axis of symmetry.
3428 # @param theRMajor Torus major radius.
3429 # @param theRMinor Torus minor radius.
3430 # @param theName Object name; when specified, this parameter is used
3431 # for result publication in the study. Otherwise, if automatic
3432 # publication is switched on, default value is used for result name.
3434 # @return New GEOM.GEOM_Object, containing the created torus.
3436 # @ref tui_creation_torus "Example"
3437 @ManageTransactions("PrimOp")
3438 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor, theName=None):
3440 Create a torus with given center, normal vector and radiuses.
3443 thePnt Torus central point.
3444 theVec Torus axis of symmetry.
3445 theRMajor Torus major radius.
3446 theRMinor Torus minor radius.
3447 theName Object name; when specified, this parameter is used
3448 for result publication in the study. Otherwise, if automatic
3449 publication is switched on, default value is used for result name.
3452 New GEOM.GEOM_Object, containing the created torus.
3454 # Example: see GEOM_TestAll.py
3455 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
3456 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
3457 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
3458 anObj.SetParameters(Parameters)
3459 self._autoPublish(anObj, theName, "torus")
3462 ## Create a torus with given radiuses at the origin of coordinate system.
3463 # @param theRMajor Torus major radius.
3464 # @param theRMinor Torus minor radius.
3465 # @param theName Object name; when specified, this parameter is used
3466 # for result publication in the study. Otherwise, if automatic
3467 # publication is switched on, default value is used for result name.
3469 # @return New GEOM.GEOM_Object, containing the created torus.
3471 # @ref tui_creation_torus "Example"
3472 @ManageTransactions("PrimOp")
3473 def MakeTorusRR(self, theRMajor, theRMinor, theName=None):
3475 Create a torus with given radiuses at the origin of coordinate system.
3478 theRMajor Torus major radius.
3479 theRMinor Torus minor radius.
3480 theName Object name; when specified, this parameter is used
3481 for result publication in the study. Otherwise, if automatic
3482 publication is switched on, default value is used for result name.
3485 New GEOM.GEOM_Object, containing the created torus.
3487 # Example: see GEOM_TestAll.py
3488 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
3489 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
3490 RaiseIfFailed("MakeTorusRR", self.PrimOp)
3491 anObj.SetParameters(Parameters)
3492 self._autoPublish(anObj, theName, "torus")
3495 # end of l3_3d_primitives
3498 ## @addtogroup l3_complex
3501 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
3502 # @param theBase Base shape to be extruded.
3503 # @param thePoint1 First end of extrusion vector.
3504 # @param thePoint2 Second end of extrusion vector.
3505 # @param theScaleFactor Use it to make prism with scaled second base.
3506 # Nagative value means not scaled second base.
3507 # @param theName Object name; when specified, this parameter is used
3508 # for result publication in the study. Otherwise, if automatic
3509 # publication is switched on, default value is used for result name.
3511 # @return New GEOM.GEOM_Object, containing the created prism.
3513 # @ref tui_creation_prism "Example"
3514 @ManageTransactions("PrimOp")
3515 def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0, theName=None):
3517 Create a shape by extrusion of the base shape along a vector, defined by two points.
3520 theBase Base shape to be extruded.
3521 thePoint1 First end of extrusion vector.
3522 thePoint2 Second end of extrusion vector.
3523 theScaleFactor Use it to make prism with scaled second base.
3524 Nagative value means not scaled second base.
3525 theName Object name; when specified, this parameter is used
3526 for result publication in the study. Otherwise, if automatic
3527 publication is switched on, default value is used for result name.
3530 New GEOM.GEOM_Object, containing the created prism.
3532 # Example: see GEOM_TestAll.py
3535 if theScaleFactor > 0:
3536 theScaleFactor,Parameters = ParseParameters(theScaleFactor)
3537 anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor)
3539 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
3540 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
3541 anObj.SetParameters(Parameters)
3542 self._autoPublish(anObj, theName, "prism")
3545 ## Create a shape by extrusion of the base shape along a
3546 # vector, defined by two points, in 2 Ways (forward/backward).
3547 # @param theBase Base shape to be extruded.
3548 # @param thePoint1 First end of extrusion vector.
3549 # @param thePoint2 Second end of extrusion vector.
3550 # @param theName Object name; when specified, this parameter is used
3551 # for result publication in the study. Otherwise, if automatic
3552 # publication is switched on, default value is used for result name.
3554 # @return New GEOM.GEOM_Object, containing the created prism.
3556 # @ref tui_creation_prism "Example"
3557 @ManageTransactions("PrimOp")
3558 def MakePrism2Ways(self, theBase, thePoint1, thePoint2, theName=None):
3560 Create a shape by extrusion of the base shape along a
3561 vector, defined by two points, in 2 Ways (forward/backward).
3564 theBase Base shape to be extruded.
3565 thePoint1 First end of extrusion vector.
3566 thePoint2 Second end of extrusion vector.
3567 theName Object name; when specified, this parameter is used
3568 for result publication in the study. Otherwise, if automatic
3569 publication is switched on, default value is used for result name.
3572 New GEOM.GEOM_Object, containing the created prism.
3574 # Example: see GEOM_TestAll.py
3575 anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
3576 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
3577 self._autoPublish(anObj, theName, "prism")
3580 ## Create a shape by extrusion of the base shape along the vector,
3581 # i.e. all the space, transfixed by the base shape during its translation
3582 # along the vector on the given distance.
3583 # @param theBase Base shape to be extruded.
3584 # @param theVec Direction of extrusion.
3585 # @param theH Prism dimension along theVec.
3586 # @param theScaleFactor Use it to make prism with scaled second base.
3587 # Negative value means not scaled second base.
3588 # @param theName Object name; when specified, this parameter is used
3589 # for result publication in the study. Otherwise, if automatic
3590 # publication is switched on, default value is used for result name.
3592 # @return New GEOM.GEOM_Object, containing the created prism.
3594 # @ref tui_creation_prism "Example"
3595 @ManageTransactions("PrimOp")
3596 def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0, theName=None):
3598 Create a shape by extrusion of the base shape along the vector,
3599 i.e. all the space, transfixed by the base shape during its translation
3600 along the vector on the given distance.
3603 theBase Base shape to be extruded.
3604 theVec Direction of extrusion.
3605 theH Prism dimension along theVec.
3606 theScaleFactor Use it to make prism with scaled second base.
3607 Negative value means not scaled second base.
3608 theName Object name; when specified, this parameter is used
3609 for result publication in the study. Otherwise, if automatic
3610 publication is switched on, default value is used for result name.
3613 New GEOM.GEOM_Object, containing the created prism.
3615 # Example: see GEOM_TestAll.py
3618 if theScaleFactor > 0:
3619 theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor)
3620 anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor)
3622 theH,Parameters = ParseParameters(theH)
3623 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
3624 RaiseIfFailed("MakePrismVecH", self.PrimOp)
3625 anObj.SetParameters(Parameters)
3626 self._autoPublish(anObj, theName, "prism")
3629 ## Create a shape by extrusion of the base shape along the vector,
3630 # i.e. all the space, transfixed by the base shape during its translation
3631 # along the vector on the given distance in 2 Ways (forward/backward).
3632 # @param theBase Base shape to be extruded.
3633 # @param theVec Direction of extrusion.
3634 # @param theH Prism dimension along theVec in forward direction.
3635 # @param theName Object name; when specified, this parameter is used
3636 # for result publication in the study. Otherwise, if automatic
3637 # publication is switched on, default value is used for result name.
3639 # @return New GEOM.GEOM_Object, containing the created prism.
3641 # @ref tui_creation_prism "Example"
3642 @ManageTransactions("PrimOp")
3643 def MakePrismVecH2Ways(self, theBase, theVec, theH, theName=None):
3645 Create a shape by extrusion of the base shape along the vector,
3646 i.e. all the space, transfixed by the base shape during its translation
3647 along the vector on the given distance in 2 Ways (forward/backward).
3650 theBase Base shape to be extruded.
3651 theVec Direction of extrusion.
3652 theH Prism dimension along theVec in forward direction.
3653 theName Object name; when specified, this parameter is used
3654 for result publication in the study. Otherwise, if automatic
3655 publication is switched on, default value is used for result name.
3658 New GEOM.GEOM_Object, containing the created prism.
3660 # Example: see GEOM_TestAll.py
3661 theH,Parameters = ParseParameters(theH)
3662 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
3663 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
3664 anObj.SetParameters(Parameters)
3665 self._autoPublish(anObj, theName, "prism")
3668 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
3669 # @param theBase Base shape to be extruded.
3670 # @param theDX, theDY, theDZ Directions of extrusion.
3671 # @param theScaleFactor Use it to make prism with scaled second base.
3672 # Nagative value means not scaled second base.
3673 # @param theName Object name; when specified, this parameter is used
3674 # for result publication in the study. Otherwise, if automatic
3675 # publication is switched on, default value is used for result name.
3677 # @return New GEOM.GEOM_Object, containing the created prism.
3679 # @ref tui_creation_prism "Example"
3680 @ManageTransactions("PrimOp")
3681 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0, theName=None):
3683 Create a shape by extrusion of the base shape along the dx, dy, dz direction
3686 theBase Base shape to be extruded.
3687 theDX, theDY, theDZ Directions of extrusion.
3688 theScaleFactor Use it to make prism with scaled second base.
3689 Nagative value means not scaled second base.
3690 theName Object name; when specified, this parameter is used
3691 for result publication in the study. Otherwise, if automatic
3692 publication is switched on, default value is used for result name.
3695 New GEOM.GEOM_Object, containing the created prism.
3697 # Example: see GEOM_TestAll.py
3700 if theScaleFactor > 0:
3701 theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor)
3702 anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor)
3704 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
3705 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
3706 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
3707 anObj.SetParameters(Parameters)
3708 self._autoPublish(anObj, theName, "prism")
3711 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
3712 # i.e. all the space, transfixed by the base shape during its translation
3713 # along the vector on the given distance in 2 Ways (forward/backward).
3714 # @param theBase Base shape to be extruded.
3715 # @param theDX, theDY, theDZ Directions of extrusion.
3716 # @param theName Object name; when specified, this parameter is used
3717 # for result publication in the study. Otherwise, if automatic
3718 # publication is switched on, default value is used for result name.
3720 # @return New GEOM.GEOM_Object, containing the created prism.
3722 # @ref tui_creation_prism "Example"
3723 @ManageTransactions("PrimOp")
3724 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ, theName=None):
3726 Create a shape by extrusion of the base shape along the dx, dy, dz direction
3727 i.e. all the space, transfixed by the base shape during its translation
3728 along the vector on the given distance in 2 Ways (forward/backward).
3731 theBase Base shape to be extruded.
3732 theDX, theDY, theDZ Directions of extrusion.
3733 theName Object name; when specified, this parameter is used
3734 for result publication in the study. Otherwise, if automatic
3735 publication is switched on, default value is used for result name.
3738 New GEOM.GEOM_Object, containing the created prism.
3740 # Example: see GEOM_TestAll.py
3741 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
3742 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
3743 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
3744 anObj.SetParameters(Parameters)
3745 self._autoPublish(anObj, theName, "prism")
3748 ## Create a shape by revolution of the base shape around the axis
3749 # on the given angle, i.e. all the space, transfixed by the base
3750 # shape during its rotation around the axis on the given angle.
3751 # @param theBase Base shape to be rotated.
3752 # @param theAxis Rotation axis.
3753 # @param theAngle Rotation angle in radians.
3754 # @param theName Object name; when specified, this parameter is used
3755 # for result publication in the study. Otherwise, if automatic
3756 # publication is switched on, default value is used for result name.
3758 # @return New GEOM.GEOM_Object, containing the created revolution.
3760 # @ref tui_creation_revolution "Example"
3761 @ManageTransactions("PrimOp")
3762 def MakeRevolution(self, theBase, theAxis, theAngle, theName=None):
3764 Create a shape by revolution of the base shape around the axis
3765 on the given angle, i.e. all the space, transfixed by the base
3766 shape during its rotation around the axis on the given angle.
3769 theBase Base shape to be rotated.
3770 theAxis Rotation axis.
3771 theAngle Rotation angle in radians.
3772 theName Object name; when specified, this parameter is used
3773 for result publication in the study. Otherwise, if automatic
3774 publication is switched on, default value is used for result name.
3777 New GEOM.GEOM_Object, containing the created revolution.
3779 # Example: see GEOM_TestAll.py
3780 theAngle,Parameters = ParseParameters(theAngle)
3781 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
3782 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
3783 anObj.SetParameters(Parameters)
3784 self._autoPublish(anObj, theName, "revolution")
3787 ## Create a shape by revolution of the base shape around the axis
3788 # on the given angle, i.e. all the space, transfixed by the base
3789 # shape during its rotation around the axis on the given angle in
3790 # both directions (forward/backward)
3791 # @param theBase Base shape to be rotated.
3792 # @param theAxis Rotation axis.
3793 # @param theAngle Rotation angle in radians.
3794 # @param theName Object name; when specified, this parameter is used
3795 # for result publication in the study. Otherwise, if automatic
3796 # publication is switched on, default value is used for result name.
3798 # @return New GEOM.GEOM_Object, containing the created revolution.
3800 # @ref tui_creation_revolution "Example"
3801 @ManageTransactions("PrimOp")
3802 def MakeRevolution2Ways(self, theBase, theAxis, theAngle, theName=None):
3804 Create a shape by revolution of the base shape around the axis
3805 on the given angle, i.e. all the space, transfixed by the base
3806 shape during its rotation around the axis on the given angle in
3807 both directions (forward/backward).
3810 theBase Base shape to be rotated.
3811 theAxis Rotation axis.
3812 theAngle Rotation angle in radians.
3813 theName Object name; when specified, this parameter is used
3814 for result publication in the study. Otherwise, if automatic
3815 publication is switched on, default value is used for result name.
3818 New GEOM.GEOM_Object, containing the created revolution.
3820 theAngle,Parameters = ParseParameters(theAngle)
3821 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
3822 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
3823 anObj.SetParameters(Parameters)
3824 self._autoPublish(anObj, theName, "revolution")
3827 ## Create a face from a given set of contours.
3828 # @param theContours either a list or a compound of edges/wires.
3829 # @param theMinDeg a minimal degree of BSpline surface to create.
3830 # @param theMaxDeg a maximal degree of BSpline surface to create.
3831 # @param theTol2D a 2d tolerance to be reached.
3832 # @param theTol3D a 3d tolerance to be reached.
3833 # @param theNbIter a number of iteration of approximation algorithm.
3834 # @param theMethod Kind of method to perform filling operation
3835 # (see GEOM.filling_oper_method enum).
3836 # @param isApprox if True, BSpline curves are generated in the process
3837 # of surface construction. By default it is False, that means
3838 # the surface is created using given curves. The usage of
3839 # Approximation makes the algorithm work slower, but allows
3840 # building the surface for rather complex cases.
3841 # @param theName Object name; when specified, this parameter is used
3842 # for result publication in the study. Otherwise, if automatic
3843 # publication is switched on, default value is used for result name.
3845 # @return New GEOM.GEOM_Object (face), containing the created filling surface.
3847 # @ref tui_creation_filling "Example"
3848 @ManageTransactions("PrimOp")
3849 def MakeFilling(self, theContours, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001,
3850 theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0, theName=None):
3852 Create a face from a given set of contours.
3855 theContours either a list or a compound of edges/wires.
3856 theMinDeg a minimal degree of BSpline surface to create.
3857 theMaxDeg a maximal degree of BSpline surface to create.
3858 theTol2D a 2d tolerance to be reached.
3859 theTol3D a 3d tolerance to be reached.
3860 theNbIter a number of iteration of approximation algorithm.
3861 theMethod Kind of method to perform filling operation
3862 (see GEOM.filling_oper_method enum).
3863 isApprox if True, BSpline curves are generated in the process
3864 of surface construction. By default it is False, that means
3865 the surface is created using given curves. The usage of
3866 Approximation makes the algorithm work slower, but allows
3867 building the surface for rather complex cases.
3868 theName Object name; when specified, this parameter is used
3869 for result publication in the study. Otherwise, if automatic
3870 publication is switched on, default value is used for result name.
3873 New GEOM.GEOM_Object (face), containing the created filling surface.
3876 filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5)
3878 # Example: see GEOM_TestAll.py
3879 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
3880 anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
3881 theTol2D, theTol3D, theNbIter,
3882 theMethod, isApprox)
3883 RaiseIfFailed("MakeFilling", self.PrimOp)
3884 anObj.SetParameters(Parameters)
3885 self._autoPublish(anObj, theName, "filling")
3889 ## Create a face from a given set of contours.
3890 # This method corresponds to MakeFilling() with isApprox=True.
3891 # @param theContours either a list or a compound of edges/wires.
3892 # @param theMinDeg a minimal degree of BSpline surface to create.
3893 # @param theMaxDeg a maximal degree of BSpline surface to create.
3894 # @param theTol3D a 3d tolerance to be reached.
3895 # @param theName Object name; when specified, this parameter is used
3896 # for result publication in the study. Otherwise, if automatic
3897 # publication is switched on, default value is used for result name.
3899 # @return New GEOM.GEOM_Object (face), containing the created filling surface.
3901 # @ref tui_creation_filling "Example"
3902 @ManageTransactions("PrimOp")
3903 def MakeFillingNew(self, theContours, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None):
3905 Create a filling from the given compound of contours.
3906 This method corresponds to MakeFilling() with isApprox=True.
3909 theContours either a list or a compound of edges/wires.
3910 theMinDeg a minimal degree of BSpline surface to create.
3911 theMaxDeg a maximal degree of BSpline surface to create.
3912 theTol3D a 3d tolerance to be reached.
3913 theName Object name; when specified, this parameter is used
3914 for result publication in the study. Otherwise, if automatic
3915 publication is switched on, default value is used for result name.
3918 New GEOM.GEOM_Object (face), containing the created filling surface.
3921 filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001)
3923 # Example: see GEOM_TestAll.py
3924 theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D)
3925 anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
3926 0, theTol3D, 0, GEOM.FOM_Default, True)
3927 RaiseIfFailed("MakeFillingNew", self.PrimOp)
3928 anObj.SetParameters(Parameters)
3929 self._autoPublish(anObj, theName, "filling")
3932 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
3933 # @param theSeqSections - set of specified sections.
3934 # @param theModeSolid - mode defining building solid or shell
3935 # @param thePreci - precision 3D used for smoothing
3936 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
3937 # @param theName Object name; when specified, this parameter is used
3938 # for result publication in the study. Otherwise, if automatic
3939 # publication is switched on, default value is used for result name.
3941 # @return New GEOM.GEOM_Object, containing the created shell or solid.
3943 # @ref swig_todo "Example"
3944 @ManageTransactions("PrimOp")
3945 def MakeThruSections(self, theSeqSections, theModeSolid, thePreci, theRuled, theName=None):
3947 Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
3950 theSeqSections - set of specified sections.
3951 theModeSolid - mode defining building solid or shell
3952 thePreci - precision 3D used for smoothing
3953 theRuled - mode defining type of the result surfaces (ruled or smoothed).
3954 theName Object name; when specified, this parameter is used
3955 for result publication in the study. Otherwise, if automatic
3956 publication is switched on, default value is used for result name.
3959 New GEOM.GEOM_Object, containing the created shell or solid.
3961 # Example: see GEOM_TestAll.py
3962 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
3963 RaiseIfFailed("MakeThruSections", self.PrimOp)
3964 self._autoPublish(anObj, theName, "filling")
3967 ## Create a shape by extrusion of the base shape along
3968 # the path shape. The path shape can be a wire or an edge. It is
3969 # possible to generate groups along with the result by means of
3970 # setting the flag \a IsGenerateGroups.<BR>
3971 # If \a thePath is a closed edge or wire and \a IsGenerateGroups is
3972 # set, an error is occurred. If \a thePath is not closed edge/wire,
3973 # the following groups are returned:
3974 # - If \a theBase is unclosed edge or wire: "Down", "Up", "Side1",
3976 # - If \a theBase is closed edge or wire, face or shell: "Down", "Up",
3979 # "Down" and "Up" groups contain:
3980 # - Edges if \a theBase is edge or wire;
3981 # - Faces if \a theBase is face or shell.<BR>
3983 # "Side1" and "Side2" groups contain edges generated from the first
3984 # and last vertices of \a theBase. The first and last vertices are
3985 # determined taking into account edge/wire orientation.<BR>
3986 # "Other" group represents faces generated from the bounding edges of
3989 # @param theBase Base shape to be extruded.
3990 # @param thePath Path shape to extrude the base shape along it.
3991 # @param IsGenerateGroups flag that tells if it is necessary to
3992 # create groups. It is equal to False by default.
3993 # @param theName Object name; when specified, this parameter is used
3994 # for result publication in the study. Otherwise, if automatic
3995 # publication is switched on, default value is used for result name.
3997 # @return New GEOM.GEOM_Object, containing the created pipe if
3998 # \a IsGenerateGroups is not set. Otherwise it returns a
3999 # list of GEOM.GEOM_Object. Its first element is the created pipe, the
4000 # remaining ones are created groups.
4002 # @ref tui_creation_pipe "Example"
4003 @ManageTransactions("PrimOp")
4004 def MakePipe(self, theBase, thePath,
4005 IsGenerateGroups=False, theName=None):
4007 Create a shape by extrusion of the base shape along
4008 the path shape. The path shape can be a wire or an edge. It is
4009 possible to generate groups along with the result by means of
4010 setting the flag IsGenerateGroups.
4011 If thePath is a closed edge or wire and IsGenerateGroups is
4012 set, an error is occurred. If thePath is not closed edge/wire,
4013 the following groups are returned:
4014 - If theBase is unclosed edge or wire: "Down", "Up", "Side1",
4016 - If theBase is closed edge or wire, face or shell: "Down", "Up",
4018 "Down" and "Up" groups contain:
4019 - Edges if theBase is edge or wire;
4020 - Faces if theBase is face or shell.
4021 "Side1" and "Side2" groups contain edges generated from the first
4022 and last vertices of theBase. The first and last vertices are
4023 determined taking into account edge/wire orientation.
4024 "Other" group represents faces generated from the bounding edges of
4028 theBase Base shape to be extruded.
4029 thePath Path shape to extrude the base shape along it.
4030 IsGenerateGroups flag that tells if it is necessary to
4031 create groups. It is equal to False by default.
4032 theName Object name; when specified, this parameter is used
4033 for result publication in the study. Otherwise, if automatic
4034 publication is switched on, default value is used for result name.
4037 New GEOM.GEOM_Object, containing the created pipe if
4038 IsGenerateGroups is not set. Otherwise it returns a
4039 list of GEOM.GEOM_Object. Its first element is the created pipe, the
4040 remaining ones are created groups.
4042 # Example: see GEOM_TestAll.py
4043 aList = self.PrimOp.MakePipe(theBase, thePath, IsGenerateGroups)
4044 RaiseIfFailed("MakePipe", self.PrimOp)
4046 if IsGenerateGroups:
4047 self._autoPublish(aList, theName, "pipe")
4050 self._autoPublish(aList[0], theName, "pipe")
4053 ## Create a shape by extrusion of the profile shape along
4054 # the path shape. The path shape can be a wire or an edge.
4055 # the several profiles can be specified in the several locations of path.
4056 # It is possible to generate groups along with the result by means of
4057 # setting the flag \a IsGenerateGroups. For detailed information on
4058 # groups that can be created please see the method MakePipe().
4059 # @param theSeqBases - list of Bases shape to be extruded.
4060 # @param theLocations - list of locations on the path corresponding
4061 # specified list of the Bases shapes. Number of locations
4062 # should be equal to number of bases or list of locations can be empty.
4063 # @param thePath - Path shape to extrude the base shape along it.
4064 # @param theWithContact - the mode defining that the section is translated to be in
4065 # contact with the spine.
4066 # @param theWithCorrection - defining that the section is rotated to be
4067 # orthogonal to the spine tangent in the correspondent point
4068 # @param IsGenerateGroups - flag that tells if it is necessary to
4069 # create groups. It is equal to False by default.
4070 # @param theName Object name; when specified, this parameter is used
4071 # for result publication in the study. Otherwise, if automatic
4072 # publication is switched on, default value is used for result name.
4074 # @return New GEOM.GEOM_Object, containing the created pipe if
4075 # \a IsGenerateGroups is not set. Otherwise it returns new
4076 # GEOM.ListOfGO. Its first element is the created pipe, the
4077 # remaining ones are created groups.
4079 # @ref tui_creation_pipe_with_diff_sec "Example"
4080 @ManageTransactions("PrimOp")
4081 def MakePipeWithDifferentSections(self, theSeqBases,
4082 theLocations, thePath,
4083 theWithContact, theWithCorrection,
4084 IsGenerateGroups=False, theName=None):
4086 Create a shape by extrusion of the profile shape along
4087 the path shape. The path shape can be a wire or an edge.
4088 the several profiles can be specified in the several locations of path.
4089 It is possible to generate groups along with the result by means of
4090 setting the flag IsGenerateGroups. For detailed information on
4091 groups that can be created please see the method geompy.MakePipe().
4094 theSeqBases - list of Bases shape to be extruded.
4095 theLocations - list of locations on the path corresponding
4096 specified list of the Bases shapes. Number of locations
4097 should be equal to number of bases or list of locations can be empty.
4098 thePath - Path shape to extrude the base shape along it.
4099 theWithContact - the mode defining that the section is translated to be in
4100 contact with the spine(0/1)
4101 theWithCorrection - defining that the section is rotated to be
4102 orthogonal to the spine tangent in the correspondent point (0/1)
4103 IsGenerateGroups - flag that tells if it is necessary to
4104 create groups. It is equal to False by default.
4105 theName Object name; when specified, this parameter is used
4106 for result publication in the study. Otherwise, if automatic
4107 publication is switched on, default value is used for result name.
4110 New GEOM.GEOM_Object, containing the created pipe if
4111 IsGenerateGroups is not set. Otherwise it returns new
4112 GEOM.ListOfGO. Its first element is the created pipe, the
4113 remaining ones are created groups.
4115 aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
4116 theLocations, thePath,
4117 theWithContact, theWithCorrection,
4118 False, IsGenerateGroups)
4119 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
4121 if IsGenerateGroups:
4122 self._autoPublish(aList, theName, "pipe")
4125 self._autoPublish(aList[0], theName, "pipe")
4128 ## Create a shape by extrusion of the profile shape along
4129 # the path shape. This function is a version of
4130 # MakePipeWithDifferentSections() with the same parameters, except
4131 # eliminated theWithContact and theWithCorrection. So it is
4132 # possible to find the description of all parameters is in this
4133 # method. The difference is that this method performs the operation
4134 # step by step, i.e. it creates pipes between each pair of neighbor
4135 # sections and fuses them into a single shape.
4137 # @ref tui_creation_pipe_with_diff_sec "Example"
4138 @ManageTransactions("PrimOp")
4139 def MakePipeWithDifferentSectionsBySteps(self, theSeqBases,
4140 theLocations, thePath,
4141 IsGenerateGroups=False, theName=None):
4143 Create a shape by extrusion of the profile shape along
4144 the path shape. This function is a version of
4145 MakePipeWithDifferentSections() with the same parameters, except
4146 eliminated theWithContact and theWithCorrection. So it is
4147 possible to find the description of all parameters is in this
4148 method. The difference is that this method performs the operation
4149 step by step, i.e. it creates pipes between each pair of neighbor
4150 sections and fuses them into a single shape.
4152 aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
4153 theLocations, thePath,
4155 True, IsGenerateGroups)
4156 RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp)
4158 if IsGenerateGroups:
4159 self._autoPublish(aList, theName, "pipe")
4162 self._autoPublish(aList[0], theName, "pipe")
4165 ## Create a shape by extrusion of the profile shape along
4166 # the path shape. The path shape can be a wire or an edge.
4167 # the several profiles can be specified in the several locations of path.
4168 # It is possible to generate groups along with the result by means of
4169 # setting the flag \a IsGenerateGroups. For detailed information on
4170 # groups that can be created please see the method MakePipe().
4171 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
4172 # shell or face. If number of faces in neighbour sections
4173 # aren't coincided result solid between such sections will
4174 # be created using external boundaries of this shells.
4175 # @param theSeqSubBases - list of corresponding sub-shapes of section shapes.
4176 # This list is used for searching correspondences between
4177 # faces in the sections. Size of this list must be equal
4178 # to size of list of base shapes.
4179 # @param theLocations - list of locations on the path corresponding
4180 # specified list of the Bases shapes. Number of locations
4181 # should be equal to number of bases. First and last
4182 # locations must be coincided with first and last vertexes
4183 # of path correspondingly.
4184 # @param thePath - Path shape to extrude the base shape along it.
4185 # @param theWithContact - the mode defining that the section is translated to be in
4186 # contact with the spine.
4187 # @param theWithCorrection - defining that the section is rotated to be
4188 # orthogonal to the spine tangent in the correspondent point
4189 # @param IsGenerateGroups - flag that tells if it is necessary to
4190 # create groups. It is equal to False by default.
4191 # @param theName Object name; when specified, this parameter is used
4192 # for result publication in the study. Otherwise, if automatic
4193 # publication is switched on, default value is used for result name.
4195 # @return New GEOM.GEOM_Object, containing the created solids if
4196 # \a IsGenerateGroups is not set. Otherwise it returns new
4197 # GEOM.ListOfGO. Its first element is the created solids, the
4198 # remaining ones are created groups.
4200 # @ref tui_creation_pipe_with_shell_sec "Example"
4201 @ManageTransactions("PrimOp")
4202 def MakePipeWithShellSections(self, theSeqBases, theSeqSubBases,
4203 theLocations, thePath,
4204 theWithContact, theWithCorrection,
4205 IsGenerateGroups=False, theName=None):
4207 Create a shape by extrusion of the profile shape along
4208 the path shape. The path shape can be a wire or an edge.
4209 the several profiles can be specified in the several locations of path.
4210 It is possible to generate groups along with the result by means of
4211 setting the flag IsGenerateGroups. For detailed information on
4212 groups that can be created please see the method geompy.MakePipe().
4215 theSeqBases - list of Bases shape to be extruded. Base shape must be
4216 shell or face. If number of faces in neighbour sections
4217 aren't coincided result solid between such sections will
4218 be created using external boundaries of this shells.
4219 theSeqSubBases - list of corresponding sub-shapes of section shapes.
4220 This list is used for searching correspondences between
4221 faces in the sections. Size of this list must be equal
4222 to size of list of base shapes.
4223 theLocations - list of locations on the path corresponding
4224 specified list of the Bases shapes. Number of locations
4225 should be equal to number of bases. First and last
4226 locations must be coincided with first and last vertexes
4227 of path correspondingly.
4228 thePath - Path shape to extrude the base shape along it.
4229 theWithContact - the mode defining that the section is translated to be in
4230 contact with the spine (0/1)
4231 theWithCorrection - defining that the section is rotated to be
4232 orthogonal to the spine tangent in the correspondent point (0/1)
4233 IsGenerateGroups - flag that tells if it is necessary to
4234 create groups. It is equal to False by default.
4235 theName Object name; when specified, this parameter is used
4236 for result publication in the study. Otherwise, if automatic
4237 publication is switched on, default value is used for result name.
4240 New GEOM.GEOM_Object, containing the created solids if
4241 IsGenerateGroups is not set. Otherwise it returns new
4242 GEOM.ListOfGO. Its first element is the created solids, the
4243 remaining ones are created groups.
4245 aList = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
4246 theLocations, thePath,
4247 theWithContact, theWithCorrection,
4249 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
4251 if IsGenerateGroups:
4252 self._autoPublish(aList, theName, "pipe")
4255 self._autoPublish(aList[0], theName, "pipe")
4258 ## Create a shape by extrusion of the profile shape along
4259 # the path shape. This function is used only for debug pipe
4260 # functionality - it is a version of function MakePipeWithShellSections()
4261 # which give a possibility to receive information about
4262 # creating pipe between each pair of sections step by step.
4263 @ManageTransactions("PrimOp")
4264 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
4265 theLocations, thePath,
4266 theWithContact, theWithCorrection,
4267 IsGenerateGroups=False, theName=None):
4269 Create a shape by extrusion of the profile shape along
4270 the path shape. This function is used only for debug pipe
4271 functionality - it is a version of previous function
4272 geompy.MakePipeWithShellSections() which give a possibility to
4273 receive information about creating pipe between each pair of
4274 sections step by step.
4277 nbsect = len(theSeqBases)
4278 nbsubsect = len(theSeqSubBases)
4279 #print "nbsect = ",nbsect
4280 for i in range(1,nbsect):
4282 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
4283 tmpLocations = [ theLocations[i-1], theLocations[i] ]
4285 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
4286 aList = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
4287 tmpLocations, thePath,
4288 theWithContact, theWithCorrection,
4290 if self.PrimOp.IsDone() == 0:
4291 print("Problems with pipe creation between ",i," and ",i+1," sections")
4292 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
4295 print("Pipe between ",i," and ",i+1," sections is OK")
4296 res.append(aList[0])
4300 resc = self.MakeCompound(res)
4301 #resc = self.MakeSewing(res, 0.001)
4302 #print "resc: ",resc
4303 self._autoPublish(resc, theName, "pipe")
4306 ## Create solids between given sections.
4307 # It is possible to generate groups along with the result by means of
4308 # setting the flag \a IsGenerateGroups. For detailed information on
4309 # groups that can be created please see the method MakePipe().
4310 # @param theSeqBases - list of sections (shell or face).
4311 # @param theLocations - list of corresponding vertexes
4312 # @param IsGenerateGroups - flag that tells if it is necessary to
4313 # create groups. It is equal to False by default.
4314 # @param theName Object name; when specified, this parameter is used
4315 # for result publication in the study. Otherwise, if automatic
4316 # publication is switched on, default value is used for result name.
4318 # @return New GEOM.GEOM_Object, containing the created solids if
4319 # \a IsGenerateGroups is not set. Otherwise it returns new
4320 # GEOM.ListOfGO. Its first element is the created solids, the
4321 # remaining ones are created groups.
4323 # @ref tui_creation_pipe_without_path "Example"
4324 @ManageTransactions("PrimOp")
4325 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations,
4326 IsGenerateGroups=False, theName=None):
4328 Create solids between given sections.
4329 It is possible to generate groups along with the result by means of
4330 setting the flag IsGenerateGroups. For detailed information on
4331 groups that can be created please see the method geompy.MakePipe().
4334 theSeqBases - list of sections (shell or face).
4335 theLocations - list of corresponding vertexes
4336 IsGenerateGroups - flag that tells if it is necessary to
4337 create groups. It is equal to False by default.
4338 theName Object name; when specified, this parameter is used
4339 for result publication in the study. Otherwise, if automatic
4340 publication is switched on, default value is used for result name.
4343 New GEOM.GEOM_Object, containing the created solids if
4344 IsGenerateGroups is not set. Otherwise it returns new
4345 GEOM.ListOfGO. Its first element is the created solids, the
4346 remaining ones are created groups.
4348 aList = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations,
4350 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
4352 if IsGenerateGroups:
4353 self._autoPublish(aList, theName, "pipe")
4356 self._autoPublish(aList[0], theName, "pipe")
4359 ## Create a shape by extrusion of the base shape along
4360 # the path shape with constant bi-normal direction along the given vector.
4361 # The path shape can be a wire or an edge.
4362 # It is possible to generate groups along with the result by means of
4363 # setting the flag \a IsGenerateGroups. For detailed information on
4364 # groups that can be created please see the method MakePipe().
4365 # @param theBase Base shape to be extruded.
4366 # @param thePath Path shape to extrude the base shape along it.
4367 # @param theVec Vector defines a constant binormal direction to keep the
4368 # same angle between the direction and the sections
4369 # along the sweep surface.
4370 # @param IsGenerateGroups flag that tells if it is necessary to
4371 # create groups. It is equal to False by default.
4372 # @param theName Object name; when specified, this parameter is used
4373 # for result publication in the study. Otherwise, if automatic
4374 # publication is switched on, default value is used for result name.
4376 # @return New GEOM.GEOM_Object, containing the created pipe if
4377 # \a IsGenerateGroups is not set. Otherwise it returns new
4378 # GEOM.ListOfGO. Its first element is the created pipe, the
4379 # remaining ones are created groups.
4381 # @ref tui_creation_pipe "Example"
4382 @ManageTransactions("PrimOp")
4383 def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec,
4384 IsGenerateGroups=False, theName=None):
4386 Create a shape by extrusion of the base shape along
4387 the path shape with constant bi-normal direction along the given vector.
4388 The path shape can be a wire or an edge.
4389 It is possible to generate groups along with the result by means of
4390 setting the flag IsGenerateGroups. For detailed information on
4391 groups that can be created please see the method geompy.MakePipe().
4394 theBase Base shape to be extruded.
4395 thePath Path shape to extrude the base shape along it.
4396 theVec Vector defines a constant binormal direction to keep the
4397 same angle between the direction and the sections
4398 along the sweep surface.
4399 IsGenerateGroups flag that tells if it is necessary to
4400 create groups. It is equal to False by default.
4401 theName Object name; when specified, this parameter is used
4402 for result publication in the study. Otherwise, if automatic
4403 publication is switched on, default value is used for result name.
4406 New GEOM.GEOM_Object, containing the created pipe if
4407 IsGenerateGroups is not set. Otherwise it returns new
4408 GEOM.ListOfGO. Its first element is the created pipe, the
4409 remaining ones are created groups.
4411 # Example: see GEOM_TestAll.py
4412 aList = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath,
4413 theVec, IsGenerateGroups)
4414 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
4416 if IsGenerateGroups:
4417 self._autoPublish(aList, theName, "pipe")
4420 self._autoPublish(aList[0], theName, "pipe")
4423 ## Makes a thick solid from a shape. If the input is a surface shape
4424 # (face or shell) the result is a thick solid. If an input shape is
4425 # a solid the result is a hollowed solid with removed faces.
4426 # @param theShape Face or Shell to get thick solid or solid to get
4428 # @param theThickness Thickness of the resulting solid
4429 # @param theFacesIDs the list of face IDs to be removed from the
4430 # result. It is ignored if \a theShape is a face or a shell.
4431 # It is empty by default.
4432 # @param theInside If true the thickness is applied towards inside
4433 # @param theName Object name; when specified, this parameter is used
4434 # for result publication in the study. Otherwise, if automatic
4435 # publication is switched on, default value is used for result name.
4437 # @return New GEOM.GEOM_Object, containing the created solid
4439 # @ref tui_creation_thickness "Example"
4440 @ManageTransactions("PrimOp")
4441 def MakeThickSolid(self, theShape, theThickness,
4442 theFacesIDs=[], theInside=False, theName=None):
4444 Make a thick solid from a shape. If the input is a surface shape
4445 (face or shell) the result is a thick solid. If an input shape is
4446 a solid the result is a hollowed solid with removed faces.
4449 theShape Face or Shell to get thick solid or solid to get
4451 theThickness Thickness of the resulting solid
4452 theFacesIDs the list of face IDs to be removed from the
4453 result. It is ignored if theShape is a face or a
4454 shell. It is empty by default.
4455 theInside If true the thickness is applied towards inside
4456 theName Object name; when specified, this parameter is used
4457 for result publication in the study. Otherwise, if automatic
4458 publication is switched on, default value is used for result name.
4461 New GEOM.GEOM_Object, containing the created solid
4463 # Example: see GEOM_TestAll.py
4464 theThickness,Parameters = ParseParameters(theThickness)
4465 anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
4466 theThickness, True, theInside)
4467 RaiseIfFailed("MakeThickSolid", self.PrimOp)
4468 anObj.SetParameters(Parameters)
4469 self._autoPublish(anObj, theName, "thickSolid")
4473 ## Modifies a shape to make it a thick solid. If the input is a surface
4474 # shape (face or shell) the result is a thick solid. If an input shape
4475 # is a solid the result is a hollowed solid with removed faces.
4476 # @param theShape Face or Shell to get thick solid or solid to get
4478 # @param theThickness Thickness of the resulting solid
4479 # @param theFacesIDs the list of face IDs to be removed from the
4480 # result. It is ignored if \a theShape is a face or a shell.
4481 # It is empty by default.
4482 # @param theInside If true the thickness is applied towards inside
4484 # @return The modified shape
4486 # @ref tui_creation_thickness "Example"
4487 @ManageTransactions("PrimOp")
4488 def Thicken(self, theShape, theThickness, theFacesIDs=[], theInside=False):
4490 Modifies a shape to make it a thick solid. If the input is a
4491 surface shape (face or shell) the result is a thick solid. If
4492 an input shape is a solid the result is a hollowed solid with
4496 theShape Face or Shell to get thick solid or solid to get
4498 theThickness Thickness of the resulting solid
4499 theFacesIDs the list of face IDs to be removed from the
4500 result. It is ignored if \a theShape is a face or
4501 a shell. It is empty by default.
4502 theInside If true the thickness is applied towards inside
4507 # Example: see GEOM_TestAll.py
4508 theThickness,Parameters = ParseParameters(theThickness)
4509 anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
4510 theThickness, False, theInside)
4511 RaiseIfFailed("Thicken", self.PrimOp)
4512 anObj.SetParameters(Parameters)
4515 ## Build a middle path of a pipe-like shape.
4516 # The path shape can be a wire or an edge.
4517 # @param theShape It can be closed or unclosed pipe-like shell
4518 # or a pipe-like solid.
4519 # @param theBase1, theBase2 Two bases of the supposed pipe. This
4520 # should be wires or faces of theShape.
4521 # @param theName Object name; when specified, this parameter is used
4522 # for result publication in the study. Otherwise, if automatic
4523 # publication is switched on, default value is used for result name.
4525 # @note It is not assumed that exact or approximate copy of theShape
4526 # can be obtained by applying existing Pipe operation on the
4527 # resulting "Path" wire taking theBase1 as the base - it is not
4528 # always possible; though in some particular cases it might work
4529 # it is not guaranteed. Thus, RestorePath function should not be
4530 # considered as an exact reverse operation of the Pipe.
4532 # @return New GEOM.GEOM_Object, containing an edge or wire that represent
4533 # source pipe's "path".
4535 # @ref tui_creation_pipe_path "Example"
4536 @ManageTransactions("PrimOp")
4537 def RestorePath (self, theShape, theBase1, theBase2, theName=None):
4539 Build a middle path of a pipe-like shape.
4540 The path shape can be a wire or an edge.
4543 theShape It can be closed or unclosed pipe-like shell
4544 or a pipe-like solid.
4545 theBase1, theBase2 Two bases of the supposed pipe. This
4546 should be wires or faces of theShape.
4547 theName Object name; when specified, this parameter is used
4548 for result publication in the study. Otherwise, if automatic
4549 publication is switched on, default value is used for result name.
4552 New GEOM_Object, containing an edge or wire that represent
4555 anObj = self.PrimOp.RestorePath(theShape, theBase1, theBase2)
4556 RaiseIfFailed("RestorePath", self.PrimOp)
4557 self._autoPublish(anObj, theName, "path")
4560 ## Build a middle path of a pipe-like shape.
4561 # The path shape can be a wire or an edge.
4562 # @param theShape It can be closed or unclosed pipe-like shell
4563 # or a pipe-like solid.
4564 # @param listEdges1, listEdges2 Two bases of the supposed pipe. This
4565 # should be lists of edges of theShape.
4566 # @param theName Object name; when specified, this parameter is used
4567 # for result publication in the study. Otherwise, if automatic
4568 # publication is switched on, default value is used for result name.
4570 # @note It is not assumed that exact or approximate copy of theShape
4571 # can be obtained by applying existing Pipe operation on the
4572 # resulting "Path" wire taking theBase1 as the base - it is not
4573 # always possible; though in some particular cases it might work
4574 # it is not guaranteed. Thus, RestorePath function should not be
4575 # considered as an exact reverse operation of the Pipe.
4577 # @return New GEOM.GEOM_Object, containing an edge or wire that represent
4578 # source pipe's "path".
4580 # @ref tui_creation_pipe_path "Example"
4581 @ManageTransactions("PrimOp")
4582 def RestorePathEdges (self, theShape, listEdges1, listEdges2, theName=None):
4584 Build a middle path of a pipe-like shape.
4585 The path shape can be a wire or an edge.
4588 theShape It can be closed or unclosed pipe-like shell
4589 or a pipe-like solid.
4590 listEdges1, listEdges2 Two bases of the supposed pipe. This
4591 should be lists of edges of theShape.
4592 theName Object name; when specified, this parameter is used
4593 for result publication in the study. Otherwise, if automatic
4594 publication is switched on, default value is used for result name.
4597 New GEOM_Object, containing an edge or wire that represent
4600 anObj = self.PrimOp.RestorePathEdges(theShape, listEdges1, listEdges2)
4601 RaiseIfFailed("RestorePath", self.PrimOp)
4602 self._autoPublish(anObj, theName, "path")
4608 ## @addtogroup l3_basic_go
4611 ## Create a linear edge with specified ends.
4612 # @param thePnt1 Point for the first end of edge.
4613 # @param thePnt2 Point for the second end of edge.
4614 # @param theName Object name; when specified, this parameter is used
4615 # for result publication in the study. Otherwise, if automatic
4616 # publication is switched on, default value is used for result name.
4618 # @return New GEOM.GEOM_Object, containing the created edge.
4620 # @ref tui_creation_edge "Example"
4621 @ManageTransactions("ShapesOp")
4622 def MakeEdge(self, thePnt1, thePnt2, theName=None):
4624 Create a linear edge with specified ends.
4627 thePnt1 Point for the first end of edge.
4628 thePnt2 Point for the second end of edge.
4629 theName Object name; when specified, this parameter is used
4630 for result publication in the study. Otherwise, if automatic
4631 publication is switched on, default value is used for result name.
4634 New GEOM.GEOM_Object, containing the created edge.
4636 # Example: see GEOM_TestAll.py
4637 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
4638 RaiseIfFailed("MakeEdge", self.ShapesOp)
4639 self._autoPublish(anObj, theName, "edge")
4642 ## Create a new edge, corresponding to the given length on the given curve.
4643 # @param theRefCurve The referenced curve (edge).
4644 # @param theLength Length on the referenced curve. It can be negative.
4645 # @param theStartPoint Any point can be selected for it, the new edge will begin
4646 # at the end of \a theRefCurve, close to the selected point.
4647 # If None, start from the first point of \a theRefCurve.
4648 # @param theName Object name; when specified, this parameter is used
4649 # for result publication in the study. Otherwise, if automatic
4650 # publication is switched on, default value is used for result name.
4652 # @return New GEOM.GEOM_Object, containing the created edge.
4654 # @ref tui_creation_edge "Example"
4655 @ManageTransactions("ShapesOp")
4656 def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
4658 Create a new edge, corresponding to the given length on the given curve.
4661 theRefCurve The referenced curve (edge).
4662 theLength Length on the referenced curve. It can be negative.
4663 theStartPoint Any point can be selected for it, the new edge will begin
4664 at the end of theRefCurve, close to the selected point.
4665 If None, start from the first point of theRefCurve.
4666 theName Object name; when specified, this parameter is used
4667 for result publication in the study. Otherwise, if automatic
4668 publication is switched on, default value is used for result name.
4671 New GEOM.GEOM_Object, containing the created edge.
4673 # Example: see GEOM_TestAll.py
4674 theLength, Parameters = ParseParameters(theLength)
4675 anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
4676 RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp)
4677 anObj.SetParameters(Parameters)
4678 self._autoPublish(anObj, theName, "edge")
4681 ## Create an edge from specified wire.
4682 # @param theWire source Wire
4683 # @param theLinearTolerance linear tolerance value (default = 1e-07)
4684 # @param theAngularTolerance angular tolerance value (default = 1e-12)
4685 # @param theName Object name; when specified, this parameter is used
4686 # for result publication in the study. Otherwise, if automatic
4687 # publication is switched on, default value is used for result name.
4689 # @return New GEOM.GEOM_Object, containing the created edge.
4691 # @ref tui_creation_edge "Example"
4692 @ManageTransactions("ShapesOp")
4693 def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12, theName=None):
4695 Create an edge from specified wire.
4699 theLinearTolerance linear tolerance value (default = 1e-07)
4700 theAngularTolerance angular tolerance value (default = 1e-12)
4701 theName Object name; when specified, this parameter is used
4702 for result publication in the study. Otherwise, if automatic
4703 publication is switched on, default value is used for result name.
4706 New GEOM.GEOM_Object, containing the created edge.
4708 # Example: see GEOM_TestAll.py
4709 anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
4710 RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
4711 self._autoPublish(anObj, theName, "edge")
4714 ## Create a wire from the set of edges and wires.
4715 # @param theEdgesAndWires List of edges and/or wires.
4716 # @param theTolerance Maximum distance between vertices, that will be merged.
4717 # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion())
4718 # @param theName Object name; when specified, this parameter is used
4719 # for result publication in the study. Otherwise, if automatic
4720 # publication is switched on, default value is used for result name.
4722 # @return New GEOM.GEOM_Object, containing the created wire.
4724 # @ref tui_creation_wire "Example"
4725 @ManageTransactions("ShapesOp")
4726 def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07, theName=None):
4728 Create a wire from the set of edges and wires.
4731 theEdgesAndWires List of edges and/or wires.
4732 theTolerance Maximum distance between vertices, that will be merged.
4733 Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
4734 theName Object name; when specified, this parameter is used
4735 for result publication in the study. Otherwise, if automatic
4736 publication is switched on, default value is used for result name.
4739 New GEOM.GEOM_Object, containing the created wire.
4741 # Example: see GEOM_TestAll.py
4742 anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
4743 RaiseIfFailed("MakeWire", self.ShapesOp)
4744 self._autoPublish(anObj, theName, "wire")
4747 ## Create a face on the given wire.
4748 # @param theWire closed Wire or Edge to build the face on.
4749 # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4750 # If the tolerance of the obtained planar face is less
4751 # than 1e-06, this face will be returned, otherwise the
4752 # algorithm tries to build any suitable face on the given
4753 # wire and prints a warning message.
4754 # @param theName Object name; when specified, this parameter is used
4755 # for result publication in the study. Otherwise, if automatic
4756 # publication is switched on, default value is used for result name.
4758 # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
4760 # @ref tui_creation_face "Example"
4761 @ManageTransactions("ShapesOp")
4762 def MakeFace(self, theWire, isPlanarWanted, theName=None, raiseException=False):
4764 Create a face on the given wire.
4767 theWire closed Wire or Edge to build the face on.
4768 isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4769 If the tolerance of the obtained planar face is less
4770 than 1e-06, this face will be returned, otherwise the
4771 algorithm tries to build any suitable face on the given
4772 wire and prints a warning message.
4773 theName Object name; when specified, this parameter is used
4774 for result publication in the study. Otherwise, if automatic
4775 publication is switched on, default value is used for result name.
4778 New GEOM.GEOM_Object, containing the created face (compound of faces).
4780 # Example: see GEOM_TestAll.py
4781 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
4782 if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
4783 PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
4785 RaiseIfFailed("MakeFace", self.ShapesOp)
4786 self._autoPublish(anObj, theName, "face")
4789 ## Create a face on the given wires set.
4790 # @param theWires List of closed wires or edges to build the face on.
4791 # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4792 # If the tolerance of the obtained planar face is less
4793 # than 1e-06, this face will be returned, otherwise the
4794 # algorithm tries to build any suitable face on the given
4795 # wire and prints a warning message.
4796 # @param theName Object name; when specified, this parameter is used
4797 # for result publication in the study. Otherwise, if automatic
4798 # publication is switched on, default value is used for result name.
4800 # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
4802 # @ref tui_creation_face "Example"
4803 @ManageTransactions("ShapesOp")
4804 def MakeFaceWires(self, theWires, isPlanarWanted, theName=None, raiseException=False):
4806 Create a face on the given wires set.
4809 theWires List of closed wires or edges to build the face on.
4810 isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4811 If the tolerance of the obtained planar face is less
4812 than 1e-06, this face will be returned, otherwise the
4813 algorithm tries to build any suitable face on the given
4814 wire and prints a warning message.
4815 theName Object name; when specified, this parameter is used
4816 for result publication in the study. Otherwise, if automatic
4817 publication is switched on, default value is used for result name.
4820 New GEOM.GEOM_Object, containing the created face (compound of faces).
4822 # Example: see GEOM_TestAll.py
4823 anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
4824 if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
4825 PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
4827 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
4828 self._autoPublish(anObj, theName, "face")
4831 ## See MakeFaceWires() method for details.
4833 # @ref tui_creation_face "Example 1"
4834 # \n @ref swig_MakeFaces "Example 2"
4835 def MakeFaces(self, theWires, isPlanarWanted, theName=None):
4837 See geompy.MakeFaceWires() method for details.
4839 # Example: see GEOM_TestOthers.py
4840 # note: auto-publishing is done in self.MakeFaceWires()
4841 anObj = self.MakeFaceWires(theWires, isPlanarWanted, theName)
4844 ## Create a face based on a surface from given face bounded
4846 # @param theFace the face whose surface is used to create a new face.
4847 # @param theWire the wire that will bound a new face.
4848 # @param theName Object name; when specified, this parameter is used
4849 # for result publication in the study. Otherwise, if automatic
4850 # publication is switched on, default value is used for result name.
4852 # @return New GEOM.GEOM_Object, containing the created face.
4854 # @ref tui_creation_face "Example"
4855 @ManageTransactions("ShapesOp")
4856 def MakeFaceFromSurface(self, theFace, theWire, theName=None):
4858 Create a face based on a surface from given face bounded
4862 theFace the face whose surface is used to create a new face.
4863 theWire the wire that will bound a new face.
4864 theName Object name; when specified, this parameter is used
4865 for result publication in the study. Otherwise, if automatic
4866 publication is switched on, default value is used for result name.
4869 New GEOM.GEOM_Object, containing the created face.
4871 # Example: see GEOM_TestAll.py
4872 anObj = self.ShapesOp.MakeFaceFromSurface(theFace, theWire)
4873 RaiseIfFailed("MakeFaceFromSurface", self.ShapesOp)
4874 self._autoPublish(anObj, theName, "face")
4877 ## Create a face from a set of edges with the given constraints.
4878 # @param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
4879 # - edges should form a closed wire;
4880 # - for each edge, constraint face is optional: if a constraint face is missing
4881 # for some edge, this means that there no constraint associated with this edge.
4882 # @param theName Object name; when specified, this parameter is used
4883 # for result publication in the study. Otherwise, if automatic
4884 # publication is switched on, default value is used for result name.
4886 # @return New GEOM.GEOM_Object, containing the created face.
4888 # @ref tui_creation_face "Example"
4889 @ManageTransactions("ShapesOp")
4890 def MakeFaceWithConstraints(self, theConstraints, theName=None):
4892 Create a face from a set of edges with the given constraints.
4895 theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
4896 - edges should form a closed wire;
4897 - for each edge, constraint face is optional: if a constraint face is missing
4898 for some edge, this means that there no constraint associated with this edge.
4899 theName Object name; when specified, this parameter is used
4900 for result publication in the study. Otherwise, if automatic
4901 publication is switched on, default value is used for result name.
4904 New GEOM.GEOM_Object, containing the created face.
4906 # Example: see GEOM_TestAll.py
4907 anObj = self.ShapesOp.MakeFaceWithConstraints(theConstraints)
4909 RaiseIfFailed("MakeFaceWithConstraints", self.ShapesOp)
4910 self._autoPublish(anObj, theName, "face")
4913 ## Create a shell from the set of faces, shells and/or compounds of faces.
4914 # @param theFacesAndShells List of faces, shells and/or compounds of faces.
4915 # @param theName Object name; when specified, this parameter is used
4916 # for result publication in the study. Otherwise, if automatic
4917 # publication is switched on, default value is used for result name.
4919 # @return New GEOM.GEOM_Object, containing the created shell (compound of shells).
4921 # @ref tui_creation_shell "Example"
4922 @ManageTransactions("ShapesOp")
4923 def MakeShell(self, theFacesAndShells, theName=None):
4925 Create a shell from the set of faces and shells.
4928 theFacesAndShells List of faces and/or shells.
4929 theName Object name; when specified, this parameter is used
4930 for result publication in the study. Otherwise, if automatic
4931 publication is switched on, default value is used for result name.
4934 New GEOM.GEOM_Object, containing the created shell (compound of shells).
4936 # Example: see GEOM_TestAll.py
4937 anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells ))
4938 RaiseIfFailed("MakeShell", self.ShapesOp)
4939 self._autoPublish(anObj, theName, "shell")
4942 ## Create a solid, bounded by the given shells.
4943 # @param theShells Sequence of bounding shells.
4944 # @param theName Object name; when specified, this parameter is used
4945 # for result publication in the study. Otherwise, if automatic
4946 # publication is switched on, default value is used for result name.
4948 # @return New GEOM.GEOM_Object, containing the created solid.
4950 # @ref tui_creation_solid "Example"
4951 @ManageTransactions("ShapesOp")
4952 def MakeSolid(self, theShells, theName=None):
4954 Create a solid, bounded by the given shells.
4957 theShells Sequence of bounding shells.
4958 theName Object name; when specified, this parameter is used
4959 for result publication in the study. Otherwise, if automatic
4960 publication is switched on, default value is used for result name.
4963 New GEOM.GEOM_Object, containing the created solid.
4965 # Example: see GEOM_TestAll.py
4966 theShells = ToList(theShells)
4967 if len(theShells) == 1:
4968 descr = self._IsGoodForSolid(theShells[0])
4970 # raise RuntimeError, "MakeSolidShells : " + descr
4971 if descr == "WRN_SHAPE_UNCLOSED":
4972 raise RuntimeError("MakeSolidShells : Unable to create solid from unclosed shape")
4973 anObj = self.ShapesOp.MakeSolidShells(theShells)
4974 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
4975 self._autoPublish(anObj, theName, "solid")
4978 ## Create a compound of the given shapes.
4979 # @param theShapes List of shapes to put in compound.
4980 # @param theName Object name; when specified, this parameter is used
4981 # for result publication in the study. Otherwise, if automatic
4982 # publication is switched on, default value is used for result name.
4984 # @return New GEOM.GEOM_Object, containing the created compound.
4986 # @ref tui_creation_compound "Example"
4987 @ManageTransactions("ShapesOp")
4988 def MakeCompound(self, theShapes, theName=None):
4990 Create a compound of the given shapes.
4993 theShapes List of shapes to put in compound.
4994 theName Object name; when specified, this parameter is used
4995 for result publication in the study. Otherwise, if automatic
4996 publication is switched on, default value is used for result name.
4999 New GEOM.GEOM_Object, containing the created compound.
5001 # Example: see GEOM_TestAll.py
5002 anObj = self.ShapesOp.MakeCompound(ToList(theShapes))
5003 RaiseIfFailed("MakeCompound", self.ShapesOp)
5004 self._autoPublish(anObj, theName, "compound")
5007 ## Create a solid (or solids) from the set of faces and/or shells.
5008 # @param theFacesOrShells List of faces and/or shells.
5009 # @param isIntersect If TRUE, forces performing intersections
5010 # between arguments; otherwise (default) intersection is not performed.
5011 # @param theName Object name; when specified, this parameter is used
5012 # for result publication in the study. Otherwise, if automatic
5013 # publication is switched on, default value is used for result name.
5015 # @return New GEOM.GEOM_Object, containing the created solid (or compound of solids).
5017 # @ref tui_creation_solid_from_faces "Example"
5018 @ManageTransactions("ShapesOp")
5019 def MakeSolidFromConnectedFaces(self, theFacesOrShells, isIntersect = False, theName=None):
5021 Create a solid (or solids) from the set of connected faces and/or shells.
5024 theFacesOrShells List of faces and/or shells.
5025 isIntersect If TRUE, forces performing intersections
5026 between arguments; otherwise (default) intersection is not performed
5027 theName Object name; when specified, this parameter is used.
5028 for result publication in the study. Otherwise, if automatic
5029 publication is switched on, default value is used for result name.
5032 New GEOM.GEOM_Object, containing the created solid (or compound of solids).
5034 # Example: see GEOM_TestAll.py
5035 anObj = self.ShapesOp.MakeSolidFromConnectedFaces(theFacesOrShells, isIntersect)
5036 RaiseIfFailed("MakeSolidFromConnectedFaces", self.ShapesOp)
5037 self._autoPublish(anObj, theName, "solid")
5040 # end of l3_basic_go
5043 ## @addtogroup l2_measure
5046 ## Gives quantity of faces in the given shape.
5047 # @param theShape Shape to count faces of.
5048 # @return Quantity of faces.
5050 # @ref swig_NumberOf "Example"
5051 @ManageTransactions("ShapesOp")
5052 def NumberOfFaces(self, theShape):
5054 Gives quantity of faces in the given shape.
5057 theShape Shape to count faces of.
5062 # Example: see GEOM_TestOthers.py
5063 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
5064 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
5067 ## Gives quantity of edges in the given shape.
5068 # @param theShape Shape to count edges of.
5069 # @return Quantity of edges.
5071 # @ref swig_NumberOf "Example"
5072 @ManageTransactions("ShapesOp")
5073 def NumberOfEdges(self, theShape):
5075 Gives quantity of edges in the given shape.
5078 theShape Shape to count edges of.
5083 # Example: see GEOM_TestOthers.py
5084 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
5085 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
5088 ## Gives quantity of sub-shapes of type theShapeType in the given shape.
5089 # @param theShape Shape to count sub-shapes of.
5090 # @param theShapeType Type of sub-shapes to count (see ShapeType())
5091 # @return Quantity of sub-shapes of given type.
5093 # @ref swig_NumberOf "Example"
5094 @ManageTransactions("ShapesOp")
5095 def NumberOfSubShapes(self, theShape, theShapeType):
5097 Gives quantity of sub-shapes of type theShapeType in the given shape.
5100 theShape Shape to count sub-shapes of.
5101 theShapeType Type of sub-shapes to count (see geompy.ShapeType)
5104 Quantity of sub-shapes of given type.
5106 # Example: see GEOM_TestOthers.py
5107 nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
5108 RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
5111 ## Gives quantity of solids in the given shape.
5112 # @param theShape Shape to count solids in.
5113 # @return Quantity of solids.
5115 # @ref swig_NumberOf "Example"
5116 @ManageTransactions("ShapesOp")
5117 def NumberOfSolids(self, theShape):
5119 Gives quantity of solids in the given shape.
5122 theShape Shape to count solids in.
5127 # Example: see GEOM_TestOthers.py
5128 nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, self.ShapeType["SOLID"])
5129 RaiseIfFailed("NumberOfSolids", self.ShapesOp)
5135 ## @addtogroup l3_healing
5138 ## Reverses an orientation the given shape.
5139 # @param theShape Shape to be reversed.
5140 # @param theName Object name; when specified, this parameter is used
5141 # for result publication in the study. Otherwise, if automatic
5142 # publication is switched on, default value is used for result name.
5144 # @return The reversed copy of theShape.
5146 # @ref swig_ChangeOrientation "Example"
5147 @ManageTransactions("ShapesOp")
5148 def ChangeOrientation(self, theShape, theName=None):
5150 Reverses an orientation the given shape.
5153 theShape Shape to be reversed.
5154 theName Object name; when specified, this parameter is used
5155 for result publication in the study. Otherwise, if automatic
5156 publication is switched on, default value is used for result name.
5159 The reversed copy of theShape.
5161 # Example: see GEOM_TestAll.py
5162 anObj = self.ShapesOp.ChangeOrientation(theShape)
5163 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
5164 self._autoPublish(anObj, theName, "reversed")
5167 ## See ChangeOrientation() method for details.
5169 # @ref swig_OrientationChange "Example"
5170 def OrientationChange(self, theShape, theName=None):
5172 See geompy.ChangeOrientation method for details.
5174 # Example: see GEOM_TestOthers.py
5175 # note: auto-publishing is done in self.ChangeOrientation()
5176 anObj = self.ChangeOrientation(theShape, theName)
5182 ## @addtogroup l4_obtain
5185 ## Retrieve all free faces from the given shape.
5186 # Free face is a face, which is not shared between two shells of the shape.
5187 # @param theShape Shape to find free faces in.
5188 # @return List of IDs of all free faces, contained in theShape.
5190 # @ref tui_free_faces_page "Example"
5191 @ManageTransactions("ShapesOp")
5192 def GetFreeFacesIDs(self,theShape):
5194 Retrieve all free faces from the given shape.
5195 Free face is a face, which is not shared between two shells of the shape.
5198 theShape Shape to find free faces in.
5201 List of IDs of all free faces, contained in theShape.
5203 # Example: see GEOM_TestOthers.py
5204 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
5205 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
5208 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
5209 # @param theShape1 Shape to find sub-shapes in.
5210 # @param theShape2 Shape to find shared sub-shapes with.
5211 # @param theShapeType Type of sub-shapes to be retrieved.
5212 # @param theName Object name; when specified, this parameter is used
5213 # for result publication in the study. Otherwise, if automatic
5214 # publication is switched on, default value is used for result name.
5216 # @return List of sub-shapes of theShape1, shared with theShape2.
5218 # @ref swig_GetSharedShapes "Example"
5219 @ManageTransactions("ShapesOp")
5220 def GetSharedShapes(self, theShape1, theShape2, theShapeType, theName=None):
5222 Get all sub-shapes of theShape1 of the given type, shared with theShape2.
5225 theShape1 Shape to find sub-shapes in.
5226 theShape2 Shape to find shared sub-shapes with.
5227 theShapeType Type of sub-shapes to be retrieved.
5228 theName Object name; when specified, this parameter is used
5229 for result publication in the study. Otherwise, if automatic
5230 publication is switched on, default value is used for result name.
5233 List of sub-shapes of theShape1, shared with theShape2.
5235 # Example: see GEOM_TestOthers.py
5236 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
5237 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
5238 self._autoPublish(aList, theName, "shared")
5241 ## Get sub-shapes, shared by input shapes.
5242 # @param theShapes Either a list or compound of shapes to find common sub-shapes of.
5243 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()).
5244 # @param theMultiShare Specifies what type of shares should be checked:
5245 # - @c True (default): search sub-shapes from 1st input shape shared with all other input shapes;
5246 # - @c False: causes to search sub-shapes shared between couples of input shapes.
5247 # @param theName Object name; when specified, this parameter is used
5248 # for result publication in the study. Otherwise, if automatic
5249 # publication is switched on, default value is used for result name.
5251 # @note If @a theShapes contains single compound, the shares between all possible couples of
5252 # its top-level shapes are returned; otherwise, only shares between 1st input shape
5253 # and all rest input shapes are returned.
5255 # @return List of all found sub-shapes.
5258 # - @ref tui_shared_shapes "Example 1"
5259 # - @ref swig_GetSharedShapes "Example 2"
5260 @ManageTransactions("ShapesOp")
5261 def GetSharedShapesMulti(self, theShapes, theShapeType, theMultiShare=True, theName=None):
5263 Get sub-shapes, shared by input shapes.
5266 theShapes Either a list or compound of shapes to find common sub-shapes of.
5267 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType).
5268 theMultiShare Specifies what type of shares should be checked:
5269 - True (default): search sub-shapes from 1st input shape shared with all other input shapes;
5270 - False: causes to search sub-shapes shared between couples of input shapes.
5271 theName Object name; when specified, this parameter is used
5272 for result publication in the study. Otherwise, if automatic
5273 publication is switched on, default value is used for result name.
5275 Note: if theShapes contains single compound, the shares between all possible couples of
5276 its top-level shapes are returned; otherwise, only shares between 1st input shape
5277 and all rest input shapes are returned.
5280 List of all found sub-shapes.
5282 # Example: see GEOM_TestOthers.py
5283 aList = self.ShapesOp.GetSharedShapesMulti(ToList(theShapes), theShapeType, theMultiShare)
5284 RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
5285 self._autoPublish(aList, theName, "shared")
5288 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5289 # situated relatively the specified plane by the certain way,
5290 # defined through <VAR>theState</VAR> parameter.
5291 # @param theShape Shape to find sub-shapes of.
5292 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5293 # @param theAx1 Vector (or line, or linear edge), specifying normal
5294 # direction and location of the plane to find shapes on.
5295 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5296 # @param theName Object name; when specified, this parameter is used
5297 # for result publication in the study. Otherwise, if automatic
5298 # publication is switched on, default value is used for result name.
5300 # @return List of all found sub-shapes.
5302 # @ref swig_GetShapesOnPlane "Example"
5303 @ManageTransactions("ShapesOp")
5304 def GetShapesOnPlane(self, theShape, theShapeType, theAx1, theState, theName=None):
5306 Find in theShape all sub-shapes of type theShapeType,
5307 situated relatively the specified plane by the certain way,
5308 defined through theState parameter.
5311 theShape Shape to find sub-shapes of.
5312 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5313 theAx1 Vector (or line, or linear edge), specifying normal
5314 direction and location of the plane to find shapes on.
5315 theState The state of the sub-shapes to find (see GEOM::shape_state)
5316 theName Object name; when specified, this parameter is used
5317 for result publication in the study. Otherwise, if automatic
5318 publication is switched on, default value is used for result name.
5321 List of all found sub-shapes.
5323 # Example: see GEOM_TestOthers.py
5324 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
5325 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
5326 self._autoPublish(aList, theName, "shapeOnPlane")
5329 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5330 # situated relatively the specified plane by the certain way,
5331 # defined through <VAR>theState</VAR> parameter.
5332 # @param theShape Shape to find sub-shapes of.
5333 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5334 # @param theAx1 Vector (or line, or linear edge), specifying normal
5335 # direction and location of the plane to find shapes on.
5336 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5338 # @return List of all found sub-shapes indices.
5340 # @ref swig_GetShapesOnPlaneIDs "Example"
5341 @ManageTransactions("ShapesOp")
5342 def GetShapesOnPlaneIDs(self, theShape, theShapeType, theAx1, theState):
5344 Find in theShape all sub-shapes of type theShapeType,
5345 situated relatively the specified plane by the certain way,
5346 defined through theState parameter.
5349 theShape Shape to find sub-shapes of.
5350 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5351 theAx1 Vector (or line, or linear edge), specifying normal
5352 direction and location of the plane to find shapes on.
5353 theState The state of the sub-shapes to find (see GEOM::shape_state)
5356 List of all found sub-shapes indices.
5358 # Example: see GEOM_TestOthers.py
5359 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
5360 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
5363 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5364 # situated relatively the specified plane by the certain way,
5365 # defined through <VAR>theState</VAR> parameter.
5366 # @param theShape Shape to find sub-shapes of.
5367 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5368 # @param theAx1 Vector (or line, or linear edge), specifying normal
5369 # direction of the plane to find shapes on.
5370 # @param thePnt Point specifying location of the plane to find shapes on.
5371 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5372 # @param theName Object name; when specified, this parameter is used
5373 # for result publication in the study. Otherwise, if automatic
5374 # publication is switched on, default value is used for result name.
5376 # @return List of all found sub-shapes.
5378 # @ref swig_GetShapesOnPlaneWithLocation "Example"
5379 @ManageTransactions("ShapesOp")
5380 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState, theName=None):
5382 Find in theShape all sub-shapes of type theShapeType,
5383 situated relatively the specified plane by the certain way,
5384 defined through theState parameter.
5387 theShape Shape to find sub-shapes of.
5388 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5389 theAx1 Vector (or line, or linear edge), specifying normal
5390 direction and location of the plane to find shapes on.
5391 thePnt Point specifying location of the plane to find shapes on.
5392 theState The state of the sub-shapes to find (see GEOM::shape_state)
5393 theName Object name; when specified, this parameter is used
5394 for result publication in the study. Otherwise, if automatic
5395 publication is switched on, default value is used for result name.
5398 List of all found sub-shapes.
5400 # Example: see GEOM_TestOthers.py
5401 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
5402 theAx1, thePnt, theState)
5403 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
5404 self._autoPublish(aList, theName, "shapeOnPlane")
5407 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5408 # situated relatively the specified plane by the certain way,
5409 # defined through <VAR>theState</VAR> parameter.
5410 # @param theShape Shape to find sub-shapes of.
5411 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5412 # @param theAx1 Vector (or line, or linear edge), specifying normal
5413 # direction of the plane to find shapes on.
5414 # @param thePnt Point specifying location of the plane to find shapes on.
5415 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5417 # @return List of all found sub-shapes indices.
5419 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
5420 @ManageTransactions("ShapesOp")
5421 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
5423 Find in theShape all sub-shapes of type theShapeType,
5424 situated relatively the specified plane by the certain way,
5425 defined through theState parameter.
5428 theShape Shape to find sub-shapes of.
5429 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5430 theAx1 Vector (or line, or linear edge), specifying normal
5431 direction and location of the plane to find shapes on.
5432 thePnt Point specifying location of the plane to find shapes on.
5433 theState The state of the sub-shapes to find (see GEOM::shape_state)
5436 List of all found sub-shapes indices.
5438 # Example: see GEOM_TestOthers.py
5439 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
5440 theAx1, thePnt, theState)
5441 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
5444 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5445 # the specified cylinder by the certain way, defined through \a theState parameter.
5446 # @param theShape Shape to find sub-shapes of.
5447 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5448 # @param theAxis Vector (or line, or linear edge), specifying
5449 # axis of the cylinder to find shapes on.
5450 # @param theRadius Radius of the cylinder to find shapes on.
5451 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5452 # @param theName Object name; when specified, this parameter is used
5453 # for result publication in the study. Otherwise, if automatic
5454 # publication is switched on, default value is used for result name.
5456 # @return List of all found sub-shapes.
5458 # @ref swig_GetShapesOnCylinder "Example"
5459 @ManageTransactions("ShapesOp")
5460 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState, theName=None):
5462 Find in theShape all sub-shapes of type theShapeType, situated relatively
5463 the specified cylinder by the certain way, defined through theState parameter.
5466 theShape Shape to find sub-shapes of.
5467 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5468 theAxis Vector (or line, or linear edge), specifying
5469 axis of the cylinder to find shapes on.
5470 theRadius Radius of the cylinder to find shapes on.
5471 theState The state of the sub-shapes to find (see GEOM::shape_state)
5472 theName Object name; when specified, this parameter is used
5473 for result publication in the study. Otherwise, if automatic
5474 publication is switched on, default value is used for result name.
5477 List of all found sub-shapes.
5479 # Example: see GEOM_TestOthers.py
5480 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
5481 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
5482 self._autoPublish(aList, theName, "shapeOnCylinder")
5485 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5486 # the specified cylinder by the certain way, defined through \a theState parameter.
5487 # @param theShape Shape to find sub-shapes of.
5488 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5489 # @param theAxis Vector (or line, or linear edge), specifying
5490 # axis of the cylinder to find shapes on.
5491 # @param theRadius Radius of the cylinder to find shapes on.
5492 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5494 # @return List of all found sub-shapes indices.
5496 # @ref swig_GetShapesOnCylinderIDs "Example"
5497 @ManageTransactions("ShapesOp")
5498 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
5500 Find in theShape all sub-shapes of type theShapeType, situated relatively
5501 the specified cylinder by the certain way, defined through theState parameter.
5504 theShape Shape to find sub-shapes of.
5505 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5506 theAxis Vector (or line, or linear edge), specifying
5507 axis of the cylinder to find shapes on.
5508 theRadius Radius of the cylinder to find shapes on.
5509 theState The state of the sub-shapes to find (see GEOM::shape_state)
5512 List of all found sub-shapes indices.
5514 # Example: see GEOM_TestOthers.py
5515 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
5516 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
5519 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5520 # the specified cylinder by the certain way, defined through \a theState parameter.
5521 # @param theShape Shape to find sub-shapes of.
5522 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5523 # @param theAxis Vector (or line, or linear edge), specifying
5524 # axis of the cylinder to find shapes on.
5525 # @param thePnt Point specifying location of the bottom of the cylinder.
5526 # @param theRadius Radius of the cylinder to find shapes on.
5527 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5528 # @param theName Object name; when specified, this parameter is used
5529 # for result publication in the study. Otherwise, if automatic
5530 # publication is switched on, default value is used for result name.
5532 # @return List of all found sub-shapes.
5534 # @ref swig_GetShapesOnCylinderWithLocation "Example"
5535 @ManageTransactions("ShapesOp")
5536 def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState, theName=None):
5538 Find in theShape all sub-shapes of type theShapeType, situated relatively
5539 the specified cylinder by the certain way, defined through theState parameter.
5542 theShape Shape to find sub-shapes of.
5543 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5544 theAxis Vector (or line, or linear edge), specifying
5545 axis of the cylinder to find shapes on.
5546 theRadius Radius of the cylinder to find shapes on.
5547 theState The state of the sub-shapes to find (see GEOM::shape_state)
5548 theName Object name; when specified, this parameter is used
5549 for result publication in the study. Otherwise, if automatic
5550 publication is switched on, default value is used for result name.
5553 List of all found sub-shapes.
5555 # Example: see GEOM_TestOthers.py
5556 aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
5557 RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
5558 self._autoPublish(aList, theName, "shapeOnCylinder")
5561 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5562 # the specified cylinder by the certain way, defined through \a theState parameter.
5563 # @param theShape Shape to find sub-shapes of.
5564 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5565 # @param theAxis Vector (or line, or linear edge), specifying
5566 # axis of the cylinder to find shapes on.
5567 # @param thePnt Point specifying location of the bottom of the cylinder.
5568 # @param theRadius Radius of the cylinder to find shapes on.
5569 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5571 # @return List of all found sub-shapes indices
5573 # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
5574 @ManageTransactions("ShapesOp")
5575 def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
5577 Find in theShape all sub-shapes of type theShapeType, situated relatively
5578 the specified cylinder by the certain way, defined through theState parameter.
5581 theShape Shape to find sub-shapes of.
5582 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5583 theAxis Vector (or line, or linear edge), specifying
5584 axis of the cylinder to find shapes on.
5585 theRadius Radius of the cylinder to find shapes on.
5586 theState The state of the sub-shapes to find (see GEOM::shape_state)
5589 List of all found sub-shapes indices.
5591 # Example: see GEOM_TestOthers.py
5592 aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
5593 RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
5596 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5597 # the specified sphere by the certain way, defined through \a theState parameter.
5598 # @param theShape Shape to find sub-shapes of.
5599 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5600 # @param theCenter Point, specifying center of the sphere to find shapes on.
5601 # @param theRadius Radius of the sphere to find shapes on.
5602 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5603 # @param theName Object name; when specified, this parameter is used
5604 # for result publication in the study. Otherwise, if automatic
5605 # publication is switched on, default value is used for result name.
5607 # @return List of all found sub-shapes.
5609 # @ref swig_GetShapesOnSphere "Example"
5610 @ManageTransactions("ShapesOp")
5611 def GetShapesOnSphere(self, theShape, theShapeType, theCenter, theRadius, theState, theName=None):
5613 Find in theShape all sub-shapes of type theShapeType, situated relatively
5614 the specified sphere by the certain way, defined through theState parameter.
5617 theShape Shape to find sub-shapes of.
5618 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5619 theCenter Point, specifying center of the sphere to find shapes on.
5620 theRadius Radius of the sphere to find shapes on.
5621 theState The state of the sub-shapes to find (see GEOM::shape_state)
5622 theName Object name; when specified, this parameter is used
5623 for result publication in the study. Otherwise, if automatic
5624 publication is switched on, default value is used for result name.
5627 List of all found sub-shapes.
5629 # Example: see GEOM_TestOthers.py
5630 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
5631 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
5632 self._autoPublish(aList, theName, "shapeOnSphere")
5635 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5636 # the specified sphere by the certain way, defined through \a theState parameter.
5637 # @param theShape Shape to find sub-shapes of.
5638 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5639 # @param theCenter Point, specifying center of the sphere to find shapes on.
5640 # @param theRadius Radius of the sphere to find shapes on.
5641 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5643 # @return List of all found sub-shapes indices.
5645 # @ref swig_GetShapesOnSphereIDs "Example"
5646 @ManageTransactions("ShapesOp")
5647 def GetShapesOnSphereIDs(self, theShape, theShapeType, theCenter, theRadius, theState):
5649 Find in theShape all sub-shapes of type theShapeType, situated relatively
5650 the specified sphere by the certain way, defined through theState parameter.
5653 theShape Shape to find sub-shapes of.
5654 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5655 theCenter Point, specifying center of the sphere to find shapes on.
5656 theRadius Radius of the sphere to find shapes on.
5657 theState The state of the sub-shapes to find (see GEOM::shape_state)
5660 List of all found sub-shapes indices.
5662 # Example: see GEOM_TestOthers.py
5663 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
5664 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
5667 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5668 # the specified quadrangle by the certain way, defined through \a theState parameter.
5669 # @param theShape Shape to find sub-shapes of.
5670 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5671 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
5672 # @param theTopRightPoint Point, specifying top right corner of a quadrangle
5673 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5674 # @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5675 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5676 # @param theName Object name; when specified, this parameter is used
5677 # for result publication in the study. Otherwise, if automatic
5678 # publication is switched on, default value is used for result name.
5680 # @return List of all found sub-shapes.
5682 # @ref swig_GetShapesOnQuadrangle "Example"
5683 @ManageTransactions("ShapesOp")
5684 def GetShapesOnQuadrangle(self, theShape, theShapeType,
5685 theTopLeftPoint, theTopRightPoint,
5686 theBottomLeftPoint, theBottomRightPoint, theState, theName=None):
5688 Find in theShape all sub-shapes of type theShapeType, situated relatively
5689 the specified quadrangle by the certain way, defined through theState parameter.
5692 theShape Shape to find sub-shapes of.
5693 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5694 theTopLeftPoint Point, specifying top left corner of a quadrangle
5695 theTopRightPoint Point, specifying top right corner of a quadrangle
5696 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5697 theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5698 theState The state of the sub-shapes to find (see GEOM::shape_state)
5699 theName Object name; when specified, this parameter is used
5700 for result publication in the study. Otherwise, if automatic
5701 publication is switched on, default value is used for result name.
5704 List of all found sub-shapes.
5706 # Example: see GEOM_TestOthers.py
5707 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
5708 theTopLeftPoint, theTopRightPoint,
5709 theBottomLeftPoint, theBottomRightPoint, theState)
5710 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
5711 self._autoPublish(aList, theName, "shapeOnQuadrangle")
5714 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5715 # the specified quadrangle by the certain way, defined through \a theState parameter.
5716 # @param theShape Shape to find sub-shapes of.
5717 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5718 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
5719 # @param theTopRightPoint Point, specifying top right corner of a quadrangle
5720 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5721 # @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5722 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5724 # @return List of all found sub-shapes indices.
5726 # @ref swig_GetShapesOnQuadrangleIDs "Example"
5727 @ManageTransactions("ShapesOp")
5728 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
5729 theTopLeftPoint, theTopRightPoint,
5730 theBottomLeftPoint, theBottomRightPoint, theState):
5732 Find in theShape all sub-shapes of type theShapeType, situated relatively
5733 the specified quadrangle by the certain way, defined through theState parameter.
5736 theShape Shape to find sub-shapes of.
5737 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5738 theTopLeftPoint Point, specifying top left corner of a quadrangle
5739 theTopRightPoint Point, specifying top right corner of a quadrangle
5740 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5741 theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5742 theState The state of the sub-shapes to find (see GEOM::shape_state)
5745 List of all found sub-shapes indices.
5748 # Example: see GEOM_TestOthers.py
5749 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
5750 theTopLeftPoint, theTopRightPoint,
5751 theBottomLeftPoint, theBottomRightPoint, theState)
5752 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
5755 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5756 # the specified \a theBox by the certain way, defined through \a theState parameter.
5757 # @param theBox Shape for relative comparing.
5758 # @param theShape Shape to find sub-shapes of.
5759 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5760 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5761 # @param theName Object name; when specified, this parameter is used
5762 # for result publication in the study. Otherwise, if automatic
5763 # publication is switched on, default value is used for result name.
5765 # @return List of all found sub-shapes.
5767 # @ref swig_GetShapesOnBox "Example"
5768 @ManageTransactions("ShapesOp")
5769 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState, theName=None):
5771 Find in theShape all sub-shapes of type theShapeType, situated relatively
5772 the specified theBox by the certain way, defined through theState parameter.
5775 theBox Shape for relative comparing.
5776 theShape Shape to find sub-shapes of.
5777 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5778 theState The state of the sub-shapes to find (see GEOM::shape_state)
5779 theName Object name; when specified, this parameter is used
5780 for result publication in the study. Otherwise, if automatic
5781 publication is switched on, default value is used for result name.
5784 List of all found sub-shapes.
5786 # Example: see GEOM_TestOthers.py
5787 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
5788 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
5789 self._autoPublish(aList, theName, "shapeOnBox")
5792 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5793 # the specified \a theBox by the certain way, defined through \a theState parameter.
5794 # @param theBox Shape for relative comparing.
5795 # @param theShape Shape to find sub-shapes of.
5796 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5797 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5799 # @return List of all found sub-shapes indices.
5801 # @ref swig_GetShapesOnBoxIDs "Example"
5802 @ManageTransactions("ShapesOp")
5803 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
5805 Find in theShape all sub-shapes of type theShapeType, situated relatively
5806 the specified theBox by the certain way, defined through theState parameter.
5809 theBox Shape for relative comparing.
5810 theShape Shape to find sub-shapes of.
5811 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5812 theState The state of the sub-shapes to find (see GEOM::shape_state)
5815 List of all found sub-shapes indices.
5817 # Example: see GEOM_TestOthers.py
5818 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
5819 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
5822 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5823 # situated relatively the specified \a theCheckShape by the
5824 # certain way, defined through \a theState parameter.
5825 # @param theCheckShape Shape for relative comparing. It must be a solid.
5826 # @param theShape Shape to find sub-shapes of.
5827 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5828 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5829 # @param theName Object name; when specified, this parameter is used
5830 # for result publication in the study. Otherwise, if automatic
5831 # publication is switched on, default value is used for result name.
5833 # @return List of all found sub-shapes.
5835 # @ref swig_GetShapesOnShape "Example"
5836 @ManageTransactions("ShapesOp")
5837 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theName=None):
5839 Find in theShape all sub-shapes of type theShapeType,
5840 situated relatively the specified theCheckShape by the
5841 certain way, defined through theState parameter.
5844 theCheckShape Shape for relative comparing. It must be a solid.
5845 theShape Shape to find sub-shapes of.
5846 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5847 theState The state of the sub-shapes to find (see GEOM::shape_state)
5848 theName Object name; when specified, this parameter is used
5849 for result publication in the study. Otherwise, if automatic
5850 publication is switched on, default value is used for result name.
5853 List of all found sub-shapes.
5855 # Example: see GEOM_TestOthers.py
5856 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
5857 theShapeType, theState)
5858 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
5859 self._autoPublish(aList, theName, "shapeOnShape")
5862 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5863 # situated relatively the specified \a theCheckShape by the
5864 # certain way, defined through \a theState parameter.
5865 # @param theCheckShape Shape for relative comparing. It must be a solid.
5866 # @param theShape Shape to find sub-shapes of.
5867 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5868 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5869 # @param theName Object name; when specified, this parameter is used
5870 # for result publication in the study. Otherwise, if automatic
5871 # publication is switched on, default value is used for result name.
5873 # @return All found sub-shapes as compound.
5875 # @ref swig_GetShapesOnShapeAsCompound "Example"
5876 @ManageTransactions("ShapesOp")
5877 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theName=None):
5879 Find in theShape all sub-shapes of type theShapeType,
5880 situated relatively the specified theCheckShape by the
5881 certain way, defined through theState parameter.
5884 theCheckShape Shape for relative comparing. It must be a solid.
5885 theShape Shape to find sub-shapes of.
5886 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5887 theState The state of the sub-shapes to find (see GEOM::shape_state)
5888 theName Object name; when specified, this parameter is used
5889 for result publication in the study. Otherwise, if automatic
5890 publication is switched on, default value is used for result name.
5893 All found sub-shapes as compound.
5895 # Example: see GEOM_TestOthers.py
5896 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
5897 theShapeType, theState)
5898 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
5899 self._autoPublish(anObj, theName, "shapeOnShape")
5902 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5903 # situated relatively the specified \a theCheckShape by the
5904 # certain way, defined through \a theState parameter.
5905 # @param theCheckShape Shape for relative comparing. It must be a solid.
5906 # @param theShape Shape to find sub-shapes of.
5907 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5908 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5910 # @return List of all found sub-shapes indices.
5912 # @ref swig_GetShapesOnShapeIDs "Example"
5913 @ManageTransactions("ShapesOp")
5914 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
5916 Find in theShape all sub-shapes of type theShapeType,
5917 situated relatively the specified theCheckShape by the
5918 certain way, defined through theState parameter.
5921 theCheckShape Shape for relative comparing. It must be a solid.
5922 theShape Shape to find sub-shapes of.
5923 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5924 theState The state of the sub-shapes to find (see GEOM::shape_state)
5927 List of all found sub-shapes indices.
5929 # Example: see GEOM_TestOthers.py
5930 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
5931 theShapeType, theState)
5932 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
5935 ## Get sub-shape(s) of theShapeWhere, which are
5936 # coincident with \a theShapeWhat or could be a part of it.
5937 # @param theShapeWhere Shape to find sub-shapes of.
5938 # @param theShapeWhat Shape, specifying what to find.
5939 # @param isNewImplementation implementation of GetInPlace functionality
5940 # (default = False, old alghorithm based on shape properties)
5941 # @param theName Object name; when specified, this parameter is used
5942 # for result publication in the study. Otherwise, if automatic
5943 # publication is switched on, default value is used for result name.
5945 # @return Compound which includes all found sub-shapes if they have different types;
5946 # or group of all found shapes of the equal type; or a single found sub-shape.
5948 # @note This function has a restriction on argument shapes.
5949 # If \a theShapeWhere has curved parts with significantly
5950 # outstanding centres (i.e. the mass centre of a part is closer to
5951 # \a theShapeWhat than to the part), such parts will not be found.
5952 # @image html get_in_place_lost_part.png
5954 # @ref swig_GetInPlace "Example"
5955 @ManageTransactions("ShapesOp")
5956 def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False, theName=None):
5958 Get sub-shape(s) of theShapeWhere, which are
5959 coincident with theShapeWhat or could be a part of it.
5962 theShapeWhere Shape to find sub-shapes of.
5963 theShapeWhat Shape, specifying what to find.
5964 isNewImplementation Implementation of GetInPlace functionality
5965 (default = False, old alghorithm based on shape properties)
5966 theName Object name; when specified, this parameter is used
5967 for result publication in the study. Otherwise, if automatic
5968 publication is switched on, default value is used for result name.
5971 Compound which includes all found sub-shapes if they have different types;
5972 or group of all found shapes of the equal type; or a single found sub-shape.
5976 This function has a restriction on argument shapes.
5977 If theShapeWhere has curved parts with significantly
5978 outstanding centres (i.e. the mass centre of a part is closer to
5979 theShapeWhat than to the part), such parts will not be found.
5981 # Example: see GEOM_TestOthers.py
5983 if isNewImplementation:
5984 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
5986 anObj = self.ShapesOp.GetInPlaceOld(theShapeWhere, theShapeWhat)
5988 RaiseIfFailed("GetInPlace", self.ShapesOp)
5989 self._autoPublish(anObj, theName, "inplace")
5992 ## Get sub-shape(s) of \a theShapeWhere, which are
5993 # coincident with \a theShapeWhat or could be a part of it.
5995 # Implementation of this method is based on a saved history of an operation,
5996 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
5997 # arguments (an argument shape or a sub-shape of an argument shape).
5998 # The operation could be the Partition or one of boolean operations,
5999 # performed on simple shapes (not on compounds).
6001 # @param theShapeWhere Shape to find sub-shapes of.
6002 # @param theShapeWhat Shape, specifying what to find (must be in the
6003 # building history of the ShapeWhere).
6004 # @param theName Object name; when specified, this parameter is used
6005 # for result publication in the study. Otherwise, if automatic
6006 # publication is switched on, default value is used for result name.
6008 # @return Compound which includes all found sub-shapes if they have different types;
6009 # or group of all found shapes of the equal type; or a single found sub-shape.
6011 # @ref swig_GetInPlace "Example"
6012 @ManageTransactions("ShapesOp")
6013 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat, theName=None):
6015 Implementation of this method is based on a saved history of an operation,
6016 produced theShapeWhere. The theShapeWhat must be among this operation's
6017 arguments (an argument shape or a sub-shape of an argument shape).
6018 The operation could be the Partition or one of boolean operations,
6019 performed on simple shapes (not on compounds).
6022 theShapeWhere Shape to find sub-shapes of.
6023 theShapeWhat Shape, specifying what to find (must be in the
6024 building history of the ShapeWhere).
6025 theName Object name; when specified, this parameter is used
6026 for result publication in the study. Otherwise, if automatic
6027 publication is switched on, default value is used for result name.
6030 Compound which includes all found sub-shapes if they have different types;
6031 or group of all found shapes of the equal type; or a single found sub-shape.
6033 # Example: see GEOM_TestOthers.py
6034 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
6035 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
6036 self._autoPublish(anObj, theName, "inplace")
6039 ## A sort of GetInPlace functionality, returning IDs of sub-shapes.
6040 # For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
6041 # IDs of @a theShapeWhere.
6042 # For example, if theShapeWhat is a box and theShapeWhere is this box cut into
6043 # two parts by a plane, then the result can be as this:
6044 # len( result_list ) = 35,
6045 # result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
6046 # solids with IDs 2 and 36 within theShapeWhere
6048 # @param theShapeWhere Shape to find sub-shapes of.
6049 # @param theShapeWhat Shape, specifying what to find.
6050 # @return List of lists of sub-shape IDS of theShapeWhere.
6051 def GetInPlaceMap(self, theShapeWhere, theShapeWhat):
6053 A sort of GetInPlace functionality, returning IDs of sub-shapes.
6054 For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
6055 IDs of @a theShapeWhere.
6056 For example, if theShapeWhat is a box and theShapeWhere is this box cut into
6057 two parts by a plane, then the result can be as this:
6058 len( result_list ) = 35,
6059 result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
6060 solids with IDs 2 and 36 within theShapeWhere
6063 theShapeWhere Shape to find sub-shapes of.
6064 theShapeWhat Shape, specifying what to find.
6067 List of lists of sub-shape IDS of theShapeWhere.
6069 return self.ShapesOp.GetInPlaceMap(theShapeWhere, theShapeWhat)
6071 ## Get sub-shape of theShapeWhere, which is
6072 # equal to \a theShapeWhat.
6073 # @param theShapeWhere Shape to find sub-shape of.
6074 # @param theShapeWhat Shape, specifying what to find.
6075 # @param theName Object name; when specified, this parameter is used
6076 # for result publication in the study. Otherwise, if automatic
6077 # publication is switched on, default value is used for result name.
6079 # @return New GEOM.GEOM_Object for found sub-shape.
6081 # @ref swig_GetSame "Example"
6082 @ManageTransactions("ShapesOp")
6083 def GetSame(self, theShapeWhere, theShapeWhat, theName=None):
6085 Get sub-shape of theShapeWhere, which is
6086 equal to theShapeWhat.
6089 theShapeWhere Shape to find sub-shape of.
6090 theShapeWhat Shape, specifying what to find.
6091 theName Object name; when specified, this parameter is used
6092 for result publication in the study. Otherwise, if automatic
6093 publication is switched on, default value is used for result name.
6096 New GEOM.GEOM_Object for found sub-shape.
6098 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
6099 RaiseIfFailed("GetSame", self.ShapesOp)
6100 self._autoPublish(anObj, theName, "sameShape")
6104 ## Get sub-shape indices of theShapeWhere, which is
6105 # equal to \a theShapeWhat.
6106 # @param theShapeWhere Shape to find sub-shape of.
6107 # @param theShapeWhat Shape, specifying what to find.
6108 # @return List of all found sub-shapes indices.
6110 # @ref swig_GetSame "Example"
6111 @ManageTransactions("ShapesOp")
6112 def GetSameIDs(self, theShapeWhere, theShapeWhat):
6114 Get sub-shape indices of theShapeWhere, which is
6115 equal to theShapeWhat.
6118 theShapeWhere Shape to find sub-shape of.
6119 theShapeWhat Shape, specifying what to find.
6122 List of all found sub-shapes indices.
6124 anObj = self.ShapesOp.GetSameIDs(theShapeWhere, theShapeWhat)
6125 RaiseIfFailed("GetSameIDs", self.ShapesOp)
6128 ## Resize the input edge with the new Min and Max parameters.
6129 # The input edge parameters range is [0, 1]. If theMin parameter is
6130 # negative, the input edge is extended, otherwise it is shrinked by
6131 # theMin parameter. If theMax is greater than 1, the edge is extended,
6132 # otherwise it is shrinked by theMax parameter.
6133 # @param theEdge the input edge to be resized.
6134 # @param theMin the minimal parameter value.
6135 # @param theMax the maximal parameter value.
6136 # @param theName Object name; when specified, this parameter is used
6137 # for result publication in the study. Otherwise, if automatic
6138 # publication is switched on, default value is used for result name.
6139 # @return New GEOM.GEOM_Object, containing the created edge.
6141 # @ref tui_extend "Example"
6142 @ManageTransactions("ShapesOp")
6143 def ExtendEdge(self, theEdge, theMin, theMax, theName=None):
6145 Resize the input edge with the new Min and Max parameters.
6146 The input edge parameters range is [0, 1]. If theMin parameter is
6147 negative, the input edge is extended, otherwise it is shrinked by
6148 theMin parameter. If theMax is greater than 1, the edge is extended,
6149 otherwise it is shrinked by theMax parameter.
6152 theEdge the input edge to be resized.
6153 theMin the minimal parameter value.
6154 theMax the maximal parameter value.
6155 theName Object name; when specified, this parameter is used
6156 for result publication in the study. Otherwise, if automatic
6157 publication is switched on, default value is used for result name.
6160 New GEOM.GEOM_Object, containing the created edge.
6162 theMin, theMax, Parameters = ParseParameters(theMin, theMax)
6163 anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax)
6164 RaiseIfFailed("ExtendEdge", self.ShapesOp)
6165 anObj.SetParameters(Parameters)
6166 self._autoPublish(anObj, theName, "edge")
6169 ## Resize the input face with the new UMin, UMax, VMin and VMax
6170 # parameters. The input face U and V parameters range is [0, 1]. If
6171 # theUMin parameter is negative, the input face is extended, otherwise
6172 # it is shrinked along U direction by theUMin parameter. If theUMax is
6173 # greater than 1, the face is extended, otherwise it is shrinked along
6174 # U direction by theUMax parameter. So as for theVMin, theVMax and
6175 # V direction of the input face.
6176 # @param theFace the input face to be resized.
6177 # @param theUMin the minimal U parameter value.
6178 # @param theUMax the maximal U parameter value.
6179 # @param theVMin the minimal V parameter value.
6180 # @param theVMax the maximal V parameter value.
6181 # @param theName Object name; when specified, this parameter is used
6182 # for result publication in the study. Otherwise, if automatic
6183 # publication is switched on, default value is used for result name.
6184 # @return New GEOM.GEOM_Object, containing the created face.
6186 # @ref tui_extend "Example"
6187 @ManageTransactions("ShapesOp")
6188 def ExtendFace(self, theFace, theUMin, theUMax,
6189 theVMin, theVMax, theName=None):
6191 Resize the input face with the new UMin, UMax, VMin and VMax
6192 parameters. The input face U and V parameters range is [0, 1]. If
6193 theUMin parameter is negative, the input face is extended, otherwise
6194 it is shrinked along U direction by theUMin parameter. If theUMax is
6195 greater than 1, the face is extended, otherwise it is shrinked along
6196 U direction by theUMax parameter. So as for theVMin, theVMax and
6197 V direction of the input face.
6200 theFace the input face to be resized.
6201 theUMin the minimal U parameter value.
6202 theUMax the maximal U parameter value.
6203 theVMin the minimal V parameter value.
6204 theVMax the maximal V parameter value.
6205 theName Object name; when specified, this parameter is used
6206 for result publication in the study. Otherwise, if automatic
6207 publication is switched on, default value is used for result name.
6210 New GEOM.GEOM_Object, containing the created face.
6212 theUMin, theUMax, theVMin, theVMax, Parameters = ParseParameters(theUMin, theUMax, theVMin, theVMax)
6213 anObj = self.ShapesOp.ExtendFace(theFace, theUMin, theUMax,
6215 RaiseIfFailed("ExtendFace", self.ShapesOp)
6216 anObj.SetParameters(Parameters)
6217 self._autoPublish(anObj, theName, "face")
6220 ## This function takes some face as input parameter and creates new
6221 # GEOM_Object, i.e. topological shape by extracting underlying surface
6222 # of the source face and limiting it by the Umin, Umax, Vmin, Vmax
6223 # parameters of the source face (in the parametrical space).
6224 # @param theFace the input face.
6225 # @param theName Object name; when specified, this parameter is used
6226 # for result publication in the study. Otherwise, if automatic
6227 # publication is switched on, default value is used for result name.
6228 # @return New GEOM.GEOM_Object, containing the created face.
6230 # @ref tui_creation_surface "Example"
6231 @ManageTransactions("ShapesOp")
6232 def MakeSurfaceFromFace(self, theFace, theName=None):
6234 This function takes some face as input parameter and creates new
6235 GEOM_Object, i.e. topological shape by extracting underlying surface
6236 of the source face and limiting it by the Umin, Umax, Vmin, Vmax
6237 parameters of the source face (in the parametrical space).
6240 theFace the input face.
6241 theName Object name; when specified, this parameter is used
6242 for result publication in the study. Otherwise, if automatic
6243 publication is switched on, default value is used for result name.
6246 New GEOM.GEOM_Object, containing the created face.
6248 anObj = self.ShapesOp.MakeSurfaceFromFace(theFace)
6249 RaiseIfFailed("MakeSurfaceFromFace", self.ShapesOp)
6250 self._autoPublish(anObj, theName, "surface")
6256 ## @addtogroup l4_access
6259 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
6260 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
6261 # @param aShape Shape to get sub-shape of.
6262 # @param ListOfID List of sub-shapes indices.
6263 # @param theName Object name; when specified, this parameter is used
6264 # for result publication in the study. Otherwise, if automatic
6265 # publication is switched on, default value is used for result name.
6267 # @return Found sub-shape.
6269 # @ref swig_all_decompose "Example"
6270 def GetSubShape(self, aShape, ListOfID, theName=None):
6272 Obtain a composite sub-shape of aShape, composed from sub-shapes
6273 of aShape, selected by their unique IDs inside aShape
6276 aShape Shape to get sub-shape of.
6277 ListOfID List of sub-shapes indices.
6278 theName Object name; when specified, this parameter is used
6279 for result publication in the study. Otherwise, if automatic
6280 publication is switched on, default value is used for result name.
6285 # Example: see GEOM_TestAll.py
6286 anObj = self.AddSubShape(aShape,ListOfID)
6287 self._autoPublish(anObj, theName, "subshape")
6290 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
6291 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
6292 # @param aShape Shape to get sub-shape of.
6293 # @param aSubShape Sub-shapes of aShape.
6294 # @return ID of found sub-shape.
6296 # @ref swig_all_decompose "Example"
6297 @ManageTransactions("LocalOp")
6298 def GetSubShapeID(self, aShape, aSubShape):
6300 Obtain unique ID of sub-shape aSubShape inside aShape
6301 of aShape, selected by their unique IDs inside aShape
6304 aShape Shape to get sub-shape of.
6305 aSubShape Sub-shapes of aShape.
6308 ID of found sub-shape.
6310 # Example: see GEOM_TestAll.py
6311 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
6312 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
6315 ## Obtain unique IDs of sub-shapes <VAR>aSubShapes</VAR> inside <VAR>aShape</VAR>
6316 # This function is provided for performance purpose. The complexity is O(n) with n
6317 # the number of subobjects of aShape
6318 # @param aShape Shape to get sub-shape of.
6319 # @param aSubShapes Sub-shapes of aShape.
6320 # @return list of IDs of found sub-shapes.
6322 # @ref swig_all_decompose "Example"
6323 @ManageTransactions("ShapesOp")
6324 def GetSubShapesIDs(self, aShape, aSubShapes):
6326 Obtain a list of IDs of sub-shapes aSubShapes inside aShape
6327 This function is provided for performance purpose. The complexity is O(n) with n
6328 the number of subobjects of aShape
6331 aShape Shape to get sub-shape of.
6332 aSubShapes Sub-shapes of aShape.
6335 List of IDs of found sub-shape.
6337 # Example: see GEOM_TestAll.py
6338 anIDs = self.ShapesOp.GetSubShapesIndices(aShape, aSubShapes)
6339 RaiseIfFailed("GetSubShapesIndices", self.ShapesOp)
6345 ## @addtogroup l4_decompose
6348 ## Get all sub-shapes and groups of \a theShape,
6349 # that were created already by any other methods.
6350 # @param theShape Any shape.
6351 # @param theGroupsOnly If this parameter is TRUE, only groups will be
6352 # returned, else all found sub-shapes and groups.
6353 # @return List of existing sub-objects of \a theShape.
6355 # @ref swig_all_decompose "Example"
6356 @ManageTransactions("ShapesOp")
6357 def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
6359 Get all sub-shapes and groups of theShape,
6360 that were created already by any other methods.
6364 theGroupsOnly If this parameter is TRUE, only groups will be
6365 returned, else all found sub-shapes and groups.
6368 List of existing sub-objects of theShape.
6370 # Example: see GEOM_TestAll.py
6371 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
6372 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
6375 ## Get all groups of \a theShape,
6376 # that were created already by any other methods.
6377 # @param theShape Any shape.
6378 # @return List of existing groups of \a theShape.
6380 # @ref swig_all_decompose "Example"
6381 @ManageTransactions("ShapesOp")
6382 def GetGroups(self, theShape):
6384 Get all groups of theShape,
6385 that were created already by any other methods.
6391 List of existing groups of theShape.
6393 # Example: see GEOM_TestAll.py
6394 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
6395 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
6398 ## Explode a shape on sub-shapes of a given type.
6399 # If the shape itself matches the type, it is also returned.
6400 # @param aShape Shape to be exploded.
6401 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6402 # @param theName Object name; when specified, this parameter is used
6403 # for result publication in the study. Otherwise, if automatic
6404 # publication is switched on, default value is used for result name.
6406 # @return List of sub-shapes of type theShapeType, contained in theShape.
6408 # @ref swig_all_decompose "Example"
6409 @ManageTransactions("ShapesOp")
6410 def SubShapeAll(self, aShape, aType, theName=None):
6412 Explode a shape on sub-shapes of a given type.
6413 If the shape itself matches the type, it is also returned.
6416 aShape Shape to be exploded.
6417 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6418 theName Object name; when specified, this parameter is used
6419 for result publication in the study. Otherwise, if automatic
6420 publication is switched on, default value is used for result name.
6423 List of sub-shapes of type theShapeType, contained in theShape.
6425 # Example: see GEOM_TestAll.py
6426 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), False)
6427 RaiseIfFailed("SubShapeAll", self.ShapesOp)
6428 self._autoPublish(ListObj, theName, "subshape")
6431 ## Explode a shape on sub-shapes of a given type.
6432 # @param aShape Shape to be exploded.
6433 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6434 # @return List of IDs of sub-shapes.
6436 # @ref swig_all_decompose "Example"
6437 @ManageTransactions("ShapesOp")
6438 def SubShapeAllIDs(self, aShape, aType):
6440 Explode a shape on sub-shapes of a given type.
6443 aShape Shape to be exploded (see geompy.ShapeType)
6444 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6447 List of IDs of sub-shapes.
6449 ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), False)
6450 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6453 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
6454 # selected by their indices in list of all sub-shapes of type <VAR>aType</VAR>.
6455 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6456 # @param aShape Shape to get sub-shape of.
6457 # @param ListOfInd List of sub-shapes indices.
6458 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6459 # @param theName Object name; when specified, this parameter is used
6460 # for result publication in the study. Otherwise, if automatic
6461 # publication is switched on, default value is used for result name.
6463 # @return A compound of sub-shapes of aShape.
6465 # @ref swig_all_decompose "Example"
6466 def SubShape(self, aShape, aType, ListOfInd, theName=None):
6468 Obtain a compound of sub-shapes of aShape,
6469 selected by their indices in list of all sub-shapes of type aType.
6470 Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6473 aShape Shape to get sub-shape of.
6474 ListOfID List of sub-shapes indices.
6475 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6476 theName Object name; when specified, this parameter is used
6477 for result publication in the study. Otherwise, if automatic
6478 publication is switched on, default value is used for result name.
6481 A compound of sub-shapes of aShape.
6483 # Example: see GEOM_TestAll.py
6485 AllShapeIDsList = self.SubShapeAllIDs(aShape, EnumToLong( aType ))
6486 for ind in ListOfInd:
6487 ListOfIDs.append(AllShapeIDsList[ind - 1])
6488 # note: auto-publishing is done in self.GetSubShape()
6489 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6492 ## Explode a shape on sub-shapes of a given type.
6493 # Sub-shapes will be sorted taking into account their gravity centers,
6494 # to provide stable order of sub-shapes. Please see
6495 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6496 # If the shape itself matches the type, it is also returned.
6497 # @param aShape Shape to be exploded.
6498 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6499 # @param theName Object name; when specified, this parameter is used
6500 # for result publication in the study. Otherwise, if automatic
6501 # publication is switched on, default value is used for result name.
6503 # @return List of sub-shapes of type theShapeType, contained in theShape.
6505 # @ref swig_SubShapeAllSorted "Example"
6506 @ManageTransactions("ShapesOp")
6507 def SubShapeAllSortedCentres(self, aShape, aType, theName=None):
6509 Explode a shape on sub-shapes of a given type.
6510 Sub-shapes will be sorted taking into account their gravity centers,
6511 to provide stable order of sub-shapes.
6512 If the shape itself matches the type, it is also returned.
6515 aShape Shape to be exploded.
6516 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6517 theName Object name; when specified, this parameter is used
6518 for result publication in the study. Otherwise, if automatic
6519 publication is switched on, default value is used for result name.
6522 List of sub-shapes of type theShapeType, contained in theShape.
6524 # Example: see GEOM_TestAll.py
6525 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), True)
6526 RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
6527 self._autoPublish(ListObj, theName, "subshape")
6530 ## Explode a shape on sub-shapes of a given type.
6531 # Sub-shapes will be sorted taking into account their gravity centers,
6532 # to provide stable order of sub-shapes. Please see
6533 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6534 # @param aShape Shape to be exploded.
6535 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6536 # @return List of IDs of sub-shapes.
6538 # @ref swig_all_decompose "Example"
6539 @ManageTransactions("ShapesOp")
6540 def SubShapeAllSortedCentresIDs(self, aShape, aType):
6542 Explode a shape on sub-shapes of a given type.
6543 Sub-shapes will be sorted taking into account their gravity centers,
6544 to provide stable order of sub-shapes.
6547 aShape Shape to be exploded.
6548 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6551 List of IDs of sub-shapes.
6553 ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), True)
6554 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6557 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
6558 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
6559 # Please see @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6560 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6561 # @param aShape Shape to get sub-shape of.
6562 # @param ListOfInd List of sub-shapes indices.
6563 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6564 # @param theName Object name; when specified, this parameter is used
6565 # for result publication in the study. Otherwise, if automatic
6566 # publication is switched on, default value is used for result name.
6568 # @return A compound of sub-shapes of aShape.
6570 # @ref swig_all_decompose "Example"
6571 def SubShapeSortedCentres(self, aShape, aType, ListOfInd, theName=None):
6573 Obtain a compound of sub-shapes of aShape,
6574 selected by they indices in sorted list of all sub-shapes of type aType.
6575 Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6578 aShape Shape to get sub-shape of.
6579 ListOfID List of sub-shapes indices.
6580 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6581 theName Object name; when specified, this parameter is used
6582 for result publication in the study. Otherwise, if automatic
6583 publication is switched on, default value is used for result name.
6586 A compound of sub-shapes of aShape.
6588 # Example: see GEOM_TestAll.py
6590 AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, EnumToLong( aType ))
6591 for ind in ListOfInd:
6592 ListOfIDs.append(AllShapeIDsList[ind - 1])
6593 # note: auto-publishing is done in self.GetSubShape()
6594 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6597 ## Extract shapes (excluding the main shape) of given type.
6598 # @param aShape The shape.
6599 # @param aType The shape type (see ShapeType())
6600 # @param isSorted Boolean flag to switch sorting on/off. Please see
6601 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6602 # @param theName Object name; when specified, this parameter is used
6603 # for result publication in the study. Otherwise, if automatic
6604 # publication is switched on, default value is used for result name.
6606 # @return List of sub-shapes of type aType, contained in aShape.
6608 # @ref swig_FilletChamfer "Example"
6609 @ManageTransactions("ShapesOp")
6610 def ExtractShapes(self, aShape, aType, isSorted = False, theName=None):
6612 Extract shapes (excluding the main shape) of given type.
6616 aType The shape type (see geompy.ShapeType)
6617 isSorted Boolean flag to switch sorting on/off.
6618 theName Object name; when specified, this parameter is used
6619 for result publication in the study. Otherwise, if automatic
6620 publication is switched on, default value is used for result name.
6623 List of sub-shapes of type aType, contained in aShape.
6625 # Example: see GEOM_TestAll.py
6626 ListObj = self.ShapesOp.ExtractSubShapes(aShape, EnumToLong( aType ), isSorted)
6627 RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
6628 self._autoPublish(ListObj, theName, "subshape")
6631 ## Get a set of sub-shapes defined by their unique IDs inside <VAR>aShape</VAR>
6632 # @param aShape Main shape.
6633 # @param anIDs List of unique IDs of sub-shapes inside <VAR>aShape</VAR>.
6634 # @param theName Object name; when specified, this parameter is used
6635 # for result publication in the study. Otherwise, if automatic
6636 # publication is switched on, default value is used for result name.
6637 # @return List of GEOM.GEOM_Object, corresponding to found sub-shapes.
6639 # @ref swig_all_decompose "Example"
6640 @ManageTransactions("ShapesOp")
6641 def SubShapes(self, aShape, anIDs, theName=None):
6643 Get a set of sub-shapes defined by their unique IDs inside theMainShape
6647 anIDs List of unique IDs of sub-shapes inside theMainShape.
6648 theName Object name; when specified, this parameter is used
6649 for result publication in the study. Otherwise, if automatic
6650 publication is switched on, default value is used for result name.
6653 List of GEOM.GEOM_Object, corresponding to found sub-shapes.
6655 # Example: see GEOM_TestAll.py
6656 ListObj = self.ShapesOp.MakeSubShapes(aShape, anIDs)
6657 RaiseIfFailed("SubShapes", self.ShapesOp)
6658 self._autoPublish(ListObj, theName, "subshape")
6661 ## Explode a shape into edges sorted in a row from a starting point.
6662 # @param theShape the shape to be exploded on edges.
6663 # @param theStartPoint the starting point.
6664 # @param theName Object name; when specified, this parameter is used
6665 # for result publication in the study. Otherwise, if automatic
6666 # publication is switched on, default value is used for result name.
6667 # @return List of GEOM.GEOM_Object that is actually an ordered list
6668 # of edges sorted in a row from a starting point.
6670 # @ref swig_GetSubShapeEdgeSorted "Example"
6671 @ManageTransactions("ShapesOp")
6672 def GetSubShapeEdgeSorted(self, theShape, theStartPoint, theName=None):
6674 Explode a shape into edges sorted in a row from a starting point.
6677 theShape the shape to be exploded on edges.
6678 theStartPoint the starting point.
6679 theName Object name; when specified, this parameter is used
6680 for result publication in the study. Otherwise, if automatic
6681 publication is switched on, default value is used for result name.
6684 List of GEOM.GEOM_Object that is actually an ordered list
6685 of edges sorted in a row from a starting point.
6687 # Example: see GEOM_TestAll.py
6688 ListObj = self.ShapesOp.GetSubShapeEdgeSorted(theShape, theStartPoint)
6689 RaiseIfFailed("GetSubShapeEdgeSorted", self.ShapesOp)
6690 self._autoPublish(ListObj, theName, "SortedEdges")
6694 # Return the list of subshapes that satisfies a certain tolerance
6695 # criterion. The user defines the type of shapes to be returned, the
6696 # condition and the tolerance value. The operation is defined for
6697 # faces, edges and vertices only. E.g. for theShapeType FACE,
6698 # theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
6699 # all faces of theShape that have tolerances greater then 1.e7.
6701 # @param theShape the shape to be exploded
6702 # @param theShapeType the type of sub-shapes to be returned (see
6703 # ShapeType()). Can have the values FACE, EDGE and VERTEX only.
6704 # @param theCondition the condition type (see GEOM::comparison_condition).
6705 # @param theTolerance the tolerance filter.
6706 # @param theName Object name; when specified, this parameter is used
6707 # for result publication in the study. Otherwise, if automatic
6708 # publication is switched on, default value is used for result name.
6709 # @return the list of shapes that satisfy the conditions.
6711 # @ref swig_GetSubShapesWithTolerance "Example"
6712 @ManageTransactions("ShapesOp")
6713 def GetSubShapesWithTolerance(self, theShape, theShapeType,
6714 theCondition, theTolerance, theName=None):
6716 Return the list of subshapes that satisfies a certain tolerance
6717 criterion. The user defines the type of shapes to be returned, the
6718 condition and the tolerance value. The operation is defined for
6719 faces, edges and vertices only. E.g. for theShapeType FACE,
6720 theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
6721 all faces of theShape that have tolerances greater then 1.e7.
6724 theShape the shape to be exploded
6725 theShapeType the type of sub-shapes to be returned (see
6726 ShapeType()). Can have the values FACE,
6727 EDGE and VERTEX only.
6728 theCondition the condition type (see GEOM::comparison_condition).
6729 theTolerance the tolerance filter.
6730 theName Object name; when specified, this parameter is used
6731 for result publication in the study. Otherwise, if automatic
6732 publication is switched on, default value is used for result name.
6735 The list of shapes that satisfy the conditions.
6737 # Example: see GEOM_TestAll.py
6738 ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
6739 theCondition, theTolerance)
6740 RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
6741 self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
6744 ## Check if the object is a sub-object of another GEOM object.
6745 # @param aSubObject Checked sub-object (or its parent object, in case if
6746 # \a theSubObjectIndex is non-zero).
6747 # @param anObject An object that is checked for ownership (or its parent object,
6748 # in case if \a theObjectIndex is non-zero).
6749 # @param aSubObjectIndex When non-zero, specifies a sub-shape index that
6750 # identifies a sub-object within its parent specified via \a theSubObject.
6751 # @param anObjectIndex When non-zero, specifies a sub-shape index that
6752 # identifies an object within its parent specified via \a theObject.
6753 # @return TRUE, if the given object contains sub-object.
6754 @ManageTransactions("ShapesOp")
6755 def IsSubShapeBelongsTo(self, aSubObject, anObject, aSubObjectIndex = 0, anObjectIndex = 0):
6757 Check if the object is a sub-object of another GEOM object.
6760 aSubObject Checked sub-object (or its parent object, in case if
6761 \a theSubObjectIndex is non-zero).
6762 anObject An object that is checked for ownership (or its parent object,
6763 in case if \a theObjectIndex is non-zero).
6764 aSubObjectIndex When non-zero, specifies a sub-shape index that
6765 identifies a sub-object within its parent specified via \a theSubObject.
6766 anObjectIndex When non-zero, specifies a sub-shape index that
6767 identifies an object within its parent specified via \a theObject.
6770 TRUE, if the given object contains sub-object.
6772 IsOk = self.ShapesOp.IsSubShapeBelongsTo(aSubObject, aSubObjectIndex, anObject, anObjectIndex)
6773 RaiseIfFailed("IsSubShapeBelongsTo", self.ShapesOp)
6776 ## Perform extraction of sub-shapes from the main shape.
6778 # @param theShape the main shape
6779 # @param theListOfID the list of sub-shape IDs to be extracted from
6781 # @return New GEOM.GEOM_Object, containing the shape without
6782 # extracted sub-shapes.
6784 # @ref swig_MakeExtraction "Example"
6785 @ManageTransactions("ShapesOp")
6786 def MakeExtraction(self, theShape, theListOfID, theName=None):
6788 Perform extraction of sub-shapes from the main shape.
6791 theShape the main shape
6792 theListOfID the list of sub-shape IDs to be extracted from
6796 New GEOM.GEOM_Object, containing the shape without
6797 extracted sub-shapes.
6799 # Example: see GEOM_TestAll.py
6800 (anObj, aStat) = self.ShapesOp.MakeExtraction(theShape, theListOfID)
6801 RaiseIfFailed("MakeExtraction", self.ShapesOp)
6802 self._autoPublish(anObj, theName, "Extraction")
6805 # end of l4_decompose
6808 ## @addtogroup l4_decompose_d
6811 ## Deprecated method
6812 # It works like SubShapeAllSortedCentres(), but wrongly
6813 # defines centres of faces, shells and solids.
6814 @ManageTransactions("ShapesOp")
6815 def SubShapeAllSorted(self, aShape, aType, theName=None):
6818 It works like geompy.SubShapeAllSortedCentres, but wrongly
6819 defines centres of faces, shells and solids.
6821 ListObj = self.ShapesOp.MakeExplode(aShape, EnumToLong( aType ), True)
6822 RaiseIfFailed("MakeExplode", self.ShapesOp)
6823 self._autoPublish(ListObj, theName, "subshape")
6826 ## Deprecated method
6827 # It works like SubShapeAllSortedCentresIDs(), but wrongly
6828 # defines centres of faces, shells and solids.
6829 @ManageTransactions("ShapesOp")
6830 def SubShapeAllSortedIDs(self, aShape, aType):
6833 It works like geompy.SubShapeAllSortedCentresIDs, but wrongly
6834 defines centres of faces, shells and solids.
6836 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, EnumToLong( aType ), True)
6837 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6840 ## Deprecated method
6841 # It works like SubShapeSortedCentres(), but has a bug
6842 # (wrongly defines centres of faces, shells and solids).
6843 def SubShapeSorted(self, aShape, aType, ListOfInd, theName=None):
6846 It works like geompy.SubShapeSortedCentres, but has a bug
6847 (wrongly defines centres of faces, shells and solids).
6850 AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, EnumToLong( aType ))
6851 for ind in ListOfInd:
6852 ListOfIDs.append(AllShapeIDsList[ind - 1])
6853 # note: auto-publishing is done in self.GetSubShape()
6854 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6857 # end of l4_decompose_d
6860 ## @addtogroup l3_healing
6863 ## Apply a sequence of Shape Healing operators to the given object.
6864 # @param theShape Shape to be processed.
6865 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
6866 # @param theParameters List of names of parameters
6867 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
6868 # @param theValues List of values of parameters, in the same order
6869 # as parameters are listed in <VAR>theParameters</VAR> list.
6870 # @param theName Object name; when specified, this parameter is used
6871 # for result publication in the study. Otherwise, if automatic
6872 # publication is switched on, default value is used for result name.
6874 # <b> Operators and Parameters: </b> \n
6876 # * \b FixShape - corrects invalid shapes. \n
6877 # - \b FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them. \n
6878 # - \b FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction. \n
6880 # * \b FixFaceSize - removes small faces, such as spots and strips.\n
6881 # - \b FixFaceSize.Tolerance - defines minimum possible face size. \n
6882 # - \b DropSmallEdges - removes edges, which merge with neighbouring edges. \n
6883 # - \b DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.\n
6884 # - \b DropSmallSolids - either removes small solids or merges them with neighboring ones. \n
6885 # - \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
6886 # - \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
6887 # - \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
6889 # * \b SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical
6890 # surfaces in segments using a certain angle. \n
6891 # - \b SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
6892 # if Angle=180, four if Angle=90, etc). \n
6893 # - \b SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.\n
6895 # * \b SplitClosedFaces - splits closed faces in segments.
6896 # The number of segments depends on the number of splitting points.\n
6897 # - \b SplitClosedFaces.NbSplitPoints - the number of splitting points.\n
6899 # * \b SplitContinuity - splits shapes to reduce continuities of curves and surfaces.\n
6900 # - \b SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.\n
6901 # - \b SplitContinuity.SurfaceContinuity - required continuity for surfaces.\n
6902 # - \b SplitContinuity.CurveContinuity - required continuity for curves.\n
6903 # This and the previous parameters can take the following values:\n
6904 # \b Parametric \b Continuity \n
6905 # \b C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces
6906 # are coincidental. The curves or surfaces may still meet at an angle, giving rise to a sharp corner or edge).\n
6907 # \b C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces are parallel,
6908 # ruling out sharp edges).\n
6909 # \b C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves or surfaces
6910 # are of the same magnitude).\n
6911 # \b CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of curves
6912 # or surfaces (d/du C(u)) are the same at junction. \n
6913 # \b Geometric \b Continuity \n
6914 # \b G1: first derivatives are proportional at junction.\n
6915 # The curve tangents thus have the same direction, but not necessarily the same magnitude.
6916 # i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).\n
6917 # \b G2: first and second derivatives are proportional at junction.
6918 # As the names imply, geometric continuity requires the geometry to be continuous, while parametric
6919 # continuity requires that the underlying parameterization was continuous as well.
6920 # Parametric continuity of order n implies geometric continuity of order n, but not vice-versa.\n
6922 # * \b BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:\n
6923 # - \b BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.\n
6924 # - \b BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.\n
6925 # - \b BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.\n
6926 # - \b BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation
6927 # with the specified parameters.\n
6928 # - \b BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation
6929 # with the specified parameters.\n
6930 # - \b BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.\n
6931 # - \b BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.\n
6932 # - \b BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.\n
6933 # - \b BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.\n
6935 # * \b ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.\n
6936 # - \b ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.\n
6937 # - \b ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.\n
6938 # - \b ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.\n
6939 # - \b ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.\n
6941 # * \b SameParameter - fixes edges of 2D and 3D curves not having the same parameter.\n
6942 # - \b SameParameter.Tolerance3d - defines tolerance for fixing of edges.\n
6945 # @return New GEOM.GEOM_Object, containing processed shape.
6947 # \n @ref tui_shape_processing "Example"
6948 @ManageTransactions("HealOp")
6949 def ProcessShape(self, theShape, theOperators, theParameters, theValues, theName=None):
6951 Apply a sequence of Shape Healing operators to the given object.
6954 theShape Shape to be processed.
6955 theValues List of values of parameters, in the same order
6956 as parameters are listed in theParameters list.
6957 theOperators List of names of operators ('FixShape', 'SplitClosedFaces', etc.).
6958 theParameters List of names of parameters
6959 ('FixShape.Tolerance3d', 'SplitClosedFaces.NbSplitPoints', etc.).
6960 theName Object name; when specified, this parameter is used
6961 for result publication in the study. Otherwise, if automatic
6962 publication is switched on, default value is used for result name.
6964 Operators and Parameters:
6966 * FixShape - corrects invalid shapes.
6967 * FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them.
6968 * FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction.
6969 * FixFaceSize - removes small faces, such as spots and strips.
6970 * FixFaceSize.Tolerance - defines minimum possible face size.
6971 * DropSmallEdges - removes edges, which merge with neighbouring edges.
6972 * DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.
6973 * DropSmallSolids - either removes small solids or merges them with neighboring ones.
6974 * 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.
6975 * 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.
6976 * 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.
6978 * SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical surfaces
6979 in segments using a certain angle.
6980 * SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
6981 if Angle=180, four if Angle=90, etc).
6982 * SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.
6983 * SplitClosedFaces - splits closed faces in segments. The number of segments depends on the number of
6985 * SplitClosedFaces.NbSplitPoints - the number of splitting points.
6986 * SplitContinuity - splits shapes to reduce continuities of curves and surfaces.
6987 * SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.
6988 * SplitContinuity.SurfaceContinuity - required continuity for surfaces.
6989 * SplitContinuity.CurveContinuity - required continuity for curves.
6990 This and the previous parameters can take the following values:
6992 Parametric Continuity:
6993 C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces are
6994 coincidental. The curves or surfaces may still meet at an angle,
6995 giving rise to a sharp corner or edge).
6996 C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces
6997 are parallel, ruling out sharp edges).
6998 C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves
6999 or surfaces are of the same magnitude).
7000 CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of
7001 curves or surfaces (d/du C(u)) are the same at junction.
7003 Geometric Continuity:
7004 G1: first derivatives are proportional at junction.
7005 The curve tangents thus have the same direction, but not necessarily the same magnitude.
7006 i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).
7007 G2: first and second derivatives are proportional at junction. As the names imply,
7008 geometric continuity requires the geometry to be continuous, while parametric continuity requires
7009 that the underlying parameterization was continuous as well. Parametric continuity of order n implies
7010 geometric continuity of order n, but not vice-versa.
7011 * BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:
7012 * BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.
7013 * BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.
7014 * BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.
7015 * BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation with
7016 the specified parameters.
7017 * BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation with
7018 the specified parameters.
7019 * BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.
7020 * BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.
7021 * BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.
7022 * BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.
7023 * ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.
7024 * ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.
7025 * ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.
7026 * ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.
7027 * ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.
7028 * SameParameter - fixes edges of 2D and 3D curves not having the same parameter.
7029 * SameParameter.Tolerance3d - defines tolerance for fixing of edges.
7032 New GEOM.GEOM_Object, containing processed shape.
7034 Note: For more information look through SALOME Geometry User's Guide->
7035 -> Introduction to Geometry-> Repairing Operations-> Shape Processing
7037 # Example: see GEOM_TestHealing.py
7038 theValues,Parameters = ParseList(theValues)
7039 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
7040 # To avoid script failure in case of good argument shape
7041 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
7043 RaiseIfFailed("ProcessShape", self.HealOp)
7044 for string in (theOperators + theParameters):
7045 Parameters = ":" + Parameters
7047 anObj.SetParameters(Parameters)
7048 self._autoPublish(anObj, theName, "healed")
7051 ## Remove faces from the given object (shape).
7052 # @param theObject Shape to be processed.
7053 # @param theFaces Indices of faces to be removed, if EMPTY then the method
7054 # removes ALL faces of the given object.
7055 # @param theName Object name; when specified, this parameter is used
7056 # for result publication in the study. Otherwise, if automatic
7057 # publication is switched on, default value is used for result name.
7059 # @return New GEOM.GEOM_Object, containing processed shape.
7061 # @ref tui_suppress_faces "Example"
7062 @ManageTransactions("HealOp")
7063 def SuppressFaces(self, theObject, theFaces, theName=None):
7065 Remove faces from the given object (shape).
7068 theObject Shape to be processed.
7069 theFaces Indices of faces to be removed, if EMPTY then the method
7070 removes ALL faces of the given object.
7071 theName Object name; when specified, this parameter is used
7072 for result publication in the study. Otherwise, if automatic
7073 publication is switched on, default value is used for result name.
7076 New GEOM.GEOM_Object, containing processed shape.
7078 # Example: see GEOM_TestHealing.py
7079 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
7080 RaiseIfFailed("SuppressFaces", self.HealOp)
7081 self._autoPublish(anObj, theName, "suppressFaces")
7084 ## Sewing of faces into a single shell.
7085 # @param ListShape Shapes to be processed.
7086 # @param theTolerance Required tolerance value.
7087 # @param AllowNonManifold Flag that allows non-manifold sewing.
7088 # @param theName Object name; when specified, this parameter is used
7089 # for result publication in the study. Otherwise, if automatic
7090 # publication is switched on, default value is used for result name.
7092 # @return New GEOM.GEOM_Object, containing a result shell.
7094 # @ref tui_sewing "Example"
7095 def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
7097 Sewing of faces into a single shell.
7100 ListShape Shapes to be processed.
7101 theTolerance Required tolerance value.
7102 AllowNonManifold Flag that allows non-manifold sewing.
7103 theName Object name; when specified, this parameter is used
7104 for result publication in the study. Otherwise, if automatic
7105 publication is switched on, default value is used for result name.
7108 New GEOM.GEOM_Object, containing containing a result shell.
7110 # Example: see GEOM_TestHealing.py
7111 # note: auto-publishing is done in self.Sew()
7112 anObj = self.Sew(ListShape, theTolerance, AllowNonManifold, theName)
7115 ## Sewing of faces into a single shell.
7116 # @param ListShape Shapes to be processed.
7117 # @param theTolerance Required tolerance value.
7118 # @param AllowNonManifold Flag that allows non-manifold sewing.
7119 # @param theName Object name; when specified, this parameter is used
7120 # for result publication in the study. Otherwise, if automatic
7121 # publication is switched on, default value is used for result name.
7123 # @return New GEOM.GEOM_Object, containing a result shell.
7124 @ManageTransactions("HealOp")
7125 def Sew(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
7127 Sewing of faces into a single shell.
7130 ListShape Shapes to be processed.
7131 theTolerance Required tolerance value.
7132 AllowNonManifold Flag that allows non-manifold sewing.
7133 theName Object name; when specified, this parameter is used
7134 for result publication in the study. Otherwise, if automatic
7135 publication is switched on, default value is used for result name.
7138 New GEOM.GEOM_Object, containing a result shell.
7140 # Example: see MakeSewing() above
7141 theTolerance,Parameters = ParseParameters(theTolerance)
7142 if AllowNonManifold:
7143 anObj = self.HealOp.SewAllowNonManifold( ToList( ListShape ), theTolerance)
7145 anObj = self.HealOp.Sew( ToList( ListShape ), theTolerance)
7146 # To avoid script failure in case of good argument shape
7147 # (Fix of test cases geom/bugs11/L7,L8)
7148 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
7150 RaiseIfFailed("Sew", self.HealOp)
7151 anObj.SetParameters(Parameters)
7152 self._autoPublish(anObj, theName, "sewed")
7155 ## Rebuild the topology of theSolids by removing
7156 # the faces that are shared by several solids.
7157 # @param theSolids A compound or a list of solids to be processed.
7158 # @param theName Object name; when specified, this parameter is used
7159 # for result publication in the study. Otherwise, if automatic
7160 # publication is switched on, default value is used for result name.
7162 # @return New GEOM.GEOM_Object, containing processed shape.
7164 # @ref tui_remove_webs "Example"
7165 @ManageTransactions("HealOp")
7166 def RemoveInternalFaces (self, theSolids, theName=None):
7168 Rebuild the topology of theSolids by removing
7169 the faces that are shared by several solids.
7172 theSolids A compound or a list of solids to be processed.
7173 theName Object name; when specified, this parameter is used
7174 for result publication in the study. Otherwise, if automatic
7175 publication is switched on, default value is used for result name.
7178 New GEOM.GEOM_Object, containing processed shape.
7180 # Example: see GEOM_TestHealing.py
7181 anObj = self.HealOp.RemoveInternalFaces(ToList(theSolids))
7182 RaiseIfFailed("RemoveInternalFaces", self.HealOp)
7183 self._autoPublish(anObj, theName, "removeWebs")
7186 ## Remove internal wires and edges from the given object (face).
7187 # @param theObject Shape to be processed.
7188 # @param theWires Indices of wires to be removed, if EMPTY then the method
7189 # removes ALL internal wires of the given object.
7190 # @param theName Object name; when specified, this parameter is used
7191 # for result publication in the study. Otherwise, if automatic
7192 # publication is switched on, default value is used for result name.
7194 # @return New GEOM.GEOM_Object, containing processed shape.
7196 # @ref tui_suppress_internal_wires "Example"
7197 @ManageTransactions("HealOp")
7198 def SuppressInternalWires(self, theObject, theWires, theName=None):
7200 Remove internal wires and edges from the given object (face).
7203 theObject Shape to be processed.
7204 theWires Indices of wires to be removed, if EMPTY then the method
7205 removes ALL internal wires of the given object.
7206 theName Object name; when specified, this parameter is used
7207 for result publication in the study. Otherwise, if automatic
7208 publication is switched on, default value is used for result name.
7211 New GEOM.GEOM_Object, containing processed shape.
7213 # Example: see GEOM_TestHealing.py
7214 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
7215 RaiseIfFailed("RemoveIntWires", self.HealOp)
7216 self._autoPublish(anObj, theName, "suppressWires")
7219 ## Remove internal closed contours (holes) from the given object.
7220 # @param theObject Shape to be processed.
7221 # @param theWires Indices of wires to be removed, if EMPTY then the method
7222 # removes ALL internal holes of the given object
7223 # @param theName Object name; when specified, this parameter is used
7224 # for result publication in the study. Otherwise, if automatic
7225 # publication is switched on, default value is used for result name.
7227 # @return New GEOM.GEOM_Object, containing processed shape.
7229 # @ref tui_suppress_holes "Example"
7230 @ManageTransactions("HealOp")
7231 def SuppressHoles(self, theObject, theWires, theName=None):
7233 Remove internal closed contours (holes) from the given object.
7236 theObject Shape to be processed.
7237 theWires Indices of wires to be removed, if EMPTY then the method
7238 removes ALL internal holes of the given object
7239 theName Object name; when specified, this parameter is used
7240 for result publication in the study. Otherwise, if automatic
7241 publication is switched on, default value is used for result name.
7244 New GEOM.GEOM_Object, containing processed shape.
7246 # Example: see GEOM_TestHealing.py
7247 anObj = self.HealOp.FillHoles(theObject, theWires)
7248 RaiseIfFailed("FillHoles", self.HealOp)
7249 self._autoPublish(anObj, theName, "suppressHoles")
7252 ## Close an open wire.
7253 # @param theObject Shape to be processed.
7254 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
7255 # if [ ], then <VAR>theObject</VAR> itself is a wire.
7256 # @param isCommonVertex If True : closure by creation of a common vertex,
7257 # If False : closure by creation of an edge between ends.
7258 # @param theName Object name; when specified, this parameter is used
7259 # for result publication in the study. Otherwise, if automatic
7260 # publication is switched on, default value is used for result name.
7262 # @return New GEOM.GEOM_Object, containing processed shape.
7264 # @ref tui_close_contour "Example"
7265 @ManageTransactions("HealOp")
7266 def CloseContour(self,theObject, theWires, isCommonVertex, theName=None):
7271 theObject Shape to be processed.
7272 theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape,
7273 if [ ], then theObject itself is a wire.
7274 isCommonVertex If True : closure by creation of a common vertex,
7275 If False : closure by creation of an edge between ends.
7276 theName Object name; when specified, this parameter is used
7277 for result publication in the study. Otherwise, if automatic
7278 publication is switched on, default value is used for result name.
7281 New GEOM.GEOM_Object, containing processed shape.
7283 # Example: see GEOM_TestHealing.py
7284 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
7285 RaiseIfFailed("CloseContour", self.HealOp)
7286 self._autoPublish(anObj, theName, "closeContour")
7289 ## Addition of a point to a given edge object.
7290 # @param theObject Shape to be processed.
7291 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
7292 # if -1, then theObject itself is the edge.
7293 # @param theValue Value of parameter on edge or length parameter,
7294 # depending on \a isByParameter.
7295 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], \n
7296 # if FALSE : \a theValue is treated as a length parameter [0..1]
7297 # @param theName Object name; when specified, this parameter is used
7298 # for result publication in the study. Otherwise, if automatic
7299 # publication is switched on, default value is used for result name.
7301 # @return New GEOM.GEOM_Object, containing processed shape.
7303 # @ref tui_add_point_on_edge "Example"
7304 @ManageTransactions("HealOp")
7305 def DivideEdge(self, theObject, theEdgeIndex, theValue, isByParameter, theName=None):
7307 Addition of a point to a given edge object.
7310 theObject Shape to be processed.
7311 theEdgeIndex Index of edge to be divided within theObject's shape,
7312 if -1, then theObject itself is the edge.
7313 theValue Value of parameter on edge or length parameter,
7314 depending on isByParameter.
7315 isByParameter If TRUE : theValue is treated as a curve parameter [0..1],
7316 if FALSE : theValue is treated as a length parameter [0..1]
7317 theName Object name; when specified, this parameter is used
7318 for result publication in the study. Otherwise, if automatic
7319 publication is switched on, default value is used for result name.
7322 New GEOM.GEOM_Object, containing processed shape.
7324 # Example: see GEOM_TestHealing.py
7325 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
7326 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
7327 RaiseIfFailed("DivideEdge", self.HealOp)
7328 anObj.SetParameters(Parameters)
7329 self._autoPublish(anObj, theName, "divideEdge")
7332 ## Addition of points to a given edge of \a theObject by projecting
7333 # other points to the given edge.
7334 # @param theObject Shape to be processed.
7335 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
7336 # if -1, then theObject itself is the edge.
7337 # @param thePoints List of points to project to theEdgeIndex-th edge.
7338 # @param theName Object name; when specified, this parameter is used
7339 # for result publication in the study. Otherwise, if automatic
7340 # publication is switched on, default value is used for result name.
7342 # @return New GEOM.GEOM_Object, containing processed shape.
7344 # @ref tui_add_point_on_edge "Example"
7345 @ManageTransactions("HealOp")
7346 def DivideEdgeByPoint(self, theObject, theEdgeIndex, thePoints, theName=None):
7348 Addition of points to a given edge of \a theObject by projecting
7349 other points to the given edge.
7352 theObject Shape to be processed.
7353 theEdgeIndex The edge or its index to be divided within theObject's shape,
7354 if -1, then theObject itself is the edge.
7355 thePoints List of points to project to theEdgeIndex-th edge.
7356 theName Object name; when specified, this parameter is used
7357 for result publication in the study. Otherwise, if automatic
7358 publication is switched on, default value is used for result name.
7361 New GEOM.GEOM_Object, containing processed shape.
7363 # Example: see GEOM_TestHealing.py
7364 if isinstance( theEdgeIndex, GEOM._objref_GEOM_Object ):
7365 theEdgeIndex = self.GetSubShapeID( theObject, theEdgeIndex )
7366 anObj = self.HealOp.DivideEdgeByPoint(theObject, theEdgeIndex, ToList( thePoints ))
7367 RaiseIfFailed("DivideEdgeByPoint", self.HealOp)
7368 self._autoPublish(anObj, theName, "divideEdge")
7371 ## Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
7372 # @param theWire Wire to minimize the number of C1 continuous edges in.
7373 # @param theVertices A list of vertices to suppress. If the list
7374 # is empty, all vertices in a wire will be assumed.
7375 # @param theName Object name; when specified, this parameter is used
7376 # for result publication in the study. Otherwise, if automatic
7377 # publication is switched on, default value is used for result name.
7379 # @return New GEOM.GEOM_Object with modified wire.
7381 # @ref tui_fuse_collinear_edges "Example"
7382 @ManageTransactions("HealOp")
7383 def FuseCollinearEdgesWithinWire(self, theWire, theVertices = [], theName=None):
7385 Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
7388 theWire Wire to minimize the number of C1 continuous edges in.
7389 theVertices A list of vertices to suppress. If the list
7390 is empty, all vertices in a wire will be assumed.
7391 theName Object name; when specified, this parameter is used
7392 for result publication in the study. Otherwise, if automatic
7393 publication is switched on, default value is used for result name.
7396 New GEOM.GEOM_Object with modified wire.
7398 anObj = self.HealOp.FuseCollinearEdgesWithinWire(theWire, theVertices)
7399 RaiseIfFailed("FuseCollinearEdgesWithinWire", self.HealOp)
7400 self._autoPublish(anObj, theName, "fuseEdges")
7403 ## Change orientation of the given object. Updates given shape.
7404 # @param theObject Shape to be processed.
7405 # @return Updated <var>theObject</var>
7407 # @ref swig_todo "Example"
7408 @ManageTransactions("HealOp")
7409 def ChangeOrientationShell(self,theObject):
7411 Change orientation of the given object. Updates given shape.
7414 theObject Shape to be processed.
7419 theObject = self.HealOp.ChangeOrientation(theObject)
7420 RaiseIfFailed("ChangeOrientation", self.HealOp)
7423 ## Change orientation of the given object.
7424 # @param theObject Shape to be processed.
7425 # @param theName Object name; when specified, this parameter is used
7426 # for result publication in the study. Otherwise, if automatic
7427 # publication is switched on, default value is used for result name.
7429 # @return New GEOM.GEOM_Object, containing processed shape.
7431 # @ref swig_todo "Example"
7432 @ManageTransactions("HealOp")
7433 def ChangeOrientationShellCopy(self, theObject, theName=None):
7435 Change orientation of the given object.
7438 theObject Shape to be processed.
7439 theName Object name; when specified, this parameter is used
7440 for result publication in the study. Otherwise, if automatic
7441 publication is switched on, default value is used for result name.
7444 New GEOM.GEOM_Object, containing processed shape.
7446 anObj = self.HealOp.ChangeOrientationCopy(theObject)
7447 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
7448 self._autoPublish(anObj, theName, "reversed")
7451 ## Try to limit tolerance of the given object by value \a theTolerance.
7452 # @param theObject Shape to be processed.
7453 # @param theTolerance Required tolerance value.
7454 # @param theName Object name; when specified, this parameter is used
7455 # for result publication in the study. Otherwise, if automatic
7456 # publication is switched on, default value is used for result name.
7458 # @return New GEOM.GEOM_Object, containing processed shape.
7460 # @ref tui_limit_tolerance "Example"
7461 @ManageTransactions("HealOp")
7462 def LimitTolerance(self, theObject, theTolerance = 1e-07, theName=None):
7464 Try to limit tolerance of the given object by value theTolerance.
7467 theObject Shape to be processed.
7468 theTolerance Required tolerance value.
7469 theName Object name; when specified, this parameter is used
7470 for result publication in the study. Otherwise, if automatic
7471 publication is switched on, default value is used for result name.
7474 New GEOM.GEOM_Object, containing processed shape.
7476 anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
7477 RaiseIfFailed("LimitTolerance", self.HealOp)
7478 self._autoPublish(anObj, theName, "limitTolerance")
7481 ## Get a list of wires (wrapped in GEOM.GEOM_Object-s),
7482 # that constitute a free boundary of the given shape.
7483 # @param theObject Shape to get free boundary of.
7484 # @param theName Object name; when specified, this parameter is used
7485 # for result publication in the study. Otherwise, if automatic
7486 # publication is switched on, default value is used for result name.
7488 # @return [\a status, \a theClosedWires, \a theOpenWires]
7489 # \n \a status: FALSE, if an error(s) occurred during the method execution.
7490 # \n \a theClosedWires: Closed wires on the free boundary of the given shape.
7491 # \n \a theOpenWires: Open wires on the free boundary of the given shape.
7493 # @ref tui_free_boundaries_page "Example"
7494 @ManageTransactions("HealOp")
7495 def GetFreeBoundary(self, theObject, theName=None):
7497 Get a list of wires (wrapped in GEOM.GEOM_Object-s),
7498 that constitute a free boundary of the given shape.
7501 theObject Shape to get free boundary of.
7502 theName Object name; when specified, this parameter is used
7503 for result publication in the study. Otherwise, if automatic
7504 publication is switched on, default value is used for result name.
7507 [status, theClosedWires, theOpenWires]
7508 status: FALSE, if an error(s) occurred during the method execution.
7509 theClosedWires: Closed wires on the free boundary of the given shape.
7510 theOpenWires: Open wires on the free boundary of the given shape.
7512 # Example: see GEOM_TestHealing.py
7513 anObj = self.HealOp.GetFreeBoundary( ToList( theObject ))
7514 RaiseIfFailed("GetFreeBoundary", self.HealOp)
7515 self._autoPublish(anObj[1], theName, "closedWire")
7516 self._autoPublish(anObj[2], theName, "openWire")
7519 ## Replace coincident faces in \a theShapes by one face.
7520 # @param theShapes Initial shapes, either a list or compound of shapes.
7521 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
7522 # @param doKeepNonSolids If FALSE, only solids will present in the result,
7523 # otherwise all initial shapes.
7524 # @param theName Object name; when specified, this parameter is used
7525 # for result publication in the study. Otherwise, if automatic
7526 # publication is switched on, default value is used for result name.
7528 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7530 # @ref tui_glue_faces "Example"
7531 @ManageTransactions("ShapesOp")
7532 def MakeGlueFaces(self, theShapes, theTolerance, doKeepNonSolids=True, theName=None):
7534 Replace coincident faces in theShapes by one face.
7537 theShapes Initial shapes, either a list or compound of shapes.
7538 theTolerance Maximum distance between faces, which can be considered as coincident.
7539 doKeepNonSolids If FALSE, only solids will present in the result,
7540 otherwise all initial shapes.
7541 theName Object name; when specified, this parameter is used
7542 for result publication in the study. Otherwise, if automatic
7543 publication is switched on, default value is used for result name.
7546 New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7548 # Example: see GEOM_Spanner.py
7549 theTolerance,Parameters = ParseParameters(theTolerance)
7550 anObj = self.ShapesOp.MakeGlueFaces(ToList(theShapes), theTolerance, doKeepNonSolids)
7552 raise RuntimeError("MakeGlueFaces : " + self.ShapesOp.GetErrorCode())
7553 anObj.SetParameters(Parameters)
7554 self._autoPublish(anObj, theName, "glueFaces")
7557 ## Find coincident faces in \a theShapes for possible gluing.
7558 # @param theShapes Initial shapes, either a list or compound of shapes.
7559 # @param theTolerance Maximum distance between faces,
7560 # which can be considered as coincident.
7561 # @param theName Object name; when specified, this parameter is used
7562 # for result publication in the study. Otherwise, if automatic
7563 # publication is switched on, default value is used for result name.
7565 # @return GEOM.ListOfGO
7567 # @ref tui_glue_faces "Example"
7568 @ManageTransactions("ShapesOp")
7569 def GetGlueFaces(self, theShapes, theTolerance, theName=None):
7571 Find coincident faces in theShapes for possible gluing.
7574 theShapes Initial shapes, either a list or compound of shapes.
7575 theTolerance Maximum distance between faces,
7576 which can be considered as coincident.
7577 theName Object name; when specified, this parameter is used
7578 for result publication in the study. Otherwise, if automatic
7579 publication is switched on, default value is used for result name.
7584 anObj = self.ShapesOp.GetGlueFaces(ToList(theShapes), theTolerance)
7585 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
7586 self._autoPublish(anObj, theName, "facesToGlue")
7589 ## Replace coincident faces in \a theShapes by one face
7590 # in compliance with given list of faces
7591 # @param theShapes Initial shapes, either a list or compound of shapes.
7592 # @param theTolerance Maximum distance between faces,
7593 # which can be considered as coincident.
7594 # @param theFaces List of faces for gluing.
7595 # @param doKeepNonSolids If FALSE, only solids will present in the result,
7596 # otherwise all initial shapes.
7597 # @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
7598 # will be glued, otherwise only the edges,
7599 # belonging to <VAR>theFaces</VAR>.
7600 # @param theName Object name; when specified, this parameter is used
7601 # for result publication in the study. Otherwise, if automatic
7602 # publication is switched on, default value is used for result name.
7604 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7606 # @ref tui_glue_faces "Example"
7607 @ManageTransactions("ShapesOp")
7608 def MakeGlueFacesByList(self, theShapes, theTolerance, theFaces,
7609 doKeepNonSolids=True, doGlueAllEdges=True, theName=None):
7611 Replace coincident faces in theShapes by one face
7612 in compliance with given list of faces
7615 theShapes theShapes Initial shapes, either a list or compound of shapes.
7616 theTolerance Maximum distance between faces,
7617 which can be considered as coincident.
7618 theFaces List of faces for gluing.
7619 doKeepNonSolids If FALSE, only solids will present in the result,
7620 otherwise all initial shapes.
7621 doGlueAllEdges If TRUE, all coincident edges of theShape
7622 will be glued, otherwise only the edges,
7623 belonging to theFaces.
7624 theName Object name; when specified, this parameter is used
7625 for result publication in the study. Otherwise, if automatic
7626 publication is switched on, default value is used for result name.
7629 New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7631 anObj = self.ShapesOp.MakeGlueFacesByList(ToList(theShapes), theTolerance, ToList(theFaces),
7632 doKeepNonSolids, doGlueAllEdges)
7634 raise RuntimeError("MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode())
7635 self._autoPublish(anObj, theName, "glueFaces")
7638 ## Replace coincident edges in \a theShapes by one edge.
7639 # @param theShapes Initial shapes, either a list or compound of shapes.
7640 # @param theTolerance Maximum distance between edges, which can be considered as coincident.
7641 # @param theName Object name; when specified, this parameter is used
7642 # for result publication in the study. Otherwise, if automatic
7643 # publication is switched on, default value is used for result name.
7645 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7647 # @ref tui_glue_edges "Example"
7648 @ManageTransactions("ShapesOp")
7649 def MakeGlueEdges(self, theShapes, theTolerance, theName=None):
7651 Replace coincident edges in theShapes by one edge.
7654 theShapes Initial shapes, either a list or compound of shapes.
7655 theTolerance Maximum distance between edges, which can be considered as coincident.
7656 theName Object name; when specified, this parameter is used
7657 for result publication in the study. Otherwise, if automatic
7658 publication is switched on, default value is used for result name.
7661 New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7663 theTolerance,Parameters = ParseParameters(theTolerance)
7664 anObj = self.ShapesOp.MakeGlueEdges(ToList(theShapes), theTolerance)
7666 raise RuntimeError("MakeGlueEdges : " + self.ShapesOp.GetErrorCode())
7667 anObj.SetParameters(Parameters)
7668 self._autoPublish(anObj, theName, "glueEdges")
7671 ## Find coincident edges in \a theShapes for possible gluing.
7672 # @param theShapes Initial shapes, either a list or compound of shapes.
7673 # @param theTolerance Maximum distance between edges,
7674 # which can be considered as coincident.
7675 # @param theName Object name; when specified, this parameter is used
7676 # for result publication in the study. Otherwise, if automatic
7677 # publication is switched on, default value is used for result name.
7679 # @return GEOM.ListOfGO
7681 # @ref tui_glue_edges "Example"
7682 @ManageTransactions("ShapesOp")
7683 def GetGlueEdges(self, theShapes, theTolerance, theName=None):
7685 Find coincident edges in theShapes for possible gluing.
7688 theShapes Initial shapes, either a list or compound of shapes.
7689 theTolerance Maximum distance between edges,
7690 which can be considered as coincident.
7691 theName Object name; when specified, this parameter is used
7692 for result publication in the study. Otherwise, if automatic
7693 publication is switched on, default value is used for result name.
7698 anObj = self.ShapesOp.GetGlueEdges(ToList(theShapes), theTolerance)
7699 RaiseIfFailed("GetGlueEdges", self.ShapesOp)
7700 self._autoPublish(anObj, theName, "edgesToGlue")
7703 ## Replace coincident edges in theShapes by one edge
7704 # in compliance with given list of edges.
7705 # @param theShapes Initial shapes, either a list or compound of shapes.
7706 # @param theTolerance Maximum distance between edges,
7707 # which can be considered as coincident.
7708 # @param theEdges List of edges for gluing.
7709 # @param theName Object name; when specified, this parameter is used
7710 # for result publication in the study. Otherwise, if automatic
7711 # publication is switched on, default value is used for result name.
7713 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7715 # @ref tui_glue_edges "Example"
7716 @ManageTransactions("ShapesOp")
7717 def MakeGlueEdgesByList(self, theShapes, theTolerance, theEdges, theName=None):
7719 Replace coincident edges in theShapes by one edge
7720 in compliance with given list of edges.
7723 theShapes Initial shapes, either a list or compound of shapes.
7724 theTolerance Maximum distance between edges,
7725 which can be considered as coincident.
7726 theEdges List of edges for gluing.
7727 theName Object name; when specified, this parameter is used
7728 for result publication in the study. Otherwise, if automatic
7729 publication is switched on, default value is used for result name.
7732 New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7734 anObj = self.ShapesOp.MakeGlueEdgesByList(ToList(theShapes), theTolerance, theEdges)
7736 raise RuntimeError("MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode())
7737 self._autoPublish(anObj, theName, "glueEdges")
7743 ## @addtogroup l3_boolean Boolean Operations
7746 # -----------------------------------------------------------------------------
7747 # Boolean (Common, Cut, Fuse, Section)
7748 # -----------------------------------------------------------------------------
7750 ## Perform one of boolean operations on two given shapes.
7751 # @param theShape1 First argument for boolean operation.
7752 # @param theShape2 Second argument for boolean operation.
7753 # @param theOperation Indicates the operation to be done:\n
7754 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
7755 # @param checkSelfInte The flag that tells if the arguments should
7756 # be checked for self-intersection prior to the operation.
7757 # @param theName Object name; when specified, this parameter is used
7758 # for result publication in the study. Otherwise, if automatic
7759 # publication is switched on, default value is used for result name.
7761 # @note This algorithm doesn't find all types of self-intersections.
7762 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7763 # vertex/face and edge/face intersections. Face/face
7764 # intersections detection is switched off as it is a
7765 # time-consuming operation that gives an impact on performance.
7766 # To find all self-intersections please use
7767 # CheckSelfIntersections() method.
7769 # @return New GEOM.GEOM_Object, containing the result shape.
7771 # @ref tui_fuse "Example"
7772 @ManageTransactions("BoolOp")
7773 def MakeBoolean(self, theShape1, theShape2, theOperation, checkSelfInte=False, theName=None):
7775 Perform one of boolean operations on two given shapes.
7778 theShape1 First argument for boolean operation.
7779 theShape2 Second argument for boolean operation.
7780 theOperation Indicates the operation to be done:
7781 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
7782 checkSelfInte The flag that tells if the arguments should
7783 be checked for self-intersection prior to
7785 theName Object name; when specified, this parameter is used
7786 for result publication in the study. Otherwise, if automatic
7787 publication is switched on, default value is used for result name.
7790 This algorithm doesn't find all types of self-intersections.
7791 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7792 vertex/face and edge/face intersections. Face/face
7793 intersections detection is switched off as it is a
7794 time-consuming operation that gives an impact on performance.
7795 To find all self-intersections please use
7796 CheckSelfIntersections() method.
7799 New GEOM.GEOM_Object, containing the result shape.
7801 # Example: see GEOM_TestAll.py
7802 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation, checkSelfInte)
7803 RaiseIfFailed("MakeBoolean", self.BoolOp)
7804 def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" }
7805 self._autoPublish(anObj, theName, def_names[theOperation])
7808 ## Perform Common boolean operation on two given shapes.
7809 # @param theShape1 First argument for boolean operation.
7810 # @param theShape2 Second argument for boolean operation.
7811 # @param checkSelfInte The flag that tells if the arguments should
7812 # be checked for self-intersection prior to the operation.
7813 # @param theName Object name; when specified, this parameter is used
7814 # for result publication in the study. Otherwise, if automatic
7815 # publication is switched on, default value is used for result name.
7817 # @note This algorithm doesn't find all types of self-intersections.
7818 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7819 # vertex/face and edge/face intersections. Face/face
7820 # intersections detection is switched off as it is a
7821 # time-consuming operation that gives an impact on performance.
7822 # To find all self-intersections please use
7823 # CheckSelfIntersections() method.
7825 # @return New GEOM.GEOM_Object, containing the result shape.
7827 # @ref tui_common "Example 1"
7828 # \n @ref swig_MakeCommon "Example 2"
7829 def MakeCommon(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7831 Perform Common boolean operation on two given shapes.
7834 theShape1 First argument for boolean operation.
7835 theShape2 Second argument for boolean operation.
7836 checkSelfInte The flag that tells if the arguments should
7837 be checked for self-intersection prior to
7839 theName Object name; when specified, this parameter is used
7840 for result publication in the study. Otherwise, if automatic
7841 publication is switched on, default value is used for result name.
7844 This algorithm doesn't find all types of self-intersections.
7845 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7846 vertex/face and edge/face intersections. Face/face
7847 intersections detection is switched off as it is a
7848 time-consuming operation that gives an impact on performance.
7849 To find all self-intersections please use
7850 CheckSelfIntersections() method.
7853 New GEOM.GEOM_Object, containing the result shape.
7855 # Example: see GEOM_TestOthers.py
7856 # note: auto-publishing is done in self.MakeBoolean()
7857 return self.MakeBoolean(theShape1, theShape2, 1, checkSelfInte, theName)
7859 ## Perform Cut boolean operation on two given shapes.
7860 # @param theShape1 First argument for boolean operation.
7861 # @param theShape2 Second argument for boolean operation.
7862 # @param checkSelfInte The flag that tells if the arguments should
7863 # be checked for self-intersection prior to the operation.
7864 # @param theName Object name; when specified, this parameter is used
7865 # for result publication in the study. Otherwise, if automatic
7866 # publication is switched on, default value is used for result name.
7868 # @note This algorithm doesn't find all types of self-intersections.
7869 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7870 # vertex/face and edge/face intersections. Face/face
7871 # intersections detection is switched off as it is a
7872 # time-consuming operation that gives an impact on performance.
7873 # To find all self-intersections please use
7874 # CheckSelfIntersections() method.
7876 # @return New GEOM.GEOM_Object, containing the result shape.
7878 # @ref tui_cut "Example 1"
7879 # \n @ref swig_MakeCommon "Example 2"
7880 def MakeCut(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7882 Perform Cut boolean operation on two given shapes.
7885 theShape1 First argument for boolean operation.
7886 theShape2 Second argument for boolean operation.
7887 checkSelfInte The flag that tells if the arguments should
7888 be checked for self-intersection prior to
7890 theName Object name; when specified, this parameter is used
7891 for result publication in the study. Otherwise, if automatic
7892 publication is switched on, default value is used for result name.
7895 This algorithm doesn't find all types of self-intersections.
7896 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7897 vertex/face and edge/face intersections. Face/face
7898 intersections detection is switched off as it is a
7899 time-consuming operation that gives an impact on performance.
7900 To find all self-intersections please use
7901 CheckSelfIntersections() method.
7904 New GEOM.GEOM_Object, containing the result shape.
7907 # Example: see GEOM_TestOthers.py
7908 # note: auto-publishing is done in self.MakeBoolean()
7909 return self.MakeBoolean(theShape1, theShape2, 2, checkSelfInte, theName)
7911 ## Perform Fuse boolean operation on two given shapes.
7912 # @param theShape1 First argument for boolean operation.
7913 # @param theShape2 Second argument for boolean operation.
7914 # @param checkSelfInte The flag that tells if the arguments should
7915 # be checked for self-intersection prior to the operation.
7916 # @param rmExtraEdges The flag that tells if Remove Extra Edges
7917 # operation should be performed during the operation.
7918 # @param theName Object name; when specified, this parameter is used
7919 # for result publication in the study. Otherwise, if automatic
7920 # publication is switched on, default value is used for result name.
7922 # @note This algorithm doesn't find all types of self-intersections.
7923 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7924 # vertex/face and edge/face intersections. Face/face
7925 # intersections detection is switched off as it is a
7926 # time-consuming operation that gives an impact on performance.
7927 # To find all self-intersections please use
7928 # CheckSelfIntersections() method.
7930 # @return New GEOM.GEOM_Object, containing the result shape.
7932 # @ref tui_fuse "Example 1"
7933 # \n @ref swig_MakeCommon "Example 2"
7934 @ManageTransactions("BoolOp")
7935 def MakeFuse(self, theShape1, theShape2, checkSelfInte=False,
7936 rmExtraEdges=False, theName=None):
7938 Perform Fuse boolean operation on two given shapes.
7941 theShape1 First argument for boolean operation.
7942 theShape2 Second argument for boolean operation.
7943 checkSelfInte The flag that tells if the arguments should
7944 be checked for self-intersection prior to
7946 rmExtraEdges The flag that tells if Remove Extra Edges
7947 operation should be performed during the operation.
7948 theName Object name; when specified, this parameter is used
7949 for result publication in the study. Otherwise, if automatic
7950 publication is switched on, default value is used for result name.
7953 This algorithm doesn't find all types of self-intersections.
7954 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7955 vertex/face and edge/face intersections. Face/face
7956 intersections detection is switched off as it is a
7957 time-consuming operation that gives an impact on performance.
7958 To find all self-intersections please use
7959 CheckSelfIntersections() method.
7962 New GEOM.GEOM_Object, containing the result shape.
7965 # Example: see GEOM_TestOthers.py
7966 anObj = self.BoolOp.MakeFuse(theShape1, theShape2,
7967 checkSelfInte, rmExtraEdges)
7968 RaiseIfFailed("MakeFuse", self.BoolOp)
7969 self._autoPublish(anObj, theName, "fuse")
7972 ## Perform Section boolean operation on two given shapes.
7973 # @param theShape1 First argument for boolean operation.
7974 # @param theShape2 Second argument for boolean operation.
7975 # @param checkSelfInte The flag that tells if the arguments should
7976 # be checked for self-intersection prior to the operation.
7977 # If a self-intersection detected the operation fails.
7978 # @param theName Object name; when specified, this parameter is used
7979 # for result publication in the study. Otherwise, if automatic
7980 # publication is switched on, default value is used for result name.
7981 # @return New GEOM.GEOM_Object, containing the result shape.
7983 # @ref tui_section "Example 1"
7984 # \n @ref swig_MakeCommon "Example 2"
7985 def MakeSection(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7987 Perform Section boolean operation on two given shapes.
7990 theShape1 First argument for boolean operation.
7991 theShape2 Second argument for boolean operation.
7992 checkSelfInte The flag that tells if the arguments should
7993 be checked for self-intersection prior to the operation.
7994 If a self-intersection detected the operation fails.
7995 theName Object name; when specified, this parameter is used
7996 for result publication in the study. Otherwise, if automatic
7997 publication is switched on, default value is used for result name.
7999 New GEOM.GEOM_Object, containing the result shape.
8002 # Example: see GEOM_TestOthers.py
8003 # note: auto-publishing is done in self.MakeBoolean()
8004 return self.MakeBoolean(theShape1, theShape2, 4, checkSelfInte, theName)
8006 ## Perform Fuse boolean operation on the list of shapes.
8007 # @param theShapesList Shapes to be fused.
8008 # @param checkSelfInte The flag that tells if the arguments should
8009 # be checked for self-intersection prior to the operation.
8010 # @param rmExtraEdges The flag that tells if Remove Extra Edges
8011 # operation should be performed during the operation.
8012 # @param theName Object name; when specified, this parameter is used
8013 # for result publication in the study. Otherwise, if automatic
8014 # publication is switched on, default value is used for result name.
8016 # @note This algorithm doesn't find all types of self-intersections.
8017 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8018 # vertex/face and edge/face intersections. Face/face
8019 # intersections detection is switched off as it is a
8020 # time-consuming operation that gives an impact on performance.
8021 # To find all self-intersections please use
8022 # CheckSelfIntersections() method.
8024 # @return New GEOM.GEOM_Object, containing the result shape.
8026 # @ref tui_fuse "Example 1"
8027 # \n @ref swig_MakeCommon "Example 2"
8028 @ManageTransactions("BoolOp")
8029 def MakeFuseList(self, theShapesList, checkSelfInte=False,
8030 rmExtraEdges=False, theName=None):
8032 Perform Fuse boolean operation on the list of shapes.
8035 theShapesList Shapes to be fused.
8036 checkSelfInte The flag that tells if the arguments should
8037 be checked for self-intersection prior to
8039 rmExtraEdges The flag that tells if Remove Extra Edges
8040 operation should be performed during the operation.
8041 theName Object name; when specified, this parameter is used
8042 for result publication in the study. Otherwise, if automatic
8043 publication is switched on, default value is used for result name.
8046 This algorithm doesn't find all types of self-intersections.
8047 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8048 vertex/face and edge/face intersections. Face/face
8049 intersections detection is switched off as it is a
8050 time-consuming operation that gives an impact on performance.
8051 To find all self-intersections please use
8052 CheckSelfIntersections() method.
8055 New GEOM.GEOM_Object, containing the result shape.
8058 # Example: see GEOM_TestOthers.py
8059 anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte,
8061 RaiseIfFailed("MakeFuseList", self.BoolOp)
8062 self._autoPublish(anObj, theName, "fuse")
8065 ## Perform Common boolean operation on the list of shapes.
8066 # @param theShapesList Shapes for Common operation.
8067 # @param checkSelfInte The flag that tells if the arguments should
8068 # be checked for self-intersection prior to the operation.
8069 # @param theName Object name; when specified, this parameter is used
8070 # for result publication in the study. Otherwise, if automatic
8071 # publication is switched on, default value is used for result name.
8073 # @note This algorithm doesn't find all types of self-intersections.
8074 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8075 # vertex/face and edge/face intersections. Face/face
8076 # intersections detection is switched off as it is a
8077 # time-consuming operation that gives an impact on performance.
8078 # To find all self-intersections please use
8079 # CheckSelfIntersections() method.
8081 # @return New GEOM.GEOM_Object, containing the result shape.
8083 # @ref tui_common "Example 1"
8084 # \n @ref swig_MakeCommon "Example 2"
8085 @ManageTransactions("BoolOp")
8086 def MakeCommonList(self, theShapesList, checkSelfInte=False, theName=None):
8088 Perform Common boolean operation on the list of shapes.
8091 theShapesList Shapes for Common operation.
8092 checkSelfInte The flag that tells if the arguments should
8093 be checked for self-intersection prior to
8095 theName Object name; when specified, this parameter is used
8096 for result publication in the study. Otherwise, if automatic
8097 publication is switched on, default value is used for result name.
8100 This algorithm doesn't find all types of self-intersections.
8101 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8102 vertex/face and edge/face intersections. Face/face
8103 intersections detection is switched off as it is a
8104 time-consuming operation that gives an impact on performance.
8105 To find all self-intersections please use
8106 CheckSelfIntersections() method.
8109 New GEOM.GEOM_Object, containing the result shape.
8112 # Example: see GEOM_TestOthers.py
8113 anObj = self.BoolOp.MakeCommonList(theShapesList, checkSelfInte)
8114 RaiseIfFailed("MakeCommonList", self.BoolOp)
8115 self._autoPublish(anObj, theName, "common")
8118 ## Perform Cut boolean operation on one object and the list of tools.
8119 # @param theMainShape The object of the operation.
8120 # @param theShapesList The list of tools of the operation.
8121 # @param checkSelfInte The flag that tells if the arguments should
8122 # be checked for self-intersection prior to the operation.
8123 # @param theName Object name; when specified, this parameter is used
8124 # for result publication in the study. Otherwise, if automatic
8125 # publication is switched on, default value is used for result name.
8127 # @note This algorithm doesn't find all types of self-intersections.
8128 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8129 # vertex/face and edge/face intersections. Face/face
8130 # intersections detection is switched off as it is a
8131 # time-consuming operation that gives an impact on performance.
8132 # To find all self-intersections please use
8133 # CheckSelfIntersections() method.
8135 # @return New GEOM.GEOM_Object, containing the result shape.
8137 # @ref tui_cut "Example 1"
8138 # \n @ref swig_MakeCommon "Example 2"
8139 @ManageTransactions("BoolOp")
8140 def MakeCutList(self, theMainShape, theShapesList, checkSelfInte=False, theName=None):
8142 Perform Cut boolean operation on one object and the list of tools.
8145 theMainShape The object of the operation.
8146 theShapesList The list of tools of the operation.
8147 checkSelfInte The flag that tells if the arguments should
8148 be checked for self-intersection prior to
8150 theName Object name; when specified, this parameter is used
8151 for result publication in the study. Otherwise, if automatic
8152 publication is switched on, default value is used for result name.
8155 This algorithm doesn't find all types of self-intersections.
8156 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8157 vertex/face and edge/face intersections. Face/face
8158 intersections detection is switched off as it is a
8159 time-consuming operation that gives an impact on performance.
8160 To find all self-intersections please use
8161 CheckSelfIntersections() method.
8164 New GEOM.GEOM_Object, containing the result shape.
8167 # Example: see GEOM_TestOthers.py
8168 anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList, checkSelfInte)
8169 RaiseIfFailed("MakeCutList", self.BoolOp)
8170 self._autoPublish(anObj, theName, "cut")
8176 ## @addtogroup l3_basic_op
8179 ## Perform partition operation.
8180 # @param ListShapes Shapes to be intersected.
8181 # @param ListTools Shapes to intersect theShapes.
8182 # @param Limit Type of resulting shapes (see ShapeType()).\n
8183 # If this parameter is set to -1 ("Auto"), most appropriate shape limit
8184 # type will be detected automatically.
8185 # @param KeepNonlimitShapes if this parameter == 0, then only shapes of
8186 # target type (equal to Limit) are kept in the result,
8187 # else standalone shapes of lower dimension
8188 # are kept also (if they exist).
8190 # @param theName Object name; when specified, this parameter is used
8191 # for result publication in the study. Otherwise, if automatic
8192 # publication is switched on, default value is used for result name.
8194 # @note Each compound from ListShapes and ListTools will be exploded
8195 # in order to avoid possible intersection between shapes from this compound.
8197 # After implementation new version of PartitionAlgo (October 2006)
8198 # other parameters are ignored by current functionality. They are kept
8199 # in this function only for support old versions.
8200 # @param ListKeepInside Shapes, outside which the results will be deleted.
8201 # Each shape from theKeepInside must belong to theShapes also.
8202 # @param ListRemoveInside Shapes, inside which the results will be deleted.
8203 # Each shape from theRemoveInside must belong to theShapes also.
8204 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
8205 # @param ListMaterials Material indices for each shape. Make sense,
8206 # only if theRemoveWebs is TRUE.
8208 # @return New GEOM.GEOM_Object, containing the result shapes.
8210 # @ref tui_partition "Example"
8211 @ManageTransactions("BoolOp")
8212 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
8213 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
8214 KeepNonlimitShapes=0, theName=None):
8216 Perform partition operation.
8219 ListShapes Shapes to be intersected.
8220 ListTools Shapes to intersect theShapes.
8221 Limit Type of resulting shapes (see geompy.ShapeType)
8222 If this parameter is set to -1 ("Auto"), most appropriate shape limit
8223 type will be detected automatically.
8224 KeepNonlimitShapes if this parameter == 0, then only shapes of
8225 target type (equal to Limit) are kept in the result,
8226 else standalone shapes of lower dimension
8227 are kept also (if they exist).
8229 theName Object name; when specified, this parameter is used
8230 for result publication in the study. Otherwise, if automatic
8231 publication is switched on, default value is used for result name.
8233 Each compound from ListShapes and ListTools will be exploded
8234 in order to avoid possible intersection between shapes from
8237 After implementation new version of PartitionAlgo (October 2006) other
8238 parameters are ignored by current functionality. They are kept in this
8239 function only for support old versions.
8242 ListKeepInside Shapes, outside which the results will be deleted.
8243 Each shape from theKeepInside must belong to theShapes also.
8244 ListRemoveInside Shapes, inside which the results will be deleted.
8245 Each shape from theRemoveInside must belong to theShapes also.
8246 RemoveWebs If TRUE, perform Glue 3D algorithm.
8247 ListMaterials Material indices for each shape. Make sense, only if theRemoveWebs is TRUE.
8250 New GEOM.GEOM_Object, containing the result shapes.
8252 # Example: see GEOM_TestAll.py
8253 if Limit == self.ShapeType["AUTO"]:
8254 # automatic detection of the most appropriate shape limit type
8256 for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
8257 Limit = EnumToLong(lim)
8259 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
8260 ListKeepInside, ListRemoveInside,
8261 Limit, RemoveWebs, ListMaterials,
8262 KeepNonlimitShapes);
8263 RaiseIfFailed("MakePartition", self.BoolOp)
8264 self._autoPublish(anObj, theName, "partition")
8267 ## Perform partition operation.
8268 # This method may be useful if it is needed to make a partition for
8269 # compound contains nonintersected shapes. Performance will be better
8270 # since intersection between shapes from compound is not performed.
8272 # Description of all parameters as in previous method MakePartition().
8273 # One additional parameter is provided:
8274 # @param checkSelfInte The flag that tells if the arguments should
8275 # be checked for self-intersection prior to the operation.
8277 # @note This algorithm doesn't find all types of self-intersections.
8278 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8279 # vertex/face and edge/face intersections. Face/face
8280 # intersections detection is switched off as it is a
8281 # time-consuming operation that gives an impact on performance.
8282 # To find all self-intersections please use
8283 # CheckSelfIntersections() method.
8285 # @note Passed compounds (via ListShapes or via ListTools)
8286 # have to consist of nonintersecting shapes.
8288 # @return New GEOM.GEOM_Object, containing the result shapes.
8290 # @ref swig_todo "Example"
8291 @ManageTransactions("BoolOp")
8292 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
8293 ListKeepInside=[], ListRemoveInside=[],
8294 Limit=ShapeType["AUTO"], RemoveWebs=0,
8295 ListMaterials=[], KeepNonlimitShapes=0,
8296 checkSelfInte=False, theName=None):
8298 Perform partition operation.
8299 This method may be useful if it is needed to make a partition for
8300 compound contains nonintersected shapes. Performance will be better
8301 since intersection between shapes from compound is not performed.
8304 Description of all parameters as in method geompy.MakePartition.
8305 One additional parameter is provided:
8306 checkSelfInte The flag that tells if the arguments should
8307 be checked for self-intersection prior to
8311 This algorithm doesn't find all types of self-intersections.
8312 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8313 vertex/face and edge/face intersections. Face/face
8314 intersections detection is switched off as it is a
8315 time-consuming operation that gives an impact on performance.
8316 To find all self-intersections please use
8317 CheckSelfIntersections() method.
8320 Passed compounds (via ListShapes or via ListTools)
8321 have to consist of nonintersecting shapes.
8324 New GEOM.GEOM_Object, containing the result shapes.
8326 if Limit == self.ShapeType["AUTO"]:
8327 # automatic detection of the most appropriate shape limit type
8329 for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
8330 Limit = EnumToLong(lim)
8332 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
8333 ListKeepInside, ListRemoveInside,
8334 Limit, RemoveWebs, ListMaterials,
8335 KeepNonlimitShapes, checkSelfInte);
8336 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
8337 self._autoPublish(anObj, theName, "partition")
8340 ## See method MakePartition() for more information.
8342 # @ref tui_partition "Example 1"
8343 # \n @ref swig_Partition "Example 2"
8344 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
8345 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
8346 KeepNonlimitShapes=0, theName=None):
8348 See method geompy.MakePartition for more information.
8350 # Example: see GEOM_TestOthers.py
8351 # note: auto-publishing is done in self.MakePartition()
8352 anObj = self.MakePartition(ListShapes, ListTools,
8353 ListKeepInside, ListRemoveInside,
8354 Limit, RemoveWebs, ListMaterials,
8355 KeepNonlimitShapes, theName);
8358 ## Perform partition of the Shape with the Plane
8359 # @param theShape Shape to be intersected.
8360 # @param thePlane Tool shape, to intersect theShape.
8361 # @param theName Object name; when specified, this parameter is used
8362 # for result publication in the study. Otherwise, if automatic
8363 # publication is switched on, default value is used for result name.
8365 # @return New GEOM.GEOM_Object, containing the result shape.
8367 # @note This operation is a shortcut to the more general @ref MakePartition
8368 # operation, where @a theShape specifies single "object" (shape being partitioned)
8369 # and @a thePlane specifies single "tool" (intersector shape). Other parameters of
8370 # @ref MakePartition operation have default values:
8371 # - @a Limit: GEOM::SHAPE (shape limit corresponds to the type of @a theShape)
8372 # - @a KeepNonlimitShapes: 0
8373 # - @a KeepInside, @a RemoveInside, @a RemoveWebs,
8374 # @a Materials (obsolete parameters): empty
8376 # @note I.e. the following two operations are equivalent:
8378 # Result = geompy.MakeHalfPartition(Object, Plane)
8379 # Result = geompy.MakePartition([Object], [Plane])
8382 # @sa MakePartition, MakePartitionNonSelfIntersectedShape
8384 # @ref tui_partition "Example"
8385 @ManageTransactions("BoolOp")
8386 def MakeHalfPartition(self, theShape, thePlane, theName=None):
8388 Perform partition of the Shape with the Plane
8391 theShape Shape to be intersected.
8392 thePlane Tool shape, to intersect theShape.
8393 theName Object name; when specified, this parameter is used
8394 for result publication in the study. Otherwise, if automatic
8395 publication is switched on, default value is used for result name.
8398 New GEOM.GEOM_Object, containing the result shape.
8400 Note: This operation is a shortcut to the more general MakePartition
8401 operation, where theShape specifies single "object" (shape being partitioned)
8402 and thePlane specifies single "tool" (intersector shape). Other parameters of
8403 MakePartition operation have default values:
8404 - Limit: GEOM::SHAPE (shape limit corresponds to the type of theShape)
8405 - KeepNonlimitShapes: 0
8406 - KeepInside, RemoveInside, RemoveWebs, Materials (obsolete parameters): empty
8408 I.e. the following two operations are equivalent:
8409 Result = geompy.MakeHalfPartition(Object, Plane)
8410 Result = geompy.MakePartition([Object], [Plane])
8412 # Example: see GEOM_TestAll.py
8413 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
8414 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
8415 self._autoPublish(anObj, theName, "partition")
8418 # end of l3_basic_op
8421 ## @addtogroup l3_transform
8424 ## Translate the given object along the vector, specified
8425 # by its end points.
8426 # @param theObject The object to be translated.
8427 # @param thePoint1 Start point of translation vector.
8428 # @param thePoint2 End point of translation vector.
8429 # @param theCopy Flag used to translate object itself or create a copy.
8430 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8431 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8432 @ManageTransactions("TrsfOp")
8433 def TranslateTwoPoints(self, theObject, thePoint1, thePoint2, theCopy=False):
8435 Translate the given object along the vector, specified by its end points.
8438 theObject The object to be translated.
8439 thePoint1 Start point of translation vector.
8440 thePoint2 End point of translation vector.
8441 theCopy Flag used to translate object itself or create a copy.
8444 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8445 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8448 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
8450 anObj = self.TrsfOp.TranslateTwoPoints(theObject, thePoint1, thePoint2)
8451 RaiseIfFailed("TranslateTwoPoints", self.TrsfOp)
8454 ## Translate the given object along the vector, specified
8455 # by its end points, creating its copy before the translation.
8456 # @param theObject The object to be translated.
8457 # @param thePoint1 Start point of translation vector.
8458 # @param thePoint2 End point of translation vector.
8459 # @param theName Object name; when specified, this parameter is used
8460 # for result publication in the study. Otherwise, if automatic
8461 # publication is switched on, default value is used for result name.
8463 # @return New GEOM.GEOM_Object, containing the translated object.
8465 # @ref tui_translation "Example 1"
8466 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
8467 @ManageTransactions("TrsfOp")
8468 def MakeTranslationTwoPoints(self, theObject, thePoint1, thePoint2, theName=None):
8470 Translate the given object along the vector, specified
8471 by its end points, creating its copy before the translation.
8474 theObject The object to be translated.
8475 thePoint1 Start point of translation vector.
8476 thePoint2 End point of translation vector.
8477 theName Object name; when specified, this parameter is used
8478 for result publication in the study. Otherwise, if automatic
8479 publication is switched on, default value is used for result name.
8482 New GEOM.GEOM_Object, containing the translated object.
8484 # Example: see GEOM_TestAll.py
8485 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
8486 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
8487 self._autoPublish(anObj, theName, "translated")
8490 ## Translate the given object along the vector, specified by its components.
8491 # @param theObject The object to be translated.
8492 # @param theDX,theDY,theDZ Components of translation vector.
8493 # @param theCopy Flag used to translate object itself or create a copy.
8494 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8495 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8497 # @ref tui_translation "Example"
8498 @ManageTransactions("TrsfOp")
8499 def TranslateDXDYDZ(self, theObject, theDX, theDY, theDZ, theCopy=False):
8501 Translate the given object along the vector, specified by its components.
8504 theObject The object to be translated.
8505 theDX,theDY,theDZ Components of translation vector.
8506 theCopy Flag used to translate object itself or create a copy.
8509 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8510 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8512 # Example: see GEOM_TestAll.py
8513 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
8515 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
8517 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
8518 anObj.SetParameters(Parameters)
8519 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
8522 ## Translate the given object along the vector, specified
8523 # by its components, creating its copy before the translation.
8524 # @param theObject The object to be translated.
8525 # @param theDX,theDY,theDZ Components of translation vector.
8526 # @param theName Object name; when specified, this parameter is used
8527 # for result publication in the study. Otherwise, if automatic
8528 # publication is switched on, default value is used for result name.
8530 # @return New GEOM.GEOM_Object, containing the translated object.
8532 # @ref tui_translation "Example"
8533 @ManageTransactions("TrsfOp")
8534 def MakeTranslation(self,theObject, theDX, theDY, theDZ, theName=None):
8536 Translate the given object along the vector, specified
8537 by its components, creating its copy before the translation.
8540 theObject The object to be translated.
8541 theDX,theDY,theDZ Components of translation vector.
8542 theName Object name; when specified, this parameter is used
8543 for result publication in the study. Otherwise, if automatic
8544 publication is switched on, default value is used for result name.
8547 New GEOM.GEOM_Object, containing the translated object.
8549 # Example: see GEOM_TestAll.py
8550 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
8551 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
8552 anObj.SetParameters(Parameters)
8553 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
8554 self._autoPublish(anObj, theName, "translated")
8557 ## Translate the given object along the given vector.
8558 # @param theObject The object to be translated.
8559 # @param theVector The translation vector.
8560 # @param theCopy Flag used to translate object itself or create a copy.
8561 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8562 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8563 @ManageTransactions("TrsfOp")
8564 def TranslateVector(self, theObject, theVector, theCopy=False):
8566 Translate the given object along the given vector.
8569 theObject The object to be translated.
8570 theVector The translation vector.
8571 theCopy Flag used to translate object itself or create a copy.
8574 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8575 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8578 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
8580 anObj = self.TrsfOp.TranslateVector(theObject, theVector)
8581 RaiseIfFailed("TranslateVector", self.TrsfOp)
8584 ## Translate the given object along the given vector,
8585 # creating its copy before the translation.
8586 # @param theObject The object to be translated.
8587 # @param theVector The translation vector.
8588 # @param theName Object name; when specified, this parameter is used
8589 # for result publication in the study. Otherwise, if automatic
8590 # publication is switched on, default value is used for result name.
8592 # @return New GEOM.GEOM_Object, containing the translated object.
8594 # @ref tui_translation "Example"
8595 @ManageTransactions("TrsfOp")
8596 def MakeTranslationVector(self, theObject, theVector, theName=None):
8598 Translate the given object along the given vector,
8599 creating its copy before the translation.
8602 theObject The object to be translated.
8603 theVector The translation vector.
8604 theName Object name; when specified, this parameter is used
8605 for result publication in the study. Otherwise, if automatic
8606 publication is switched on, default value is used for result name.
8609 New GEOM.GEOM_Object, containing the translated object.
8611 # Example: see GEOM_TestAll.py
8612 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
8613 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
8614 self._autoPublish(anObj, theName, "translated")
8617 ## Translate the given object along the given vector on given distance.
8618 # @param theObject The object to be translated.
8619 # @param theVector The translation vector.
8620 # @param theDistance The translation distance.
8621 # @param theCopy Flag used to translate object itself or create a copy.
8622 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8623 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8625 # @ref tui_translation "Example"
8626 @ManageTransactions("TrsfOp")
8627 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy=False):
8629 Translate the given object along the given vector on given distance.
8632 theObject The object to be translated.
8633 theVector The translation vector.
8634 theDistance The translation distance.
8635 theCopy Flag used to translate object itself or create a copy.
8638 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8639 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8641 # Example: see GEOM_TestAll.py
8642 theDistance,Parameters = ParseParameters(theDistance)
8643 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
8644 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
8645 anObj.SetParameters(Parameters)
8648 ## Translate the given object along the given vector on given distance,
8649 # creating its copy before the translation.
8650 # @param theObject The object to be translated.
8651 # @param theVector The translation vector.
8652 # @param theDistance The translation distance.
8653 # @param theName Object name; when specified, this parameter is used
8654 # for result publication in the study. Otherwise, if automatic
8655 # publication is switched on, default value is used for result name.
8657 # @return New GEOM.GEOM_Object, containing the translated object.
8659 # @ref tui_translation "Example"
8660 @ManageTransactions("TrsfOp")
8661 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance, theName=None):
8663 Translate the given object along the given vector on given distance,
8664 creating its copy before the translation.
8667 theObject The object to be translated.
8668 theVector The translation vector.
8669 theDistance The translation distance.
8670 theName Object name; when specified, this parameter is used
8671 for result publication in the study. Otherwise, if automatic
8672 publication is switched on, default value is used for result name.
8675 New GEOM.GEOM_Object, containing the translated object.
8677 # Example: see GEOM_TestAll.py
8678 theDistance,Parameters = ParseParameters(theDistance)
8679 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
8680 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
8681 anObj.SetParameters(Parameters)
8682 self._autoPublish(anObj, theName, "translated")
8685 ## Rotate the given object around the given axis on the given angle.
8686 # @param theObject The object to be rotated.
8687 # @param theAxis Rotation axis.
8688 # @param theAngle Rotation angle in radians.
8689 # @param theCopy Flag used to rotate object itself or create a copy.
8691 # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8692 # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
8694 # @ref tui_rotation "Example"
8695 @ManageTransactions("TrsfOp")
8696 def Rotate(self, theObject, theAxis, theAngle, theCopy=False):
8698 Rotate the given object around the given axis on the given angle.
8701 theObject The object to be rotated.
8702 theAxis Rotation axis.
8703 theAngle Rotation angle in radians.
8704 theCopy Flag used to rotate object itself or create a copy.
8707 Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8708 new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
8710 # Example: see GEOM_TestAll.py
8712 if isinstance(theAngle,str):
8714 theAngle, Parameters = ParseParameters(theAngle)
8716 theAngle = theAngle*math.pi/180.0
8718 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
8720 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
8721 RaiseIfFailed("Rotate", self.TrsfOp)
8722 anObj.SetParameters(Parameters)
8725 ## Rotate the given object around the given axis
8726 # on the given angle, creating its copy before the rotation.
8727 # @param theObject The object to be rotated.
8728 # @param theAxis Rotation axis.
8729 # @param theAngle Rotation angle in radians.
8730 # @param theName Object name; when specified, this parameter is used
8731 # for result publication in the study. Otherwise, if automatic
8732 # publication is switched on, default value is used for result name.
8734 # @return New GEOM.GEOM_Object, containing the rotated object.
8736 # @ref tui_rotation "Example"
8737 @ManageTransactions("TrsfOp")
8738 def MakeRotation(self, theObject, theAxis, theAngle, theName=None):
8740 Rotate the given object around the given axis
8741 on the given angle, creating its copy before the rotatation.
8744 theObject The object to be rotated.
8745 theAxis Rotation axis.
8746 theAngle Rotation angle in radians.
8747 theName Object name; when specified, this parameter is used
8748 for result publication in the study. Otherwise, if automatic
8749 publication is switched on, default value is used for result name.
8752 New GEOM.GEOM_Object, containing the rotated object.
8754 # Example: see GEOM_TestAll.py
8756 if isinstance(theAngle,str):
8758 theAngle, Parameters = ParseParameters(theAngle)
8760 theAngle = theAngle*math.pi/180.0
8761 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
8762 RaiseIfFailed("RotateCopy", self.TrsfOp)
8763 anObj.SetParameters(Parameters)
8764 self._autoPublish(anObj, theName, "rotated")
8767 ## Rotate given object around vector perpendicular to plane
8768 # containing three points.
8769 # @param theObject The object to be rotated.
8770 # @param theCentPoint central point the axis is the vector perpendicular to the plane
8771 # containing the three points.
8772 # @param thePoint1,thePoint2 points in a perpendicular plane of the axis.
8773 # @param theCopy Flag used to rotate object itself or create a copy.
8774 # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8775 # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
8776 @ManageTransactions("TrsfOp")
8777 def RotateThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theCopy=False):
8779 Rotate given object around vector perpendicular to plane
8780 containing three points.
8783 theObject The object to be rotated.
8784 theCentPoint central point the axis is the vector perpendicular to the plane
8785 containing the three points.
8786 thePoint1,thePoint2 points in a perpendicular plane of the axis.
8787 theCopy Flag used to rotate object itself or create a copy.
8790 Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8791 new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
8794 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
8796 anObj = self.TrsfOp.RotateThreePoints(theObject, theCentPoint, thePoint1, thePoint2)
8797 RaiseIfFailed("RotateThreePoints", self.TrsfOp)
8800 ## Rotate given object around vector perpendicular to plane
8801 # containing three points, creating its copy before the rotatation.
8802 # @param theObject The object to be rotated.
8803 # @param theCentPoint central point the axis is the vector perpendicular to the plane
8804 # containing the three points.
8805 # @param thePoint1,thePoint2 in a perpendicular plane of the axis.
8806 # @param theName Object name; when specified, this parameter is used
8807 # for result publication in the study. Otherwise, if automatic
8808 # publication is switched on, default value is used for result name.
8810 # @return New GEOM.GEOM_Object, containing the rotated object.
8812 # @ref tui_rotation "Example"
8813 @ManageTransactions("TrsfOp")
8814 def MakeRotationThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theName=None):
8816 Rotate given object around vector perpendicular to plane
8817 containing three points, creating its copy before the rotatation.
8820 theObject The object to be rotated.
8821 theCentPoint central point the axis is the vector perpendicular to the plane
8822 containing the three points.
8823 thePoint1,thePoint2 in a perpendicular plane of the axis.
8824 theName Object name; when specified, this parameter is used
8825 for result publication in the study. Otherwise, if automatic
8826 publication is switched on, default value is used for result name.
8829 New GEOM.GEOM_Object, containing the rotated object.
8831 # Example: see GEOM_TestAll.py
8832 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
8833 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
8834 self._autoPublish(anObj, theName, "rotated")
8837 ## Scale the given object by the specified factor.
8838 # @param theObject The object to be scaled.
8839 # @param thePoint Center point for scaling.
8840 # Passing None for it means scaling relatively the origin of global CS.
8841 # @param theFactor Scaling factor value.
8842 # @param theCopy Flag used to scale object itself or create a copy.
8843 # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8844 # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
8845 @ManageTransactions("TrsfOp")
8846 def Scale(self, theObject, thePoint, theFactor, theCopy=False):
8848 Scale the given object by the specified factor.
8851 theObject The object to be scaled.
8852 thePoint Center point for scaling.
8853 Passing None for it means scaling relatively the origin of global CS.
8854 theFactor Scaling factor value.
8855 theCopy Flag used to scale object itself or create a copy.
8858 Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8859 new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
8861 # Example: see GEOM_TestAll.py
8862 theFactor, Parameters = ParseParameters(theFactor)
8864 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
8866 anObj = self.TrsfOp.ScaleShape(theObject, thePoint, theFactor)
8867 RaiseIfFailed("Scale", self.TrsfOp)
8868 anObj.SetParameters(Parameters)
8871 ## Scale the given object by the factor, creating its copy before the scaling.
8872 # @param theObject The object to be scaled.
8873 # @param thePoint Center point for scaling.
8874 # Passing None for it means scaling relatively the origin of global CS.
8875 # @param theFactor Scaling factor value.
8876 # @param theName Object name; when specified, this parameter is used
8877 # for result publication in the study. Otherwise, if automatic
8878 # publication is switched on, default value is used for result name.
8880 # @return New GEOM.GEOM_Object, containing the scaled shape.
8882 # @ref tui_scale "Example"
8883 @ManageTransactions("TrsfOp")
8884 def MakeScaleTransform(self, theObject, thePoint, theFactor, theName=None):
8886 Scale the given object by the factor, creating its copy before the scaling.
8889 theObject The object to be scaled.
8890 thePoint Center point for scaling.
8891 Passing None for it means scaling relatively the origin of global CS.
8892 theFactor Scaling factor value.
8893 theName Object name; when specified, this parameter is used
8894 for result publication in the study. Otherwise, if automatic
8895 publication is switched on, default value is used for result name.
8898 New GEOM.GEOM_Object, containing the scaled shape.
8900 # Example: see GEOM_TestAll.py
8901 theFactor, Parameters = ParseParameters(theFactor)
8902 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
8903 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
8904 anObj.SetParameters(Parameters)
8905 self._autoPublish(anObj, theName, "scaled")
8908 ## Scale the given object by different factors along coordinate axes.
8909 # @param theObject The object to be scaled.
8910 # @param thePoint Center point for scaling.
8911 # Passing None for it means scaling relatively the origin of global CS.
8912 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8913 # @param theCopy Flag used to scale object itself or create a copy.
8914 # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8915 # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
8916 @ManageTransactions("TrsfOp")
8917 def ScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theCopy=False):
8919 Scale the given object by different factors along coordinate axes.
8922 theObject The object to be scaled.
8923 thePoint Center point for scaling.
8924 Passing None for it means scaling relatively the origin of global CS.
8925 theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8926 theCopy Flag used to scale object itself or create a copy.
8929 Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8930 new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
8932 # Example: see GEOM_TestAll.py
8933 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
8935 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
8936 theFactorX, theFactorY, theFactorZ)
8938 anObj = self.TrsfOp.ScaleShapeAlongAxes(theObject, thePoint,
8939 theFactorX, theFactorY, theFactorZ)
8940 RaiseIfFailed("ScaleAlongAxes", self.TrsfOp)
8941 anObj.SetParameters(Parameters)
8944 ## Scale the given object by different factors along coordinate axes,
8945 # creating its copy before the scaling.
8946 # @param theObject The object to be scaled.
8947 # @param thePoint Center point for scaling.
8948 # Passing None for it means scaling relatively the origin of global CS.
8949 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8950 # @param theName Object name; when specified, this parameter is used
8951 # for result publication in the study. Otherwise, if automatic
8952 # publication is switched on, default value is used for result name.
8954 # @return New GEOM.GEOM_Object, containing the scaled shape.
8956 # @ref swig_scale "Example"
8957 @ManageTransactions("TrsfOp")
8958 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theName=None):
8960 Scale the given object by different factors along coordinate axes,
8961 creating its copy before the scaling.
8964 theObject The object to be scaled.
8965 thePoint Center point for scaling.
8966 Passing None for it means scaling relatively the origin of global CS.
8967 theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8968 theName Object name; when specified, this parameter is used
8969 for result publication in the study. Otherwise, if automatic
8970 publication is switched on, default value is used for result name.
8973 New GEOM.GEOM_Object, containing the scaled shape.
8975 # Example: see GEOM_TestAll.py
8976 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
8977 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
8978 theFactorX, theFactorY, theFactorZ)
8979 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
8980 anObj.SetParameters(Parameters)
8981 self._autoPublish(anObj, theName, "scaled")
8984 ## Mirror an object relatively the given plane.
8985 # @param theObject The object to be mirrored.
8986 # @param thePlane Plane of symmetry.
8987 # @param theCopy Flag used to mirror object itself or create a copy.
8988 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8989 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
8990 @ManageTransactions("TrsfOp")
8991 def MirrorByPlane(self, theObject, thePlane, theCopy=False):
8993 Mirror an object relatively the given plane.
8996 theObject The object to be mirrored.
8997 thePlane Plane of symmetry.
8998 theCopy Flag used to mirror object itself or create a copy.
9001 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9002 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9005 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
9007 anObj = self.TrsfOp.MirrorPlane(theObject, thePlane)
9008 RaiseIfFailed("MirrorByPlane", self.TrsfOp)
9011 ## Create an object, symmetrical
9012 # to the given one relatively the given plane.
9013 # @param theObject The object to be mirrored.
9014 # @param thePlane Plane of symmetry.
9015 # @param theName Object name; when specified, this parameter is used
9016 # for result publication in the study. Otherwise, if automatic
9017 # publication is switched on, default value is used for result name.
9019 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9021 # @ref tui_mirror "Example"
9022 @ManageTransactions("TrsfOp")
9023 def MakeMirrorByPlane(self, theObject, thePlane, theName=None):
9025 Create an object, symmetrical to the given one relatively the given plane.
9028 theObject The object to be mirrored.
9029 thePlane Plane of symmetry.
9030 theName Object name; when specified, this parameter is used
9031 for result publication in the study. Otherwise, if automatic
9032 publication is switched on, default value is used for result name.
9035 New GEOM.GEOM_Object, containing the mirrored shape.
9037 # Example: see GEOM_TestAll.py
9038 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
9039 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
9040 self._autoPublish(anObj, theName, "mirrored")
9043 ## Mirror an object relatively the given axis.
9044 # @param theObject The object to be mirrored.
9045 # @param theAxis Axis of symmetry.
9046 # @param theCopy Flag used to mirror object itself or create a copy.
9047 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9048 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
9049 @ManageTransactions("TrsfOp")
9050 def MirrorByAxis(self, theObject, theAxis, theCopy=False):
9052 Mirror an object relatively the given axis.
9055 theObject The object to be mirrored.
9056 theAxis Axis of symmetry.
9057 theCopy Flag used to mirror object itself or create a copy.
9060 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9061 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9064 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
9066 anObj = self.TrsfOp.MirrorAxis(theObject, theAxis)
9067 RaiseIfFailed("MirrorByAxis", self.TrsfOp)
9070 ## Create an object, symmetrical
9071 # to the given one relatively the given axis.
9072 # @param theObject The object to be mirrored.
9073 # @param theAxis Axis of symmetry.
9074 # @param theName Object name; when specified, this parameter is used
9075 # for result publication in the study. Otherwise, if automatic
9076 # publication is switched on, default value is used for result name.
9078 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9080 # @ref tui_mirror "Example"
9081 @ManageTransactions("TrsfOp")
9082 def MakeMirrorByAxis(self, theObject, theAxis, theName=None):
9084 Create an object, symmetrical to the given one relatively the given axis.
9087 theObject The object to be mirrored.
9088 theAxis Axis of symmetry.
9089 theName Object name; when specified, this parameter is used
9090 for result publication in the study. Otherwise, if automatic
9091 publication is switched on, default value is used for result name.
9094 New GEOM.GEOM_Object, containing the mirrored shape.
9096 # Example: see GEOM_TestAll.py
9097 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
9098 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
9099 self._autoPublish(anObj, theName, "mirrored")
9102 ## Mirror an object relatively the given point.
9103 # @param theObject The object to be mirrored.
9104 # @param thePoint Point of symmetry.
9105 # @param theCopy Flag used to mirror object itself or create a copy.
9106 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9107 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
9108 @ManageTransactions("TrsfOp")
9109 def MirrorByPoint(self, theObject, thePoint, theCopy=False):
9111 Mirror an object relatively the given point.
9114 theObject The object to be mirrored.
9115 thePoint Point of symmetry.
9116 theCopy Flag used to mirror object itself or create a copy.
9119 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9120 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9122 # Example: see GEOM_TestAll.py
9124 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
9126 anObj = self.TrsfOp.MirrorPoint(theObject, thePoint)
9127 RaiseIfFailed("MirrorByPoint", self.TrsfOp)
9130 ## Create an object, symmetrical
9131 # to the given one relatively the given point.
9132 # @param theObject The object to be mirrored.
9133 # @param thePoint Point of symmetry.
9134 # @param theName Object name; when specified, this parameter is used
9135 # for result publication in the study. Otherwise, if automatic
9136 # publication is switched on, default value is used for result name.
9138 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9140 # @ref tui_mirror "Example"
9141 @ManageTransactions("TrsfOp")
9142 def MakeMirrorByPoint(self, theObject, thePoint, theName=None):
9144 Create an object, symmetrical
9145 to the given one relatively the given point.
9148 theObject The object to be mirrored.
9149 thePoint Point of symmetry.
9150 theName Object name; when specified, this parameter is used
9151 for result publication in the study. Otherwise, if automatic
9152 publication is switched on, default value is used for result name.
9155 New GEOM.GEOM_Object, containing the mirrored shape.
9157 # Example: see GEOM_TestAll.py
9158 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
9159 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
9160 self._autoPublish(anObj, theName, "mirrored")
9163 ## Modify the location of the given object.
9164 # @param theObject The object to be displaced.
9165 # @param theStartLCS Coordinate system to perform displacement from it.\n
9166 # If \a theStartLCS is NULL, displacement
9167 # will be performed from global CS.\n
9168 # If \a theObject itself is used as \a theStartLCS,
9169 # its location will be changed to \a theEndLCS.
9170 # @param theEndLCS Coordinate system to perform displacement to it.
9171 # @param theCopy Flag used to displace object itself or create a copy.
9172 # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9173 # new GEOM.GEOM_Object, containing the displaced object if @a theCopy flag is @c True.
9174 @ManageTransactions("TrsfOp")
9175 def Position(self, theObject, theStartLCS, theEndLCS, theCopy=False):
9177 Modify the Location of the given object by LCS, creating its copy before the setting.
9180 theObject The object to be displaced.
9181 theStartLCS Coordinate system to perform displacement from it.
9182 If theStartLCS is NULL, displacement
9183 will be performed from global CS.
9184 If theObject itself is used as theStartLCS,
9185 its location will be changed to theEndLCS.
9186 theEndLCS Coordinate system to perform displacement to it.
9187 theCopy Flag used to displace object itself or create a copy.
9190 Displaced theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9191 new GEOM.GEOM_Object, containing the displaced object if theCopy flag is True.
9193 # Example: see GEOM_TestAll.py
9195 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
9197 anObj = self.TrsfOp.PositionShape(theObject, theStartLCS, theEndLCS)
9198 RaiseIfFailed("Displace", self.TrsfOp)
9201 ## Modify the Location of the given object by LCS,
9202 # creating its copy before the setting.
9203 # @param theObject The object to be displaced.
9204 # @param theStartLCS Coordinate system to perform displacement from it.\n
9205 # If \a theStartLCS is NULL, displacement
9206 # will be performed from global CS.\n
9207 # If \a theObject itself is used as \a theStartLCS,
9208 # its location will be changed to \a theEndLCS.
9209 # @param theEndLCS Coordinate system to perform displacement to it.
9210 # @param theName Object name; when specified, this parameter is used
9211 # for result publication in the study. Otherwise, if automatic
9212 # publication is switched on, default value is used for result name.
9214 # @return New GEOM.GEOM_Object, containing the displaced shape.
9216 # @ref tui_modify_location "Example"
9217 @ManageTransactions("TrsfOp")
9218 def MakePosition(self, theObject, theStartLCS, theEndLCS, theName=None):
9220 Modify the Location of the given object by LCS, creating its copy before the setting.
9223 theObject The object to be displaced.
9224 theStartLCS Coordinate system to perform displacement from it.
9225 If theStartLCS is NULL, displacement
9226 will be performed from global CS.
9227 If theObject itself is used as theStartLCS,
9228 its location will be changed to theEndLCS.
9229 theEndLCS Coordinate system to perform displacement to it.
9230 theName Object name; when specified, this parameter is used
9231 for result publication in the study. Otherwise, if automatic
9232 publication is switched on, default value is used for result name.
9235 New GEOM.GEOM_Object, containing the displaced shape.
9238 # create local coordinate systems
9239 cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
9240 cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
9241 # modify the location of the given object
9242 position = geompy.MakePosition(cylinder, cs1, cs2)
9244 # Example: see GEOM_TestAll.py
9245 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
9246 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
9247 self._autoPublish(anObj, theName, "displaced")
9250 ## Modify the Location of the given object by Path.
9251 # @param theObject The object to be displaced.
9252 # @param thePath Wire or Edge along that the object will be translated.
9253 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
9254 # @param theCopy is to create a copy objects if true.
9255 # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
9256 # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy is @c False or
9257 # new GEOM.GEOM_Object, containing the displaced shape if @a theCopy is @c True.
9259 # @ref tui_modify_location "Example"
9260 @ManageTransactions("TrsfOp")
9261 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
9263 Modify the Location of the given object by Path.
9266 theObject The object to be displaced.
9267 thePath Wire or Edge along that the object will be translated.
9268 theDistance progress of Path (0 = start location, 1 = end of path location).
9269 theCopy is to create a copy objects if true.
9270 theReverse 0 - for usual direction, 1 - to reverse path direction.
9273 Displaced theObject (GEOM.GEOM_Object) if theCopy is False or
9274 new GEOM.GEOM_Object, containing the displaced shape if theCopy is True.
9277 position = geompy.PositionAlongPath(cylinder, circle, 0.75, 1, 1)
9279 # Example: see GEOM_TestAll.py
9280 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
9281 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
9284 ## Modify the Location of the given object by Path, creating its copy before the operation.
9285 # @param theObject The object to be displaced.
9286 # @param thePath Wire or Edge along that the object will be translated.
9287 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
9288 # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
9289 # @param theName Object name; when specified, this parameter is used
9290 # for result publication in the study. Otherwise, if automatic
9291 # publication is switched on, default value is used for result name.
9293 # @return New GEOM.GEOM_Object, containing the displaced shape.
9294 @ManageTransactions("TrsfOp")
9295 def MakePositionAlongPath(self, theObject, thePath, theDistance, theReverse, theName=None):
9297 Modify the Location of the given object by Path, creating its copy before the operation.
9300 theObject The object to be displaced.
9301 thePath Wire or Edge along that the object will be translated.
9302 theDistance progress of Path (0 = start location, 1 = end of path location).
9303 theReverse 0 - for usual direction, 1 - to reverse path direction.
9304 theName Object name; when specified, this parameter is used
9305 for result publication in the study. Otherwise, if automatic
9306 publication is switched on, default value is used for result name.
9309 New GEOM.GEOM_Object, containing the displaced shape.
9311 # Example: see GEOM_TestAll.py
9312 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, 1, theReverse)
9313 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
9314 self._autoPublish(anObj, theName, "displaced")
9317 ## Offset given shape.
9318 # @param theObject The base object for the offset.
9319 # @param theOffset Offset value.
9320 # @param theCopy Flag used to offset object itself or create a copy.
9321 # @return Modified @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9322 # new GEOM.GEOM_Object, containing the result of offset operation if @a theCopy flag is @c True.
9323 @ManageTransactions("TrsfOp")
9324 def Offset(self, theObject, theOffset, theCopy=False):
9329 theObject The base object for the offset.
9330 theOffset Offset value.
9331 theCopy Flag used to offset object itself or create a copy.
9334 Modified theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9335 new GEOM.GEOM_Object, containing the result of offset operation if theCopy flag is True.
9337 theOffset, Parameters = ParseParameters(theOffset)
9339 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset, True)
9341 anObj = self.TrsfOp.OffsetShape(theObject, theOffset, True)
9342 RaiseIfFailed("Offset", self.TrsfOp)
9343 anObj.SetParameters(Parameters)
9346 ## Create new object as offset of the given one. Gap between two adjacent
9347 # offset surfaces is filled by a pipe.
9348 # @param theObject The base object for the offset.
9349 # @param theOffset Offset value.
9350 # @param theName Object name; when specified, this parameter is used
9351 # for result publication in the study. Otherwise, if automatic
9352 # publication is switched on, default value is used for result name.
9354 # @return New GEOM.GEOM_Object, containing the offset object.
9356 # @sa MakeOffsetIntersectionJoin
9357 # @ref tui_offset "Example"
9358 @ManageTransactions("TrsfOp")
9359 def MakeOffset(self, theObject, theOffset, theName=None):
9361 Create new object as offset of the given one. Gap between adjacent
9362 offset surfaces is filled by a pipe.
9365 theObject The base object for the offset.
9366 theOffset Offset value.
9367 theName Object name; when specified, this parameter is used
9368 for result publication in the study. Otherwise, if automatic
9369 publication is switched on, default value is used for result name.
9372 New GEOM.GEOM_Object, containing the offset object.
9375 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
9376 # create a new object as offset of the given object
9377 offset = geompy.MakeOffset(box, 70.)
9379 # Example: see GEOM_TestAll.py
9380 theOffset, Parameters = ParseParameters(theOffset)
9381 anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, True )
9382 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
9383 anObj.SetParameters(Parameters)
9384 self._autoPublish(anObj, theName, "offset")
9387 ## Create new object as offset of the given one. Gap between adjacent
9388 # offset surfaces is filled by extending and intersecting them.
9389 # @param theObject The base object for the offset.
9390 # @param theOffset Offset value.
9391 # @param theName Object name; when specified, this parameter is used
9392 # for result publication in the study. Otherwise, if automatic
9393 # publication is switched on, default value is used for result name.
9395 # @return New GEOM.GEOM_Object, containing the offset object.
9398 # @ref tui_offset "Example"
9399 @ManageTransactions("TrsfOp")
9400 def MakeOffsetIntersectionJoin(self, theObject, theOffset, theName=None):
9402 Create new object as offset of the given one. Gap between adjacent
9403 offset surfaces is filled by extending and intersecting them.
9406 theObject The base object for the offset.
9407 theOffset Offset value.
9408 theName Object name; when specified, this parameter is used
9409 for result publication in the study. Otherwise, if automatic
9410 publication is switched on, default value is used for result name.
9413 New GEOM.GEOM_Object, containing the offset object.
9416 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
9417 # create a new box extended by 70
9418 offset = geompy.MakeOffsetIntersectionJoin(box, 70.)
9420 # Example: see GEOM_TestAll.py
9421 theOffset, Parameters = ParseParameters( theOffset )
9422 anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, False )
9423 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
9424 anObj.SetParameters(Parameters)
9425 self._autoPublish(anObj, theName, "offset")
9428 ## Create new object as projection of the given one on another.
9429 # @param theSource The source object for the projection. It can be a point, edge or wire.
9430 # Edge and wire are acceptable if @a theTarget is a face.
9431 # @param theTarget The target object. It can be planar or cylindrical face, edge or wire.
9432 # @param theName Object name; when specified, this parameter is used
9433 # for result publication in the study. Otherwise, if automatic
9434 # publication is switched on, default value is used for result name.
9436 # @return New GEOM.GEOM_Object, containing the projection.
9438 # @ref tui_projection "Example"
9439 @ManageTransactions("TrsfOp")
9440 def MakeProjection(self, theSource, theTarget, theName=None):
9442 Create new object as projection of the given one on another.
9445 theSource The source object for the projection. It can be a point, edge or wire.
9446 Edge and wire are acceptable if theTarget is a face.
9447 theTarget The target object. It can be planar or cylindrical face, edge or wire.
9448 theName Object name; when specified, this parameter is used
9449 for result publication in the study. Otherwise, if automatic
9450 publication is switched on, default value is used for result name.
9453 New GEOM.GEOM_Object, containing the projection.
9455 # Example: see GEOM_TestAll.py
9456 anObj = self.TrsfOp.ProjectShapeCopy(theSource, theTarget)
9457 RaiseIfFailed("ProjectShapeCopy", self.TrsfOp)
9458 self._autoPublish(anObj, theName, "projection")
9461 ## Create a projection of the given point on a wire or an edge.
9462 # If there are no solutions or there are 2 or more solutions It throws an
9464 # @param thePoint the point to be projected.
9465 # @param theWire the wire. The edge is accepted as well.
9466 # @param theName Object name; when specified, this parameter is used
9467 # for result publication in the study. Otherwise, if automatic
9468 # publication is switched on, default value is used for result name.
9470 # @return [\a u, \a PointOnEdge, \a EdgeInWireIndex]
9471 # \n \a u: The parameter of projection point on edge.
9472 # \n \a PointOnEdge: The projection point.
9473 # \n \a EdgeInWireIndex: The index of an edge in a wire.
9475 # @ref tui_projection "Example"
9476 @ManageTransactions("TrsfOp")
9477 def MakeProjectionOnWire(self, thePoint, theWire, theName=None):
9479 Create a projection of the given point on a wire or an edge.
9480 If there are no solutions or there are 2 or more solutions It throws an
9484 thePoint the point to be projected.
9485 theWire the wire. The edge is accepted as well.
9486 theName Object name; when specified, this parameter is used
9487 for result publication in the study. Otherwise, if automatic
9488 publication is switched on, default value is used for result name.
9491 [u, PointOnEdge, EdgeInWireIndex]
9492 u: The parameter of projection point on edge.
9493 PointOnEdge: The projection point.
9494 EdgeInWireIndex: The index of an edge in a wire.
9496 # Example: see GEOM_TestAll.py
9497 anObj = self.TrsfOp.ProjectPointOnWire(thePoint, theWire)
9498 RaiseIfFailed("ProjectPointOnWire", self.TrsfOp)
9499 self._autoPublish(anObj[1], theName, "projection")
9502 # -----------------------------------------------------------------------------
9504 # -----------------------------------------------------------------------------
9506 ## Translate the given object along the given vector a given number times
9507 # @param theObject The object to be translated.
9508 # @param theVector Direction of the translation. DX if None.
9509 # @param theStep Distance to translate on.
9510 # @param theNbTimes Quantity of translations to be done.
9511 # @param theName Object name; when specified, this parameter is used
9512 # for result publication in the study. Otherwise, if automatic
9513 # publication is switched on, default value is used for result name.
9515 # @return New GEOM.GEOM_Object, containing compound of all
9516 # the shapes, obtained after each translation.
9518 # @ref tui_multi_translation "Example"
9519 @ManageTransactions("TrsfOp")
9520 def MakeMultiTranslation1D(self, theObject, theVector, theStep, theNbTimes, theName=None):
9522 Translate the given object along the given vector a given number times
9525 theObject The object to be translated.
9526 theVector Direction of the translation. DX if None.
9527 theStep Distance to translate on.
9528 theNbTimes Quantity of translations to be done.
9529 theName Object name; when specified, this parameter is used
9530 for result publication in the study. Otherwise, if automatic
9531 publication is switched on, default value is used for result name.
9534 New GEOM.GEOM_Object, containing compound of all
9535 the shapes, obtained after each translation.
9538 r1d = geompy.MakeMultiTranslation1D(prism, vect, 20, 4)
9540 # Example: see GEOM_TestAll.py
9541 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
9542 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
9543 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
9544 anObj.SetParameters(Parameters)
9545 self._autoPublish(anObj, theName, "multitranslation")
9548 ## Conseqently apply two specified translations to theObject specified number of times.
9549 # @param theObject The object to be translated.
9550 # @param theVector1 Direction of the first translation. DX if None.
9551 # @param theStep1 Step of the first translation.
9552 # @param theNbTimes1 Quantity of translations to be done along theVector1.
9553 # @param theVector2 Direction of the second translation. DY if None.
9554 # @param theStep2 Step of the second translation.
9555 # @param theNbTimes2 Quantity of translations to be done along theVector2.
9556 # @param theName Object name; when specified, this parameter is used
9557 # for result publication in the study. Otherwise, if automatic
9558 # publication is switched on, default value is used for result name.
9560 # @return New GEOM.GEOM_Object, containing compound of all
9561 # the shapes, obtained after each translation.
9563 # @ref tui_multi_translation "Example"
9564 @ManageTransactions("TrsfOp")
9565 def MakeMultiTranslation2D(self, theObject, theVector1, theStep1, theNbTimes1,
9566 theVector2, theStep2, theNbTimes2, theName=None):
9568 Conseqently apply two specified translations to theObject specified number of times.
9571 theObject The object to be translated.
9572 theVector1 Direction of the first translation. DX if None.
9573 theStep1 Step of the first translation.
9574 theNbTimes1 Quantity of translations to be done along theVector1.
9575 theVector2 Direction of the second translation. DY if None.
9576 theStep2 Step of the second translation.
9577 theNbTimes2 Quantity of translations to be done along theVector2.
9578 theName Object name; when specified, this parameter is used
9579 for result publication in the study. Otherwise, if automatic
9580 publication is switched on, default value is used for result name.
9583 New GEOM.GEOM_Object, containing compound of all
9584 the shapes, obtained after each translation.
9587 tr2d = geompy.MakeMultiTranslation2D(prism, vect1, 20, 4, vect2, 80, 3)
9589 # Example: see GEOM_TestAll.py
9590 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
9591 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
9592 theVector2, theStep2, theNbTimes2)
9593 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
9594 anObj.SetParameters(Parameters)
9595 self._autoPublish(anObj, theName, "multitranslation")
9598 ## Rotate the given object around the given axis a given number times.
9599 # Rotation angle will be 2*PI/theNbTimes.
9600 # @param theObject The object to be rotated.
9601 # @param theAxis The rotation axis. DZ if None.
9602 # @param theNbTimes Quantity of rotations to be done.
9603 # @param theName Object name; when specified, this parameter is used
9604 # for result publication in the study. Otherwise, if automatic
9605 # publication is switched on, default value is used for result name.
9607 # @return New GEOM.GEOM_Object, containing compound of all the
9608 # shapes, obtained after each rotation.
9610 # @ref tui_multi_rotation "Example"
9611 @ManageTransactions("TrsfOp")
9612 def MultiRotate1DNbTimes (self, theObject, theAxis, theNbTimes, theName=None):
9614 Rotate the given object around the given axis a given number times.
9615 Rotation angle will be 2*PI/theNbTimes.
9618 theObject The object to be rotated.
9619 theAxis The rotation axis. DZ if None.
9620 theNbTimes Quantity of rotations to be done.
9621 theName Object name; when specified, this parameter is used
9622 for result publication in the study. Otherwise, if automatic
9623 publication is switched on, default value is used for result name.
9626 New GEOM.GEOM_Object, containing compound of all the
9627 shapes, obtained after each rotation.
9630 rot1d = geompy.MultiRotate1DNbTimes(prism, vect, 4)
9632 # Example: see GEOM_TestAll.py
9633 theNbTimes, Parameters = ParseParameters(theNbTimes)
9634 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
9635 RaiseIfFailed("MultiRotate1DNbTimes", self.TrsfOp)
9636 anObj.SetParameters(Parameters)
9637 self._autoPublish(anObj, theName, "multirotation")
9640 ## Rotate the given object around the given axis
9641 # a given number times on the given angle.
9642 # @param theObject The object to be rotated.
9643 # @param theAxis The rotation axis. DZ if None.
9644 # @param theAngleStep Rotation angle in radians.
9645 # @param theNbTimes Quantity of rotations to be done.
9646 # @param theName Object name; when specified, this parameter is used
9647 # for result publication in the study. Otherwise, if automatic
9648 # publication is switched on, default value is used for result name.
9650 # @return New GEOM.GEOM_Object, containing compound of all the
9651 # shapes, obtained after each rotation.
9653 # @ref tui_multi_rotation "Example"
9654 @ManageTransactions("TrsfOp")
9655 def MultiRotate1DByStep(self, theObject, theAxis, theAngleStep, theNbTimes, theName=None):
9657 Rotate the given object around the given axis
9658 a given number times on the given angle.
9661 theObject The object to be rotated.
9662 theAxis The rotation axis. DZ if None.
9663 theAngleStep Rotation angle in radians.
9664 theNbTimes Quantity of rotations to be done.
9665 theName Object name; when specified, this parameter is used
9666 for result publication in the study. Otherwise, if automatic
9667 publication is switched on, default value is used for result name.
9670 New GEOM.GEOM_Object, containing compound of all the
9671 shapes, obtained after each rotation.
9674 rot1d = geompy.MultiRotate1DByStep(prism, vect, math.pi/4, 4)
9676 # Example: see GEOM_TestAll.py
9677 theAngleStep, theNbTimes, Parameters = ParseParameters(theAngleStep, theNbTimes)
9678 anObj = self.TrsfOp.MultiRotate1DByStep(theObject, theAxis, theAngleStep, theNbTimes)
9679 RaiseIfFailed("MultiRotate1DByStep", self.TrsfOp)
9680 anObj.SetParameters(Parameters)
9681 self._autoPublish(anObj, theName, "multirotation")
9684 ## Rotate the given object around the given axis a given
9685 # number times and multi-translate each rotation result.
9686 # Rotation angle will be 2*PI/theNbTimes1.
9687 # Translation direction passes through center of gravity
9688 # of rotated shape and its projection on the rotation axis.
9689 # @param theObject The object to be rotated.
9690 # @param theAxis Rotation axis. DZ if None.
9691 # @param theNbTimes1 Quantity of rotations to be done.
9692 # @param theRadialStep Translation distance.
9693 # @param theNbTimes2 Quantity of translations to be done.
9694 # @param theName Object name; when specified, this parameter is used
9695 # for result publication in the study. Otherwise, if automatic
9696 # publication is switched on, default value is used for result name.
9698 # @return New GEOM.GEOM_Object, containing compound of all the
9699 # shapes, obtained after each transformation.
9701 # @ref tui_multi_rotation "Example"
9702 @ManageTransactions("TrsfOp")
9703 def MultiRotate2DNbTimes(self, theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
9705 Rotate the given object around the
9706 given axis on the given angle a given number
9707 times and multi-translate each rotation result.
9708 Translation direction passes through center of gravity
9709 of rotated shape and its projection on the rotation axis.
9712 theObject The object to be rotated.
9713 theAxis Rotation axis. DZ if None.
9714 theNbTimes1 Quantity of rotations to be done.
9715 theRadialStep Translation distance.
9716 theNbTimes2 Quantity of translations to be done.
9717 theName Object name; when specified, this parameter is used
9718 for result publication in the study. Otherwise, if automatic
9719 publication is switched on, default value is used for result name.
9722 New GEOM.GEOM_Object, containing compound of all the
9723 shapes, obtained after each transformation.
9726 rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
9728 # Example: see GEOM_TestAll.py
9729 theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theNbTimes1, theRadialStep, theNbTimes2)
9730 anObj = self.TrsfOp.MultiRotate2DNbTimes(theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2)
9731 RaiseIfFailed("MultiRotate2DNbTimes", self.TrsfOp)
9732 anObj.SetParameters(Parameters)
9733 self._autoPublish(anObj, theName, "multirotation")
9736 ## Rotate the given object around the
9737 # given axis on the given angle a given number
9738 # times and multi-translate each rotation result.
9739 # Translation direction passes through center of gravity
9740 # of rotated shape and its projection on the rotation axis.
9741 # @param theObject The object to be rotated.
9742 # @param theAxis Rotation axis. DZ if None.
9743 # @param theAngleStep Rotation angle in radians.
9744 # @param theNbTimes1 Quantity of rotations to be done.
9745 # @param theRadialStep Translation distance.
9746 # @param theNbTimes2 Quantity of translations to be done.
9747 # @param theName Object name; when specified, this parameter is used
9748 # for result publication in the study. Otherwise, if automatic
9749 # publication is switched on, default value is used for result name.
9751 # @return New GEOM.GEOM_Object, containing compound of all the
9752 # shapes, obtained after each transformation.
9754 # @ref tui_multi_rotation "Example"
9755 @ManageTransactions("TrsfOp")
9756 def MultiRotate2DByStep (self, theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
9758 Rotate the given object around the
9759 given axis on the given angle a given number
9760 times and multi-translate each rotation result.
9761 Translation direction passes through center of gravity
9762 of rotated shape and its projection on the rotation axis.
9765 theObject The object to be rotated.
9766 theAxis Rotation axis. DZ if None.
9767 theAngleStep Rotation angle in radians.
9768 theNbTimes1 Quantity of rotations to be done.
9769 theRadialStep Translation distance.
9770 theNbTimes2 Quantity of translations to be done.
9771 theName Object name; when specified, this parameter is used
9772 for result publication in the study. Otherwise, if automatic
9773 publication is switched on, default value is used for result name.
9776 New GEOM.GEOM_Object, containing compound of all the
9777 shapes, obtained after each transformation.
9780 rot2d = geompy.MultiRotate2D(prism, vect, math.pi/3, 4, 50, 5)
9782 # Example: see GEOM_TestAll.py
9783 theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
9784 anObj = self.TrsfOp.MultiRotate2DByStep(theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
9785 RaiseIfFailed("MultiRotate2DByStep", self.TrsfOp)
9786 anObj.SetParameters(Parameters)
9787 self._autoPublish(anObj, theName, "multirotation")
9790 ## The same, as MultiRotate1DNbTimes(), but axis is given by direction and point
9792 # @ref swig_MakeMultiRotation "Example"
9793 def MakeMultiRotation1DNbTimes(self, aShape, aDir, aPoint, aNbTimes, theName=None):
9795 The same, as geompy.MultiRotate1DNbTimes, but axis is given by direction and point
9798 pz = geompy.MakeVertex(0, 0, 100)
9799 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9800 MultiRot1D = geompy.MakeMultiRotation1DNbTimes(prism, vy, pz, 6)
9802 # Example: see GEOM_TestOthers.py
9803 aVec = self.MakeLine(aPoint,aDir)
9804 # note: auto-publishing is done in self.MultiRotate1D()
9805 anObj = self.MultiRotate1DNbTimes(aShape, aVec, aNbTimes, theName)
9808 ## The same, as MultiRotate1DByStep(), but axis is given by direction and point
9810 # @ref swig_MakeMultiRotation "Example"
9811 def MakeMultiRotation1DByStep(self, aShape, aDir, aPoint, anAngle, aNbTimes, theName=None):
9813 The same, as geompy.MultiRotate1D, but axis is given by direction and point
9816 pz = geompy.MakeVertex(0, 0, 100)
9817 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9818 MultiRot1D = geompy.MakeMultiRotation1DByStep(prism, vy, pz, math.pi/3, 6)
9820 # Example: see GEOM_TestOthers.py
9821 aVec = self.MakeLine(aPoint,aDir)
9822 # note: auto-publishing is done in self.MultiRotate1D()
9823 anObj = self.MultiRotate1DByStep(aShape, aVec, anAngle, aNbTimes, theName)
9826 ## The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
9828 # @ref swig_MakeMultiRotation "Example"
9829 def MakeMultiRotation2DNbTimes(self, aShape, aDir, aPoint, nbtimes1, aStep, nbtimes2, theName=None):
9831 The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
9834 pz = geompy.MakeVertex(0, 0, 100)
9835 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9836 MultiRot2D = geompy.MakeMultiRotation2DNbTimes(f12, vy, pz, 6, 30, 3)
9838 # Example: see GEOM_TestOthers.py
9839 aVec = self.MakeLine(aPoint,aDir)
9840 # note: auto-publishing is done in self.MultiRotate2DNbTimes()
9841 anObj = self.MultiRotate2DNbTimes(aShape, aVec, nbtimes1, aStep, nbtimes2, theName)
9844 ## The same, as MultiRotate2DByStep(), but axis is given by direction and point
9846 # @ref swig_MakeMultiRotation "Example"
9847 def MakeMultiRotation2DByStep(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
9849 The same, as MultiRotate2DByStep(), but axis is given by direction and point
9852 pz = geompy.MakeVertex(0, 0, 100)
9853 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9854 MultiRot2D = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4, 6, 30, 3)
9856 # Example: see GEOM_TestOthers.py
9857 aVec = self.MakeLine(aPoint,aDir)
9858 # note: auto-publishing is done in self.MultiRotate2D()
9859 anObj = self.MultiRotate2DByStep(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
9863 # Compute a wire or a face that represents a projection of the source
9864 # shape onto cylinder. The cylinder's coordinate system is the same
9865 # as the global coordinate system.
9867 # @param theObject The object to be projected. It can be either
9868 # a planar wire or a face.
9869 # @param theRadius The radius of the cylinder.
9870 # @param theStartAngle The starting angle in radians from
9871 # the cylinder's X axis around Z axis. The angle from which
9872 # the projection is started.
9873 # @param theAngleLength The projection length angle in radians.
9874 # The angle in which to project the total length of the wire.
9875 # If it is negative the projection is not scaled and natural
9876 # wire length is kept for the projection.
9877 # @param theAngleRotation The desired angle in radians between
9878 # the tangent vector to the first curve at the first point of
9879 # the theObject's projection in 2D space and U-direction of
9880 # cylinder's 2D space.
9881 # @param theName Object name; when specified, this parameter is used
9882 # for result publication in the study. Otherwise, if automatic
9883 # publication is switched on, default value is used for result name.
9885 # @return New GEOM.GEOM_Object, containing the result shape. The result
9886 # represents a wire or a face that represents a projection of
9887 # the source shape onto a cylinder.
9889 # @ref tui_projection "Example"
9890 def MakeProjectionOnCylinder (self, theObject, theRadius,
9891 theStartAngle=0.0, theAngleLength=-1.0,
9892 theAngleRotation=0.0,
9895 Compute a wire or a face that represents a projection of the source
9896 shape onto cylinder. The cylinder's coordinate system is the same
9897 as the global coordinate system.
9900 theObject The object to be projected. It can be either
9901 a planar wire or a face.
9902 theRadius The radius of the cylinder.
9903 theStartAngle The starting angle in radians from the cylinder's X axis
9904 around Z axis. The angle from which the projection is started.
9905 theAngleLength The projection length angle in radians. The angle in which
9906 to project the total length of the wire. If it is negative the
9907 projection is not scaled and natural wire length is kept for
9909 theAngleRotation The desired angle in radians between
9910 the tangent vector to the first curve at the first
9911 point of the theObject's projection in 2D space and
9912 U-direction of cylinder's 2D space.
9913 theName Object name; when specified, this parameter is used
9914 for result publication in the study. Otherwise, if automatic
9915 publication is switched on, default value is used for result name.
9918 New GEOM.GEOM_Object, containing the result shape. The result
9919 represents a wire or a face that represents a projection of
9920 the source shape onto a cylinder.
9922 # Example: see GEOM_TestAll.py
9923 flagStartAngle = False
9924 if isinstance(theStartAngle,str):
9925 flagStartAngle = True
9926 flagAngleLength = False
9927 if isinstance(theAngleLength,str):
9928 flagAngleLength = True
9929 flagAngleRotation = False
9930 if isinstance(theAngleRotation,str):
9931 flagAngleRotation = True
9932 theRadius, theStartAngle, theAngleLength, theAngleRotation, Parameters = ParseParameters(
9933 theRadius, theStartAngle, theAngleLength, theAngleRotation)
9935 theStartAngle = theStartAngle*math.pi/180.
9937 theAngleLength = theAngleLength*math.pi/180.
9938 if flagAngleRotation:
9939 theAngleRotation = theAngleRotation*math.pi/180.
9940 anObj = self.TrsfOp.MakeProjectionOnCylinder(theObject, theRadius,
9941 theStartAngle, theAngleLength, theAngleRotation)
9942 RaiseIfFailed("MakeProjectionOnCylinder", self.TrsfOp)
9943 anObj.SetParameters(Parameters)
9944 self._autoPublish(anObj, theName, "projection")
9947 # end of l3_transform
9950 ## @addtogroup l3_transform_d
9953 ## Deprecated method. Use MultiRotate1DNbTimes instead.
9954 def MultiRotate1D(self, theObject, theAxis, theNbTimes, theName=None):
9956 Deprecated method. Use MultiRotate1DNbTimes instead.
9958 print("The method MultiRotate1D is DEPRECATED. Use MultiRotate1DNbTimes instead.")
9959 return self.MultiRotate1DNbTimes(theObject, theAxis, theNbTimes, theName)
9961 ## The same, as MultiRotate2DByStep(), but theAngle is in degrees.
9962 # This method is DEPRECATED. Use MultiRotate2DByStep() instead.
9963 @ManageTransactions("TrsfOp")
9964 def MultiRotate2D(self, theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2, theName=None):
9966 The same, as MultiRotate2DByStep(), but theAngle is in degrees.
9967 This method is DEPRECATED. Use MultiRotate2DByStep() instead.
9970 rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
9972 print("The method MultiRotate2D is DEPRECATED. Use MultiRotate2DByStep instead.")
9973 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
9974 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
9975 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
9976 anObj.SetParameters(Parameters)
9977 self._autoPublish(anObj, theName, "multirotation")
9980 ## The same, as MultiRotate1D(), but axis is given by direction and point
9981 # This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
9982 def MakeMultiRotation1D(self, aShape, aDir, aPoint, aNbTimes, theName=None):
9984 The same, as geompy.MultiRotate1D, but axis is given by direction and point.
9985 This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
9988 pz = geompy.MakeVertex(0, 0, 100)
9989 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9990 MultiRot1D = geompy.MakeMultiRotation1D(prism, vy, pz, 6)
9992 print("The method MakeMultiRotation1D is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.")
9993 aVec = self.MakeLine(aPoint,aDir)
9994 # note: auto-publishing is done in self.MultiRotate1D()
9995 anObj = self.MultiRotate1D(aShape, aVec, aNbTimes, theName)
9998 ## The same, as MultiRotate2D(), but axis is given by direction and point
9999 # This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
10000 def MakeMultiRotation2D(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
10002 The same, as MultiRotate2D(), but axis is given by direction and point
10003 This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
10006 pz = geompy.MakeVertex(0, 0, 100)
10007 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
10008 MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
10010 print("The method MakeMultiRotation2D is DEPRECATED. Use MakeMultiRotation2DByStep instead.")
10011 aVec = self.MakeLine(aPoint,aDir)
10012 # note: auto-publishing is done in self.MultiRotate2D()
10013 anObj = self.MultiRotate2D(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
10016 # end of l3_transform_d
10019 ## @addtogroup l3_local
10022 ## Perform a fillet on all edges of the given shape.
10023 # @param theShape Shape, to perform fillet on.
10024 # @param theR Fillet radius.
10025 # @param theName Object name; when specified, this parameter is used
10026 # for result publication in the study. Otherwise, if automatic
10027 # publication is switched on, default value is used for result name.
10029 # @return New GEOM.GEOM_Object, containing the result shape.
10031 # @ref tui_fillet "Example 1"
10032 # \n @ref swig_MakeFilletAll "Example 2"
10033 @ManageTransactions("LocalOp")
10034 def MakeFilletAll(self, theShape, theR, theName=None):
10036 Perform a fillet on all edges of the given shape.
10039 theShape Shape, to perform fillet on.
10040 theR Fillet radius.
10041 theName Object name; when specified, this parameter is used
10042 for result publication in the study. Otherwise, if automatic
10043 publication is switched on, default value is used for result name.
10046 New GEOM.GEOM_Object, containing the result shape.
10049 filletall = geompy.MakeFilletAll(prism, 10.)
10051 # Example: see GEOM_TestOthers.py
10052 theR,Parameters = ParseParameters(theR)
10053 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
10054 RaiseIfFailed("MakeFilletAll", self.LocalOp)
10055 anObj.SetParameters(Parameters)
10056 self._autoPublish(anObj, theName, "fillet")
10059 ## Perform a fillet on the specified edges/faces of the given shape
10060 # @param theShape Shape, to perform fillet on.
10061 # @param theR Fillet radius.
10062 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR> (see ShapeType())
10063 # @param theListShapes Global indices of edges/faces to perform fillet on.
10064 # @param theName Object name; when specified, this parameter is used
10065 # for result publication in the study. Otherwise, if automatic
10066 # publication is switched on, default value is used for result name.
10068 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10070 # @return New GEOM.GEOM_Object, containing the result shape.
10072 # @ref tui_fillet "Example"
10073 @ManageTransactions("LocalOp")
10074 def MakeFillet(self, theShape, theR, theShapeType, theListShapes, theName=None):
10076 Perform a fillet on the specified edges/faces of the given shape
10079 theShape Shape, to perform fillet on.
10080 theR Fillet radius.
10081 theShapeType Type of shapes in theListShapes (see geompy.ShapeTypes)
10082 theListShapes Global indices of edges/faces to perform fillet on.
10083 theName Object name; when specified, this parameter is used
10084 for result publication in the study. Otherwise, if automatic
10085 publication is switched on, default value is used for result name.
10088 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10091 New GEOM.GEOM_Object, containing the result shape.
10094 # get the list of IDs (IDList) for the fillet
10095 prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"])
10097 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
10098 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
10099 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
10100 # make a fillet on the specified edges of the given shape
10101 fillet = geompy.MakeFillet(prism, 10., geompy.ShapeType["EDGE"], IDlist_e)
10103 # Example: see GEOM_TestAll.py
10104 theR,Parameters = ParseParameters(theR)
10106 if theShapeType == self.ShapeType["EDGE"]:
10107 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
10108 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
10110 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
10111 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
10112 anObj.SetParameters(Parameters)
10113 self._autoPublish(anObj, theName, "fillet")
10116 ## The same that MakeFillet() but with two Fillet Radius R1 and R2
10117 @ManageTransactions("LocalOp")
10118 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes, theName=None):
10120 The same that geompy.MakeFillet but with two Fillet Radius R1 and R2
10123 # get the list of IDs (IDList) for the fillet
10124 prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"])
10126 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
10127 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
10128 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
10129 # make a fillet on the specified edges of the given shape
10130 fillet = geompy.MakeFillet(prism, 10., 15., geompy.ShapeType["EDGE"], IDlist_e)
10132 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
10134 if theShapeType == self.ShapeType["EDGE"]:
10135 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
10136 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
10138 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
10139 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
10140 anObj.SetParameters(Parameters)
10141 self._autoPublish(anObj, theName, "fillet")
10144 ## Perform a fillet on the specified edges of the given shape
10145 # @param theShape Wire Shape to perform fillet on.
10146 # @param theR Fillet radius.
10147 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
10148 # \note Global index of sub-shape can be obtained, using method GetSubShapeID()
10149 # \note The list of vertices could be empty,
10150 # in this case fillet will done done at all vertices in wire
10151 # @param doIgnoreSecantVertices If FALSE, fillet radius is always limited
10152 # by the length of the edges, nearest to the fillet vertex.
10153 # But sometimes the next edge is C1 continuous with the one, nearest to
10154 # the fillet point, and such two (or more) edges can be united to allow
10155 # bigger radius. Set this flag to TRUE to allow collinear edges union,
10156 # thus ignoring the secant vertex (vertices).
10157 # @param theName Object name; when specified, this parameter is used
10158 # for result publication in the study. Otherwise, if automatic
10159 # publication is switched on, default value is used for result name.
10161 # @return New GEOM.GEOM_Object, containing the result shape.
10163 # @ref tui_fillet2d "Example"
10164 @ManageTransactions("LocalOp")
10165 def MakeFillet1D(self, theShape, theR, theListOfVertexes, doIgnoreSecantVertices = True, theName=None):
10167 Perform a fillet on the specified edges of the given shape
10170 theShape Wire Shape to perform fillet on.
10171 theR Fillet radius.
10172 theListOfVertexes Global indices of vertexes to perform fillet on.
10173 doIgnoreSecantVertices If FALSE, fillet radius is always limited
10174 by the length of the edges, nearest to the fillet vertex.
10175 But sometimes the next edge is C1 continuous with the one, nearest to
10176 the fillet point, and such two (or more) edges can be united to allow
10177 bigger radius. Set this flag to TRUE to allow collinear edges union,
10178 thus ignoring the secant vertex (vertices).
10179 theName Object name; when specified, this parameter is used
10180 for result publication in the study. Otherwise, if automatic
10181 publication is switched on, default value is used for result name.
10183 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10185 The list of vertices could be empty,in this case fillet will done done at all vertices in wire
10188 New GEOM.GEOM_Object, containing the result shape.
10192 Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
10193 # make fillet at given wire vertices with giver radius
10194 Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
10196 # Example: see GEOM_TestAll.py
10197 theR,doIgnoreSecantVertices,Parameters = ParseParameters(theR,doIgnoreSecantVertices)
10198 anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes, doIgnoreSecantVertices)
10199 RaiseIfFailed("MakeFillet1D", self.LocalOp)
10200 anObj.SetParameters(Parameters)
10201 self._autoPublish(anObj, theName, "fillet")
10204 ## Perform a fillet at the specified vertices of the given face/shell.
10205 # @param theShape Face or Shell shape to perform fillet on.
10206 # @param theR Fillet radius.
10207 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
10208 # @param theName Object name; when specified, this parameter is used
10209 # for result publication in the study. Otherwise, if automatic
10210 # publication is switched on, default value is used for result name.
10212 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10214 # @return New GEOM.GEOM_Object, containing the result shape.
10216 # @ref tui_fillet2d "Example"
10217 @ManageTransactions("LocalOp")
10218 def MakeFillet2D(self, theShape, theR, theListOfVertexes, theName=None):
10220 Perform a fillet at the specified vertices of the given face/shell.
10223 theShape Face or Shell shape to perform fillet on.
10224 theR Fillet radius.
10225 theListOfVertexes Global indices of vertexes to perform fillet on.
10226 theName Object name; when specified, this parameter is used
10227 for result publication in the study. Otherwise, if automatic
10228 publication is switched on, default value is used for result name.
10230 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10233 New GEOM.GEOM_Object, containing the result shape.
10236 face = geompy.MakeFaceHW(100, 100, 1)
10237 fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
10239 # Example: see GEOM_TestAll.py
10240 theR,Parameters = ParseParameters(theR)
10241 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
10242 RaiseIfFailed("MakeFillet2D", self.LocalOp)
10243 anObj.SetParameters(Parameters)
10244 self._autoPublish(anObj, theName, "fillet")
10247 ## Perform a symmetric chamfer on all edges of the given shape.
10248 # @param theShape Shape, to perform chamfer on.
10249 # @param theD Chamfer size along each face.
10250 # @param theName Object name; when specified, this parameter is used
10251 # for result publication in the study. Otherwise, if automatic
10252 # publication is switched on, default value is used for result name.
10254 # @return New GEOM.GEOM_Object, containing the result shape.
10256 # @ref tui_chamfer "Example 1"
10257 # \n @ref swig_MakeChamferAll "Example 2"
10258 @ManageTransactions("LocalOp")
10259 def MakeChamferAll(self, theShape, theD, theName=None):
10261 Perform a symmetric chamfer on all edges of the given shape.
10264 theShape Shape, to perform chamfer on.
10265 theD Chamfer size along each face.
10266 theName Object name; when specified, this parameter is used
10267 for result publication in the study. Otherwise, if automatic
10268 publication is switched on, default value is used for result name.
10271 New GEOM.GEOM_Object, containing the result shape.
10274 chamfer_all = geompy.MakeChamferAll(prism, 10.)
10276 # Example: see GEOM_TestOthers.py
10277 theD,Parameters = ParseParameters(theD)
10278 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
10279 RaiseIfFailed("MakeChamferAll", self.LocalOp)
10280 anObj.SetParameters(Parameters)
10281 self._autoPublish(anObj, theName, "chamfer")
10284 ## Perform a chamfer on edges, common to the specified faces,
10285 # with distance D1 on the Face1
10286 # @param theShape Shape, to perform chamfer on.
10287 # @param theD1 Chamfer size along \a theFace1.
10288 # @param theD2 Chamfer size along \a theFace2.
10289 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
10290 # @param theName Object name; when specified, this parameter is used
10291 # for result publication in the study. Otherwise, if automatic
10292 # publication is switched on, default value is used for result name.
10294 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10296 # @return New GEOM.GEOM_Object, containing the result shape.
10298 # @ref tui_chamfer "Example"
10299 @ManageTransactions("LocalOp")
10300 def MakeChamferEdge(self, theShape, theD1, theD2, theFace1, theFace2, theName=None):
10302 Perform a chamfer on edges, common to the specified faces,
10303 with distance D1 on the Face1
10306 theShape Shape, to perform chamfer on.
10307 theD1 Chamfer size along theFace1.
10308 theD2 Chamfer size along theFace2.
10309 theFace1,theFace2 Global indices of two faces of theShape.
10310 theName Object name; when specified, this parameter is used
10311 for result publication in the study. Otherwise, if automatic
10312 publication is switched on, default value is used for result name.
10315 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10318 New GEOM.GEOM_Object, containing the result shape.
10321 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
10322 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
10323 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
10324 chamfer_e = geompy.MakeChamferEdge(prism, 10., 10., f_ind_1, f_ind_2)
10326 # Example: see GEOM_TestAll.py
10327 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10328 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
10329 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
10330 anObj.SetParameters(Parameters)
10331 self._autoPublish(anObj, theName, "chamfer")
10334 ## Perform a chamfer on edges
10335 # @param theShape Shape, to perform chamfer on.
10336 # @param theD Chamfer length
10337 # @param theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10338 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
10339 # @param theName Object name; when specified, this parameter is used
10340 # for result publication in the study. Otherwise, if automatic
10341 # publication is switched on, default value is used for result name.
10343 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10345 # @return New GEOM.GEOM_Object, containing the result shape.
10346 @ManageTransactions("LocalOp")
10347 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2, theName=None):
10349 Perform a chamfer on edges
10352 theShape Shape, to perform chamfer on.
10353 theD1 Chamfer size along theFace1.
10354 theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees).
10355 theFace1,theFace2 Global indices of two faces of theShape.
10356 theName Object name; when specified, this parameter is used
10357 for result publication in the study. Otherwise, if automatic
10358 publication is switched on, default value is used for result name.
10361 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10364 New GEOM.GEOM_Object, containing the result shape.
10367 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
10368 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
10369 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
10371 chamfer_e = geompy.MakeChamferEdge(prism, 10., ang, f_ind_1, f_ind_2)
10374 if isinstance(theAngle,str):
10376 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10378 theAngle = theAngle*math.pi/180.0
10379 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
10380 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
10381 anObj.SetParameters(Parameters)
10382 self._autoPublish(anObj, theName, "chamfer")
10385 ## Perform a chamfer on all edges of the specified faces,
10386 # with distance D1 on the first specified face (if several for one edge)
10387 # @param theShape Shape, to perform chamfer on.
10388 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
10389 # connected to the edge, are in \a theFaces, \a theD1
10390 # will be get along face, which is nearer to \a theFaces beginning.
10391 # @param theD2 Chamfer size along another of two faces, connected to the edge.
10392 # @param theFaces Sequence of global indices of faces of \a theShape.
10393 # @param theName Object name; when specified, this parameter is used
10394 # for result publication in the study. Otherwise, if automatic
10395 # publication is switched on, default value is used for result name.
10397 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10399 # @return New GEOM.GEOM_Object, containing the result shape.
10401 # @ref tui_chamfer "Example"
10402 @ManageTransactions("LocalOp")
10403 def MakeChamferFaces(self, theShape, theD1, theD2, theFaces, theName=None):
10405 Perform a chamfer on all edges of the specified faces,
10406 with distance D1 on the first specified face (if several for one edge)
10409 theShape Shape, to perform chamfer on.
10410 theD1 Chamfer size along face from theFaces. If both faces,
10411 connected to the edge, are in theFaces, theD1
10412 will be get along face, which is nearer to theFaces beginning.
10413 theD2 Chamfer size along another of two faces, connected to the edge.
10414 theFaces Sequence of global indices of faces of theShape.
10415 theName Object name; when specified, this parameter is used
10416 for result publication in the study. Otherwise, if automatic
10417 publication is switched on, default value is used for result name.
10419 Note: Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
10422 New GEOM.GEOM_Object, containing the result shape.
10424 # Example: see GEOM_TestAll.py
10425 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10426 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
10427 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
10428 anObj.SetParameters(Parameters)
10429 self._autoPublish(anObj, theName, "chamfer")
10432 ## The Same that MakeChamferFaces() but with params theD is chamfer length and
10433 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10435 # @ref swig_FilletChamfer "Example"
10436 @ManageTransactions("LocalOp")
10437 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces, theName=None):
10439 The Same that geompy.MakeChamferFaces but with params theD is chamfer length and
10440 theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10443 if isinstance(theAngle,str):
10445 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10447 theAngle = theAngle*math.pi/180.0
10448 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
10449 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
10450 anObj.SetParameters(Parameters)
10451 self._autoPublish(anObj, theName, "chamfer")
10454 ## Perform a chamfer on edges,
10455 # with distance D1 on the first specified face (if several for one edge)
10456 # @param theShape Shape, to perform chamfer on.
10457 # @param theD1,theD2 Chamfer size
10458 # @param theEdges Sequence of edges of \a theShape.
10459 # @param theName Object name; when specified, this parameter is used
10460 # for result publication in the study. Otherwise, if automatic
10461 # publication is switched on, default value is used for result name.
10463 # @return New GEOM.GEOM_Object, containing the result shape.
10465 # @ref swig_FilletChamfer "Example"
10466 @ManageTransactions("LocalOp")
10467 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges, theName=None):
10469 Perform a chamfer on edges,
10470 with distance D1 on the first specified face (if several for one edge)
10473 theShape Shape, to perform chamfer on.
10474 theD1,theD2 Chamfer size
10475 theEdges Sequence of edges of theShape.
10476 theName Object name; when specified, this parameter is used
10477 for result publication in the study. Otherwise, if automatic
10478 publication is switched on, default value is used for result name.
10481 New GEOM.GEOM_Object, containing the result shape.
10483 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10484 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
10485 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
10486 anObj.SetParameters(Parameters)
10487 self._autoPublish(anObj, theName, "chamfer")
10490 ## The Same that MakeChamferEdges() but with params theD is chamfer length and
10491 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10492 @ManageTransactions("LocalOp")
10493 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges, theName=None):
10495 The Same that geompy.MakeChamferEdges but with params theD is chamfer length and
10496 theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10499 if isinstance(theAngle,str):
10501 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10503 theAngle = theAngle*math.pi/180.0
10504 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
10505 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
10506 anObj.SetParameters(Parameters)
10507 self._autoPublish(anObj, theName, "chamfer")
10510 ## @sa MakeChamferEdge(), MakeChamferFaces()
10512 # @ref swig_MakeChamfer "Example"
10513 def MakeChamfer(self, aShape, d1, d2, aShapeType, ListShape, theName=None):
10515 See geompy.MakeChamferEdge() and geompy.MakeChamferFaces() functions for more information.
10517 # Example: see GEOM_TestOthers.py
10519 # note: auto-publishing is done in self.MakeChamferEdge() or self.MakeChamferFaces()
10520 if aShapeType == self.ShapeType["EDGE"]:
10521 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1],theName)
10523 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape,theName)
10526 ## Remove material from a solid by extrusion of the base shape on the given distance.
10527 # @param theInit Shape to remove material from. It must be a solid or
10528 # a compound made of a single solid.
10529 # @param theBase Closed edge or wire defining the base shape to be extruded.
10530 # @param theH Prism dimension along the normal to theBase
10531 # @param theAngle Draft angle in degrees.
10532 # @param theInvert If true material changes the direction
10533 # @param theName Object name; when specified, this parameter is used
10534 # for result publication in the study. Otherwise, if automatic
10535 # publication is switched on, default value is used for result name.
10537 # @return New GEOM.GEOM_Object, containing the initial shape with removed material
10539 # @ref tui_creation_prism "Example"
10540 @ManageTransactions("PrimOp")
10541 def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
10543 Add material to a solid by extrusion of the base shape on the given distance.
10546 theInit Shape to remove material from. It must be a solid or a compound made of a single solid.
10547 theBase Closed edge or wire defining the base shape to be extruded.
10548 theH Prism dimension along the normal to theBase
10549 theAngle Draft angle in degrees.
10550 theInvert If true material changes the direction.
10551 theName Object name; when specified, this parameter is used
10552 for result publication in the study. Otherwise, if automatic
10553 publication is switched on, default value is used for result name.
10556 New GEOM.GEOM_Object, containing the initial shape with removed material.
10558 # Example: see GEOM_TestAll.py
10559 theH,theAngle,Parameters = ParseParameters(theH,theAngle)
10560 anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False, theInvert)
10561 RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
10562 anObj.SetParameters(Parameters)
10563 self._autoPublish(anObj, theName, "extrudedCut")
10566 ## Add material to a solid by extrusion of the base shape on the given distance.
10567 # @param theInit Shape to add material to. It must be a solid or
10568 # a compound made of a single solid.
10569 # @param theBase Closed edge or wire defining the base shape to be extruded.
10570 # @param theH Prism dimension along the normal to theBase
10571 # @param theAngle Draft angle in degrees.
10572 # @param theInvert If true material changes the direction
10573 # @param theName Object name; when specified, this parameter is used
10574 # for result publication in the study. Otherwise, if automatic
10575 # publication is switched on, default value is used for result name.
10577 # @return New GEOM.GEOM_Object, containing the initial shape with added material
10579 # @ref tui_creation_prism "Example"
10580 @ManageTransactions("PrimOp")
10581 def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
10583 Add material to a solid by extrusion of the base shape on the given distance.
10586 theInit Shape to add material to. It must be a solid or a compound made of a single solid.
10587 theBase Closed edge or wire defining the base shape to be extruded.
10588 theH Prism dimension along the normal to theBase
10589 theAngle Draft angle in degrees.
10590 theInvert If true material changes the direction.
10591 theName Object name; when specified, this parameter is used
10592 for result publication in the study. Otherwise, if automatic
10593 publication is switched on, default value is used for result name.
10596 New GEOM.GEOM_Object, containing the initial shape with added material.
10598 # Example: see GEOM_TestAll.py
10599 theH,theAngle,Parameters = ParseParameters(theH,theAngle)
10600 anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True, theInvert)
10601 RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
10602 anObj.SetParameters(Parameters)
10603 self._autoPublish(anObj, theName, "extrudedBoss")
10609 ## @addtogroup l3_basic_op
10612 ## Perform an Archimde operation on the given shape with given parameters.
10613 # The object presenting the resulting face is returned.
10614 # @param theShape Shape to be put in water.
10615 # @param theWeight Weight of the shape.
10616 # @param theWaterDensity Density of the water.
10617 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
10618 # @param theName Object name; when specified, this parameter is used
10619 # for result publication in the study. Otherwise, if automatic
10620 # publication is switched on, default value is used for result name.
10622 # @return New GEOM.GEOM_Object, containing a section of \a theShape
10623 # by a plane, corresponding to water level.
10625 # @ref tui_archimede "Example"
10626 @ManageTransactions("LocalOp")
10627 def Archimede(self, theShape, theWeight, theWaterDensity, theMeshDeflection, theName=None):
10629 Perform an Archimde operation on the given shape with given parameters.
10630 The object presenting the resulting face is returned.
10633 theShape Shape to be put in water.
10634 theWeight Weight of the shape.
10635 theWaterDensity Density of the water.
10636 theMeshDeflection Deflection of the mesh, using to compute the section.
10637 theName Object name; when specified, this parameter is used
10638 for result publication in the study. Otherwise, if automatic
10639 publication is switched on, default value is used for result name.
10642 New GEOM.GEOM_Object, containing a section of theShape
10643 by a plane, corresponding to water level.
10645 # Example: see GEOM_TestAll.py
10646 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
10647 theWeight,theWaterDensity,theMeshDeflection)
10648 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
10649 RaiseIfFailed("MakeArchimede", self.LocalOp)
10650 anObj.SetParameters(Parameters)
10651 self._autoPublish(anObj, theName, "archimede")
10654 # end of l3_basic_op
10657 ## @addtogroup l2_measure
10660 ## Get point coordinates
10661 # @return [x, y, z]
10663 # @ref tui_point_coordinates_page "Example"
10664 @ManageTransactions("MeasuOp")
10665 def PointCoordinates(self,Point):
10667 Get point coordinates
10672 # Example: see GEOM_TestMeasures.py
10673 aTuple = self.MeasuOp.PointCoordinates(Point)
10674 RaiseIfFailed("PointCoordinates", self.MeasuOp)
10677 ## Get vector coordinates
10678 # @return [x, y, z]
10680 # @ref tui_measurement_tools_page "Example"
10681 def VectorCoordinates(self,Vector):
10683 Get vector coordinates
10689 p1=self.GetFirstVertex(Vector)
10690 p2=self.GetLastVertex(Vector)
10692 X1=self.PointCoordinates(p1)
10693 X2=self.PointCoordinates(p2)
10695 return (X2[0]-X1[0],X2[1]-X1[1],X2[2]-X1[2])
10698 ## Compute cross product
10699 # @return vector w=u^v
10701 # @ref tui_measurement_tools_page "Example"
10702 def CrossProduct(self, Vector1, Vector2):
10704 Compute cross product
10706 Returns: vector w=u^v
10708 u=self.VectorCoordinates(Vector1)
10709 v=self.VectorCoordinates(Vector2)
10710 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])
10714 ## Compute cross product
10715 # @return dot product p=u.v
10717 # @ref tui_measurement_tools_page "Example"
10718 def DotProduct(self, Vector1, Vector2):
10720 Compute cross product
10722 Returns: dot product p=u.v
10724 u=self.VectorCoordinates(Vector1)
10725 v=self.VectorCoordinates(Vector2)
10726 p=u[0]*v[0]+u[1]*v[1]+u[2]*v[2]
10731 ## Get summarized length of all wires,
10732 # area of surface and volume of the given shape.
10733 # @param theShape Shape to define properties of.
10734 # @param theTolerance maximal relative error of area
10735 # and volume computation.
10736 # @return [theLength, theSurfArea, theVolume]\n
10737 # theLength: Summarized length of all wires of the given shape.\n
10738 # theSurfArea: Area of surface of the given shape.\n
10739 # theVolume: Volume of the given shape.
10741 # @ref tui_basic_properties_page "Example"
10742 @ManageTransactions("MeasuOp")
10743 def BasicProperties(self,theShape, theTolerance=1.e-6):
10745 Get summarized length of all wires,
10746 area of surface and volume of the given shape.
10749 theShape Shape to define properties of.
10750 theTolerance maximal relative error of area
10751 and volume computation.
10754 [theLength, theSurfArea, theVolume]
10755 theLength: Summarized length of all wires of the given shape.
10756 theSurfArea: Area of surface of the given shape.
10757 theVolume: Volume of the given shape.
10759 # Example: see GEOM_TestMeasures.py
10760 aTuple = self.MeasuOp.GetBasicProperties(theShape, theTolerance)
10761 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
10764 ## Get parameters of bounding box of the given shape
10765 # @param theShape Shape to obtain bounding box of.
10766 # @param precise TRUE for precise computation; FALSE for fast one.
10767 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
10768 # Xmin,Xmax: Limits of shape along OX axis.
10769 # Ymin,Ymax: Limits of shape along OY axis.
10770 # Zmin,Zmax: Limits of shape along OZ axis.
10772 # @ref tui_bounding_box_page "Example"
10773 @ManageTransactions("MeasuOp")
10774 def BoundingBox (self, theShape, precise=False):
10776 Get parameters of bounding box of the given shape
10779 theShape Shape to obtain bounding box of.
10780 precise TRUE for precise computation; FALSE for fast one.
10783 [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
10784 Xmin,Xmax: Limits of shape along OX axis.
10785 Ymin,Ymax: Limits of shape along OY axis.
10786 Zmin,Zmax: Limits of shape along OZ axis.
10788 # Example: see GEOM_TestMeasures.py
10789 aTuple = self.MeasuOp.GetBoundingBox(theShape, precise)
10790 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
10793 ## Get bounding box of the given shape
10794 # @param theShape Shape to obtain bounding box of.
10795 # @param precise TRUE for precise computation; FALSE for fast one.
10796 # @param theName Object name; when specified, this parameter is used
10797 # for result publication in the study. Otherwise, if automatic
10798 # publication is switched on, default value is used for result name.
10800 # @return New GEOM.GEOM_Object, containing the created box.
10802 # @ref tui_bounding_box_page "Example"
10803 @ManageTransactions("MeasuOp")
10804 def MakeBoundingBox (self, theShape, precise=False, theName=None):
10806 Get bounding box of the given shape
10809 theShape Shape to obtain bounding box of.
10810 precise TRUE for precise computation; FALSE for fast one.
10811 theName Object name; when specified, this parameter is used
10812 for result publication in the study. Otherwise, if automatic
10813 publication is switched on, default value is used for result name.
10816 New GEOM.GEOM_Object, containing the created box.
10818 # Example: see GEOM_TestMeasures.py
10819 anObj = self.MeasuOp.MakeBoundingBox(theShape, precise)
10820 RaiseIfFailed("MakeBoundingBox", self.MeasuOp)
10821 self._autoPublish(anObj, theName, "bndbox")
10824 ## Get inertia matrix and moments of inertia of theShape.
10825 # @param theShape Shape to calculate inertia of.
10826 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
10827 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
10828 # Ix,Iy,Iz: Moments of inertia of the given shape.
10830 # @ref tui_inertia_page "Example"
10831 @ManageTransactions("MeasuOp")
10832 def Inertia(self,theShape):
10834 Get inertia matrix and moments of inertia of theShape.
10837 theShape Shape to calculate inertia of.
10840 [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
10841 I(1-3)(1-3): Components of the inertia matrix of the given shape.
10842 Ix,Iy,Iz: Moments of inertia of the given shape.
10844 # Example: see GEOM_TestMeasures.py
10845 aTuple = self.MeasuOp.GetInertia(theShape)
10846 RaiseIfFailed("GetInertia", self.MeasuOp)
10849 ## Get if coords are included in the shape (ST_IN or ST_ON)
10850 # @param theShape Shape
10851 # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
10852 # @param tolerance to be used (default is 1.0e-7)
10853 # @return list_of_boolean = [res1, res2, ...]
10854 @ManageTransactions("MeasuOp")
10855 def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
10857 Get if coords are included in the shape (ST_IN or ST_ON)
10861 coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
10862 tolerance to be used (default is 1.0e-7)
10865 list_of_boolean = [res1, res2, ...]
10867 return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
10869 ## Get minimal distance between the given shapes.
10870 # @param theShape1,theShape2 Shapes to find minimal distance between.
10871 # @return Value of the minimal distance between the given shapes.
10873 # @ref tui_min_distance_page "Example"
10874 @ManageTransactions("MeasuOp")
10875 def MinDistance(self, theShape1, theShape2):
10877 Get minimal distance between the given shapes.
10880 theShape1,theShape2 Shapes to find minimal distance between.
10883 Value of the minimal distance between the given shapes.
10885 # Example: see GEOM_TestMeasures.py
10886 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
10887 RaiseIfFailed("GetMinDistance", self.MeasuOp)
10890 ## Get minimal distance between the given shapes.
10891 # @param theShape1,theShape2 Shapes to find minimal distance between.
10892 # @return Value of the minimal distance between the given shapes, in form of list
10893 # [Distance, DX, DY, DZ].
10895 # @ref tui_min_distance_page "Example"
10896 @ManageTransactions("MeasuOp")
10897 def MinDistanceComponents(self, theShape1, theShape2):
10899 Get minimal distance between the given shapes.
10902 theShape1,theShape2 Shapes to find minimal distance between.
10905 Value of the minimal distance between the given shapes, in form of list
10906 [Distance, DX, DY, DZ]
10908 # Example: see GEOM_TestMeasures.py
10909 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
10910 RaiseIfFailed("GetMinDistance", self.MeasuOp)
10911 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
10914 ## Get closest points of the given shapes.
10915 # @param theShape1,theShape2 Shapes to find closest points of.
10916 # @return The number of found solutions (-1 in case of infinite number of
10917 # solutions) and a list of (X, Y, Z) coordinates for all couples of points.
10919 # @ref tui_min_distance_page "Example"
10920 @ManageTransactions("MeasuOp")
10921 def ClosestPoints (self, theShape1, theShape2):
10923 Get closest points of the given shapes.
10926 theShape1,theShape2 Shapes to find closest points of.
10929 The number of found solutions (-1 in case of infinite number of
10930 solutions) and a list of (X, Y, Z) coordinates for all couples of points.
10932 # Example: see GEOM_TestMeasures.py
10933 aTuple = self.MeasuOp.ClosestPoints(theShape1, theShape2)
10934 RaiseIfFailed("ClosestPoints", self.MeasuOp)
10937 ## Get angle between the given shapes in degrees.
10938 # @param theShape1,theShape2 Lines or linear edges to find angle between.
10939 # @note If both arguments are vectors, the angle is computed in accordance
10940 # with their orientations, otherwise the minimum angle is computed.
10941 # @return Value of the angle between the given shapes in degrees.
10943 # @ref tui_angle_page "Example"
10944 @ManageTransactions("MeasuOp")
10945 def GetAngle(self, theShape1, theShape2):
10947 Get angle between the given shapes in degrees.
10950 theShape1,theShape2 Lines or linear edges to find angle between.
10953 If both arguments are vectors, the angle is computed in accordance
10954 with their orientations, otherwise the minimum angle is computed.
10957 Value of the angle between the given shapes in degrees.
10959 # Example: see GEOM_TestMeasures.py
10960 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
10961 RaiseIfFailed("GetAngle", self.MeasuOp)
10964 ## Get angle between the given shapes in radians.
10965 # @param theShape1,theShape2 Lines or linear edges to find angle between.
10966 # @note If both arguments are vectors, the angle is computed in accordance
10967 # with their orientations, otherwise the minimum angle is computed.
10968 # @return Value of the angle between the given shapes in radians.
10970 # @ref tui_angle_page "Example"
10971 @ManageTransactions("MeasuOp")
10972 def GetAngleRadians(self, theShape1, theShape2):
10974 Get angle between the given shapes in radians.
10977 theShape1,theShape2 Lines or linear edges to find angle between.
10981 If both arguments are vectors, the angle is computed in accordance
10982 with their orientations, otherwise the minimum angle is computed.
10985 Value of the angle between the given shapes in radians.
10987 # Example: see GEOM_TestMeasures.py
10988 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
10989 RaiseIfFailed("GetAngle", self.MeasuOp)
10992 ## Get angle between the given vectors in degrees.
10993 # @param theShape1,theShape2 Vectors to find angle between.
10994 # @param theFlag If True, the normal vector is defined by the two vectors cross,
10995 # if False, the opposite vector to the normal vector is used.
10996 # @return Value of the angle between the given vectors in degrees.
10998 # @ref tui_angle_page "Example"
10999 @ManageTransactions("MeasuOp")
11000 def GetAngleVectors(self, theShape1, theShape2, theFlag = True):
11002 Get angle between the given vectors in degrees.
11005 theShape1,theShape2 Vectors to find angle between.
11006 theFlag If True, the normal vector is defined by the two vectors cross,
11007 if False, the opposite vector to the normal vector is used.
11010 Value of the angle between the given vectors in degrees.
11012 anAngle = self.MeasuOp.GetAngleBtwVectors(theShape1, theShape2)
11014 anAngle = 360. - anAngle
11015 RaiseIfFailed("GetAngleVectors", self.MeasuOp)
11018 ## The same as GetAngleVectors, but the result is in radians.
11019 def GetAngleRadiansVectors(self, theShape1, theShape2, theFlag = True):
11021 Get angle between the given vectors in radians.
11024 theShape1,theShape2 Vectors to find angle between.
11025 theFlag If True, the normal vector is defined by the two vectors cross,
11026 if False, the opposite vector to the normal vector is used.
11029 Value of the angle between the given vectors in radians.
11031 anAngle = self.GetAngleVectors(theShape1, theShape2, theFlag)*math.pi/180.
11034 ## @name Curve Curvature Measurement
11035 # Methods for receiving radius of curvature of curves
11036 # in the given point
11039 ## Measure curvature of a curve at a point, set by parameter.
11040 # @param theCurve a curve.
11041 # @param theParam parameter.
11042 # @return radius of curvature of \a theCurve.
11044 # @ref swig_todo "Example"
11045 @ManageTransactions("MeasuOp")
11046 def CurveCurvatureByParam(self, theCurve, theParam):
11048 Measure curvature of a curve at a point, set by parameter.
11052 theParam parameter.
11055 radius of curvature of theCurve.
11057 # Example: see GEOM_TestMeasures.py
11058 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
11059 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
11062 ## Measure curvature of a curve at a point.
11063 # @param theCurve a curve.
11064 # @param thePoint given point.
11065 # @return radius of curvature of \a theCurve.
11067 # @ref swig_todo "Example"
11068 @ManageTransactions("MeasuOp")
11069 def CurveCurvatureByPoint(self, theCurve, thePoint):
11071 Measure curvature of a curve at a point.
11075 thePoint given point.
11078 radius of curvature of theCurve.
11080 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
11081 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
11085 ## @name Surface Curvature Measurement
11086 # Methods for receiving max and min radius of curvature of surfaces
11087 # in the given point
11090 ## Measure max radius of curvature of surface.
11091 # @param theSurf the given surface.
11092 # @param theUParam Value of U-parameter on the referenced surface.
11093 # @param theVParam Value of V-parameter on the referenced surface.
11094 # @return max radius of curvature of theSurf.
11096 ## @ref swig_todo "Example"
11097 @ManageTransactions("MeasuOp")
11098 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
11100 Measure max radius of curvature of surface.
11103 theSurf the given surface.
11104 theUParam Value of U-parameter on the referenced surface.
11105 theVParam Value of V-parameter on the referenced surface.
11108 max radius of curvature of theSurf.
11110 # Example: see GEOM_TestMeasures.py
11111 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
11112 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
11115 ## Measure max radius of curvature of surface in the given point
11116 # @param theSurf the given surface.
11117 # @param thePoint given point.
11118 # @return max radius of curvature of theSurf.
11120 ## @ref swig_todo "Example"
11121 @ManageTransactions("MeasuOp")
11122 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
11124 Measure max radius of curvature of surface in the given point.
11127 theSurf the given surface.
11128 thePoint given point.
11131 max radius of curvature of theSurf.
11133 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
11134 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
11137 ## Measure min radius of curvature of surface.
11138 # @param theSurf the given surface.
11139 # @param theUParam Value of U-parameter on the referenced surface.
11140 # @param theVParam Value of V-parameter on the referenced surface.
11141 # @return min radius of curvature of theSurf.
11143 ## @ref swig_todo "Example"
11144 @ManageTransactions("MeasuOp")
11145 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
11147 Measure min radius of curvature of surface.
11150 theSurf the given surface.
11151 theUParam Value of U-parameter on the referenced surface.
11152 theVParam Value of V-parameter on the referenced surface.
11155 Min radius of curvature of theSurf.
11157 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
11158 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
11161 ## Measure min radius of curvature of surface in the given point
11162 # @param theSurf the given surface.
11163 # @param thePoint given point.
11164 # @return min radius of curvature of theSurf.
11166 ## @ref swig_todo "Example"
11167 @ManageTransactions("MeasuOp")
11168 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
11170 Measure min radius of curvature of surface in the given point.
11173 theSurf the given surface.
11174 thePoint given point.
11177 Min radius of curvature of theSurf.
11179 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
11180 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
11184 ## Measure curvature radius of surface in the given point along the given direction.
11185 # @param theSurf the given face.
11186 # @param thePoint given point.
11187 # @param theDirection given direction.
11188 # @param theName Object name; when specified, this parameter is used
11189 # for result publication in the study. Otherwise, if automatic
11190 # publication is switched on, default value is used for result name.
11192 # @return New GEOM.GEOM_Object, containing vector of curvature of theSurf.
11193 # The returned vector is codirectional with the normal to the face
11194 # in the given point in case of positive curvature value
11195 # and opposite to the normal in case of negative curvature.
11196 # The normal of the returned vector is equal to the
11197 # absolute value of the curvature radius.
11198 # Null shape is returned in case of infinite radius
11199 # (zero curvature), for example, in case of flat face.
11201 ## @ref swig_CurvatureOnFace "Example"
11202 @ManageTransactions("MeasuOp")
11203 def CurvatureOnFace(self, theSurf, thePoint, theDirection, theName=None):
11205 Measure curvature radius of surface in the given point along the given direction.
11208 theSurf the given face.
11209 thePoint given point.
11210 theDirection given direction.
11211 theName Object name; when specified, this parameter is used
11212 for result publication in the study. Otherwise, if automatic
11213 publication is switched on, default value is used for result name.
11216 New GEOM.GEOM_Object, containing vector of curvature of theSurf.
11217 The returned vector is codirectional with the normal to the face
11218 in the given point in case of positive curvature value
11219 and opposite to the normal in case of negative curvature.
11220 The normal of the returned vector is equal to the
11221 absolute value of the curvature radius.
11222 Null shape is returned in case of infinite radius
11223 (zero curvature), for example, in case of flat face.
11226 curvature_1 = geompy.CurvatureOnFace(Face_1, Vertex_1, OX)
11228 aVec = self.MeasuOp.SurfaceCurvatureByPointAndDirection(theSurf,thePoint,theDirection)
11229 if self.MeasuOp.GetErrorCode() != "ZERO_CURVATURE":
11230 RaiseIfFailed("CurvatureOnFace", self.MeasuOp)
11231 self._autoPublish(aVec, theName, "curvature")
11234 ## Get min and max tolerances of sub-shapes of theShape
11235 # @param theShape Shape, to get tolerances of.
11236 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]\n
11237 # FaceMin,FaceMax: Min and max tolerances of the faces.\n
11238 # EdgeMin,EdgeMax: Min and max tolerances of the edges.\n
11239 # VertMin,VertMax: Min and max tolerances of the vertices.
11241 # @ref tui_tolerance_page "Example"
11242 @ManageTransactions("MeasuOp")
11243 def Tolerance(self,theShape):
11245 Get min and max tolerances of sub-shapes of theShape
11248 theShape Shape, to get tolerances of.
11251 [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
11252 FaceMin,FaceMax: Min and max tolerances of the faces.
11253 EdgeMin,EdgeMax: Min and max tolerances of the edges.
11254 VertMin,VertMax: Min and max tolerances of the vertices.
11256 # Example: see GEOM_TestMeasures.py
11257 aTuple = self.MeasuOp.GetTolerance(theShape)
11258 RaiseIfFailed("GetTolerance", self.MeasuOp)
11261 ## Obtain description of the given shape (number of sub-shapes of each type)
11262 # @param theShape Shape to be described.
11263 # @return Description of the given shape.
11265 # @ref tui_whatis_page "Example"
11266 @ManageTransactions("MeasuOp")
11267 def WhatIs(self,theShape):
11269 Obtain description of the given shape (number of sub-shapes of each type)
11272 theShape Shape to be described.
11275 Description of the given shape.
11277 # Example: see GEOM_TestMeasures.py
11278 aDescr = self.MeasuOp.WhatIs(theShape)
11279 RaiseIfFailed("WhatIs", self.MeasuOp)
11282 ## Obtain quantity of shapes of the given type in \a theShape.
11283 # If \a theShape is of type \a theType, it is also counted.
11284 # @param theShape Shape to be described.
11285 # @param theType the given ShapeType().
11286 # @return Quantity of shapes of type \a theType in \a theShape.
11288 # @ref tui_measurement_tools_page "Example"
11289 def NbShapes (self, theShape, theType):
11291 Obtain quantity of shapes of the given type in theShape.
11292 If theShape is of type theType, it is also counted.
11295 theShape Shape to be described.
11296 theType the given geompy.ShapeType
11299 Quantity of shapes of type theType in theShape.
11301 # Example: see GEOM_TestMeasures.py
11302 listSh = self.SubShapeAllIDs(theShape, theType)
11306 ## Obtain quantity of shapes of each type in \a theShape.
11307 # The \a theShape is also counted.
11308 # @param theShape Shape to be described.
11309 # @return Dictionary of ShapeType() with bound quantities of shapes.
11311 # @ref tui_measurement_tools_page "Example"
11312 def ShapeInfo (self, theShape):
11314 Obtain quantity of shapes of each type in theShape.
11315 The theShape is also counted.
11318 theShape Shape to be described.
11321 Dictionary of geompy.ShapeType with bound quantities of shapes.
11323 # Example: see GEOM_TestMeasures.py
11325 for typeSh in self.ShapeType:
11326 if typeSh in ( "AUTO", "SHAPE" ): continue
11327 listSh = self.SubShapeAllIDs(theShape, self.ShapeType[typeSh])
11333 def GetCreationInformation(self, theShape):
11335 infos = theShape.GetCreationInformation()
11338 opName = info.operationName
11339 if not opName: opName = "no info available"
11340 if res: res += "\n"
11341 res += "Operation: " + opName
11343 for parVal in info.params:
11344 res += "\n \t%s = %s" % ( parVal.name, parVal.value )
11347 ## Get a point, situated at the centre of mass of theShape.
11348 # @param theShape Shape to define centre of mass of.
11349 # @param theName Object name; when specified, this parameter is used
11350 # for result publication in the study. Otherwise, if automatic
11351 # publication is switched on, default value is used for result name.
11353 # @return New GEOM.GEOM_Object, containing the created point.
11355 # @ref tui_center_of_mass_page "Example"
11356 @ManageTransactions("MeasuOp")
11357 def MakeCDG(self, theShape, theName=None):
11359 Get a point, situated at the centre of mass of theShape.
11362 theShape Shape to define centre of mass of.
11363 theName Object name; when specified, this parameter is used
11364 for result publication in the study. Otherwise, if automatic
11365 publication is switched on, default value is used for result name.
11368 New GEOM.GEOM_Object, containing the created point.
11370 # Example: see GEOM_TestMeasures.py
11371 anObj = self.MeasuOp.GetCentreOfMass(theShape)
11372 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
11373 self._autoPublish(anObj, theName, "centerOfMass")
11376 ## Get a vertex sub-shape by index.
11377 # @param theShape Shape to find sub-shape.
11378 # @param theIndex Index to find vertex by this index (starting from zero)
11379 # @param theUseOri To consider edge/wire orientation or not
11380 # @param theName Object name; when specified, this parameter is used
11381 # for result publication in the study. Otherwise, if automatic
11382 # publication is switched on, default value is used for result name.
11384 # @return New GEOM.GEOM_Object, containing the created vertex.
11386 # @ref tui_measurement_tools_page "Example"
11387 @ManageTransactions("MeasuOp")
11388 def GetVertexByIndex(self, theShape, theIndex, theUseOri=True, theName=None):
11390 Get a vertex sub-shape by index.
11393 theShape Shape to find sub-shape.
11394 theIndex Index to find vertex by this index (starting from zero)
11395 theUseOri To consider edge/wire orientation or not
11396 theName Object name; when specified, this parameter is used
11397 for result publication in the study. Otherwise, if automatic
11398 publication is switched on, default value is used for result name.
11401 New GEOM.GEOM_Object, containing the created vertex.
11403 # Example: see GEOM_TestMeasures.py
11404 if isinstance( theUseOri, str ): # theUseOri was inserted before theName
11405 theUseOri, theName = True, theUseOri
11406 anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex, theUseOri)
11407 RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
11408 self._autoPublish(anObj, theName, "vertex")
11411 ## Get the first vertex of wire/edge depended orientation.
11412 # @param theShape Shape to find first vertex.
11413 # @param theName Object name; when specified, this parameter is used
11414 # for result publication in the study. Otherwise, if automatic
11415 # publication is switched on, default value is used for result name.
11417 # @return New GEOM.GEOM_Object, containing the created vertex.
11419 # @ref tui_measurement_tools_page "Example"
11420 def GetFirstVertex(self, theShape, theName=None):
11422 Get the first vertex of wire/edge depended orientation.
11425 theShape Shape to find first vertex.
11426 theName Object name; when specified, this parameter is used
11427 for result publication in the study. Otherwise, if automatic
11428 publication is switched on, default value is used for result name.
11431 New GEOM.GEOM_Object, containing the created vertex.
11433 # Example: see GEOM_TestMeasures.py
11434 # note: auto-publishing is done in self.GetVertexByIndex()
11435 return self.GetVertexByIndex(theShape, 0, True, theName)
11437 ## Get the last vertex of wire/edge depended orientation.
11438 # @param theShape Shape to find last vertex.
11439 # @param theName Object name; when specified, this parameter is used
11440 # for result publication in the study. Otherwise, if automatic
11441 # publication is switched on, default value is used for result name.
11443 # @return New GEOM.GEOM_Object, containing the created vertex.
11445 # @ref tui_measurement_tools_page "Example"
11446 def GetLastVertex(self, theShape, theName=None):
11448 Get the last vertex of wire/edge depended orientation.
11451 theShape Shape to find last vertex.
11452 theName Object name; when specified, this parameter is used
11453 for result publication in the study. Otherwise, if automatic
11454 publication is switched on, default value is used for result name.
11457 New GEOM.GEOM_Object, containing the created vertex.
11459 # Example: see GEOM_TestMeasures.py
11460 nb_vert = self.NumberOfSubShapes(theShape, self.ShapeType["VERTEX"])
11461 # note: auto-publishing is done in self.GetVertexByIndex()
11462 return self.GetVertexByIndex(theShape, (nb_vert-1), True, theName)
11464 ## Get a normale to the given face. If the point is not given,
11465 # the normale is calculated at the center of mass.
11466 # @param theFace Face to define normale of.
11467 # @param theOptionalPoint Point to compute the normale at.
11468 # @param theName Object name; when specified, this parameter is used
11469 # for result publication in the study. Otherwise, if automatic
11470 # publication is switched on, default value is used for result name.
11472 # @return New GEOM.GEOM_Object, containing the created vector.
11474 # @ref swig_todo "Example"
11475 @ManageTransactions("MeasuOp")
11476 def GetNormal(self, theFace, theOptionalPoint = None, theName=None):
11478 Get a normale to the given face. If the point is not given,
11479 the normale is calculated at the center of mass.
11482 theFace Face to define normale of.
11483 theOptionalPoint Point to compute the normale at.
11484 theName Object name; when specified, this parameter is used
11485 for result publication in the study. Otherwise, if automatic
11486 publication is switched on, default value is used for result name.
11489 New GEOM.GEOM_Object, containing the created vector.
11491 # Example: see GEOM_TestMeasures.py
11492 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
11493 RaiseIfFailed("GetNormal", self.MeasuOp)
11494 self._autoPublish(anObj, theName, "normal")
11497 ## Print shape errors obtained from CheckShape.
11498 # @param theShape Shape that was checked.
11499 # @param theShapeErrors the shape errors obtained by CheckShape.
11500 # @param theReturnStatus If 0 the description of problem is printed.
11501 # If 1 the description of problem is returned.
11502 # @return If theReturnStatus is equal to 1 the description is returned.
11503 # Otherwise doesn't return anything.
11505 # @ref tui_check_shape_page "Example"
11506 @ManageTransactions("MeasuOp")
11507 def PrintShapeErrors(self, theShape, theShapeErrors, theReturnStatus = 0):
11509 Print shape errors obtained from CheckShape.
11512 theShape Shape that was checked.
11513 theShapeErrors the shape errors obtained by CheckShape.
11514 theReturnStatus If 0 the description of problem is printed.
11515 If 1 the description of problem is returned.
11518 If theReturnStatus is equal to 1 the description is returned.
11519 Otherwise doesn't return anything.
11521 # Example: see GEOM_TestMeasures.py
11522 Descr = self.MeasuOp.PrintShapeErrors(theShape, theShapeErrors)
11523 if theReturnStatus == 1:
11528 ## Check a topology of the given shape.
11529 # @param theShape Shape to check validity of.
11530 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked, \n
11531 # if TRUE, the shape's geometry will be checked also.
11532 # @param theReturnStatus If 0 and if theShape is invalid, a description
11533 # of problem is printed.
11534 # If 1 isValid flag and the description of
11535 # problem is returned.
11536 # If 2 isValid flag and the list of error data
11538 # @return TRUE, if the shape "seems to be valid".
11539 # If theShape is invalid, prints a description of problem.
11540 # If theReturnStatus is equal to 1 the description is returned
11541 # along with IsValid flag.
11542 # If theReturnStatus is equal to 2 the list of error data is
11543 # returned along with IsValid flag.
11545 # @ref tui_check_shape_page "Example"
11546 @ManageTransactions("MeasuOp")
11547 def CheckShape(self,theShape, theIsCheckGeom = 0, theReturnStatus = 0):
11549 Check a topology of the given shape.
11552 theShape Shape to check validity of.
11553 theIsCheckGeom If FALSE, only the shape's topology will be checked,
11554 if TRUE, the shape's geometry will be checked also.
11555 theReturnStatus If 0 and if theShape is invalid, a description
11556 of problem is printed.
11557 If 1 IsValid flag and the description of
11558 problem is returned.
11559 If 2 IsValid flag and the list of error data
11563 TRUE, if the shape "seems to be valid".
11564 If theShape is invalid, prints a description of problem.
11565 If theReturnStatus is equal to 1 the description is returned
11566 along with IsValid flag.
11567 If theReturnStatus is equal to 2 the list of error data is
11568 returned along with IsValid flag.
11570 # Example: see GEOM_TestMeasures.py
11572 (IsValid, ShapeErrors) = self.MeasuOp.CheckShapeWithGeometry(theShape)
11573 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
11575 (IsValid, ShapeErrors) = self.MeasuOp.CheckShape(theShape)
11576 RaiseIfFailed("CheckShape", self.MeasuOp)
11578 if theReturnStatus == 0:
11579 Descr = self.MeasuOp.PrintShapeErrors(theShape, ShapeErrors)
11581 if theReturnStatus == 1:
11582 Descr = self.MeasuOp.PrintShapeErrors(theShape, ShapeErrors)
11583 return (IsValid, Descr)
11584 elif theReturnStatus == 2:
11585 return (IsValid, ShapeErrors)
11588 ## Detect self-intersections in the given shape.
11589 # @param theShape Shape to check.
11590 # @param theCheckLevel is the level of self-intersection check.
11591 # Possible input values are:
11592 # - GEOM.SI_V_V(0) - only V/V interferences
11593 # - GEOM.SI_V_E(1) - V/V and V/E interferences
11594 # - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
11595 # - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
11596 # - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
11597 # - GEOM.SI_ALL(5) - all interferences.
11598 # @return TRUE, if the shape contains no self-intersections.
11600 # @ref tui_check_self_intersections_page "Example"
11601 @ManageTransactions("MeasuOp")
11602 def CheckSelfIntersections(self, theShape, theCheckLevel = GEOM.SI_ALL):
11604 Detect self-intersections in the given shape.
11607 theShape Shape to check.
11608 theCheckLevel is the level of self-intersection check.
11609 Possible input values are:
11610 - GEOM.SI_V_V(0) - only V/V interferences
11611 - GEOM.SI_V_E(1) - V/V and V/E interferences
11612 - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
11613 - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
11614 - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
11615 - GEOM.SI_ALL(5) - all interferences.
11618 TRUE, if the shape contains no self-intersections.
11620 # Example: see GEOM_TestMeasures.py
11621 (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape, EnumToLong(theCheckLevel))
11622 RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
11625 ## Detect self-intersections of the given shape with algorithm based on mesh intersections.
11626 # @param theShape Shape to check.
11627 # @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
11628 # - if \a theDeflection <= 0, default deflection 0.001 is used
11629 # @param theTolerance Specifies a distance between sub-shapes used for detecting gaps:
11630 # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
11631 # - if \a theTolerance > 0, algorithm detects gaps
11632 # @return TRUE, if the shape contains no self-intersections.
11634 # @ref tui_check_self_intersections_fast_page "Example"
11635 @ManageTransactions("MeasuOp")
11636 def CheckSelfIntersectionsFast(self, theShape, theDeflection = 0.001, theTolerance = 0.0):
11638 Detect self-intersections of the given shape with algorithm based on mesh intersections.
11641 theShape Shape to check.
11642 theDeflection Linear deflection coefficient that specifies quality of tessellation:
11643 - if theDeflection <= 0, default deflection 0.001 is used
11644 theTolerance Specifies a distance between shapes used for detecting gaps:
11645 - if theTolerance <= 0, algorithm detects intersections (default behavior)
11646 - if theTolerance > 0, algorithm detects gaps
11649 TRUE, if the shape contains no self-intersections.
11651 # Example: see GEOM_TestMeasures.py
11652 (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance)
11653 RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
11656 ## Check boolean and partition operations arguments.
11657 # @param theShape the argument of an operation to be checked
11658 # @return TRUE if the argument is valid for a boolean or partition
11659 # operation; FALSE otherwise.
11660 @ManageTransactions("MeasuOp")
11661 def CheckBOPArguments(self, theShape):
11663 Check boolean and partition operations arguments.
11666 theShape the argument of an operation to be checked
11669 TRUE if the argument is valid for a boolean or partition
11670 operation; FALSE otherwise.
11672 return self.MeasuOp.CheckBOPArguments(theShape)
11674 ## Detect intersections of the given shapes with algorithm based on mesh intersections.
11675 # @param theShape1 First source object
11676 # @param theShape2 Second source object
11677 # @param theTolerance Specifies a distance between shapes used for detecting gaps:
11678 # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
11679 # - if \a theTolerance > 0, algorithm detects gaps
11680 # @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
11681 # - if \a theDeflection <= 0, default deflection 0.001 is used
11682 # @return TRUE, if there are intersections (gaps) between source shapes
11683 # @return List of sub-shapes IDs from 1st shape that localize intersection.
11684 # @return List of sub-shapes IDs from 2nd shape that localize intersection.
11686 # @ref tui_fast_intersection_page "Example"
11687 @ManageTransactions("MeasuOp")
11688 def FastIntersect(self, theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001):
11690 Detect intersections of the given shapes with algorithm based on mesh intersections.
11693 theShape1 First source object
11694 theShape2 Second source object
11695 theTolerance Specifies a distance between shapes used for detecting gaps:
11696 - if theTolerance <= 0, algorithm detects intersections (default behavior)
11697 - if theTolerance > 0, algorithm detects gaps
11698 theDeflection Linear deflection coefficient that specifies quality of tessellation:
11699 - if theDeflection <= 0, default deflection 0.001 is used
11702 TRUE, if there are intersections (gaps) between source shapes
11703 List of sub-shapes IDs from 1st shape that localize intersection.
11704 List of sub-shapes IDs from 2nd shape that localize intersection.
11706 # Example: see GEOM_TestMeasures.py
11707 IsOk, Res1, Res2 = self.MeasuOp.FastIntersect(theShape1, theShape2, theTolerance, theDeflection)
11708 RaiseIfFailed("FastIntersect", self.MeasuOp)
11709 return IsOk, Res1, Res2
11711 ## Get position (LCS) of theShape.
11713 # Origin of the LCS is situated at the shape's center of mass.
11714 # Axes of the LCS are obtained from shape's location or,
11715 # if the shape is a planar face, from position of its plane.
11717 # @param theShape Shape to calculate position of.
11718 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
11719 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
11720 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
11721 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
11723 # @ref swig_todo "Example"
11724 @ManageTransactions("MeasuOp")
11725 def GetPosition(self,theShape):
11727 Get position (LCS) of theShape.
11728 Origin of the LCS is situated at the shape's center of mass.
11729 Axes of the LCS are obtained from shape's location or,
11730 if the shape is a planar face, from position of its plane.
11733 theShape Shape to calculate position of.
11736 [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
11737 Ox,Oy,Oz: Coordinates of shape's LCS origin.
11738 Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
11739 Xx,Xy,Xz: Coordinates of shape's LCS X direction.
11741 # Example: see GEOM_TestMeasures.py
11742 aTuple = self.MeasuOp.GetPosition(theShape)
11743 RaiseIfFailed("GetPosition", self.MeasuOp)
11746 ## Get kind of theShape.
11748 # @param theShape Shape to get a kind of.
11749 # @return Returns a kind of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
11750 # and a list of parameters, describing the shape.
11751 # @note Concrete meaning of each value, returned via \a theIntegers
11752 # or \a theDoubles list depends on the kind() of the shape.
11754 # @ref swig_todo "Example"
11755 @ManageTransactions("MeasuOp")
11756 def KindOfShape(self,theShape):
11758 Get kind of theShape.
11761 theShape Shape to get a kind of.
11764 a kind of shape in terms of GEOM_IKindOfShape.shape_kind enumeration
11765 and a list of parameters, describing the shape.
11767 Concrete meaning of each value, returned via theIntegers
11768 or theDoubles list depends on the geompy.kind of the shape
11770 # Example: see GEOM_TestMeasures.py
11771 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
11772 RaiseIfFailed("KindOfShape", self.MeasuOp)
11774 aKind = aRoughTuple[0]
11775 anInts = aRoughTuple[1]
11776 aDbls = aRoughTuple[2]
11778 # Now there is no exception from this rule:
11779 aKindTuple = [aKind] + aDbls + anInts
11781 # If they are we will regroup parameters for such kind of shape.
11783 #if aKind == kind.SOME_KIND:
11784 # # SOME_KIND int int double int double double
11785 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
11789 ## The function takes a single face with holes and returns a list of faces,
11790 # first of them is the original face without holes, and the other faces are placed
11791 # on the same surface as the original face but bounded by each hole wire.
11792 # If the original face has no holes, it will be returned as an output
11793 # @param theShape Face to perform operation on.
11795 # @return GEOM.ListOfGO, list created faces, where first of them is the original face without holes
11796 @ManageTransactions("MeasuOp")
11797 def PatchFace(self, theShape):
11799 The function takes a single face with holes and returns a list of faces,
11800 first of them is the original face without holes, and the other faces are placed
11801 on the same surface as the original face but bounded by each hole wire.
11802 If the original face has no holes, it will be returned as an output
11805 theShape Face to perform operation on.
11808 GEOM.ListOfGO, list created faces, where first of them is the original face without holes
11811 Circle_1 = geompy.MakeCircle(None, None, 190)
11812 Circle_2 = geompy.MakeCircle(None, None, 100)
11813 Face_1 = geompy.MakeFaceWires([Circle_1], 1)
11814 Face_2 = geompy.MakeFaceWires([Circle_2], 1)
11815 Cut_1 = geompy.MakeCutList(Face_1, [Face_2], True)
11816 faces = geompy.PatchFace(Cut_1)
11818 aList = self.MeasuOp.PatchFace(theShape)
11819 RaiseIfFailed("PatchFace", self.MeasuOp)
11822 ## Returns the string that describes if the shell is good for solid.
11823 # This is a support method for MakeSolid.
11825 # @param theShell the shell to be checked.
11826 # @return Returns a string that describes the shell validity for
11827 # solid construction.
11828 @ManageTransactions("MeasuOp")
11829 def _IsGoodForSolid(self, theShell):
11831 Returns the string that describes if the shell is good for solid.
11832 This is a support method for MakeSolid.
11835 theShell the shell to be checked.
11838 Returns a string that describes the shell validity for
11839 solid construction.
11841 aDescr = self.MeasuOp.IsGoodForSolid(theShell)
11844 ## Obtain a canonical recognition interface.
11845 # @return An instance of
11846 # @ref canonicalrecognition.CanonicalRecognition "CanonicalRecognition" interface
11848 # @ref tui_3dsketcher_page "Example"
11849 def CanonicalRecognition (self):
11851 Obtain a canonical recognition interface.
11854 cr = geompy.CanonicalRecognition()
11855 cr.isLine(aLine, tolerance)
11857 cr = CanonicalRecognition (self)
11860 # end of l2_measure
11863 ## @addtogroup l2_import_export
11866 ## Import a shape from the BREP, IGES, STEP or other file
11867 # (depends on given format) with given name.
11869 # Note: this function is deprecated, it is kept for backward compatibility only
11870 # Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
11872 # @param theFileName The file, containing the shape.
11873 # @param theFormatName Specify format for the file reading.
11874 # Available formats can be obtained with InsertOp.ImportTranslators() method.
11875 # If format 'IGES_SCALE' is used instead of 'IGES' or
11876 # format 'STEP_SCALE' is used instead of 'STEP',
11877 # length unit will be set to 'meter' and result model will be scaled.
11878 # @param theName Object name; when specified, this parameter is used
11879 # for result publication in the study. Otherwise, if automatic
11880 # publication is switched on, default value is used for result name.
11882 # @return New GEOM.GEOM_Object, containing the imported shape.
11883 # If material names are imported it returns the list of
11884 # objects. The first one is the imported object followed by
11886 # @note Auto publishing is allowed for the shape itself. Imported
11887 # material groups are not automatically published.
11889 # @ref swig_Import_Export "Example"
11890 @ManageTransactions("InsertOp")
11891 def ImportFile(self, theFileName, theFormatName, theName=None):
11893 Import a shape from the BREP, IGES, STEP or other file
11894 (depends on given format) with given name.
11896 Note: this function is deprecated, it is kept for backward compatibility only
11897 Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
11900 theFileName The file, containing the shape.
11901 theFormatName Specify format for the file reading.
11902 Available formats can be obtained with geompy.InsertOp.ImportTranslators() method.
11903 If format 'IGES_SCALE' is used instead of 'IGES' or
11904 format 'STEP_SCALE' is used instead of 'STEP',
11905 length unit will be set to 'meter' and result model will be scaled.
11906 theName Object name; when specified, this parameter is used
11907 for result publication in the study. Otherwise, if automatic
11908 publication is switched on, default value is used for result name.
11911 New GEOM.GEOM_Object, containing the imported shape.
11912 If material names are imported it returns the list of
11913 objects. The first one is the imported object followed by
11916 Auto publishing is allowed for the shape itself. Imported
11917 material groups are not automatically published.
11919 # Example: see GEOM_TestOthers.py
11921 WARNING: Function ImportFile is deprecated, use Import<FormatName> instead,
11922 where <FormatName> is a name of desirable format for importing.
11924 aListObj = self.InsertOp.ImportFile(theFileName, theFormatName)
11925 RaiseIfFailed("ImportFile", self.InsertOp)
11926 aNbObj = len(aListObj)
11928 self._autoPublish(aListObj[0], theName, "imported")
11933 ## Deprecated analog of ImportFile()
11934 def Import(self, theFileName, theFormatName, theName=None):
11936 Deprecated analog of geompy.ImportFile, kept for backward compatibility only.
11938 # note: auto-publishing is done in self.ImportFile()
11939 return self.ImportFile(theFileName, theFormatName, theName)
11941 ## Read a shape from the binary stream, containing its bounding representation (BRep).
11943 # @note As the byte-stream representing the shape data can be quite large, this method
11944 # is not automatically dumped to the Python script with the DumpStudy functionality;
11945 # so please use this method carefully, only for strong reasons.
11947 # @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's
11950 # @param theStream The BRep binary stream.
11951 # @param theName Object name; when specified, this parameter is used
11952 # for result publication in the study. Otherwise, if automatic
11953 # publication is switched on, default value is used for result name.
11955 # @return New GEOM_Object, containing the shape, read from theStream.
11957 # @ref swig_Import_Export "Example"
11958 @ManageTransactions("InsertOp")
11959 def RestoreShape (self, theStream, theName=None):
11961 Read a shape from the binary stream, containing its bounding representation (BRep).
11964 shape.GetShapeStream() method can be used to obtain the shape's BRep stream.
11967 theStream The BRep binary stream.
11968 theName Object name; when specified, this parameter is used
11969 for result publication in the study. Otherwise, if automatic
11970 publication is switched on, default value is used for result name.
11973 New GEOM_Object, containing the shape, read from theStream.
11975 # Example: see GEOM_TestOthers.py
11977 # this is the workaround to ignore invalid case when data stream is empty
11978 if int(os.getenv("GEOM_IGNORE_RESTORE_SHAPE", "0")) > 0:
11979 print("WARNING: Result of RestoreShape is a NULL shape!")
11981 anObj = self.InsertOp.RestoreShape(theStream)
11982 RaiseIfFailed("RestoreShape", self.InsertOp)
11983 self._autoPublish(anObj, theName, "restored")
11986 ## Export the given shape into a file with given name.
11988 # Note: this function is deprecated, it is kept for backward compatibility only
11989 # Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
11991 # @param theObject Shape to be stored in the file.
11992 # @param theFileName Name of the file to store the given shape in.
11993 # @param theFormatName Specify format for the shape storage.
11994 # Available formats can be obtained with
11995 # geompy.InsertOp.ExportTranslators()[0] method.
11997 # @ref swig_Import_Export "Example"
11998 @ManageTransactions("InsertOp")
11999 def Export(self, theObject, theFileName, theFormatName):
12001 Export the given shape into a file with given name.
12003 Note: this function is deprecated, it is kept for backward compatibility only
12004 Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
12007 theObject Shape to be stored in the file.
12008 theFileName Name of the file to store the given shape in.
12009 theFormatName Specify format for the shape storage.
12010 Available formats can be obtained with
12011 geompy.InsertOp.ExportTranslators()[0] method.
12013 # Example: see GEOM_TestOthers.py
12015 WARNING: Function Export is deprecated, use Export<FormatName> instead,
12016 where <FormatName> is a name of desirable format for exporting.
12018 self.InsertOp.Export(theObject, theFileName, theFormatName)
12019 if self.InsertOp.IsDone() == 0:
12020 raise RuntimeError("Export : " + self.InsertOp.GetErrorCode())
12024 # end of l2_import_export
12027 ## @addtogroup l3_blocks
12030 ## Create a quadrangle face from four edges. Order of Edges is not
12031 # important. It is not necessary that edges share the same vertex.
12032 # @param E1,E2,E3,E4 Edges for the face bound.
12033 # @param theName Object name; when specified, this parameter is used
12034 # for result publication in the study. Otherwise, if automatic
12035 # publication is switched on, default value is used for result name.
12037 # @return New GEOM.GEOM_Object, containing the created face.
12039 # @ref tui_building_by_blocks_page "Example"
12040 @ManageTransactions("BlocksOp")
12041 def MakeQuad(self, E1, E2, E3, E4, theName=None):
12043 Create a quadrangle face from four edges. Order of Edges is not
12044 important. It is not necessary that edges share the same vertex.
12047 E1,E2,E3,E4 Edges for the face bound.
12048 theName Object name; when specified, this parameter is used
12049 for result publication in the study. Otherwise, if automatic
12050 publication is switched on, default value is used for result name.
12053 New GEOM.GEOM_Object, containing the created face.
12056 qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
12058 # Example: see GEOM_Spanner.py
12059 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
12060 RaiseIfFailed("MakeQuad", self.BlocksOp)
12061 self._autoPublish(anObj, theName, "quad")
12064 ## Create a quadrangle face on two edges.
12065 # The missing edges will be built by creating the shortest ones.
12066 # @param E1,E2 Two opposite edges for the face.
12067 # @param theName Object name; when specified, this parameter is used
12068 # for result publication in the study. Otherwise, if automatic
12069 # publication is switched on, default value is used for result name.
12071 # @return New GEOM.GEOM_Object, containing the created face.
12073 # @ref tui_building_by_blocks_page "Example"
12074 @ManageTransactions("BlocksOp")
12075 def MakeQuad2Edges(self, E1, E2, theName=None):
12077 Create a quadrangle face on two edges.
12078 The missing edges will be built by creating the shortest ones.
12081 E1,E2 Two opposite edges for the face.
12082 theName Object name; when specified, this parameter is used
12083 for result publication in the study. Otherwise, if automatic
12084 publication is switched on, default value is used for result name.
12087 New GEOM.GEOM_Object, containing the created face.
12091 p1 = geompy.MakeVertex( 0., 0., 0.)
12092 p2 = geompy.MakeVertex(150., 30., 0.)
12093 p3 = geompy.MakeVertex( 0., 120., 50.)
12094 p4 = geompy.MakeVertex( 0., 40., 70.)
12096 edge1 = geompy.MakeEdge(p1, p2)
12097 edge2 = geompy.MakeEdge(p3, p4)
12098 # create a quadrangle face from two edges
12099 qface2 = geompy.MakeQuad2Edges(edge1, edge2)
12101 # Example: see GEOM_Spanner.py
12102 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
12103 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
12104 self._autoPublish(anObj, theName, "quad")
12107 ## Create a quadrangle face with specified corners.
12108 # The missing edges will be built by creating the shortest ones.
12109 # @param V1,V2,V3,V4 Corner vertices for the face.
12110 # @param theName Object name; when specified, this parameter is used
12111 # for result publication in the study. Otherwise, if automatic
12112 # publication is switched on, default value is used for result name.
12114 # @return New GEOM.GEOM_Object, containing the created face.
12116 # @ref tui_building_by_blocks_page "Example 1"
12117 # \n @ref swig_MakeQuad4Vertices "Example 2"
12118 @ManageTransactions("BlocksOp")
12119 def MakeQuad4Vertices(self, V1, V2, V3, V4, theName=None):
12121 Create a quadrangle face with specified corners.
12122 The missing edges will be built by creating the shortest ones.
12125 V1,V2,V3,V4 Corner vertices for the face.
12126 theName Object name; when specified, this parameter is used
12127 for result publication in the study. Otherwise, if automatic
12128 publication is switched on, default value is used for result name.
12131 New GEOM.GEOM_Object, containing the created face.
12135 p1 = geompy.MakeVertex( 0., 0., 0.)
12136 p2 = geompy.MakeVertex(150., 30., 0.)
12137 p3 = geompy.MakeVertex( 0., 120., 50.)
12138 p4 = geompy.MakeVertex( 0., 40., 70.)
12139 # create a quadrangle from four points in its corners
12140 qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
12142 # Example: see GEOM_Spanner.py
12143 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
12144 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
12145 self._autoPublish(anObj, theName, "quad")
12148 ## Create a hexahedral solid, bounded by the six given faces. Order of
12149 # faces is not important. It is not necessary that Faces share the same edge.
12150 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
12151 # @param theName Object name; when specified, this parameter is used
12152 # for result publication in the study. Otherwise, if automatic
12153 # publication is switched on, default value is used for result name.
12155 # @return New GEOM.GEOM_Object, containing the created solid.
12157 # @ref tui_building_by_blocks_page "Example 1"
12158 # \n @ref swig_MakeHexa "Example 2"
12159 @ManageTransactions("BlocksOp")
12160 def MakeHexa(self, F1, F2, F3, F4, F5, F6, theName=None):
12162 Create a hexahedral solid, bounded by the six given faces. Order of
12163 faces is not important. It is not necessary that Faces share the same edge.
12166 F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
12167 theName Object name; when specified, this parameter is used
12168 for result publication in the study. Otherwise, if automatic
12169 publication is switched on, default value is used for result name.
12172 New GEOM.GEOM_Object, containing the created solid.
12175 solid = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
12177 # Example: see GEOM_Spanner.py
12178 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
12179 RaiseIfFailed("MakeHexa", self.BlocksOp)
12180 self._autoPublish(anObj, theName, "hexa")
12183 ## Create a hexahedral solid between two given faces.
12184 # The missing faces will be built by creating the smallest ones.
12185 # @param F1,F2 Two opposite faces for the hexahedral solid.
12186 # @param theName Object name; when specified, this parameter is used
12187 # for result publication in the study. Otherwise, if automatic
12188 # publication is switched on, default value is used for result name.
12190 # @return New GEOM.GEOM_Object, containing the created solid.
12192 # @ref tui_building_by_blocks_page "Example 1"
12193 # \n @ref swig_MakeHexa2Faces "Example 2"
12194 @ManageTransactions("BlocksOp")
12195 def MakeHexa2Faces(self, F1, F2, theName=None):
12197 Create a hexahedral solid between two given faces.
12198 The missing faces will be built by creating the smallest ones.
12201 F1,F2 Two opposite faces for the hexahedral solid.
12202 theName Object name; when specified, this parameter is used
12203 for result publication in the study. Otherwise, if automatic
12204 publication is switched on, default value is used for result name.
12207 New GEOM.GEOM_Object, containing the created solid.
12210 solid1 = geompy.MakeHexa2Faces(qface1, qface2)
12212 # Example: see GEOM_Spanner.py
12213 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
12214 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
12215 self._autoPublish(anObj, theName, "hexa")
12221 ## @addtogroup l3_blocks_op
12224 ## Get a vertex, found in the given shape by its coordinates.
12225 # @param theShape Block or a compound of blocks.
12226 # @param theX,theY,theZ Coordinates of the sought vertex.
12227 # @param theEpsilon Maximum allowed distance between the resulting
12228 # vertex and point with the given coordinates.
12229 # @param theName Object name; when specified, this parameter is used
12230 # for result publication in the study. Otherwise, if automatic
12231 # publication is switched on, default value is used for result name.
12233 # @return New GEOM.GEOM_Object, containing the found vertex.
12235 # @ref swig_GetPoint "Example"
12236 @ManageTransactions("BlocksOp")
12237 def GetPoint(self, theShape, theX, theY, theZ, theEpsilon, theName=None):
12239 Get a vertex, found in the given shape by its coordinates.
12242 theShape Block or a compound of blocks.
12243 theX,theY,theZ Coordinates of the sought vertex.
12244 theEpsilon Maximum allowed distance between the resulting
12245 vertex and point with the given coordinates.
12246 theName Object name; when specified, this parameter is used
12247 for result publication in the study. Otherwise, if automatic
12248 publication is switched on, default value is used for result name.
12251 New GEOM.GEOM_Object, containing the found vertex.
12254 pnt = geompy.GetPoint(shape, -50, 50, 50, 0.01)
12256 # Example: see GEOM_TestOthers.py
12257 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
12258 RaiseIfFailed("GetPoint", self.BlocksOp)
12259 self._autoPublish(anObj, theName, "vertex")
12262 ## Find a vertex of the given shape, which has minimal distance to the given point.
12263 # @param theShape Any shape.
12264 # @param thePoint Point, close to the desired vertex.
12265 # @param theName Object name; when specified, this parameter is used
12266 # for result publication in the study. Otherwise, if automatic
12267 # publication is switched on, default value is used for result name.
12269 # @return New GEOM.GEOM_Object, containing the found vertex.
12271 # @ref swig_GetVertexNearPoint "Example"
12272 @ManageTransactions("BlocksOp")
12273 def GetVertexNearPoint(self, theShape, thePoint, theName=None):
12275 Find a vertex of the given shape, which has minimal distance to the given point.
12278 theShape Any shape.
12279 thePoint Point, close to the desired vertex.
12280 theName Object name; when specified, this parameter is used
12281 for result publication in the study. Otherwise, if automatic
12282 publication is switched on, default value is used for result name.
12285 New GEOM.GEOM_Object, containing the found vertex.
12288 pmidle = geompy.MakeVertex(50, 0, 50)
12289 edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
12291 # Example: see GEOM_TestOthers.py
12292 anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
12293 RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
12294 self._autoPublish(anObj, theName, "vertex")
12297 ## Get an edge, found in the given shape by two given vertices.
12298 # @param theShape Block or a compound of blocks.
12299 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
12300 # @param theName Object name; when specified, this parameter is used
12301 # for result publication in the study. Otherwise, if automatic
12302 # publication is switched on, default value is used for result name.
12304 # @return New GEOM.GEOM_Object, containing the found edge.
12306 # @ref swig_GetEdge "Example"
12307 @ManageTransactions("BlocksOp")
12308 def GetEdge(self, theShape, thePoint1, thePoint2, theName=None):
12310 Get an edge, found in the given shape by two given vertices.
12313 theShape Block or a compound of blocks.
12314 thePoint1,thePoint2 Points, close to the ends of the desired edge.
12315 theName Object name; when specified, this parameter is used
12316 for result publication in the study. Otherwise, if automatic
12317 publication is switched on, default value is used for result name.
12320 New GEOM.GEOM_Object, containing the found edge.
12322 # Example: see GEOM_Spanner.py
12323 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
12324 RaiseIfFailed("GetEdge", self.BlocksOp)
12325 self._autoPublish(anObj, theName, "edge")
12328 ## Find an edge of the given shape, which has minimal distance to the given point.
12329 # @param theShape Block or a compound of blocks.
12330 # @param thePoint Point, close to the desired edge.
12331 # @param theName Object name; when specified, this parameter is used
12332 # for result publication in the study. Otherwise, if automatic
12333 # publication is switched on, default value is used for result name.
12335 # @return New GEOM.GEOM_Object, containing the found edge.
12337 # @ref swig_GetEdgeNearPoint "Example"
12338 @ManageTransactions("BlocksOp")
12339 def GetEdgeNearPoint(self, theShape, thePoint, theName=None):
12341 Find an edge of the given shape, which has minimal distance to the given point.
12344 theShape Block or a compound of blocks.
12345 thePoint Point, close to the desired edge.
12346 theName Object name; when specified, this parameter is used
12347 for result publication in the study. Otherwise, if automatic
12348 publication is switched on, default value is used for result name.
12351 New GEOM.GEOM_Object, containing the found edge.
12353 # Example: see GEOM_TestOthers.py
12354 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
12355 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
12356 self._autoPublish(anObj, theName, "edge")
12359 ## Returns a face, found in the given shape by four given corner vertices.
12360 # @param theShape Block or a compound of blocks.
12361 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
12362 # @param theName Object name; when specified, this parameter is used
12363 # for result publication in the study. Otherwise, if automatic
12364 # publication is switched on, default value is used for result name.
12366 # @return New GEOM.GEOM_Object, containing the found face.
12368 # @ref swig_todo "Example"
12369 @ManageTransactions("BlocksOp")
12370 def GetFaceByPoints(self, theShape, thePoint1, thePoint2, thePoint3, thePoint4, theName=None):
12372 Returns a face, found in the given shape by four given corner vertices.
12375 theShape Block or a compound of blocks.
12376 thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
12377 theName Object name; when specified, this parameter is used
12378 for result publication in the study. Otherwise, if automatic
12379 publication is switched on, default value is used for result name.
12382 New GEOM.GEOM_Object, containing the found face.
12384 # Example: see GEOM_Spanner.py
12385 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
12386 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
12387 self._autoPublish(anObj, theName, "face")
12390 ## Get a face of block, found in the given shape by two given edges.
12391 # @param theShape Block or a compound of blocks.
12392 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
12393 # @param theName Object name; when specified, this parameter is used
12394 # for result publication in the study. Otherwise, if automatic
12395 # publication is switched on, default value is used for result name.
12397 # @return New GEOM.GEOM_Object, containing the found face.
12399 # @ref swig_todo "Example"
12400 @ManageTransactions("BlocksOp")
12401 def GetFaceByEdges(self, theShape, theEdge1, theEdge2, theName=None):
12403 Get a face of block, found in the given shape by two given edges.
12406 theShape Block or a compound of blocks.
12407 theEdge1,theEdge2 Edges, close to the edges of the desired face.
12408 theName Object name; when specified, this parameter is used
12409 for result publication in the study. Otherwise, if automatic
12410 publication is switched on, default value is used for result name.
12413 New GEOM.GEOM_Object, containing the found face.
12415 # Example: see GEOM_Spanner.py
12416 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
12417 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
12418 self._autoPublish(anObj, theName, "face")
12421 ## Find a face, opposite to the given one in the given block.
12422 # @param theBlock Must be a hexahedral solid.
12423 # @param theFace Face of \a theBlock, opposite to the desired face.
12424 # @param theName Object name; when specified, this parameter is used
12425 # for result publication in the study. Otherwise, if automatic
12426 # publication is switched on, default value is used for result name.
12428 # @return New GEOM.GEOM_Object, containing the found face.
12430 # @ref swig_GetOppositeFace "Example"
12431 @ManageTransactions("BlocksOp")
12432 def GetOppositeFace(self, theBlock, theFace, theName=None):
12434 Find a face, opposite to the given one in the given block.
12437 theBlock Must be a hexahedral solid.
12438 theFace Face of theBlock, opposite to the desired face.
12439 theName Object name; when specified, this parameter is used
12440 for result publication in the study. Otherwise, if automatic
12441 publication is switched on, default value is used for result name.
12444 New GEOM.GEOM_Object, containing the found face.
12446 # Example: see GEOM_Spanner.py
12447 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
12448 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
12449 self._autoPublish(anObj, theName, "face")
12452 ## Find a face of the given shape, which has minimal distance to the given point.
12453 # @param theShape Block or a compound of blocks.
12454 # @param thePoint Point, close to the desired face.
12455 # @param theName Object name; when specified, this parameter is used
12456 # for result publication in the study. Otherwise, if automatic
12457 # publication is switched on, default value is used for result name.
12459 # @return New GEOM.GEOM_Object, containing the found face.
12461 # @ref swig_GetFaceNearPoint "Example"
12462 @ManageTransactions("BlocksOp")
12463 def GetFaceNearPoint(self, theShape, thePoint, theName=None):
12465 Find a face of the given shape, which has minimal distance to the given point.
12468 theShape Block or a compound of blocks.
12469 thePoint Point, close to the desired face.
12470 theName Object name; when specified, this parameter is used
12471 for result publication in the study. Otherwise, if automatic
12472 publication is switched on, default value is used for result name.
12475 New GEOM.GEOM_Object, containing the found face.
12477 # Example: see GEOM_Spanner.py
12478 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
12479 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
12480 self._autoPublish(anObj, theName, "face")
12483 ## Find a face of block, whose outside normale has minimal angle with the given vector.
12484 # @param theBlock Block or a compound of blocks.
12485 # @param theVector Vector, close to the normale of the desired face.
12486 # @param theName Object name; when specified, this parameter is used
12487 # for result publication in the study. Otherwise, if automatic
12488 # publication is switched on, default value is used for result name.
12490 # @return New GEOM.GEOM_Object, containing the found face.
12492 # @ref swig_todo "Example"
12493 @ManageTransactions("BlocksOp")
12494 def GetFaceByNormale(self, theBlock, theVector, theName=None):
12496 Find a face of block, whose outside normale has minimal angle with the given vector.
12499 theBlock Block or a compound of blocks.
12500 theVector Vector, close to the normale of the desired face.
12501 theName Object name; when specified, this parameter is used
12502 for result publication in the study. Otherwise, if automatic
12503 publication is switched on, default value is used for result name.
12506 New GEOM.GEOM_Object, containing the found face.
12508 # Example: see GEOM_Spanner.py
12509 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
12510 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
12511 self._autoPublish(anObj, theName, "face")
12514 ## Find all sub-shapes of type \a theShapeType of the given shape,
12515 # which have minimal distance to the given point.
12516 # @param theShape Any shape.
12517 # @param thePoint Point, close to the desired shape.
12518 # @param theShapeType Defines what kind of sub-shapes is searched GEOM::shape_type
12519 # @param theTolerance The tolerance for distances comparison. All shapes
12520 # with distances to the given point in interval
12521 # [minimal_distance, minimal_distance + theTolerance] will be gathered.
12522 # @param theName Object name; when specified, this parameter is used
12523 # for result publication in the study. Otherwise, if automatic
12524 # publication is switched on, default value is used for result name.
12526 # @return New GEOM_Object, containing a group of all found shapes.
12528 # @ref swig_GetShapesNearPoint "Example"
12529 @ManageTransactions("BlocksOp")
12530 def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07, theName=None):
12532 Find all sub-shapes of type theShapeType of the given shape,
12533 which have minimal distance to the given point.
12536 theShape Any shape.
12537 thePoint Point, close to the desired shape.
12538 theShapeType Defines what kind of sub-shapes is searched (see GEOM::shape_type)
12539 theTolerance The tolerance for distances comparison. All shapes
12540 with distances to the given point in interval
12541 [minimal_distance, minimal_distance + theTolerance] will be gathered.
12542 theName Object name; when specified, this parameter is used
12543 for result publication in the study. Otherwise, if automatic
12544 publication is switched on, default value is used for result name.
12547 New GEOM_Object, containing a group of all found shapes.
12549 # Example: see GEOM_TestOthers.py
12550 anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
12551 RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
12552 self._autoPublish(anObj, theName, "group")
12555 # end of l3_blocks_op
12558 ## @addtogroup l4_blocks_measure
12561 ## Check, if the compound of blocks is given.
12562 # To be considered as a compound of blocks, the
12563 # given shape must satisfy the following conditions:
12564 # - Each element of the compound should be a Block (6 faces).
12565 # - Each face should be a quadrangle, i.e. it should have only 1 wire
12566 # with 4 edges. If <VAR>theIsUseC1</VAR> is set to True and
12567 # there are more than 4 edges in the only wire of a face,
12568 # this face is considered to be quadrangle if it has 4 bounds
12569 # (1 or more edge) of C1 continuity.
12570 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
12571 # - The compound should be connexe.
12572 # - The glue between two quadrangle faces should be applied.
12573 # @param theCompound The compound to check.
12574 # @param theIsUseC1 Flag to check if there are 4 bounds on a face
12575 # taking into account C1 continuity.
12576 # @param theAngTolerance the angular tolerance to check if two neighbor
12577 # edges are codirectional in the common vertex with this
12578 # tolerance. This parameter is used only if
12579 # <VAR>theIsUseC1</VAR> is set to True.
12580 # @return TRUE, if the given shape is a compound of blocks.
12581 # If theCompound is not valid, prints all discovered errors.
12583 # @ref tui_check_compound_of_blocks_page "Example 1"
12584 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
12585 @ManageTransactions("BlocksOp")
12586 def CheckCompoundOfBlocks(self,theCompound, theIsUseC1 = False,
12587 theAngTolerance = 1.e-12):
12589 Check, if the compound of blocks is given.
12590 To be considered as a compound of blocks, the
12591 given shape must satisfy the following conditions:
12592 - Each element of the compound should be a Block (6 faces).
12593 - Each face should be a quadrangle, i.e. it should have only 1 wire
12594 with 4 edges. If theIsUseC1 is set to True and
12595 there are more than 4 edges in the only wire of a face,
12596 this face is considered to be quadrangle if it has 4 bounds
12597 (1 or more edge) of C1 continuity.
12598 - A connection between two Blocks should be an entire quadrangle face or an entire edge.
12599 - The compound should be connexe.
12600 - The glue between two quadrangle faces should be applied.
12603 theCompound The compound to check.
12604 theIsUseC1 Flag to check if there are 4 bounds on a face
12605 taking into account C1 continuity.
12606 theAngTolerance the angular tolerance to check if two neighbor
12607 edges are codirectional in the common vertex with this
12608 tolerance. This parameter is used only if
12609 theIsUseC1 is set to True.
12612 TRUE, if the given shape is a compound of blocks.
12613 If theCompound is not valid, prints all discovered errors.
12615 # Example: see GEOM_Spanner.py
12618 aTolerance = theAngTolerance
12619 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound, aTolerance)
12620 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
12622 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
12626 ## Retrieve all non blocks solids and faces from \a theShape.
12627 # @param theShape The shape to explore.
12628 # @param theIsUseC1 Flag to check if there are 4 bounds on a face
12629 # taking into account C1 continuity.
12630 # @param theAngTolerance the angular tolerance to check if two neighbor
12631 # edges are codirectional in the common vertex with this
12632 # tolerance. This parameter is used only if
12633 # <VAR>theIsUseC1</VAR> is set to True.
12634 # @param theName Object name; when specified, this parameter is used
12635 # for result publication in the study. Otherwise, if automatic
12636 # publication is switched on, default value is used for result name.
12638 # @return A tuple of two GEOM_Objects. The first object is a group of all
12639 # non block solids (= not 6 faces, or with 6 faces, but with the
12640 # presence of non-quadrangular faces). The second object is a
12641 # group of all non quadrangular faces (= faces with more then
12642 # 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
12643 # with 1 wire with not 4 edges that do not form 4 bounds of
12646 # @ref tui_get_non_blocks_page "Example 1"
12647 # \n @ref swig_GetNonBlocks "Example 2"
12648 @ManageTransactions("BlocksOp")
12649 def GetNonBlocks (self, theShape, theIsUseC1 = False,
12650 theAngTolerance = 1.e-12, theName=None):
12652 Retrieve all non blocks solids and faces from theShape.
12655 theShape The shape to explore.
12656 theIsUseC1 Flag to check if there are 4 bounds on a face
12657 taking into account C1 continuity.
12658 theAngTolerance the angular tolerance to check if two neighbor
12659 edges are codirectional in the common vertex with this
12660 tolerance. This parameter is used only if
12661 theIsUseC1 is set to True.
12662 theName Object name; when specified, this parameter is used
12663 for result publication in the study. Otherwise, if automatic
12664 publication is switched on, default value is used for result name.
12667 A tuple of two GEOM_Objects. The first object is a group of all
12668 non block solids (= not 6 faces, or with 6 faces, but with the
12669 presence of non-quadrangular faces). The second object is a
12670 group of all non quadrangular faces (= faces with more then
12671 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
12672 with 1 wire with not 4 edges that do not form 4 bounds of
12676 (res_sols, res_faces) = geompy.GetNonBlocks(myShape1)
12678 # Example: see GEOM_Spanner.py
12681 aTolerance = theAngTolerance
12682 aTuple = self.BlocksOp.GetNonBlocks(theShape, aTolerance)
12683 RaiseIfFailed("GetNonBlocks", self.BlocksOp)
12684 self._autoPublish(aTuple, theName, ("groupNonHexas", "groupNonQuads"))
12687 ## Remove all seam and degenerated edges from \a theShape.
12688 # Unite faces and edges, sharing one surface. It means that
12689 # this faces must have references to one C++ surface object (handle).
12690 # @param theShape The compound or single solid to remove irregular edges from.
12691 # @param doUnionFaces If True, then unite faces. If False (the default value),
12692 # do not unite faces.
12693 # @param theName Object name; when specified, this parameter is used
12694 # for result publication in the study. Otherwise, if automatic
12695 # publication is switched on, default value is used for result name.
12697 # @return Improved shape.
12699 # @ref swig_RemoveExtraEdges "Example"
12700 @ManageTransactions("BlocksOp")
12701 def RemoveExtraEdges(self, theShape, doUnionFaces=False, theName=None):
12703 Remove all seam and degenerated edges from theShape.
12704 Unite faces and edges, sharing one surface. It means that
12705 this faces must have references to one C++ surface object (handle).
12708 theShape The compound or single solid to remove irregular edges from.
12709 doUnionFaces If True, then unite faces. If False (the default value),
12710 do not unite faces.
12711 theName Object name; when specified, this parameter is used
12712 for result publication in the study. Otherwise, if automatic
12713 publication is switched on, default value is used for result name.
12718 # Example: see GEOM_TestOthers.py
12719 nbFacesOptimum = -1 # -1 means do not unite faces
12720 if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
12721 anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
12722 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
12723 self._autoPublish(anObj, theName, "removeExtraEdges")
12726 ## Performs union faces of \a theShape
12727 # Unite faces sharing one surface. It means that
12728 # these faces must have references to one C++ surface object (handle).
12729 # @param theShape The compound or single solid that contains faces
12730 # to perform union.
12731 # @param theName Object name; when specified, this parameter is used
12732 # for result publication in the study. Otherwise, if automatic
12733 # publication is switched on, default value is used for result name.
12735 # @return Improved shape.
12737 # @ref swig_UnionFaces "Example"
12738 @ManageTransactions("BlocksOp")
12739 def UnionFaces(self, theShape, theName=None):
12741 Performs union faces of theShape.
12742 Unite faces sharing one surface. It means that
12743 these faces must have references to one C++ surface object (handle).
12746 theShape The compound or single solid that contains faces
12748 theName Object name; when specified, this parameter is used
12749 for result publication in the study. Otherwise, if automatic
12750 publication is switched on, default value is used for result name.
12755 # Example: see GEOM_TestOthers.py
12756 anObj = self.BlocksOp.UnionFaces(theShape)
12757 RaiseIfFailed("UnionFaces", self.BlocksOp)
12758 self._autoPublish(anObj, theName, "unionFaces")
12761 ## Check, if the given shape is a blocks compound.
12762 # Fix all detected errors.
12763 # \note Single block can be also fixed by this method.
12764 # @param theShape The compound to check and improve.
12765 # @param theName Object name; when specified, this parameter is used
12766 # for result publication in the study. Otherwise, if automatic
12767 # publication is switched on, default value is used for result name.
12769 # @return Improved compound.
12771 # @ref swig_CheckAndImprove "Example"
12772 @ManageTransactions("BlocksOp")
12773 def CheckAndImprove(self, theShape, theName=None):
12775 Check, if the given shape is a blocks compound.
12776 Fix all detected errors.
12779 Single block can be also fixed by this method.
12782 theShape The compound to check and improve.
12783 theName Object name; when specified, this parameter is used
12784 for result publication in the study. Otherwise, if automatic
12785 publication is switched on, default value is used for result name.
12790 # Example: see GEOM_TestOthers.py
12791 anObj = self.BlocksOp.CheckAndImprove(theShape)
12792 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
12793 self._autoPublish(anObj, theName, "improved")
12796 # end of l4_blocks_measure
12799 ## @addtogroup l3_blocks_op
12802 ## Get all the blocks, contained in the given compound.
12803 # @param theCompound The compound to explode.
12804 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
12805 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
12806 # @param theName Object name; when specified, this parameter is used
12807 # for result publication in the study. Otherwise, if automatic
12808 # publication is switched on, default value is used for result name.
12810 # @note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
12812 # @return List of GEOM.GEOM_Object, containing the retrieved blocks.
12814 # @ref tui_explode_on_blocks "Example 1"
12815 # \n @ref swig_MakeBlockExplode "Example 2"
12816 @ManageTransactions("BlocksOp")
12817 def MakeBlockExplode(self, theCompound, theMinNbFaces, theMaxNbFaces, theName=None):
12819 Get all the blocks, contained in the given compound.
12822 theCompound The compound to explode.
12823 theMinNbFaces If solid has lower number of faces, it is not a block.
12824 theMaxNbFaces If solid has higher number of faces, it is not a block.
12825 theName Object name; when specified, this parameter is used
12826 for result publication in the study. Otherwise, if automatic
12827 publication is switched on, default value is used for result name.
12830 If theMaxNbFaces = 0, the maximum number of faces is not restricted.
12833 List of GEOM.GEOM_Object, containing the retrieved blocks.
12835 # Example: see GEOM_TestOthers.py
12836 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
12837 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
12838 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
12839 for anObj in aList:
12840 anObj.SetParameters(Parameters)
12842 self._autoPublish(aList, theName, "block")
12845 ## Find block, containing the given point inside its volume or on boundary.
12846 # @param theCompound Compound, to find block in.
12847 # @param thePoint Point, close to the desired block. If the point lays on
12848 # boundary between some blocks, we return block with nearest center.
12849 # @param theName Object name; when specified, this parameter is used
12850 # for result publication in the study. Otherwise, if automatic
12851 # publication is switched on, default value is used for result name.
12853 # @return New GEOM.GEOM_Object, containing the found block.
12855 # @ref swig_todo "Example"
12856 @ManageTransactions("BlocksOp")
12857 def GetBlockNearPoint(self, theCompound, thePoint, theName=None):
12859 Find block, containing the given point inside its volume or on boundary.
12862 theCompound Compound, to find block in.
12863 thePoint Point, close to the desired block. If the point lays on
12864 boundary between some blocks, we return block with nearest center.
12865 theName Object name; when specified, this parameter is used
12866 for result publication in the study. Otherwise, if automatic
12867 publication is switched on, default value is used for result name.
12870 New GEOM.GEOM_Object, containing the found block.
12872 # Example: see GEOM_Spanner.py
12873 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
12874 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
12875 self._autoPublish(anObj, theName, "block")
12878 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
12879 # @param theCompound Compound, to find block in.
12880 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
12881 # @param theName Object name; when specified, this parameter is used
12882 # for result publication in the study. Otherwise, if automatic
12883 # publication is switched on, default value is used for result name.
12885 # @return New GEOM.GEOM_Object, containing the found block.
12887 # @ref swig_GetBlockByParts "Example"
12888 @ManageTransactions("BlocksOp")
12889 def GetBlockByParts(self, theCompound, theParts, theName=None):
12891 Find block, containing all the elements, passed as the parts, or maximum quantity of them.
12894 theCompound Compound, to find block in.
12895 theParts List of faces and/or edges and/or vertices to be parts of the found block.
12896 theName Object name; when specified, this parameter is used
12897 for result publication in the study. Otherwise, if automatic
12898 publication is switched on, default value is used for result name.
12901 New GEOM_Object, containing the found block.
12903 # Example: see GEOM_TestOthers.py
12904 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
12905 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
12906 self._autoPublish(anObj, theName, "block")
12909 ## Return all blocks, containing all the elements, passed as the parts.
12910 # @param theCompound Compound, to find blocks in.
12911 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
12912 # @param theName Object name; when specified, this parameter is used
12913 # for result publication in the study. Otherwise, if automatic
12914 # publication is switched on, default value is used for result name.
12916 # @return List of GEOM.GEOM_Object, containing the found blocks.
12918 # @ref swig_todo "Example"
12919 @ManageTransactions("BlocksOp")
12920 def GetBlocksByParts(self, theCompound, theParts, theName=None):
12922 Return all blocks, containing all the elements, passed as the parts.
12925 theCompound Compound, to find blocks in.
12926 theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
12927 theName Object name; when specified, this parameter is used
12928 for result publication in the study. Otherwise, if automatic
12929 publication is switched on, default value is used for result name.
12932 List of GEOM.GEOM_Object, containing the found blocks.
12934 # Example: see GEOM_Spanner.py
12935 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
12936 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
12937 self._autoPublish(aList, theName, "block")
12940 ## Multi-transformate block and glue the result.
12941 # Transformation is defined so, as to superpose direction faces.
12942 # @param Block Hexahedral solid to be multi-transformed.
12943 # @param DirFace1 ID of First direction face.
12944 # @param DirFace2 ID of Second direction face.
12945 # @param NbTimes Quantity of transformations to be done.
12946 # @param theName Object name; when specified, this parameter is used
12947 # for result publication in the study. Otherwise, if automatic
12948 # publication is switched on, default value is used for result name.
12950 # @note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
12952 # @return New GEOM.GEOM_Object, containing the result shape.
12954 # @ref tui_multi_transformation "Example"
12955 @ManageTransactions("BlocksOp")
12956 def MakeMultiTransformation1D(self, Block, DirFace1, DirFace2, NbTimes, theName=None):
12958 Multi-transformate block and glue the result.
12959 Transformation is defined so, as to superpose direction faces.
12962 Block Hexahedral solid to be multi-transformed.
12963 DirFace1 ID of First direction face.
12964 DirFace2 ID of Second direction face.
12965 NbTimes Quantity of transformations to be done.
12966 theName Object name; when specified, this parameter is used
12967 for result publication in the study. Otherwise, if automatic
12968 publication is switched on, default value is used for result name.
12971 Unique ID of sub-shape can be obtained, using method GetSubShapeID().
12974 New GEOM.GEOM_Object, containing the result shape.
12976 # Example: see GEOM_Spanner.py
12977 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
12978 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
12979 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
12980 anObj.SetParameters(Parameters)
12981 self._autoPublish(anObj, theName, "transformed")
12984 ## Multi-transformate block and glue the result.
12985 # @param Block Hexahedral solid to be multi-transformed.
12986 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
12987 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
12988 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
12989 # @param theName Object name; when specified, this parameter is used
12990 # for result publication in the study. Otherwise, if automatic
12991 # publication is switched on, default value is used for result name.
12993 # @return New GEOM.GEOM_Object, containing the result shape.
12995 # @ref tui_multi_transformation "Example"
12996 @ManageTransactions("BlocksOp")
12997 def MakeMultiTransformation2D(self, Block, DirFace1U, DirFace2U, NbTimesU,
12998 DirFace1V, DirFace2V, NbTimesV, theName=None):
13000 Multi-transformate block and glue the result.
13003 Block Hexahedral solid to be multi-transformed.
13004 DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
13005 DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
13006 NbTimesU,NbTimesV Quantity of transformations to be done.
13007 theName Object name; when specified, this parameter is used
13008 for result publication in the study. Otherwise, if automatic
13009 publication is switched on, default value is used for result name.
13012 New GEOM.GEOM_Object, containing the result shape.
13014 # Example: see GEOM_Spanner.py
13015 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
13016 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
13017 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
13018 DirFace1V, DirFace2V, NbTimesV)
13019 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
13020 anObj.SetParameters(Parameters)
13021 self._autoPublish(anObj, theName, "transformed")
13024 ## Build all possible propagation groups.
13025 # Propagation group is a set of all edges, opposite to one (main)
13026 # edge of this group directly or through other opposite edges.
13027 # Notion of Opposite Edge make sense only on quadrangle face.
13028 # @param theShape Shape to build propagation groups on.
13029 # @param theName Object name; when specified, this parameter is used
13030 # for result publication in the study. Otherwise, if automatic
13031 # publication is switched on, default value is used for result name.
13033 # @return List of GEOM.GEOM_Object, each of them is a propagation group.
13035 # @ref swig_Propagate "Example"
13036 @ManageTransactions("BlocksOp")
13037 def Propagate(self, theShape, theName=None):
13039 Build all possible propagation groups.
13040 Propagation group is a set of all edges, opposite to one (main)
13041 edge of this group directly or through other opposite edges.
13042 Notion of Opposite Edge make sense only on quadrangle face.
13045 theShape Shape to build propagation groups on.
13046 theName Object name; when specified, this parameter is used
13047 for result publication in the study. Otherwise, if automatic
13048 publication is switched on, default value is used for result name.
13051 List of GEOM.GEOM_Object, each of them is a propagation group.
13053 # Example: see GEOM_TestOthers.py
13054 listChains = self.BlocksOp.Propagate(theShape)
13055 RaiseIfFailed("Propagate", self.BlocksOp)
13056 self._autoPublish(listChains, theName, "propagate")
13059 # end of l3_blocks_op
13062 ## @addtogroup l3_groups
13065 ## Creates a new group which will store sub-shapes of theMainShape
13066 # @param theMainShape is a GEOM object on which the group is selected
13067 # @param theShapeType defines a shape type of the group (see GEOM::shape_type)
13068 # @param theName Object name; when specified, this parameter is used
13069 # for result publication in the study. Otherwise, if automatic
13070 # publication is switched on, default value is used for result name.
13072 # @return a newly created GEOM group (GEOM.GEOM_Object)
13074 # @ref tui_working_with_groups_page "Example 1"
13075 # \n @ref swig_CreateGroup "Example 2"
13076 @ManageTransactions("GroupOp")
13077 def CreateGroup(self, theMainShape, theShapeType, theName=None):
13079 Creates a new group which will store sub-shapes of theMainShape
13082 theMainShape is a GEOM object on which the group is selected
13083 theShapeType defines a shape type of the group:"COMPOUND", "COMPSOLID",
13084 "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX", "SHAPE".
13085 theName Object name; when specified, this parameter is used
13086 for result publication in the study. Otherwise, if automatic
13087 publication is switched on, default value is used for result name.
13090 a newly created GEOM group
13093 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
13096 # Example: see GEOM_TestOthers.py
13097 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
13098 RaiseIfFailed("CreateGroup", self.GroupOp)
13099 self._autoPublish(anObj, theName, "group")
13102 ## Adds a sub-object with ID theSubShapeId to the group
13103 # @param theGroup is a GEOM group to which the new sub-shape is added
13104 # @param theSubShapeID is a sub-shape ID in the main object.
13105 # \note Use method GetSubShapeID() to get an unique ID of the sub-shape
13107 # @ref tui_working_with_groups_page "Example"
13108 @ManageTransactions("GroupOp")
13109 def AddObject(self,theGroup, theSubShapeID):
13111 Adds a sub-object with ID theSubShapeId to the group
13114 theGroup is a GEOM group to which the new sub-shape is added
13115 theSubShapeID is a sub-shape ID in the main object.
13118 Use method GetSubShapeID() to get an unique ID of the sub-shape
13120 # Example: see GEOM_TestOthers.py
13121 self.GroupOp.AddObject(theGroup, theSubShapeID)
13122 if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT":
13123 RaiseIfFailed("AddObject", self.GroupOp)
13127 ## Removes a sub-object with ID \a theSubShapeId from the group
13128 # @param theGroup is a GEOM group from which the new sub-shape is removed
13129 # @param theSubShapeID is a sub-shape ID in the main object.
13130 # \note Use method GetSubShapeID() to get an unique ID of the sub-shape
13132 # @ref tui_working_with_groups_page "Example"
13133 @ManageTransactions("GroupOp")
13134 def RemoveObject(self,theGroup, theSubShapeID):
13136 Removes a sub-object with ID theSubShapeId from the group
13139 theGroup is a GEOM group from which the new sub-shape is removed
13140 theSubShapeID is a sub-shape ID in the main object.
13143 Use method GetSubShapeID() to get an unique ID of the sub-shape
13145 # Example: see GEOM_TestOthers.py
13146 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
13147 RaiseIfFailed("RemoveObject", self.GroupOp)
13150 ## Adds to the group all the given shapes. No errors, if some shapes are already included.
13151 # @param theGroup is a GEOM group to which the new sub-shapes are added.
13152 # @param theSubShapes is a list of sub-shapes to be added.
13154 # @ref tui_working_with_groups_page "Example"
13155 @ManageTransactions("GroupOp")
13156 def UnionList (self,theGroup, theSubShapes):
13158 Adds to the group all the given shapes. No errors, if some shapes are already included.
13161 theGroup is a GEOM group to which the new sub-shapes are added.
13162 theSubShapes is a list of sub-shapes to be added.
13164 # Example: see GEOM_TestOthers.py
13165 self.GroupOp.UnionList(theGroup, theSubShapes)
13166 RaiseIfFailed("UnionList", self.GroupOp)
13169 ## Adds to the group all the given shapes. No errors, if some shapes are already included.
13170 # @param theGroup is a GEOM group to which the new sub-shapes are added.
13171 # @param theSubShapes is a list of indices of sub-shapes to be added.
13173 # @ref swig_UnionIDs "Example"
13174 @ManageTransactions("GroupOp")
13175 def UnionIDs(self,theGroup, theSubShapes):
13177 Adds to the group all the given shapes. No errors, if some shapes are already included.
13180 theGroup is a GEOM group to which the new sub-shapes are added.
13181 theSubShapes is a list of indices of sub-shapes to be added.
13183 # Example: see GEOM_TestOthers.py
13184 self.GroupOp.UnionIDs(theGroup, theSubShapes)
13185 RaiseIfFailed("UnionIDs", self.GroupOp)
13188 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
13189 # @param theGroup is a GEOM group from which the sub-shapes are removed.
13190 # @param theSubShapes is a list of sub-shapes to be removed.
13192 # @ref tui_working_with_groups_page "Example"
13193 @ManageTransactions("GroupOp")
13194 def DifferenceList (self,theGroup, theSubShapes):
13196 Removes from the group all the given shapes. No errors, if some shapes are not included.
13199 theGroup is a GEOM group from which the sub-shapes are removed.
13200 theSubShapes is a list of sub-shapes to be removed.
13202 # Example: see GEOM_TestOthers.py
13203 self.GroupOp.DifferenceList(theGroup, theSubShapes)
13204 RaiseIfFailed("DifferenceList", self.GroupOp)
13207 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
13208 # @param theGroup is a GEOM group from which the sub-shapes are removed.
13209 # @param theSubShapes is a list of indices of sub-shapes to be removed.
13211 # @ref swig_DifferenceIDs "Example"
13212 @ManageTransactions("GroupOp")
13213 def DifferenceIDs(self,theGroup, theSubShapes):
13215 Removes from the group all the given shapes. No errors, if some shapes are not included.
13218 theGroup is a GEOM group from which the sub-shapes are removed.
13219 theSubShapes is a list of indices of sub-shapes to be removed.
13221 # Example: see GEOM_TestOthers.py
13222 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
13223 RaiseIfFailed("DifferenceIDs", self.GroupOp)
13226 ## Union of two groups.
13227 # New group is created. It will contain all entities
13228 # which are present in groups theGroup1 and theGroup2.
13229 # @param theGroup1, theGroup2 are the initial GEOM groups
13230 # to create the united group from.
13231 # @param theName Object name; when specified, this parameter is used
13232 # for result publication in the study. Otherwise, if automatic
13233 # publication is switched on, default value is used for result name.
13235 # @return a newly created GEOM group.
13237 # @ref tui_union_groups_anchor "Example"
13238 @ManageTransactions("GroupOp")
13239 def UnionGroups (self, theGroup1, theGroup2, theName=None):
13241 Union of two groups.
13242 New group is created. It will contain all entities
13243 which are present in groups theGroup1 and theGroup2.
13246 theGroup1, theGroup2 are the initial GEOM groups
13247 to create the united group from.
13248 theName Object name; when specified, this parameter is used
13249 for result publication in the study. Otherwise, if automatic
13250 publication is switched on, default value is used for result name.
13253 a newly created GEOM group.
13255 # Example: see GEOM_TestOthers.py
13256 aGroup = self.GroupOp.UnionGroups(theGroup1, theGroup2)
13257 RaiseIfFailed("UnionGroups", self.GroupOp)
13258 self._autoPublish(aGroup, theName, "group")
13261 ## Intersection of two groups.
13262 # New group is created. It will contain only those entities
13263 # which are present in both groups theGroup1 and theGroup2.
13264 # @param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
13265 # @param theName Object name; when specified, this parameter is used
13266 # for result publication in the study. Otherwise, if automatic
13267 # publication is switched on, default value is used for result name.
13269 # @return a newly created GEOM group.
13271 # @ref tui_intersect_groups_anchor "Example"
13272 @ManageTransactions("GroupOp")
13273 def IntersectGroups (self, theGroup1, theGroup2, theName=None):
13275 Intersection of two groups.
13276 New group is created. It will contain only those entities
13277 which are present in both groups theGroup1 and theGroup2.
13280 theGroup1, theGroup2 are the initial GEOM groups to get common part of.
13281 theName Object name; when specified, this parameter is used
13282 for result publication in the study. Otherwise, if automatic
13283 publication is switched on, default value is used for result name.
13286 a newly created GEOM group.
13288 # Example: see GEOM_TestOthers.py
13289 aGroup = self.GroupOp.IntersectGroups(theGroup1, theGroup2)
13290 RaiseIfFailed("IntersectGroups", self.GroupOp)
13291 self._autoPublish(aGroup, theName, "group")
13294 ## Cut of two groups.
13295 # New group is created. It will contain entities which are
13296 # present in group theGroup1 but are not present in group theGroup2.
13297 # @param theGroup1 is a GEOM group to include elements of.
13298 # @param theGroup2 is a GEOM group to exclude elements of.
13299 # @param theName Object name; when specified, this parameter is used
13300 # for result publication in the study. Otherwise, if automatic
13301 # publication is switched on, default value is used for result name.
13303 # @return a newly created GEOM group.
13305 # @ref tui_cut_groups_anchor "Example"
13306 @ManageTransactions("GroupOp")
13307 def CutGroups (self, theGroup1, theGroup2, theName=None):
13310 New group is created. It will contain entities which are
13311 present in group theGroup1 but are not present in group theGroup2.
13314 theGroup1 is a GEOM group to include elements of.
13315 theGroup2 is a GEOM group to exclude elements of.
13316 theName Object name; when specified, this parameter is used
13317 for result publication in the study. Otherwise, if automatic
13318 publication is switched on, default value is used for result name.
13321 a newly created GEOM group.
13323 # Example: see GEOM_TestOthers.py
13324 aGroup = self.GroupOp.CutGroups(theGroup1, theGroup2)
13325 RaiseIfFailed("CutGroups", self.GroupOp)
13326 self._autoPublish(aGroup, theName, "group")
13329 ## Union of list of groups.
13330 # New group is created. It will contain all entities that are
13331 # present in groups listed in theGList.
13332 # @param theGList is a list of GEOM groups to create the united group from.
13333 # @param theName Object name; when specified, this parameter is used
13334 # for result publication in the study. Otherwise, if automatic
13335 # publication is switched on, default value is used for result name.
13337 # @return a newly created GEOM group.
13339 # @ref tui_union_groups_anchor "Example"
13340 @ManageTransactions("GroupOp")
13341 def UnionListOfGroups (self, theGList, theName=None):
13343 Union of list of groups.
13344 New group is created. It will contain all entities that are
13345 present in groups listed in theGList.
13348 theGList is a list of GEOM groups to create the united group from.
13349 theName Object name; when specified, this parameter is used
13350 for result publication in the study. Otherwise, if automatic
13351 publication is switched on, default value is used for result name.
13354 a newly created GEOM group.
13356 # Example: see GEOM_TestOthers.py
13357 aGroup = self.GroupOp.UnionListOfGroups(theGList)
13358 RaiseIfFailed("UnionListOfGroups", self.GroupOp)
13359 self._autoPublish(aGroup, theName, "group")
13362 ## Cut of lists of groups.
13363 # New group is created. It will contain only entities
13364 # which are present in groups listed in theGList.
13365 # @param theGList is a list of GEOM groups to include elements of.
13366 # @param theName Object name; when specified, this parameter is used
13367 # for result publication in the study. Otherwise, if automatic
13368 # publication is switched on, default value is used for result name.
13370 # @return a newly created GEOM group.
13372 # @ref tui_intersect_groups_anchor "Example"
13373 @ManageTransactions("GroupOp")
13374 def IntersectListOfGroups (self, theGList, theName=None):
13376 Cut of lists of groups.
13377 New group is created. It will contain only entities
13378 which are present in groups listed in theGList.
13381 theGList is a list of GEOM groups to include elements of.
13382 theName Object name; when specified, this parameter is used
13383 for result publication in the study. Otherwise, if automatic
13384 publication is switched on, default value is used for result name.
13387 a newly created GEOM group.
13389 # Example: see GEOM_TestOthers.py
13390 aGroup = self.GroupOp.IntersectListOfGroups(theGList)
13391 RaiseIfFailed("IntersectListOfGroups", self.GroupOp)
13392 self._autoPublish(aGroup, theName, "group")
13395 ## Cut of lists of groups.
13396 # New group is created. It will contain only entities
13397 # which are present in groups listed in theGList1 but
13398 # are not present in groups from theGList2.
13399 # @param theGList1 is a list of GEOM groups to include elements of.
13400 # @param theGList2 is a list of GEOM groups to exclude elements of.
13401 # @param theName Object name; when specified, this parameter is used
13402 # for result publication in the study. Otherwise, if automatic
13403 # publication is switched on, default value is used for result name.
13405 # @return a newly created GEOM group.
13407 # @ref tui_cut_groups_anchor "Example"
13408 @ManageTransactions("GroupOp")
13409 def CutListOfGroups (self, theGList1, theGList2, theName=None):
13411 Cut of lists of groups.
13412 New group is created. It will contain only entities
13413 which are present in groups listed in theGList1 but
13414 are not present in groups from theGList2.
13417 theGList1 is a list of GEOM groups to include elements of.
13418 theGList2 is a list of GEOM groups to exclude elements of.
13419 theName Object name; when specified, this parameter is used
13420 for result publication in the study. Otherwise, if automatic
13421 publication is switched on, default value is used for result name.
13424 a newly created GEOM group.
13426 # Example: see GEOM_TestOthers.py
13427 aGroup = self.GroupOp.CutListOfGroups(theGList1, theGList2)
13428 RaiseIfFailed("CutListOfGroups", self.GroupOp)
13429 self._autoPublish(aGroup, theName, "group")
13432 ## Returns a list of sub-objects ID stored in the group
13433 # @param theGroup is a GEOM group for which a list of IDs is requested
13435 # @ref swig_GetObjectIDs "Example"
13436 @ManageTransactions("GroupOp")
13437 def GetObjectIDs(self,theGroup):
13439 Returns a list of sub-objects ID stored in the group
13442 theGroup is a GEOM group for which a list of IDs is requested
13444 # Example: see GEOM_TestOthers.py
13445 ListIDs = self.GroupOp.GetObjects(theGroup)
13446 RaiseIfFailed("GetObjects", self.GroupOp)
13449 ## Returns a type of sub-objects stored in the group
13450 # @param theGroup is a GEOM group which type is returned.
13452 # @ref swig_GetType "Example"
13453 @ManageTransactions("GroupOp")
13454 def GetType(self,theGroup):
13456 Returns a type of sub-objects stored in the group
13459 theGroup is a GEOM group which type is returned.
13461 # Example: see GEOM_TestOthers.py
13462 aType = self.GroupOp.GetType(theGroup)
13463 RaiseIfFailed("GetType", self.GroupOp)
13466 ## Convert a type of geom object from id to string value
13467 # @param theId is a GEOM object type id.
13468 # @return type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
13469 # @ref swig_GetType "Example"
13470 def ShapeIdToType(self, theId):
13472 Convert a type of geom object from id to string value
13475 theId is a GEOM object type id.
13478 type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
13505 return "REVOLUTION"
13553 return "FREE_BOUNDS"
13561 return "THRUSECTIONS"
13563 return "COMPOUNDFILTER"
13565 return "SHAPES_ON_SHAPE"
13567 return "ELLIPSE_ARC"
13569 return "3DSKETCHER"
13575 return "PIPETSHAPE"
13576 return "Shape Id not exist."
13578 ## Returns a main shape associated with the group
13579 # @param theGroup is a GEOM group for which a main shape object is requested
13580 # @return a GEOM object which is a main shape for theGroup
13582 # @ref swig_GetMainShape "Example"
13583 @ManageTransactions("GroupOp")
13584 def GetMainShape(self,theGroup):
13586 Returns a main shape associated with the group
13589 theGroup is a GEOM group for which a main shape object is requested
13592 a GEOM object which is a main shape for theGroup
13594 Example of usage: BoxCopy = geompy.GetMainShape(CreateGroup)
13596 # Example: see GEOM_TestOthers.py
13597 anObj = self.GroupOp.GetMainShape(theGroup)
13598 RaiseIfFailed("GetMainShape", self.GroupOp)
13601 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
13602 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
13603 # @param theShape given shape (see GEOM.GEOM_Object)
13604 # @param min_length minimum length of edges of theShape
13605 # @param max_length maximum length of edges of theShape
13606 # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13607 # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13608 # @param theName Object name; when specified, this parameter is used
13609 # for result publication in the study. Otherwise, if automatic
13610 # publication is switched on, default value is used for result name.
13612 # @return a newly created GEOM group of edges
13614 # @@ref swig_todo "Example"
13615 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1, theName=None):
13617 Create group of edges of theShape, whose length is in range [min_length, max_length].
13618 If include_min/max == 0, edges with length == min/max_length will not be included in result.
13621 theShape given shape
13622 min_length minimum length of edges of theShape
13623 max_length maximum length of edges of theShape
13624 include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13625 include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13626 theName Object name; when specified, this parameter is used
13627 for result publication in the study. Otherwise, if automatic
13628 publication is switched on, default value is used for result name.
13631 a newly created GEOM group of edges.
13633 edges = self.SubShapeAll(theShape, self.ShapeType["EDGE"])
13634 edges_in_range = []
13636 Props = self.BasicProperties(edge)
13637 if min_length <= Props[0] and Props[0] <= max_length:
13638 if (not include_min) and (min_length == Props[0]):
13641 if (not include_max) and (Props[0] == max_length):
13644 edges_in_range.append(edge)
13646 if len(edges_in_range) <= 0:
13647 print("No edges found by given criteria")
13650 # note: auto-publishing is done in self.CreateGroup()
13651 group_edges = self.CreateGroup(theShape, self.ShapeType["EDGE"], theName)
13652 self.UnionList(group_edges, edges_in_range)
13656 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
13657 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
13658 # @param min_length minimum length of edges of selected shape
13659 # @param max_length maximum length of edges of selected shape
13660 # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13661 # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13662 # @return a newly created GEOM group of edges
13663 # @ref swig_todo "Example"
13664 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
13666 Create group of edges of selected shape, whose length is in range [min_length, max_length].
13667 If include_min/max == 0, edges with length == min/max_length will not be included in result.
13670 min_length minimum length of edges of selected shape
13671 max_length maximum length of edges of selected shape
13672 include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13673 include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13676 a newly created GEOM group of edges.
13678 nb_selected = sg.SelectedCount()
13679 if nb_selected < 1:
13680 print("Select a shape before calling this function, please.")
13682 if nb_selected > 1:
13683 print("Only one shape must be selected")
13686 id_shape = sg.getSelected(0)
13687 shape = IDToObject( id_shape )
13689 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
13693 if include_min: left_str = " <= "
13694 if include_max: right_str = " <= "
13696 self.addToStudyInFather(shape, group_edges, "Group of edges with " + repr(min_length)
13697 + left_str + "length" + right_str + repr(max_length))
13699 sg.updateObjBrowser()
13706 #@@ insert new functions before this line @@ do not remove this line @@#
13708 ## Create a copy of the given object
13710 # @param theOriginal geometry object for copy
13711 # @param theName Object name; when specified, this parameter is used
13712 # for result publication in the study. Otherwise, if automatic
13713 # publication is switched on, default value is used for result name.
13715 # @return New GEOM_Object, containing the copied shape.
13717 # @ingroup l1_geomBuilder_auxiliary
13718 # @ref swig_MakeCopy "Example"
13719 @ManageTransactions("InsertOp")
13720 def MakeCopy(self, theOriginal, theName=None):
13722 Create a copy of the given object
13725 theOriginal geometry object for copy
13726 theName Object name; when specified, this parameter is used
13727 for result publication in the study. Otherwise, if automatic
13728 publication is switched on, default value is used for result name.
13731 New GEOM_Object, containing the copied shape.
13733 Example of usage: Copy = geompy.MakeCopy(Box)
13735 # Example: see GEOM_TestAll.py
13736 anObj = self.InsertOp.MakeCopy(theOriginal)
13737 RaiseIfFailed("MakeCopy", self.InsertOp)
13738 self._autoPublish(anObj, theName, "copy")
13741 ## Add Path to load python scripts from
13742 # @param Path a path to load python scripts from
13743 # @ingroup l1_geomBuilder_auxiliary
13744 def addPath(self,Path):
13746 Add Path to load python scripts from
13749 Path a path to load python scripts from
13751 if (sys.path.count(Path) < 1):
13752 sys.path.append(Path)
13756 ## Load marker texture from the file
13757 # @param Path a path to the texture file
13758 # @return unique texture identifier
13759 # @ingroup l1_geomBuilder_auxiliary
13760 @ManageTransactions("InsertOp")
13761 def LoadTexture(self, Path):
13763 Load marker texture from the file
13766 Path a path to the texture file
13769 unique texture identifier
13771 # Example: see GEOM_TestAll.py
13772 ID = self.InsertOp.LoadTexture(Path)
13773 RaiseIfFailed("LoadTexture", self.InsertOp)
13776 ## Get internal name of the object based on its study entry
13777 # @note This method does not provide an unique identifier of the geometry object.
13778 # @note This is internal function of GEOM component, though it can be used outside it for
13779 # appropriate reason (e.g. for identification of geometry object).
13780 # @param obj geometry object
13781 # @return unique object identifier
13782 # @ingroup l1_geomBuilder_auxiliary
13783 def getObjectID(self, obj):
13785 Get internal name of the object based on its study entry.
13786 Note: this method does not provide an unique identifier of the geometry object.
13787 It is an internal function of GEOM component, though it can be used outside GEOM for
13788 appropriate reason (e.g. for identification of geometry object).
13791 obj geometry object
13794 unique object identifier
13797 entry = salome.ObjectToID(obj)
13798 if entry is not None:
13799 lst = entry.split(":")
13801 ID = lst[-1] # -1 means last item in the list
13802 return "GEOM_" + ID
13807 ## Add marker texture. @a Width and @a Height parameters
13808 # specify width and height of the texture in pixels.
13809 # If @a RowData is @c True, @a Texture parameter should represent texture data
13810 # packed into the byte array. If @a RowData is @c False (default), @a Texture
13811 # parameter should be unpacked string, in which '1' symbols represent opaque
13812 # pixels and '0' represent transparent pixels of the texture bitmap.
13814 # @param Width texture width in pixels
13815 # @param Height texture height in pixels
13816 # @param Texture texture data
13817 # @param RowData if @c True, @a Texture data are packed in the byte stream
13818 # @return unique texture identifier
13819 # @ingroup l1_geomBuilder_auxiliary
13820 @ManageTransactions("InsertOp")
13821 def AddTexture(self, Width, Height, Texture, RowData=False):
13823 Add marker texture. Width and Height parameters
13824 specify width and height of the texture in pixels.
13825 If RowData is True, Texture parameter should represent texture data
13826 packed into the byte array. If RowData is False (default), Texture
13827 parameter should be unpacked string, in which '1' symbols represent opaque
13828 pixels and '0' represent transparent pixels of the texture bitmap.
13831 Width texture width in pixels
13832 Height texture height in pixels
13833 Texture texture data
13834 RowData if True, Texture data are packed in the byte stream
13837 return unique texture identifier
13839 if not RowData: Texture = PackData(Texture)
13840 ID = self.InsertOp.AddTexture(Width, Height, Texture)
13841 RaiseIfFailed("AddTexture", self.InsertOp)
13844 ## Transfer not topological data from one GEOM object to another.
13846 # @param theObjectFrom the source object of non-topological data
13847 # @param theObjectTo the destination object of non-topological data
13848 # @param theFindMethod method to search sub-shapes of theObjectFrom
13849 # in shape theObjectTo. Possible values are: GEOM.FSM_GetInPlace,
13850 # GEOM.FSM_GetInPlaceByHistory and GEOM.FSM_GetInPlace_Old.
13851 # Other values of GEOM.find_shape_method are not supported.
13853 # @return True in case of success; False otherwise.
13855 # @ingroup l1_geomBuilder_auxiliary
13857 # @ref swig_TransferData "Example"
13858 @ManageTransactions("InsertOp")
13859 def TransferData(self, theObjectFrom, theObjectTo,
13860 theFindMethod=GEOM.FSM_GetInPlace):
13862 Transfer not topological data from one GEOM object to another.
13865 theObjectFrom the source object of non-topological data
13866 theObjectTo the destination object of non-topological data
13867 theFindMethod method to search sub-shapes of theObjectFrom
13868 in shape theObjectTo. Possible values are:
13869 GEOM.FSM_GetInPlace, GEOM.FSM_GetInPlaceByHistory
13870 and GEOM.FSM_GetInPlace_Old. Other values of
13871 GEOM.find_shape_method are not supported.
13874 True in case of success; False otherwise.
13876 # Example: see GEOM_TestOthers.py
13878 # Example: see GEOM_TestAll.py
13879 isOk = self.InsertOp.TransferData(theObjectFrom,
13880 theObjectTo, theFindMethod)
13881 RaiseIfFailed("TransferData", self.InsertOp)
13884 ## Creates a new folder object. It is a container for any GEOM objects.
13885 # @param Name name of the container
13886 # @param Father parent object. If None,
13887 # folder under 'Geometry' root object will be created.
13888 # @return a new created folder
13889 # @ingroup l1_publish_data
13890 def NewFolder(self, Name, Father=None):
13892 Create a new folder object. It is an auxiliary container for any GEOM objects.
13895 Name name of the container
13896 Father parent object. If None,
13897 folder under 'Geometry' root object will be created.
13900 a new created folder
13902 return self.CreateFolder(Name, Father)
13904 ## Move object to the specified folder
13905 # @param Object object to move
13906 # @param Folder target folder
13907 # @ingroup l1_publish_data
13908 def PutToFolder(self, Object, Folder):
13910 Move object to the specified folder
13913 Object object to move
13914 Folder target folder
13916 self.MoveToFolder(Object, Folder)
13919 ## Move list of objects to the specified folder
13920 # @param ListOfSO list of objects to move
13921 # @param Folder target folder
13922 # @ingroup l1_publish_data
13923 def PutListToFolder(self, ListOfSO, Folder):
13925 Move list of objects to the specified folder
13928 ListOfSO list of objects to move
13929 Folder target folder
13931 self.MoveListToFolder(ListOfSO, Folder)
13934 ## @addtogroup l2_field
13938 # @param shape the shape the field lies on
13939 # @param name the field name
13940 # @param type type of field data: 0 - bool, 1 - int, 2 - double, 3 - string
13941 # @param dimension dimension of the shape the field lies on
13942 # 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
13943 # @param componentNames names of components
13944 # @return a created field
13945 @ManageTransactions("FieldOp")
13946 def CreateField(self, shape, name, type, dimension, componentNames):
13951 shape the shape the field lies on
13952 name the field name
13953 type type of field data
13954 dimension dimension of the shape the field lies on
13955 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
13956 componentNames names of components
13961 if isinstance( type, int ):
13962 if type < 0 or type > 3:
13963 raise RuntimeError("CreateField : Error: data type must be within [0-3] range")
13964 type = [GEOM.FDT_Bool,GEOM.FDT_Int,GEOM.FDT_Double,GEOM.FDT_String][type]
13966 f = self.FieldOp.CreateField( shape, name, type, dimension, componentNames)
13967 RaiseIfFailed("CreateField", self.FieldOp)
13969 geom._autoPublish( f, "", name)
13972 ## Removes a field from the GEOM component
13973 # @param field the field to remove
13974 def RemoveField(self, field):
13975 "Removes a field from the GEOM component"
13977 if isinstance( field, GEOM._objref_GEOM_Field ):
13978 geom.RemoveObject( field )
13979 elif isinstance( field, geomField ):
13980 geom.RemoveObject( field.field )
13982 raise RuntimeError("RemoveField() : the object is not a field")
13985 ## Returns number of fields on a shape
13986 @ManageTransactions("FieldOp")
13987 def CountFields(self, shape):
13988 "Returns number of fields on a shape"
13989 nb = self.FieldOp.CountFields( shape )
13990 RaiseIfFailed("CountFields", self.FieldOp)
13993 ## Returns all fields on a shape
13994 @ManageTransactions("FieldOp")
13995 def GetFields(self, shape):
13996 "Returns all fields on a shape"
13997 ff = self.FieldOp.GetFields( shape )
13998 RaiseIfFailed("GetFields", self.FieldOp)
14001 ## Returns a field on a shape by its name
14002 @ManageTransactions("FieldOp")
14003 def GetField(self, shape, name):
14004 "Returns a field on a shape by its name"
14005 f = self.FieldOp.GetField( shape, name )
14006 RaiseIfFailed("GetField", self.FieldOp)
14012 ## @addtogroup l2_testing
14015 ## Build a mesh on the given shape.
14016 # @param shape the source shape
14017 # @param linear_deflection linear deflection coefficient
14018 # @param is_relative says if given value of deflection is relative to shape's bounding box
14019 # @param angular_deflection angular deflection for edges in degrees
14020 # @return True in case of success; otherwise False.
14021 @ManageTransactions("TestOp")
14022 def Tesselate(self, shape, linear_deflection=0, is_relative=True, angular_deflection=0):
14023 """Build a mesh on the given shape.
14026 shape the source shape
14027 linear_deflection linear deflection coefficient
14028 is_relative says if given value of deflection is relative to shape's bounding box
14029 angular_deflection angular deflection for edges in degrees
14032 True in case of success; otherwise False.
14034 if angular_deflection > 0:
14035 angular_deflection = angular_deflection * math.pi / 180.
14036 r = self.TestOp.Tesselate(shape, linear_deflection, is_relative, angular_deflection)
14037 RaiseIfFailed("Tesselate", self.TestOp)
14040 ## Obtain a shape checker
14041 # @return An instance of @ref conformity.CheckConformity "CheckConformity" interface
14043 # @ref tui_conformity_page "Example"
14044 def CheckConformity (self, shape):
14046 Obtain a shape checker.
14049 conf = geompy.CheckConformity(shape)
14050 valid = conf.isValid()
14051 si2d = conf.selfIntersected2D()
14052 dist = conf.distantShapes()
14053 small = conf.smallEdges()
14054 interfer = cc.interferingSubshapes()
14056 conf = CheckConformity (shape, self)
14059 # end of l2_testing
14063 # Register the new proxy for GEOM_Gen
14064 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geomBuilder)
14067 ## Field on Geometry
14068 # @ingroup l2_field
14069 class geomField( GEOM._objref_GEOM_Field ):
14071 def __init__(self, *args):
14072 GEOM._objref_GEOM_Field.__init__(self, *args)
14073 self.field = GEOM._objref_GEOM_Field
14076 ## Returns the shape the field lies on
14077 def getShape(self):
14078 "Returns the shape the field lies on"
14079 return self.field.GetShape(self)
14081 ## Returns the field name
14083 "Returns the field name"
14084 return self.field.GetName(self)
14086 ## Returns type of field data as integer [0-3]
14088 "Returns type of field data"
14089 return EnumToLong(self.field.GetDataType(self))
14091 ## Returns type of field data:
14092 # one of GEOM.FDT_Bool, GEOM.FDT_Int, GEOM.FDT_Double, GEOM.FDT_String
14093 def getTypeEnum(self):
14094 "Returns type of field data"
14095 return self.field.GetDataType(self)
14097 ## Returns dimension of the shape the field lies on:
14098 # 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
14099 def getDimension(self):
14100 """Returns dimension of the shape the field lies on:
14101 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape"""
14102 return self.field.GetDimension(self)
14104 ## Returns names of components
14105 def getComponents(self):
14106 "Returns names of components"
14107 return self.field.GetComponents(self)
14109 ## Adds a time step to the field
14110 # @param step the time step number further used as the step identifier
14111 # @param stamp the time step time
14112 # @param values the values of the time step
14113 def addStep(self, step, stamp, values):
14114 "Adds a time step to the field"
14115 stp = self.field.AddStep( self, step, stamp )
14117 raise RuntimeError("Field.addStep() : Error: step %s already exists in this field"%step)
14119 geom._autoPublish( stp, "", "Step %s, %s"%(step,stamp))
14120 self.setValues( step, values )
14123 ## Remove a time step from the field
14124 def removeStep(self,step):
14125 "Remove a time step from the field"
14128 stepObj = self.field.GetStep( self, step )
14130 stepSO = geom.myStudy.FindObjectID( stepObj.GetStudyEntry() )
14133 #traceback.print_exc()
14135 self.field.RemoveStep( self, step )
14137 geom.myBuilder.RemoveObjectWithChildren( stepSO )
14140 ## Returns number of time steps in the field
14141 def countSteps(self):
14142 "Returns number of time steps in the field"
14143 return self.field.CountSteps(self)
14145 ## Returns a list of time step IDs in the field
14146 def getSteps(self):
14147 "Returns a list of time step IDs in the field"
14148 return self.field.GetSteps(self)
14150 ## Returns a time step by its ID
14151 def getStep(self,step):
14152 "Returns a time step by its ID"
14153 stp = self.field.GetStep(self, step)
14155 raise RuntimeError("Step %s is missing from this field"%step)
14158 ## Returns the time of the field step
14159 def getStamp(self,step):
14160 "Returns the time of the field step"
14161 return self.getStep(step).GetStamp()
14163 ## Changes the time of the field step
14164 def setStamp(self, step, stamp):
14165 "Changes the time of the field step"
14166 return self.getStep(step).SetStamp(stamp)
14168 ## Returns values of the field step
14169 def getValues(self, step):
14170 "Returns values of the field step"
14171 return self.getStep(step).GetValues()
14173 ## Changes values of the field step
14174 def setValues(self, step, values):
14175 "Changes values of the field step"
14176 stp = self.getStep(step)
14177 errBeg = "Field.setValues(values) : Error: "
14179 ok = stp.SetValues( values )
14180 except Exception as e:
14182 if excStr.find("WrongPythonType") > 0:
14183 raise RuntimeError(errBeg +\
14184 "wrong type of values, %s values are expected"%str(self.getTypeEnum())[4:])
14185 raise RuntimeError(errBeg + str(e))
14187 nbOK = self.field.GetArraySize(self)
14190 raise RuntimeError(errBeg + "len(values) must be %s but not %s"%(nbOK,nbKO))
14192 raise RuntimeError(errBeg + "failed")
14195 pass # end of class geomField
14197 # Register the new proxy for GEOM_Field
14198 omniORB.registerObjref(GEOM._objref_GEOM_Field._NP_RepositoryId, geomField)
14201 ## Create a new geomBuilder instance.The geomBuilder class provides the Python
14202 # interface to GEOM operations.
14207 # salome.salome_init()
14208 # from salome.geom import geomBuilder
14209 # geompy = geomBuilder.New()
14211 # @param instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
14212 # @return geomBuilder instance
14213 def New( instance=None):
14215 Create a new geomBuilder instance.The geomBuilder class provides the Python
14216 interface to GEOM operations.
14220 salome.salome_init()
14221 from salome.geom import geomBuilder
14222 geompy = geomBuilder.New()
14225 instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
14227 geomBuilder instance
14229 #print "New geomBuilder ", study, instance
14233 if instance and isinstance( instance, SALOMEDS._objref_Study ):
14235 sys.stderr.write("Warning: 'study' argument is no more needed in geomBuilder.New(). Consider updating your script!!!\n\n")
14240 geom = geomBuilder()
14241 assert isinstance(geom,geomBuilder), "Geom engine class is %s but should be geomBuilder.geomBuilder. Import geomBuilder before creating the instance."%geom.__class__
14246 # Register methods from the plug-ins in the geomBuilder class
14247 plugins_var = os.environ.get( "GEOM_PluginsList" )
14250 if plugins_var is not None:
14251 plugins = plugins_var.split( ":" )
14252 plugins=[x for x in plugins if len(x)>0]
14253 if plugins is not None:
14254 for pluginName in plugins:
14255 pluginBuilderName = pluginName + "Builder"
14257 exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
14258 except Exception as e:
14259 from salome_utils import verbose
14260 print("Exception while loading %s: %s" % ( pluginBuilderName, e ))
14262 exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
14263 plugin = eval( pluginBuilderName )
14265 # add methods from plugin module to the geomBuilder class
14266 for k in dir( plugin ):
14267 if k[0] == '_': continue
14268 method = getattr( plugin, k )
14269 if type( method ).__name__ == 'function':
14270 if not hasattr( geomBuilder, k ):
14271 setattr( geomBuilder, k, method )