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
264 # In case the omniORBpy EnumItem class does not fully support Python 3
265 # (for instance in version 4.2.1-2), the comparison ordering methods must be
269 GEOM.COMPOUND < GEOM.SOLID
271 def enumitem_eq(self, other):
273 if isinstance(other, omniORB.EnumItem):
274 if other._parent_id == self._parent_id:
275 return self._v == other._v
277 return self._parent_id == other._parent_id
279 return id(self) == id(other)
281 return id(self) == id(other)
283 def enumitem_lt(self, other):
285 if isinstance(other, omniORB.EnumItem):
286 if other._parent_id == self._parent_id:
287 return self._v < other._v
289 return self._parent_id < other._parent_id
291 return id(self) < id(other)
293 return id(self) < id(other)
295 def enumitem_le(self, other):
297 if isinstance(other, omniORB.EnumItem):
298 if other._parent_id == self._parent_id:
299 return self._v <= other._v
301 return self._parent_id <= other._parent_id
303 return id(self) <= id(other)
305 return id(self) <= id(other)
307 def enumitem_gt(self, other):
309 if isinstance(other, omniORB.EnumItem):
310 if other._parent_id == self._parent_id:
311 return self._v > other._v
313 return self._parent_id > other._parent_id
315 return id(self) > id(other)
317 return id(self) > id(other)
319 def enumitem_ge(self, other):
321 if isinstance(other, omniORB.EnumItem):
322 if other._parent_id == self._parent_id:
323 return self._v >= other._v
325 return self._parent_id >= other._parent_id
327 return id(self) >= id(other)
329 return id(self) >= id(other)
331 GEOM.omniORB.EnumItem.__eq__ = enumitem_eq
332 GEOM.omniORB.EnumItem.__lt__ = enumitem_lt
333 GEOM.omniORB.EnumItem.__le__ = enumitem_le
334 GEOM.omniORB.EnumItem.__gt__ = enumitem_gt
335 GEOM.omniORB.EnumItem.__ge__ = enumitem_ge
336 omniORB.EnumItem.__eq__ = enumitem_eq
337 omniORB.EnumItem.__lt__ = enumitem_lt
338 omniORB.EnumItem.__le__ = enumitem_le
339 omniORB.EnumItem.__gt__ = enumitem_gt
340 omniORB.EnumItem.__ge__ = enumitem_ge
343 def _toListOfNames(_names, _size=-1):
346 if type(_names) in [list, tuple]:
347 for i in _names: l.append(i)
350 if l and len(l) < _size:
351 for i in range(len(l), _size): l.append("%s_%d"%(l[0],i))
354 # Decorator function to manage transactions for all geometric operations.
355 def ManageTransactions(theOpeName):
356 def MTDecorator(theFunction):
357 # To keep the original function name an documentation.
358 @functools.wraps(theFunction)
359 def OpenCallClose(self, *args, **kwargs):
361 anOperation = getattr(self, theOpeName)
362 anOperation.StartOperation()
365 res = theFunction(self, *args, **kwargs)
367 anOperation.FinishOperation()
371 anOperation.AbortOperation()
376 ## Raise an Error, containing the Method_name, if Operation is Failed
377 ## @ingroup l1_geomBuilder_auxiliary
378 def RaiseIfFailed (Method_name, Operation):
379 if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
380 raise RuntimeError(Method_name + " : " + Operation.GetErrorCode())
382 def PrintOrRaise(message, raiseException=False):
384 raise RuntimeError(message)
388 ## Return list of variables value from salome notebook
389 ## @ingroup l1_geomBuilder_auxiliary
390 def ParseParameters(*parameters):
393 for parameter in parameters:
394 if isinstance(parameter, list):
395 lResults = ParseParameters(*parameter)
396 if len(lResults) > 0:
397 Result.append(lResults[:-1])
398 StringResult += lResults[-1].split(":")
402 if isinstance(parameter,str):
403 if notebook.isVariable(parameter):
404 Result.append(notebook.get(parameter))
406 raise RuntimeError("Variable with name '" + parameter + "' doesn't exist!!!")
409 Result.append(parameter)
411 StringResult.append(str(parameter))
415 Result.append(":".join(StringResult))
417 Result = ":".join(StringResult)
420 ## Return list of variables value from salome notebook
421 ## @ingroup l1_geomBuilder_auxiliary
425 for parameter in list:
426 if isinstance(parameter,str) and notebook.isVariable(parameter):
427 Result.append(str(notebook.get(parameter)))
430 Result.append(str(parameter))
433 StringResult = StringResult + str(parameter)
434 StringResult = StringResult + ":"
436 StringResult = StringResult[:len(StringResult)-1]
437 return Result, StringResult
439 ## Return list of variables value from salome notebook
440 ## @ingroup l1_geomBuilder_auxiliary
441 def ParseSketcherCommand(command):
444 sections = command.split(":")
445 for section in sections:
446 parameters = section.split(" ")
448 for parameter in parameters:
449 if paramIndex > 1 and parameter.find("'") != -1:
450 parameter = parameter.replace("'","")
451 if notebook.isVariable(parameter):
452 Result = Result + str(notebook.get(parameter)) + " "
455 raise RuntimeError("Variable with name '" + parameter + "' doesn't exist!!!")
459 Result = Result + str(parameter) + " "
462 StringResult = StringResult + parameter
463 StringResult = StringResult + ":"
465 paramIndex = paramIndex + 1
467 Result = Result[:len(Result)-1] + ":"
469 Result = Result[:len(Result)-1]
470 return Result, StringResult
472 ## Helper function which can be used to pack the passed string to the byte data.
473 ## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
474 ## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
477 ## val = PackData("10001110") # val = 0xAE
478 ## val = PackData("1") # val = 0x80
480 ## @param data unpacked data - a string containing '1' and '0' symbols
481 ## @return data packed to the byte stream
482 ## @ingroup l1_geomBuilder_auxiliary
485 Helper function which can be used to pack the passed string to the byte data.
486 Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
487 If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
490 data unpacked data - a string containing '1' and '0' symbols
493 data packed to the byte stream
496 val = PackData("10001110") # val = 0xAE
497 val = PackData("1") # val = 0x80
500 if len(data)%8: bytes += 1
502 for b in range(bytes):
503 d = data[b*8:(b+1)*8]
508 if d[i] == "1": val += 1
510 raise "Invalid symbol %s" % d[i]
517 ## Read bitmap texture from the text file.
518 ## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
519 ## A zero symbol ('0') represents transparent pixel of the texture bitmap.
520 ## The function returns width and height of the pixmap in pixels and byte stream representing
521 ## texture bitmap itself.
523 ## This function can be used to read the texture to the byte stream in order to pass it to
524 ## the AddTexture() function of geomBuilder class.
527 ## from salome.geom import geomBuilder
528 ## geompy = geomBuilder.New()
529 ## texture = geompy.readtexture('mytexture.dat')
530 ## texture = geompy.AddTexture(*texture)
531 ## obj.SetMarkerTexture(texture)
533 ## @param fname texture file name
534 ## @return sequence of tree values: texture's width, height in pixels and its byte stream
535 ## @ingroup l1_geomBuilder_auxiliary
536 def ReadTexture(fname):
538 Read bitmap texture from the text file.
539 In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
540 A zero symbol ('0') represents transparent pixel of the texture bitmap.
541 The function returns width and height of the pixmap in pixels and byte stream representing
542 texture bitmap itself.
543 This function can be used to read the texture to the byte stream in order to pass it to
544 the AddTexture() function of geomBuilder class.
547 fname texture file name
550 sequence of tree values: texture's width, height in pixels and its byte stream
553 from salome.geom import geomBuilder
554 geompy = geomBuilder.New()
555 texture = geompy.readtexture('mytexture.dat')
556 texture = geompy.AddTexture(*texture)
557 obj.SetMarkerTexture(texture)
561 lines = [ l.strip() for l in f.readlines()]
564 if lines: maxlen = max([len(x) for x in lines])
566 if maxlen%8: lenbytes += 1
570 lenline = (len(line)/8+1)*8
573 lenline = (len(line)/8)*8
575 for i in range(lenline/8):
578 if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
581 bytedata += PackData(byte)
583 for i in range(lenline/8, lenbytes):
584 bytedata += PackData("0")
586 return lenbytes*8, len(lines), bytedata
591 ## Returns a long value from enumeration type
592 # Can be used for CORBA enumerator types like GEOM.shape_type
593 # @param theItem enumeration type
594 # @ingroup l1_geomBuilder_auxiliary
595 def EnumToLong(theItem):
597 Returns a long value from enumeration type
598 Can be used for CORBA enumerator types like geomBuilder.ShapeType
601 theItem enumeration type
604 if hasattr(theItem, "_v"): ret = theItem._v
607 ## Pack an argument into a list
609 if isinstance( arg, list ):
611 if hasattr( arg, "__getitem__" ):
615 ## Information about closed/unclosed state of shell or wire
616 # @ingroup l1_geomBuilder_auxiliary
619 Information about closed/unclosed state of shell or wire
625 ## Private class used to bind calls of plugin operations to geomBuilder
626 class PluginOperation:
627 def __init__(self, operation, function):
628 self.operation = operation
629 self.function = function
632 @ManageTransactions("operation")
633 def __call__(self, *args):
634 res = self.function(self.operation, *args)
635 RaiseIfFailed(self.function.__name__, self.operation)
638 # Warning: geom is a singleton
644 class geomBuilder(GEOM._objref_GEOM_Gen):
646 ## Enumeration ShapeType as a dictionary. \n
647 ## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details.
648 # @ingroup l1_geomBuilder_auxiliary
649 ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8, "FLAT":9}
651 ## Kinds of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
652 # and a list of parameters, describing the shape.
653 # List of parameters, describing the shape:
654 # - COMPOUND: [nb_solids nb_faces nb_edges nb_vertices]
655 # - COMPSOLID: [nb_solids nb_faces nb_edges nb_vertices]
657 # - SHELL: [info.CLOSED / info.UNCLOSED nb_faces nb_edges nb_vertices]
659 # - WIRE: [info.CLOSED / info.UNCLOSED nb_edges nb_vertices]
661 # - SPHERE: [xc yc zc R]
662 # - CYLINDER: [xb yb zb dx dy dz R H]
663 # - BOX: [xc yc zc ax ay az]
664 # - ROTATED_BOX: [xc yc zc zx zy zz xx xy xz ax ay az]
665 # - TORUS: [xc yc zc dx dy dz R_1 R_2]
666 # - CONE: [xb yb zb dx dy dz R_1 R_2 H]
667 # - POLYHEDRON: [nb_faces nb_edges nb_vertices]
668 # - SOLID: [nb_faces nb_edges nb_vertices]
670 # - SPHERE2D: [xc yc zc R]
671 # - CYLINDER2D: [xb yb zb dx dy dz R H]
672 # - TORUS2D: [xc yc zc dx dy dz R_1 R_2]
673 # - CONE2D: [xc yc zc dx dy dz R_1 R_2 H]
674 # - DISK_CIRCLE: [xc yc zc dx dy dz R]
675 # - DISK_ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
676 # - POLYGON: [xo yo zo dx dy dz nb_edges nb_vertices]
677 # - PLANE: [xo yo zo dx dy dz]
678 # - PLANAR: [xo yo zo dx dy dz nb_edges nb_vertices]
679 # - FACE: [nb_edges nb_vertices]
681 # - CIRCLE: [xc yc zc dx dy dz R]
682 # - ARC_CIRCLE: [xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2]
683 # - ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
684 # - ARC_ELLIPSE: [xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2]
685 # - LINE: [xo yo zo dx dy dz]
686 # - SEGMENT: [x1 y1 z1 x2 y2 z2]
687 # - EDGE: [nb_vertices]
691 # - LCS: [x y z xx xy xz yx yy yz zx zy zz]
692 # @ingroup l1_geomBuilder_auxiliary
693 kind = GEOM.GEOM_IKindOfShape
695 def __new__(cls, *args):
700 #print "==== __new__ ", engine, geom, doLcc, created
702 # geom engine is either retrieved from engine, or created
704 # Following test avoids a recursive loop
707 # geom engine not created: existing engine found
709 if doLcc and not created:
711 # FindOrLoadComponent called:
712 # 1. CORBA resolution of server
713 # 2. the __new__ method is called again
714 #print "==== FindOrLoadComponent ", engine, geom, doLcc, created
715 geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" )
718 # FindOrLoadComponent not called
720 # geomBuilder instance is created from lcc.FindOrLoadComponent
721 #print "==== super ", engine, geom, doLcc, created
722 geom = super(geomBuilder,cls).__new__(cls)
725 # geom engine not created: existing engine found
726 #print "==== existing ", engine, geom, doLcc, created
728 #print "return geom 1 ", geom
731 #print "return geom 2 ", geom
734 def __init__(self, *args):
736 #print "-------- geomBuilder __init__ --- ", created, self
739 GEOM._objref_GEOM_Gen.__init__(self, *args)
740 self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
741 self.myBuilder = None
758 ## Process object publication in the study, as follows:
759 # - if @a theName is specified (not None), the object is published in the study
760 # with this name, not taking into account "auto-publishing" option;
761 # - if @a theName is NOT specified, the object is published in the study
762 # (using default name, which can be customized using @a theDefaultName parameter)
763 # only if auto-publishing is switched on.
765 # @param theObj object, a subject for publishing
766 # @param theName object name for study
767 # @param theDefaultName default name for the auto-publishing
769 # @sa addToStudyAuto()
770 def _autoPublish(self, theObj, theName, theDefaultName="noname"):
772 def _item_name(_names, _defname, _idx=-1):
773 if not _names: _names = _defname
774 if type(_names) in [list, tuple]:
776 if _idx >= len(_names) or not _names[_idx]:
777 if type(_defname) not in [list, tuple]:
778 _name = "%s_%d"%(_defname, _idx+1)
779 elif len(_defname) > 0 and _idx >= 0 and _idx < len(_defname):
780 _name = _defname[_idx]
782 _name = "%noname_%d"%(dn, _idx+1)
788 # must be wrong usage
793 _name = "%s_%d"%(_names, _idx+1)
799 def _publish( _name, _obj ):
801 if isinstance( _obj, GEOM._objref_GEOM_Field ):
802 fatherObj = _obj.GetShape()
803 elif isinstance( _obj, GEOM._objref_GEOM_FieldStep ):
804 fatherObj = _obj.GetField()
805 elif not _obj.IsMainShape():
806 fatherObj = _obj.GetMainShape()
808 if fatherObj and fatherObj.GetStudyEntry():
809 self.addToStudyInFather(fatherObj, _obj, _name)
811 self.addToStudy(_obj, _name)
817 if not theName and not self.myMaxNbSubShapesAllowed:
818 return # nothing to do: auto-publishing is disabled
819 if not theName and not theDefaultName:
820 return # neither theName nor theDefaultName is given
822 if type(theObj) in [list, tuple]:
823 # list of objects is being published
826 if not obj: continue # bad object
827 name = _item_name(theName, theDefaultName, idx)
828 _publish( name, obj )
830 if not theName and idx == self.myMaxNbSubShapesAllowed: break
834 # single object is published
835 name = _item_name(theName, theDefaultName)
836 _publish( name, theObj )
839 ## @addtogroup l1_geomBuilder_auxiliary
842 self.myStudy = salome.myStudy
843 self.myBuilder = self.myStudy.NewBuilder()
845 # load data from the study file, if necessary
846 component = self.myStudy.FindComponent("GEOM")
848 self.myBuilder.LoadWith(component, self)
850 self.BasicOp = self.GetIBasicOperations ()
851 self.CurvesOp = self.GetICurvesOperations ()
852 self.PrimOp = self.GetI3DPrimOperations ()
853 self.ShapesOp = self.GetIShapesOperations ()
854 self.HealOp = self.GetIHealingOperations ()
855 self.InsertOp = self.GetIInsertOperations ()
856 self.BoolOp = self.GetIBooleanOperations ()
857 self.TrsfOp = self.GetITransformOperations()
858 self.LocalOp = self.GetILocalOperations ()
859 self.MeasuOp = self.GetIMeasureOperations ()
860 self.BlocksOp = self.GetIBlocksOperations ()
861 self.GroupOp = self.GetIGroupOperations ()
862 self.FieldOp = self.GetIFieldOperations ()
863 self.TestOp = self.GetITestOperations ()
865 notebook.myStudy = self.myStudy
868 def GetPluginOperations(self, libraryName):
869 op = GEOM._objref_GEOM_Gen.GetPluginOperations(self, libraryName)
872 ## Enable / disable results auto-publishing
874 # The automatic publishing is managed in the following way:
875 # - if @a maxNbSubShapes = 0, automatic publishing is disabled.
876 # - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
877 # maximum number of sub-shapes allowed for publishing is unlimited; any negative
878 # value passed as parameter has the same effect.
879 # - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
880 # maximum number of sub-shapes allowed for publishing is set to specified value.
882 # @param maxNbSubShapes maximum number of sub-shapes allowed for publishing.
883 # @ingroup l1_publish_data
884 def addToStudyAuto(self, maxNbSubShapes=-1):
886 Enable / disable results auto-publishing
888 The automatic publishing is managed in the following way:
889 - if @a maxNbSubShapes = 0, automatic publishing is disabled;
890 - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
891 maximum number of sub-shapes allowed for publishing is unlimited; any negative
892 value passed as parameter has the same effect.
893 - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
894 maximum number of sub-shapes allowed for publishing is set to this value.
897 maxNbSubShapes maximum number of sub-shapes allowed for publishing.
900 geompy.addToStudyAuto() # enable auto-publishing
901 geompy.MakeBoxDXDYDZ(100) # box is created and published with default name
902 geompy.addToStudyAuto(0) # disable auto-publishing
904 self.myMaxNbSubShapesAllowed = max(-1, maxNbSubShapes)
907 ## Dump component to the Python script
908 # This method overrides IDL function to allow default values for the parameters.
909 def DumpPython(self, theIsPublished=True, theIsMultiFile=True):
911 Dump component to the Python script
912 This method overrides IDL function to allow default values for the parameters.
914 return GEOM._objref_GEOM_Gen.DumpPython(self, theIsPublished, theIsMultiFile)
916 ## Get name for sub-shape aSubObj of shape aMainObj
918 # @ref swig_SubShapeName "Example"
919 @ManageTransactions("ShapesOp")
920 def SubShapeName(self,aSubObj, aMainObj):
922 Get name for sub-shape aSubObj of shape aMainObj
924 # Example: see GEOM_TestAll.py
926 #aSubId = orb.object_to_string(aSubObj)
927 #aMainId = orb.object_to_string(aMainObj)
928 #index = gg.getIndexTopology(aSubId, aMainId)
929 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
930 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
931 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
934 ## Publish in study aShape with name aName
936 # \param aShape the shape to be published
937 # \param aName the name for the shape
938 # \param doRestoreSubShapes if True, finds and publishes also
939 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
940 # and published sub-shapes of arguments
941 # \param theArgs,theFindMethod,theInheritFirstArg see RestoreSubShapes() for
942 # these arguments description
943 # \return study entry of the published shape in form of string
945 # @ingroup l1_publish_data
946 # @ref swig_all_addtostudy "Example"
947 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
948 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
950 Publish in study aShape with name aName
953 aShape the shape to be published
954 aName the name for the shape
955 doRestoreSubShapes if True, finds and publishes also
956 sub-shapes of aShape, corresponding to its arguments
957 and published sub-shapes of arguments
958 theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes() for
959 these arguments description
962 study entry of the published shape in form of string
965 id_block1 = geompy.addToStudy(Block1, "Block 1")
967 # Example: see GEOM_TestAll.py
969 aSObject = self.AddInStudy(aShape, aName, None)
970 if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
971 if doRestoreSubShapes:
972 self.RestoreSubShapesSO(aSObject, theArgs,
973 theFindMethod, theInheritFirstArg, True )
975 print("addToStudy() failed")
977 return aShape.GetStudyEntry()
979 ## Publish in study aShape with name aName as sub-object of previously published aFather
980 # \param aFather previously published object
981 # \param aShape the shape to be published as sub-object of <VAR>aFather</VAR>
982 # \param aName the name for the shape
984 # \return study entry of the published shape in form of string
986 # @ingroup l1_publish_data
987 # @ref swig_all_addtostudyInFather "Example"
988 def addToStudyInFather(self, aFather, aShape, aName):
990 Publish in study aShape with name aName as sub-object of previously published aFather
993 aFather previously published object
994 aShape the shape to be published as sub-object of aFather
995 aName the name for the shape
998 study entry of the published shape in form of string
1000 # Example: see GEOM_TestAll.py
1002 aSObject = self.AddInStudy(aShape, aName, aFather)
1003 if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
1005 print("addToStudyInFather() failed")
1007 return aShape.GetStudyEntry()
1009 ## Unpublish object in study
1011 # \param obj the object to be unpublished
1012 def hideInStudy(self, obj):
1014 Unpublish object in study
1017 obj the object to be unpublished
1019 ior = salome.orb.object_to_string(obj)
1020 aSObject = self.myStudy.FindObjectIOR(ior)
1021 if aSObject is not None:
1022 genericAttribute = self.myBuilder.FindOrCreateAttribute(aSObject, "AttributeDrawable")
1023 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
1024 drwAttribute.SetDrawable(False)
1025 # hide references if any
1026 vso = self.myStudy.FindDependances(aSObject);
1028 genericAttribute = self.myBuilder.FindOrCreateAttribute(refObj, "AttributeDrawable")
1029 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
1030 drwAttribute.SetDrawable(False)
1034 # end of l1_geomBuilder_auxiliary
1037 ## @addtogroup l3_restore_ss
1040 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
1041 # To be used from python scripts out of addToStudy() (non-default usage)
1042 # \param theObject published GEOM.GEOM_Object, arguments of which will be published
1043 # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1044 # If this list is empty, all operation arguments will be published
1045 # \param theFindMethod method to search sub-shapes, corresponding to arguments and
1046 # their sub-shapes. Value from enumeration GEOM.find_shape_method.
1047 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
1048 # Do not publish sub-shapes in place of arguments, but only
1049 # in place of sub-shapes of the first argument,
1050 # because the whole shape corresponds to the first argument.
1051 # Mainly to be used after transformations, but it also can be
1052 # useful after partition with one object shape, and some other
1053 # operations, where only the first argument has to be considered.
1054 # If theObject has only one argument shape, this flag is automatically
1055 # considered as True, not regarding really passed value.
1056 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
1057 # and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1058 # \return list of published sub-shapes
1060 # @ref tui_restore_prs_params "Example"
1061 def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
1062 theInheritFirstArg=False, theAddPrefix=True):
1064 Publish sub-shapes, standing for arguments and sub-shapes of arguments
1065 To be used from python scripts out of geompy.addToStudy (non-default usage)
1068 theObject published GEOM.GEOM_Object, arguments of which will be published
1069 theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1070 If this list is empty, all operation arguments will be published
1071 theFindMethod method to search sub-shapes, corresponding to arguments and
1072 their sub-shapes. Value from enumeration GEOM.find_shape_method.
1073 theInheritFirstArg set properties of the first argument for theObject.
1074 Do not publish sub-shapes in place of arguments, but only
1075 in place of sub-shapes of the first argument,
1076 because the whole shape corresponds to the first argument.
1077 Mainly to be used after transformations, but it also can be
1078 useful after partition with one object shape, and some other
1079 operations, where only the first argument has to be considered.
1080 If theObject has only one argument shape, this flag is automatically
1081 considered as True, not regarding really passed value.
1082 theAddPrefix add prefix "from_" to names of restored sub-shapes,
1083 and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1085 list of published sub-shapes
1087 # Example: see GEOM_TestAll.py
1088 return self.RestoreSubShapesO(theObject, theArgs,
1089 theFindMethod, theInheritFirstArg, theAddPrefix)
1091 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
1092 # To be used from python scripts out of addToStudy() (non-default usage)
1093 # \param theObject published GEOM.GEOM_Object, arguments of which will be published
1094 # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1095 # If this list is empty, all operation arguments will be published
1096 # \param theFindMethod method to search sub-shapes, corresponding to arguments and
1097 # their sub-shapes. Value from enumeration GEOM::find_shape_method.
1098 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
1099 # Do not publish sub-shapes in place of arguments, but only
1100 # in place of sub-shapes of the first argument,
1101 # because the whole shape corresponds to the first argument.
1102 # Mainly to be used after transformations, but it also can be
1103 # useful after partition with one object shape, and some other
1104 # operations, where only the first argument has to be considered.
1105 # If theObject has only one argument shape, this flag is automatically
1106 # considered as True, not regarding really passed value.
1107 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
1108 # and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1109 # \return list of published sub-shapes
1111 # @ref tui_restore_prs_params "Example"
1112 def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
1113 theInheritFirstArg=False, theAddPrefix=True):
1115 Publish sub-shapes, standing for arguments and sub-shapes of arguments
1116 To be used from python scripts out of geompy.addToStudy() (non-default usage)
1119 theObject published GEOM.GEOM_Object, arguments of which will be published
1120 theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1121 If this list is empty, all operation arguments will be published
1122 theFindMethod method to search sub-shapes, corresponding to arguments and
1123 their sub-shapes. Value from enumeration GEOM::find_shape_method.
1124 theInheritFirstArg set properties of the first argument for theObject.
1125 Do not publish sub-shapes in place of arguments, but only
1126 in place of sub-shapes of the first argument,
1127 because the whole shape corresponds to the first argument.
1128 Mainly to be used after transformations, but it also can be
1129 useful after partition with one object shape, and some other
1130 operations, where only the first argument has to be considered.
1131 If theObject has only one argument shape, this flag is automatically
1132 considered as True, not regarding really passed value.
1133 theAddPrefix add prefix "from_" to names of restored sub-shapes,
1134 and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1137 list of published sub-shapes
1139 # Example: see GEOM_TestAll.py
1140 return self.RestoreGivenSubShapesO(theObject, theArgs,
1141 theFindMethod, theInheritFirstArg, theAddPrefix)
1143 # end of l3_restore_ss
1146 ## @addtogroup l3_basic_go
1149 ## Create point by three coordinates.
1150 # @param theX The X coordinate of the point.
1151 # @param theY The Y coordinate of the point.
1152 # @param theZ The Z coordinate of the point.
1153 # @param theName Object name; when specified, this parameter is used
1154 # for result publication in the study. Otherwise, if automatic
1155 # publication is switched on, default value is used for result name.
1157 # @return New GEOM.GEOM_Object, containing the created point.
1159 # @ref tui_creation_point "Example"
1160 @ManageTransactions("BasicOp")
1161 def MakeVertex(self, theX, theY, theZ, theName=None):
1163 Create point by three coordinates.
1166 theX The X coordinate of the point.
1167 theY The Y coordinate of the point.
1168 theZ The Z coordinate of the point.
1169 theName Object name; when specified, this parameter is used
1170 for result publication in the study. Otherwise, if automatic
1171 publication is switched on, default value is used for result name.
1174 New GEOM.GEOM_Object, containing the created point.
1176 # Example: see GEOM_TestAll.py
1177 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
1178 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
1179 RaiseIfFailed("MakePointXYZ", self.BasicOp)
1180 anObj.SetParameters(Parameters)
1181 self._autoPublish(anObj, theName, "vertex")
1184 ## Create a point, distant from the referenced point
1185 # on the given distances along the coordinate axes.
1186 # @param theReference The referenced point.
1187 # @param theX Displacement from the referenced point along OX axis.
1188 # @param theY Displacement from the referenced point along OY axis.
1189 # @param theZ Displacement from the referenced point along OZ axis.
1190 # @param theName Object name; when specified, this parameter is used
1191 # for result publication in the study. Otherwise, if automatic
1192 # publication is switched on, default value is used for result name.
1194 # @return New GEOM.GEOM_Object, containing the created point.
1196 # @ref tui_creation_point "Example"
1197 @ManageTransactions("BasicOp")
1198 def MakeVertexWithRef(self, theReference, theX, theY, theZ, theName=None):
1200 Create a point, distant from the referenced point
1201 on the given distances along the coordinate axes.
1204 theReference The referenced point.
1205 theX Displacement from the referenced point along OX axis.
1206 theY Displacement from the referenced point along OY axis.
1207 theZ Displacement from the referenced point along OZ axis.
1208 theName Object name; when specified, this parameter is used
1209 for result publication in the study. Otherwise, if automatic
1210 publication is switched on, default value is used for result name.
1213 New GEOM.GEOM_Object, containing the created point.
1215 # Example: see GEOM_TestAll.py
1216 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
1217 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
1218 RaiseIfFailed("MakePointWithReference", self.BasicOp)
1219 anObj.SetParameters(Parameters)
1220 self._autoPublish(anObj, theName, "vertex")
1223 ## Create a point, corresponding to the given parameter on the given curve.
1224 # @param theRefCurve The referenced curve.
1225 # @param theParameter Value of parameter on the referenced curve.
1226 # @param takeOrientationIntoAccount flag that tells if it is necessary
1227 # to take the curve's orientation into account for the
1228 # operation. I.e. if this flag is set, the results for the same
1229 # parameters (except the value 0.5) is different for forward
1230 # and reversed curves. If it is not set the result is the same.
1231 # @param theName Object name; when specified, this parameter is used
1232 # for result publication in the study. Otherwise, if automatic
1233 # publication is switched on, default value is used for result name.
1235 # @return New GEOM.GEOM_Object, containing the created point.
1237 # @ref tui_creation_point "Example"
1238 @ManageTransactions("BasicOp")
1239 def MakeVertexOnCurve(self, theRefCurve, theParameter,
1240 takeOrientationIntoAccount=False, theName=None):
1242 Create a point, corresponding to the given parameter on the given curve.
1245 theRefCurve The referenced curve.
1246 theParameter Value of parameter on the referenced curve.
1247 takeOrientationIntoAccount flag that tells if it is necessary
1248 to take the curve's orientation into account for the
1249 operation. I.e. if this flag is set, the results for
1250 the same parameters (except the value 0.5) is different
1251 for forward and reversed curves. If it is not set
1252 the result is the same.
1253 theName Object name; when specified, this parameter is used
1254 for result publication in the study. Otherwise, if automatic
1255 publication is switched on, default value is used for result name.
1258 New GEOM.GEOM_Object, containing the created point.
1261 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
1263 # Example: see GEOM_TestAll.py
1264 theParameter, takeOrientationIntoAccount, Parameters = ParseParameters(
1265 theParameter, takeOrientationIntoAccount)
1266 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter,
1267 takeOrientationIntoAccount)
1268 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
1269 anObj.SetParameters(Parameters)
1270 self._autoPublish(anObj, theName, "vertex")
1273 ## Create a point by projection give coordinates on the given curve
1274 # @param theRefCurve The referenced curve.
1275 # @param theX X-coordinate in 3D space
1276 # @param theY Y-coordinate in 3D space
1277 # @param theZ Z-coordinate in 3D space
1278 # @param theName Object name; when specified, this parameter is used
1279 # for result publication in the study. Otherwise, if automatic
1280 # publication is switched on, default value is used for result name.
1282 # @return New GEOM.GEOM_Object, containing the created point.
1284 # @ref tui_creation_point "Example"
1285 @ManageTransactions("BasicOp")
1286 def MakeVertexOnCurveByCoord(self, theRefCurve, theX, theY, theZ, theName=None):
1288 Create a point by projection give coordinates on the given curve
1291 theRefCurve The referenced curve.
1292 theX X-coordinate in 3D space
1293 theY Y-coordinate in 3D space
1294 theZ Z-coordinate in 3D space
1295 theName Object name; when specified, this parameter is used
1296 for result publication in the study. Otherwise, if automatic
1297 publication is switched on, default value is used for result name.
1300 New GEOM.GEOM_Object, containing the created point.
1303 p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
1305 # Example: see GEOM_TestAll.py
1306 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
1307 anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
1308 RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
1309 anObj.SetParameters(Parameters)
1310 self._autoPublish(anObj, theName, "vertex")
1313 ## Create a point, corresponding to the given length on the given curve.
1314 # @param theRefCurve The referenced curve.
1315 # @param theLength Length on the referenced curve. It can be negative.
1316 # @param theStartPoint Point allowing to choose the direction for the calculation
1317 # of the length. If None, start from the first point of theRefCurve.
1318 # @param theName Object name; when specified, this parameter is used
1319 # for result publication in the study. Otherwise, if automatic
1320 # publication is switched on, default value is used for result name.
1322 # @return New GEOM.GEOM_Object, containing the created point.
1324 # @ref tui_creation_point "Example"
1325 @ManageTransactions("BasicOp")
1326 def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
1328 Create a point, corresponding to the given length on the given curve.
1331 theRefCurve The referenced curve.
1332 theLength Length on the referenced curve. It can be negative.
1333 theStartPoint Point allowing to choose the direction for the calculation
1334 of the length. If None, start from the first point of theRefCurve.
1335 theName Object name; when specified, this parameter is used
1336 for result publication in the study. Otherwise, if automatic
1337 publication is switched on, default value is used for result name.
1340 New GEOM.GEOM_Object, containing the created point.
1342 # Example: see GEOM_TestAll.py
1343 theLength, Parameters = ParseParameters(theLength)
1344 anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
1345 RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
1346 anObj.SetParameters(Parameters)
1347 self._autoPublish(anObj, theName, "vertex")
1350 ## Create a point, corresponding to the given parameters on the
1352 # @param theRefSurf The referenced surface.
1353 # @param theUParameter Value of U-parameter on the referenced surface.
1354 # @param theVParameter Value of V-parameter on the referenced surface.
1355 # @param theName Object name; when specified, this parameter is used
1356 # for result publication in the study. Otherwise, if automatic
1357 # publication is switched on, default value is used for result name.
1359 # @return New GEOM.GEOM_Object, containing the created point.
1361 # @ref swig_MakeVertexOnSurface "Example"
1362 @ManageTransactions("BasicOp")
1363 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter, theName=None):
1365 Create a point, corresponding to the given parameters on the
1369 theRefSurf The referenced surface.
1370 theUParameter Value of U-parameter on the referenced surface.
1371 theVParameter Value of V-parameter on the referenced surface.
1372 theName Object name; when specified, this parameter is used
1373 for result publication in the study. Otherwise, if automatic
1374 publication is switched on, default value is used for result name.
1377 New GEOM.GEOM_Object, containing the created point.
1380 p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8)
1382 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
1383 # Example: see GEOM_TestAll.py
1384 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
1385 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
1386 anObj.SetParameters(Parameters);
1387 self._autoPublish(anObj, theName, "vertex")
1390 ## Create a point by projection give coordinates on the given surface
1391 # @param theRefSurf The referenced surface.
1392 # @param theX X-coordinate in 3D space
1393 # @param theY Y-coordinate in 3D space
1394 # @param theZ Z-coordinate in 3D space
1395 # @param theName Object name; when specified, this parameter is used
1396 # for result publication in the study. Otherwise, if automatic
1397 # publication is switched on, default value is used for result name.
1399 # @return New GEOM.GEOM_Object, containing the created point.
1401 # @ref swig_MakeVertexOnSurfaceByCoord "Example"
1402 @ManageTransactions("BasicOp")
1403 def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ, theName=None):
1405 Create a point by projection give coordinates on the given surface
1408 theRefSurf The referenced surface.
1409 theX X-coordinate in 3D space
1410 theY Y-coordinate in 3D space
1411 theZ Z-coordinate in 3D space
1412 theName Object name; when specified, this parameter is used
1413 for result publication in the study. Otherwise, if automatic
1414 publication is switched on, default value is used for result name.
1417 New GEOM.GEOM_Object, containing the created point.
1420 p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.)
1422 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
1423 # Example: see GEOM_TestAll.py
1424 anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
1425 RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
1426 anObj.SetParameters(Parameters);
1427 self._autoPublish(anObj, theName, "vertex")
1430 ## Create a point, which lays on the given face.
1431 # The point will lay in arbitrary place of the face.
1432 # The only condition on it is a non-zero distance to the face boundary.
1433 # Such point can be used to uniquely identify the face inside any
1434 # shape in case, when the shape does not contain overlapped faces.
1435 # @param theFace The referenced face.
1436 # @param theName Object name; when specified, this parameter is used
1437 # for result publication in the study. Otherwise, if automatic
1438 # publication is switched on, default value is used for result name.
1440 # @return New GEOM.GEOM_Object, containing the created point.
1442 # @ref swig_MakeVertexInsideFace "Example"
1443 @ManageTransactions("BasicOp")
1444 def MakeVertexInsideFace (self, theFace, theName=None):
1446 Create a point, which lays on the given face.
1447 The point will lay in arbitrary place of the face.
1448 The only condition on it is a non-zero distance to the face boundary.
1449 Such point can be used to uniquely identify the face inside any
1450 shape in case, when the shape does not contain overlapped faces.
1453 theFace The referenced face.
1454 theName Object name; when specified, this parameter is used
1455 for result publication in the study. Otherwise, if automatic
1456 publication is switched on, default value is used for result name.
1459 New GEOM.GEOM_Object, containing the created point.
1462 p_on_face = geompy.MakeVertexInsideFace(Face)
1464 # Example: see GEOM_TestAll.py
1465 anObj = self.BasicOp.MakePointOnFace(theFace)
1466 RaiseIfFailed("MakeVertexInsideFace", self.BasicOp)
1467 self._autoPublish(anObj, theName, "vertex")
1470 ## Create a point on intersection of two lines.
1471 # @param theRefLine1, theRefLine2 The referenced lines.
1472 # @param theName Object name; when specified, this parameter is used
1473 # for result publication in the study. Otherwise, if automatic
1474 # publication is switched on, default value is used for result name.
1476 # @return New GEOM.GEOM_Object, containing the created point.
1478 # @ref swig_MakeVertexOnLinesIntersection "Example"
1479 @ManageTransactions("BasicOp")
1480 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2, theName=None):
1482 Create a point on intersection of two lines.
1485 theRefLine1, theRefLine2 The referenced lines.
1486 theName Object name; when specified, this parameter is used
1487 for result publication in the study. Otherwise, if automatic
1488 publication is switched on, default value is used for result name.
1491 New GEOM.GEOM_Object, containing the created point.
1493 # Example: see GEOM_TestAll.py
1494 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
1495 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
1496 self._autoPublish(anObj, theName, "vertex")
1499 ## Create a tangent, corresponding to the given parameter on the given curve.
1500 # @param theRefCurve The referenced curve.
1501 # @param theParameter Value of parameter on the referenced curve.
1502 # @param theName Object name; when specified, this parameter is used
1503 # for result publication in the study. Otherwise, if automatic
1504 # publication is switched on, default value is used for result name.
1506 # @return New GEOM.GEOM_Object, containing the created tangent.
1508 # @ref swig_MakeTangentOnCurve "Example"
1509 @ManageTransactions("BasicOp")
1510 def MakeTangentOnCurve(self, theRefCurve, theParameter, theName=None):
1512 Create a tangent, corresponding to the given parameter on the given curve.
1515 theRefCurve The referenced curve.
1516 theParameter Value of parameter on the referenced curve.
1517 theName Object name; when specified, this parameter is used
1518 for result publication in the study. Otherwise, if automatic
1519 publication is switched on, default value is used for result name.
1522 New GEOM.GEOM_Object, containing the created tangent.
1525 tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7)
1527 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
1528 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
1529 self._autoPublish(anObj, theName, "tangent")
1532 ## Create a tangent plane, corresponding to the given parameter on the given face.
1533 # @param theFace The face for which tangent plane should be built.
1534 # @param theParameterV vertical value of the center point (0.0 - 1.0).
1535 # @param theParameterU horisontal value of the center point (0.0 - 1.0).
1536 # @param theTrimSize the size of plane.
1537 # @param theName Object name; when specified, this parameter is used
1538 # for result publication in the study. Otherwise, if automatic
1539 # publication is switched on, default value is used for result name.
1541 # @return New GEOM.GEOM_Object, containing the created tangent.
1543 # @ref swig_MakeTangentPlaneOnFace "Example"
1544 @ManageTransactions("BasicOp")
1545 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize, theName=None):
1547 Create a tangent plane, corresponding to the given parameter on the given face.
1550 theFace The face for which tangent plane should be built.
1551 theParameterV vertical value of the center point (0.0 - 1.0).
1552 theParameterU horisontal value of the center point (0.0 - 1.0).
1553 theTrimSize the size of plane.
1554 theName Object name; when specified, this parameter is used
1555 for result publication in the study. Otherwise, if automatic
1556 publication is switched on, default value is used for result name.
1559 New GEOM.GEOM_Object, containing the created tangent.
1562 an_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
1564 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
1565 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
1566 self._autoPublish(anObj, theName, "tangent")
1569 ## Create a vector with the given components.
1570 # @param theDX X component of the vector.
1571 # @param theDY Y component of the vector.
1572 # @param theDZ Z component of the vector.
1573 # @param theName Object name; when specified, this parameter is used
1574 # for result publication in the study. Otherwise, if automatic
1575 # publication is switched on, default value is used for result name.
1577 # @return New GEOM.GEOM_Object, containing the created vector.
1579 # @ref tui_creation_vector "Example"
1580 @ManageTransactions("BasicOp")
1581 def MakeVectorDXDYDZ(self, theDX, theDY, theDZ, theName=None):
1583 Create a vector with the given components.
1586 theDX X component of the vector.
1587 theDY Y component of the vector.
1588 theDZ Z component of the vector.
1589 theName Object name; when specified, this parameter is used
1590 for result publication in the study. Otherwise, if automatic
1591 publication is switched on, default value is used for result name.
1594 New GEOM.GEOM_Object, containing the created vector.
1596 # Example: see GEOM_TestAll.py
1597 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1598 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
1599 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
1600 anObj.SetParameters(Parameters)
1601 self._autoPublish(anObj, theName, "vector")
1604 ## Create a vector between two points.
1605 # @param thePnt1 Start point for the vector.
1606 # @param thePnt2 End point for the vector.
1607 # @param theName Object name; when specified, this parameter is used
1608 # for result publication in the study. Otherwise, if automatic
1609 # publication is switched on, default value is used for result name.
1611 # @return New GEOM.GEOM_Object, containing the created vector.
1613 # @ref tui_creation_vector "Example"
1614 @ManageTransactions("BasicOp")
1615 def MakeVector(self, thePnt1, thePnt2, theName=None):
1617 Create a vector between two points.
1620 thePnt1 Start point for the vector.
1621 thePnt2 End point for the vector.
1622 theName Object name; when specified, this parameter is used
1623 for result publication in the study. Otherwise, if automatic
1624 publication is switched on, default value is used for result name.
1627 New GEOM.GEOM_Object, containing the created vector.
1629 # Example: see GEOM_TestAll.py
1630 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
1631 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
1632 self._autoPublish(anObj, theName, "vector")
1635 ## Create a line, passing through the given point
1636 # and parallel to the given direction
1637 # @param thePnt Point. The resulting line will pass through it.
1638 # @param theDir Direction. The resulting line will be parallel to it.
1639 # @param theName Object name; when specified, this parameter is used
1640 # for result publication in the study. Otherwise, if automatic
1641 # publication is switched on, default value is used for result name.
1643 # @return New GEOM.GEOM_Object, containing the created line.
1645 # @ref tui_creation_line "Example"
1646 @ManageTransactions("BasicOp")
1647 def MakeLine(self, thePnt, theDir, theName=None):
1649 Create a line, passing through the given point
1650 and parallel to the given direction
1653 thePnt Point. The resulting line will pass through it.
1654 theDir Direction. The resulting line will be parallel to it.
1655 theName Object name; when specified, this parameter is used
1656 for result publication in the study. Otherwise, if automatic
1657 publication is switched on, default value is used for result name.
1660 New GEOM.GEOM_Object, containing the created line.
1662 # Example: see GEOM_TestAll.py
1663 anObj = self.BasicOp.MakeLine(thePnt, theDir)
1664 RaiseIfFailed("MakeLine", self.BasicOp)
1665 self._autoPublish(anObj, theName, "line")
1668 ## Create a line, passing through the given points
1669 # @param thePnt1 First of two points, defining the line.
1670 # @param thePnt2 Second of two points, defining the line.
1671 # @param theName Object name; when specified, this parameter is used
1672 # for result publication in the study. Otherwise, if automatic
1673 # publication is switched on, default value is used for result name.
1675 # @return New GEOM.GEOM_Object, containing the created line.
1677 # @ref tui_creation_line "Example"
1678 @ManageTransactions("BasicOp")
1679 def MakeLineTwoPnt(self, thePnt1, thePnt2, theName=None):
1681 Create a line, passing through the given points
1684 thePnt1 First of two points, defining the line.
1685 thePnt2 Second of two points, defining the line.
1686 theName Object name; when specified, this parameter is used
1687 for result publication in the study. Otherwise, if automatic
1688 publication is switched on, default value is used for result name.
1691 New GEOM.GEOM_Object, containing the created line.
1693 # Example: see GEOM_TestAll.py
1694 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
1695 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
1696 self._autoPublish(anObj, theName, "line")
1699 ## Create a line on two faces intersection.
1700 # @param theFace1 First of two faces, defining the line.
1701 # @param theFace2 Second of two faces, defining the line.
1702 # @param theName Object name; when specified, this parameter is used
1703 # for result publication in the study. Otherwise, if automatic
1704 # publication is switched on, default value is used for result name.
1706 # @return New GEOM.GEOM_Object, containing the created line.
1708 # @ref swig_MakeLineTwoFaces "Example"
1709 @ManageTransactions("BasicOp")
1710 def MakeLineTwoFaces(self, theFace1, theFace2, theName=None):
1712 Create a line on two faces intersection.
1715 theFace1 First of two faces, defining the line.
1716 theFace2 Second of two faces, defining the line.
1717 theName Object name; when specified, this parameter is used
1718 for result publication in the study. Otherwise, if automatic
1719 publication is switched on, default value is used for result name.
1722 New GEOM.GEOM_Object, containing the created line.
1724 # Example: see GEOM_TestAll.py
1725 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
1726 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
1727 self._autoPublish(anObj, theName, "line")
1730 ## Create a plane, passing through the given point
1731 # and normal to the given vector.
1732 # @param thePnt Point, the plane has to pass through.
1733 # @param theVec Vector, defining the plane normal direction.
1734 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1735 # @param theName Object name; when specified, this parameter is used
1736 # for result publication in the study. Otherwise, if automatic
1737 # publication is switched on, default value is used for result name.
1739 # @return New GEOM.GEOM_Object, containing the created plane.
1741 # @ref tui_creation_plane "Example"
1742 @ManageTransactions("BasicOp")
1743 def MakePlane(self, thePnt, theVec, theTrimSize, theName=None):
1745 Create a plane, passing through the given point
1746 and normal to the given vector.
1749 thePnt Point, the plane has to pass through.
1750 theVec Vector, defining the plane normal direction.
1751 theTrimSize Half size of a side of quadrangle face, representing the plane.
1752 theName Object name; when specified, this parameter is used
1753 for result publication in the study. Otherwise, if automatic
1754 publication is switched on, default value is used for result name.
1757 New GEOM.GEOM_Object, containing the created plane.
1759 # Example: see GEOM_TestAll.py
1760 theTrimSize, Parameters = ParseParameters(theTrimSize);
1761 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
1762 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
1763 anObj.SetParameters(Parameters)
1764 self._autoPublish(anObj, theName, "plane")
1767 ## Create a plane, passing through the three given points
1768 # @param thePnt1 First of three points, defining the plane.
1769 # @param thePnt2 Second of three points, defining the plane.
1770 # @param thePnt3 Third of three points, defining the plane.
1771 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1772 # @param theName Object name; when specified, this parameter is used
1773 # for result publication in the study. Otherwise, if automatic
1774 # publication is switched on, default value is used for result name.
1776 # @return New GEOM.GEOM_Object, containing the created plane.
1778 # @ref tui_creation_plane "Example"
1779 @ManageTransactions("BasicOp")
1780 def MakePlaneThreePnt(self, thePnt1, thePnt2, thePnt3, theTrimSize, theName=None):
1782 Create a plane, passing through the three given points
1785 thePnt1 First of three points, defining the plane.
1786 thePnt2 Second of three points, defining the plane.
1787 thePnt3 Third of three points, defining the plane.
1788 theTrimSize Half size of a side of quadrangle face, representing the plane.
1789 theName Object name; when specified, this parameter is used
1790 for result publication in the study. Otherwise, if automatic
1791 publication is switched on, default value is used for result name.
1794 New GEOM.GEOM_Object, containing the created plane.
1796 # Example: see GEOM_TestAll.py
1797 theTrimSize, Parameters = ParseParameters(theTrimSize);
1798 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
1799 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
1800 anObj.SetParameters(Parameters)
1801 self._autoPublish(anObj, theName, "plane")
1804 ## Create a plane, similar to the existing one, but with another size of representing face.
1805 # @param theFace Referenced plane or LCS(Marker).
1806 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
1807 # @param theName Object name; when specified, this parameter is used
1808 # for result publication in the study. Otherwise, if automatic
1809 # publication is switched on, default value is used for result name.
1811 # @return New GEOM.GEOM_Object, containing the created plane.
1813 # @ref tui_creation_plane "Example"
1814 @ManageTransactions("BasicOp")
1815 def MakePlaneFace(self, theFace, theTrimSize, theName=None):
1817 Create a plane, similar to the existing one, but with another size of representing face.
1820 theFace Referenced plane or LCS(Marker).
1821 theTrimSize New half size of a side of quadrangle face, representing the plane.
1822 theName Object name; when specified, this parameter is used
1823 for result publication in the study. Otherwise, if automatic
1824 publication is switched on, default value is used for result name.
1827 New GEOM.GEOM_Object, containing the created plane.
1829 # Example: see GEOM_TestAll.py
1830 theTrimSize, Parameters = ParseParameters(theTrimSize);
1831 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
1832 RaiseIfFailed("MakePlaneFace", self.BasicOp)
1833 anObj.SetParameters(Parameters)
1834 self._autoPublish(anObj, theName, "plane")
1837 ## Create a plane, passing through the 2 vectors
1838 # with center in a start point of the first vector.
1839 # @param theVec1 Vector, defining center point and plane direction.
1840 # @param theVec2 Vector, defining the plane normal direction.
1841 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1842 # @param theName Object name; when specified, this parameter is used
1843 # for result publication in the study. Otherwise, if automatic
1844 # publication is switched on, default value is used for result name.
1846 # @return New GEOM.GEOM_Object, containing the created plane.
1848 # @ref tui_creation_plane "Example"
1849 @ManageTransactions("BasicOp")
1850 def MakePlane2Vec(self, theVec1, theVec2, theTrimSize, theName=None):
1852 Create a plane, passing through the 2 vectors
1853 with center in a start point of the first vector.
1856 theVec1 Vector, defining center point and plane direction.
1857 theVec2 Vector, defining the plane normal direction.
1858 theTrimSize Half size of a side of quadrangle face, representing the plane.
1859 theName Object name; when specified, this parameter is used
1860 for result publication in the study. Otherwise, if automatic
1861 publication is switched on, default value is used for result name.
1864 New GEOM.GEOM_Object, containing the created plane.
1866 # Example: see GEOM_TestAll.py
1867 theTrimSize, Parameters = ParseParameters(theTrimSize);
1868 anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
1869 RaiseIfFailed("MakePlane2Vec", self.BasicOp)
1870 anObj.SetParameters(Parameters)
1871 self._autoPublish(anObj, theName, "plane")
1874 ## Create a plane, based on a Local coordinate system.
1875 # @param theLCS coordinate system, defining plane.
1876 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1877 # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
1878 # @param theName Object name; when specified, this parameter is used
1879 # for result publication in the study. Otherwise, if automatic
1880 # publication is switched on, default value is used for result name.
1882 # @return New GEOM.GEOM_Object, containing the created plane.
1884 # @ref tui_creation_plane "Example"
1885 @ManageTransactions("BasicOp")
1886 def MakePlaneLCS(self, theLCS, theTrimSize, theOrientation, theName=None):
1888 Create a plane, based on a Local coordinate system.
1891 theLCS coordinate system, defining plane.
1892 theTrimSize Half size of a side of quadrangle face, representing the plane.
1893 theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
1894 theName Object name; when specified, this parameter is used
1895 for result publication in the study. Otherwise, if automatic
1896 publication is switched on, default value is used for result name.
1899 New GEOM.GEOM_Object, containing the created plane.
1901 # Example: see GEOM_TestAll.py
1902 theTrimSize, Parameters = ParseParameters(theTrimSize);
1903 anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
1904 RaiseIfFailed("MakePlaneLCS", self.BasicOp)
1905 anObj.SetParameters(Parameters)
1906 self._autoPublish(anObj, theName, "plane")
1909 ## Create a local coordinate system.
1910 # @param OX,OY,OZ Three coordinates of coordinate system origin.
1911 # @param XDX,XDY,XDZ Three components of OX direction
1912 # @param YDX,YDY,YDZ Three components of OY direction
1913 # @param theName Object name; when specified, this parameter is used
1914 # for result publication in the study. Otherwise, if automatic
1915 # publication is switched on, default value is used for result name.
1917 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1919 # @ref swig_MakeMarker "Example"
1920 @ManageTransactions("BasicOp")
1921 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, theName=None):
1923 Create a local coordinate system.
1926 OX,OY,OZ Three coordinates of coordinate system origin.
1927 XDX,XDY,XDZ Three components of OX direction
1928 YDX,YDY,YDZ Three components of OY direction
1929 theName Object name; when specified, this parameter is used
1930 for result publication in the study. Otherwise, if automatic
1931 publication is switched on, default value is used for result name.
1934 New GEOM.GEOM_Object, containing the created coordinate system.
1936 # Example: see GEOM_TestAll.py
1937 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
1938 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
1939 RaiseIfFailed("MakeMarker", self.BasicOp)
1940 anObj.SetParameters(Parameters)
1941 self._autoPublish(anObj, theName, "lcs")
1944 ## Create a local coordinate system from shape.
1945 # @param theShape The initial shape to detect the coordinate system.
1946 # @param theName Object name; when specified, this parameter is used
1947 # for result publication in the study. Otherwise, if automatic
1948 # publication is switched on, default value is used for result name.
1950 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1952 # @ref tui_creation_lcs "Example"
1953 @ManageTransactions("BasicOp")
1954 def MakeMarkerFromShape(self, theShape, theName=None):
1956 Create a local coordinate system from shape.
1959 theShape The initial shape to detect the coordinate system.
1960 theName Object name; when specified, this parameter is used
1961 for result publication in the study. Otherwise, if automatic
1962 publication is switched on, default value is used for result name.
1965 New GEOM.GEOM_Object, containing the created coordinate system.
1967 anObj = self.BasicOp.MakeMarkerFromShape(theShape)
1968 RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
1969 self._autoPublish(anObj, theName, "lcs")
1972 ## Create a local coordinate system from point and two vectors.
1973 # @param theOrigin Point of coordinate system origin.
1974 # @param theXVec Vector of X direction
1975 # @param theYVec Vector of Y direction
1976 # @param theName Object name; when specified, this parameter is used
1977 # for result publication in the study. Otherwise, if automatic
1978 # publication is switched on, default value is used for result name.
1980 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1982 # @ref tui_creation_lcs "Example"
1983 @ManageTransactions("BasicOp")
1984 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec, theName=None):
1986 Create a local coordinate system from point and two vectors.
1989 theOrigin Point of coordinate system origin.
1990 theXVec Vector of X direction
1991 theYVec Vector of Y direction
1992 theName Object name; when specified, this parameter is used
1993 for result publication in the study. Otherwise, if automatic
1994 publication is switched on, default value is used for result name.
1997 New GEOM.GEOM_Object, containing the created coordinate system.
2000 anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
2001 RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
2002 self._autoPublish(anObj, theName, "lcs")
2005 # end of l3_basic_go
2008 ## @addtogroup l4_curves
2011 ## Create an arc of circle, passing through three given points.
2012 # @param thePnt1 Start point of the arc.
2013 # @param thePnt2 Middle point of the arc.
2014 # @param thePnt3 End point of the arc.
2015 # @param theName Object name; when specified, this parameter is used
2016 # for result publication in the study. Otherwise, if automatic
2017 # publication is switched on, default value is used for result name.
2019 # @return New GEOM.GEOM_Object, containing the created arc.
2021 # @ref swig_MakeArc "Example"
2022 @ManageTransactions("CurvesOp")
2023 def MakeArc(self, thePnt1, thePnt2, thePnt3, theName=None):
2025 Create an arc of circle, passing through three given points.
2028 thePnt1 Start point of the arc.
2029 thePnt2 Middle point of the arc.
2030 thePnt3 End point of the arc.
2031 theName Object name; when specified, this parameter is used
2032 for result publication in the study. Otherwise, if automatic
2033 publication is switched on, default value is used for result name.
2036 New GEOM.GEOM_Object, containing the created arc.
2038 # Example: see GEOM_TestAll.py
2039 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
2040 RaiseIfFailed("MakeArc", self.CurvesOp)
2041 self._autoPublish(anObj, theName, "arc")
2044 ## Create an arc of circle from a center and 2 points.
2045 # @param thePnt1 Center of the arc
2046 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
2047 # @param thePnt3 End point of the arc (Gives also a direction)
2048 # @param theSense Orientation of the arc
2049 # @param theName Object name; when specified, this parameter is used
2050 # for result publication in the study. Otherwise, if automatic
2051 # publication is switched on, default value is used for result name.
2053 # @return New GEOM.GEOM_Object, containing the created arc.
2055 # @ref swig_MakeArc "Example"
2056 @ManageTransactions("CurvesOp")
2057 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False, theName=None):
2059 Create an arc of circle from a center and 2 points.
2062 thePnt1 Center of the arc
2063 thePnt2 Start point of the arc. (Gives also the radius of the arc)
2064 thePnt3 End point of the arc (Gives also a direction)
2065 theSense Orientation of the arc
2066 theName Object name; when specified, this parameter is used
2067 for result publication in the study. Otherwise, if automatic
2068 publication is switched on, default value is used for result name.
2071 New GEOM.GEOM_Object, containing the created arc.
2073 # Example: see GEOM_TestAll.py
2074 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
2075 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
2076 self._autoPublish(anObj, theName, "arc")
2079 ## Create an arc of ellipse, of center and two points.
2080 # @param theCenter Center of the arc.
2081 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
2082 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2083 # @param theName Object name; when specified, this parameter is used
2084 # for result publication in the study. Otherwise, if automatic
2085 # publication is switched on, default value is used for result name.
2087 # @return New GEOM.GEOM_Object, containing the created arc.
2089 # @ref swig_MakeArc "Example"
2090 @ManageTransactions("CurvesOp")
2091 def MakeArcOfEllipse(self, theCenter, thePnt1, thePnt2, theName=None):
2093 Create an arc of ellipse, of center and two points.
2096 theCenter Center of the arc.
2097 thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
2098 thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2099 theName Object name; when specified, this parameter is used
2100 for result publication in the study. Otherwise, if automatic
2101 publication is switched on, default value is used for result name.
2104 New GEOM.GEOM_Object, containing the created arc.
2106 # Example: see GEOM_TestAll.py
2107 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
2108 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
2109 self._autoPublish(anObj, theName, "arc")
2112 ## Create a circle with given center, normal vector and radius.
2113 # @param thePnt Circle center.
2114 # @param theVec Vector, normal to the plane of the circle.
2115 # @param theR Circle radius.
2116 # @param theName Object name; when specified, this parameter is used
2117 # for result publication in the study. Otherwise, if automatic
2118 # publication is switched on, default value is used for result name.
2120 # @return New GEOM.GEOM_Object, containing the created circle.
2122 # @ref tui_creation_circle "Example"
2123 @ManageTransactions("CurvesOp")
2124 def MakeCircle(self, thePnt, theVec, theR, theName=None):
2126 Create a circle with given center, normal vector and radius.
2129 thePnt Circle center.
2130 theVec Vector, normal to the plane of the circle.
2132 theName Object name; when specified, this parameter is used
2133 for result publication in the study. Otherwise, if automatic
2134 publication is switched on, default value is used for result name.
2137 New GEOM.GEOM_Object, containing the created circle.
2139 # Example: see GEOM_TestAll.py
2140 theR, Parameters = ParseParameters(theR)
2141 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
2142 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
2143 anObj.SetParameters(Parameters)
2144 self._autoPublish(anObj, theName, "circle")
2147 ## Create a circle with given radius.
2148 # Center of the circle will be in the origin of global
2149 # coordinate system and normal vector will be codirected with Z axis
2150 # @param theR Circle radius.
2151 # @param theName Object name; when specified, this parameter is used
2152 # for result publication in the study. Otherwise, if automatic
2153 # publication is switched on, default value is used for result name.
2155 # @return New GEOM.GEOM_Object, containing the created circle.
2156 @ManageTransactions("CurvesOp")
2157 def MakeCircleR(self, theR, theName=None):
2159 Create a circle with given radius.
2160 Center of the circle will be in the origin of global
2161 coordinate system and normal vector will be codirected with Z axis
2165 theName Object name; when specified, this parameter is used
2166 for result publication in the study. Otherwise, if automatic
2167 publication is switched on, default value is used for result name.
2170 New GEOM.GEOM_Object, containing the created circle.
2172 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
2173 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
2174 self._autoPublish(anObj, theName, "circle")
2177 ## Create a circle, passing through three given points
2178 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2179 # @param theName Object name; when specified, this parameter is used
2180 # for result publication in the study. Otherwise, if automatic
2181 # publication is switched on, default value is used for result name.
2183 # @return New GEOM.GEOM_Object, containing the created circle.
2185 # @ref tui_creation_circle "Example"
2186 @ManageTransactions("CurvesOp")
2187 def MakeCircleThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
2189 Create a circle, passing through three given points
2192 thePnt1,thePnt2,thePnt3 Points, defining the circle.
2193 theName Object name; when specified, this parameter is used
2194 for result publication in the study. Otherwise, if automatic
2195 publication is switched on, default value is used for result name.
2198 New GEOM.GEOM_Object, containing the created circle.
2200 # Example: see GEOM_TestAll.py
2201 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
2202 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
2203 self._autoPublish(anObj, theName, "circle")
2206 ## Create a circle, with given point1 as center,
2207 # passing through the point2 as radius and laying in the plane,
2208 # defined by all three given points.
2209 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2210 # @param theName Object name; when specified, this parameter is used
2211 # for result publication in the study. Otherwise, if automatic
2212 # publication is switched on, default value is used for result name.
2214 # @return New GEOM.GEOM_Object, containing the created circle.
2216 # @ref swig_MakeCircle "Example"
2217 @ManageTransactions("CurvesOp")
2218 def MakeCircleCenter2Pnt(self, thePnt1, thePnt2, thePnt3, theName=None):
2220 Create a circle, with given point1 as center,
2221 passing through the point2 as radius and laying in the plane,
2222 defined by all three given points.
2225 thePnt1,thePnt2,thePnt3 Points, defining the circle.
2226 theName Object name; when specified, this parameter is used
2227 for result publication in the study. Otherwise, if automatic
2228 publication is switched on, default value is used for result name.
2231 New GEOM.GEOM_Object, containing the created circle.
2233 # Example: see GEOM_example6.py
2234 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
2235 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
2236 self._autoPublish(anObj, theName, "circle")
2239 ## Create an ellipse with given center, normal vector and radiuses.
2240 # @param thePnt Ellipse center.
2241 # @param theVec Vector, normal to the plane of the ellipse.
2242 # @param theRMajor Major ellipse radius.
2243 # @param theRMinor Minor ellipse radius.
2244 # @param theVecMaj Vector, direction of the ellipse's main axis.
2245 # @param theName Object name; when specified, this parameter is used
2246 # for result publication in the study. Otherwise, if automatic
2247 # publication is switched on, default value is used for result name.
2249 # @return New GEOM.GEOM_Object, containing the created ellipse.
2251 # @ref tui_creation_ellipse "Example"
2252 @ManageTransactions("CurvesOp")
2253 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None, theName=None):
2255 Create an ellipse with given center, normal vector and radiuses.
2258 thePnt Ellipse center.
2259 theVec Vector, normal to the plane of the ellipse.
2260 theRMajor Major ellipse radius.
2261 theRMinor Minor ellipse radius.
2262 theVecMaj Vector, direction of the ellipse's main axis.
2263 theName Object name; when specified, this parameter is used
2264 for result publication in the study. Otherwise, if automatic
2265 publication is switched on, default value is used for result name.
2268 New GEOM.GEOM_Object, containing the created ellipse.
2270 # Example: see GEOM_TestAll.py
2271 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
2272 if theVecMaj is not None:
2273 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
2275 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
2277 RaiseIfFailed("MakeEllipse", self.CurvesOp)
2278 anObj.SetParameters(Parameters)
2279 self._autoPublish(anObj, theName, "ellipse")
2282 ## Create an ellipse with given radiuses.
2283 # Center of the ellipse will be in the origin of global
2284 # coordinate system and normal vector will be codirected with Z axis
2285 # @param theRMajor Major ellipse radius.
2286 # @param theRMinor Minor ellipse radius.
2287 # @param theName Object name; when specified, this parameter is used
2288 # for result publication in the study. Otherwise, if automatic
2289 # publication is switched on, default value is used for result name.
2291 # @return New GEOM.GEOM_Object, containing the created ellipse.
2292 @ManageTransactions("CurvesOp")
2293 def MakeEllipseRR(self, theRMajor, theRMinor, theName=None):
2295 Create an ellipse with given radiuses.
2296 Center of the ellipse will be in the origin of global
2297 coordinate system and normal vector will be codirected with Z axis
2300 theRMajor Major ellipse radius.
2301 theRMinor Minor ellipse radius.
2302 theName Object name; when specified, this parameter is used
2303 for result publication in the study. Otherwise, if automatic
2304 publication is switched on, default value is used for result name.
2307 New GEOM.GEOM_Object, containing the created ellipse.
2309 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
2310 RaiseIfFailed("MakeEllipse", self.CurvesOp)
2311 self._autoPublish(anObj, theName, "ellipse")
2314 ## Create a polyline on the set of points.
2315 # @param thePoints Sequence of points for the polyline.
2316 # @param theIsClosed If True, build a closed wire.
2317 # @param theName Object name; when specified, this parameter is used
2318 # for result publication in the study. Otherwise, if automatic
2319 # publication is switched on, default value is used for result name.
2321 # @return New GEOM.GEOM_Object, containing the created polyline.
2323 # @ref tui_creation_curve "Example"
2324 @ManageTransactions("CurvesOp")
2325 def MakePolyline(self, thePoints, theIsClosed=False, theName=None):
2327 Create a polyline on the set of points.
2330 thePoints Sequence of points for the polyline.
2331 theIsClosed If True, build a closed wire.
2332 theName Object name; when specified, this parameter is used
2333 for result publication in the study. Otherwise, if automatic
2334 publication is switched on, default value is used for result name.
2337 New GEOM.GEOM_Object, containing the created polyline.
2339 # Example: see GEOM_TestAll.py
2340 anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
2341 RaiseIfFailed("MakePolyline", self.CurvesOp)
2342 self._autoPublish(anObj, theName, "polyline")
2345 ## Create bezier curve on the set of points.
2346 # @param thePoints Sequence of points for the bezier curve.
2347 # @param theIsClosed If True, build a closed curve.
2348 # @param theName Object name; when specified, this parameter is used
2349 # for result publication in the study. Otherwise, if automatic
2350 # publication is switched on, default value is used for result name.
2352 # @return New GEOM.GEOM_Object, containing the created bezier curve.
2354 # @ref tui_creation_curve "Example"
2355 @ManageTransactions("CurvesOp")
2356 def MakeBezier(self, thePoints, theIsClosed=False, theName=None):
2358 Create bezier curve on the set of points.
2361 thePoints Sequence of points for the bezier curve.
2362 theIsClosed If True, build a closed curve.
2363 theName Object name; when specified, this parameter is used
2364 for result publication in the study. Otherwise, if automatic
2365 publication is switched on, default value is used for result name.
2368 New GEOM.GEOM_Object, containing the created bezier curve.
2370 # Example: see GEOM_TestAll.py
2371 anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
2372 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
2373 self._autoPublish(anObj, theName, "bezier")
2376 ## Create B-Spline curve on the set of points.
2377 # @param thePoints Sequence of points for the B-Spline curve.
2378 # @param theIsClosed If True, build a closed curve.
2379 # @param theDoReordering If TRUE, the algo does not follow the order of
2380 # \a thePoints but searches for the closest vertex.
2381 # @param theName Object name; when specified, this parameter is used
2382 # for result publication in the study. Otherwise, if automatic
2383 # publication is switched on, default value is used for result name.
2385 # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2387 # @ref tui_creation_curve "Example"
2388 @ManageTransactions("CurvesOp")
2389 def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False, theName=None):
2391 Create B-Spline curve on the set of points.
2394 thePoints Sequence of points for the B-Spline curve.
2395 theIsClosed If True, build a closed curve.
2396 theDoReordering If True, the algo does not follow the order of
2397 thePoints but searches for the closest vertex.
2398 theName Object name; when specified, this parameter is used
2399 for result publication in the study. Otherwise, if automatic
2400 publication is switched on, default value is used for result name.
2403 New GEOM.GEOM_Object, containing the created B-Spline curve.
2405 # Example: see GEOM_TestAll.py
2406 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
2407 RaiseIfFailed("MakeInterpol", self.CurvesOp)
2408 self._autoPublish(anObj, theName, "bspline")
2411 ## Create B-Spline curve on the set of points.
2412 # @param thePoints Sequence of points for the B-Spline curve.
2413 # @param theFirstVec Vector object, defining the curve direction at its first point.
2414 # @param theLastVec Vector object, defining the curve direction at its last point.
2415 # @param theName Object name; when specified, this parameter is used
2416 # for result publication in the study. Otherwise, if automatic
2417 # publication is switched on, default value is used for result name.
2419 # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2421 # @ref tui_creation_curve "Example"
2422 @ManageTransactions("CurvesOp")
2423 def MakeInterpolWithTangents(self, thePoints, theFirstVec, theLastVec, theName=None):
2425 Create B-Spline curve on the set of points.
2428 thePoints Sequence of points for the B-Spline curve.
2429 theFirstVec Vector object, defining the curve direction at its first point.
2430 theLastVec Vector object, defining the curve direction at its last point.
2431 theName Object name; when specified, this parameter is used
2432 for result publication in the study. Otherwise, if automatic
2433 publication is switched on, default value is used for result name.
2436 New GEOM.GEOM_Object, containing the created B-Spline curve.
2438 # Example: see GEOM_TestAll.py
2439 anObj = self.CurvesOp.MakeSplineInterpolWithTangents(thePoints, theFirstVec, theLastVec)
2440 RaiseIfFailed("MakeInterpolWithTangents", self.CurvesOp)
2441 self._autoPublish(anObj, theName, "bspline")
2444 ## Creates a curve using the parametric definition of the basic points.
2445 # @param thexExpr parametric equation of the coordinates X.
2446 # @param theyExpr parametric equation of the coordinates Y.
2447 # @param thezExpr parametric equation of the coordinates Z.
2448 # @param theParamMin the minimal value of the parameter.
2449 # @param theParamMax the maximum value of the parameter.
2450 # @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2451 # @param theCurveType the type of the curve,
2452 # one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2453 # @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.
2454 # @param theName Object name; when specified, this parameter is used
2455 # for result publication in the study. Otherwise, if automatic
2456 # publication is switched on, default value is used for result name.
2458 # @return New GEOM.GEOM_Object, containing the created curve.
2460 # @ref tui_creation_curve "Example"
2461 @ManageTransactions("CurvesOp")
2462 def MakeCurveParametric(self, thexExpr, theyExpr, thezExpr,
2463 theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False, theName=None ):
2465 Creates a curve using the parametric definition of the basic points.
2468 thexExpr parametric equation of the coordinates X.
2469 theyExpr parametric equation of the coordinates Y.
2470 thezExpr parametric equation of the coordinates Z.
2471 theParamMin the minimal value of the parameter.
2472 theParamMax the maximum value of the parameter.
2473 theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2474 theCurveType the type of the curve,
2475 one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2476 theNewMethod flag for switching to the new method if the flag is set to false a deprecated
2477 method is used which can lead to a bug.
2478 theName Object name; when specified, this parameter is used
2479 for result publication in the study. Otherwise, if automatic
2480 publication is switched on, default value is used for result name.
2483 New GEOM.GEOM_Object, containing the created curve.
2485 theParamMin,theParamMax,theParamStep,Parameters = ParseParameters(theParamMin,theParamMax,theParamStep)
2487 anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
2489 anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
2490 RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
2491 anObj.SetParameters(Parameters)
2492 self._autoPublish(anObj, theName, "curve")
2495 ## Create an isoline curve on a face.
2496 # @param theFace the face for which an isoline is created.
2497 # @param IsUIsoline True for U-isoline creation; False for V-isoline
2499 # @param theParameter the U parameter for U-isoline or V parameter
2501 # @param theName Object name; when specified, this parameter is used
2502 # for result publication in the study. Otherwise, if automatic
2503 # publication is switched on, default value is used for result name.
2505 # @return New GEOM.GEOM_Object, containing the created isoline edge or
2506 # a compound of edges.
2508 # @ref tui_creation_curve "Example"
2509 @ManageTransactions("CurvesOp")
2510 def MakeIsoline(self, theFace, IsUIsoline, theParameter, theName=None):
2512 Create an isoline curve on a face.
2515 theFace the face for which an isoline is created.
2516 IsUIsoline True for U-isoline creation; False for V-isoline
2518 theParameter the U parameter for U-isoline or V parameter
2520 theName Object name; when specified, this parameter is used
2521 for result publication in the study. Otherwise, if automatic
2522 publication is switched on, default value is used for result name.
2525 New GEOM.GEOM_Object, containing the created isoline edge or a
2528 # Example: see GEOM_TestAll.py
2529 anObj = self.CurvesOp.MakeIsoline(theFace, IsUIsoline, theParameter)
2530 RaiseIfFailed("MakeIsoline", self.CurvesOp)
2532 self._autoPublish(anObj, theName, "U-Isoline")
2534 self._autoPublish(anObj, theName, "V-Isoline")
2540 ## @addtogroup l3_sketcher
2543 ## Create a sketcher (wire or face), following the textual description,
2544 # passed through <VAR>theCommand</VAR> argument. \n
2545 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
2546 # Format of the description string have to be the following:
2548 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
2551 # - x1, y1 are coordinates of the first sketcher point (zero by default),
2553 # - "R angle" : Set the direction by angle
2554 # - "D dx dy" : Set the direction by DX & DY
2557 # - "TT x y" : Create segment by point at X & Y
2558 # - "T dx dy" : Create segment by point with DX & DY
2559 # - "L length" : Create segment by direction & Length
2560 # - "IX x" : Create segment by direction & Intersect. X
2561 # - "IY y" : Create segment by direction & Intersect. Y
2564 # - "C radius length" : Create arc by direction, radius and length(in degree)
2565 # - "AA x y": Create arc by point at X & Y
2566 # - "A dx dy" : Create arc by point with DX & DY
2567 # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
2568 # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
2569 # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
2570 # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2573 # - "WW" : Close Wire (to finish)
2574 # - "WF" : Close Wire and build face (to finish)
2577 # - Flag1 (= reverse) is 0 or 2 ...
2578 # - if 0 the drawn arc is the one of lower angle (< Pi)
2579 # - if 2 the drawn arc ius the one of greater angle (> Pi)
2582 # - Flag2 (= control tolerance) is 0 or 1 ...
2583 # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
2584 # - if 1 the wire is built only if the end point is on the arc
2585 # with a tolerance of 10^-7 on the distance else the creation fails
2587 # @param theCommand String, defining the sketcher in local
2588 # coordinates of the working plane.
2589 # @param theWorkingPlane Nine double values, defining origin,
2590 # OZ and OX directions of the working plane.
2591 # @param theName Object name; when specified, this parameter is used
2592 # for result publication in the study. Otherwise, if automatic
2593 # publication is switched on, default value is used for result name.
2595 # @return New GEOM.GEOM_Object, containing the created wire.
2597 # @ref tui_sketcher_page "Example"
2598 @ManageTransactions("CurvesOp")
2599 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0], theName=None):
2601 Create a sketcher (wire or face), following the textual description, passed
2602 through theCommand argument.
2603 Edges of the resulting wire or face will be arcs of circles and/or linear segments.
2604 Format of the description string have to be the following:
2605 "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
2607 - x1, y1 are coordinates of the first sketcher point (zero by default),
2609 - "R angle" : Set the direction by angle
2610 - "D dx dy" : Set the direction by DX & DY
2612 - "TT x y" : Create segment by point at X & Y
2613 - "T dx dy" : Create segment by point with DX & DY
2614 - "L length" : Create segment by direction & Length
2615 - "IX x" : Create segment by direction & Intersect. X
2616 - "IY y" : Create segment by direction & Intersect. Y
2618 - "C radius length" : Create arc by direction, radius and length(in degree)
2619 - "AA x y": Create arc by point at X & Y
2620 - "A dx dy" : Create arc by point with DX & DY
2621 - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
2622 - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
2623 - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
2624 - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2626 - "WW" : Close Wire (to finish)
2627 - "WF" : Close Wire and build face (to finish)
2629 - Flag1 (= reverse) is 0 or 2 ...
2630 - if 0 the drawn arc is the one of lower angle (< Pi)
2631 - if 2 the drawn arc ius the one of greater angle (> Pi)
2633 - Flag2 (= control tolerance) is 0 or 1 ...
2634 - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
2635 - if 1 the wire is built only if the end point is on the arc
2636 with a tolerance of 10^-7 on the distance else the creation fails
2639 theCommand String, defining the sketcher in local
2640 coordinates of the working plane.
2641 theWorkingPlane Nine double values, defining origin,
2642 OZ and OX directions of the working plane.
2643 theName Object name; when specified, this parameter is used
2644 for result publication in the study. Otherwise, if automatic
2645 publication is switched on, default value is used for result name.
2648 New GEOM.GEOM_Object, containing the created wire.
2650 # Example: see GEOM_TestAll.py
2651 theCommand,Parameters = ParseSketcherCommand(theCommand)
2652 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
2653 RaiseIfFailed("MakeSketcher", self.CurvesOp)
2654 anObj.SetParameters(Parameters)
2655 self._autoPublish(anObj, theName, "wire")
2658 ## Create a sketcher (wire or face), following the textual description,
2659 # passed through <VAR>theCommand</VAR> argument. \n
2660 # For format of the description string see MakeSketcher() method.\n
2661 # @param theCommand String, defining the sketcher in local
2662 # coordinates of the working plane.
2663 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2664 # @param theName Object name; when specified, this parameter is used
2665 # for result publication in the study. Otherwise, if automatic
2666 # publication is switched on, default value is used for result name.
2668 # @return New GEOM.GEOM_Object, containing the created wire.
2670 # @ref tui_sketcher_page "Example"
2671 @ManageTransactions("CurvesOp")
2672 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane, theName=None):
2674 Create a sketcher (wire or face), following the textual description,
2675 passed through theCommand argument.
2676 For format of the description string see geompy.MakeSketcher() method.
2679 theCommand String, defining the sketcher in local
2680 coordinates of the working plane.
2681 theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2682 theName Object name; when specified, this parameter is used
2683 for result publication in the study. Otherwise, if automatic
2684 publication is switched on, default value is used for result name.
2687 New GEOM.GEOM_Object, containing the created wire.
2689 theCommand,Parameters = ParseSketcherCommand(theCommand)
2690 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
2691 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
2692 anObj.SetParameters(Parameters)
2693 self._autoPublish(anObj, theName, "wire")
2696 ## Obtain a 2D sketcher interface
2697 # @return An instance of @ref gsketcher.Sketcher2D "Sketcher2D" interface
2698 def Sketcher2D (self):
2700 Obtain a 2D sketcher interface.
2703 sk = geompy.Sketcher2D()
2705 sk.addSegmentRelative(15, 70)
2706 sk.addSegmentPerpY(50)
2707 sk.addArcRadiusRelative(25, 15, 14.5, 0)
2708 sk.addArcCenterAbsolute(1, 1, 50, 50, 0, 0)
2709 sk.addArcDirectionRadiusLength(20, 20, 101, 162.13)
2711 Sketch_1 = sk.wire(geomObj_1)
2713 sk = Sketcher2D (self)
2716 ## Create a sketcher wire, following the numerical description,
2717 # passed through <VAR>theCoordinates</VAR> argument. \n
2718 # @param theCoordinates double values, defining points to create a wire,
2720 # @param theName Object name; when specified, this parameter is used
2721 # for result publication in the study. Otherwise, if automatic
2722 # publication is switched on, default value is used for result name.
2724 # @return New GEOM.GEOM_Object, containing the created wire.
2726 # @ref tui_3dsketcher_page "Example"
2727 @ManageTransactions("CurvesOp")
2728 def Make3DSketcher(self, theCoordinates, theName=None):
2730 Create a sketcher wire, following the numerical description,
2731 passed through theCoordinates argument.
2734 theCoordinates double values, defining points to create a wire,
2736 theName Object name; when specified, this parameter is used
2737 for result publication in the study. Otherwise, if automatic
2738 publication is switched on, default value is used for result name.
2741 New GEOM_Object, containing the created wire.
2743 theCoordinates,Parameters = ParseParameters(theCoordinates)
2744 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
2745 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
2746 anObj.SetParameters(Parameters)
2747 self._autoPublish(anObj, theName, "wire")
2750 ## Obtain a 3D sketcher interface
2751 # @return An instance of @ref gsketcher.Sketcher3D "Sketcher3D" interface
2753 # @ref tui_3dsketcher_page "Example"
2754 def Sketcher3D (self):
2756 Obtain a 3D sketcher interface.
2759 sk = geompy.Sketcher3D()
2760 sk.addPointsAbsolute(0,0,0, 70,0,0)
2761 sk.addPointsRelative(0, 0, 130)
2762 sk.addPointAnglesLength("OXY", 50, 0, 100)
2763 sk.addPointAnglesLength("OXZ", 30, 80, 130)
2765 a3D_Sketcher_1 = sk.wire()
2767 sk = Sketcher3D (self)
2770 ## Obtain a 2D polyline creation interface
2771 # @return An instance of @ref gsketcher.Polyline2D "Polyline2D" interface
2773 # @ref tui_3dsketcher_page "Example"
2774 def Polyline2D (self):
2776 Obtain a 2D polyline creation interface.
2779 pl = geompy.Polyline2D()
2780 pl.addSection("section 1", GEOM.Polyline, True)
2781 pl.addPoints(0, 0, 10, 0, 10, 10)
2782 pl.addSection("section 2", GEOM.Interpolation, False)
2783 pl.addPoints(20, 0, 30, 0, 30, 10)
2784 resultObj = pl.result(WorkingPlane)
2786 pl = Polyline2D (self)
2789 # end of l3_sketcher
2792 ## @addtogroup l3_3d_primitives
2795 ## Create a box by coordinates of two opposite vertices.
2797 # @param x1,y1,z1 double values, defining first point it.
2798 # @param x2,y2,z2 double values, defining first point it.
2799 # @param theName Object name; when specified, this parameter is used
2800 # for result publication in the study. Otherwise, if automatic
2801 # publication is switched on, default value is used for result name.
2803 # @return New GEOM.GEOM_Object, containing the created box.
2805 # @ref tui_creation_box "Example"
2806 def MakeBox(self, x1, y1, z1, x2, y2, z2, theName=None):
2808 Create a box by coordinates of two opposite vertices.
2811 x1,y1,z1 double values, defining first point.
2812 x2,y2,z2 double values, defining second point.
2813 theName Object name; when specified, this parameter is used
2814 for result publication in the study. Otherwise, if automatic
2815 publication is switched on, default value is used for result name.
2818 New GEOM.GEOM_Object, containing the created box.
2820 # Example: see GEOM_TestAll.py
2821 pnt1 = self.MakeVertex(x1,y1,z1)
2822 pnt2 = self.MakeVertex(x2,y2,z2)
2823 # note: auto-publishing is done in self.MakeBoxTwoPnt()
2824 return self.MakeBoxTwoPnt(pnt1, pnt2, theName)
2826 ## Create a box with specified dimensions along the coordinate axes
2827 # and with edges, parallel to the coordinate axes.
2828 # Center of the box will be at point (DX/2, DY/2, DZ/2).
2829 # @param theDX Length of Box edges, parallel to OX axis.
2830 # @param theDY Length of Box edges, parallel to OY axis.
2831 # @param theDZ Length of Box edges, parallel to OZ axis.
2832 # @param theName Object name; when specified, this parameter is used
2833 # for result publication in the study. Otherwise, if automatic
2834 # publication is switched on, default value is used for result name.
2836 # @return New GEOM.GEOM_Object, containing the created box.
2838 # @ref tui_creation_box "Example"
2839 @ManageTransactions("PrimOp")
2840 def MakeBoxDXDYDZ(self, theDX, theDY, theDZ, theName=None):
2842 Create a box with specified dimensions along the coordinate axes
2843 and with edges, parallel to the coordinate axes.
2844 Center of the box will be at point (DX/2, DY/2, DZ/2).
2847 theDX Length of Box edges, parallel to OX axis.
2848 theDY Length of Box edges, parallel to OY axis.
2849 theDZ Length of Box edges, parallel to OZ axis.
2850 theName Object name; when specified, this parameter is used
2851 for result publication in the study. Otherwise, if automatic
2852 publication is switched on, default value is used for result name.
2855 New GEOM.GEOM_Object, containing the created box.
2857 # Example: see GEOM_TestAll.py
2858 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
2859 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
2860 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
2861 anObj.SetParameters(Parameters)
2862 self._autoPublish(anObj, theName, "box")
2865 ## Create a box with two specified opposite vertices,
2866 # and with edges, parallel to the coordinate axes
2867 # @param thePnt1 First of two opposite vertices.
2868 # @param thePnt2 Second of two opposite vertices.
2869 # @param theName Object name; when specified, this parameter is used
2870 # for result publication in the study. Otherwise, if automatic
2871 # publication is switched on, default value is used for result name.
2873 # @return New GEOM.GEOM_Object, containing the created box.
2875 # @ref tui_creation_box "Example"
2876 @ManageTransactions("PrimOp")
2877 def MakeBoxTwoPnt(self, thePnt1, thePnt2, theName=None):
2879 Create a box with two specified opposite vertices,
2880 and with edges, parallel to the coordinate axes
2883 thePnt1 First of two opposite vertices.
2884 thePnt2 Second of two opposite vertices.
2885 theName Object name; when specified, this parameter is used
2886 for result publication in the study. Otherwise, if automatic
2887 publication is switched on, default value is used for result name.
2890 New GEOM.GEOM_Object, containing the created box.
2892 # Example: see GEOM_TestAll.py
2893 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
2894 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
2895 self._autoPublish(anObj, theName, "box")
2898 ## Create a face with specified dimensions with edges parallel to coordinate axes.
2899 # @param theH height of Face.
2900 # @param theW width of Face.
2901 # @param theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2902 # @param theName Object name; when specified, this parameter is used
2903 # for result publication in the study. Otherwise, if automatic
2904 # publication is switched on, default value is used for result name.
2906 # @return New GEOM.GEOM_Object, containing the created face.
2908 # @ref tui_creation_face "Example"
2909 @ManageTransactions("PrimOp")
2910 def MakeFaceHW(self, theH, theW, theOrientation, theName=None):
2912 Create a face with specified dimensions with edges parallel to coordinate axes.
2915 theH height of Face.
2917 theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2918 theName Object name; when specified, this parameter is used
2919 for result publication in the study. Otherwise, if automatic
2920 publication is switched on, default value is used for result name.
2923 New GEOM.GEOM_Object, containing the created face.
2925 # Example: see GEOM_TestAll.py
2926 theH,theW,Parameters = ParseParameters(theH, theW)
2927 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
2928 RaiseIfFailed("MakeFaceHW", self.PrimOp)
2929 anObj.SetParameters(Parameters)
2930 self._autoPublish(anObj, theName, "rectangle")
2933 ## Create a face from another plane and two sizes,
2934 # vertical size and horisontal size.
2935 # @param theObj Normale vector to the creating face or
2937 # @param theH Height (vertical size).
2938 # @param theW Width (horisontal size).
2939 # @param theName Object name; when specified, this parameter is used
2940 # for result publication in the study. Otherwise, if automatic
2941 # publication is switched on, default value is used for result name.
2943 # @return New GEOM.GEOM_Object, containing the created face.
2945 # @ref tui_creation_face "Example"
2946 @ManageTransactions("PrimOp")
2947 def MakeFaceObjHW(self, theObj, theH, theW, theName=None):
2949 Create a face from another plane and two sizes,
2950 vertical size and horisontal size.
2953 theObj Normale vector to the creating face or
2955 theH Height (vertical size).
2956 theW Width (horisontal size).
2957 theName Object name; when specified, this parameter is used
2958 for result publication in the study. Otherwise, if automatic
2959 publication is switched on, default value is used for result name.
2962 New GEOM_Object, containing the created face.
2964 # Example: see GEOM_TestAll.py
2965 theH,theW,Parameters = ParseParameters(theH, theW)
2966 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
2967 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
2968 anObj.SetParameters(Parameters)
2969 self._autoPublish(anObj, theName, "rectangle")
2972 ## Create a disk with given center, normal vector and radius.
2973 # @param thePnt Disk center.
2974 # @param theVec Vector, normal to the plane of the disk.
2975 # @param theR Disk radius.
2976 # @param theName Object name; when specified, this parameter is used
2977 # for result publication in the study. Otherwise, if automatic
2978 # publication is switched on, default value is used for result name.
2980 # @return New GEOM.GEOM_Object, containing the created disk.
2982 # @ref tui_creation_disk "Example"
2983 @ManageTransactions("PrimOp")
2984 def MakeDiskPntVecR(self, thePnt, theVec, theR, theName=None):
2986 Create a disk with given center, normal vector and radius.
2990 theVec Vector, normal to the plane of the disk.
2992 theName Object name; when specified, this parameter is used
2993 for result publication in the study. Otherwise, if automatic
2994 publication is switched on, default value is used for result name.
2997 New GEOM.GEOM_Object, containing the created disk.
2999 # Example: see GEOM_TestAll.py
3000 theR,Parameters = ParseParameters(theR)
3001 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
3002 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
3003 anObj.SetParameters(Parameters)
3004 self._autoPublish(anObj, theName, "disk")
3007 ## Create a disk, passing through three given points
3008 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
3009 # @param theName Object name; when specified, this parameter is used
3010 # for result publication in the study. Otherwise, if automatic
3011 # publication is switched on, default value is used for result name.
3013 # @return New GEOM.GEOM_Object, containing the created disk.
3015 # @ref tui_creation_disk "Example"
3016 @ManageTransactions("PrimOp")
3017 def MakeDiskThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
3019 Create a disk, passing through three given points
3022 thePnt1,thePnt2,thePnt3 Points, defining the disk.
3023 theName Object name; when specified, this parameter is used
3024 for result publication in the study. Otherwise, if automatic
3025 publication is switched on, default value is used for result name.
3028 New GEOM.GEOM_Object, containing the created disk.
3030 # Example: see GEOM_TestAll.py
3031 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
3032 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
3033 self._autoPublish(anObj, theName, "disk")
3036 ## Create a disk with specified dimensions along OX-OY coordinate axes.
3037 # @param theR Radius of Face.
3038 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
3039 # @param theName Object name; when specified, this parameter is used
3040 # for result publication in the study. Otherwise, if automatic
3041 # publication is switched on, default value is used for result name.
3043 # @return New GEOM.GEOM_Object, containing the created disk.
3045 # @ref tui_creation_face "Example"
3046 @ManageTransactions("PrimOp")
3047 def MakeDiskR(self, theR, theOrientation, theName=None):
3049 Create a disk with specified dimensions along OX-OY coordinate axes.
3052 theR Radius of Face.
3053 theOrientation set the orientation belong axis OXY or OYZ or OZX
3054 theName Object name; when specified, this parameter is used
3055 for result publication in the study. Otherwise, if automatic
3056 publication is switched on, default value is used for result name.
3059 New GEOM.GEOM_Object, containing the created disk.
3062 Disk3 = geompy.MakeDiskR(100., 1)
3064 # Example: see GEOM_TestAll.py
3065 theR,Parameters = ParseParameters(theR)
3066 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
3067 RaiseIfFailed("MakeDiskR", self.PrimOp)
3068 anObj.SetParameters(Parameters)
3069 self._autoPublish(anObj, theName, "disk")
3072 ## Create a cylinder with given base point, axis, radius and height.
3073 # @param thePnt Central point of cylinder base.
3074 # @param theAxis Cylinder axis.
3075 # @param theR Cylinder radius.
3076 # @param theH Cylinder height.
3077 # @param theName Object name; when specified, this parameter is used
3078 # for result publication in the study. Otherwise, if automatic
3079 # publication is switched on, default value is used for result name.
3081 # @return New GEOM.GEOM_Object, containing the created cylinder.
3083 # @ref tui_creation_cylinder "Example"
3084 @ManageTransactions("PrimOp")
3085 def MakeCylinder(self, thePnt, theAxis, theR, theH, theName=None):
3087 Create a cylinder with given base point, axis, radius and height.
3090 thePnt Central point of cylinder base.
3091 theAxis Cylinder axis.
3092 theR Cylinder radius.
3093 theH Cylinder height.
3094 theName Object name; when specified, this parameter is used
3095 for result publication in the study. Otherwise, if automatic
3096 publication is switched on, default value is used for result name.
3099 New GEOM.GEOM_Object, containing the created cylinder.
3101 # Example: see GEOM_TestAll.py
3102 theR,theH,Parameters = ParseParameters(theR, theH)
3103 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
3104 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
3105 anObj.SetParameters(Parameters)
3106 self._autoPublish(anObj, theName, "cylinder")
3109 ## Create a portion of cylinder with given base point, axis, radius, height and angle.
3110 # @param thePnt Central point of cylinder base.
3111 # @param theAxis Cylinder axis.
3112 # @param theR Cylinder radius.
3113 # @param theH Cylinder height.
3114 # @param theA Cylinder angle in radians.
3115 # @param theName Object name; when specified, this parameter is used
3116 # for result publication in the study. Otherwise, if automatic
3117 # publication is switched on, default value is used for result name.
3119 # @return New GEOM.GEOM_Object, containing the created cylinder.
3121 # @ref tui_creation_cylinder "Example"
3122 @ManageTransactions("PrimOp")
3123 def MakeCylinderA(self, thePnt, theAxis, theR, theH, theA, theName=None):
3125 Create a portion of cylinder with given base point, axis, radius, height and angle.
3128 thePnt Central point of cylinder base.
3129 theAxis Cylinder axis.
3130 theR Cylinder radius.
3131 theH Cylinder height.
3132 theA Cylinder angle in radians.
3133 theName Object name; when specified, this parameter is used
3134 for result publication in the study. Otherwise, if automatic
3135 publication is switched on, default value is used for result name.
3138 New GEOM.GEOM_Object, containing the created cylinder.
3140 # Example: see GEOM_TestAll.py
3142 if isinstance(theA,str):
3144 theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
3146 theA = theA*math.pi/180.
3147 if theA<=0. or theA>=2*math.pi:
3148 raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
3149 anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
3150 RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
3151 anObj.SetParameters(Parameters)
3152 self._autoPublish(anObj, theName, "cylinder")
3155 ## Create a cylinder with given radius and height at
3156 # the origin of coordinate system. Axis of the cylinder
3157 # will be collinear to the OZ axis of the coordinate system.
3158 # @param theR Cylinder radius.
3159 # @param theH Cylinder height.
3160 # @param theName Object name; when specified, this parameter is used
3161 # for result publication in the study. Otherwise, if automatic
3162 # publication is switched on, default value is used for result name.
3164 # @return New GEOM.GEOM_Object, containing the created cylinder.
3166 # @ref tui_creation_cylinder "Example"
3167 @ManageTransactions("PrimOp")
3168 def MakeCylinderRH(self, theR, theH, theName=None):
3170 Create a cylinder with given radius and height at
3171 the origin of coordinate system. Axis of the cylinder
3172 will be collinear to the OZ axis of the coordinate system.
3175 theR Cylinder radius.
3176 theH Cylinder height.
3177 theName Object name; when specified, this parameter is used
3178 for result publication in the study. Otherwise, if automatic
3179 publication is switched on, default value is used for result name.
3182 New GEOM.GEOM_Object, containing the created cylinder.
3184 # Example: see GEOM_TestAll.py
3185 theR,theH,Parameters = ParseParameters(theR, theH)
3186 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
3187 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
3188 anObj.SetParameters(Parameters)
3189 self._autoPublish(anObj, theName, "cylinder")
3192 ## Create a portion of cylinder with given radius, height and angle at
3193 # the origin of coordinate system. Axis of the cylinder
3194 # will be collinear to the OZ axis of the coordinate system.
3195 # @param theR Cylinder radius.
3196 # @param theH Cylinder height.
3197 # @param theA Cylinder angle in radians.
3198 # @param theName Object name; when specified, this parameter is used
3199 # for result publication in the study. Otherwise, if automatic
3200 # publication is switched on, default value is used for result name.
3202 # @return New GEOM.GEOM_Object, containing the created cylinder.
3204 # @ref tui_creation_cylinder "Example"
3205 @ManageTransactions("PrimOp")
3206 def MakeCylinderRHA(self, theR, theH, theA, theName=None):
3208 Create a portion of cylinder with given radius, height and angle at
3209 the origin of coordinate system. Axis of the cylinder
3210 will be collinear to the OZ axis of the coordinate system.
3213 theR Cylinder radius.
3214 theH Cylinder height.
3215 theA Cylinder angle in radians.
3216 theName Object name; when specified, this parameter is used
3217 for result publication in the study. Otherwise, if automatic
3218 publication is switched on, default value is used for result name.
3221 New GEOM.GEOM_Object, containing the created cylinder.
3223 # Example: see GEOM_TestAll.py
3225 if isinstance(theA,str):
3227 theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
3229 theA = theA*math.pi/180.
3230 if theA<=0. or theA>=2*math.pi:
3231 raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
3232 anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
3233 RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
3234 anObj.SetParameters(Parameters)
3235 self._autoPublish(anObj, theName, "cylinder")
3238 ## Create a sphere with given center and radius.
3239 # @param thePnt Sphere center.
3240 # @param theR Sphere radius.
3241 # @param theName Object name; when specified, this parameter is used
3242 # for result publication in the study. Otherwise, if automatic
3243 # publication is switched on, default value is used for result name.
3245 # @return New GEOM.GEOM_Object, containing the created sphere.
3247 # @ref tui_creation_sphere "Example"
3248 @ManageTransactions("PrimOp")
3249 def MakeSpherePntR(self, thePnt, theR, theName=None):
3251 Create a sphere with given center and radius.
3254 thePnt Sphere center.
3256 theName Object name; when specified, this parameter is used
3257 for result publication in the study. Otherwise, if automatic
3258 publication is switched on, default value is used for result name.
3261 New GEOM.GEOM_Object, containing the created sphere.
3263 # Example: see GEOM_TestAll.py
3264 theR,Parameters = ParseParameters(theR)
3265 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
3266 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
3267 anObj.SetParameters(Parameters)
3268 self._autoPublish(anObj, theName, "sphere")
3271 ## Create a sphere with given center and radius.
3272 # @param x,y,z Coordinates of sphere center.
3273 # @param theR Sphere radius.
3274 # @param theName Object name; when specified, this parameter is used
3275 # for result publication in the study. Otherwise, if automatic
3276 # publication is switched on, default value is used for result name.
3278 # @return New GEOM.GEOM_Object, containing the created sphere.
3280 # @ref tui_creation_sphere "Example"
3281 def MakeSphere(self, x, y, z, theR, theName=None):
3283 Create a sphere with given center and radius.
3286 x,y,z Coordinates of sphere center.
3288 theName Object name; when specified, this parameter is used
3289 for result publication in the study. Otherwise, if automatic
3290 publication is switched on, default value is used for result name.
3293 New GEOM.GEOM_Object, containing the created sphere.
3295 # Example: see GEOM_TestAll.py
3296 point = self.MakeVertex(x, y, z)
3297 # note: auto-publishing is done in self.MakeSpherePntR()
3298 anObj = self.MakeSpherePntR(point, theR, theName)
3301 ## Create a sphere with given radius at the origin of coordinate system.
3302 # @param theR Sphere radius.
3303 # @param theName Object name; when specified, this parameter is used
3304 # for result publication in the study. Otherwise, if automatic
3305 # publication is switched on, default value is used for result name.
3307 # @return New GEOM.GEOM_Object, containing the created sphere.
3309 # @ref tui_creation_sphere "Example"
3310 @ManageTransactions("PrimOp")
3311 def MakeSphereR(self, theR, theName=None):
3313 Create a sphere with given radius at the origin of coordinate system.
3317 theName Object name; when specified, this parameter is used
3318 for result publication in the study. Otherwise, if automatic
3319 publication is switched on, default value is used for result name.
3322 New GEOM.GEOM_Object, containing the created sphere.
3324 # Example: see GEOM_TestAll.py
3325 theR,Parameters = ParseParameters(theR)
3326 anObj = self.PrimOp.MakeSphereR(theR)
3327 RaiseIfFailed("MakeSphereR", self.PrimOp)
3328 anObj.SetParameters(Parameters)
3329 self._autoPublish(anObj, theName, "sphere")
3332 ## Create a cone with given base point, axis, height and radiuses.
3333 # @param thePnt Central point of the first cone base.
3334 # @param theAxis Cone axis.
3335 # @param theR1 Radius of the first cone base.
3336 # @param theR2 Radius of the second cone base.
3337 # \note If both radiuses are non-zero, the cone will be truncated.
3338 # \note If the radiuses are equal, a cylinder will be created instead.
3339 # @param theH Cone height.
3340 # @param theName Object name; when specified, this parameter is used
3341 # for result publication in the study. Otherwise, if automatic
3342 # publication is switched on, default value is used for result name.
3344 # @return New GEOM.GEOM_Object, containing the created cone.
3346 # @ref tui_creation_cone "Example"
3347 @ManageTransactions("PrimOp")
3348 def MakeCone(self, thePnt, theAxis, theR1, theR2, theH, theName=None):
3350 Create a cone with given base point, axis, height and radiuses.
3353 thePnt Central point of the first cone base.
3355 theR1 Radius of the first cone base.
3356 theR2 Radius of the second cone base.
3358 theName Object name; when specified, this parameter is used
3359 for result publication in the study. Otherwise, if automatic
3360 publication is switched on, default value is used for result name.
3363 If both radiuses are non-zero, the cone will be truncated.
3364 If the radiuses are equal, a cylinder will be created instead.
3367 New GEOM.GEOM_Object, containing the created cone.
3369 # Example: see GEOM_TestAll.py
3370 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
3371 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
3372 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
3373 anObj.SetParameters(Parameters)
3374 self._autoPublish(anObj, theName, "cone")
3377 ## Create a cone with given height and radiuses at
3378 # the origin of coordinate system. Axis of the cone will
3379 # be collinear to the OZ axis of the coordinate system.
3380 # @param theR1 Radius of the first cone base.
3381 # @param theR2 Radius of the second cone base.
3382 # \note If both radiuses are non-zero, the cone will be truncated.
3383 # \note If the radiuses are equal, a cylinder will be created instead.
3384 # @param theH Cone height.
3385 # @param theName Object name; when specified, this parameter is used
3386 # for result publication in the study. Otherwise, if automatic
3387 # publication is switched on, default value is used for result name.
3389 # @return New GEOM.GEOM_Object, containing the created cone.
3391 # @ref tui_creation_cone "Example"
3392 @ManageTransactions("PrimOp")
3393 def MakeConeR1R2H(self, theR1, theR2, theH, theName=None):
3395 Create a cone with given height and radiuses at
3396 the origin of coordinate system. Axis of the cone will
3397 be collinear to the OZ axis of the coordinate system.
3400 theR1 Radius of the first cone base.
3401 theR2 Radius of the second cone base.
3403 theName Object name; when specified, this parameter is used
3404 for result publication in the study. Otherwise, if automatic
3405 publication is switched on, default value is used for result name.
3408 If both radiuses are non-zero, the cone will be truncated.
3409 If the radiuses are equal, a cylinder will be created instead.
3412 New GEOM.GEOM_Object, containing the created cone.
3414 # Example: see GEOM_TestAll.py
3415 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
3416 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
3417 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
3418 anObj.SetParameters(Parameters)
3419 self._autoPublish(anObj, theName, "cone")
3422 ## Create a torus with given center, normal vector and radiuses.
3423 # @param thePnt Torus central point.
3424 # @param theVec Torus axis of symmetry.
3425 # @param theRMajor Torus major radius.
3426 # @param theRMinor Torus minor radius.
3427 # @param theName Object name; when specified, this parameter is used
3428 # for result publication in the study. Otherwise, if automatic
3429 # publication is switched on, default value is used for result name.
3431 # @return New GEOM.GEOM_Object, containing the created torus.
3433 # @ref tui_creation_torus "Example"
3434 @ManageTransactions("PrimOp")
3435 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor, theName=None):
3437 Create a torus with given center, normal vector and radiuses.
3440 thePnt Torus central point.
3441 theVec Torus axis of symmetry.
3442 theRMajor Torus major radius.
3443 theRMinor Torus minor radius.
3444 theName Object name; when specified, this parameter is used
3445 for result publication in the study. Otherwise, if automatic
3446 publication is switched on, default value is used for result name.
3449 New GEOM.GEOM_Object, containing the created torus.
3451 # Example: see GEOM_TestAll.py
3452 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
3453 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
3454 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
3455 anObj.SetParameters(Parameters)
3456 self._autoPublish(anObj, theName, "torus")
3459 ## Create a torus with given radiuses at the origin of coordinate system.
3460 # @param theRMajor Torus major radius.
3461 # @param theRMinor Torus minor radius.
3462 # @param theName Object name; when specified, this parameter is used
3463 # for result publication in the study. Otherwise, if automatic
3464 # publication is switched on, default value is used for result name.
3466 # @return New GEOM.GEOM_Object, containing the created torus.
3468 # @ref tui_creation_torus "Example"
3469 @ManageTransactions("PrimOp")
3470 def MakeTorusRR(self, theRMajor, theRMinor, theName=None):
3472 Create a torus with given radiuses at the origin of coordinate system.
3475 theRMajor Torus major radius.
3476 theRMinor Torus minor radius.
3477 theName Object name; when specified, this parameter is used
3478 for result publication in the study. Otherwise, if automatic
3479 publication is switched on, default value is used for result name.
3482 New GEOM.GEOM_Object, containing the created torus.
3484 # Example: see GEOM_TestAll.py
3485 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
3486 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
3487 RaiseIfFailed("MakeTorusRR", self.PrimOp)
3488 anObj.SetParameters(Parameters)
3489 self._autoPublish(anObj, theName, "torus")
3492 # end of l3_3d_primitives
3495 ## @addtogroup l3_complex
3498 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
3499 # @param theBase Base shape to be extruded.
3500 # @param thePoint1 First end of extrusion vector.
3501 # @param thePoint2 Second end of extrusion vector.
3502 # @param theScaleFactor Use it to make prism with scaled second base.
3503 # Nagative value means not scaled second base.
3504 # @param theName Object name; when specified, this parameter is used
3505 # for result publication in the study. Otherwise, if automatic
3506 # publication is switched on, default value is used for result name.
3508 # @return New GEOM.GEOM_Object, containing the created prism.
3510 # @ref tui_creation_prism "Example"
3511 @ManageTransactions("PrimOp")
3512 def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0, theName=None):
3514 Create a shape by extrusion of the base shape along a vector, defined by two points.
3517 theBase Base shape to be extruded.
3518 thePoint1 First end of extrusion vector.
3519 thePoint2 Second end of extrusion vector.
3520 theScaleFactor Use it to make prism with scaled second base.
3521 Nagative value means not scaled second base.
3522 theName Object name; when specified, this parameter is used
3523 for result publication in the study. Otherwise, if automatic
3524 publication is switched on, default value is used for result name.
3527 New GEOM.GEOM_Object, containing the created prism.
3529 # Example: see GEOM_TestAll.py
3532 if theScaleFactor > 0:
3533 theScaleFactor,Parameters = ParseParameters(theScaleFactor)
3534 anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor)
3536 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
3537 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
3538 anObj.SetParameters(Parameters)
3539 self._autoPublish(anObj, theName, "prism")
3542 ## Create a shape by extrusion of the base shape along a
3543 # vector, defined by two points, in 2 Ways (forward/backward).
3544 # @param theBase Base shape to be extruded.
3545 # @param thePoint1 First end of extrusion vector.
3546 # @param thePoint2 Second end of extrusion vector.
3547 # @param theName Object name; when specified, this parameter is used
3548 # for result publication in the study. Otherwise, if automatic
3549 # publication is switched on, default value is used for result name.
3551 # @return New GEOM.GEOM_Object, containing the created prism.
3553 # @ref tui_creation_prism "Example"
3554 @ManageTransactions("PrimOp")
3555 def MakePrism2Ways(self, theBase, thePoint1, thePoint2, theName=None):
3557 Create a shape by extrusion of the base shape along a
3558 vector, defined by two points, in 2 Ways (forward/backward).
3561 theBase Base shape to be extruded.
3562 thePoint1 First end of extrusion vector.
3563 thePoint2 Second end of extrusion vector.
3564 theName Object name; when specified, this parameter is used
3565 for result publication in the study. Otherwise, if automatic
3566 publication is switched on, default value is used for result name.
3569 New GEOM.GEOM_Object, containing the created prism.
3571 # Example: see GEOM_TestAll.py
3572 anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
3573 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
3574 self._autoPublish(anObj, theName, "prism")
3577 ## Create a shape by extrusion of the base shape along the vector,
3578 # i.e. all the space, transfixed by the base shape during its translation
3579 # along the vector on the given distance.
3580 # @param theBase Base shape to be extruded.
3581 # @param theVec Direction of extrusion.
3582 # @param theH Prism dimension along theVec.
3583 # @param theScaleFactor Use it to make prism with scaled second base.
3584 # Negative value means not scaled second base.
3585 # @param theName Object name; when specified, this parameter is used
3586 # for result publication in the study. Otherwise, if automatic
3587 # publication is switched on, default value is used for result name.
3589 # @return New GEOM.GEOM_Object, containing the created prism.
3591 # @ref tui_creation_prism "Example"
3592 @ManageTransactions("PrimOp")
3593 def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0, theName=None):
3595 Create a shape by extrusion of the base shape along the vector,
3596 i.e. all the space, transfixed by the base shape during its translation
3597 along the vector on the given distance.
3600 theBase Base shape to be extruded.
3601 theVec Direction of extrusion.
3602 theH Prism dimension along theVec.
3603 theScaleFactor Use it to make prism with scaled second base.
3604 Negative value means not scaled second base.
3605 theName Object name; when specified, this parameter is used
3606 for result publication in the study. Otherwise, if automatic
3607 publication is switched on, default value is used for result name.
3610 New GEOM.GEOM_Object, containing the created prism.
3612 # Example: see GEOM_TestAll.py
3615 if theScaleFactor > 0:
3616 theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor)
3617 anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor)
3619 theH,Parameters = ParseParameters(theH)
3620 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
3621 RaiseIfFailed("MakePrismVecH", self.PrimOp)
3622 anObj.SetParameters(Parameters)
3623 self._autoPublish(anObj, theName, "prism")
3626 ## Create a shape by extrusion of the base shape along the vector,
3627 # i.e. all the space, transfixed by the base shape during its translation
3628 # along the vector on the given distance in 2 Ways (forward/backward).
3629 # @param theBase Base shape to be extruded.
3630 # @param theVec Direction of extrusion.
3631 # @param theH Prism dimension along theVec in forward direction.
3632 # @param theName Object name; when specified, this parameter is used
3633 # for result publication in the study. Otherwise, if automatic
3634 # publication is switched on, default value is used for result name.
3636 # @return New GEOM.GEOM_Object, containing the created prism.
3638 # @ref tui_creation_prism "Example"
3639 @ManageTransactions("PrimOp")
3640 def MakePrismVecH2Ways(self, theBase, theVec, theH, theName=None):
3642 Create a shape by extrusion of the base shape along the vector,
3643 i.e. all the space, transfixed by the base shape during its translation
3644 along the vector on the given distance in 2 Ways (forward/backward).
3647 theBase Base shape to be extruded.
3648 theVec Direction of extrusion.
3649 theH Prism dimension along theVec in forward direction.
3650 theName Object name; when specified, this parameter is used
3651 for result publication in the study. Otherwise, if automatic
3652 publication is switched on, default value is used for result name.
3655 New GEOM.GEOM_Object, containing the created prism.
3657 # Example: see GEOM_TestAll.py
3658 theH,Parameters = ParseParameters(theH)
3659 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
3660 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
3661 anObj.SetParameters(Parameters)
3662 self._autoPublish(anObj, theName, "prism")
3665 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
3666 # @param theBase Base shape to be extruded.
3667 # @param theDX, theDY, theDZ Directions of extrusion.
3668 # @param theScaleFactor Use it to make prism with scaled second base.
3669 # Nagative value means not scaled second base.
3670 # @param theName Object name; when specified, this parameter is used
3671 # for result publication in the study. Otherwise, if automatic
3672 # publication is switched on, default value is used for result name.
3674 # @return New GEOM.GEOM_Object, containing the created prism.
3676 # @ref tui_creation_prism "Example"
3677 @ManageTransactions("PrimOp")
3678 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0, theName=None):
3680 Create a shape by extrusion of the base shape along the dx, dy, dz direction
3683 theBase Base shape to be extruded.
3684 theDX, theDY, theDZ Directions of extrusion.
3685 theScaleFactor Use it to make prism with scaled second base.
3686 Nagative value means not scaled second base.
3687 theName Object name; when specified, this parameter is used
3688 for result publication in the study. Otherwise, if automatic
3689 publication is switched on, default value is used for result name.
3692 New GEOM.GEOM_Object, containing the created prism.
3694 # Example: see GEOM_TestAll.py
3697 if theScaleFactor > 0:
3698 theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor)
3699 anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor)
3701 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
3702 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
3703 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
3704 anObj.SetParameters(Parameters)
3705 self._autoPublish(anObj, theName, "prism")
3708 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
3709 # i.e. all the space, transfixed by the base shape during its translation
3710 # along the vector on the given distance in 2 Ways (forward/backward).
3711 # @param theBase Base shape to be extruded.
3712 # @param theDX, theDY, theDZ Directions of extrusion.
3713 # @param theName Object name; when specified, this parameter is used
3714 # for result publication in the study. Otherwise, if automatic
3715 # publication is switched on, default value is used for result name.
3717 # @return New GEOM.GEOM_Object, containing the created prism.
3719 # @ref tui_creation_prism "Example"
3720 @ManageTransactions("PrimOp")
3721 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ, theName=None):
3723 Create a shape by extrusion of the base shape along the dx, dy, dz direction
3724 i.e. all the space, transfixed by the base shape during its translation
3725 along the vector on the given distance in 2 Ways (forward/backward).
3728 theBase Base shape to be extruded.
3729 theDX, theDY, theDZ Directions of extrusion.
3730 theName Object name; when specified, this parameter is used
3731 for result publication in the study. Otherwise, if automatic
3732 publication is switched on, default value is used for result name.
3735 New GEOM.GEOM_Object, containing the created prism.
3737 # Example: see GEOM_TestAll.py
3738 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
3739 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
3740 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
3741 anObj.SetParameters(Parameters)
3742 self._autoPublish(anObj, theName, "prism")
3745 ## Create a shape by revolution of the base shape around the axis
3746 # on the given angle, i.e. all the space, transfixed by the base
3747 # shape during its rotation around the axis on the given angle.
3748 # @param theBase Base shape to be rotated.
3749 # @param theAxis Rotation axis.
3750 # @param theAngle Rotation angle in radians.
3751 # @param theName Object name; when specified, this parameter is used
3752 # for result publication in the study. Otherwise, if automatic
3753 # publication is switched on, default value is used for result name.
3755 # @return New GEOM.GEOM_Object, containing the created revolution.
3757 # @ref tui_creation_revolution "Example"
3758 @ManageTransactions("PrimOp")
3759 def MakeRevolution(self, theBase, theAxis, theAngle, theName=None):
3761 Create a shape by revolution of the base shape around the axis
3762 on the given angle, i.e. all the space, transfixed by the base
3763 shape during its rotation around the axis on the given angle.
3766 theBase Base shape to be rotated.
3767 theAxis Rotation axis.
3768 theAngle Rotation angle in radians.
3769 theName Object name; when specified, this parameter is used
3770 for result publication in the study. Otherwise, if automatic
3771 publication is switched on, default value is used for result name.
3774 New GEOM.GEOM_Object, containing the created revolution.
3776 # Example: see GEOM_TestAll.py
3777 theAngle,Parameters = ParseParameters(theAngle)
3778 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
3779 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
3780 anObj.SetParameters(Parameters)
3781 self._autoPublish(anObj, theName, "revolution")
3784 ## Create a shape by revolution of the base shape around the axis
3785 # on the given angle, i.e. all the space, transfixed by the base
3786 # shape during its rotation around the axis on the given angle in
3787 # both directions (forward/backward)
3788 # @param theBase Base shape to be rotated.
3789 # @param theAxis Rotation axis.
3790 # @param theAngle Rotation angle in radians.
3791 # @param theName Object name; when specified, this parameter is used
3792 # for result publication in the study. Otherwise, if automatic
3793 # publication is switched on, default value is used for result name.
3795 # @return New GEOM.GEOM_Object, containing the created revolution.
3797 # @ref tui_creation_revolution "Example"
3798 @ManageTransactions("PrimOp")
3799 def MakeRevolution2Ways(self, theBase, theAxis, theAngle, theName=None):
3801 Create a shape by revolution of the base shape around the axis
3802 on the given angle, i.e. all the space, transfixed by the base
3803 shape during its rotation around the axis on the given angle in
3804 both directions (forward/backward).
3807 theBase Base shape to be rotated.
3808 theAxis Rotation axis.
3809 theAngle Rotation angle in radians.
3810 theName Object name; when specified, this parameter is used
3811 for result publication in the study. Otherwise, if automatic
3812 publication is switched on, default value is used for result name.
3815 New GEOM.GEOM_Object, containing the created revolution.
3817 theAngle,Parameters = ParseParameters(theAngle)
3818 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
3819 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
3820 anObj.SetParameters(Parameters)
3821 self._autoPublish(anObj, theName, "revolution")
3824 ## Create a face from a given set of contours.
3825 # @param theContours either a list or a compound of edges/wires.
3826 # @param theMinDeg a minimal degree of BSpline surface to create.
3827 # @param theMaxDeg a maximal degree of BSpline surface to create.
3828 # @param theTol2D a 2d tolerance to be reached.
3829 # @param theTol3D a 3d tolerance to be reached.
3830 # @param theNbIter a number of iteration of approximation algorithm.
3831 # @param theMethod Kind of method to perform filling operation
3832 # (see GEOM.filling_oper_method enum).
3833 # @param isApprox if True, BSpline curves are generated in the process
3834 # of surface construction. By default it is False, that means
3835 # the surface is created using given curves. The usage of
3836 # Approximation makes the algorithm work slower, but allows
3837 # building the surface for rather complex cases.
3838 # @param theName Object name; when specified, this parameter is used
3839 # for result publication in the study. Otherwise, if automatic
3840 # publication is switched on, default value is used for result name.
3842 # @return New GEOM.GEOM_Object (face), containing the created filling surface.
3844 # @ref tui_creation_filling "Example"
3845 @ManageTransactions("PrimOp")
3846 def MakeFilling(self, theContours, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001,
3847 theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0, theName=None):
3849 Create a face from a given set of contours.
3852 theContours either a list or a compound of edges/wires.
3853 theMinDeg a minimal degree of BSpline surface to create.
3854 theMaxDeg a maximal degree of BSpline surface to create.
3855 theTol2D a 2d tolerance to be reached.
3856 theTol3D a 3d tolerance to be reached.
3857 theNbIter a number of iteration of approximation algorithm.
3858 theMethod Kind of method to perform filling operation
3859 (see GEOM.filling_oper_method enum).
3860 isApprox if True, BSpline curves are generated in the process
3861 of surface construction. By default it is False, that means
3862 the surface is created using given curves. The usage of
3863 Approximation makes the algorithm work slower, but allows
3864 building the surface for rather complex cases.
3865 theName Object name; when specified, this parameter is used
3866 for result publication in the study. Otherwise, if automatic
3867 publication is switched on, default value is used for result name.
3870 New GEOM.GEOM_Object (face), containing the created filling surface.
3873 filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5)
3875 # Example: see GEOM_TestAll.py
3876 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
3877 anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
3878 theTol2D, theTol3D, theNbIter,
3879 theMethod, isApprox)
3880 RaiseIfFailed("MakeFilling", self.PrimOp)
3881 anObj.SetParameters(Parameters)
3882 self._autoPublish(anObj, theName, "filling")
3886 ## Create a face from a given set of contours.
3887 # This method corresponds to MakeFilling() with isApprox=True.
3888 # @param theContours either a list or a compound of edges/wires.
3889 # @param theMinDeg a minimal degree of BSpline surface to create.
3890 # @param theMaxDeg a maximal degree of BSpline surface to create.
3891 # @param theTol3D a 3d tolerance to be reached.
3892 # @param theName Object name; when specified, this parameter is used
3893 # for result publication in the study. Otherwise, if automatic
3894 # publication is switched on, default value is used for result name.
3896 # @return New GEOM.GEOM_Object (face), containing the created filling surface.
3898 # @ref tui_creation_filling "Example"
3899 @ManageTransactions("PrimOp")
3900 def MakeFillingNew(self, theContours, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None):
3902 Create a filling from the given compound of contours.
3903 This method corresponds to MakeFilling() with isApprox=True.
3906 theContours either a list or a compound of edges/wires.
3907 theMinDeg a minimal degree of BSpline surface to create.
3908 theMaxDeg a maximal degree of BSpline surface to create.
3909 theTol3D a 3d tolerance to be reached.
3910 theName Object name; when specified, this parameter is used
3911 for result publication in the study. Otherwise, if automatic
3912 publication is switched on, default value is used for result name.
3915 New GEOM.GEOM_Object (face), containing the created filling surface.
3918 filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001)
3920 # Example: see GEOM_TestAll.py
3921 theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D)
3922 anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
3923 0, theTol3D, 0, GEOM.FOM_Default, True)
3924 RaiseIfFailed("MakeFillingNew", self.PrimOp)
3925 anObj.SetParameters(Parameters)
3926 self._autoPublish(anObj, theName, "filling")
3929 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
3930 # @param theSeqSections - set of specified sections.
3931 # @param theModeSolid - mode defining building solid or shell
3932 # @param thePreci - precision 3D used for smoothing
3933 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
3934 # @param theName Object name; when specified, this parameter is used
3935 # for result publication in the study. Otherwise, if automatic
3936 # publication is switched on, default value is used for result name.
3938 # @return New GEOM.GEOM_Object, containing the created shell or solid.
3940 # @ref swig_todo "Example"
3941 @ManageTransactions("PrimOp")
3942 def MakeThruSections(self, theSeqSections, theModeSolid, thePreci, theRuled, theName=None):
3944 Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
3947 theSeqSections - set of specified sections.
3948 theModeSolid - mode defining building solid or shell
3949 thePreci - precision 3D used for smoothing
3950 theRuled - mode defining type of the result surfaces (ruled or smoothed).
3951 theName Object name; when specified, this parameter is used
3952 for result publication in the study. Otherwise, if automatic
3953 publication is switched on, default value is used for result name.
3956 New GEOM.GEOM_Object, containing the created shell or solid.
3958 # Example: see GEOM_TestAll.py
3959 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
3960 RaiseIfFailed("MakeThruSections", self.PrimOp)
3961 self._autoPublish(anObj, theName, "filling")
3964 ## Create a shape by extrusion of the base shape along
3965 # the path shape. The path shape can be a wire or an edge. It is
3966 # possible to generate groups along with the result by means of
3967 # setting the flag \a IsGenerateGroups.<BR>
3968 # If \a thePath is a closed edge or wire and \a IsGenerateGroups is
3969 # set, an error is occurred. If \a thePath is not closed edge/wire,
3970 # the following groups are returned:
3971 # - If \a theBase is unclosed edge or wire: "Down", "Up", "Side1",
3973 # - If \a theBase is closed edge or wire, face or shell: "Down", "Up",
3976 # "Down" and "Up" groups contain:
3977 # - Edges if \a theBase is edge or wire;
3978 # - Faces if \a theBase is face or shell.<BR>
3980 # "Side1" and "Side2" groups contain edges generated from the first
3981 # and last vertices of \a theBase. The first and last vertices are
3982 # determined taking into account edge/wire orientation.<BR>
3983 # "Other" group represents faces generated from the bounding edges of
3986 # @param theBase Base shape to be extruded.
3987 # @param thePath Path shape to extrude the base shape along it.
3988 # @param IsGenerateGroups flag that tells if it is necessary to
3989 # create groups. It is equal to False by default.
3990 # @param theName Object name; when specified, this parameter is used
3991 # for result publication in the study. Otherwise, if automatic
3992 # publication is switched on, default value is used for result name.
3994 # @return New GEOM.GEOM_Object, containing the created pipe if
3995 # \a IsGenerateGroups is not set. Otherwise it returns a
3996 # list of GEOM.GEOM_Object. Its first element is the created pipe, the
3997 # remaining ones are created groups.
3999 # @ref tui_creation_pipe "Example"
4000 @ManageTransactions("PrimOp")
4001 def MakePipe(self, theBase, thePath,
4002 IsGenerateGroups=False, theName=None):
4004 Create a shape by extrusion of the base shape along
4005 the path shape. The path shape can be a wire or an edge. It is
4006 possible to generate groups along with the result by means of
4007 setting the flag IsGenerateGroups.
4008 If thePath is a closed edge or wire and IsGenerateGroups is
4009 set, an error is occurred. If thePath is not closed edge/wire,
4010 the following groups are returned:
4011 - If theBase is unclosed edge or wire: "Down", "Up", "Side1",
4013 - If theBase is closed edge or wire, face or shell: "Down", "Up",
4015 "Down" and "Up" groups contain:
4016 - Edges if theBase is edge or wire;
4017 - Faces if theBase is face or shell.
4018 "Side1" and "Side2" groups contain edges generated from the first
4019 and last vertices of theBase. The first and last vertices are
4020 determined taking into account edge/wire orientation.
4021 "Other" group represents faces generated from the bounding edges of
4025 theBase Base shape to be extruded.
4026 thePath Path shape to extrude the base shape along it.
4027 IsGenerateGroups flag that tells if it is necessary to
4028 create groups. It is equal to False by default.
4029 theName Object name; when specified, this parameter is used
4030 for result publication in the study. Otherwise, if automatic
4031 publication is switched on, default value is used for result name.
4034 New GEOM.GEOM_Object, containing the created pipe if
4035 IsGenerateGroups is not set. Otherwise it returns a
4036 list of GEOM.GEOM_Object. Its first element is the created pipe, the
4037 remaining ones are created groups.
4039 # Example: see GEOM_TestAll.py
4040 aList = self.PrimOp.MakePipe(theBase, thePath, IsGenerateGroups)
4041 RaiseIfFailed("MakePipe", self.PrimOp)
4043 if IsGenerateGroups:
4044 self._autoPublish(aList, theName, "pipe")
4047 self._autoPublish(aList[0], theName, "pipe")
4050 ## Create a shape by extrusion of the profile shape along
4051 # the path shape. The path shape can be a wire or an edge.
4052 # the several profiles can be specified in the several locations of path.
4053 # It is possible to generate groups along with the result by means of
4054 # setting the flag \a IsGenerateGroups. For detailed information on
4055 # groups that can be created please see the method MakePipe().
4056 # @param theSeqBases - list of Bases shape to be extruded.
4057 # @param theLocations - list of locations on the path corresponding
4058 # specified list of the Bases shapes. Number of locations
4059 # should be equal to number of bases or list of locations can be empty.
4060 # @param thePath - Path shape to extrude the base shape along it.
4061 # @param theWithContact - the mode defining that the section is translated to be in
4062 # contact with the spine.
4063 # @param theWithCorrection - defining that the section is rotated to be
4064 # orthogonal to the spine tangent in the correspondent point
4065 # @param IsGenerateGroups - flag that tells if it is necessary to
4066 # create groups. It is equal to False by default.
4067 # @param theName Object name; when specified, this parameter is used
4068 # for result publication in the study. Otherwise, if automatic
4069 # publication is switched on, default value is used for result name.
4071 # @return New GEOM.GEOM_Object, containing the created pipe if
4072 # \a IsGenerateGroups is not set. Otherwise it returns new
4073 # GEOM.ListOfGO. Its first element is the created pipe, the
4074 # remaining ones are created groups.
4076 # @ref tui_creation_pipe_with_diff_sec "Example"
4077 @ManageTransactions("PrimOp")
4078 def MakePipeWithDifferentSections(self, theSeqBases,
4079 theLocations, thePath,
4080 theWithContact, theWithCorrection,
4081 IsGenerateGroups=False, theName=None):
4083 Create a shape by extrusion of the profile shape along
4084 the path shape. The path shape can be a wire or an edge.
4085 the several profiles can be specified in the several locations of path.
4086 It is possible to generate groups along with the result by means of
4087 setting the flag IsGenerateGroups. For detailed information on
4088 groups that can be created please see the method geompy.MakePipe().
4091 theSeqBases - list of Bases shape to be extruded.
4092 theLocations - list of locations on the path corresponding
4093 specified list of the Bases shapes. Number of locations
4094 should be equal to number of bases or list of locations can be empty.
4095 thePath - Path shape to extrude the base shape along it.
4096 theWithContact - the mode defining that the section is translated to be in
4097 contact with the spine(0/1)
4098 theWithCorrection - defining that the section is rotated to be
4099 orthogonal to the spine tangent in the correspondent point (0/1)
4100 IsGenerateGroups - flag that tells if it is necessary to
4101 create groups. It is equal to False by default.
4102 theName Object name; when specified, this parameter is used
4103 for result publication in the study. Otherwise, if automatic
4104 publication is switched on, default value is used for result name.
4107 New GEOM.GEOM_Object, containing the created pipe if
4108 IsGenerateGroups is not set. Otherwise it returns new
4109 GEOM.ListOfGO. Its first element is the created pipe, the
4110 remaining ones are created groups.
4112 aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
4113 theLocations, thePath,
4114 theWithContact, theWithCorrection,
4115 False, IsGenerateGroups)
4116 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
4118 if IsGenerateGroups:
4119 self._autoPublish(aList, theName, "pipe")
4122 self._autoPublish(aList[0], theName, "pipe")
4125 ## Create a shape by extrusion of the profile shape along
4126 # the path shape. This function is a version of
4127 # MakePipeWithDifferentSections() with the same parameters, except
4128 # eliminated theWithContact and theWithCorrection. So it is
4129 # possible to find the description of all parameters is in this
4130 # method. The difference is that this method performs the operation
4131 # step by step, i.e. it creates pipes between each pair of neighbor
4132 # sections and fuses them into a single shape.
4134 # @ref tui_creation_pipe_with_diff_sec "Example"
4135 @ManageTransactions("PrimOp")
4136 def MakePipeWithDifferentSectionsBySteps(self, theSeqBases,
4137 theLocations, thePath,
4138 IsGenerateGroups=False, theName=None):
4140 Create a shape by extrusion of the profile shape along
4141 the path shape. This function is a version of
4142 MakePipeWithDifferentSections() with the same parameters, except
4143 eliminated theWithContact and theWithCorrection. So it is
4144 possible to find the description of all parameters is in this
4145 method. The difference is that this method performs the operation
4146 step by step, i.e. it creates pipes between each pair of neighbor
4147 sections and fuses them into a single shape.
4149 aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
4150 theLocations, thePath,
4152 True, IsGenerateGroups)
4153 RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp)
4155 if IsGenerateGroups:
4156 self._autoPublish(aList, theName, "pipe")
4159 self._autoPublish(aList[0], theName, "pipe")
4162 ## Create a shape by extrusion of the profile shape along
4163 # the path shape. The path shape can be a wire or an edge.
4164 # the several profiles can be specified in the several locations of path.
4165 # It is possible to generate groups along with the result by means of
4166 # setting the flag \a IsGenerateGroups. For detailed information on
4167 # groups that can be created please see the method MakePipe().
4168 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
4169 # shell or face. If number of faces in neighbour sections
4170 # aren't coincided result solid between such sections will
4171 # be created using external boundaries of this shells.
4172 # @param theSeqSubBases - list of corresponding sub-shapes of section shapes.
4173 # This list is used for searching correspondences between
4174 # faces in the sections. Size of this list must be equal
4175 # to size of list of base shapes.
4176 # @param theLocations - list of locations on the path corresponding
4177 # specified list of the Bases shapes. Number of locations
4178 # should be equal to number of bases. First and last
4179 # locations must be coincided with first and last vertexes
4180 # of path correspondingly.
4181 # @param thePath - Path shape to extrude the base shape along it.
4182 # @param theWithContact - the mode defining that the section is translated to be in
4183 # contact with the spine.
4184 # @param theWithCorrection - defining that the section is rotated to be
4185 # orthogonal to the spine tangent in the correspondent point
4186 # @param IsGenerateGroups - flag that tells if it is necessary to
4187 # create groups. It is equal to False by default.
4188 # @param theName Object name; when specified, this parameter is used
4189 # for result publication in the study. Otherwise, if automatic
4190 # publication is switched on, default value is used for result name.
4192 # @return New GEOM.GEOM_Object, containing the created solids if
4193 # \a IsGenerateGroups is not set. Otherwise it returns new
4194 # GEOM.ListOfGO. Its first element is the created solids, the
4195 # remaining ones are created groups.
4197 # @ref tui_creation_pipe_with_shell_sec "Example"
4198 @ManageTransactions("PrimOp")
4199 def MakePipeWithShellSections(self, theSeqBases, theSeqSubBases,
4200 theLocations, thePath,
4201 theWithContact, theWithCorrection,
4202 IsGenerateGroups=False, theName=None):
4204 Create a shape by extrusion of the profile shape along
4205 the path shape. The path shape can be a wire or an edge.
4206 the several profiles can be specified in the several locations of path.
4207 It is possible to generate groups along with the result by means of
4208 setting the flag IsGenerateGroups. For detailed information on
4209 groups that can be created please see the method geompy.MakePipe().
4212 theSeqBases - list of Bases shape to be extruded. Base shape must be
4213 shell or face. If number of faces in neighbour sections
4214 aren't coincided result solid between such sections will
4215 be created using external boundaries of this shells.
4216 theSeqSubBases - list of corresponding sub-shapes of section shapes.
4217 This list is used for searching correspondences between
4218 faces in the sections. Size of this list must be equal
4219 to size of list of base shapes.
4220 theLocations - list of locations on the path corresponding
4221 specified list of the Bases shapes. Number of locations
4222 should be equal to number of bases. First and last
4223 locations must be coincided with first and last vertexes
4224 of path correspondingly.
4225 thePath - Path shape to extrude the base shape along it.
4226 theWithContact - the mode defining that the section is translated to be in
4227 contact with the spine (0/1)
4228 theWithCorrection - defining that the section is rotated to be
4229 orthogonal to the spine tangent in the correspondent point (0/1)
4230 IsGenerateGroups - flag that tells if it is necessary to
4231 create groups. It is equal to False by default.
4232 theName Object name; when specified, this parameter is used
4233 for result publication in the study. Otherwise, if automatic
4234 publication is switched on, default value is used for result name.
4237 New GEOM.GEOM_Object, containing the created solids if
4238 IsGenerateGroups is not set. Otherwise it returns new
4239 GEOM.ListOfGO. Its first element is the created solids, the
4240 remaining ones are created groups.
4242 aList = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
4243 theLocations, thePath,
4244 theWithContact, theWithCorrection,
4246 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
4248 if IsGenerateGroups:
4249 self._autoPublish(aList, theName, "pipe")
4252 self._autoPublish(aList[0], theName, "pipe")
4255 ## Create a shape by extrusion of the profile shape along
4256 # the path shape. This function is used only for debug pipe
4257 # functionality - it is a version of function MakePipeWithShellSections()
4258 # which give a possibility to receive information about
4259 # creating pipe between each pair of sections step by step.
4260 @ManageTransactions("PrimOp")
4261 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
4262 theLocations, thePath,
4263 theWithContact, theWithCorrection,
4264 IsGenerateGroups=False, theName=None):
4266 Create a shape by extrusion of the profile shape along
4267 the path shape. This function is used only for debug pipe
4268 functionality - it is a version of previous function
4269 geompy.MakePipeWithShellSections() which give a possibility to
4270 receive information about creating pipe between each pair of
4271 sections step by step.
4274 nbsect = len(theSeqBases)
4275 nbsubsect = len(theSeqSubBases)
4276 #print "nbsect = ",nbsect
4277 for i in range(1,nbsect):
4279 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
4280 tmpLocations = [ theLocations[i-1], theLocations[i] ]
4282 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
4283 aList = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
4284 tmpLocations, thePath,
4285 theWithContact, theWithCorrection,
4287 if self.PrimOp.IsDone() == 0:
4288 print("Problems with pipe creation between ",i," and ",i+1," sections")
4289 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
4292 print("Pipe between ",i," and ",i+1," sections is OK")
4293 res.append(aList[0])
4297 resc = self.MakeCompound(res)
4298 #resc = self.MakeSewing(res, 0.001)
4299 #print "resc: ",resc
4300 self._autoPublish(resc, theName, "pipe")
4303 ## Create solids between given sections.
4304 # It is possible to generate groups along with the result by means of
4305 # setting the flag \a IsGenerateGroups. For detailed information on
4306 # groups that can be created please see the method MakePipe().
4307 # @param theSeqBases - list of sections (shell or face).
4308 # @param theLocations - list of corresponding vertexes
4309 # @param IsGenerateGroups - flag that tells if it is necessary to
4310 # create groups. It is equal to False by default.
4311 # @param theName Object name; when specified, this parameter is used
4312 # for result publication in the study. Otherwise, if automatic
4313 # publication is switched on, default value is used for result name.
4315 # @return New GEOM.GEOM_Object, containing the created solids if
4316 # \a IsGenerateGroups is not set. Otherwise it returns new
4317 # GEOM.ListOfGO. Its first element is the created solids, the
4318 # remaining ones are created groups.
4320 # @ref tui_creation_pipe_without_path "Example"
4321 @ManageTransactions("PrimOp")
4322 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations,
4323 IsGenerateGroups=False, theName=None):
4325 Create solids between given sections.
4326 It is possible to generate groups along with the result by means of
4327 setting the flag IsGenerateGroups. For detailed information on
4328 groups that can be created please see the method geompy.MakePipe().
4331 theSeqBases - list of sections (shell or face).
4332 theLocations - list of corresponding vertexes
4333 IsGenerateGroups - flag that tells if it is necessary to
4334 create groups. It is equal to False by default.
4335 theName Object name; when specified, this parameter is used
4336 for result publication in the study. Otherwise, if automatic
4337 publication is switched on, default value is used for result name.
4340 New GEOM.GEOM_Object, containing the created solids if
4341 IsGenerateGroups is not set. Otherwise it returns new
4342 GEOM.ListOfGO. Its first element is the created solids, the
4343 remaining ones are created groups.
4345 aList = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations,
4347 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
4349 if IsGenerateGroups:
4350 self._autoPublish(aList, theName, "pipe")
4353 self._autoPublish(aList[0], theName, "pipe")
4356 ## Create a shape by extrusion of the base shape along
4357 # the path shape with constant bi-normal direction along the given vector.
4358 # The path shape can be a wire or an edge.
4359 # It is possible to generate groups along with the result by means of
4360 # setting the flag \a IsGenerateGroups. For detailed information on
4361 # groups that can be created please see the method MakePipe().
4362 # @param theBase Base shape to be extruded.
4363 # @param thePath Path shape to extrude the base shape along it.
4364 # @param theVec Vector defines a constant binormal direction to keep the
4365 # same angle between the direction and the sections
4366 # along the sweep surface.
4367 # @param IsGenerateGroups flag that tells if it is necessary to
4368 # create groups. It is equal to False by default.
4369 # @param theName Object name; when specified, this parameter is used
4370 # for result publication in the study. Otherwise, if automatic
4371 # publication is switched on, default value is used for result name.
4373 # @return New GEOM.GEOM_Object, containing the created pipe if
4374 # \a IsGenerateGroups is not set. Otherwise it returns new
4375 # GEOM.ListOfGO. Its first element is the created pipe, the
4376 # remaining ones are created groups.
4378 # @ref tui_creation_pipe "Example"
4379 @ManageTransactions("PrimOp")
4380 def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec,
4381 IsGenerateGroups=False, theName=None):
4383 Create a shape by extrusion of the base shape along
4384 the path shape with constant bi-normal direction along the given vector.
4385 The path shape can be a wire or an edge.
4386 It is possible to generate groups along with the result by means of
4387 setting the flag IsGenerateGroups. For detailed information on
4388 groups that can be created please see the method geompy.MakePipe().
4391 theBase Base shape to be extruded.
4392 thePath Path shape to extrude the base shape along it.
4393 theVec Vector defines a constant binormal direction to keep the
4394 same angle between the direction and the sections
4395 along the sweep surface.
4396 IsGenerateGroups flag that tells if it is necessary to
4397 create groups. It is equal to False by default.
4398 theName Object name; when specified, this parameter is used
4399 for result publication in the study. Otherwise, if automatic
4400 publication is switched on, default value is used for result name.
4403 New GEOM.GEOM_Object, containing the created pipe if
4404 IsGenerateGroups is not set. Otherwise it returns new
4405 GEOM.ListOfGO. Its first element is the created pipe, the
4406 remaining ones are created groups.
4408 # Example: see GEOM_TestAll.py
4409 aList = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath,
4410 theVec, IsGenerateGroups)
4411 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
4413 if IsGenerateGroups:
4414 self._autoPublish(aList, theName, "pipe")
4417 self._autoPublish(aList[0], theName, "pipe")
4420 ## Makes a thick solid from a shape. If the input is a surface shape
4421 # (face or shell) the result is a thick solid. If an input shape is
4422 # a solid the result is a hollowed solid with removed faces.
4423 # @param theShape Face or Shell to get thick solid or solid to get
4425 # @param theThickness Thickness of the resulting solid
4426 # @param theFacesIDs the list of face IDs to be removed from the
4427 # result. It is ignored if \a theShape is a face or a shell.
4428 # It is empty by default.
4429 # @param theInside If true the thickness is applied towards inside
4430 # @param theName Object name; when specified, this parameter is used
4431 # for result publication in the study. Otherwise, if automatic
4432 # publication is switched on, default value is used for result name.
4434 # @return New GEOM.GEOM_Object, containing the created solid
4436 # @ref tui_creation_thickness "Example"
4437 @ManageTransactions("PrimOp")
4438 def MakeThickSolid(self, theShape, theThickness,
4439 theFacesIDs=[], theInside=False, theName=None):
4441 Make a thick solid from a shape. If the input is a surface shape
4442 (face or shell) the result is a thick solid. If an input shape is
4443 a solid the result is a hollowed solid with removed faces.
4446 theShape Face or Shell to get thick solid or solid to get
4448 theThickness Thickness of the resulting solid
4449 theFacesIDs the list of face IDs to be removed from the
4450 result. It is ignored if theShape is a face or a
4451 shell. It is empty by default.
4452 theInside If true the thickness is applied towards inside
4453 theName Object name; when specified, this parameter is used
4454 for result publication in the study. Otherwise, if automatic
4455 publication is switched on, default value is used for result name.
4458 New GEOM.GEOM_Object, containing the created solid
4460 # Example: see GEOM_TestAll.py
4461 theThickness,Parameters = ParseParameters(theThickness)
4462 anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
4463 theThickness, True, theInside)
4464 RaiseIfFailed("MakeThickSolid", self.PrimOp)
4465 anObj.SetParameters(Parameters)
4466 self._autoPublish(anObj, theName, "thickSolid")
4470 ## Modifies a shape to make it a thick solid. If the input is a surface
4471 # shape (face or shell) the result is a thick solid. If an input shape
4472 # is a solid the result is a hollowed solid with removed faces.
4473 # @param theShape Face or Shell to get thick solid or solid to get
4475 # @param theThickness Thickness of the resulting solid
4476 # @param theFacesIDs the list of face IDs to be removed from the
4477 # result. It is ignored if \a theShape is a face or a shell.
4478 # It is empty by default.
4479 # @param theInside If true the thickness is applied towards inside
4481 # @return The modified shape
4483 # @ref tui_creation_thickness "Example"
4484 @ManageTransactions("PrimOp")
4485 def Thicken(self, theShape, theThickness, theFacesIDs=[], theInside=False):
4487 Modifies a shape to make it a thick solid. If the input is a
4488 surface shape (face or shell) the result is a thick solid. If
4489 an input shape is a solid the result is a hollowed solid with
4493 theShape Face or Shell to get thick solid or solid to get
4495 theThickness Thickness of the resulting solid
4496 theFacesIDs the list of face IDs to be removed from the
4497 result. It is ignored if \a theShape is a face or
4498 a shell. It is empty by default.
4499 theInside If true the thickness is applied towards inside
4504 # Example: see GEOM_TestAll.py
4505 theThickness,Parameters = ParseParameters(theThickness)
4506 anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
4507 theThickness, False, theInside)
4508 RaiseIfFailed("Thicken", self.PrimOp)
4509 anObj.SetParameters(Parameters)
4512 ## Build a middle path of a pipe-like shape.
4513 # The path shape can be a wire or an edge.
4514 # @param theShape It can be closed or unclosed pipe-like shell
4515 # or a pipe-like solid.
4516 # @param theBase1, theBase2 Two bases of the supposed pipe. This
4517 # should be wires or faces of theShape.
4518 # @param theName Object name; when specified, this parameter is used
4519 # for result publication in the study. Otherwise, if automatic
4520 # publication is switched on, default value is used for result name.
4522 # @note It is not assumed that exact or approximate copy of theShape
4523 # can be obtained by applying existing Pipe operation on the
4524 # resulting "Path" wire taking theBase1 as the base - it is not
4525 # always possible; though in some particular cases it might work
4526 # it is not guaranteed. Thus, RestorePath function should not be
4527 # considered as an exact reverse operation of the Pipe.
4529 # @return New GEOM.GEOM_Object, containing an edge or wire that represent
4530 # source pipe's "path".
4532 # @ref tui_creation_pipe_path "Example"
4533 @ManageTransactions("PrimOp")
4534 def RestorePath (self, theShape, theBase1, theBase2, theName=None):
4536 Build a middle path of a pipe-like shape.
4537 The path shape can be a wire or an edge.
4540 theShape It can be closed or unclosed pipe-like shell
4541 or a pipe-like solid.
4542 theBase1, theBase2 Two bases of the supposed pipe. This
4543 should be wires or faces of theShape.
4544 theName Object name; when specified, this parameter is used
4545 for result publication in the study. Otherwise, if automatic
4546 publication is switched on, default value is used for result name.
4549 New GEOM_Object, containing an edge or wire that represent
4552 anObj = self.PrimOp.RestorePath(theShape, theBase1, theBase2)
4553 RaiseIfFailed("RestorePath", self.PrimOp)
4554 self._autoPublish(anObj, theName, "path")
4557 ## Build a middle path of a pipe-like shape.
4558 # The path shape can be a wire or an edge.
4559 # @param theShape It can be closed or unclosed pipe-like shell
4560 # or a pipe-like solid.
4561 # @param listEdges1, listEdges2 Two bases of the supposed pipe. This
4562 # should be lists of edges of theShape.
4563 # @param theName Object name; when specified, this parameter is used
4564 # for result publication in the study. Otherwise, if automatic
4565 # publication is switched on, default value is used for result name.
4567 # @note It is not assumed that exact or approximate copy of theShape
4568 # can be obtained by applying existing Pipe operation on the
4569 # resulting "Path" wire taking theBase1 as the base - it is not
4570 # always possible; though in some particular cases it might work
4571 # it is not guaranteed. Thus, RestorePath function should not be
4572 # considered as an exact reverse operation of the Pipe.
4574 # @return New GEOM.GEOM_Object, containing an edge or wire that represent
4575 # source pipe's "path".
4577 # @ref tui_creation_pipe_path "Example"
4578 @ManageTransactions("PrimOp")
4579 def RestorePathEdges (self, theShape, listEdges1, listEdges2, theName=None):
4581 Build a middle path of a pipe-like shape.
4582 The path shape can be a wire or an edge.
4585 theShape It can be closed or unclosed pipe-like shell
4586 or a pipe-like solid.
4587 listEdges1, listEdges2 Two bases of the supposed pipe. This
4588 should be lists of edges of theShape.
4589 theName Object name; when specified, this parameter is used
4590 for result publication in the study. Otherwise, if automatic
4591 publication is switched on, default value is used for result name.
4594 New GEOM_Object, containing an edge or wire that represent
4597 anObj = self.PrimOp.RestorePathEdges(theShape, listEdges1, listEdges2)
4598 RaiseIfFailed("RestorePath", self.PrimOp)
4599 self._autoPublish(anObj, theName, "path")
4605 ## @addtogroup l3_basic_go
4608 ## Create a linear edge with specified ends.
4609 # @param thePnt1 Point for the first end of edge.
4610 # @param thePnt2 Point for the second end of edge.
4611 # @param theName Object name; when specified, this parameter is used
4612 # for result publication in the study. Otherwise, if automatic
4613 # publication is switched on, default value is used for result name.
4615 # @return New GEOM.GEOM_Object, containing the created edge.
4617 # @ref tui_creation_edge "Example"
4618 @ManageTransactions("ShapesOp")
4619 def MakeEdge(self, thePnt1, thePnt2, theName=None):
4621 Create a linear edge with specified ends.
4624 thePnt1 Point for the first end of edge.
4625 thePnt2 Point for the second end of edge.
4626 theName Object name; when specified, this parameter is used
4627 for result publication in the study. Otherwise, if automatic
4628 publication is switched on, default value is used for result name.
4631 New GEOM.GEOM_Object, containing the created edge.
4633 # Example: see GEOM_TestAll.py
4634 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
4635 RaiseIfFailed("MakeEdge", self.ShapesOp)
4636 self._autoPublish(anObj, theName, "edge")
4639 ## Create a new edge, corresponding to the given length on the given curve.
4640 # @param theRefCurve The referenced curve (edge).
4641 # @param theLength Length on the referenced curve. It can be negative.
4642 # @param theStartPoint Any point can be selected for it, the new edge will begin
4643 # at the end of \a theRefCurve, close to the selected point.
4644 # If None, start from the first point of \a theRefCurve.
4645 # @param theName Object name; when specified, this parameter is used
4646 # for result publication in the study. Otherwise, if automatic
4647 # publication is switched on, default value is used for result name.
4649 # @return New GEOM.GEOM_Object, containing the created edge.
4651 # @ref tui_creation_edge "Example"
4652 @ManageTransactions("ShapesOp")
4653 def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
4655 Create a new edge, corresponding to the given length on the given curve.
4658 theRefCurve The referenced curve (edge).
4659 theLength Length on the referenced curve. It can be negative.
4660 theStartPoint Any point can be selected for it, the new edge will begin
4661 at the end of theRefCurve, close to the selected point.
4662 If None, start from the first point of theRefCurve.
4663 theName Object name; when specified, this parameter is used
4664 for result publication in the study. Otherwise, if automatic
4665 publication is switched on, default value is used for result name.
4668 New GEOM.GEOM_Object, containing the created edge.
4670 # Example: see GEOM_TestAll.py
4671 theLength, Parameters = ParseParameters(theLength)
4672 anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
4673 RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp)
4674 anObj.SetParameters(Parameters)
4675 self._autoPublish(anObj, theName, "edge")
4678 ## Create an edge from specified wire.
4679 # @param theWire source Wire
4680 # @param theLinearTolerance linear tolerance value (default = 1e-07)
4681 # @param theAngularTolerance angular tolerance value (default = 1e-12)
4682 # @param theName Object name; when specified, this parameter is used
4683 # for result publication in the study. Otherwise, if automatic
4684 # publication is switched on, default value is used for result name.
4686 # @return New GEOM.GEOM_Object, containing the created edge.
4688 # @ref tui_creation_edge "Example"
4689 @ManageTransactions("ShapesOp")
4690 def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12, theName=None):
4692 Create an edge from specified wire.
4696 theLinearTolerance linear tolerance value (default = 1e-07)
4697 theAngularTolerance angular tolerance value (default = 1e-12)
4698 theName Object name; when specified, this parameter is used
4699 for result publication in the study. Otherwise, if automatic
4700 publication is switched on, default value is used for result name.
4703 New GEOM.GEOM_Object, containing the created edge.
4705 # Example: see GEOM_TestAll.py
4706 anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
4707 RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
4708 self._autoPublish(anObj, theName, "edge")
4711 ## Create a wire from the set of edges and wires.
4712 # @param theEdgesAndWires List of edges and/or wires.
4713 # @param theTolerance Maximum distance between vertices, that will be merged.
4714 # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion())
4715 # @param theName Object name; when specified, this parameter is used
4716 # for result publication in the study. Otherwise, if automatic
4717 # publication is switched on, default value is used for result name.
4719 # @return New GEOM.GEOM_Object, containing the created wire.
4721 # @ref tui_creation_wire "Example"
4722 @ManageTransactions("ShapesOp")
4723 def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07, theName=None):
4725 Create a wire from the set of edges and wires.
4728 theEdgesAndWires List of edges and/or wires.
4729 theTolerance Maximum distance between vertices, that will be merged.
4730 Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
4731 theName Object name; when specified, this parameter is used
4732 for result publication in the study. Otherwise, if automatic
4733 publication is switched on, default value is used for result name.
4736 New GEOM.GEOM_Object, containing the created wire.
4738 # Example: see GEOM_TestAll.py
4739 anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
4740 RaiseIfFailed("MakeWire", self.ShapesOp)
4741 self._autoPublish(anObj, theName, "wire")
4744 ## Create a face on the given wire.
4745 # @param theWire closed Wire or Edge to build the face on.
4746 # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4747 # If the tolerance of the obtained planar face is less
4748 # than 1e-06, this face will be returned, otherwise the
4749 # algorithm tries to build any suitable face on the given
4750 # wire and prints a warning message.
4751 # @param theName Object name; when specified, this parameter is used
4752 # for result publication in the study. Otherwise, if automatic
4753 # publication is switched on, default value is used for result name.
4755 # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
4757 # @ref tui_creation_face "Example"
4758 @ManageTransactions("ShapesOp")
4759 def MakeFace(self, theWire, isPlanarWanted, theName=None, raiseException=False):
4761 Create a face on the given wire.
4764 theWire closed Wire or Edge to build the face on.
4765 isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4766 If the tolerance of the obtained planar face is less
4767 than 1e-06, this face will be returned, otherwise the
4768 algorithm tries to build any suitable face on the given
4769 wire and prints a warning message.
4770 theName Object name; when specified, this parameter is used
4771 for result publication in the study. Otherwise, if automatic
4772 publication is switched on, default value is used for result name.
4775 New GEOM.GEOM_Object, containing the created face (compound of faces).
4777 # Example: see GEOM_TestAll.py
4778 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
4779 if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
4780 PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
4782 RaiseIfFailed("MakeFace", self.ShapesOp)
4783 self._autoPublish(anObj, theName, "face")
4786 ## Create a face on the given wires set.
4787 # @param theWires List of closed wires or edges to build the face on.
4788 # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4789 # If the tolerance of the obtained planar face is less
4790 # than 1e-06, this face will be returned, otherwise the
4791 # algorithm tries to build any suitable face on the given
4792 # wire and prints a warning message.
4793 # @param theName Object name; when specified, this parameter is used
4794 # for result publication in the study. Otherwise, if automatic
4795 # publication is switched on, default value is used for result name.
4797 # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
4799 # @ref tui_creation_face "Example"
4800 @ManageTransactions("ShapesOp")
4801 def MakeFaceWires(self, theWires, isPlanarWanted, theName=None, raiseException=False):
4803 Create a face on the given wires set.
4806 theWires List of closed wires or edges to build the face on.
4807 isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4808 If the tolerance of the obtained planar face is less
4809 than 1e-06, this face will be returned, otherwise the
4810 algorithm tries to build any suitable face on the given
4811 wire and prints a warning message.
4812 theName Object name; when specified, this parameter is used
4813 for result publication in the study. Otherwise, if automatic
4814 publication is switched on, default value is used for result name.
4817 New GEOM.GEOM_Object, containing the created face (compound of faces).
4819 # Example: see GEOM_TestAll.py
4820 anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
4821 if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
4822 PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
4824 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
4825 self._autoPublish(anObj, theName, "face")
4828 ## See MakeFaceWires() method for details.
4830 # @ref tui_creation_face "Example 1"
4831 # \n @ref swig_MakeFaces "Example 2"
4832 def MakeFaces(self, theWires, isPlanarWanted, theName=None):
4834 See geompy.MakeFaceWires() method for details.
4836 # Example: see GEOM_TestOthers.py
4837 # note: auto-publishing is done in self.MakeFaceWires()
4838 anObj = self.MakeFaceWires(theWires, isPlanarWanted, theName)
4841 ## Create a face based on a surface from given face bounded
4843 # @param theFace the face whose surface is used to create a new face.
4844 # @param theWire the wire that will bound a new face.
4845 # @param theName Object name; when specified, this parameter is used
4846 # for result publication in the study. Otherwise, if automatic
4847 # publication is switched on, default value is used for result name.
4849 # @return New GEOM.GEOM_Object, containing the created face.
4851 # @ref tui_creation_face "Example"
4852 @ManageTransactions("ShapesOp")
4853 def MakeFaceFromSurface(self, theFace, theWire, theName=None):
4855 Create a face based on a surface from given face bounded
4859 theFace the face whose surface is used to create a new face.
4860 theWire the wire that will bound a new face.
4861 theName Object name; when specified, this parameter is used
4862 for result publication in the study. Otherwise, if automatic
4863 publication is switched on, default value is used for result name.
4866 New GEOM.GEOM_Object, containing the created face.
4868 # Example: see GEOM_TestAll.py
4869 anObj = self.ShapesOp.MakeFaceFromSurface(theFace, theWire)
4870 RaiseIfFailed("MakeFaceFromSurface", self.ShapesOp)
4871 self._autoPublish(anObj, theName, "face")
4874 ## Create a face from a set of edges with the given constraints.
4875 # @param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
4876 # - edges should form a closed wire;
4877 # - for each edge, constraint face is optional: if a constraint face is missing
4878 # for some edge, this means that there no constraint associated with this edge.
4879 # @param theName Object name; when specified, this parameter is used
4880 # for result publication in the study. Otherwise, if automatic
4881 # publication is switched on, default value is used for result name.
4883 # @return New GEOM.GEOM_Object, containing the created face.
4885 # @ref tui_creation_face "Example"
4886 @ManageTransactions("ShapesOp")
4887 def MakeFaceWithConstraints(self, theConstraints, theName=None):
4889 Create a face from a set of edges with the given constraints.
4892 theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
4893 - edges should form a closed wire;
4894 - for each edge, constraint face is optional: if a constraint face is missing
4895 for some edge, this means that there no constraint associated with this edge.
4896 theName Object name; when specified, this parameter is used
4897 for result publication in the study. Otherwise, if automatic
4898 publication is switched on, default value is used for result name.
4901 New GEOM.GEOM_Object, containing the created face.
4903 # Example: see GEOM_TestAll.py
4904 anObj = self.ShapesOp.MakeFaceWithConstraints(theConstraints)
4906 RaiseIfFailed("MakeFaceWithConstraints", self.ShapesOp)
4907 self._autoPublish(anObj, theName, "face")
4910 ## Create a shell from the set of faces, shells and/or compounds of faces.
4911 # @param theFacesAndShells List of faces, shells and/or compounds of faces.
4912 # @param theName Object name; when specified, this parameter is used
4913 # for result publication in the study. Otherwise, if automatic
4914 # publication is switched on, default value is used for result name.
4916 # @return New GEOM.GEOM_Object, containing the created shell (compound of shells).
4918 # @ref tui_creation_shell "Example"
4919 @ManageTransactions("ShapesOp")
4920 def MakeShell(self, theFacesAndShells, theName=None):
4922 Create a shell from the set of faces and shells.
4925 theFacesAndShells List of faces and/or shells.
4926 theName Object name; when specified, this parameter is used
4927 for result publication in the study. Otherwise, if automatic
4928 publication is switched on, default value is used for result name.
4931 New GEOM.GEOM_Object, containing the created shell (compound of shells).
4933 # Example: see GEOM_TestAll.py
4934 anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells ))
4935 RaiseIfFailed("MakeShell", self.ShapesOp)
4936 self._autoPublish(anObj, theName, "shell")
4939 ## Create a solid, bounded by the given shells.
4940 # @param theShells Sequence of bounding shells.
4941 # @param theName Object name; when specified, this parameter is used
4942 # for result publication in the study. Otherwise, if automatic
4943 # publication is switched on, default value is used for result name.
4945 # @return New GEOM.GEOM_Object, containing the created solid.
4947 # @ref tui_creation_solid "Example"
4948 @ManageTransactions("ShapesOp")
4949 def MakeSolid(self, theShells, theName=None):
4951 Create a solid, bounded by the given shells.
4954 theShells Sequence of bounding shells.
4955 theName Object name; when specified, this parameter is used
4956 for result publication in the study. Otherwise, if automatic
4957 publication is switched on, default value is used for result name.
4960 New GEOM.GEOM_Object, containing the created solid.
4962 # Example: see GEOM_TestAll.py
4963 theShells = ToList(theShells)
4964 if len(theShells) == 1:
4965 descr = self._IsGoodForSolid(theShells[0])
4967 # raise RuntimeError, "MakeSolidShells : " + descr
4968 if descr == "WRN_SHAPE_UNCLOSED":
4969 raise RuntimeError("MakeSolidShells : Unable to create solid from unclosed shape")
4970 anObj = self.ShapesOp.MakeSolidShells(theShells)
4971 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
4972 self._autoPublish(anObj, theName, "solid")
4975 ## Create a compound of the given shapes.
4976 # @param theShapes List of shapes to put in compound.
4977 # @param theName Object name; when specified, this parameter is used
4978 # for result publication in the study. Otherwise, if automatic
4979 # publication is switched on, default value is used for result name.
4981 # @return New GEOM.GEOM_Object, containing the created compound.
4983 # @ref tui_creation_compound "Example"
4984 @ManageTransactions("ShapesOp")
4985 def MakeCompound(self, theShapes, theName=None):
4987 Create a compound of the given shapes.
4990 theShapes List of shapes to put in compound.
4991 theName Object name; when specified, this parameter is used
4992 for result publication in the study. Otherwise, if automatic
4993 publication is switched on, default value is used for result name.
4996 New GEOM.GEOM_Object, containing the created compound.
4998 # Example: see GEOM_TestAll.py
4999 anObj = self.ShapesOp.MakeCompound(ToList(theShapes))
5000 RaiseIfFailed("MakeCompound", self.ShapesOp)
5001 self._autoPublish(anObj, theName, "compound")
5004 ## Create a solid (or solids) from the set of faces and/or shells.
5005 # @param theFacesOrShells List of faces and/or shells.
5006 # @param isIntersect If TRUE, forces performing intersections
5007 # between arguments; otherwise (default) intersection is not performed.
5008 # @param theName Object name; when specified, this parameter is used
5009 # for result publication in the study. Otherwise, if automatic
5010 # publication is switched on, default value is used for result name.
5012 # @return New GEOM.GEOM_Object, containing the created solid (or compound of solids).
5014 # @ref tui_creation_solid_from_faces "Example"
5015 @ManageTransactions("ShapesOp")
5016 def MakeSolidFromConnectedFaces(self, theFacesOrShells, isIntersect = False, theName=None):
5018 Create a solid (or solids) from the set of connected faces and/or shells.
5021 theFacesOrShells List of faces and/or shells.
5022 isIntersect If TRUE, forces performing intersections
5023 between arguments; otherwise (default) intersection is not performed
5024 theName Object name; when specified, this parameter is used.
5025 for result publication in the study. Otherwise, if automatic
5026 publication is switched on, default value is used for result name.
5029 New GEOM.GEOM_Object, containing the created solid (or compound of solids).
5031 # Example: see GEOM_TestAll.py
5032 anObj = self.ShapesOp.MakeSolidFromConnectedFaces(theFacesOrShells, isIntersect)
5033 RaiseIfFailed("MakeSolidFromConnectedFaces", self.ShapesOp)
5034 self._autoPublish(anObj, theName, "solid")
5037 # end of l3_basic_go
5040 ## @addtogroup l2_measure
5043 ## Gives quantity of faces in the given shape.
5044 # @param theShape Shape to count faces of.
5045 # @return Quantity of faces.
5047 # @ref swig_NumberOf "Example"
5048 @ManageTransactions("ShapesOp")
5049 def NumberOfFaces(self, theShape):
5051 Gives quantity of faces in the given shape.
5054 theShape Shape to count faces of.
5059 # Example: see GEOM_TestOthers.py
5060 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
5061 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
5064 ## Gives quantity of edges in the given shape.
5065 # @param theShape Shape to count edges of.
5066 # @return Quantity of edges.
5068 # @ref swig_NumberOf "Example"
5069 @ManageTransactions("ShapesOp")
5070 def NumberOfEdges(self, theShape):
5072 Gives quantity of edges in the given shape.
5075 theShape Shape to count edges of.
5080 # Example: see GEOM_TestOthers.py
5081 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
5082 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
5085 ## Gives quantity of sub-shapes of type theShapeType in the given shape.
5086 # @param theShape Shape to count sub-shapes of.
5087 # @param theShapeType Type of sub-shapes to count (see ShapeType())
5088 # @return Quantity of sub-shapes of given type.
5090 # @ref swig_NumberOf "Example"
5091 @ManageTransactions("ShapesOp")
5092 def NumberOfSubShapes(self, theShape, theShapeType):
5094 Gives quantity of sub-shapes of type theShapeType in the given shape.
5097 theShape Shape to count sub-shapes of.
5098 theShapeType Type of sub-shapes to count (see geompy.ShapeType)
5101 Quantity of sub-shapes of given type.
5103 # Example: see GEOM_TestOthers.py
5104 nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
5105 RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
5108 ## Gives quantity of solids in the given shape.
5109 # @param theShape Shape to count solids in.
5110 # @return Quantity of solids.
5112 # @ref swig_NumberOf "Example"
5113 @ManageTransactions("ShapesOp")
5114 def NumberOfSolids(self, theShape):
5116 Gives quantity of solids in the given shape.
5119 theShape Shape to count solids in.
5124 # Example: see GEOM_TestOthers.py
5125 nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, self.ShapeType["SOLID"])
5126 RaiseIfFailed("NumberOfSolids", self.ShapesOp)
5132 ## @addtogroup l3_healing
5135 ## Reverses an orientation the given shape.
5136 # @param theShape Shape to be reversed.
5137 # @param theName Object name; when specified, this parameter is used
5138 # for result publication in the study. Otherwise, if automatic
5139 # publication is switched on, default value is used for result name.
5141 # @return The reversed copy of theShape.
5143 # @ref swig_ChangeOrientation "Example"
5144 @ManageTransactions("ShapesOp")
5145 def ChangeOrientation(self, theShape, theName=None):
5147 Reverses an orientation the given shape.
5150 theShape Shape to be reversed.
5151 theName Object name; when specified, this parameter is used
5152 for result publication in the study. Otherwise, if automatic
5153 publication is switched on, default value is used for result name.
5156 The reversed copy of theShape.
5158 # Example: see GEOM_TestAll.py
5159 anObj = self.ShapesOp.ChangeOrientation(theShape)
5160 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
5161 self._autoPublish(anObj, theName, "reversed")
5164 ## See ChangeOrientation() method for details.
5166 # @ref swig_OrientationChange "Example"
5167 def OrientationChange(self, theShape, theName=None):
5169 See geompy.ChangeOrientation method for details.
5171 # Example: see GEOM_TestOthers.py
5172 # note: auto-publishing is done in self.ChangeOrientation()
5173 anObj = self.ChangeOrientation(theShape, theName)
5179 ## @addtogroup l4_obtain
5182 ## Retrieve all free faces from the given shape.
5183 # Free face is a face, which is not shared between two shells of the shape.
5184 # @param theShape Shape to find free faces in.
5185 # @return List of IDs of all free faces, contained in theShape.
5187 # @ref tui_free_faces_page "Example"
5188 @ManageTransactions("ShapesOp")
5189 def GetFreeFacesIDs(self,theShape):
5191 Retrieve all free faces from the given shape.
5192 Free face is a face, which is not shared between two shells of the shape.
5195 theShape Shape to find free faces in.
5198 List of IDs of all free faces, contained in theShape.
5200 # Example: see GEOM_TestOthers.py
5201 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
5202 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
5205 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
5206 # @param theShape1 Shape to find sub-shapes in.
5207 # @param theShape2 Shape to find shared sub-shapes with.
5208 # @param theShapeType Type of sub-shapes to be retrieved.
5209 # @param theName Object name; when specified, this parameter is used
5210 # for result publication in the study. Otherwise, if automatic
5211 # publication is switched on, default value is used for result name.
5213 # @return List of sub-shapes of theShape1, shared with theShape2.
5215 # @ref swig_GetSharedShapes "Example"
5216 @ManageTransactions("ShapesOp")
5217 def GetSharedShapes(self, theShape1, theShape2, theShapeType, theName=None):
5219 Get all sub-shapes of theShape1 of the given type, shared with theShape2.
5222 theShape1 Shape to find sub-shapes in.
5223 theShape2 Shape to find shared sub-shapes with.
5224 theShapeType Type of sub-shapes to be retrieved.
5225 theName Object name; when specified, this parameter is used
5226 for result publication in the study. Otherwise, if automatic
5227 publication is switched on, default value is used for result name.
5230 List of sub-shapes of theShape1, shared with theShape2.
5232 # Example: see GEOM_TestOthers.py
5233 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
5234 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
5235 self._autoPublish(aList, theName, "shared")
5238 ## Get sub-shapes, shared by input shapes.
5239 # @param theShapes Either a list or compound of shapes to find common sub-shapes of.
5240 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()).
5241 # @param theMultiShare Specifies what type of shares should be checked:
5242 # - @c True (default): search sub-shapes from 1st input shape shared with all other input shapes;
5243 # - @c False: causes to search sub-shapes shared between couples of input shapes.
5244 # @param theName Object name; when specified, this parameter is used
5245 # for result publication in the study. Otherwise, if automatic
5246 # publication is switched on, default value is used for result name.
5248 # @note If @a theShapes contains single compound, the shares between all possible couples of
5249 # its top-level shapes are returned; otherwise, only shares between 1st input shape
5250 # and all rest input shapes are returned.
5252 # @return List of all found sub-shapes.
5255 # - @ref tui_shared_shapes "Example 1"
5256 # - @ref swig_GetSharedShapes "Example 2"
5257 @ManageTransactions("ShapesOp")
5258 def GetSharedShapesMulti(self, theShapes, theShapeType, theMultiShare=True, theName=None):
5260 Get sub-shapes, shared by input shapes.
5263 theShapes Either a list or compound of shapes to find common sub-shapes of.
5264 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType).
5265 theMultiShare Specifies what type of shares should be checked:
5266 - True (default): search sub-shapes from 1st input shape shared with all other input shapes;
5267 - False: causes to search sub-shapes shared between couples of input shapes.
5268 theName Object name; when specified, this parameter is used
5269 for result publication in the study. Otherwise, if automatic
5270 publication is switched on, default value is used for result name.
5272 Note: if theShapes contains single compound, the shares between all possible couples of
5273 its top-level shapes are returned; otherwise, only shares between 1st input shape
5274 and all rest input shapes are returned.
5277 List of all found sub-shapes.
5279 # Example: see GEOM_TestOthers.py
5280 aList = self.ShapesOp.GetSharedShapesMulti(ToList(theShapes), theShapeType, theMultiShare)
5281 RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
5282 self._autoPublish(aList, theName, "shared")
5285 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5286 # situated relatively the specified plane by the certain way,
5287 # defined through <VAR>theState</VAR> parameter.
5288 # @param theShape Shape to find sub-shapes of.
5289 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5290 # @param theAx1 Vector (or line, or linear edge), specifying normal
5291 # direction and location of the plane to find shapes on.
5292 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5293 # @param theName Object name; when specified, this parameter is used
5294 # for result publication in the study. Otherwise, if automatic
5295 # publication is switched on, default value is used for result name.
5297 # @return List of all found sub-shapes.
5299 # @ref swig_GetShapesOnPlane "Example"
5300 @ManageTransactions("ShapesOp")
5301 def GetShapesOnPlane(self, theShape, theShapeType, theAx1, theState, theName=None):
5303 Find in theShape all sub-shapes of type theShapeType,
5304 situated relatively the specified plane by the certain way,
5305 defined through theState parameter.
5308 theShape Shape to find sub-shapes of.
5309 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5310 theAx1 Vector (or line, or linear edge), specifying normal
5311 direction and location of the plane to find shapes on.
5312 theState The state of the sub-shapes to find (see GEOM::shape_state)
5313 theName Object name; when specified, this parameter is used
5314 for result publication in the study. Otherwise, if automatic
5315 publication is switched on, default value is used for result name.
5318 List of all found sub-shapes.
5320 # Example: see GEOM_TestOthers.py
5321 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
5322 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
5323 self._autoPublish(aList, theName, "shapeOnPlane")
5326 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5327 # situated relatively the specified plane by the certain way,
5328 # defined through <VAR>theState</VAR> parameter.
5329 # @param theShape Shape to find sub-shapes of.
5330 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5331 # @param theAx1 Vector (or line, or linear edge), specifying normal
5332 # direction and location of the plane to find shapes on.
5333 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5335 # @return List of all found sub-shapes indices.
5337 # @ref swig_GetShapesOnPlaneIDs "Example"
5338 @ManageTransactions("ShapesOp")
5339 def GetShapesOnPlaneIDs(self, theShape, theShapeType, theAx1, theState):
5341 Find in theShape all sub-shapes of type theShapeType,
5342 situated relatively the specified plane by the certain way,
5343 defined through theState parameter.
5346 theShape Shape to find sub-shapes of.
5347 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5348 theAx1 Vector (or line, or linear edge), specifying normal
5349 direction and location of the plane to find shapes on.
5350 theState The state of the sub-shapes to find (see GEOM::shape_state)
5353 List of all found sub-shapes indices.
5355 # Example: see GEOM_TestOthers.py
5356 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
5357 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
5360 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5361 # situated relatively the specified plane by the certain way,
5362 # defined through <VAR>theState</VAR> parameter.
5363 # @param theShape Shape to find sub-shapes of.
5364 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5365 # @param theAx1 Vector (or line, or linear edge), specifying normal
5366 # direction of the plane to find shapes on.
5367 # @param thePnt Point specifying location of the plane to find shapes on.
5368 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5369 # @param theName Object name; when specified, this parameter is used
5370 # for result publication in the study. Otherwise, if automatic
5371 # publication is switched on, default value is used for result name.
5373 # @return List of all found sub-shapes.
5375 # @ref swig_GetShapesOnPlaneWithLocation "Example"
5376 @ManageTransactions("ShapesOp")
5377 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState, theName=None):
5379 Find in theShape all sub-shapes of type theShapeType,
5380 situated relatively the specified plane by the certain way,
5381 defined through theState parameter.
5384 theShape Shape to find sub-shapes of.
5385 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5386 theAx1 Vector (or line, or linear edge), specifying normal
5387 direction and location of the plane to find shapes on.
5388 thePnt Point specifying location of the plane to find shapes on.
5389 theState The state of the sub-shapes to find (see GEOM::shape_state)
5390 theName Object name; when specified, this parameter is used
5391 for result publication in the study. Otherwise, if automatic
5392 publication is switched on, default value is used for result name.
5395 List of all found sub-shapes.
5397 # Example: see GEOM_TestOthers.py
5398 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
5399 theAx1, thePnt, theState)
5400 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
5401 self._autoPublish(aList, theName, "shapeOnPlane")
5404 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5405 # situated relatively the specified plane by the certain way,
5406 # defined through <VAR>theState</VAR> parameter.
5407 # @param theShape Shape to find sub-shapes of.
5408 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5409 # @param theAx1 Vector (or line, or linear edge), specifying normal
5410 # direction of the plane to find shapes on.
5411 # @param thePnt Point specifying location of the plane to find shapes on.
5412 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5414 # @return List of all found sub-shapes indices.
5416 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
5417 @ManageTransactions("ShapesOp")
5418 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
5420 Find in theShape all sub-shapes of type theShapeType,
5421 situated relatively the specified plane by the certain way,
5422 defined through theState parameter.
5425 theShape Shape to find sub-shapes of.
5426 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5427 theAx1 Vector (or line, or linear edge), specifying normal
5428 direction and location of the plane to find shapes on.
5429 thePnt Point specifying location of the plane to find shapes on.
5430 theState The state of the sub-shapes to find (see GEOM::shape_state)
5433 List of all found sub-shapes indices.
5435 # Example: see GEOM_TestOthers.py
5436 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
5437 theAx1, thePnt, theState)
5438 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
5441 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5442 # the specified cylinder by the certain way, defined through \a theState parameter.
5443 # @param theShape Shape to find sub-shapes of.
5444 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5445 # @param theAxis Vector (or line, or linear edge), specifying
5446 # axis of the cylinder to find shapes on.
5447 # @param theRadius Radius of the cylinder to find shapes on.
5448 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5449 # @param theName Object name; when specified, this parameter is used
5450 # for result publication in the study. Otherwise, if automatic
5451 # publication is switched on, default value is used for result name.
5453 # @return List of all found sub-shapes.
5455 # @ref swig_GetShapesOnCylinder "Example"
5456 @ManageTransactions("ShapesOp")
5457 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState, theName=None):
5459 Find in theShape all sub-shapes of type theShapeType, situated relatively
5460 the specified cylinder by the certain way, defined through theState parameter.
5463 theShape Shape to find sub-shapes of.
5464 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5465 theAxis Vector (or line, or linear edge), specifying
5466 axis of the cylinder to find shapes on.
5467 theRadius Radius of the cylinder to find shapes on.
5468 theState The state of the sub-shapes to find (see GEOM::shape_state)
5469 theName Object name; when specified, this parameter is used
5470 for result publication in the study. Otherwise, if automatic
5471 publication is switched on, default value is used for result name.
5474 List of all found sub-shapes.
5476 # Example: see GEOM_TestOthers.py
5477 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
5478 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
5479 self._autoPublish(aList, theName, "shapeOnCylinder")
5482 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5483 # the specified cylinder by the certain way, defined through \a theState parameter.
5484 # @param theShape Shape to find sub-shapes of.
5485 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5486 # @param theAxis Vector (or line, or linear edge), specifying
5487 # axis of the cylinder to find shapes on.
5488 # @param theRadius Radius of the cylinder to find shapes on.
5489 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5491 # @return List of all found sub-shapes indices.
5493 # @ref swig_GetShapesOnCylinderIDs "Example"
5494 @ManageTransactions("ShapesOp")
5495 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
5497 Find in theShape all sub-shapes of type theShapeType, situated relatively
5498 the specified cylinder by the certain way, defined through theState parameter.
5501 theShape Shape to find sub-shapes of.
5502 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5503 theAxis Vector (or line, or linear edge), specifying
5504 axis of the cylinder to find shapes on.
5505 theRadius Radius of the cylinder to find shapes on.
5506 theState The state of the sub-shapes to find (see GEOM::shape_state)
5509 List of all found sub-shapes indices.
5511 # Example: see GEOM_TestOthers.py
5512 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
5513 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
5516 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5517 # the specified cylinder by the certain way, defined through \a theState parameter.
5518 # @param theShape Shape to find sub-shapes of.
5519 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5520 # @param theAxis Vector (or line, or linear edge), specifying
5521 # axis of the cylinder to find shapes on.
5522 # @param thePnt Point specifying location of the bottom of the cylinder.
5523 # @param theRadius Radius of the cylinder to find shapes on.
5524 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5525 # @param theName Object name; when specified, this parameter is used
5526 # for result publication in the study. Otherwise, if automatic
5527 # publication is switched on, default value is used for result name.
5529 # @return List of all found sub-shapes.
5531 # @ref swig_GetShapesOnCylinderWithLocation "Example"
5532 @ManageTransactions("ShapesOp")
5533 def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState, theName=None):
5535 Find in theShape all sub-shapes of type theShapeType, situated relatively
5536 the specified cylinder by the certain way, defined through theState parameter.
5539 theShape Shape to find sub-shapes of.
5540 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5541 theAxis Vector (or line, or linear edge), specifying
5542 axis of the cylinder to find shapes on.
5543 theRadius Radius of the cylinder to find shapes on.
5544 theState The state of the sub-shapes to find (see GEOM::shape_state)
5545 theName Object name; when specified, this parameter is used
5546 for result publication in the study. Otherwise, if automatic
5547 publication is switched on, default value is used for result name.
5550 List of all found sub-shapes.
5552 # Example: see GEOM_TestOthers.py
5553 aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
5554 RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
5555 self._autoPublish(aList, theName, "shapeOnCylinder")
5558 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5559 # the specified cylinder by the certain way, defined through \a theState parameter.
5560 # @param theShape Shape to find sub-shapes of.
5561 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5562 # @param theAxis Vector (or line, or linear edge), specifying
5563 # axis of the cylinder to find shapes on.
5564 # @param thePnt Point specifying location of the bottom of the cylinder.
5565 # @param theRadius Radius of the cylinder to find shapes on.
5566 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5568 # @return List of all found sub-shapes indices
5570 # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
5571 @ManageTransactions("ShapesOp")
5572 def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
5574 Find in theShape all sub-shapes of type theShapeType, situated relatively
5575 the specified cylinder by the certain way, defined through theState parameter.
5578 theShape Shape to find sub-shapes of.
5579 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5580 theAxis Vector (or line, or linear edge), specifying
5581 axis of the cylinder to find shapes on.
5582 theRadius Radius of the cylinder to find shapes on.
5583 theState The state of the sub-shapes to find (see GEOM::shape_state)
5586 List of all found sub-shapes indices.
5588 # Example: see GEOM_TestOthers.py
5589 aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
5590 RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
5593 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5594 # the specified sphere by the certain way, defined through \a theState parameter.
5595 # @param theShape Shape to find sub-shapes of.
5596 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5597 # @param theCenter Point, specifying center of the sphere to find shapes on.
5598 # @param theRadius Radius of the sphere to find shapes on.
5599 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5600 # @param theName Object name; when specified, this parameter is used
5601 # for result publication in the study. Otherwise, if automatic
5602 # publication is switched on, default value is used for result name.
5604 # @return List of all found sub-shapes.
5606 # @ref swig_GetShapesOnSphere "Example"
5607 @ManageTransactions("ShapesOp")
5608 def GetShapesOnSphere(self, theShape, theShapeType, theCenter, theRadius, theState, theName=None):
5610 Find in theShape all sub-shapes of type theShapeType, situated relatively
5611 the specified sphere by the certain way, defined through theState parameter.
5614 theShape Shape to find sub-shapes of.
5615 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5616 theCenter Point, specifying center of the sphere to find shapes on.
5617 theRadius Radius of the sphere to find shapes on.
5618 theState The state of the sub-shapes to find (see GEOM::shape_state)
5619 theName Object name; when specified, this parameter is used
5620 for result publication in the study. Otherwise, if automatic
5621 publication is switched on, default value is used for result name.
5624 List of all found sub-shapes.
5626 # Example: see GEOM_TestOthers.py
5627 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
5628 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
5629 self._autoPublish(aList, theName, "shapeOnSphere")
5632 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5633 # the specified sphere by the certain way, defined through \a theState parameter.
5634 # @param theShape Shape to find sub-shapes of.
5635 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5636 # @param theCenter Point, specifying center of the sphere to find shapes on.
5637 # @param theRadius Radius of the sphere to find shapes on.
5638 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5640 # @return List of all found sub-shapes indices.
5642 # @ref swig_GetShapesOnSphereIDs "Example"
5643 @ManageTransactions("ShapesOp")
5644 def GetShapesOnSphereIDs(self, theShape, theShapeType, theCenter, theRadius, theState):
5646 Find in theShape all sub-shapes of type theShapeType, situated relatively
5647 the specified sphere by the certain way, defined through theState parameter.
5650 theShape Shape to find sub-shapes of.
5651 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5652 theCenter Point, specifying center of the sphere to find shapes on.
5653 theRadius Radius of the sphere to find shapes on.
5654 theState The state of the sub-shapes to find (see GEOM::shape_state)
5657 List of all found sub-shapes indices.
5659 # Example: see GEOM_TestOthers.py
5660 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
5661 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
5664 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5665 # the specified quadrangle by the certain way, defined through \a theState parameter.
5666 # @param theShape Shape to find sub-shapes of.
5667 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5668 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
5669 # @param theTopRightPoint Point, specifying top right corner of a quadrangle
5670 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5671 # @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5672 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5673 # @param theName Object name; when specified, this parameter is used
5674 # for result publication in the study. Otherwise, if automatic
5675 # publication is switched on, default value is used for result name.
5677 # @return List of all found sub-shapes.
5679 # @ref swig_GetShapesOnQuadrangle "Example"
5680 @ManageTransactions("ShapesOp")
5681 def GetShapesOnQuadrangle(self, theShape, theShapeType,
5682 theTopLeftPoint, theTopRightPoint,
5683 theBottomLeftPoint, theBottomRightPoint, theState, theName=None):
5685 Find in theShape all sub-shapes of type theShapeType, situated relatively
5686 the specified quadrangle by the certain way, defined through theState parameter.
5689 theShape Shape to find sub-shapes of.
5690 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5691 theTopLeftPoint Point, specifying top left corner of a quadrangle
5692 theTopRightPoint Point, specifying top right corner of a quadrangle
5693 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5694 theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5695 theState The state of the sub-shapes to find (see GEOM::shape_state)
5696 theName Object name; when specified, this parameter is used
5697 for result publication in the study. Otherwise, if automatic
5698 publication is switched on, default value is used for result name.
5701 List of all found sub-shapes.
5703 # Example: see GEOM_TestOthers.py
5704 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
5705 theTopLeftPoint, theTopRightPoint,
5706 theBottomLeftPoint, theBottomRightPoint, theState)
5707 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
5708 self._autoPublish(aList, theName, "shapeOnQuadrangle")
5711 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5712 # the specified quadrangle by the certain way, defined through \a theState parameter.
5713 # @param theShape Shape to find sub-shapes of.
5714 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5715 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
5716 # @param theTopRightPoint Point, specifying top right corner of a quadrangle
5717 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5718 # @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5719 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5721 # @return List of all found sub-shapes indices.
5723 # @ref swig_GetShapesOnQuadrangleIDs "Example"
5724 @ManageTransactions("ShapesOp")
5725 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
5726 theTopLeftPoint, theTopRightPoint,
5727 theBottomLeftPoint, theBottomRightPoint, theState):
5729 Find in theShape all sub-shapes of type theShapeType, situated relatively
5730 the specified quadrangle by the certain way, defined through theState parameter.
5733 theShape Shape to find sub-shapes of.
5734 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5735 theTopLeftPoint Point, specifying top left corner of a quadrangle
5736 theTopRightPoint Point, specifying top right corner of a quadrangle
5737 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5738 theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5739 theState The state of the sub-shapes to find (see GEOM::shape_state)
5742 List of all found sub-shapes indices.
5745 # Example: see GEOM_TestOthers.py
5746 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
5747 theTopLeftPoint, theTopRightPoint,
5748 theBottomLeftPoint, theBottomRightPoint, theState)
5749 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
5752 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5753 # the specified \a theBox by the certain way, defined through \a theState parameter.
5754 # @param theBox Shape for relative comparing.
5755 # @param theShape Shape to find sub-shapes of.
5756 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5757 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5758 # @param theName Object name; when specified, this parameter is used
5759 # for result publication in the study. Otherwise, if automatic
5760 # publication is switched on, default value is used for result name.
5762 # @return List of all found sub-shapes.
5764 # @ref swig_GetShapesOnBox "Example"
5765 @ManageTransactions("ShapesOp")
5766 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState, theName=None):
5768 Find in theShape all sub-shapes of type theShapeType, situated relatively
5769 the specified theBox by the certain way, defined through theState parameter.
5772 theBox Shape for relative comparing.
5773 theShape Shape to find sub-shapes of.
5774 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5775 theState The state of the sub-shapes to find (see GEOM::shape_state)
5776 theName Object name; when specified, this parameter is used
5777 for result publication in the study. Otherwise, if automatic
5778 publication is switched on, default value is used for result name.
5781 List of all found sub-shapes.
5783 # Example: see GEOM_TestOthers.py
5784 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
5785 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
5786 self._autoPublish(aList, theName, "shapeOnBox")
5789 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5790 # the specified \a theBox by the certain way, defined through \a theState parameter.
5791 # @param theBox Shape for relative comparing.
5792 # @param theShape Shape to find sub-shapes of.
5793 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5794 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5796 # @return List of all found sub-shapes indices.
5798 # @ref swig_GetShapesOnBoxIDs "Example"
5799 @ManageTransactions("ShapesOp")
5800 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
5802 Find in theShape all sub-shapes of type theShapeType, situated relatively
5803 the specified theBox by the certain way, defined through theState parameter.
5806 theBox Shape for relative comparing.
5807 theShape Shape to find sub-shapes of.
5808 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5809 theState The state of the sub-shapes to find (see GEOM::shape_state)
5812 List of all found sub-shapes indices.
5814 # Example: see GEOM_TestOthers.py
5815 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
5816 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
5819 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5820 # situated relatively the specified \a theCheckShape by the
5821 # certain way, defined through \a theState parameter.
5822 # @param theCheckShape Shape for relative comparing. It must be a solid.
5823 # @param theShape Shape to find sub-shapes of.
5824 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5825 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5826 # @param theName Object name; when specified, this parameter is used
5827 # for result publication in the study. Otherwise, if automatic
5828 # publication is switched on, default value is used for result name.
5830 # @return List of all found sub-shapes.
5832 # @ref swig_GetShapesOnShape "Example"
5833 @ManageTransactions("ShapesOp")
5834 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theName=None):
5836 Find in theShape all sub-shapes of type theShapeType,
5837 situated relatively the specified theCheckShape by the
5838 certain way, defined through theState parameter.
5841 theCheckShape Shape for relative comparing. It must be a solid.
5842 theShape Shape to find sub-shapes of.
5843 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5844 theState The state of the sub-shapes to find (see GEOM::shape_state)
5845 theName Object name; when specified, this parameter is used
5846 for result publication in the study. Otherwise, if automatic
5847 publication is switched on, default value is used for result name.
5850 List of all found sub-shapes.
5852 # Example: see GEOM_TestOthers.py
5853 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
5854 theShapeType, theState)
5855 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
5856 self._autoPublish(aList, theName, "shapeOnShape")
5859 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5860 # situated relatively the specified \a theCheckShape by the
5861 # certain way, defined through \a theState parameter.
5862 # @param theCheckShape Shape for relative comparing. It must be a solid.
5863 # @param theShape Shape to find sub-shapes of.
5864 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5865 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5866 # @param theName Object name; when specified, this parameter is used
5867 # for result publication in the study. Otherwise, if automatic
5868 # publication is switched on, default value is used for result name.
5870 # @return All found sub-shapes as compound.
5872 # @ref swig_GetShapesOnShapeAsCompound "Example"
5873 @ManageTransactions("ShapesOp")
5874 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theName=None):
5876 Find in theShape all sub-shapes of type theShapeType,
5877 situated relatively the specified theCheckShape by the
5878 certain way, defined through theState parameter.
5881 theCheckShape Shape for relative comparing. It must be a solid.
5882 theShape Shape to find sub-shapes of.
5883 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5884 theState The state of the sub-shapes to find (see GEOM::shape_state)
5885 theName Object name; when specified, this parameter is used
5886 for result publication in the study. Otherwise, if automatic
5887 publication is switched on, default value is used for result name.
5890 All found sub-shapes as compound.
5892 # Example: see GEOM_TestOthers.py
5893 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
5894 theShapeType, theState)
5895 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
5896 self._autoPublish(anObj, theName, "shapeOnShape")
5899 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5900 # situated relatively the specified \a theCheckShape by the
5901 # certain way, defined through \a theState parameter.
5902 # @param theCheckShape Shape for relative comparing. It must be a solid.
5903 # @param theShape Shape to find sub-shapes of.
5904 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5905 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5907 # @return List of all found sub-shapes indices.
5909 # @ref swig_GetShapesOnShapeIDs "Example"
5910 @ManageTransactions("ShapesOp")
5911 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
5913 Find in theShape all sub-shapes of type theShapeType,
5914 situated relatively the specified theCheckShape by the
5915 certain way, defined through theState parameter.
5918 theCheckShape Shape for relative comparing. It must be a solid.
5919 theShape Shape to find sub-shapes of.
5920 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5921 theState The state of the sub-shapes to find (see GEOM::shape_state)
5924 List of all found sub-shapes indices.
5926 # Example: see GEOM_TestOthers.py
5927 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
5928 theShapeType, theState)
5929 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
5932 ## Get sub-shape(s) of theShapeWhere, which are
5933 # coincident with \a theShapeWhat or could be a part of it.
5934 # @param theShapeWhere Shape to find sub-shapes of.
5935 # @param theShapeWhat Shape, specifying what to find.
5936 # @param isNewImplementation implementation of GetInPlace functionality
5937 # (default = False, old alghorithm based on shape properties)
5938 # @param theName Object name; when specified, this parameter is used
5939 # for result publication in the study. Otherwise, if automatic
5940 # publication is switched on, default value is used for result name.
5942 # @return Compound which includes all found sub-shapes if they have different types;
5943 # or group of all found shapes of the equal type; or a single found sub-shape.
5945 # @note This function has a restriction on argument shapes.
5946 # If \a theShapeWhere has curved parts with significantly
5947 # outstanding centres (i.e. the mass centre of a part is closer to
5948 # \a theShapeWhat than to the part), such parts will not be found.
5949 # @image html get_in_place_lost_part.png
5951 # @ref swig_GetInPlace "Example"
5952 @ManageTransactions("ShapesOp")
5953 def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False, theName=None):
5955 Get sub-shape(s) of theShapeWhere, which are
5956 coincident with theShapeWhat or could be a part of it.
5959 theShapeWhere Shape to find sub-shapes of.
5960 theShapeWhat Shape, specifying what to find.
5961 isNewImplementation Implementation of GetInPlace functionality
5962 (default = False, old alghorithm based on shape properties)
5963 theName Object name; when specified, this parameter is used
5964 for result publication in the study. Otherwise, if automatic
5965 publication is switched on, default value is used for result name.
5968 Compound which includes all found sub-shapes if they have different types;
5969 or group of all found shapes of the equal type; or a single found sub-shape.
5973 This function has a restriction on argument shapes.
5974 If theShapeWhere has curved parts with significantly
5975 outstanding centres (i.e. the mass centre of a part is closer to
5976 theShapeWhat than to the part), such parts will not be found.
5978 # Example: see GEOM_TestOthers.py
5980 if isNewImplementation:
5981 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
5983 anObj = self.ShapesOp.GetInPlaceOld(theShapeWhere, theShapeWhat)
5985 RaiseIfFailed("GetInPlace", self.ShapesOp)
5986 self._autoPublish(anObj, theName, "inplace")
5989 ## Get sub-shape(s) of \a theShapeWhere, which are
5990 # coincident with \a theShapeWhat or could be a part of it.
5992 # Implementation of this method is based on a saved history of an operation,
5993 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
5994 # arguments (an argument shape or a sub-shape of an argument shape).
5995 # The operation could be the Partition or one of boolean operations,
5996 # performed on simple shapes (not on compounds).
5998 # @param theShapeWhere Shape to find sub-shapes of.
5999 # @param theShapeWhat Shape, specifying what to find (must be in the
6000 # building history of the ShapeWhere).
6001 # @param theName Object name; when specified, this parameter is used
6002 # for result publication in the study. Otherwise, if automatic
6003 # publication is switched on, default value is used for result name.
6005 # @return Compound which includes all found sub-shapes if they have different types;
6006 # or group of all found shapes of the equal type; or a single found sub-shape.
6008 # @ref swig_GetInPlace "Example"
6009 @ManageTransactions("ShapesOp")
6010 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat, theName=None):
6012 Implementation of this method is based on a saved history of an operation,
6013 produced theShapeWhere. The theShapeWhat must be among this operation's
6014 arguments (an argument shape or a sub-shape of an argument shape).
6015 The operation could be the Partition or one of boolean operations,
6016 performed on simple shapes (not on compounds).
6019 theShapeWhere Shape to find sub-shapes of.
6020 theShapeWhat Shape, specifying what to find (must be in the
6021 building history of the ShapeWhere).
6022 theName Object name; when specified, this parameter is used
6023 for result publication in the study. Otherwise, if automatic
6024 publication is switched on, default value is used for result name.
6027 Compound which includes all found sub-shapes if they have different types;
6028 or group of all found shapes of the equal type; or a single found sub-shape.
6030 # Example: see GEOM_TestOthers.py
6031 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
6032 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
6033 self._autoPublish(anObj, theName, "inplace")
6036 ## A sort of GetInPlace functionality, returning IDs of sub-shapes.
6037 # For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
6038 # IDs of @a theShapeWhere.
6039 # For example, if theShapeWhat is a box and theShapeWhere is this box cut into
6040 # two parts by a plane, then the result can be as this:
6041 # len( result_list ) = 35,
6042 # result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
6043 # solids with IDs 2 and 36 within theShapeWhere
6045 # @param theShapeWhere Shape to find sub-shapes of.
6046 # @param theShapeWhat Shape, specifying what to find.
6047 # @return List of lists of sub-shape IDS of theShapeWhere.
6048 def GetInPlaceMap(self, theShapeWhere, theShapeWhat):
6050 A sort of GetInPlace functionality, returning IDs of sub-shapes.
6051 For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
6052 IDs of @a theShapeWhere.
6053 For example, if theShapeWhat is a box and theShapeWhere is this box cut into
6054 two parts by a plane, then the result can be as this:
6055 len( result_list ) = 35,
6056 result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
6057 solids with IDs 2 and 36 within theShapeWhere
6060 theShapeWhere Shape to find sub-shapes of.
6061 theShapeWhat Shape, specifying what to find.
6064 List of lists of sub-shape IDS of theShapeWhere.
6066 return self.ShapesOp.GetInPlaceMap(theShapeWhere, theShapeWhat)
6068 ## Get sub-shape of theShapeWhere, which is
6069 # equal to \a theShapeWhat.
6070 # @param theShapeWhere Shape to find sub-shape of.
6071 # @param theShapeWhat Shape, specifying what to find.
6072 # @param theName Object name; when specified, this parameter is used
6073 # for result publication in the study. Otherwise, if automatic
6074 # publication is switched on, default value is used for result name.
6076 # @return New GEOM.GEOM_Object for found sub-shape.
6078 # @ref swig_GetSame "Example"
6079 @ManageTransactions("ShapesOp")
6080 def GetSame(self, theShapeWhere, theShapeWhat, theName=None):
6082 Get sub-shape of theShapeWhere, which is
6083 equal to theShapeWhat.
6086 theShapeWhere Shape to find sub-shape of.
6087 theShapeWhat Shape, specifying what to find.
6088 theName Object name; when specified, this parameter is used
6089 for result publication in the study. Otherwise, if automatic
6090 publication is switched on, default value is used for result name.
6093 New GEOM.GEOM_Object for found sub-shape.
6095 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
6096 RaiseIfFailed("GetSame", self.ShapesOp)
6097 self._autoPublish(anObj, theName, "sameShape")
6101 ## Get sub-shape indices of theShapeWhere, which is
6102 # equal to \a theShapeWhat.
6103 # @param theShapeWhere Shape to find sub-shape of.
6104 # @param theShapeWhat Shape, specifying what to find.
6105 # @return List of all found sub-shapes indices.
6107 # @ref swig_GetSame "Example"
6108 @ManageTransactions("ShapesOp")
6109 def GetSameIDs(self, theShapeWhere, theShapeWhat):
6111 Get sub-shape indices of theShapeWhere, which is
6112 equal to theShapeWhat.
6115 theShapeWhere Shape to find sub-shape of.
6116 theShapeWhat Shape, specifying what to find.
6119 List of all found sub-shapes indices.
6121 anObj = self.ShapesOp.GetSameIDs(theShapeWhere, theShapeWhat)
6122 RaiseIfFailed("GetSameIDs", self.ShapesOp)
6125 ## Resize the input edge with the new Min and Max parameters.
6126 # The input edge parameters range is [0, 1]. If theMin parameter is
6127 # negative, the input edge is extended, otherwise it is shrinked by
6128 # theMin parameter. If theMax is greater than 1, the edge is extended,
6129 # otherwise it is shrinked by theMax parameter.
6130 # @param theEdge the input edge to be resized.
6131 # @param theMin the minimal parameter value.
6132 # @param theMax the maximal parameter value.
6133 # @param theName Object name; when specified, this parameter is used
6134 # for result publication in the study. Otherwise, if automatic
6135 # publication is switched on, default value is used for result name.
6136 # @return New GEOM.GEOM_Object, containing the created edge.
6138 # @ref tui_extend "Example"
6139 @ManageTransactions("ShapesOp")
6140 def ExtendEdge(self, theEdge, theMin, theMax, theName=None):
6142 Resize the input edge with the new Min and Max parameters.
6143 The input edge parameters range is [0, 1]. If theMin parameter is
6144 negative, the input edge is extended, otherwise it is shrinked by
6145 theMin parameter. If theMax is greater than 1, the edge is extended,
6146 otherwise it is shrinked by theMax parameter.
6149 theEdge the input edge to be resized.
6150 theMin the minimal parameter value.
6151 theMax the maximal parameter value.
6152 theName Object name; when specified, this parameter is used
6153 for result publication in the study. Otherwise, if automatic
6154 publication is switched on, default value is used for result name.
6157 New GEOM.GEOM_Object, containing the created edge.
6159 theMin, theMax, Parameters = ParseParameters(theMin, theMax)
6160 anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax)
6161 RaiseIfFailed("ExtendEdge", self.ShapesOp)
6162 anObj.SetParameters(Parameters)
6163 self._autoPublish(anObj, theName, "edge")
6166 ## Resize the input face with the new UMin, UMax, VMin and VMax
6167 # parameters. The input face U and V parameters range is [0, 1]. If
6168 # theUMin parameter is negative, the input face is extended, otherwise
6169 # it is shrinked along U direction by theUMin parameter. If theUMax is
6170 # greater than 1, the face is extended, otherwise it is shrinked along
6171 # U direction by theUMax parameter. So as for theVMin, theVMax and
6172 # V direction of the input face.
6173 # @param theFace the input face to be resized.
6174 # @param theUMin the minimal U parameter value.
6175 # @param theUMax the maximal U parameter value.
6176 # @param theVMin the minimal V parameter value.
6177 # @param theVMax the maximal V parameter value.
6178 # @param theName Object name; when specified, this parameter is used
6179 # for result publication in the study. Otherwise, if automatic
6180 # publication is switched on, default value is used for result name.
6181 # @return New GEOM.GEOM_Object, containing the created face.
6183 # @ref tui_extend "Example"
6184 @ManageTransactions("ShapesOp")
6185 def ExtendFace(self, theFace, theUMin, theUMax,
6186 theVMin, theVMax, theName=None):
6188 Resize the input face with the new UMin, UMax, VMin and VMax
6189 parameters. The input face U and V parameters range is [0, 1]. If
6190 theUMin parameter is negative, the input face is extended, otherwise
6191 it is shrinked along U direction by theUMin parameter. If theUMax is
6192 greater than 1, the face is extended, otherwise it is shrinked along
6193 U direction by theUMax parameter. So as for theVMin, theVMax and
6194 V direction of the input face.
6197 theFace the input face to be resized.
6198 theUMin the minimal U parameter value.
6199 theUMax the maximal U parameter value.
6200 theVMin the minimal V parameter value.
6201 theVMax the maximal V parameter value.
6202 theName Object name; when specified, this parameter is used
6203 for result publication in the study. Otherwise, if automatic
6204 publication is switched on, default value is used for result name.
6207 New GEOM.GEOM_Object, containing the created face.
6209 theUMin, theUMax, theVMin, theVMax, Parameters = ParseParameters(theUMin, theUMax, theVMin, theVMax)
6210 anObj = self.ShapesOp.ExtendFace(theFace, theUMin, theUMax,
6212 RaiseIfFailed("ExtendFace", self.ShapesOp)
6213 anObj.SetParameters(Parameters)
6214 self._autoPublish(anObj, theName, "face")
6217 ## This function takes some face as input parameter and creates new
6218 # GEOM_Object, i.e. topological shape by extracting underlying surface
6219 # of the source face and limiting it by the Umin, Umax, Vmin, Vmax
6220 # parameters of the source face (in the parametrical space).
6221 # @param theFace the input face.
6222 # @param theName Object name; when specified, this parameter is used
6223 # for result publication in the study. Otherwise, if automatic
6224 # publication is switched on, default value is used for result name.
6225 # @return New GEOM.GEOM_Object, containing the created face.
6227 # @ref tui_creation_surface "Example"
6228 @ManageTransactions("ShapesOp")
6229 def MakeSurfaceFromFace(self, theFace, theName=None):
6231 This function takes some face as input parameter and creates new
6232 GEOM_Object, i.e. topological shape by extracting underlying surface
6233 of the source face and limiting it by the Umin, Umax, Vmin, Vmax
6234 parameters of the source face (in the parametrical space).
6237 theFace the input face.
6238 theName Object name; when specified, this parameter is used
6239 for result publication in the study. Otherwise, if automatic
6240 publication is switched on, default value is used for result name.
6243 New GEOM.GEOM_Object, containing the created face.
6245 anObj = self.ShapesOp.MakeSurfaceFromFace(theFace)
6246 RaiseIfFailed("MakeSurfaceFromFace", self.ShapesOp)
6247 self._autoPublish(anObj, theName, "surface")
6253 ## @addtogroup l4_access
6256 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
6257 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
6258 # @param aShape Shape to get sub-shape of.
6259 # @param ListOfID List of sub-shapes indices.
6260 # @param theName Object name; when specified, this parameter is used
6261 # for result publication in the study. Otherwise, if automatic
6262 # publication is switched on, default value is used for result name.
6264 # @return Found sub-shape.
6266 # @ref swig_all_decompose "Example"
6267 def GetSubShape(self, aShape, ListOfID, theName=None):
6269 Obtain a composite sub-shape of aShape, composed from sub-shapes
6270 of aShape, selected by their unique IDs inside aShape
6273 aShape Shape to get sub-shape of.
6274 ListOfID List of sub-shapes indices.
6275 theName Object name; when specified, this parameter is used
6276 for result publication in the study. Otherwise, if automatic
6277 publication is switched on, default value is used for result name.
6282 # Example: see GEOM_TestAll.py
6283 anObj = self.AddSubShape(aShape,ListOfID)
6284 self._autoPublish(anObj, theName, "subshape")
6287 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
6288 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
6289 # @param aShape Shape to get sub-shape of.
6290 # @param aSubShape Sub-shapes of aShape.
6291 # @return ID of found sub-shape.
6293 # @ref swig_all_decompose "Example"
6294 @ManageTransactions("LocalOp")
6295 def GetSubShapeID(self, aShape, aSubShape):
6297 Obtain unique ID of sub-shape aSubShape inside aShape
6298 of aShape, selected by their unique IDs inside aShape
6301 aShape Shape to get sub-shape of.
6302 aSubShape Sub-shapes of aShape.
6305 ID of found sub-shape.
6307 # Example: see GEOM_TestAll.py
6308 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
6309 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
6312 ## Obtain unique IDs of sub-shapes <VAR>aSubShapes</VAR> inside <VAR>aShape</VAR>
6313 # This function is provided for performance purpose. The complexity is O(n) with n
6314 # the number of subobjects of aShape
6315 # @param aShape Shape to get sub-shape of.
6316 # @param aSubShapes Sub-shapes of aShape.
6317 # @return list of IDs of found sub-shapes.
6319 # @ref swig_all_decompose "Example"
6320 @ManageTransactions("ShapesOp")
6321 def GetSubShapesIDs(self, aShape, aSubShapes):
6323 Obtain a list of IDs of sub-shapes aSubShapes inside aShape
6324 This function is provided for performance purpose. The complexity is O(n) with n
6325 the number of subobjects of aShape
6328 aShape Shape to get sub-shape of.
6329 aSubShapes Sub-shapes of aShape.
6332 List of IDs of found sub-shape.
6334 # Example: see GEOM_TestAll.py
6335 anIDs = self.ShapesOp.GetSubShapesIndices(aShape, aSubShapes)
6336 RaiseIfFailed("GetSubShapesIndices", self.ShapesOp)
6342 ## @addtogroup l4_decompose
6345 ## Get all sub-shapes and groups of \a theShape,
6346 # that were created already by any other methods.
6347 # @param theShape Any shape.
6348 # @param theGroupsOnly If this parameter is TRUE, only groups will be
6349 # returned, else all found sub-shapes and groups.
6350 # @return List of existing sub-objects of \a theShape.
6352 # @ref swig_all_decompose "Example"
6353 @ManageTransactions("ShapesOp")
6354 def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
6356 Get all sub-shapes and groups of theShape,
6357 that were created already by any other methods.
6361 theGroupsOnly If this parameter is TRUE, only groups will be
6362 returned, else all found sub-shapes and groups.
6365 List of existing sub-objects of theShape.
6367 # Example: see GEOM_TestAll.py
6368 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
6369 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
6372 ## Get all groups of \a theShape,
6373 # that were created already by any other methods.
6374 # @param theShape Any shape.
6375 # @return List of existing groups of \a theShape.
6377 # @ref swig_all_decompose "Example"
6378 @ManageTransactions("ShapesOp")
6379 def GetGroups(self, theShape):
6381 Get all groups of theShape,
6382 that were created already by any other methods.
6388 List of existing groups of theShape.
6390 # Example: see GEOM_TestAll.py
6391 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
6392 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
6395 ## Explode a shape on sub-shapes of a given type.
6396 # If the shape itself matches the type, it is also returned.
6397 # @param aShape Shape to be exploded.
6398 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6399 # @param theName Object name; when specified, this parameter is used
6400 # for result publication in the study. Otherwise, if automatic
6401 # publication is switched on, default value is used for result name.
6403 # @return List of sub-shapes of type theShapeType, contained in theShape.
6405 # @ref swig_all_decompose "Example"
6406 @ManageTransactions("ShapesOp")
6407 def SubShapeAll(self, aShape, aType, theName=None):
6409 Explode a shape on sub-shapes of a given type.
6410 If the shape itself matches the type, it is also returned.
6413 aShape Shape to be exploded.
6414 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6415 theName Object name; when specified, this parameter is used
6416 for result publication in the study. Otherwise, if automatic
6417 publication is switched on, default value is used for result name.
6420 List of sub-shapes of type theShapeType, contained in theShape.
6422 # Example: see GEOM_TestAll.py
6423 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), False)
6424 RaiseIfFailed("SubShapeAll", self.ShapesOp)
6425 self._autoPublish(ListObj, theName, "subshape")
6428 ## Explode a shape on sub-shapes of a given type.
6429 # @param aShape Shape to be exploded.
6430 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6431 # @return List of IDs of sub-shapes.
6433 # @ref swig_all_decompose "Example"
6434 @ManageTransactions("ShapesOp")
6435 def SubShapeAllIDs(self, aShape, aType):
6437 Explode a shape on sub-shapes of a given type.
6440 aShape Shape to be exploded (see geompy.ShapeType)
6441 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6444 List of IDs of sub-shapes.
6446 ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), False)
6447 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6450 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
6451 # selected by their indices in list of all sub-shapes of type <VAR>aType</VAR>.
6452 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6453 # @param aShape Shape to get sub-shape of.
6454 # @param ListOfInd List of sub-shapes indices.
6455 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6456 # @param theName Object name; when specified, this parameter is used
6457 # for result publication in the study. Otherwise, if automatic
6458 # publication is switched on, default value is used for result name.
6460 # @return A compound of sub-shapes of aShape.
6462 # @ref swig_all_decompose "Example"
6463 def SubShape(self, aShape, aType, ListOfInd, theName=None):
6465 Obtain a compound of sub-shapes of aShape,
6466 selected by their indices in list of all sub-shapes of type aType.
6467 Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6470 aShape Shape to get sub-shape of.
6471 ListOfID List of sub-shapes indices.
6472 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6473 theName Object name; when specified, this parameter is used
6474 for result publication in the study. Otherwise, if automatic
6475 publication is switched on, default value is used for result name.
6478 A compound of sub-shapes of aShape.
6480 # Example: see GEOM_TestAll.py
6482 AllShapeIDsList = self.SubShapeAllIDs(aShape, EnumToLong( aType ))
6483 for ind in ListOfInd:
6484 ListOfIDs.append(AllShapeIDsList[ind - 1])
6485 # note: auto-publishing is done in self.GetSubShape()
6486 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6489 ## Explode a shape on sub-shapes of a given type.
6490 # Sub-shapes will be sorted taking into account their gravity centers,
6491 # to provide stable order of sub-shapes. Please see
6492 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6493 # If the shape itself matches the type, it is also returned.
6494 # @param aShape Shape to be exploded.
6495 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6496 # @param theName Object name; when specified, this parameter is used
6497 # for result publication in the study. Otherwise, if automatic
6498 # publication is switched on, default value is used for result name.
6500 # @return List of sub-shapes of type theShapeType, contained in theShape.
6502 # @ref swig_SubShapeAllSorted "Example"
6503 @ManageTransactions("ShapesOp")
6504 def SubShapeAllSortedCentres(self, aShape, aType, theName=None):
6506 Explode a shape on sub-shapes of a given type.
6507 Sub-shapes will be sorted taking into account their gravity centers,
6508 to provide stable order of sub-shapes.
6509 If the shape itself matches the type, it is also returned.
6512 aShape Shape to be exploded.
6513 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6514 theName Object name; when specified, this parameter is used
6515 for result publication in the study. Otherwise, if automatic
6516 publication is switched on, default value is used for result name.
6519 List of sub-shapes of type theShapeType, contained in theShape.
6521 # Example: see GEOM_TestAll.py
6522 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), True)
6523 RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
6524 self._autoPublish(ListObj, theName, "subshape")
6527 ## Explode a shape on sub-shapes of a given type.
6528 # Sub-shapes will be sorted taking into account their gravity centers,
6529 # to provide stable order of sub-shapes. Please see
6530 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6531 # @param aShape Shape to be exploded.
6532 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6533 # @return List of IDs of sub-shapes.
6535 # @ref swig_all_decompose "Example"
6536 @ManageTransactions("ShapesOp")
6537 def SubShapeAllSortedCentresIDs(self, aShape, aType):
6539 Explode a shape on sub-shapes of a given type.
6540 Sub-shapes will be sorted taking into account their gravity centers,
6541 to provide stable order of sub-shapes.
6544 aShape Shape to be exploded.
6545 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6548 List of IDs of sub-shapes.
6550 ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), True)
6551 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6554 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
6555 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
6556 # Please see @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6557 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6558 # @param aShape Shape to get sub-shape of.
6559 # @param ListOfInd List of sub-shapes indices.
6560 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6561 # @param theName Object name; when specified, this parameter is used
6562 # for result publication in the study. Otherwise, if automatic
6563 # publication is switched on, default value is used for result name.
6565 # @return A compound of sub-shapes of aShape.
6567 # @ref swig_all_decompose "Example"
6568 def SubShapeSortedCentres(self, aShape, aType, ListOfInd, theName=None):
6570 Obtain a compound of sub-shapes of aShape,
6571 selected by they indices in sorted list of all sub-shapes of type aType.
6572 Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6575 aShape Shape to get sub-shape of.
6576 ListOfID List of sub-shapes indices.
6577 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6578 theName Object name; when specified, this parameter is used
6579 for result publication in the study. Otherwise, if automatic
6580 publication is switched on, default value is used for result name.
6583 A compound of sub-shapes of aShape.
6585 # Example: see GEOM_TestAll.py
6587 AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, EnumToLong( aType ))
6588 for ind in ListOfInd:
6589 ListOfIDs.append(AllShapeIDsList[ind - 1])
6590 # note: auto-publishing is done in self.GetSubShape()
6591 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6594 ## Extract shapes (excluding the main shape) of given type.
6595 # @param aShape The shape.
6596 # @param aType The shape type (see ShapeType())
6597 # @param isSorted Boolean flag to switch sorting on/off. Please see
6598 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6599 # @param theName Object name; when specified, this parameter is used
6600 # for result publication in the study. Otherwise, if automatic
6601 # publication is switched on, default value is used for result name.
6603 # @return List of sub-shapes of type aType, contained in aShape.
6605 # @ref swig_FilletChamfer "Example"
6606 @ManageTransactions("ShapesOp")
6607 def ExtractShapes(self, aShape, aType, isSorted = False, theName=None):
6609 Extract shapes (excluding the main shape) of given type.
6613 aType The shape type (see geompy.ShapeType)
6614 isSorted Boolean flag to switch sorting on/off.
6615 theName Object name; when specified, this parameter is used
6616 for result publication in the study. Otherwise, if automatic
6617 publication is switched on, default value is used for result name.
6620 List of sub-shapes of type aType, contained in aShape.
6622 # Example: see GEOM_TestAll.py
6623 ListObj = self.ShapesOp.ExtractSubShapes(aShape, EnumToLong( aType ), isSorted)
6624 RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
6625 self._autoPublish(ListObj, theName, "subshape")
6628 ## Get a set of sub-shapes defined by their unique IDs inside <VAR>aShape</VAR>
6629 # @param aShape Main shape.
6630 # @param anIDs List of unique IDs of sub-shapes inside <VAR>aShape</VAR>.
6631 # @param theName Object name; when specified, this parameter is used
6632 # for result publication in the study. Otherwise, if automatic
6633 # publication is switched on, default value is used for result name.
6634 # @return List of GEOM.GEOM_Object, corresponding to found sub-shapes.
6636 # @ref swig_all_decompose "Example"
6637 @ManageTransactions("ShapesOp")
6638 def SubShapes(self, aShape, anIDs, theName=None):
6640 Get a set of sub-shapes defined by their unique IDs inside theMainShape
6644 anIDs List of unique IDs of sub-shapes inside theMainShape.
6645 theName Object name; when specified, this parameter is used
6646 for result publication in the study. Otherwise, if automatic
6647 publication is switched on, default value is used for result name.
6650 List of GEOM.GEOM_Object, corresponding to found sub-shapes.
6652 # Example: see GEOM_TestAll.py
6653 ListObj = self.ShapesOp.MakeSubShapes(aShape, anIDs)
6654 RaiseIfFailed("SubShapes", self.ShapesOp)
6655 self._autoPublish(ListObj, theName, "subshape")
6658 ## Explode a shape into edges sorted in a row from a starting point.
6659 # @param theShape the shape to be exploded on edges.
6660 # @param theStartPoint the starting point.
6661 # @param theName Object name; when specified, this parameter is used
6662 # for result publication in the study. Otherwise, if automatic
6663 # publication is switched on, default value is used for result name.
6664 # @return List of GEOM.GEOM_Object that is actually an ordered list
6665 # of edges sorted in a row from a starting point.
6667 # @ref swig_GetSubShapeEdgeSorted "Example"
6668 @ManageTransactions("ShapesOp")
6669 def GetSubShapeEdgeSorted(self, theShape, theStartPoint, theName=None):
6671 Explode a shape into edges sorted in a row from a starting point.
6674 theShape the shape to be exploded on edges.
6675 theStartPoint the starting point.
6676 theName Object name; when specified, this parameter is used
6677 for result publication in the study. Otherwise, if automatic
6678 publication is switched on, default value is used for result name.
6681 List of GEOM.GEOM_Object that is actually an ordered list
6682 of edges sorted in a row from a starting point.
6684 # Example: see GEOM_TestAll.py
6685 ListObj = self.ShapesOp.GetSubShapeEdgeSorted(theShape, theStartPoint)
6686 RaiseIfFailed("GetSubShapeEdgeSorted", self.ShapesOp)
6687 self._autoPublish(ListObj, theName, "SortedEdges")
6691 # Return the list of subshapes that satisfies a certain tolerance
6692 # criterion. The user defines the type of shapes to be returned, the
6693 # condition and the tolerance value. The operation is defined for
6694 # faces, edges and vertices only. E.g. for theShapeType FACE,
6695 # theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
6696 # all faces of theShape that have tolerances greater then 1.e7.
6698 # @param theShape the shape to be exploded
6699 # @param theShapeType the type of sub-shapes to be returned (see
6700 # ShapeType()). Can have the values FACE, EDGE and VERTEX only.
6701 # @param theCondition the condition type (see GEOM::comparison_condition).
6702 # @param theTolerance the tolerance filter.
6703 # @param theName Object name; when specified, this parameter is used
6704 # for result publication in the study. Otherwise, if automatic
6705 # publication is switched on, default value is used for result name.
6706 # @return the list of shapes that satisfy the conditions.
6708 # @ref swig_GetSubShapesWithTolerance "Example"
6709 @ManageTransactions("ShapesOp")
6710 def GetSubShapesWithTolerance(self, theShape, theShapeType,
6711 theCondition, theTolerance, theName=None):
6713 Return the list of subshapes that satisfies a certain tolerance
6714 criterion. The user defines the type of shapes to be returned, the
6715 condition and the tolerance value. The operation is defined for
6716 faces, edges and vertices only. E.g. for theShapeType FACE,
6717 theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
6718 all faces of theShape that have tolerances greater then 1.e7.
6721 theShape the shape to be exploded
6722 theShapeType the type of sub-shapes to be returned (see
6723 ShapeType()). Can have the values FACE,
6724 EDGE and VERTEX only.
6725 theCondition the condition type (see GEOM::comparison_condition).
6726 theTolerance the tolerance filter.
6727 theName Object name; when specified, this parameter is used
6728 for result publication in the study. Otherwise, if automatic
6729 publication is switched on, default value is used for result name.
6732 The list of shapes that satisfy the conditions.
6734 # Example: see GEOM_TestAll.py
6735 ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
6736 theCondition, theTolerance)
6737 RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
6738 self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
6741 ## Check if the object is a sub-object of another GEOM object.
6742 # @param aSubObject Checked sub-object (or its parent object, in case if
6743 # \a theSubObjectIndex is non-zero).
6744 # @param anObject An object that is checked for ownership (or its parent object,
6745 # in case if \a theObjectIndex is non-zero).
6746 # @param aSubObjectIndex When non-zero, specifies a sub-shape index that
6747 # identifies a sub-object within its parent specified via \a theSubObject.
6748 # @param anObjectIndex When non-zero, specifies a sub-shape index that
6749 # identifies an object within its parent specified via \a theObject.
6750 # @return TRUE, if the given object contains sub-object.
6751 @ManageTransactions("ShapesOp")
6752 def IsSubShapeBelongsTo(self, aSubObject, anObject, aSubObjectIndex = 0, anObjectIndex = 0):
6754 Check if the object is a sub-object of another GEOM object.
6757 aSubObject Checked sub-object (or its parent object, in case if
6758 \a theSubObjectIndex is non-zero).
6759 anObject An object that is checked for ownership (or its parent object,
6760 in case if \a theObjectIndex is non-zero).
6761 aSubObjectIndex When non-zero, specifies a sub-shape index that
6762 identifies a sub-object within its parent specified via \a theSubObject.
6763 anObjectIndex When non-zero, specifies a sub-shape index that
6764 identifies an object within its parent specified via \a theObject.
6767 TRUE, if the given object contains sub-object.
6769 IsOk = self.ShapesOp.IsSubShapeBelongsTo(aSubObject, aSubObjectIndex, anObject, anObjectIndex)
6770 RaiseIfFailed("IsSubShapeBelongsTo", self.ShapesOp)
6773 ## Perform extraction of sub-shapes from the main shape.
6775 # @param theShape the main shape
6776 # @param theListOfID the list of sub-shape IDs to be extracted from
6778 # @return New GEOM.GEOM_Object, containing the shape without
6779 # extracted sub-shapes.
6781 # @ref swig_MakeExtraction "Example"
6782 @ManageTransactions("ShapesOp")
6783 def MakeExtraction(self, theShape, theListOfID, theName=None):
6785 Perform extraction of sub-shapes from the main shape.
6788 theShape the main shape
6789 theListOfID the list of sub-shape IDs to be extracted from
6793 New GEOM.GEOM_Object, containing the shape without
6794 extracted sub-shapes.
6796 # Example: see GEOM_TestAll.py
6797 (anObj, aStat) = self.ShapesOp.MakeExtraction(theShape, theListOfID)
6798 RaiseIfFailed("MakeExtraction", self.ShapesOp)
6799 self._autoPublish(anObj, theName, "Extraction")
6802 # end of l4_decompose
6805 ## @addtogroup l4_decompose_d
6808 ## Deprecated method
6809 # It works like SubShapeAllSortedCentres(), but wrongly
6810 # defines centres of faces, shells and solids.
6811 @ManageTransactions("ShapesOp")
6812 def SubShapeAllSorted(self, aShape, aType, theName=None):
6815 It works like geompy.SubShapeAllSortedCentres, but wrongly
6816 defines centres of faces, shells and solids.
6818 ListObj = self.ShapesOp.MakeExplode(aShape, EnumToLong( aType ), True)
6819 RaiseIfFailed("MakeExplode", self.ShapesOp)
6820 self._autoPublish(ListObj, theName, "subshape")
6823 ## Deprecated method
6824 # It works like SubShapeAllSortedCentresIDs(), but wrongly
6825 # defines centres of faces, shells and solids.
6826 @ManageTransactions("ShapesOp")
6827 def SubShapeAllSortedIDs(self, aShape, aType):
6830 It works like geompy.SubShapeAllSortedCentresIDs, but wrongly
6831 defines centres of faces, shells and solids.
6833 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, EnumToLong( aType ), True)
6834 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6837 ## Deprecated method
6838 # It works like SubShapeSortedCentres(), but has a bug
6839 # (wrongly defines centres of faces, shells and solids).
6840 def SubShapeSorted(self, aShape, aType, ListOfInd, theName=None):
6843 It works like geompy.SubShapeSortedCentres, but has a bug
6844 (wrongly defines centres of faces, shells and solids).
6847 AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, EnumToLong( aType ))
6848 for ind in ListOfInd:
6849 ListOfIDs.append(AllShapeIDsList[ind - 1])
6850 # note: auto-publishing is done in self.GetSubShape()
6851 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6854 # end of l4_decompose_d
6857 ## @addtogroup l3_healing
6860 ## Apply a sequence of Shape Healing operators to the given object.
6861 # @param theShape Shape to be processed.
6862 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
6863 # @param theParameters List of names of parameters
6864 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
6865 # @param theValues List of values of parameters, in the same order
6866 # as parameters are listed in <VAR>theParameters</VAR> list.
6867 # @param theName Object name; when specified, this parameter is used
6868 # for result publication in the study. Otherwise, if automatic
6869 # publication is switched on, default value is used for result name.
6871 # <b> Operators and Parameters: </b> \n
6873 # * \b FixShape - corrects invalid shapes. \n
6874 # - \b FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them. \n
6875 # - \b FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction. \n
6877 # * \b FixFaceSize - removes small faces, such as spots and strips.\n
6878 # - \b FixFaceSize.Tolerance - defines minimum possible face size. \n
6879 # - \b DropSmallEdges - removes edges, which merge with neighbouring edges. \n
6880 # - \b DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.\n
6881 # - \b DropSmallSolids - either removes small solids or merges them with neighboring ones. \n
6882 # - \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
6883 # - \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
6884 # - \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
6886 # * \b SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical
6887 # surfaces in segments using a certain angle. \n
6888 # - \b SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
6889 # if Angle=180, four if Angle=90, etc). \n
6890 # - \b SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.\n
6892 # * \b SplitClosedFaces - splits closed faces in segments.
6893 # The number of segments depends on the number of splitting points.\n
6894 # - \b SplitClosedFaces.NbSplitPoints - the number of splitting points.\n
6896 # * \b SplitContinuity - splits shapes to reduce continuities of curves and surfaces.\n
6897 # - \b SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.\n
6898 # - \b SplitContinuity.SurfaceContinuity - required continuity for surfaces.\n
6899 # - \b SplitContinuity.CurveContinuity - required continuity for curves.\n
6900 # This and the previous parameters can take the following values:\n
6901 # \b Parametric \b Continuity \n
6902 # \b C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces
6903 # are coincidental. The curves or surfaces may still meet at an angle, giving rise to a sharp corner or edge).\n
6904 # \b C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces are parallel,
6905 # ruling out sharp edges).\n
6906 # \b C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves or surfaces
6907 # are of the same magnitude).\n
6908 # \b CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of curves
6909 # or surfaces (d/du C(u)) are the same at junction. \n
6910 # \b Geometric \b Continuity \n
6911 # \b G1: first derivatives are proportional at junction.\n
6912 # The curve tangents thus have the same direction, but not necessarily the same magnitude.
6913 # i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).\n
6914 # \b G2: first and second derivatives are proportional at junction.
6915 # As the names imply, geometric continuity requires the geometry to be continuous, while parametric
6916 # continuity requires that the underlying parameterization was continuous as well.
6917 # Parametric continuity of order n implies geometric continuity of order n, but not vice-versa.\n
6919 # * \b BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:\n
6920 # - \b BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.\n
6921 # - \b BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.\n
6922 # - \b BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.\n
6923 # - \b BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation
6924 # with the specified parameters.\n
6925 # - \b BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation
6926 # with the specified parameters.\n
6927 # - \b BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.\n
6928 # - \b BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.\n
6929 # - \b BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.\n
6930 # - \b BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.\n
6932 # * \b ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.\n
6933 # - \b ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.\n
6934 # - \b ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.\n
6935 # - \b ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.\n
6936 # - \b ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.\n
6938 # * \b SameParameter - fixes edges of 2D and 3D curves not having the same parameter.\n
6939 # - \b SameParameter.Tolerance3d - defines tolerance for fixing of edges.\n
6942 # @return New GEOM.GEOM_Object, containing processed shape.
6944 # \n @ref tui_shape_processing "Example"
6945 @ManageTransactions("HealOp")
6946 def ProcessShape(self, theShape, theOperators, theParameters, theValues, theName=None):
6948 Apply a sequence of Shape Healing operators to the given object.
6951 theShape Shape to be processed.
6952 theValues List of values of parameters, in the same order
6953 as parameters are listed in theParameters list.
6954 theOperators List of names of operators ('FixShape', 'SplitClosedFaces', etc.).
6955 theParameters List of names of parameters
6956 ('FixShape.Tolerance3d', 'SplitClosedFaces.NbSplitPoints', etc.).
6957 theName Object name; when specified, this parameter is used
6958 for result publication in the study. Otherwise, if automatic
6959 publication is switched on, default value is used for result name.
6961 Operators and Parameters:
6963 * FixShape - corrects invalid shapes.
6964 * FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them.
6965 * FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction.
6966 * FixFaceSize - removes small faces, such as spots and strips.
6967 * FixFaceSize.Tolerance - defines minimum possible face size.
6968 * DropSmallEdges - removes edges, which merge with neighbouring edges.
6969 * DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.
6970 * DropSmallSolids - either removes small solids or merges them with neighboring ones.
6971 * 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.
6972 * 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.
6973 * 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.
6975 * SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical surfaces
6976 in segments using a certain angle.
6977 * SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
6978 if Angle=180, four if Angle=90, etc).
6979 * SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.
6980 * SplitClosedFaces - splits closed faces in segments. The number of segments depends on the number of
6982 * SplitClosedFaces.NbSplitPoints - the number of splitting points.
6983 * SplitContinuity - splits shapes to reduce continuities of curves and surfaces.
6984 * SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.
6985 * SplitContinuity.SurfaceContinuity - required continuity for surfaces.
6986 * SplitContinuity.CurveContinuity - required continuity for curves.
6987 This and the previous parameters can take the following values:
6989 Parametric Continuity:
6990 C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces are
6991 coincidental. The curves or surfaces may still meet at an angle,
6992 giving rise to a sharp corner or edge).
6993 C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces
6994 are parallel, ruling out sharp edges).
6995 C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves
6996 or surfaces are of the same magnitude).
6997 CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of
6998 curves or surfaces (d/du C(u)) are the same at junction.
7000 Geometric Continuity:
7001 G1: first derivatives are proportional at junction.
7002 The curve tangents thus have the same direction, but not necessarily the same magnitude.
7003 i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).
7004 G2: first and second derivatives are proportional at junction. As the names imply,
7005 geometric continuity requires the geometry to be continuous, while parametric continuity requires
7006 that the underlying parameterization was continuous as well. Parametric continuity of order n implies
7007 geometric continuity of order n, but not vice-versa.
7008 * BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:
7009 * BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.
7010 * BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.
7011 * BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.
7012 * BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation with
7013 the specified parameters.
7014 * BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation with
7015 the specified parameters.
7016 * BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.
7017 * BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.
7018 * BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.
7019 * BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.
7020 * ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.
7021 * ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.
7022 * ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.
7023 * ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.
7024 * ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.
7025 * SameParameter - fixes edges of 2D and 3D curves not having the same parameter.
7026 * SameParameter.Tolerance3d - defines tolerance for fixing of edges.
7029 New GEOM.GEOM_Object, containing processed shape.
7031 Note: For more information look through SALOME Geometry User's Guide->
7032 -> Introduction to Geometry-> Repairing Operations-> Shape Processing
7034 # Example: see GEOM_TestHealing.py
7035 theValues,Parameters = ParseList(theValues)
7036 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
7037 # To avoid script failure in case of good argument shape
7038 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
7040 RaiseIfFailed("ProcessShape", self.HealOp)
7041 for string in (theOperators + theParameters):
7042 Parameters = ":" + Parameters
7044 anObj.SetParameters(Parameters)
7045 self._autoPublish(anObj, theName, "healed")
7048 ## Remove faces from the given object (shape).
7049 # @param theObject Shape to be processed.
7050 # @param theFaces Indices of faces to be removed, if EMPTY then the method
7051 # removes ALL faces of the given object.
7052 # @param theName Object name; when specified, this parameter is used
7053 # for result publication in the study. Otherwise, if automatic
7054 # publication is switched on, default value is used for result name.
7056 # @return New GEOM.GEOM_Object, containing processed shape.
7058 # @ref tui_suppress_faces "Example"
7059 @ManageTransactions("HealOp")
7060 def SuppressFaces(self, theObject, theFaces, theName=None):
7062 Remove faces from the given object (shape).
7065 theObject Shape to be processed.
7066 theFaces Indices of faces to be removed, if EMPTY then the method
7067 removes ALL faces of the given object.
7068 theName Object name; when specified, this parameter is used
7069 for result publication in the study. Otherwise, if automatic
7070 publication is switched on, default value is used for result name.
7073 New GEOM.GEOM_Object, containing processed shape.
7075 # Example: see GEOM_TestHealing.py
7076 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
7077 RaiseIfFailed("SuppressFaces", self.HealOp)
7078 self._autoPublish(anObj, theName, "suppressFaces")
7081 ## Sewing of faces into a single shell.
7082 # @param ListShape Shapes to be processed.
7083 # @param theTolerance Required tolerance value.
7084 # @param AllowNonManifold Flag that allows non-manifold sewing.
7085 # @param theName Object name; when specified, this parameter is used
7086 # for result publication in the study. Otherwise, if automatic
7087 # publication is switched on, default value is used for result name.
7089 # @return New GEOM.GEOM_Object, containing a result shell.
7091 # @ref tui_sewing "Example"
7092 def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
7094 Sewing of faces into a single shell.
7097 ListShape Shapes to be processed.
7098 theTolerance Required tolerance value.
7099 AllowNonManifold Flag that allows non-manifold sewing.
7100 theName Object name; when specified, this parameter is used
7101 for result publication in the study. Otherwise, if automatic
7102 publication is switched on, default value is used for result name.
7105 New GEOM.GEOM_Object, containing containing a result shell.
7107 # Example: see GEOM_TestHealing.py
7108 # note: auto-publishing is done in self.Sew()
7109 anObj = self.Sew(ListShape, theTolerance, AllowNonManifold, theName)
7112 ## Sewing of faces into a single shell.
7113 # @param ListShape Shapes to be processed.
7114 # @param theTolerance Required tolerance value.
7115 # @param AllowNonManifold Flag that allows non-manifold sewing.
7116 # @param theName Object name; when specified, this parameter is used
7117 # for result publication in the study. Otherwise, if automatic
7118 # publication is switched on, default value is used for result name.
7120 # @return New GEOM.GEOM_Object, containing a result shell.
7121 @ManageTransactions("HealOp")
7122 def Sew(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
7124 Sewing of faces into a single shell.
7127 ListShape Shapes to be processed.
7128 theTolerance Required tolerance value.
7129 AllowNonManifold Flag that allows non-manifold sewing.
7130 theName Object name; when specified, this parameter is used
7131 for result publication in the study. Otherwise, if automatic
7132 publication is switched on, default value is used for result name.
7135 New GEOM.GEOM_Object, containing a result shell.
7137 # Example: see MakeSewing() above
7138 theTolerance,Parameters = ParseParameters(theTolerance)
7139 if AllowNonManifold:
7140 anObj = self.HealOp.SewAllowNonManifold( ToList( ListShape ), theTolerance)
7142 anObj = self.HealOp.Sew( ToList( ListShape ), theTolerance)
7143 # To avoid script failure in case of good argument shape
7144 # (Fix of test cases geom/bugs11/L7,L8)
7145 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
7147 RaiseIfFailed("Sew", self.HealOp)
7148 anObj.SetParameters(Parameters)
7149 self._autoPublish(anObj, theName, "sewed")
7152 ## Rebuild the topology of theSolids by removing
7153 # the faces that are shared by several solids.
7154 # @param theSolids A compound or a list of solids to be processed.
7155 # @param theName Object name; when specified, this parameter is used
7156 # for result publication in the study. Otherwise, if automatic
7157 # publication is switched on, default value is used for result name.
7159 # @return New GEOM.GEOM_Object, containing processed shape.
7161 # @ref tui_remove_webs "Example"
7162 @ManageTransactions("HealOp")
7163 def RemoveInternalFaces (self, theSolids, theName=None):
7165 Rebuild the topology of theSolids by removing
7166 the faces that are shared by several solids.
7169 theSolids A compound or a list of solids to be processed.
7170 theName Object name; when specified, this parameter is used
7171 for result publication in the study. Otherwise, if automatic
7172 publication is switched on, default value is used for result name.
7175 New GEOM.GEOM_Object, containing processed shape.
7177 # Example: see GEOM_TestHealing.py
7178 anObj = self.HealOp.RemoveInternalFaces(ToList(theSolids))
7179 RaiseIfFailed("RemoveInternalFaces", self.HealOp)
7180 self._autoPublish(anObj, theName, "removeWebs")
7183 ## Remove internal wires and edges from the given object (face).
7184 # @param theObject Shape to be processed.
7185 # @param theWires Indices of wires to be removed, if EMPTY then the method
7186 # removes ALL internal wires of the given object.
7187 # @param theName Object name; when specified, this parameter is used
7188 # for result publication in the study. Otherwise, if automatic
7189 # publication is switched on, default value is used for result name.
7191 # @return New GEOM.GEOM_Object, containing processed shape.
7193 # @ref tui_suppress_internal_wires "Example"
7194 @ManageTransactions("HealOp")
7195 def SuppressInternalWires(self, theObject, theWires, theName=None):
7197 Remove internal wires and edges from the given object (face).
7200 theObject Shape to be processed.
7201 theWires Indices of wires to be removed, if EMPTY then the method
7202 removes ALL internal wires of the given object.
7203 theName Object name; when specified, this parameter is used
7204 for result publication in the study. Otherwise, if automatic
7205 publication is switched on, default value is used for result name.
7208 New GEOM.GEOM_Object, containing processed shape.
7210 # Example: see GEOM_TestHealing.py
7211 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
7212 RaiseIfFailed("RemoveIntWires", self.HealOp)
7213 self._autoPublish(anObj, theName, "suppressWires")
7216 ## Remove internal closed contours (holes) from the given object.
7217 # @param theObject Shape to be processed.
7218 # @param theWires Indices of wires to be removed, if EMPTY then the method
7219 # removes ALL internal holes of the given object
7220 # @param theName Object name; when specified, this parameter is used
7221 # for result publication in the study. Otherwise, if automatic
7222 # publication is switched on, default value is used for result name.
7224 # @return New GEOM.GEOM_Object, containing processed shape.
7226 # @ref tui_suppress_holes "Example"
7227 @ManageTransactions("HealOp")
7228 def SuppressHoles(self, theObject, theWires, theName=None):
7230 Remove internal closed contours (holes) from the given object.
7233 theObject Shape to be processed.
7234 theWires Indices of wires to be removed, if EMPTY then the method
7235 removes ALL internal holes of the given object
7236 theName Object name; when specified, this parameter is used
7237 for result publication in the study. Otherwise, if automatic
7238 publication is switched on, default value is used for result name.
7241 New GEOM.GEOM_Object, containing processed shape.
7243 # Example: see GEOM_TestHealing.py
7244 anObj = self.HealOp.FillHoles(theObject, theWires)
7245 RaiseIfFailed("FillHoles", self.HealOp)
7246 self._autoPublish(anObj, theName, "suppressHoles")
7249 ## Close an open wire.
7250 # @param theObject Shape to be processed.
7251 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
7252 # if [ ], then <VAR>theObject</VAR> itself is a wire.
7253 # @param isCommonVertex If True : closure by creation of a common vertex,
7254 # If False : closure by creation of an edge between ends.
7255 # @param theName Object name; when specified, this parameter is used
7256 # for result publication in the study. Otherwise, if automatic
7257 # publication is switched on, default value is used for result name.
7259 # @return New GEOM.GEOM_Object, containing processed shape.
7261 # @ref tui_close_contour "Example"
7262 @ManageTransactions("HealOp")
7263 def CloseContour(self,theObject, theWires, isCommonVertex, theName=None):
7268 theObject Shape to be processed.
7269 theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape,
7270 if [ ], then theObject itself is a wire.
7271 isCommonVertex If True : closure by creation of a common vertex,
7272 If False : closure by creation of an edge between ends.
7273 theName Object name; when specified, this parameter is used
7274 for result publication in the study. Otherwise, if automatic
7275 publication is switched on, default value is used for result name.
7278 New GEOM.GEOM_Object, containing processed shape.
7280 # Example: see GEOM_TestHealing.py
7281 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
7282 RaiseIfFailed("CloseContour", self.HealOp)
7283 self._autoPublish(anObj, theName, "closeContour")
7286 ## Addition of a point to a given edge object.
7287 # @param theObject Shape to be processed.
7288 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
7289 # if -1, then theObject itself is the edge.
7290 # @param theValue Value of parameter on edge or length parameter,
7291 # depending on \a isByParameter.
7292 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], \n
7293 # if FALSE : \a theValue is treated as a length parameter [0..1]
7294 # @param theName Object name; when specified, this parameter is used
7295 # for result publication in the study. Otherwise, if automatic
7296 # publication is switched on, default value is used for result name.
7298 # @return New GEOM.GEOM_Object, containing processed shape.
7300 # @ref tui_add_point_on_edge "Example"
7301 @ManageTransactions("HealOp")
7302 def DivideEdge(self, theObject, theEdgeIndex, theValue, isByParameter, theName=None):
7304 Addition of a point to a given edge object.
7307 theObject Shape to be processed.
7308 theEdgeIndex Index of edge to be divided within theObject's shape,
7309 if -1, then theObject itself is the edge.
7310 theValue Value of parameter on edge or length parameter,
7311 depending on isByParameter.
7312 isByParameter If TRUE : theValue is treated as a curve parameter [0..1],
7313 if FALSE : theValue is treated as a length parameter [0..1]
7314 theName Object name; when specified, this parameter is used
7315 for result publication in the study. Otherwise, if automatic
7316 publication is switched on, default value is used for result name.
7319 New GEOM.GEOM_Object, containing processed shape.
7321 # Example: see GEOM_TestHealing.py
7322 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
7323 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
7324 RaiseIfFailed("DivideEdge", self.HealOp)
7325 anObj.SetParameters(Parameters)
7326 self._autoPublish(anObj, theName, "divideEdge")
7329 ## Addition of points to a given edge of \a theObject by projecting
7330 # other points to the given edge.
7331 # @param theObject Shape to be processed.
7332 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
7333 # if -1, then theObject itself is the edge.
7334 # @param thePoints List of points to project to theEdgeIndex-th edge.
7335 # @param theName Object name; when specified, this parameter is used
7336 # for result publication in the study. Otherwise, if automatic
7337 # publication is switched on, default value is used for result name.
7339 # @return New GEOM.GEOM_Object, containing processed shape.
7341 # @ref tui_add_point_on_edge "Example"
7342 @ManageTransactions("HealOp")
7343 def DivideEdgeByPoint(self, theObject, theEdgeIndex, thePoints, theName=None):
7345 Addition of points to a given edge of \a theObject by projecting
7346 other points to the given edge.
7349 theObject Shape to be processed.
7350 theEdgeIndex The edge or its index to be divided within theObject's shape,
7351 if -1, then theObject itself is the edge.
7352 thePoints List of points to project to theEdgeIndex-th edge.
7353 theName Object name; when specified, this parameter is used
7354 for result publication in the study. Otherwise, if automatic
7355 publication is switched on, default value is used for result name.
7358 New GEOM.GEOM_Object, containing processed shape.
7360 # Example: see GEOM_TestHealing.py
7361 if isinstance( theEdgeIndex, GEOM._objref_GEOM_Object ):
7362 theEdgeIndex = self.GetSubShapeID( theObject, theEdgeIndex )
7363 anObj = self.HealOp.DivideEdgeByPoint(theObject, theEdgeIndex, ToList( thePoints ))
7364 RaiseIfFailed("DivideEdgeByPoint", self.HealOp)
7365 self._autoPublish(anObj, theName, "divideEdge")
7368 ## Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
7369 # @param theWire Wire to minimize the number of C1 continuous edges in.
7370 # @param theVertices A list of vertices to suppress. If the list
7371 # is empty, all vertices in a wire will be assumed.
7372 # @param theName Object name; when specified, this parameter is used
7373 # for result publication in the study. Otherwise, if automatic
7374 # publication is switched on, default value is used for result name.
7376 # @return New GEOM.GEOM_Object with modified wire.
7378 # @ref tui_fuse_collinear_edges "Example"
7379 @ManageTransactions("HealOp")
7380 def FuseCollinearEdgesWithinWire(self, theWire, theVertices = [], theName=None):
7382 Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
7385 theWire Wire to minimize the number of C1 continuous edges in.
7386 theVertices A list of vertices to suppress. If the list
7387 is empty, all vertices in a wire will be assumed.
7388 theName Object name; when specified, this parameter is used
7389 for result publication in the study. Otherwise, if automatic
7390 publication is switched on, default value is used for result name.
7393 New GEOM.GEOM_Object with modified wire.
7395 anObj = self.HealOp.FuseCollinearEdgesWithinWire(theWire, theVertices)
7396 RaiseIfFailed("FuseCollinearEdgesWithinWire", self.HealOp)
7397 self._autoPublish(anObj, theName, "fuseEdges")
7400 ## Change orientation of the given object. Updates given shape.
7401 # @param theObject Shape to be processed.
7402 # @return Updated <var>theObject</var>
7404 # @ref swig_todo "Example"
7405 @ManageTransactions("HealOp")
7406 def ChangeOrientationShell(self,theObject):
7408 Change orientation of the given object. Updates given shape.
7411 theObject Shape to be processed.
7416 theObject = self.HealOp.ChangeOrientation(theObject)
7417 RaiseIfFailed("ChangeOrientation", self.HealOp)
7420 ## Change orientation of the given object.
7421 # @param theObject Shape to be processed.
7422 # @param theName Object name; when specified, this parameter is used
7423 # for result publication in the study. Otherwise, if automatic
7424 # publication is switched on, default value is used for result name.
7426 # @return New GEOM.GEOM_Object, containing processed shape.
7428 # @ref swig_todo "Example"
7429 @ManageTransactions("HealOp")
7430 def ChangeOrientationShellCopy(self, theObject, theName=None):
7432 Change orientation of the given object.
7435 theObject Shape to be processed.
7436 theName Object name; when specified, this parameter is used
7437 for result publication in the study. Otherwise, if automatic
7438 publication is switched on, default value is used for result name.
7441 New GEOM.GEOM_Object, containing processed shape.
7443 anObj = self.HealOp.ChangeOrientationCopy(theObject)
7444 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
7445 self._autoPublish(anObj, theName, "reversed")
7448 ## Try to limit tolerance of the given object by value \a theTolerance.
7449 # @param theObject Shape to be processed.
7450 # @param theTolerance Required tolerance value.
7451 # @param theName Object name; when specified, this parameter is used
7452 # for result publication in the study. Otherwise, if automatic
7453 # publication is switched on, default value is used for result name.
7455 # @return New GEOM.GEOM_Object, containing processed shape.
7457 # @ref tui_limit_tolerance "Example"
7458 @ManageTransactions("HealOp")
7459 def LimitTolerance(self, theObject, theTolerance = 1e-07, theName=None):
7461 Try to limit tolerance of the given object by value theTolerance.
7464 theObject Shape to be processed.
7465 theTolerance Required tolerance value.
7466 theName Object name; when specified, this parameter is used
7467 for result publication in the study. Otherwise, if automatic
7468 publication is switched on, default value is used for result name.
7471 New GEOM.GEOM_Object, containing processed shape.
7473 anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
7474 RaiseIfFailed("LimitTolerance", self.HealOp)
7475 self._autoPublish(anObj, theName, "limitTolerance")
7478 ## Get a list of wires (wrapped in GEOM.GEOM_Object-s),
7479 # that constitute a free boundary of the given shape.
7480 # @param theObject Shape to get free boundary of.
7481 # @param theName Object name; when specified, this parameter is used
7482 # for result publication in the study. Otherwise, if automatic
7483 # publication is switched on, default value is used for result name.
7485 # @return [\a status, \a theClosedWires, \a theOpenWires]
7486 # \n \a status: FALSE, if an error(s) occurred during the method execution.
7487 # \n \a theClosedWires: Closed wires on the free boundary of the given shape.
7488 # \n \a theOpenWires: Open wires on the free boundary of the given shape.
7490 # @ref tui_free_boundaries_page "Example"
7491 @ManageTransactions("HealOp")
7492 def GetFreeBoundary(self, theObject, theName=None):
7494 Get a list of wires (wrapped in GEOM.GEOM_Object-s),
7495 that constitute a free boundary of the given shape.
7498 theObject Shape to get free boundary of.
7499 theName Object name; when specified, this parameter is used
7500 for result publication in the study. Otherwise, if automatic
7501 publication is switched on, default value is used for result name.
7504 [status, theClosedWires, theOpenWires]
7505 status: FALSE, if an error(s) occurred during the method execution.
7506 theClosedWires: Closed wires on the free boundary of the given shape.
7507 theOpenWires: Open wires on the free boundary of the given shape.
7509 # Example: see GEOM_TestHealing.py
7510 anObj = self.HealOp.GetFreeBoundary( ToList( theObject ))
7511 RaiseIfFailed("GetFreeBoundary", self.HealOp)
7512 self._autoPublish(anObj[1], theName, "closedWire")
7513 self._autoPublish(anObj[2], theName, "openWire")
7516 ## Replace coincident faces in \a theShapes by one face.
7517 # @param theShapes Initial shapes, either a list or compound of shapes.
7518 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
7519 # @param doKeepNonSolids If FALSE, only solids will present in the result,
7520 # otherwise all initial shapes.
7521 # @param theName Object name; when specified, this parameter is used
7522 # for result publication in the study. Otherwise, if automatic
7523 # publication is switched on, default value is used for result name.
7525 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7527 # @ref tui_glue_faces "Example"
7528 @ManageTransactions("ShapesOp")
7529 def MakeGlueFaces(self, theShapes, theTolerance, doKeepNonSolids=True, theName=None):
7531 Replace coincident faces in theShapes by one face.
7534 theShapes Initial shapes, either a list or compound of shapes.
7535 theTolerance Maximum distance between faces, which can be considered as coincident.
7536 doKeepNonSolids If FALSE, only solids will present in the result,
7537 otherwise all initial shapes.
7538 theName Object name; when specified, this parameter is used
7539 for result publication in the study. Otherwise, if automatic
7540 publication is switched on, default value is used for result name.
7543 New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7545 # Example: see GEOM_Spanner.py
7546 theTolerance,Parameters = ParseParameters(theTolerance)
7547 anObj = self.ShapesOp.MakeGlueFaces(ToList(theShapes), theTolerance, doKeepNonSolids)
7549 raise RuntimeError("MakeGlueFaces : " + self.ShapesOp.GetErrorCode())
7550 anObj.SetParameters(Parameters)
7551 self._autoPublish(anObj, theName, "glueFaces")
7554 ## Find coincident faces in \a theShapes for possible gluing.
7555 # @param theShapes Initial shapes, either a list or compound of shapes.
7556 # @param theTolerance Maximum distance between faces,
7557 # which can be considered as coincident.
7558 # @param theName Object name; when specified, this parameter is used
7559 # for result publication in the study. Otherwise, if automatic
7560 # publication is switched on, default value is used for result name.
7562 # @return GEOM.ListOfGO
7564 # @ref tui_glue_faces "Example"
7565 @ManageTransactions("ShapesOp")
7566 def GetGlueFaces(self, theShapes, theTolerance, theName=None):
7568 Find coincident faces in theShapes for possible gluing.
7571 theShapes Initial shapes, either a list or compound of shapes.
7572 theTolerance Maximum distance between faces,
7573 which can be considered as coincident.
7574 theName Object name; when specified, this parameter is used
7575 for result publication in the study. Otherwise, if automatic
7576 publication is switched on, default value is used for result name.
7581 anObj = self.ShapesOp.GetGlueFaces(ToList(theShapes), theTolerance)
7582 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
7583 self._autoPublish(anObj, theName, "facesToGlue")
7586 ## Replace coincident faces in \a theShapes by one face
7587 # in compliance with given list of faces
7588 # @param theShapes Initial shapes, either a list or compound of shapes.
7589 # @param theTolerance Maximum distance between faces,
7590 # which can be considered as coincident.
7591 # @param theFaces List of faces for gluing.
7592 # @param doKeepNonSolids If FALSE, only solids will present in the result,
7593 # otherwise all initial shapes.
7594 # @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
7595 # will be glued, otherwise only the edges,
7596 # belonging to <VAR>theFaces</VAR>.
7597 # @param theName Object name; when specified, this parameter is used
7598 # for result publication in the study. Otherwise, if automatic
7599 # publication is switched on, default value is used for result name.
7601 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7603 # @ref tui_glue_faces "Example"
7604 @ManageTransactions("ShapesOp")
7605 def MakeGlueFacesByList(self, theShapes, theTolerance, theFaces,
7606 doKeepNonSolids=True, doGlueAllEdges=True, theName=None):
7608 Replace coincident faces in theShapes by one face
7609 in compliance with given list of faces
7612 theShapes theShapes Initial shapes, either a list or compound of shapes.
7613 theTolerance Maximum distance between faces,
7614 which can be considered as coincident.
7615 theFaces List of faces for gluing.
7616 doKeepNonSolids If FALSE, only solids will present in the result,
7617 otherwise all initial shapes.
7618 doGlueAllEdges If TRUE, all coincident edges of theShape
7619 will be glued, otherwise only the edges,
7620 belonging to theFaces.
7621 theName Object name; when specified, this parameter is used
7622 for result publication in the study. Otherwise, if automatic
7623 publication is switched on, default value is used for result name.
7626 New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7628 anObj = self.ShapesOp.MakeGlueFacesByList(ToList(theShapes), theTolerance, ToList(theFaces),
7629 doKeepNonSolids, doGlueAllEdges)
7631 raise RuntimeError("MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode())
7632 self._autoPublish(anObj, theName, "glueFaces")
7635 ## Replace coincident edges in \a theShapes by one edge.
7636 # @param theShapes Initial shapes, either a list or compound of shapes.
7637 # @param theTolerance Maximum distance between edges, which can be considered as coincident.
7638 # @param theName Object name; when specified, this parameter is used
7639 # for result publication in the study. Otherwise, if automatic
7640 # publication is switched on, default value is used for result name.
7642 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7644 # @ref tui_glue_edges "Example"
7645 @ManageTransactions("ShapesOp")
7646 def MakeGlueEdges(self, theShapes, theTolerance, theName=None):
7648 Replace coincident edges in theShapes by one edge.
7651 theShapes Initial shapes, either a list or compound of shapes.
7652 theTolerance Maximum distance between edges, which can be considered as coincident.
7653 theName Object name; when specified, this parameter is used
7654 for result publication in the study. Otherwise, if automatic
7655 publication is switched on, default value is used for result name.
7658 New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7660 theTolerance,Parameters = ParseParameters(theTolerance)
7661 anObj = self.ShapesOp.MakeGlueEdges(ToList(theShapes), theTolerance)
7663 raise RuntimeError("MakeGlueEdges : " + self.ShapesOp.GetErrorCode())
7664 anObj.SetParameters(Parameters)
7665 self._autoPublish(anObj, theName, "glueEdges")
7668 ## Find coincident edges in \a theShapes for possible gluing.
7669 # @param theShapes Initial shapes, either a list or compound of shapes.
7670 # @param theTolerance Maximum distance between edges,
7671 # which can be considered as coincident.
7672 # @param theName Object name; when specified, this parameter is used
7673 # for result publication in the study. Otherwise, if automatic
7674 # publication is switched on, default value is used for result name.
7676 # @return GEOM.ListOfGO
7678 # @ref tui_glue_edges "Example"
7679 @ManageTransactions("ShapesOp")
7680 def GetGlueEdges(self, theShapes, theTolerance, theName=None):
7682 Find coincident edges in theShapes for possible gluing.
7685 theShapes Initial shapes, either a list or compound of shapes.
7686 theTolerance Maximum distance between edges,
7687 which can be considered as coincident.
7688 theName Object name; when specified, this parameter is used
7689 for result publication in the study. Otherwise, if automatic
7690 publication is switched on, default value is used for result name.
7695 anObj = self.ShapesOp.GetGlueEdges(ToList(theShapes), theTolerance)
7696 RaiseIfFailed("GetGlueEdges", self.ShapesOp)
7697 self._autoPublish(anObj, theName, "edgesToGlue")
7700 ## Replace coincident edges in theShapes by one edge
7701 # in compliance with given list of edges.
7702 # @param theShapes Initial shapes, either a list or compound of shapes.
7703 # @param theTolerance Maximum distance between edges,
7704 # which can be considered as coincident.
7705 # @param theEdges List of edges for gluing.
7706 # @param theName Object name; when specified, this parameter is used
7707 # for result publication in the study. Otherwise, if automatic
7708 # publication is switched on, default value is used for result name.
7710 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7712 # @ref tui_glue_edges "Example"
7713 @ManageTransactions("ShapesOp")
7714 def MakeGlueEdgesByList(self, theShapes, theTolerance, theEdges, theName=None):
7716 Replace coincident edges in theShapes by one edge
7717 in compliance with given list of edges.
7720 theShapes Initial shapes, either a list or compound of shapes.
7721 theTolerance Maximum distance between edges,
7722 which can be considered as coincident.
7723 theEdges List of edges for gluing.
7724 theName Object name; when specified, this parameter is used
7725 for result publication in the study. Otherwise, if automatic
7726 publication is switched on, default value is used for result name.
7729 New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7731 anObj = self.ShapesOp.MakeGlueEdgesByList(ToList(theShapes), theTolerance, theEdges)
7733 raise RuntimeError("MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode())
7734 self._autoPublish(anObj, theName, "glueEdges")
7740 ## @addtogroup l3_boolean Boolean Operations
7743 # -----------------------------------------------------------------------------
7744 # Boolean (Common, Cut, Fuse, Section)
7745 # -----------------------------------------------------------------------------
7747 ## Perform one of boolean operations on two given shapes.
7748 # @param theShape1 First argument for boolean operation.
7749 # @param theShape2 Second argument for boolean operation.
7750 # @param theOperation Indicates the operation to be done:\n
7751 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
7752 # @param checkSelfInte The flag that tells if the arguments should
7753 # be checked for self-intersection prior to the operation.
7754 # @param theName Object name; when specified, this parameter is used
7755 # for result publication in the study. Otherwise, if automatic
7756 # publication is switched on, default value is used for result name.
7758 # @note This algorithm doesn't find all types of self-intersections.
7759 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7760 # vertex/face and edge/face intersections. Face/face
7761 # intersections detection is switched off as it is a
7762 # time-consuming operation that gives an impact on performance.
7763 # To find all self-intersections please use
7764 # CheckSelfIntersections() method.
7766 # @return New GEOM.GEOM_Object, containing the result shape.
7768 # @ref tui_fuse "Example"
7769 @ManageTransactions("BoolOp")
7770 def MakeBoolean(self, theShape1, theShape2, theOperation, checkSelfInte=False, theName=None):
7772 Perform one of boolean operations on two given shapes.
7775 theShape1 First argument for boolean operation.
7776 theShape2 Second argument for boolean operation.
7777 theOperation Indicates the operation to be done:
7778 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
7779 checkSelfInte The flag that tells if the arguments should
7780 be checked for self-intersection prior to
7782 theName Object name; when specified, this parameter is used
7783 for result publication in the study. Otherwise, if automatic
7784 publication is switched on, default value is used for result name.
7787 This algorithm doesn't find all types of self-intersections.
7788 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7789 vertex/face and edge/face intersections. Face/face
7790 intersections detection is switched off as it is a
7791 time-consuming operation that gives an impact on performance.
7792 To find all self-intersections please use
7793 CheckSelfIntersections() method.
7796 New GEOM.GEOM_Object, containing the result shape.
7798 # Example: see GEOM_TestAll.py
7799 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation, checkSelfInte)
7800 RaiseIfFailed("MakeBoolean", self.BoolOp)
7801 def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" }
7802 self._autoPublish(anObj, theName, def_names[theOperation])
7805 ## Perform Common boolean operation on two given shapes.
7806 # @param theShape1 First argument for boolean operation.
7807 # @param theShape2 Second argument for boolean operation.
7808 # @param checkSelfInte The flag that tells if the arguments should
7809 # be checked for self-intersection prior to the operation.
7810 # @param theName Object name; when specified, this parameter is used
7811 # for result publication in the study. Otherwise, if automatic
7812 # publication is switched on, default value is used for result name.
7814 # @note This algorithm doesn't find all types of self-intersections.
7815 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7816 # vertex/face and edge/face intersections. Face/face
7817 # intersections detection is switched off as it is a
7818 # time-consuming operation that gives an impact on performance.
7819 # To find all self-intersections please use
7820 # CheckSelfIntersections() method.
7822 # @return New GEOM.GEOM_Object, containing the result shape.
7824 # @ref tui_common "Example 1"
7825 # \n @ref swig_MakeCommon "Example 2"
7826 def MakeCommon(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7828 Perform Common boolean operation on two given shapes.
7831 theShape1 First argument for boolean operation.
7832 theShape2 Second argument for boolean operation.
7833 checkSelfInte The flag that tells if the arguments should
7834 be checked for self-intersection prior to
7836 theName Object name; when specified, this parameter is used
7837 for result publication in the study. Otherwise, if automatic
7838 publication is switched on, default value is used for result name.
7841 This algorithm doesn't find all types of self-intersections.
7842 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7843 vertex/face and edge/face intersections. Face/face
7844 intersections detection is switched off as it is a
7845 time-consuming operation that gives an impact on performance.
7846 To find all self-intersections please use
7847 CheckSelfIntersections() method.
7850 New GEOM.GEOM_Object, containing the result shape.
7852 # Example: see GEOM_TestOthers.py
7853 # note: auto-publishing is done in self.MakeBoolean()
7854 return self.MakeBoolean(theShape1, theShape2, 1, checkSelfInte, theName)
7856 ## Perform Cut boolean operation on two given shapes.
7857 # @param theShape1 First argument for boolean operation.
7858 # @param theShape2 Second argument for boolean operation.
7859 # @param checkSelfInte The flag that tells if the arguments should
7860 # be checked for self-intersection prior to the operation.
7861 # @param theName Object name; when specified, this parameter is used
7862 # for result publication in the study. Otherwise, if automatic
7863 # publication is switched on, default value is used for result name.
7865 # @note This algorithm doesn't find all types of self-intersections.
7866 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7867 # vertex/face and edge/face intersections. Face/face
7868 # intersections detection is switched off as it is a
7869 # time-consuming operation that gives an impact on performance.
7870 # To find all self-intersections please use
7871 # CheckSelfIntersections() method.
7873 # @return New GEOM.GEOM_Object, containing the result shape.
7875 # @ref tui_cut "Example 1"
7876 # \n @ref swig_MakeCommon "Example 2"
7877 def MakeCut(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7879 Perform Cut boolean operation on two given shapes.
7882 theShape1 First argument for boolean operation.
7883 theShape2 Second argument for boolean operation.
7884 checkSelfInte The flag that tells if the arguments should
7885 be checked for self-intersection prior to
7887 theName Object name; when specified, this parameter is used
7888 for result publication in the study. Otherwise, if automatic
7889 publication is switched on, default value is used for result name.
7892 This algorithm doesn't find all types of self-intersections.
7893 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7894 vertex/face and edge/face intersections. Face/face
7895 intersections detection is switched off as it is a
7896 time-consuming operation that gives an impact on performance.
7897 To find all self-intersections please use
7898 CheckSelfIntersections() method.
7901 New GEOM.GEOM_Object, containing the result shape.
7904 # Example: see GEOM_TestOthers.py
7905 # note: auto-publishing is done in self.MakeBoolean()
7906 return self.MakeBoolean(theShape1, theShape2, 2, checkSelfInte, theName)
7908 ## Perform Fuse boolean operation on two given shapes.
7909 # @param theShape1 First argument for boolean operation.
7910 # @param theShape2 Second argument for boolean operation.
7911 # @param checkSelfInte The flag that tells if the arguments should
7912 # be checked for self-intersection prior to the operation.
7913 # @param rmExtraEdges The flag that tells if Remove Extra Edges
7914 # operation should be performed during the operation.
7915 # @param theName Object name; when specified, this parameter is used
7916 # for result publication in the study. Otherwise, if automatic
7917 # publication is switched on, default value is used for result name.
7919 # @note This algorithm doesn't find all types of self-intersections.
7920 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7921 # vertex/face and edge/face intersections. Face/face
7922 # intersections detection is switched off as it is a
7923 # time-consuming operation that gives an impact on performance.
7924 # To find all self-intersections please use
7925 # CheckSelfIntersections() method.
7927 # @return New GEOM.GEOM_Object, containing the result shape.
7929 # @ref tui_fuse "Example 1"
7930 # \n @ref swig_MakeCommon "Example 2"
7931 @ManageTransactions("BoolOp")
7932 def MakeFuse(self, theShape1, theShape2, checkSelfInte=False,
7933 rmExtraEdges=False, theName=None):
7935 Perform Fuse boolean operation on two given shapes.
7938 theShape1 First argument for boolean operation.
7939 theShape2 Second argument for boolean operation.
7940 checkSelfInte The flag that tells if the arguments should
7941 be checked for self-intersection prior to
7943 rmExtraEdges The flag that tells if Remove Extra Edges
7944 operation should be performed during the operation.
7945 theName Object name; when specified, this parameter is used
7946 for result publication in the study. Otherwise, if automatic
7947 publication is switched on, default value is used for result name.
7950 This algorithm doesn't find all types of self-intersections.
7951 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7952 vertex/face and edge/face intersections. Face/face
7953 intersections detection is switched off as it is a
7954 time-consuming operation that gives an impact on performance.
7955 To find all self-intersections please use
7956 CheckSelfIntersections() method.
7959 New GEOM.GEOM_Object, containing the result shape.
7962 # Example: see GEOM_TestOthers.py
7963 anObj = self.BoolOp.MakeFuse(theShape1, theShape2,
7964 checkSelfInte, rmExtraEdges)
7965 RaiseIfFailed("MakeFuse", self.BoolOp)
7966 self._autoPublish(anObj, theName, "fuse")
7969 ## Perform Section boolean operation on two given shapes.
7970 # @param theShape1 First argument for boolean operation.
7971 # @param theShape2 Second argument for boolean operation.
7972 # @param checkSelfInte The flag that tells if the arguments should
7973 # be checked for self-intersection prior to the operation.
7974 # If a self-intersection detected the operation fails.
7975 # @param theName Object name; when specified, this parameter is used
7976 # for result publication in the study. Otherwise, if automatic
7977 # publication is switched on, default value is used for result name.
7978 # @return New GEOM.GEOM_Object, containing the result shape.
7980 # @ref tui_section "Example 1"
7981 # \n @ref swig_MakeCommon "Example 2"
7982 def MakeSection(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7984 Perform Section boolean operation on two given shapes.
7987 theShape1 First argument for boolean operation.
7988 theShape2 Second argument for boolean operation.
7989 checkSelfInte The flag that tells if the arguments should
7990 be checked for self-intersection prior to the operation.
7991 If a self-intersection detected the operation fails.
7992 theName Object name; when specified, this parameter is used
7993 for result publication in the study. Otherwise, if automatic
7994 publication is switched on, default value is used for result name.
7996 New GEOM.GEOM_Object, containing the result shape.
7999 # Example: see GEOM_TestOthers.py
8000 # note: auto-publishing is done in self.MakeBoolean()
8001 return self.MakeBoolean(theShape1, theShape2, 4, checkSelfInte, theName)
8003 ## Perform Fuse boolean operation on the list of shapes.
8004 # @param theShapesList Shapes to be fused.
8005 # @param checkSelfInte The flag that tells if the arguments should
8006 # be checked for self-intersection prior to the operation.
8007 # @param rmExtraEdges The flag that tells if Remove Extra Edges
8008 # operation should be performed during the operation.
8009 # @param theName Object name; when specified, this parameter is used
8010 # for result publication in the study. Otherwise, if automatic
8011 # publication is switched on, default value is used for result name.
8013 # @note This algorithm doesn't find all types of self-intersections.
8014 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8015 # vertex/face and edge/face intersections. Face/face
8016 # intersections detection is switched off as it is a
8017 # time-consuming operation that gives an impact on performance.
8018 # To find all self-intersections please use
8019 # CheckSelfIntersections() method.
8021 # @return New GEOM.GEOM_Object, containing the result shape.
8023 # @ref tui_fuse "Example 1"
8024 # \n @ref swig_MakeCommon "Example 2"
8025 @ManageTransactions("BoolOp")
8026 def MakeFuseList(self, theShapesList, checkSelfInte=False,
8027 rmExtraEdges=False, theName=None):
8029 Perform Fuse boolean operation on the list of shapes.
8032 theShapesList Shapes to be fused.
8033 checkSelfInte The flag that tells if the arguments should
8034 be checked for self-intersection prior to
8036 rmExtraEdges The flag that tells if Remove Extra Edges
8037 operation should be performed during the operation.
8038 theName Object name; when specified, this parameter is used
8039 for result publication in the study. Otherwise, if automatic
8040 publication is switched on, default value is used for result name.
8043 This algorithm doesn't find all types of self-intersections.
8044 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8045 vertex/face and edge/face intersections. Face/face
8046 intersections detection is switched off as it is a
8047 time-consuming operation that gives an impact on performance.
8048 To find all self-intersections please use
8049 CheckSelfIntersections() method.
8052 New GEOM.GEOM_Object, containing the result shape.
8055 # Example: see GEOM_TestOthers.py
8056 anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte,
8058 RaiseIfFailed("MakeFuseList", self.BoolOp)
8059 self._autoPublish(anObj, theName, "fuse")
8062 ## Perform Common boolean operation on the list of shapes.
8063 # @param theShapesList Shapes for Common operation.
8064 # @param checkSelfInte The flag that tells if the arguments should
8065 # be checked for self-intersection prior to the operation.
8066 # @param theName Object name; when specified, this parameter is used
8067 # for result publication in the study. Otherwise, if automatic
8068 # publication is switched on, default value is used for result name.
8070 # @note This algorithm doesn't find all types of self-intersections.
8071 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8072 # vertex/face and edge/face intersections. Face/face
8073 # intersections detection is switched off as it is a
8074 # time-consuming operation that gives an impact on performance.
8075 # To find all self-intersections please use
8076 # CheckSelfIntersections() method.
8078 # @return New GEOM.GEOM_Object, containing the result shape.
8080 # @ref tui_common "Example 1"
8081 # \n @ref swig_MakeCommon "Example 2"
8082 @ManageTransactions("BoolOp")
8083 def MakeCommonList(self, theShapesList, checkSelfInte=False, theName=None):
8085 Perform Common boolean operation on the list of shapes.
8088 theShapesList Shapes for Common operation.
8089 checkSelfInte The flag that tells if the arguments should
8090 be checked for self-intersection prior to
8092 theName Object name; when specified, this parameter is used
8093 for result publication in the study. Otherwise, if automatic
8094 publication is switched on, default value is used for result name.
8097 This algorithm doesn't find all types of self-intersections.
8098 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8099 vertex/face and edge/face intersections. Face/face
8100 intersections detection is switched off as it is a
8101 time-consuming operation that gives an impact on performance.
8102 To find all self-intersections please use
8103 CheckSelfIntersections() method.
8106 New GEOM.GEOM_Object, containing the result shape.
8109 # Example: see GEOM_TestOthers.py
8110 anObj = self.BoolOp.MakeCommonList(theShapesList, checkSelfInte)
8111 RaiseIfFailed("MakeCommonList", self.BoolOp)
8112 self._autoPublish(anObj, theName, "common")
8115 ## Perform Cut boolean operation on one object and the list of tools.
8116 # @param theMainShape The object of the operation.
8117 # @param theShapesList The list of tools of the operation.
8118 # @param checkSelfInte The flag that tells if the arguments should
8119 # be checked for self-intersection prior to the operation.
8120 # @param theName Object name; when specified, this parameter is used
8121 # for result publication in the study. Otherwise, if automatic
8122 # publication is switched on, default value is used for result name.
8124 # @note This algorithm doesn't find all types of self-intersections.
8125 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8126 # vertex/face and edge/face intersections. Face/face
8127 # intersections detection is switched off as it is a
8128 # time-consuming operation that gives an impact on performance.
8129 # To find all self-intersections please use
8130 # CheckSelfIntersections() method.
8132 # @return New GEOM.GEOM_Object, containing the result shape.
8134 # @ref tui_cut "Example 1"
8135 # \n @ref swig_MakeCommon "Example 2"
8136 @ManageTransactions("BoolOp")
8137 def MakeCutList(self, theMainShape, theShapesList, checkSelfInte=False, theName=None):
8139 Perform Cut boolean operation on one object and the list of tools.
8142 theMainShape The object of the operation.
8143 theShapesList The list of tools of the operation.
8144 checkSelfInte The flag that tells if the arguments should
8145 be checked for self-intersection prior to
8147 theName Object name; when specified, this parameter is used
8148 for result publication in the study. Otherwise, if automatic
8149 publication is switched on, default value is used for result name.
8152 This algorithm doesn't find all types of self-intersections.
8153 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8154 vertex/face and edge/face intersections. Face/face
8155 intersections detection is switched off as it is a
8156 time-consuming operation that gives an impact on performance.
8157 To find all self-intersections please use
8158 CheckSelfIntersections() method.
8161 New GEOM.GEOM_Object, containing the result shape.
8164 # Example: see GEOM_TestOthers.py
8165 anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList, checkSelfInte)
8166 RaiseIfFailed("MakeCutList", self.BoolOp)
8167 self._autoPublish(anObj, theName, "cut")
8173 ## @addtogroup l3_basic_op
8176 ## Perform partition operation.
8177 # @param ListShapes Shapes to be intersected.
8178 # @param ListTools Shapes to intersect theShapes.
8179 # @param Limit Type of resulting shapes (see ShapeType()).\n
8180 # If this parameter is set to -1 ("Auto"), most appropriate shape limit
8181 # type will be detected automatically.
8182 # @param KeepNonlimitShapes if this parameter == 0, then only shapes of
8183 # target type (equal to Limit) are kept in the result,
8184 # else standalone shapes of lower dimension
8185 # are kept also (if they exist).
8187 # @param theName Object name; when specified, this parameter is used
8188 # for result publication in the study. Otherwise, if automatic
8189 # publication is switched on, default value is used for result name.
8191 # @note Each compound from ListShapes and ListTools will be exploded
8192 # in order to avoid possible intersection between shapes from this compound.
8194 # After implementation new version of PartitionAlgo (October 2006)
8195 # other parameters are ignored by current functionality. They are kept
8196 # in this function only for support old versions.
8197 # @param ListKeepInside Shapes, outside which the results will be deleted.
8198 # Each shape from theKeepInside must belong to theShapes also.
8199 # @param ListRemoveInside Shapes, inside which the results will be deleted.
8200 # Each shape from theRemoveInside must belong to theShapes also.
8201 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
8202 # @param ListMaterials Material indices for each shape. Make sense,
8203 # only if theRemoveWebs is TRUE.
8205 # @return New GEOM.GEOM_Object, containing the result shapes.
8207 # @ref tui_partition "Example"
8208 @ManageTransactions("BoolOp")
8209 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
8210 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
8211 KeepNonlimitShapes=0, theName=None):
8213 Perform partition operation.
8216 ListShapes Shapes to be intersected.
8217 ListTools Shapes to intersect theShapes.
8218 Limit Type of resulting shapes (see geompy.ShapeType)
8219 If this parameter is set to -1 ("Auto"), most appropriate shape limit
8220 type will be detected automatically.
8221 KeepNonlimitShapes if this parameter == 0, then only shapes of
8222 target type (equal to Limit) are kept in the result,
8223 else standalone shapes of lower dimension
8224 are kept also (if they exist).
8226 theName Object name; when specified, this parameter is used
8227 for result publication in the study. Otherwise, if automatic
8228 publication is switched on, default value is used for result name.
8230 Each compound from ListShapes and ListTools will be exploded
8231 in order to avoid possible intersection between shapes from
8234 After implementation new version of PartitionAlgo (October 2006) other
8235 parameters are ignored by current functionality. They are kept in this
8236 function only for support old versions.
8239 ListKeepInside Shapes, outside which the results will be deleted.
8240 Each shape from theKeepInside must belong to theShapes also.
8241 ListRemoveInside Shapes, inside which the results will be deleted.
8242 Each shape from theRemoveInside must belong to theShapes also.
8243 RemoveWebs If TRUE, perform Glue 3D algorithm.
8244 ListMaterials Material indices for each shape. Make sense, only if theRemoveWebs is TRUE.
8247 New GEOM.GEOM_Object, containing the result shapes.
8249 # Example: see GEOM_TestAll.py
8250 if Limit == self.ShapeType["AUTO"]:
8251 # automatic detection of the most appropriate shape limit type
8253 for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
8254 Limit = EnumToLong(lim)
8256 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
8257 ListKeepInside, ListRemoveInside,
8258 Limit, RemoveWebs, ListMaterials,
8259 KeepNonlimitShapes);
8260 RaiseIfFailed("MakePartition", self.BoolOp)
8261 self._autoPublish(anObj, theName, "partition")
8264 ## Perform partition operation.
8265 # This method may be useful if it is needed to make a partition for
8266 # compound contains nonintersected shapes. Performance will be better
8267 # since intersection between shapes from compound is not performed.
8269 # Description of all parameters as in previous method MakePartition().
8270 # One additional parameter is provided:
8271 # @param checkSelfInte The flag that tells if the arguments should
8272 # be checked for self-intersection prior to the operation.
8274 # @note This algorithm doesn't find all types of self-intersections.
8275 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8276 # vertex/face and edge/face intersections. Face/face
8277 # intersections detection is switched off as it is a
8278 # time-consuming operation that gives an impact on performance.
8279 # To find all self-intersections please use
8280 # CheckSelfIntersections() method.
8282 # @note Passed compounds (via ListShapes or via ListTools)
8283 # have to consist of nonintersecting shapes.
8285 # @return New GEOM.GEOM_Object, containing the result shapes.
8287 # @ref swig_todo "Example"
8288 @ManageTransactions("BoolOp")
8289 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
8290 ListKeepInside=[], ListRemoveInside=[],
8291 Limit=ShapeType["AUTO"], RemoveWebs=0,
8292 ListMaterials=[], KeepNonlimitShapes=0,
8293 checkSelfInte=False, theName=None):
8295 Perform partition operation.
8296 This method may be useful if it is needed to make a partition for
8297 compound contains nonintersected shapes. Performance will be better
8298 since intersection between shapes from compound is not performed.
8301 Description of all parameters as in method geompy.MakePartition.
8302 One additional parameter is provided:
8303 checkSelfInte The flag that tells if the arguments should
8304 be checked for self-intersection prior to
8308 This algorithm doesn't find all types of self-intersections.
8309 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8310 vertex/face and edge/face intersections. Face/face
8311 intersections detection is switched off as it is a
8312 time-consuming operation that gives an impact on performance.
8313 To find all self-intersections please use
8314 CheckSelfIntersections() method.
8317 Passed compounds (via ListShapes or via ListTools)
8318 have to consist of nonintersecting shapes.
8321 New GEOM.GEOM_Object, containing the result shapes.
8323 if Limit == self.ShapeType["AUTO"]:
8324 # automatic detection of the most appropriate shape limit type
8326 for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
8327 Limit = EnumToLong(lim)
8329 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
8330 ListKeepInside, ListRemoveInside,
8331 Limit, RemoveWebs, ListMaterials,
8332 KeepNonlimitShapes, checkSelfInte);
8333 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
8334 self._autoPublish(anObj, theName, "partition")
8337 ## See method MakePartition() for more information.
8339 # @ref tui_partition "Example 1"
8340 # \n @ref swig_Partition "Example 2"
8341 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
8342 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
8343 KeepNonlimitShapes=0, theName=None):
8345 See method geompy.MakePartition for more information.
8347 # Example: see GEOM_TestOthers.py
8348 # note: auto-publishing is done in self.MakePartition()
8349 anObj = self.MakePartition(ListShapes, ListTools,
8350 ListKeepInside, ListRemoveInside,
8351 Limit, RemoveWebs, ListMaterials,
8352 KeepNonlimitShapes, theName);
8355 ## Perform partition of the Shape with the Plane
8356 # @param theShape Shape to be intersected.
8357 # @param thePlane Tool shape, to intersect theShape.
8358 # @param theName Object name; when specified, this parameter is used
8359 # for result publication in the study. Otherwise, if automatic
8360 # publication is switched on, default value is used for result name.
8362 # @return New GEOM.GEOM_Object, containing the result shape.
8364 # @note This operation is a shortcut to the more general @ref MakePartition
8365 # operation, where @a theShape specifies single "object" (shape being partitioned)
8366 # and @a thePlane specifies single "tool" (intersector shape). Other parameters of
8367 # @ref MakePartition operation have default values:
8368 # - @a Limit: GEOM::SHAPE (shape limit corresponds to the type of @a theShape)
8369 # - @a KeepNonlimitShapes: 0
8370 # - @a KeepInside, @a RemoveInside, @a RemoveWebs,
8371 # @a Materials (obsolete parameters): empty
8373 # @note I.e. the following two operations are equivalent:
8375 # Result = geompy.MakeHalfPartition(Object, Plane)
8376 # Result = geompy.MakePartition([Object], [Plane])
8379 # @sa MakePartition, MakePartitionNonSelfIntersectedShape
8381 # @ref tui_partition "Example"
8382 @ManageTransactions("BoolOp")
8383 def MakeHalfPartition(self, theShape, thePlane, theName=None):
8385 Perform partition of the Shape with the Plane
8388 theShape Shape to be intersected.
8389 thePlane Tool shape, to intersect theShape.
8390 theName Object name; when specified, this parameter is used
8391 for result publication in the study. Otherwise, if automatic
8392 publication is switched on, default value is used for result name.
8395 New GEOM.GEOM_Object, containing the result shape.
8397 Note: This operation is a shortcut to the more general MakePartition
8398 operation, where theShape specifies single "object" (shape being partitioned)
8399 and thePlane specifies single "tool" (intersector shape). Other parameters of
8400 MakePartition operation have default values:
8401 - Limit: GEOM::SHAPE (shape limit corresponds to the type of theShape)
8402 - KeepNonlimitShapes: 0
8403 - KeepInside, RemoveInside, RemoveWebs, Materials (obsolete parameters): empty
8405 I.e. the following two operations are equivalent:
8406 Result = geompy.MakeHalfPartition(Object, Plane)
8407 Result = geompy.MakePartition([Object], [Plane])
8409 # Example: see GEOM_TestAll.py
8410 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
8411 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
8412 self._autoPublish(anObj, theName, "partition")
8415 # end of l3_basic_op
8418 ## @addtogroup l3_transform
8421 ## Translate the given object along the vector, specified
8422 # by its end points.
8423 # @param theObject The object to be translated.
8424 # @param thePoint1 Start point of translation vector.
8425 # @param thePoint2 End point of translation vector.
8426 # @param theCopy Flag used to translate object itself or create a copy.
8427 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8428 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8429 @ManageTransactions("TrsfOp")
8430 def TranslateTwoPoints(self, theObject, thePoint1, thePoint2, theCopy=False):
8432 Translate the given object along the vector, specified by its end points.
8435 theObject The object to be translated.
8436 thePoint1 Start point of translation vector.
8437 thePoint2 End point of translation vector.
8438 theCopy Flag used to translate object itself or create a copy.
8441 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8442 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8445 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
8447 anObj = self.TrsfOp.TranslateTwoPoints(theObject, thePoint1, thePoint2)
8448 RaiseIfFailed("TranslateTwoPoints", self.TrsfOp)
8451 ## Translate the given object along the vector, specified
8452 # by its end points, creating its copy before the translation.
8453 # @param theObject The object to be translated.
8454 # @param thePoint1 Start point of translation vector.
8455 # @param thePoint2 End point of translation vector.
8456 # @param theName Object name; when specified, this parameter is used
8457 # for result publication in the study. Otherwise, if automatic
8458 # publication is switched on, default value is used for result name.
8460 # @return New GEOM.GEOM_Object, containing the translated object.
8462 # @ref tui_translation "Example 1"
8463 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
8464 @ManageTransactions("TrsfOp")
8465 def MakeTranslationTwoPoints(self, theObject, thePoint1, thePoint2, theName=None):
8467 Translate the given object along the vector, specified
8468 by its end points, creating its copy before the translation.
8471 theObject The object to be translated.
8472 thePoint1 Start point of translation vector.
8473 thePoint2 End point of translation vector.
8474 theName Object name; when specified, this parameter is used
8475 for result publication in the study. Otherwise, if automatic
8476 publication is switched on, default value is used for result name.
8479 New GEOM.GEOM_Object, containing the translated object.
8481 # Example: see GEOM_TestAll.py
8482 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
8483 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
8484 self._autoPublish(anObj, theName, "translated")
8487 ## Translate the given object along the vector, specified by its components.
8488 # @param theObject The object to be translated.
8489 # @param theDX,theDY,theDZ Components of translation vector.
8490 # @param theCopy Flag used to translate object itself or create a copy.
8491 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8492 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8494 # @ref tui_translation "Example"
8495 @ManageTransactions("TrsfOp")
8496 def TranslateDXDYDZ(self, theObject, theDX, theDY, theDZ, theCopy=False):
8498 Translate the given object along the vector, specified by its components.
8501 theObject The object to be translated.
8502 theDX,theDY,theDZ Components of translation vector.
8503 theCopy Flag used to translate object itself or create a copy.
8506 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8507 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8509 # Example: see GEOM_TestAll.py
8510 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
8512 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
8514 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
8515 anObj.SetParameters(Parameters)
8516 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
8519 ## Translate the given object along the vector, specified
8520 # by its components, creating its copy before the translation.
8521 # @param theObject The object to be translated.
8522 # @param theDX,theDY,theDZ Components of translation vector.
8523 # @param theName Object name; when specified, this parameter is used
8524 # for result publication in the study. Otherwise, if automatic
8525 # publication is switched on, default value is used for result name.
8527 # @return New GEOM.GEOM_Object, containing the translated object.
8529 # @ref tui_translation "Example"
8530 @ManageTransactions("TrsfOp")
8531 def MakeTranslation(self,theObject, theDX, theDY, theDZ, theName=None):
8533 Translate the given object along the vector, specified
8534 by its components, creating its copy before the translation.
8537 theObject The object to be translated.
8538 theDX,theDY,theDZ Components of translation vector.
8539 theName Object name; when specified, this parameter is used
8540 for result publication in the study. Otherwise, if automatic
8541 publication is switched on, default value is used for result name.
8544 New GEOM.GEOM_Object, containing the translated object.
8546 # Example: see GEOM_TestAll.py
8547 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
8548 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
8549 anObj.SetParameters(Parameters)
8550 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
8551 self._autoPublish(anObj, theName, "translated")
8554 ## Translate the given object along the given vector.
8555 # @param theObject The object to be translated.
8556 # @param theVector The translation vector.
8557 # @param theCopy Flag used to translate object itself or create a copy.
8558 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8559 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8560 @ManageTransactions("TrsfOp")
8561 def TranslateVector(self, theObject, theVector, theCopy=False):
8563 Translate the given object along the given vector.
8566 theObject The object to be translated.
8567 theVector The translation vector.
8568 theCopy Flag used to translate object itself or create a copy.
8571 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8572 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8575 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
8577 anObj = self.TrsfOp.TranslateVector(theObject, theVector)
8578 RaiseIfFailed("TranslateVector", self.TrsfOp)
8581 ## Translate the given object along the given vector,
8582 # creating its copy before the translation.
8583 # @param theObject The object to be translated.
8584 # @param theVector The translation vector.
8585 # @param theName Object name; when specified, this parameter is used
8586 # for result publication in the study. Otherwise, if automatic
8587 # publication is switched on, default value is used for result name.
8589 # @return New GEOM.GEOM_Object, containing the translated object.
8591 # @ref tui_translation "Example"
8592 @ManageTransactions("TrsfOp")
8593 def MakeTranslationVector(self, theObject, theVector, theName=None):
8595 Translate the given object along the given vector,
8596 creating its copy before the translation.
8599 theObject The object to be translated.
8600 theVector The translation vector.
8601 theName Object name; when specified, this parameter is used
8602 for result publication in the study. Otherwise, if automatic
8603 publication is switched on, default value is used for result name.
8606 New GEOM.GEOM_Object, containing the translated object.
8608 # Example: see GEOM_TestAll.py
8609 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
8610 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
8611 self._autoPublish(anObj, theName, "translated")
8614 ## Translate the given object along the given vector on given distance.
8615 # @param theObject The object to be translated.
8616 # @param theVector The translation vector.
8617 # @param theDistance The translation distance.
8618 # @param theCopy Flag used to translate object itself or create a copy.
8619 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8620 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8622 # @ref tui_translation "Example"
8623 @ManageTransactions("TrsfOp")
8624 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy=False):
8626 Translate the given object along the given vector on given distance.
8629 theObject The object to be translated.
8630 theVector The translation vector.
8631 theDistance The translation distance.
8632 theCopy Flag used to translate object itself or create a copy.
8635 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8636 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8638 # Example: see GEOM_TestAll.py
8639 theDistance,Parameters = ParseParameters(theDistance)
8640 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
8641 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
8642 anObj.SetParameters(Parameters)
8645 ## Translate the given object along the given vector on given distance,
8646 # creating its copy before the translation.
8647 # @param theObject The object to be translated.
8648 # @param theVector The translation vector.
8649 # @param theDistance The translation distance.
8650 # @param theName Object name; when specified, this parameter is used
8651 # for result publication in the study. Otherwise, if automatic
8652 # publication is switched on, default value is used for result name.
8654 # @return New GEOM.GEOM_Object, containing the translated object.
8656 # @ref tui_translation "Example"
8657 @ManageTransactions("TrsfOp")
8658 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance, theName=None):
8660 Translate the given object along the given vector on given distance,
8661 creating its copy before the translation.
8664 theObject The object to be translated.
8665 theVector The translation vector.
8666 theDistance The translation distance.
8667 theName Object name; when specified, this parameter is used
8668 for result publication in the study. Otherwise, if automatic
8669 publication is switched on, default value is used for result name.
8672 New GEOM.GEOM_Object, containing the translated object.
8674 # Example: see GEOM_TestAll.py
8675 theDistance,Parameters = ParseParameters(theDistance)
8676 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
8677 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
8678 anObj.SetParameters(Parameters)
8679 self._autoPublish(anObj, theName, "translated")
8682 ## Rotate the given object around the given axis on the given angle.
8683 # @param theObject The object to be rotated.
8684 # @param theAxis Rotation axis.
8685 # @param theAngle Rotation angle in radians.
8686 # @param theCopy Flag used to rotate object itself or create a copy.
8688 # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8689 # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
8691 # @ref tui_rotation "Example"
8692 @ManageTransactions("TrsfOp")
8693 def Rotate(self, theObject, theAxis, theAngle, theCopy=False):
8695 Rotate the given object around the given axis on the given angle.
8698 theObject The object to be rotated.
8699 theAxis Rotation axis.
8700 theAngle Rotation angle in radians.
8701 theCopy Flag used to rotate object itself or create a copy.
8704 Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8705 new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
8707 # Example: see GEOM_TestAll.py
8709 if isinstance(theAngle,str):
8711 theAngle, Parameters = ParseParameters(theAngle)
8713 theAngle = theAngle*math.pi/180.0
8715 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
8717 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
8718 RaiseIfFailed("Rotate", self.TrsfOp)
8719 anObj.SetParameters(Parameters)
8722 ## Rotate the given object around the given axis
8723 # on the given angle, creating its copy before the rotation.
8724 # @param theObject The object to be rotated.
8725 # @param theAxis Rotation axis.
8726 # @param theAngle Rotation angle in radians.
8727 # @param theName Object name; when specified, this parameter is used
8728 # for result publication in the study. Otherwise, if automatic
8729 # publication is switched on, default value is used for result name.
8731 # @return New GEOM.GEOM_Object, containing the rotated object.
8733 # @ref tui_rotation "Example"
8734 @ManageTransactions("TrsfOp")
8735 def MakeRotation(self, theObject, theAxis, theAngle, theName=None):
8737 Rotate the given object around the given axis
8738 on the given angle, creating its copy before the rotatation.
8741 theObject The object to be rotated.
8742 theAxis Rotation axis.
8743 theAngle Rotation angle in radians.
8744 theName Object name; when specified, this parameter is used
8745 for result publication in the study. Otherwise, if automatic
8746 publication is switched on, default value is used for result name.
8749 New GEOM.GEOM_Object, containing the rotated object.
8751 # Example: see GEOM_TestAll.py
8753 if isinstance(theAngle,str):
8755 theAngle, Parameters = ParseParameters(theAngle)
8757 theAngle = theAngle*math.pi/180.0
8758 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
8759 RaiseIfFailed("RotateCopy", self.TrsfOp)
8760 anObj.SetParameters(Parameters)
8761 self._autoPublish(anObj, theName, "rotated")
8764 ## Rotate given object around vector perpendicular to plane
8765 # containing three points.
8766 # @param theObject The object to be rotated.
8767 # @param theCentPoint central point the axis is the vector perpendicular to the plane
8768 # containing the three points.
8769 # @param thePoint1,thePoint2 points in a perpendicular plane of the axis.
8770 # @param theCopy Flag used to rotate object itself or create a copy.
8771 # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8772 # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
8773 @ManageTransactions("TrsfOp")
8774 def RotateThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theCopy=False):
8776 Rotate given object around vector perpendicular to plane
8777 containing three points.
8780 theObject The object to be rotated.
8781 theCentPoint central point the axis is the vector perpendicular to the plane
8782 containing the three points.
8783 thePoint1,thePoint2 points in a perpendicular plane of the axis.
8784 theCopy Flag used to rotate object itself or create a copy.
8787 Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8788 new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
8791 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
8793 anObj = self.TrsfOp.RotateThreePoints(theObject, theCentPoint, thePoint1, thePoint2)
8794 RaiseIfFailed("RotateThreePoints", self.TrsfOp)
8797 ## Rotate given object around vector perpendicular to plane
8798 # containing three points, creating its copy before the rotatation.
8799 # @param theObject The object to be rotated.
8800 # @param theCentPoint central point the axis is the vector perpendicular to the plane
8801 # containing the three points.
8802 # @param thePoint1,thePoint2 in a perpendicular plane of the axis.
8803 # @param theName Object name; when specified, this parameter is used
8804 # for result publication in the study. Otherwise, if automatic
8805 # publication is switched on, default value is used for result name.
8807 # @return New GEOM.GEOM_Object, containing the rotated object.
8809 # @ref tui_rotation "Example"
8810 @ManageTransactions("TrsfOp")
8811 def MakeRotationThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theName=None):
8813 Rotate given object around vector perpendicular to plane
8814 containing three points, creating its copy before the rotatation.
8817 theObject The object to be rotated.
8818 theCentPoint central point the axis is the vector perpendicular to the plane
8819 containing the three points.
8820 thePoint1,thePoint2 in a perpendicular plane of the axis.
8821 theName Object name; when specified, this parameter is used
8822 for result publication in the study. Otherwise, if automatic
8823 publication is switched on, default value is used for result name.
8826 New GEOM.GEOM_Object, containing the rotated object.
8828 # Example: see GEOM_TestAll.py
8829 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
8830 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
8831 self._autoPublish(anObj, theName, "rotated")
8834 ## Scale the given object by the specified factor.
8835 # @param theObject The object to be scaled.
8836 # @param thePoint Center point for scaling.
8837 # Passing None for it means scaling relatively the origin of global CS.
8838 # @param theFactor Scaling factor value.
8839 # @param theCopy Flag used to scale object itself or create a copy.
8840 # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8841 # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
8842 @ManageTransactions("TrsfOp")
8843 def Scale(self, theObject, thePoint, theFactor, theCopy=False):
8845 Scale the given object by the specified factor.
8848 theObject The object to be scaled.
8849 thePoint Center point for scaling.
8850 Passing None for it means scaling relatively the origin of global CS.
8851 theFactor Scaling factor value.
8852 theCopy Flag used to scale object itself or create a copy.
8855 Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8856 new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
8858 # Example: see GEOM_TestAll.py
8859 theFactor, Parameters = ParseParameters(theFactor)
8861 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
8863 anObj = self.TrsfOp.ScaleShape(theObject, thePoint, theFactor)
8864 RaiseIfFailed("Scale", self.TrsfOp)
8865 anObj.SetParameters(Parameters)
8868 ## Scale the given object by the factor, creating its copy before the scaling.
8869 # @param theObject The object to be scaled.
8870 # @param thePoint Center point for scaling.
8871 # Passing None for it means scaling relatively the origin of global CS.
8872 # @param theFactor Scaling factor value.
8873 # @param theName Object name; when specified, this parameter is used
8874 # for result publication in the study. Otherwise, if automatic
8875 # publication is switched on, default value is used for result name.
8877 # @return New GEOM.GEOM_Object, containing the scaled shape.
8879 # @ref tui_scale "Example"
8880 @ManageTransactions("TrsfOp")
8881 def MakeScaleTransform(self, theObject, thePoint, theFactor, theName=None):
8883 Scale the given object by the factor, creating its copy before the scaling.
8886 theObject The object to be scaled.
8887 thePoint Center point for scaling.
8888 Passing None for it means scaling relatively the origin of global CS.
8889 theFactor Scaling factor value.
8890 theName Object name; when specified, this parameter is used
8891 for result publication in the study. Otherwise, if automatic
8892 publication is switched on, default value is used for result name.
8895 New GEOM.GEOM_Object, containing the scaled shape.
8897 # Example: see GEOM_TestAll.py
8898 theFactor, Parameters = ParseParameters(theFactor)
8899 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
8900 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
8901 anObj.SetParameters(Parameters)
8902 self._autoPublish(anObj, theName, "scaled")
8905 ## Scale the given object by different factors along coordinate axes.
8906 # @param theObject The object to be scaled.
8907 # @param thePoint Center point for scaling.
8908 # Passing None for it means scaling relatively the origin of global CS.
8909 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8910 # @param theCopy Flag used to scale object itself or create a copy.
8911 # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8912 # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
8913 @ManageTransactions("TrsfOp")
8914 def ScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theCopy=False):
8916 Scale the given object by different factors along coordinate axes.
8919 theObject The object to be scaled.
8920 thePoint Center point for scaling.
8921 Passing None for it means scaling relatively the origin of global CS.
8922 theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8923 theCopy Flag used to scale object itself or create a copy.
8926 Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8927 new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
8929 # Example: see GEOM_TestAll.py
8930 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
8932 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
8933 theFactorX, theFactorY, theFactorZ)
8935 anObj = self.TrsfOp.ScaleShapeAlongAxes(theObject, thePoint,
8936 theFactorX, theFactorY, theFactorZ)
8937 RaiseIfFailed("ScaleAlongAxes", self.TrsfOp)
8938 anObj.SetParameters(Parameters)
8941 ## Scale the given object by different factors along coordinate axes,
8942 # creating its copy before the scaling.
8943 # @param theObject The object to be scaled.
8944 # @param thePoint Center point for scaling.
8945 # Passing None for it means scaling relatively the origin of global CS.
8946 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8947 # @param theName Object name; when specified, this parameter is used
8948 # for result publication in the study. Otherwise, if automatic
8949 # publication is switched on, default value is used for result name.
8951 # @return New GEOM.GEOM_Object, containing the scaled shape.
8953 # @ref swig_scale "Example"
8954 @ManageTransactions("TrsfOp")
8955 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theName=None):
8957 Scale the given object by different factors along coordinate axes,
8958 creating its copy before the scaling.
8961 theObject The object to be scaled.
8962 thePoint Center point for scaling.
8963 Passing None for it means scaling relatively the origin of global CS.
8964 theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8965 theName Object name; when specified, this parameter is used
8966 for result publication in the study. Otherwise, if automatic
8967 publication is switched on, default value is used for result name.
8970 New GEOM.GEOM_Object, containing the scaled shape.
8972 # Example: see GEOM_TestAll.py
8973 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
8974 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
8975 theFactorX, theFactorY, theFactorZ)
8976 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
8977 anObj.SetParameters(Parameters)
8978 self._autoPublish(anObj, theName, "scaled")
8981 ## Mirror an object relatively the given plane.
8982 # @param theObject The object to be mirrored.
8983 # @param thePlane Plane of symmetry.
8984 # @param theCopy Flag used to mirror object itself or create a copy.
8985 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8986 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
8987 @ManageTransactions("TrsfOp")
8988 def MirrorByPlane(self, theObject, thePlane, theCopy=False):
8990 Mirror an object relatively the given plane.
8993 theObject The object to be mirrored.
8994 thePlane Plane of symmetry.
8995 theCopy Flag used to mirror object itself or create a copy.
8998 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8999 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9002 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
9004 anObj = self.TrsfOp.MirrorPlane(theObject, thePlane)
9005 RaiseIfFailed("MirrorByPlane", self.TrsfOp)
9008 ## Create an object, symmetrical
9009 # to the given one relatively the given plane.
9010 # @param theObject The object to be mirrored.
9011 # @param thePlane Plane of symmetry.
9012 # @param theName Object name; when specified, this parameter is used
9013 # for result publication in the study. Otherwise, if automatic
9014 # publication is switched on, default value is used for result name.
9016 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9018 # @ref tui_mirror "Example"
9019 @ManageTransactions("TrsfOp")
9020 def MakeMirrorByPlane(self, theObject, thePlane, theName=None):
9022 Create an object, symmetrical to the given one relatively the given plane.
9025 theObject The object to be mirrored.
9026 thePlane Plane of symmetry.
9027 theName Object name; when specified, this parameter is used
9028 for result publication in the study. Otherwise, if automatic
9029 publication is switched on, default value is used for result name.
9032 New GEOM.GEOM_Object, containing the mirrored shape.
9034 # Example: see GEOM_TestAll.py
9035 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
9036 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
9037 self._autoPublish(anObj, theName, "mirrored")
9040 ## Mirror an object relatively the given axis.
9041 # @param theObject The object to be mirrored.
9042 # @param theAxis Axis of symmetry.
9043 # @param theCopy Flag used to mirror object itself or create a copy.
9044 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9045 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
9046 @ManageTransactions("TrsfOp")
9047 def MirrorByAxis(self, theObject, theAxis, theCopy=False):
9049 Mirror an object relatively the given axis.
9052 theObject The object to be mirrored.
9053 theAxis Axis of symmetry.
9054 theCopy Flag used to mirror object itself or create a copy.
9057 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9058 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9061 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
9063 anObj = self.TrsfOp.MirrorAxis(theObject, theAxis)
9064 RaiseIfFailed("MirrorByAxis", self.TrsfOp)
9067 ## Create an object, symmetrical
9068 # to the given one relatively the given axis.
9069 # @param theObject The object to be mirrored.
9070 # @param theAxis Axis of symmetry.
9071 # @param theName Object name; when specified, this parameter is used
9072 # for result publication in the study. Otherwise, if automatic
9073 # publication is switched on, default value is used for result name.
9075 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9077 # @ref tui_mirror "Example"
9078 @ManageTransactions("TrsfOp")
9079 def MakeMirrorByAxis(self, theObject, theAxis, theName=None):
9081 Create an object, symmetrical to the given one relatively the given axis.
9084 theObject The object to be mirrored.
9085 theAxis Axis of symmetry.
9086 theName Object name; when specified, this parameter is used
9087 for result publication in the study. Otherwise, if automatic
9088 publication is switched on, default value is used for result name.
9091 New GEOM.GEOM_Object, containing the mirrored shape.
9093 # Example: see GEOM_TestAll.py
9094 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
9095 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
9096 self._autoPublish(anObj, theName, "mirrored")
9099 ## Mirror an object relatively the given point.
9100 # @param theObject The object to be mirrored.
9101 # @param thePoint Point of symmetry.
9102 # @param theCopy Flag used to mirror object itself or create a copy.
9103 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9104 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
9105 @ManageTransactions("TrsfOp")
9106 def MirrorByPoint(self, theObject, thePoint, theCopy=False):
9108 Mirror an object relatively the given point.
9111 theObject The object to be mirrored.
9112 thePoint Point of symmetry.
9113 theCopy Flag used to mirror object itself or create a copy.
9116 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9117 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9119 # Example: see GEOM_TestAll.py
9121 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
9123 anObj = self.TrsfOp.MirrorPoint(theObject, thePoint)
9124 RaiseIfFailed("MirrorByPoint", self.TrsfOp)
9127 ## Create an object, symmetrical
9128 # to the given one relatively the given point.
9129 # @param theObject The object to be mirrored.
9130 # @param thePoint Point of symmetry.
9131 # @param theName Object name; when specified, this parameter is used
9132 # for result publication in the study. Otherwise, if automatic
9133 # publication is switched on, default value is used for result name.
9135 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9137 # @ref tui_mirror "Example"
9138 @ManageTransactions("TrsfOp")
9139 def MakeMirrorByPoint(self, theObject, thePoint, theName=None):
9141 Create an object, symmetrical
9142 to the given one relatively the given point.
9145 theObject The object to be mirrored.
9146 thePoint Point of symmetry.
9147 theName Object name; when specified, this parameter is used
9148 for result publication in the study. Otherwise, if automatic
9149 publication is switched on, default value is used for result name.
9152 New GEOM.GEOM_Object, containing the mirrored shape.
9154 # Example: see GEOM_TestAll.py
9155 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
9156 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
9157 self._autoPublish(anObj, theName, "mirrored")
9160 ## Modify the location of the given object.
9161 # @param theObject The object to be displaced.
9162 # @param theStartLCS Coordinate system to perform displacement from it.\n
9163 # If \a theStartLCS is NULL, displacement
9164 # will be performed from global CS.\n
9165 # If \a theObject itself is used as \a theStartLCS,
9166 # its location will be changed to \a theEndLCS.
9167 # @param theEndLCS Coordinate system to perform displacement to it.
9168 # @param theCopy Flag used to displace object itself or create a copy.
9169 # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9170 # new GEOM.GEOM_Object, containing the displaced object if @a theCopy flag is @c True.
9171 @ManageTransactions("TrsfOp")
9172 def Position(self, theObject, theStartLCS, theEndLCS, theCopy=False):
9174 Modify the Location of the given object by LCS, creating its copy before the setting.
9177 theObject The object to be displaced.
9178 theStartLCS Coordinate system to perform displacement from it.
9179 If theStartLCS is NULL, displacement
9180 will be performed from global CS.
9181 If theObject itself is used as theStartLCS,
9182 its location will be changed to theEndLCS.
9183 theEndLCS Coordinate system to perform displacement to it.
9184 theCopy Flag used to displace object itself or create a copy.
9187 Displaced theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9188 new GEOM.GEOM_Object, containing the displaced object if theCopy flag is True.
9190 # Example: see GEOM_TestAll.py
9192 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
9194 anObj = self.TrsfOp.PositionShape(theObject, theStartLCS, theEndLCS)
9195 RaiseIfFailed("Displace", self.TrsfOp)
9198 ## Modify the Location of the given object by LCS,
9199 # creating its copy before the setting.
9200 # @param theObject The object to be displaced.
9201 # @param theStartLCS Coordinate system to perform displacement from it.\n
9202 # If \a theStartLCS is NULL, displacement
9203 # will be performed from global CS.\n
9204 # If \a theObject itself is used as \a theStartLCS,
9205 # its location will be changed to \a theEndLCS.
9206 # @param theEndLCS Coordinate system to perform displacement to it.
9207 # @param theName Object name; when specified, this parameter is used
9208 # for result publication in the study. Otherwise, if automatic
9209 # publication is switched on, default value is used for result name.
9211 # @return New GEOM.GEOM_Object, containing the displaced shape.
9213 # @ref tui_modify_location "Example"
9214 @ManageTransactions("TrsfOp")
9215 def MakePosition(self, theObject, theStartLCS, theEndLCS, theName=None):
9217 Modify the Location of the given object by LCS, creating its copy before the setting.
9220 theObject The object to be displaced.
9221 theStartLCS Coordinate system to perform displacement from it.
9222 If theStartLCS is NULL, displacement
9223 will be performed from global CS.
9224 If theObject itself is used as theStartLCS,
9225 its location will be changed to theEndLCS.
9226 theEndLCS Coordinate system to perform displacement to it.
9227 theName Object name; when specified, this parameter is used
9228 for result publication in the study. Otherwise, if automatic
9229 publication is switched on, default value is used for result name.
9232 New GEOM.GEOM_Object, containing the displaced shape.
9235 # create local coordinate systems
9236 cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
9237 cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
9238 # modify the location of the given object
9239 position = geompy.MakePosition(cylinder, cs1, cs2)
9241 # Example: see GEOM_TestAll.py
9242 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
9243 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
9244 self._autoPublish(anObj, theName, "displaced")
9247 ## Modify the Location of the given object by Path.
9248 # @param theObject The object to be displaced.
9249 # @param thePath Wire or Edge along that the object will be translated.
9250 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
9251 # @param theCopy is to create a copy objects if true.
9252 # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
9253 # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy is @c False or
9254 # new GEOM.GEOM_Object, containing the displaced shape if @a theCopy is @c True.
9256 # @ref tui_modify_location "Example"
9257 @ManageTransactions("TrsfOp")
9258 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
9260 Modify the Location of the given object by Path.
9263 theObject The object to be displaced.
9264 thePath Wire or Edge along that the object will be translated.
9265 theDistance progress of Path (0 = start location, 1 = end of path location).
9266 theCopy is to create a copy objects if true.
9267 theReverse 0 - for usual direction, 1 - to reverse path direction.
9270 Displaced theObject (GEOM.GEOM_Object) if theCopy is False or
9271 new GEOM.GEOM_Object, containing the displaced shape if theCopy is True.
9274 position = geompy.PositionAlongPath(cylinder, circle, 0.75, 1, 1)
9276 # Example: see GEOM_TestAll.py
9277 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
9278 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
9281 ## Modify the Location of the given object by Path, creating its copy before the operation.
9282 # @param theObject The object to be displaced.
9283 # @param thePath Wire or Edge along that the object will be translated.
9284 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
9285 # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
9286 # @param theName Object name; when specified, this parameter is used
9287 # for result publication in the study. Otherwise, if automatic
9288 # publication is switched on, default value is used for result name.
9290 # @return New GEOM.GEOM_Object, containing the displaced shape.
9291 @ManageTransactions("TrsfOp")
9292 def MakePositionAlongPath(self, theObject, thePath, theDistance, theReverse, theName=None):
9294 Modify the Location of the given object by Path, creating its copy before the operation.
9297 theObject The object to be displaced.
9298 thePath Wire or Edge along that the object will be translated.
9299 theDistance progress of Path (0 = start location, 1 = end of path location).
9300 theReverse 0 - for usual direction, 1 - to reverse path direction.
9301 theName Object name; when specified, this parameter is used
9302 for result publication in the study. Otherwise, if automatic
9303 publication is switched on, default value is used for result name.
9306 New GEOM.GEOM_Object, containing the displaced shape.
9308 # Example: see GEOM_TestAll.py
9309 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, 1, theReverse)
9310 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
9311 self._autoPublish(anObj, theName, "displaced")
9314 ## Offset given shape.
9315 # @param theObject The base object for the offset.
9316 # @param theOffset Offset value.
9317 # @param theCopy Flag used to offset object itself or create a copy.
9318 # @return Modified @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9319 # new GEOM.GEOM_Object, containing the result of offset operation if @a theCopy flag is @c True.
9320 @ManageTransactions("TrsfOp")
9321 def Offset(self, theObject, theOffset, theCopy=False):
9326 theObject The base object for the offset.
9327 theOffset Offset value.
9328 theCopy Flag used to offset object itself or create a copy.
9331 Modified theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9332 new GEOM.GEOM_Object, containing the result of offset operation if theCopy flag is True.
9334 theOffset, Parameters = ParseParameters(theOffset)
9336 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset, True)
9338 anObj = self.TrsfOp.OffsetShape(theObject, theOffset, True)
9339 RaiseIfFailed("Offset", self.TrsfOp)
9340 anObj.SetParameters(Parameters)
9343 ## Create new object as offset of the given one. Gap between two adjacent
9344 # offset surfaces is filled by a pipe.
9345 # @param theObject The base object for the offset.
9346 # @param theOffset Offset value.
9347 # @param theName Object name; when specified, this parameter is used
9348 # for result publication in the study. Otherwise, if automatic
9349 # publication is switched on, default value is used for result name.
9351 # @return New GEOM.GEOM_Object, containing the offset object.
9353 # @sa MakeOffsetIntersectionJoin
9354 # @ref tui_offset "Example"
9355 @ManageTransactions("TrsfOp")
9356 def MakeOffset(self, theObject, theOffset, theName=None):
9358 Create new object as offset of the given one. Gap between adjacent
9359 offset surfaces is filled by a pipe.
9362 theObject The base object for the offset.
9363 theOffset Offset value.
9364 theName Object name; when specified, this parameter is used
9365 for result publication in the study. Otherwise, if automatic
9366 publication is switched on, default value is used for result name.
9369 New GEOM.GEOM_Object, containing the offset object.
9372 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
9373 # create a new object as offset of the given object
9374 offset = geompy.MakeOffset(box, 70.)
9376 # Example: see GEOM_TestAll.py
9377 theOffset, Parameters = ParseParameters(theOffset)
9378 anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, True )
9379 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
9380 anObj.SetParameters(Parameters)
9381 self._autoPublish(anObj, theName, "offset")
9384 ## Create new object as offset of the given one. Gap between adjacent
9385 # offset surfaces is filled by extending and intersecting them.
9386 # @param theObject The base object for the offset.
9387 # @param theOffset Offset value.
9388 # @param theName Object name; when specified, this parameter is used
9389 # for result publication in the study. Otherwise, if automatic
9390 # publication is switched on, default value is used for result name.
9392 # @return New GEOM.GEOM_Object, containing the offset object.
9395 # @ref tui_offset "Example"
9396 @ManageTransactions("TrsfOp")
9397 def MakeOffsetIntersectionJoin(self, theObject, theOffset, theName=None):
9399 Create new object as offset of the given one. Gap between adjacent
9400 offset surfaces is filled by extending and intersecting them.
9403 theObject The base object for the offset.
9404 theOffset Offset value.
9405 theName Object name; when specified, this parameter is used
9406 for result publication in the study. Otherwise, if automatic
9407 publication is switched on, default value is used for result name.
9410 New GEOM.GEOM_Object, containing the offset object.
9413 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
9414 # create a new box extended by 70
9415 offset = geompy.MakeOffsetIntersectionJoin(box, 70.)
9417 # Example: see GEOM_TestAll.py
9418 theOffset, Parameters = ParseParameters( theOffset )
9419 anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, False )
9420 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
9421 anObj.SetParameters(Parameters)
9422 self._autoPublish(anObj, theName, "offset")
9425 ## Create new object as projection of the given one on another.
9426 # @param theSource The source object for the projection. It can be a point, edge or wire.
9427 # Edge and wire are acceptable if @a theTarget is a face.
9428 # @param theTarget The target object. It can be planar or cylindrical face, edge or wire.
9429 # @param theName Object name; when specified, this parameter is used
9430 # for result publication in the study. Otherwise, if automatic
9431 # publication is switched on, default value is used for result name.
9433 # @return New GEOM.GEOM_Object, containing the projection.
9435 # @ref tui_projection "Example"
9436 @ManageTransactions("TrsfOp")
9437 def MakeProjection(self, theSource, theTarget, theName=None):
9439 Create new object as projection of the given one on another.
9442 theSource The source object for the projection. It can be a point, edge or wire.
9443 Edge and wire are acceptable if theTarget is a face.
9444 theTarget The target object. It can be planar or cylindrical face, edge or wire.
9445 theName Object name; when specified, this parameter is used
9446 for result publication in the study. Otherwise, if automatic
9447 publication is switched on, default value is used for result name.
9450 New GEOM.GEOM_Object, containing the projection.
9452 # Example: see GEOM_TestAll.py
9453 anObj = self.TrsfOp.ProjectShapeCopy(theSource, theTarget)
9454 RaiseIfFailed("ProjectShapeCopy", self.TrsfOp)
9455 self._autoPublish(anObj, theName, "projection")
9458 ## Create a projection of the given point on a wire or an edge.
9459 # If there are no solutions or there are 2 or more solutions It throws an
9461 # @param thePoint the point to be projected.
9462 # @param theWire the wire. The edge is accepted as well.
9463 # @param theName Object name; when specified, this parameter is used
9464 # for result publication in the study. Otherwise, if automatic
9465 # publication is switched on, default value is used for result name.
9467 # @return [\a u, \a PointOnEdge, \a EdgeInWireIndex]
9468 # \n \a u: The parameter of projection point on edge.
9469 # \n \a PointOnEdge: The projection point.
9470 # \n \a EdgeInWireIndex: The index of an edge in a wire.
9472 # @ref tui_projection "Example"
9473 @ManageTransactions("TrsfOp")
9474 def MakeProjectionOnWire(self, thePoint, theWire, theName=None):
9476 Create a projection of the given point on a wire or an edge.
9477 If there are no solutions or there are 2 or more solutions It throws an
9481 thePoint the point to be projected.
9482 theWire the wire. The edge is accepted as well.
9483 theName Object name; when specified, this parameter is used
9484 for result publication in the study. Otherwise, if automatic
9485 publication is switched on, default value is used for result name.
9488 [u, PointOnEdge, EdgeInWireIndex]
9489 u: The parameter of projection point on edge.
9490 PointOnEdge: The projection point.
9491 EdgeInWireIndex: The index of an edge in a wire.
9493 # Example: see GEOM_TestAll.py
9494 anObj = self.TrsfOp.ProjectPointOnWire(thePoint, theWire)
9495 RaiseIfFailed("ProjectPointOnWire", self.TrsfOp)
9496 self._autoPublish(anObj[1], theName, "projection")
9499 # -----------------------------------------------------------------------------
9501 # -----------------------------------------------------------------------------
9503 ## Translate the given object along the given vector a given number times
9504 # @param theObject The object to be translated.
9505 # @param theVector Direction of the translation. DX if None.
9506 # @param theStep Distance to translate on.
9507 # @param theNbTimes Quantity of translations to be done.
9508 # @param theName Object name; when specified, this parameter is used
9509 # for result publication in the study. Otherwise, if automatic
9510 # publication is switched on, default value is used for result name.
9512 # @return New GEOM.GEOM_Object, containing compound of all
9513 # the shapes, obtained after each translation.
9515 # @ref tui_multi_translation "Example"
9516 @ManageTransactions("TrsfOp")
9517 def MakeMultiTranslation1D(self, theObject, theVector, theStep, theNbTimes, theName=None):
9519 Translate the given object along the given vector a given number times
9522 theObject The object to be translated.
9523 theVector Direction of the translation. DX if None.
9524 theStep Distance to translate on.
9525 theNbTimes Quantity of translations to be done.
9526 theName Object name; when specified, this parameter is used
9527 for result publication in the study. Otherwise, if automatic
9528 publication is switched on, default value is used for result name.
9531 New GEOM.GEOM_Object, containing compound of all
9532 the shapes, obtained after each translation.
9535 r1d = geompy.MakeMultiTranslation1D(prism, vect, 20, 4)
9537 # Example: see GEOM_TestAll.py
9538 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
9539 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
9540 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
9541 anObj.SetParameters(Parameters)
9542 self._autoPublish(anObj, theName, "multitranslation")
9545 ## Conseqently apply two specified translations to theObject specified number of times.
9546 # @param theObject The object to be translated.
9547 # @param theVector1 Direction of the first translation. DX if None.
9548 # @param theStep1 Step of the first translation.
9549 # @param theNbTimes1 Quantity of translations to be done along theVector1.
9550 # @param theVector2 Direction of the second translation. DY if None.
9551 # @param theStep2 Step of the second translation.
9552 # @param theNbTimes2 Quantity of translations to be done along theVector2.
9553 # @param theName Object name; when specified, this parameter is used
9554 # for result publication in the study. Otherwise, if automatic
9555 # publication is switched on, default value is used for result name.
9557 # @return New GEOM.GEOM_Object, containing compound of all
9558 # the shapes, obtained after each translation.
9560 # @ref tui_multi_translation "Example"
9561 @ManageTransactions("TrsfOp")
9562 def MakeMultiTranslation2D(self, theObject, theVector1, theStep1, theNbTimes1,
9563 theVector2, theStep2, theNbTimes2, theName=None):
9565 Conseqently apply two specified translations to theObject specified number of times.
9568 theObject The object to be translated.
9569 theVector1 Direction of the first translation. DX if None.
9570 theStep1 Step of the first translation.
9571 theNbTimes1 Quantity of translations to be done along theVector1.
9572 theVector2 Direction of the second translation. DY if None.
9573 theStep2 Step of the second translation.
9574 theNbTimes2 Quantity of translations to be done along theVector2.
9575 theName Object name; when specified, this parameter is used
9576 for result publication in the study. Otherwise, if automatic
9577 publication is switched on, default value is used for result name.
9580 New GEOM.GEOM_Object, containing compound of all
9581 the shapes, obtained after each translation.
9584 tr2d = geompy.MakeMultiTranslation2D(prism, vect1, 20, 4, vect2, 80, 3)
9586 # Example: see GEOM_TestAll.py
9587 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
9588 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
9589 theVector2, theStep2, theNbTimes2)
9590 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
9591 anObj.SetParameters(Parameters)
9592 self._autoPublish(anObj, theName, "multitranslation")
9595 ## Rotate the given object around the given axis a given number times.
9596 # Rotation angle will be 2*PI/theNbTimes.
9597 # @param theObject The object to be rotated.
9598 # @param theAxis The rotation axis. DZ if None.
9599 # @param theNbTimes Quantity of rotations to be done.
9600 # @param theName Object name; when specified, this parameter is used
9601 # for result publication in the study. Otherwise, if automatic
9602 # publication is switched on, default value is used for result name.
9604 # @return New GEOM.GEOM_Object, containing compound of all the
9605 # shapes, obtained after each rotation.
9607 # @ref tui_multi_rotation "Example"
9608 @ManageTransactions("TrsfOp")
9609 def MultiRotate1DNbTimes (self, theObject, theAxis, theNbTimes, theName=None):
9611 Rotate the given object around the given axis a given number times.
9612 Rotation angle will be 2*PI/theNbTimes.
9615 theObject The object to be rotated.
9616 theAxis The rotation axis. DZ if None.
9617 theNbTimes Quantity of rotations to be done.
9618 theName Object name; when specified, this parameter is used
9619 for result publication in the study. Otherwise, if automatic
9620 publication is switched on, default value is used for result name.
9623 New GEOM.GEOM_Object, containing compound of all the
9624 shapes, obtained after each rotation.
9627 rot1d = geompy.MultiRotate1DNbTimes(prism, vect, 4)
9629 # Example: see GEOM_TestAll.py
9630 theNbTimes, Parameters = ParseParameters(theNbTimes)
9631 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
9632 RaiseIfFailed("MultiRotate1DNbTimes", self.TrsfOp)
9633 anObj.SetParameters(Parameters)
9634 self._autoPublish(anObj, theName, "multirotation")
9637 ## Rotate the given object around the given axis
9638 # a given number times on the given angle.
9639 # @param theObject The object to be rotated.
9640 # @param theAxis The rotation axis. DZ if None.
9641 # @param theAngleStep Rotation angle in radians.
9642 # @param theNbTimes Quantity of rotations to be done.
9643 # @param theName Object name; when specified, this parameter is used
9644 # for result publication in the study. Otherwise, if automatic
9645 # publication is switched on, default value is used for result name.
9647 # @return New GEOM.GEOM_Object, containing compound of all the
9648 # shapes, obtained after each rotation.
9650 # @ref tui_multi_rotation "Example"
9651 @ManageTransactions("TrsfOp")
9652 def MultiRotate1DByStep(self, theObject, theAxis, theAngleStep, theNbTimes, theName=None):
9654 Rotate the given object around the given axis
9655 a given number times on the given angle.
9658 theObject The object to be rotated.
9659 theAxis The rotation axis. DZ if None.
9660 theAngleStep Rotation angle in radians.
9661 theNbTimes Quantity of rotations to be done.
9662 theName Object name; when specified, this parameter is used
9663 for result publication in the study. Otherwise, if automatic
9664 publication is switched on, default value is used for result name.
9667 New GEOM.GEOM_Object, containing compound of all the
9668 shapes, obtained after each rotation.
9671 rot1d = geompy.MultiRotate1DByStep(prism, vect, math.pi/4, 4)
9673 # Example: see GEOM_TestAll.py
9674 theAngleStep, theNbTimes, Parameters = ParseParameters(theAngleStep, theNbTimes)
9675 anObj = self.TrsfOp.MultiRotate1DByStep(theObject, theAxis, theAngleStep, theNbTimes)
9676 RaiseIfFailed("MultiRotate1DByStep", self.TrsfOp)
9677 anObj.SetParameters(Parameters)
9678 self._autoPublish(anObj, theName, "multirotation")
9681 ## Rotate the given object around the given axis a given
9682 # number times and multi-translate each rotation result.
9683 # Rotation angle will be 2*PI/theNbTimes1.
9684 # Translation direction passes through center of gravity
9685 # of rotated shape and its projection on the rotation axis.
9686 # @param theObject The object to be rotated.
9687 # @param theAxis Rotation axis. DZ if None.
9688 # @param theNbTimes1 Quantity of rotations to be done.
9689 # @param theRadialStep Translation distance.
9690 # @param theNbTimes2 Quantity of translations to be done.
9691 # @param theName Object name; when specified, this parameter is used
9692 # for result publication in the study. Otherwise, if automatic
9693 # publication is switched on, default value is used for result name.
9695 # @return New GEOM.GEOM_Object, containing compound of all the
9696 # shapes, obtained after each transformation.
9698 # @ref tui_multi_rotation "Example"
9699 @ManageTransactions("TrsfOp")
9700 def MultiRotate2DNbTimes(self, theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
9702 Rotate the given object around the
9703 given axis on the given angle a given number
9704 times and multi-translate each rotation result.
9705 Translation direction passes through center of gravity
9706 of rotated shape and its projection on the rotation axis.
9709 theObject The object to be rotated.
9710 theAxis Rotation axis. DZ if None.
9711 theNbTimes1 Quantity of rotations to be done.
9712 theRadialStep Translation distance.
9713 theNbTimes2 Quantity of translations to be done.
9714 theName Object name; when specified, this parameter is used
9715 for result publication in the study. Otherwise, if automatic
9716 publication is switched on, default value is used for result name.
9719 New GEOM.GEOM_Object, containing compound of all the
9720 shapes, obtained after each transformation.
9723 rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
9725 # Example: see GEOM_TestAll.py
9726 theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theNbTimes1, theRadialStep, theNbTimes2)
9727 anObj = self.TrsfOp.MultiRotate2DNbTimes(theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2)
9728 RaiseIfFailed("MultiRotate2DNbTimes", self.TrsfOp)
9729 anObj.SetParameters(Parameters)
9730 self._autoPublish(anObj, theName, "multirotation")
9733 ## Rotate the given object around the
9734 # given axis on the given angle a given number
9735 # times and multi-translate each rotation result.
9736 # Translation direction passes through center of gravity
9737 # of rotated shape and its projection on the rotation axis.
9738 # @param theObject The object to be rotated.
9739 # @param theAxis Rotation axis. DZ if None.
9740 # @param theAngleStep Rotation angle in radians.
9741 # @param theNbTimes1 Quantity of rotations to be done.
9742 # @param theRadialStep Translation distance.
9743 # @param theNbTimes2 Quantity of translations to be done.
9744 # @param theName Object name; when specified, this parameter is used
9745 # for result publication in the study. Otherwise, if automatic
9746 # publication is switched on, default value is used for result name.
9748 # @return New GEOM.GEOM_Object, containing compound of all the
9749 # shapes, obtained after each transformation.
9751 # @ref tui_multi_rotation "Example"
9752 @ManageTransactions("TrsfOp")
9753 def MultiRotate2DByStep (self, theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
9755 Rotate the given object around the
9756 given axis on the given angle a given number
9757 times and multi-translate each rotation result.
9758 Translation direction passes through center of gravity
9759 of rotated shape and its projection on the rotation axis.
9762 theObject The object to be rotated.
9763 theAxis Rotation axis. DZ if None.
9764 theAngleStep Rotation angle in radians.
9765 theNbTimes1 Quantity of rotations to be done.
9766 theRadialStep Translation distance.
9767 theNbTimes2 Quantity of translations to be done.
9768 theName Object name; when specified, this parameter is used
9769 for result publication in the study. Otherwise, if automatic
9770 publication is switched on, default value is used for result name.
9773 New GEOM.GEOM_Object, containing compound of all the
9774 shapes, obtained after each transformation.
9777 rot2d = geompy.MultiRotate2D(prism, vect, math.pi/3, 4, 50, 5)
9779 # Example: see GEOM_TestAll.py
9780 theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
9781 anObj = self.TrsfOp.MultiRotate2DByStep(theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
9782 RaiseIfFailed("MultiRotate2DByStep", self.TrsfOp)
9783 anObj.SetParameters(Parameters)
9784 self._autoPublish(anObj, theName, "multirotation")
9787 ## The same, as MultiRotate1DNbTimes(), but axis is given by direction and point
9789 # @ref swig_MakeMultiRotation "Example"
9790 def MakeMultiRotation1DNbTimes(self, aShape, aDir, aPoint, aNbTimes, theName=None):
9792 The same, as geompy.MultiRotate1DNbTimes, but axis is given by direction and point
9795 pz = geompy.MakeVertex(0, 0, 100)
9796 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9797 MultiRot1D = geompy.MakeMultiRotation1DNbTimes(prism, vy, pz, 6)
9799 # Example: see GEOM_TestOthers.py
9800 aVec = self.MakeLine(aPoint,aDir)
9801 # note: auto-publishing is done in self.MultiRotate1D()
9802 anObj = self.MultiRotate1DNbTimes(aShape, aVec, aNbTimes, theName)
9805 ## The same, as MultiRotate1DByStep(), but axis is given by direction and point
9807 # @ref swig_MakeMultiRotation "Example"
9808 def MakeMultiRotation1DByStep(self, aShape, aDir, aPoint, anAngle, aNbTimes, theName=None):
9810 The same, as geompy.MultiRotate1D, but axis is given by direction and point
9813 pz = geompy.MakeVertex(0, 0, 100)
9814 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9815 MultiRot1D = geompy.MakeMultiRotation1DByStep(prism, vy, pz, math.pi/3, 6)
9817 # Example: see GEOM_TestOthers.py
9818 aVec = self.MakeLine(aPoint,aDir)
9819 # note: auto-publishing is done in self.MultiRotate1D()
9820 anObj = self.MultiRotate1DByStep(aShape, aVec, anAngle, aNbTimes, theName)
9823 ## The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
9825 # @ref swig_MakeMultiRotation "Example"
9826 def MakeMultiRotation2DNbTimes(self, aShape, aDir, aPoint, nbtimes1, aStep, nbtimes2, theName=None):
9828 The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
9831 pz = geompy.MakeVertex(0, 0, 100)
9832 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9833 MultiRot2D = geompy.MakeMultiRotation2DNbTimes(f12, vy, pz, 6, 30, 3)
9835 # Example: see GEOM_TestOthers.py
9836 aVec = self.MakeLine(aPoint,aDir)
9837 # note: auto-publishing is done in self.MultiRotate2DNbTimes()
9838 anObj = self.MultiRotate2DNbTimes(aShape, aVec, nbtimes1, aStep, nbtimes2, theName)
9841 ## The same, as MultiRotate2DByStep(), but axis is given by direction and point
9843 # @ref swig_MakeMultiRotation "Example"
9844 def MakeMultiRotation2DByStep(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
9846 The same, as MultiRotate2DByStep(), but axis is given by direction and point
9849 pz = geompy.MakeVertex(0, 0, 100)
9850 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9851 MultiRot2D = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4, 6, 30, 3)
9853 # Example: see GEOM_TestOthers.py
9854 aVec = self.MakeLine(aPoint,aDir)
9855 # note: auto-publishing is done in self.MultiRotate2D()
9856 anObj = self.MultiRotate2DByStep(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
9860 # Compute a wire or a face that represents a projection of the source
9861 # shape onto cylinder. The cylinder's coordinate system is the same
9862 # as the global coordinate system.
9864 # @param theObject The object to be projected. It can be either
9865 # a planar wire or a face.
9866 # @param theRadius The radius of the cylinder.
9867 # @param theStartAngle The starting angle in radians from
9868 # the cylinder's X axis around Z axis. The angle from which
9869 # the projection is started.
9870 # @param theAngleLength The projection length angle in radians.
9871 # The angle in which to project the total length of the wire.
9872 # If it is negative the projection is not scaled and natural
9873 # wire length is kept for the projection.
9874 # @param theAngleRotation The desired angle in radians between
9875 # the tangent vector to the first curve at the first point of
9876 # the theObject's projection in 2D space and U-direction of
9877 # cylinder's 2D space.
9878 # @param theName Object name; when specified, this parameter is used
9879 # for result publication in the study. Otherwise, if automatic
9880 # publication is switched on, default value is used for result name.
9882 # @return New GEOM.GEOM_Object, containing the result shape. The result
9883 # represents a wire or a face that represents a projection of
9884 # the source shape onto a cylinder.
9886 # @ref tui_projection "Example"
9887 def MakeProjectionOnCylinder (self, theObject, theRadius,
9888 theStartAngle=0.0, theAngleLength=-1.0,
9889 theAngleRotation=0.0,
9892 Compute a wire or a face that represents a projection of the source
9893 shape onto cylinder. The cylinder's coordinate system is the same
9894 as the global coordinate system.
9897 theObject The object to be projected. It can be either
9898 a planar wire or a face.
9899 theRadius The radius of the cylinder.
9900 theStartAngle The starting angle in radians from the cylinder's X axis
9901 around Z axis. The angle from which the projection is started.
9902 theAngleLength The projection length angle in radians. The angle in which
9903 to project the total length of the wire. If it is negative the
9904 projection is not scaled and natural wire length is kept for
9906 theAngleRotation The desired angle in radians between
9907 the tangent vector to the first curve at the first
9908 point of the theObject's projection in 2D space and
9909 U-direction of cylinder's 2D space.
9910 theName Object name; when specified, this parameter is used
9911 for result publication in the study. Otherwise, if automatic
9912 publication is switched on, default value is used for result name.
9915 New GEOM.GEOM_Object, containing the result shape. The result
9916 represents a wire or a face that represents a projection of
9917 the source shape onto a cylinder.
9919 # Example: see GEOM_TestAll.py
9920 flagStartAngle = False
9921 if isinstance(theStartAngle,str):
9922 flagStartAngle = True
9923 flagAngleLength = False
9924 if isinstance(theAngleLength,str):
9925 flagAngleLength = True
9926 flagAngleRotation = False
9927 if isinstance(theAngleRotation,str):
9928 flagAngleRotation = True
9929 theRadius, theStartAngle, theAngleLength, theAngleRotation, Parameters = ParseParameters(
9930 theRadius, theStartAngle, theAngleLength, theAngleRotation)
9932 theStartAngle = theStartAngle*math.pi/180.
9934 theAngleLength = theAngleLength*math.pi/180.
9935 if flagAngleRotation:
9936 theAngleRotation = theAngleRotation*math.pi/180.
9937 anObj = self.TrsfOp.MakeProjectionOnCylinder(theObject, theRadius,
9938 theStartAngle, theAngleLength, theAngleRotation)
9939 RaiseIfFailed("MakeProjectionOnCylinder", self.TrsfOp)
9940 anObj.SetParameters(Parameters)
9941 self._autoPublish(anObj, theName, "projection")
9944 # end of l3_transform
9947 ## @addtogroup l3_transform_d
9950 ## Deprecated method. Use MultiRotate1DNbTimes instead.
9951 def MultiRotate1D(self, theObject, theAxis, theNbTimes, theName=None):
9953 Deprecated method. Use MultiRotate1DNbTimes instead.
9955 print("The method MultiRotate1D is DEPRECATED. Use MultiRotate1DNbTimes instead.")
9956 return self.MultiRotate1DNbTimes(theObject, theAxis, theNbTimes, theName)
9958 ## The same, as MultiRotate2DByStep(), but theAngle is in degrees.
9959 # This method is DEPRECATED. Use MultiRotate2DByStep() instead.
9960 @ManageTransactions("TrsfOp")
9961 def MultiRotate2D(self, theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2, theName=None):
9963 The same, as MultiRotate2DByStep(), but theAngle is in degrees.
9964 This method is DEPRECATED. Use MultiRotate2DByStep() instead.
9967 rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
9969 print("The method MultiRotate2D is DEPRECATED. Use MultiRotate2DByStep instead.")
9970 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
9971 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
9972 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
9973 anObj.SetParameters(Parameters)
9974 self._autoPublish(anObj, theName, "multirotation")
9977 ## The same, as MultiRotate1D(), but axis is given by direction and point
9978 # This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
9979 def MakeMultiRotation1D(self, aShape, aDir, aPoint, aNbTimes, theName=None):
9981 The same, as geompy.MultiRotate1D, but axis is given by direction and point.
9982 This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
9985 pz = geompy.MakeVertex(0, 0, 100)
9986 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9987 MultiRot1D = geompy.MakeMultiRotation1D(prism, vy, pz, 6)
9989 print("The method MakeMultiRotation1D is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.")
9990 aVec = self.MakeLine(aPoint,aDir)
9991 # note: auto-publishing is done in self.MultiRotate1D()
9992 anObj = self.MultiRotate1D(aShape, aVec, aNbTimes, theName)
9995 ## The same, as MultiRotate2D(), but axis is given by direction and point
9996 # This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
9997 def MakeMultiRotation2D(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
9999 The same, as MultiRotate2D(), but axis is given by direction and point
10000 This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
10003 pz = geompy.MakeVertex(0, 0, 100)
10004 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
10005 MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
10007 print("The method MakeMultiRotation2D is DEPRECATED. Use MakeMultiRotation2DByStep instead.")
10008 aVec = self.MakeLine(aPoint,aDir)
10009 # note: auto-publishing is done in self.MultiRotate2D()
10010 anObj = self.MultiRotate2D(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
10013 # end of l3_transform_d
10016 ## @addtogroup l3_local
10019 ## Perform a fillet on all edges of the given shape.
10020 # @param theShape Shape, to perform fillet on.
10021 # @param theR Fillet radius.
10022 # @param theName Object name; when specified, this parameter is used
10023 # for result publication in the study. Otherwise, if automatic
10024 # publication is switched on, default value is used for result name.
10026 # @return New GEOM.GEOM_Object, containing the result shape.
10028 # @ref tui_fillet "Example 1"
10029 # \n @ref swig_MakeFilletAll "Example 2"
10030 @ManageTransactions("LocalOp")
10031 def MakeFilletAll(self, theShape, theR, theName=None):
10033 Perform a fillet on all edges of the given shape.
10036 theShape Shape, to perform fillet on.
10037 theR Fillet radius.
10038 theName Object name; when specified, this parameter is used
10039 for result publication in the study. Otherwise, if automatic
10040 publication is switched on, default value is used for result name.
10043 New GEOM.GEOM_Object, containing the result shape.
10046 filletall = geompy.MakeFilletAll(prism, 10.)
10048 # Example: see GEOM_TestOthers.py
10049 theR,Parameters = ParseParameters(theR)
10050 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
10051 RaiseIfFailed("MakeFilletAll", self.LocalOp)
10052 anObj.SetParameters(Parameters)
10053 self._autoPublish(anObj, theName, "fillet")
10056 ## Perform a fillet on the specified edges/faces of the given shape
10057 # @param theShape Shape, to perform fillet on.
10058 # @param theR Fillet radius.
10059 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR> (see ShapeType())
10060 # @param theListShapes Global indices of edges/faces to perform fillet on.
10061 # @param theName Object name; when specified, this parameter is used
10062 # for result publication in the study. Otherwise, if automatic
10063 # publication is switched on, default value is used for result name.
10065 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10067 # @return New GEOM.GEOM_Object, containing the result shape.
10069 # @ref tui_fillet "Example"
10070 @ManageTransactions("LocalOp")
10071 def MakeFillet(self, theShape, theR, theShapeType, theListShapes, theName=None):
10073 Perform a fillet on the specified edges/faces of the given shape
10076 theShape Shape, to perform fillet on.
10077 theR Fillet radius.
10078 theShapeType Type of shapes in theListShapes (see geompy.ShapeTypes)
10079 theListShapes Global indices of edges/faces to perform fillet on.
10080 theName Object name; when specified, this parameter is used
10081 for result publication in the study. Otherwise, if automatic
10082 publication is switched on, default value is used for result name.
10085 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10088 New GEOM.GEOM_Object, containing the result shape.
10091 # get the list of IDs (IDList) for the fillet
10092 prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"])
10094 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
10095 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
10096 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
10097 # make a fillet on the specified edges of the given shape
10098 fillet = geompy.MakeFillet(prism, 10., geompy.ShapeType["EDGE"], IDlist_e)
10100 # Example: see GEOM_TestAll.py
10101 theR,Parameters = ParseParameters(theR)
10103 if theShapeType == self.ShapeType["EDGE"]:
10104 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
10105 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
10107 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
10108 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
10109 anObj.SetParameters(Parameters)
10110 self._autoPublish(anObj, theName, "fillet")
10113 ## The same that MakeFillet() but with two Fillet Radius R1 and R2
10114 @ManageTransactions("LocalOp")
10115 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes, theName=None):
10117 The same that geompy.MakeFillet but with two Fillet Radius R1 and R2
10120 # get the list of IDs (IDList) for the fillet
10121 prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"])
10123 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
10124 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
10125 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
10126 # make a fillet on the specified edges of the given shape
10127 fillet = geompy.MakeFillet(prism, 10., 15., geompy.ShapeType["EDGE"], IDlist_e)
10129 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
10131 if theShapeType == self.ShapeType["EDGE"]:
10132 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
10133 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
10135 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
10136 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
10137 anObj.SetParameters(Parameters)
10138 self._autoPublish(anObj, theName, "fillet")
10141 ## Perform a fillet on the specified edges of the given shape
10142 # @param theShape Wire Shape to perform fillet on.
10143 # @param theR Fillet radius.
10144 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
10145 # \note Global index of sub-shape can be obtained, using method GetSubShapeID()
10146 # \note The list of vertices could be empty,
10147 # in this case fillet will done done at all vertices in wire
10148 # @param doIgnoreSecantVertices If FALSE, fillet radius is always limited
10149 # by the length of the edges, nearest to the fillet vertex.
10150 # But sometimes the next edge is C1 continuous with the one, nearest to
10151 # the fillet point, and such two (or more) edges can be united to allow
10152 # bigger radius. Set this flag to TRUE to allow collinear edges union,
10153 # thus ignoring the secant vertex (vertices).
10154 # @param theName Object name; when specified, this parameter is used
10155 # for result publication in the study. Otherwise, if automatic
10156 # publication is switched on, default value is used for result name.
10158 # @return New GEOM.GEOM_Object, containing the result shape.
10160 # @ref tui_fillet2d "Example"
10161 @ManageTransactions("LocalOp")
10162 def MakeFillet1D(self, theShape, theR, theListOfVertexes, doIgnoreSecantVertices = True, theName=None):
10164 Perform a fillet on the specified edges of the given shape
10167 theShape Wire Shape to perform fillet on.
10168 theR Fillet radius.
10169 theListOfVertexes Global indices of vertexes to perform fillet on.
10170 doIgnoreSecantVertices If FALSE, fillet radius is always limited
10171 by the length of the edges, nearest to the fillet vertex.
10172 But sometimes the next edge is C1 continuous with the one, nearest to
10173 the fillet point, and such two (or more) edges can be united to allow
10174 bigger radius. Set this flag to TRUE to allow collinear edges union,
10175 thus ignoring the secant vertex (vertices).
10176 theName Object name; when specified, this parameter is used
10177 for result publication in the study. Otherwise, if automatic
10178 publication is switched on, default value is used for result name.
10180 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10182 The list of vertices could be empty,in this case fillet will done done at all vertices in wire
10185 New GEOM.GEOM_Object, containing the result shape.
10189 Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
10190 # make fillet at given wire vertices with giver radius
10191 Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
10193 # Example: see GEOM_TestAll.py
10194 theR,doIgnoreSecantVertices,Parameters = ParseParameters(theR,doIgnoreSecantVertices)
10195 anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes, doIgnoreSecantVertices)
10196 RaiseIfFailed("MakeFillet1D", self.LocalOp)
10197 anObj.SetParameters(Parameters)
10198 self._autoPublish(anObj, theName, "fillet")
10201 ## Perform a fillet at the specified vertices of the given face/shell.
10202 # @param theShape Face or Shell shape to perform fillet on.
10203 # @param theR Fillet radius.
10204 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
10205 # @param theName Object name; when specified, this parameter is used
10206 # for result publication in the study. Otherwise, if automatic
10207 # publication is switched on, default value is used for result name.
10209 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10211 # @return New GEOM.GEOM_Object, containing the result shape.
10213 # @ref tui_fillet2d "Example"
10214 @ManageTransactions("LocalOp")
10215 def MakeFillet2D(self, theShape, theR, theListOfVertexes, theName=None):
10217 Perform a fillet at the specified vertices of the given face/shell.
10220 theShape Face or Shell shape to perform fillet on.
10221 theR Fillet radius.
10222 theListOfVertexes Global indices of vertexes to perform fillet on.
10223 theName Object name; when specified, this parameter is used
10224 for result publication in the study. Otherwise, if automatic
10225 publication is switched on, default value is used for result name.
10227 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10230 New GEOM.GEOM_Object, containing the result shape.
10233 face = geompy.MakeFaceHW(100, 100, 1)
10234 fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
10236 # Example: see GEOM_TestAll.py
10237 theR,Parameters = ParseParameters(theR)
10238 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
10239 RaiseIfFailed("MakeFillet2D", self.LocalOp)
10240 anObj.SetParameters(Parameters)
10241 self._autoPublish(anObj, theName, "fillet")
10244 ## Perform a symmetric chamfer on all edges of the given shape.
10245 # @param theShape Shape, to perform chamfer on.
10246 # @param theD Chamfer size along each face.
10247 # @param theName Object name; when specified, this parameter is used
10248 # for result publication in the study. Otherwise, if automatic
10249 # publication is switched on, default value is used for result name.
10251 # @return New GEOM.GEOM_Object, containing the result shape.
10253 # @ref tui_chamfer "Example 1"
10254 # \n @ref swig_MakeChamferAll "Example 2"
10255 @ManageTransactions("LocalOp")
10256 def MakeChamferAll(self, theShape, theD, theName=None):
10258 Perform a symmetric chamfer on all edges of the given shape.
10261 theShape Shape, to perform chamfer on.
10262 theD Chamfer size along each face.
10263 theName Object name; when specified, this parameter is used
10264 for result publication in the study. Otherwise, if automatic
10265 publication is switched on, default value is used for result name.
10268 New GEOM.GEOM_Object, containing the result shape.
10271 chamfer_all = geompy.MakeChamferAll(prism, 10.)
10273 # Example: see GEOM_TestOthers.py
10274 theD,Parameters = ParseParameters(theD)
10275 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
10276 RaiseIfFailed("MakeChamferAll", self.LocalOp)
10277 anObj.SetParameters(Parameters)
10278 self._autoPublish(anObj, theName, "chamfer")
10281 ## Perform a chamfer on edges, common to the specified faces,
10282 # with distance D1 on the Face1
10283 # @param theShape Shape, to perform chamfer on.
10284 # @param theD1 Chamfer size along \a theFace1.
10285 # @param theD2 Chamfer size along \a theFace2.
10286 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
10287 # @param theName Object name; when specified, this parameter is used
10288 # for result publication in the study. Otherwise, if automatic
10289 # publication is switched on, default value is used for result name.
10291 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10293 # @return New GEOM.GEOM_Object, containing the result shape.
10295 # @ref tui_chamfer "Example"
10296 @ManageTransactions("LocalOp")
10297 def MakeChamferEdge(self, theShape, theD1, theD2, theFace1, theFace2, theName=None):
10299 Perform a chamfer on edges, common to the specified faces,
10300 with distance D1 on the Face1
10303 theShape Shape, to perform chamfer on.
10304 theD1 Chamfer size along theFace1.
10305 theD2 Chamfer size along theFace2.
10306 theFace1,theFace2 Global indices of two faces of theShape.
10307 theName Object name; when specified, this parameter is used
10308 for result publication in the study. Otherwise, if automatic
10309 publication is switched on, default value is used for result name.
10312 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10315 New GEOM.GEOM_Object, containing the result shape.
10318 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
10319 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
10320 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
10321 chamfer_e = geompy.MakeChamferEdge(prism, 10., 10., f_ind_1, f_ind_2)
10323 # Example: see GEOM_TestAll.py
10324 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10325 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
10326 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
10327 anObj.SetParameters(Parameters)
10328 self._autoPublish(anObj, theName, "chamfer")
10331 ## Perform a chamfer on edges
10332 # @param theShape Shape, to perform chamfer on.
10333 # @param theD Chamfer length
10334 # @param theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10335 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
10336 # @param theName Object name; when specified, this parameter is used
10337 # for result publication in the study. Otherwise, if automatic
10338 # publication is switched on, default value is used for result name.
10340 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10342 # @return New GEOM.GEOM_Object, containing the result shape.
10343 @ManageTransactions("LocalOp")
10344 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2, theName=None):
10346 Perform a chamfer on edges
10349 theShape Shape, to perform chamfer on.
10350 theD1 Chamfer size along theFace1.
10351 theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees).
10352 theFace1,theFace2 Global indices of two faces of theShape.
10353 theName Object name; when specified, this parameter is used
10354 for result publication in the study. Otherwise, if automatic
10355 publication is switched on, default value is used for result name.
10358 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10361 New GEOM.GEOM_Object, containing the result shape.
10364 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
10365 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
10366 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
10368 chamfer_e = geompy.MakeChamferEdge(prism, 10., ang, f_ind_1, f_ind_2)
10371 if isinstance(theAngle,str):
10373 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10375 theAngle = theAngle*math.pi/180.0
10376 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
10377 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
10378 anObj.SetParameters(Parameters)
10379 self._autoPublish(anObj, theName, "chamfer")
10382 ## Perform a chamfer on all edges of the specified faces,
10383 # with distance D1 on the first specified face (if several for one edge)
10384 # @param theShape Shape, to perform chamfer on.
10385 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
10386 # connected to the edge, are in \a theFaces, \a theD1
10387 # will be get along face, which is nearer to \a theFaces beginning.
10388 # @param theD2 Chamfer size along another of two faces, connected to the edge.
10389 # @param theFaces Sequence of global indices of faces of \a theShape.
10390 # @param theName Object name; when specified, this parameter is used
10391 # for result publication in the study. Otherwise, if automatic
10392 # publication is switched on, default value is used for result name.
10394 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10396 # @return New GEOM.GEOM_Object, containing the result shape.
10398 # @ref tui_chamfer "Example"
10399 @ManageTransactions("LocalOp")
10400 def MakeChamferFaces(self, theShape, theD1, theD2, theFaces, theName=None):
10402 Perform a chamfer on all edges of the specified faces,
10403 with distance D1 on the first specified face (if several for one edge)
10406 theShape Shape, to perform chamfer on.
10407 theD1 Chamfer size along face from theFaces. If both faces,
10408 connected to the edge, are in theFaces, theD1
10409 will be get along face, which is nearer to theFaces beginning.
10410 theD2 Chamfer size along another of two faces, connected to the edge.
10411 theFaces Sequence of global indices of faces of theShape.
10412 theName Object name; when specified, this parameter is used
10413 for result publication in the study. Otherwise, if automatic
10414 publication is switched on, default value is used for result name.
10416 Note: Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
10419 New GEOM.GEOM_Object, containing the result shape.
10421 # Example: see GEOM_TestAll.py
10422 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10423 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
10424 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
10425 anObj.SetParameters(Parameters)
10426 self._autoPublish(anObj, theName, "chamfer")
10429 ## The Same that MakeChamferFaces() but with params theD is chamfer length and
10430 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10432 # @ref swig_FilletChamfer "Example"
10433 @ManageTransactions("LocalOp")
10434 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces, theName=None):
10436 The Same that geompy.MakeChamferFaces but with params theD is chamfer length and
10437 theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10440 if isinstance(theAngle,str):
10442 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10444 theAngle = theAngle*math.pi/180.0
10445 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
10446 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
10447 anObj.SetParameters(Parameters)
10448 self._autoPublish(anObj, theName, "chamfer")
10451 ## Perform a chamfer on edges,
10452 # with distance D1 on the first specified face (if several for one edge)
10453 # @param theShape Shape, to perform chamfer on.
10454 # @param theD1,theD2 Chamfer size
10455 # @param theEdges Sequence of edges of \a theShape.
10456 # @param theName Object name; when specified, this parameter is used
10457 # for result publication in the study. Otherwise, if automatic
10458 # publication is switched on, default value is used for result name.
10460 # @return New GEOM.GEOM_Object, containing the result shape.
10462 # @ref swig_FilletChamfer "Example"
10463 @ManageTransactions("LocalOp")
10464 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges, theName=None):
10466 Perform a chamfer on edges,
10467 with distance D1 on the first specified face (if several for one edge)
10470 theShape Shape, to perform chamfer on.
10471 theD1,theD2 Chamfer size
10472 theEdges Sequence of edges of theShape.
10473 theName Object name; when specified, this parameter is used
10474 for result publication in the study. Otherwise, if automatic
10475 publication is switched on, default value is used for result name.
10478 New GEOM.GEOM_Object, containing the result shape.
10480 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10481 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
10482 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
10483 anObj.SetParameters(Parameters)
10484 self._autoPublish(anObj, theName, "chamfer")
10487 ## The Same that MakeChamferEdges() but with params theD is chamfer length and
10488 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10489 @ManageTransactions("LocalOp")
10490 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges, theName=None):
10492 The Same that geompy.MakeChamferEdges but with params theD is chamfer length and
10493 theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10496 if isinstance(theAngle,str):
10498 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10500 theAngle = theAngle*math.pi/180.0
10501 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
10502 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
10503 anObj.SetParameters(Parameters)
10504 self._autoPublish(anObj, theName, "chamfer")
10507 ## @sa MakeChamferEdge(), MakeChamferFaces()
10509 # @ref swig_MakeChamfer "Example"
10510 def MakeChamfer(self, aShape, d1, d2, aShapeType, ListShape, theName=None):
10512 See geompy.MakeChamferEdge() and geompy.MakeChamferFaces() functions for more information.
10514 # Example: see GEOM_TestOthers.py
10516 # note: auto-publishing is done in self.MakeChamferEdge() or self.MakeChamferFaces()
10517 if aShapeType == self.ShapeType["EDGE"]:
10518 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1],theName)
10520 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape,theName)
10523 ## Remove material from a solid by extrusion of the base shape on the given distance.
10524 # @param theInit Shape to remove material from. It must be a solid or
10525 # a compound made of a single solid.
10526 # @param theBase Closed edge or wire defining the base shape to be extruded.
10527 # @param theH Prism dimension along the normal to theBase
10528 # @param theAngle Draft angle in degrees.
10529 # @param theInvert If true material changes the direction
10530 # @param theName Object name; when specified, this parameter is used
10531 # for result publication in the study. Otherwise, if automatic
10532 # publication is switched on, default value is used for result name.
10534 # @return New GEOM.GEOM_Object, containing the initial shape with removed material
10536 # @ref tui_creation_prism "Example"
10537 @ManageTransactions("PrimOp")
10538 def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
10540 Add material to a solid by extrusion of the base shape on the given distance.
10543 theInit Shape to remove material from. It must be a solid or a compound made of a single solid.
10544 theBase Closed edge or wire defining the base shape to be extruded.
10545 theH Prism dimension along the normal to theBase
10546 theAngle Draft angle in degrees.
10547 theInvert If true material changes the direction.
10548 theName Object name; when specified, this parameter is used
10549 for result publication in the study. Otherwise, if automatic
10550 publication is switched on, default value is used for result name.
10553 New GEOM.GEOM_Object, containing the initial shape with removed material.
10555 # Example: see GEOM_TestAll.py
10556 theH,theAngle,Parameters = ParseParameters(theH,theAngle)
10557 anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False, theInvert)
10558 RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
10559 anObj.SetParameters(Parameters)
10560 self._autoPublish(anObj, theName, "extrudedCut")
10563 ## Add material to a solid by extrusion of the base shape on the given distance.
10564 # @param theInit Shape to add material to. It must be a solid or
10565 # a compound made of a single solid.
10566 # @param theBase Closed edge or wire defining the base shape to be extruded.
10567 # @param theH Prism dimension along the normal to theBase
10568 # @param theAngle Draft angle in degrees.
10569 # @param theInvert If true material changes the direction
10570 # @param theName Object name; when specified, this parameter is used
10571 # for result publication in the study. Otherwise, if automatic
10572 # publication is switched on, default value is used for result name.
10574 # @return New GEOM.GEOM_Object, containing the initial shape with added material
10576 # @ref tui_creation_prism "Example"
10577 @ManageTransactions("PrimOp")
10578 def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
10580 Add material to a solid by extrusion of the base shape on the given distance.
10583 theInit Shape to add material to. It must be a solid or a compound made of a single solid.
10584 theBase Closed edge or wire defining the base shape to be extruded.
10585 theH Prism dimension along the normal to theBase
10586 theAngle Draft angle in degrees.
10587 theInvert If true material changes the direction.
10588 theName Object name; when specified, this parameter is used
10589 for result publication in the study. Otherwise, if automatic
10590 publication is switched on, default value is used for result name.
10593 New GEOM.GEOM_Object, containing the initial shape with added material.
10595 # Example: see GEOM_TestAll.py
10596 theH,theAngle,Parameters = ParseParameters(theH,theAngle)
10597 anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True, theInvert)
10598 RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
10599 anObj.SetParameters(Parameters)
10600 self._autoPublish(anObj, theName, "extrudedBoss")
10606 ## @addtogroup l3_basic_op
10609 ## Perform an Archimde operation on the given shape with given parameters.
10610 # The object presenting the resulting face is returned.
10611 # @param theShape Shape to be put in water.
10612 # @param theWeight Weight of the shape.
10613 # @param theWaterDensity Density of the water.
10614 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
10615 # @param theName Object name; when specified, this parameter is used
10616 # for result publication in the study. Otherwise, if automatic
10617 # publication is switched on, default value is used for result name.
10619 # @return New GEOM.GEOM_Object, containing a section of \a theShape
10620 # by a plane, corresponding to water level.
10622 # @ref tui_archimede "Example"
10623 @ManageTransactions("LocalOp")
10624 def Archimede(self, theShape, theWeight, theWaterDensity, theMeshDeflection, theName=None):
10626 Perform an Archimde operation on the given shape with given parameters.
10627 The object presenting the resulting face is returned.
10630 theShape Shape to be put in water.
10631 theWeight Weight of the shape.
10632 theWaterDensity Density of the water.
10633 theMeshDeflection Deflection of the mesh, using to compute the section.
10634 theName Object name; when specified, this parameter is used
10635 for result publication in the study. Otherwise, if automatic
10636 publication is switched on, default value is used for result name.
10639 New GEOM.GEOM_Object, containing a section of theShape
10640 by a plane, corresponding to water level.
10642 # Example: see GEOM_TestAll.py
10643 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
10644 theWeight,theWaterDensity,theMeshDeflection)
10645 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
10646 RaiseIfFailed("MakeArchimede", self.LocalOp)
10647 anObj.SetParameters(Parameters)
10648 self._autoPublish(anObj, theName, "archimede")
10651 # end of l3_basic_op
10654 ## @addtogroup l2_measure
10657 ## Get point coordinates
10658 # @return [x, y, z]
10660 # @ref tui_point_coordinates_page "Example"
10661 @ManageTransactions("MeasuOp")
10662 def PointCoordinates(self,Point):
10664 Get point coordinates
10669 # Example: see GEOM_TestMeasures.py
10670 aTuple = self.MeasuOp.PointCoordinates(Point)
10671 RaiseIfFailed("PointCoordinates", self.MeasuOp)
10674 ## Get vector coordinates
10675 # @return [x, y, z]
10677 # @ref tui_measurement_tools_page "Example"
10678 def VectorCoordinates(self,Vector):
10680 Get vector coordinates
10686 p1=self.GetFirstVertex(Vector)
10687 p2=self.GetLastVertex(Vector)
10689 X1=self.PointCoordinates(p1)
10690 X2=self.PointCoordinates(p2)
10692 return (X2[0]-X1[0],X2[1]-X1[1],X2[2]-X1[2])
10695 ## Compute cross product
10696 # @return vector w=u^v
10698 # @ref tui_measurement_tools_page "Example"
10699 def CrossProduct(self, Vector1, Vector2):
10701 Compute cross product
10703 Returns: vector w=u^v
10705 u=self.VectorCoordinates(Vector1)
10706 v=self.VectorCoordinates(Vector2)
10707 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])
10711 ## Compute cross product
10712 # @return dot product p=u.v
10714 # @ref tui_measurement_tools_page "Example"
10715 def DotProduct(self, Vector1, Vector2):
10717 Compute cross product
10719 Returns: dot product p=u.v
10721 u=self.VectorCoordinates(Vector1)
10722 v=self.VectorCoordinates(Vector2)
10723 p=u[0]*v[0]+u[1]*v[1]+u[2]*v[2]
10728 ## Get summarized length of all wires,
10729 # area of surface and volume of the given shape.
10730 # @param theShape Shape to define properties of.
10731 # @param theTolerance maximal relative error of area
10732 # and volume computation.
10733 # @return [theLength, theSurfArea, theVolume]\n
10734 # theLength: Summarized length of all wires of the given shape.\n
10735 # theSurfArea: Area of surface of the given shape.\n
10736 # theVolume: Volume of the given shape.
10738 # @ref tui_basic_properties_page "Example"
10739 @ManageTransactions("MeasuOp")
10740 def BasicProperties(self,theShape, theTolerance=1.e-6):
10742 Get summarized length of all wires,
10743 area of surface and volume of the given shape.
10746 theShape Shape to define properties of.
10747 theTolerance maximal relative error of area
10748 and volume computation.
10751 [theLength, theSurfArea, theVolume]
10752 theLength: Summarized length of all wires of the given shape.
10753 theSurfArea: Area of surface of the given shape.
10754 theVolume: Volume of the given shape.
10756 # Example: see GEOM_TestMeasures.py
10757 aTuple = self.MeasuOp.GetBasicProperties(theShape, theTolerance)
10758 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
10761 ## Get parameters of bounding box of the given shape
10762 # @param theShape Shape to obtain bounding box of.
10763 # @param precise TRUE for precise computation; FALSE for fast one.
10764 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
10765 # Xmin,Xmax: Limits of shape along OX axis.
10766 # Ymin,Ymax: Limits of shape along OY axis.
10767 # Zmin,Zmax: Limits of shape along OZ axis.
10769 # @ref tui_bounding_box_page "Example"
10770 @ManageTransactions("MeasuOp")
10771 def BoundingBox (self, theShape, precise=False):
10773 Get parameters of bounding box of the given shape
10776 theShape Shape to obtain bounding box of.
10777 precise TRUE for precise computation; FALSE for fast one.
10780 [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
10781 Xmin,Xmax: Limits of shape along OX axis.
10782 Ymin,Ymax: Limits of shape along OY axis.
10783 Zmin,Zmax: Limits of shape along OZ axis.
10785 # Example: see GEOM_TestMeasures.py
10786 aTuple = self.MeasuOp.GetBoundingBox(theShape, precise)
10787 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
10790 ## Get bounding box of the given shape
10791 # @param theShape Shape to obtain bounding box of.
10792 # @param precise TRUE for precise computation; FALSE for fast one.
10793 # @param theName Object name; when specified, this parameter is used
10794 # for result publication in the study. Otherwise, if automatic
10795 # publication is switched on, default value is used for result name.
10797 # @return New GEOM.GEOM_Object, containing the created box.
10799 # @ref tui_bounding_box_page "Example"
10800 @ManageTransactions("MeasuOp")
10801 def MakeBoundingBox (self, theShape, precise=False, theName=None):
10803 Get bounding box of the given shape
10806 theShape Shape to obtain bounding box of.
10807 precise TRUE for precise computation; FALSE for fast one.
10808 theName Object name; when specified, this parameter is used
10809 for result publication in the study. Otherwise, if automatic
10810 publication is switched on, default value is used for result name.
10813 New GEOM.GEOM_Object, containing the created box.
10815 # Example: see GEOM_TestMeasures.py
10816 anObj = self.MeasuOp.MakeBoundingBox(theShape, precise)
10817 RaiseIfFailed("MakeBoundingBox", self.MeasuOp)
10818 self._autoPublish(anObj, theName, "bndbox")
10821 ## Get inertia matrix and moments of inertia of theShape.
10822 # @param theShape Shape to calculate inertia of.
10823 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
10824 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
10825 # Ix,Iy,Iz: Moments of inertia of the given shape.
10827 # @ref tui_inertia_page "Example"
10828 @ManageTransactions("MeasuOp")
10829 def Inertia(self,theShape):
10831 Get inertia matrix and moments of inertia of theShape.
10834 theShape Shape to calculate inertia of.
10837 [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
10838 I(1-3)(1-3): Components of the inertia matrix of the given shape.
10839 Ix,Iy,Iz: Moments of inertia of the given shape.
10841 # Example: see GEOM_TestMeasures.py
10842 aTuple = self.MeasuOp.GetInertia(theShape)
10843 RaiseIfFailed("GetInertia", self.MeasuOp)
10846 ## Get if coords are included in the shape (ST_IN or ST_ON)
10847 # @param theShape Shape
10848 # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
10849 # @param tolerance to be used (default is 1.0e-7)
10850 # @return list_of_boolean = [res1, res2, ...]
10851 @ManageTransactions("MeasuOp")
10852 def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
10854 Get if coords are included in the shape (ST_IN or ST_ON)
10858 coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
10859 tolerance to be used (default is 1.0e-7)
10862 list_of_boolean = [res1, res2, ...]
10864 return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
10866 ## Get minimal distance between the given shapes.
10867 # @param theShape1,theShape2 Shapes to find minimal distance between.
10868 # @return Value of the minimal distance between the given shapes.
10870 # @ref tui_min_distance_page "Example"
10871 @ManageTransactions("MeasuOp")
10872 def MinDistance(self, theShape1, theShape2):
10874 Get minimal distance between the given shapes.
10877 theShape1,theShape2 Shapes to find minimal distance between.
10880 Value of the minimal distance between the given shapes.
10882 # Example: see GEOM_TestMeasures.py
10883 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
10884 RaiseIfFailed("GetMinDistance", self.MeasuOp)
10887 ## Get minimal distance between the given shapes.
10888 # @param theShape1,theShape2 Shapes to find minimal distance between.
10889 # @return Value of the minimal distance between the given shapes, in form of list
10890 # [Distance, DX, DY, DZ].
10892 # @ref tui_min_distance_page "Example"
10893 @ManageTransactions("MeasuOp")
10894 def MinDistanceComponents(self, theShape1, theShape2):
10896 Get minimal distance between the given shapes.
10899 theShape1,theShape2 Shapes to find minimal distance between.
10902 Value of the minimal distance between the given shapes, in form of list
10903 [Distance, DX, DY, DZ]
10905 # Example: see GEOM_TestMeasures.py
10906 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
10907 RaiseIfFailed("GetMinDistance", self.MeasuOp)
10908 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
10911 ## Get closest points of the given shapes.
10912 # @param theShape1,theShape2 Shapes to find closest points of.
10913 # @return The number of found solutions (-1 in case of infinite number of
10914 # solutions) and a list of (X, Y, Z) coordinates for all couples of points.
10916 # @ref tui_min_distance_page "Example"
10917 @ManageTransactions("MeasuOp")
10918 def ClosestPoints (self, theShape1, theShape2):
10920 Get closest points of the given shapes.
10923 theShape1,theShape2 Shapes to find closest points of.
10926 The number of found solutions (-1 in case of infinite number of
10927 solutions) and a list of (X, Y, Z) coordinates for all couples of points.
10929 # Example: see GEOM_TestMeasures.py
10930 aTuple = self.MeasuOp.ClosestPoints(theShape1, theShape2)
10931 RaiseIfFailed("ClosestPoints", self.MeasuOp)
10934 ## Get angle between the given shapes in degrees.
10935 # @param theShape1,theShape2 Lines or linear edges to find angle between.
10936 # @note If both arguments are vectors, the angle is computed in accordance
10937 # with their orientations, otherwise the minimum angle is computed.
10938 # @return Value of the angle between the given shapes in degrees.
10940 # @ref tui_angle_page "Example"
10941 @ManageTransactions("MeasuOp")
10942 def GetAngle(self, theShape1, theShape2):
10944 Get angle between the given shapes in degrees.
10947 theShape1,theShape2 Lines or linear edges to find angle between.
10950 If both arguments are vectors, the angle is computed in accordance
10951 with their orientations, otherwise the minimum angle is computed.
10954 Value of the angle between the given shapes in degrees.
10956 # Example: see GEOM_TestMeasures.py
10957 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
10958 RaiseIfFailed("GetAngle", self.MeasuOp)
10961 ## Get angle between the given shapes in radians.
10962 # @param theShape1,theShape2 Lines or linear edges to find angle between.
10963 # @note If both arguments are vectors, the angle is computed in accordance
10964 # with their orientations, otherwise the minimum angle is computed.
10965 # @return Value of the angle between the given shapes in radians.
10967 # @ref tui_angle_page "Example"
10968 @ManageTransactions("MeasuOp")
10969 def GetAngleRadians(self, theShape1, theShape2):
10971 Get angle between the given shapes in radians.
10974 theShape1,theShape2 Lines or linear edges to find angle between.
10978 If both arguments are vectors, the angle is computed in accordance
10979 with their orientations, otherwise the minimum angle is computed.
10982 Value of the angle between the given shapes in radians.
10984 # Example: see GEOM_TestMeasures.py
10985 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
10986 RaiseIfFailed("GetAngle", self.MeasuOp)
10989 ## Get angle between the given vectors in degrees.
10990 # @param theShape1,theShape2 Vectors to find angle between.
10991 # @param theFlag If True, the normal vector is defined by the two vectors cross,
10992 # if False, the opposite vector to the normal vector is used.
10993 # @return Value of the angle between the given vectors in degrees.
10995 # @ref tui_angle_page "Example"
10996 @ManageTransactions("MeasuOp")
10997 def GetAngleVectors(self, theShape1, theShape2, theFlag = True):
10999 Get angle between the given vectors in degrees.
11002 theShape1,theShape2 Vectors to find angle between.
11003 theFlag If True, the normal vector is defined by the two vectors cross,
11004 if False, the opposite vector to the normal vector is used.
11007 Value of the angle between the given vectors in degrees.
11009 anAngle = self.MeasuOp.GetAngleBtwVectors(theShape1, theShape2)
11011 anAngle = 360. - anAngle
11012 RaiseIfFailed("GetAngleVectors", self.MeasuOp)
11015 ## The same as GetAngleVectors, but the result is in radians.
11016 def GetAngleRadiansVectors(self, theShape1, theShape2, theFlag = True):
11018 Get angle between the given vectors in radians.
11021 theShape1,theShape2 Vectors to find angle between.
11022 theFlag If True, the normal vector is defined by the two vectors cross,
11023 if False, the opposite vector to the normal vector is used.
11026 Value of the angle between the given vectors in radians.
11028 anAngle = self.GetAngleVectors(theShape1, theShape2, theFlag)*math.pi/180.
11031 ## @name Curve Curvature Measurement
11032 # Methods for receiving radius of curvature of curves
11033 # in the given point
11036 ## Measure curvature of a curve at a point, set by parameter.
11037 # @param theCurve a curve.
11038 # @param theParam parameter.
11039 # @return radius of curvature of \a theCurve.
11041 # @ref swig_todo "Example"
11042 @ManageTransactions("MeasuOp")
11043 def CurveCurvatureByParam(self, theCurve, theParam):
11045 Measure curvature of a curve at a point, set by parameter.
11049 theParam parameter.
11052 radius of curvature of theCurve.
11054 # Example: see GEOM_TestMeasures.py
11055 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
11056 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
11059 ## Measure curvature of a curve at a point.
11060 # @param theCurve a curve.
11061 # @param thePoint given point.
11062 # @return radius of curvature of \a theCurve.
11064 # @ref swig_todo "Example"
11065 @ManageTransactions("MeasuOp")
11066 def CurveCurvatureByPoint(self, theCurve, thePoint):
11068 Measure curvature of a curve at a point.
11072 thePoint given point.
11075 radius of curvature of theCurve.
11077 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
11078 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
11082 ## @name Surface Curvature Measurement
11083 # Methods for receiving max and min radius of curvature of surfaces
11084 # in the given point
11087 ## Measure max radius of curvature of surface.
11088 # @param theSurf the given surface.
11089 # @param theUParam Value of U-parameter on the referenced surface.
11090 # @param theVParam Value of V-parameter on the referenced surface.
11091 # @return max radius of curvature of theSurf.
11093 ## @ref swig_todo "Example"
11094 @ManageTransactions("MeasuOp")
11095 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
11097 Measure max radius of curvature of surface.
11100 theSurf the given surface.
11101 theUParam Value of U-parameter on the referenced surface.
11102 theVParam Value of V-parameter on the referenced surface.
11105 max radius of curvature of theSurf.
11107 # Example: see GEOM_TestMeasures.py
11108 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
11109 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
11112 ## Measure max radius of curvature of surface in the given point
11113 # @param theSurf the given surface.
11114 # @param thePoint given point.
11115 # @return max radius of curvature of theSurf.
11117 ## @ref swig_todo "Example"
11118 @ManageTransactions("MeasuOp")
11119 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
11121 Measure max radius of curvature of surface in the given point.
11124 theSurf the given surface.
11125 thePoint given point.
11128 max radius of curvature of theSurf.
11130 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
11131 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
11134 ## Measure min radius of curvature of surface.
11135 # @param theSurf the given surface.
11136 # @param theUParam Value of U-parameter on the referenced surface.
11137 # @param theVParam Value of V-parameter on the referenced surface.
11138 # @return min radius of curvature of theSurf.
11140 ## @ref swig_todo "Example"
11141 @ManageTransactions("MeasuOp")
11142 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
11144 Measure min radius of curvature of surface.
11147 theSurf the given surface.
11148 theUParam Value of U-parameter on the referenced surface.
11149 theVParam Value of V-parameter on the referenced surface.
11152 Min radius of curvature of theSurf.
11154 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
11155 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
11158 ## Measure min radius of curvature of surface in the given point
11159 # @param theSurf the given surface.
11160 # @param thePoint given point.
11161 # @return min radius of curvature of theSurf.
11163 ## @ref swig_todo "Example"
11164 @ManageTransactions("MeasuOp")
11165 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
11167 Measure min radius of curvature of surface in the given point.
11170 theSurf the given surface.
11171 thePoint given point.
11174 Min radius of curvature of theSurf.
11176 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
11177 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
11181 ## Measure curvature radius of surface in the given point along the given direction.
11182 # @param theSurf the given face.
11183 # @param thePoint given point.
11184 # @param theDirection given direction.
11185 # @param theName Object name; when specified, this parameter is used
11186 # for result publication in the study. Otherwise, if automatic
11187 # publication is switched on, default value is used for result name.
11189 # @return New GEOM.GEOM_Object, containing vector of curvature of theSurf.
11190 # The returned vector is codirectional with the normal to the face
11191 # in the given point in case of positive curvature value
11192 # and opposite to the normal in case of negative curvature.
11193 # The normal of the returned vector is equal to the
11194 # absolute value of the curvature radius.
11195 # Null shape is returned in case of infinite radius
11196 # (zero curvature), for example, in case of flat face.
11198 ## @ref swig_CurvatureOnFace "Example"
11199 @ManageTransactions("MeasuOp")
11200 def CurvatureOnFace(self, theSurf, thePoint, theDirection, theName=None):
11202 Measure curvature radius of surface in the given point along the given direction.
11205 theSurf the given face.
11206 thePoint given point.
11207 theDirection given direction.
11208 theName Object name; when specified, this parameter is used
11209 for result publication in the study. Otherwise, if automatic
11210 publication is switched on, default value is used for result name.
11213 New GEOM.GEOM_Object, containing vector of curvature of theSurf.
11214 The returned vector is codirectional with the normal to the face
11215 in the given point in case of positive curvature value
11216 and opposite to the normal in case of negative curvature.
11217 The normal of the returned vector is equal to the
11218 absolute value of the curvature radius.
11219 Null shape is returned in case of infinite radius
11220 (zero curvature), for example, in case of flat face.
11223 curvature_1 = geompy.CurvatureOnFace(Face_1, Vertex_1, OX)
11225 aVec = self.MeasuOp.SurfaceCurvatureByPointAndDirection(theSurf,thePoint,theDirection)
11226 if self.MeasuOp.GetErrorCode() != "ZERO_CURVATURE":
11227 RaiseIfFailed("CurvatureOnFace", self.MeasuOp)
11228 self._autoPublish(aVec, theName, "curvature")
11231 ## Get min and max tolerances of sub-shapes of theShape
11232 # @param theShape Shape, to get tolerances of.
11233 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]\n
11234 # FaceMin,FaceMax: Min and max tolerances of the faces.\n
11235 # EdgeMin,EdgeMax: Min and max tolerances of the edges.\n
11236 # VertMin,VertMax: Min and max tolerances of the vertices.
11238 # @ref tui_tolerance_page "Example"
11239 @ManageTransactions("MeasuOp")
11240 def Tolerance(self,theShape):
11242 Get min and max tolerances of sub-shapes of theShape
11245 theShape Shape, to get tolerances of.
11248 [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
11249 FaceMin,FaceMax: Min and max tolerances of the faces.
11250 EdgeMin,EdgeMax: Min and max tolerances of the edges.
11251 VertMin,VertMax: Min and max tolerances of the vertices.
11253 # Example: see GEOM_TestMeasures.py
11254 aTuple = self.MeasuOp.GetTolerance(theShape)
11255 RaiseIfFailed("GetTolerance", self.MeasuOp)
11258 ## Obtain description of the given shape (number of sub-shapes of each type)
11259 # @param theShape Shape to be described.
11260 # @return Description of the given shape.
11262 # @ref tui_whatis_page "Example"
11263 @ManageTransactions("MeasuOp")
11264 def WhatIs(self,theShape):
11266 Obtain description of the given shape (number of sub-shapes of each type)
11269 theShape Shape to be described.
11272 Description of the given shape.
11274 # Example: see GEOM_TestMeasures.py
11275 aDescr = self.MeasuOp.WhatIs(theShape)
11276 RaiseIfFailed("WhatIs", self.MeasuOp)
11279 ## Obtain quantity of shapes of the given type in \a theShape.
11280 # If \a theShape is of type \a theType, it is also counted.
11281 # @param theShape Shape to be described.
11282 # @param theType the given ShapeType().
11283 # @return Quantity of shapes of type \a theType in \a theShape.
11285 # @ref tui_measurement_tools_page "Example"
11286 def NbShapes (self, theShape, theType):
11288 Obtain quantity of shapes of the given type in theShape.
11289 If theShape is of type theType, it is also counted.
11292 theShape Shape to be described.
11293 theType the given geompy.ShapeType
11296 Quantity of shapes of type theType in theShape.
11298 # Example: see GEOM_TestMeasures.py
11299 listSh = self.SubShapeAllIDs(theShape, theType)
11303 ## Obtain quantity of shapes of each type in \a theShape.
11304 # The \a theShape is also counted.
11305 # @param theShape Shape to be described.
11306 # @return Dictionary of ShapeType() with bound quantities of shapes.
11308 # @ref tui_measurement_tools_page "Example"
11309 def ShapeInfo (self, theShape):
11311 Obtain quantity of shapes of each type in theShape.
11312 The theShape is also counted.
11315 theShape Shape to be described.
11318 Dictionary of geompy.ShapeType with bound quantities of shapes.
11320 # Example: see GEOM_TestMeasures.py
11322 for typeSh in self.ShapeType:
11323 if typeSh in ( "AUTO", "SHAPE" ): continue
11324 listSh = self.SubShapeAllIDs(theShape, self.ShapeType[typeSh])
11330 def GetCreationInformation(self, theShape):
11332 infos = theShape.GetCreationInformation()
11335 opName = info.operationName
11336 if not opName: opName = "no info available"
11337 if res: res += "\n"
11338 res += "Operation: " + opName
11340 for parVal in info.params:
11341 res += "\n \t%s = %s" % ( parVal.name, parVal.value )
11344 ## Get a point, situated at the centre of mass of theShape.
11345 # @param theShape Shape to define centre of mass of.
11346 # @param theName Object name; when specified, this parameter is used
11347 # for result publication in the study. Otherwise, if automatic
11348 # publication is switched on, default value is used for result name.
11350 # @return New GEOM.GEOM_Object, containing the created point.
11352 # @ref tui_center_of_mass_page "Example"
11353 @ManageTransactions("MeasuOp")
11354 def MakeCDG(self, theShape, theName=None):
11356 Get a point, situated at the centre of mass of theShape.
11359 theShape Shape to define centre of mass of.
11360 theName Object name; when specified, this parameter is used
11361 for result publication in the study. Otherwise, if automatic
11362 publication is switched on, default value is used for result name.
11365 New GEOM.GEOM_Object, containing the created point.
11367 # Example: see GEOM_TestMeasures.py
11368 anObj = self.MeasuOp.GetCentreOfMass(theShape)
11369 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
11370 self._autoPublish(anObj, theName, "centerOfMass")
11373 ## Get a vertex sub-shape by index.
11374 # @param theShape Shape to find sub-shape.
11375 # @param theIndex Index to find vertex by this index (starting from zero)
11376 # @param theUseOri To consider edge/wire orientation or not
11377 # @param theName Object name; when specified, this parameter is used
11378 # for result publication in the study. Otherwise, if automatic
11379 # publication is switched on, default value is used for result name.
11381 # @return New GEOM.GEOM_Object, containing the created vertex.
11383 # @ref tui_measurement_tools_page "Example"
11384 @ManageTransactions("MeasuOp")
11385 def GetVertexByIndex(self, theShape, theIndex, theUseOri=True, theName=None):
11387 Get a vertex sub-shape by index.
11390 theShape Shape to find sub-shape.
11391 theIndex Index to find vertex by this index (starting from zero)
11392 theUseOri To consider edge/wire orientation or not
11393 theName Object name; when specified, this parameter is used
11394 for result publication in the study. Otherwise, if automatic
11395 publication is switched on, default value is used for result name.
11398 New GEOM.GEOM_Object, containing the created vertex.
11400 # Example: see GEOM_TestMeasures.py
11401 if isinstance( theUseOri, str ): # theUseOri was inserted before theName
11402 theUseOri, theName = True, theUseOri
11403 anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex, theUseOri)
11404 RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
11405 self._autoPublish(anObj, theName, "vertex")
11408 ## Get the first vertex of wire/edge depended orientation.
11409 # @param theShape Shape to find first vertex.
11410 # @param theName Object name; when specified, this parameter is used
11411 # for result publication in the study. Otherwise, if automatic
11412 # publication is switched on, default value is used for result name.
11414 # @return New GEOM.GEOM_Object, containing the created vertex.
11416 # @ref tui_measurement_tools_page "Example"
11417 def GetFirstVertex(self, theShape, theName=None):
11419 Get the first vertex of wire/edge depended orientation.
11422 theShape Shape to find first vertex.
11423 theName Object name; when specified, this parameter is used
11424 for result publication in the study. Otherwise, if automatic
11425 publication is switched on, default value is used for result name.
11428 New GEOM.GEOM_Object, containing the created vertex.
11430 # Example: see GEOM_TestMeasures.py
11431 # note: auto-publishing is done in self.GetVertexByIndex()
11432 return self.GetVertexByIndex(theShape, 0, True, theName)
11434 ## Get the last vertex of wire/edge depended orientation.
11435 # @param theShape Shape to find last vertex.
11436 # @param theName Object name; when specified, this parameter is used
11437 # for result publication in the study. Otherwise, if automatic
11438 # publication is switched on, default value is used for result name.
11440 # @return New GEOM.GEOM_Object, containing the created vertex.
11442 # @ref tui_measurement_tools_page "Example"
11443 def GetLastVertex(self, theShape, theName=None):
11445 Get the last vertex of wire/edge depended orientation.
11448 theShape Shape to find last vertex.
11449 theName Object name; when specified, this parameter is used
11450 for result publication in the study. Otherwise, if automatic
11451 publication is switched on, default value is used for result name.
11454 New GEOM.GEOM_Object, containing the created vertex.
11456 # Example: see GEOM_TestMeasures.py
11457 nb_vert = self.NumberOfSubShapes(theShape, self.ShapeType["VERTEX"])
11458 # note: auto-publishing is done in self.GetVertexByIndex()
11459 return self.GetVertexByIndex(theShape, (nb_vert-1), True, theName)
11461 ## Get a normale to the given face. If the point is not given,
11462 # the normale is calculated at the center of mass.
11463 # @param theFace Face to define normale of.
11464 # @param theOptionalPoint Point to compute the normale at.
11465 # @param theName Object name; when specified, this parameter is used
11466 # for result publication in the study. Otherwise, if automatic
11467 # publication is switched on, default value is used for result name.
11469 # @return New GEOM.GEOM_Object, containing the created vector.
11471 # @ref swig_todo "Example"
11472 @ManageTransactions("MeasuOp")
11473 def GetNormal(self, theFace, theOptionalPoint = None, theName=None):
11475 Get a normale to the given face. If the point is not given,
11476 the normale is calculated at the center of mass.
11479 theFace Face to define normale of.
11480 theOptionalPoint Point to compute the normale at.
11481 theName Object name; when specified, this parameter is used
11482 for result publication in the study. Otherwise, if automatic
11483 publication is switched on, default value is used for result name.
11486 New GEOM.GEOM_Object, containing the created vector.
11488 # Example: see GEOM_TestMeasures.py
11489 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
11490 RaiseIfFailed("GetNormal", self.MeasuOp)
11491 self._autoPublish(anObj, theName, "normal")
11494 ## Print shape errors obtained from CheckShape.
11495 # @param theShape Shape that was checked.
11496 # @param theShapeErrors the shape errors obtained by CheckShape.
11497 # @param theReturnStatus If 0 the description of problem is printed.
11498 # If 1 the description of problem is returned.
11499 # @return If theReturnStatus is equal to 1 the description is returned.
11500 # Otherwise doesn't return anything.
11502 # @ref tui_check_shape_page "Example"
11503 @ManageTransactions("MeasuOp")
11504 def PrintShapeErrors(self, theShape, theShapeErrors, theReturnStatus = 0):
11506 Print shape errors obtained from CheckShape.
11509 theShape Shape that was checked.
11510 theShapeErrors the shape errors obtained by CheckShape.
11511 theReturnStatus If 0 the description of problem is printed.
11512 If 1 the description of problem is returned.
11515 If theReturnStatus is equal to 1 the description is returned.
11516 Otherwise doesn't return anything.
11518 # Example: see GEOM_TestMeasures.py
11519 Descr = self.MeasuOp.PrintShapeErrors(theShape, theShapeErrors)
11520 if theReturnStatus == 1:
11525 ## Check a topology of the given shape.
11526 # @param theShape Shape to check validity of.
11527 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked, \n
11528 # if TRUE, the shape's geometry will be checked also.
11529 # @param theReturnStatus If 0 and if theShape is invalid, a description
11530 # of problem is printed.
11531 # If 1 isValid flag and the description of
11532 # problem is returned.
11533 # If 2 isValid flag and the list of error data
11535 # @return TRUE, if the shape "seems to be valid".
11536 # If theShape is invalid, prints a description of problem.
11537 # If theReturnStatus is equal to 1 the description is returned
11538 # along with IsValid flag.
11539 # If theReturnStatus is equal to 2 the list of error data is
11540 # returned along with IsValid flag.
11542 # @ref tui_check_shape_page "Example"
11543 @ManageTransactions("MeasuOp")
11544 def CheckShape(self,theShape, theIsCheckGeom = 0, theReturnStatus = 0):
11546 Check a topology of the given shape.
11549 theShape Shape to check validity of.
11550 theIsCheckGeom If FALSE, only the shape's topology will be checked,
11551 if TRUE, the shape's geometry will be checked also.
11552 theReturnStatus If 0 and if theShape is invalid, a description
11553 of problem is printed.
11554 If 1 IsValid flag and the description of
11555 problem is returned.
11556 If 2 IsValid flag and the list of error data
11560 TRUE, if the shape "seems to be valid".
11561 If theShape is invalid, prints a description of problem.
11562 If theReturnStatus is equal to 1 the description is returned
11563 along with IsValid flag.
11564 If theReturnStatus is equal to 2 the list of error data is
11565 returned along with IsValid flag.
11567 # Example: see GEOM_TestMeasures.py
11569 (IsValid, ShapeErrors) = self.MeasuOp.CheckShapeWithGeometry(theShape)
11570 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
11572 (IsValid, ShapeErrors) = self.MeasuOp.CheckShape(theShape)
11573 RaiseIfFailed("CheckShape", self.MeasuOp)
11575 if theReturnStatus == 0:
11576 Descr = self.MeasuOp.PrintShapeErrors(theShape, ShapeErrors)
11578 if theReturnStatus == 1:
11579 Descr = self.MeasuOp.PrintShapeErrors(theShape, ShapeErrors)
11580 return (IsValid, Descr)
11581 elif theReturnStatus == 2:
11582 return (IsValid, ShapeErrors)
11585 ## Detect self-intersections in the given shape.
11586 # @param theShape Shape to check.
11587 # @param theCheckLevel is the level of self-intersection check.
11588 # Possible input values are:
11589 # - GEOM.SI_V_V(0) - only V/V interferences
11590 # - GEOM.SI_V_E(1) - V/V and V/E interferences
11591 # - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
11592 # - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
11593 # - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
11594 # - GEOM.SI_ALL(5) - all interferences.
11595 # @return TRUE, if the shape contains no self-intersections.
11597 # @ref tui_check_self_intersections_page "Example"
11598 @ManageTransactions("MeasuOp")
11599 def CheckSelfIntersections(self, theShape, theCheckLevel = GEOM.SI_ALL):
11601 Detect self-intersections in the given shape.
11604 theShape Shape to check.
11605 theCheckLevel is the level of self-intersection check.
11606 Possible input values are:
11607 - GEOM.SI_V_V(0) - only V/V interferences
11608 - GEOM.SI_V_E(1) - V/V and V/E interferences
11609 - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
11610 - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
11611 - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
11612 - GEOM.SI_ALL(5) - all interferences.
11615 TRUE, if the shape contains no self-intersections.
11617 # Example: see GEOM_TestMeasures.py
11618 (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape, EnumToLong(theCheckLevel))
11619 RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
11622 ## Detect self-intersections of the given shape with algorithm based on mesh intersections.
11623 # @param theShape Shape to check.
11624 # @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
11625 # - if \a theDeflection <= 0, default deflection 0.001 is used
11626 # @param theTolerance Specifies a distance between sub-shapes used for detecting gaps:
11627 # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
11628 # - if \a theTolerance > 0, algorithm detects gaps
11629 # @return TRUE, if the shape contains no self-intersections.
11631 # @ref tui_check_self_intersections_fast_page "Example"
11632 @ManageTransactions("MeasuOp")
11633 def CheckSelfIntersectionsFast(self, theShape, theDeflection = 0.001, theTolerance = 0.0):
11635 Detect self-intersections of the given shape with algorithm based on mesh intersections.
11638 theShape Shape to check.
11639 theDeflection Linear deflection coefficient that specifies quality of tessellation:
11640 - if theDeflection <= 0, default deflection 0.001 is used
11641 theTolerance Specifies a distance between shapes used for detecting gaps:
11642 - if theTolerance <= 0, algorithm detects intersections (default behavior)
11643 - if theTolerance > 0, algorithm detects gaps
11646 TRUE, if the shape contains no self-intersections.
11648 # Example: see GEOM_TestMeasures.py
11649 (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance)
11650 RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
11653 ## Check boolean and partition operations arguments.
11654 # @param theShape the argument of an operation to be checked
11655 # @return TRUE if the argument is valid for a boolean or partition
11656 # operation; FALSE otherwise.
11657 @ManageTransactions("MeasuOp")
11658 def CheckBOPArguments(self, theShape):
11660 Check boolean and partition operations arguments.
11663 theShape the argument of an operation to be checked
11666 TRUE if the argument is valid for a boolean or partition
11667 operation; FALSE otherwise.
11669 return self.MeasuOp.CheckBOPArguments(theShape)
11671 ## Detect intersections of the given shapes with algorithm based on mesh intersections.
11672 # @param theShape1 First source object
11673 # @param theShape2 Second source object
11674 # @param theTolerance Specifies a distance between shapes used for detecting gaps:
11675 # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
11676 # - if \a theTolerance > 0, algorithm detects gaps
11677 # @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
11678 # - if \a theDeflection <= 0, default deflection 0.001 is used
11679 # @return TRUE, if there are intersections (gaps) between source shapes
11680 # @return List of sub-shapes IDs from 1st shape that localize intersection.
11681 # @return List of sub-shapes IDs from 2nd shape that localize intersection.
11683 # @ref tui_fast_intersection_page "Example"
11684 @ManageTransactions("MeasuOp")
11685 def FastIntersect(self, theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001):
11687 Detect intersections of the given shapes with algorithm based on mesh intersections.
11690 theShape1 First source object
11691 theShape2 Second source object
11692 theTolerance Specifies a distance between shapes used for detecting gaps:
11693 - if theTolerance <= 0, algorithm detects intersections (default behavior)
11694 - if theTolerance > 0, algorithm detects gaps
11695 theDeflection Linear deflection coefficient that specifies quality of tessellation:
11696 - if theDeflection <= 0, default deflection 0.001 is used
11699 TRUE, if there are intersections (gaps) between source shapes
11700 List of sub-shapes IDs from 1st shape that localize intersection.
11701 List of sub-shapes IDs from 2nd shape that localize intersection.
11703 # Example: see GEOM_TestMeasures.py
11704 IsOk, Res1, Res2 = self.MeasuOp.FastIntersect(theShape1, theShape2, theTolerance, theDeflection)
11705 RaiseIfFailed("FastIntersect", self.MeasuOp)
11706 return IsOk, Res1, Res2
11708 ## Get position (LCS) of theShape.
11710 # Origin of the LCS is situated at the shape's center of mass.
11711 # Axes of the LCS are obtained from shape's location or,
11712 # if the shape is a planar face, from position of its plane.
11714 # @param theShape Shape to calculate position of.
11715 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
11716 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
11717 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
11718 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
11720 # @ref swig_todo "Example"
11721 @ManageTransactions("MeasuOp")
11722 def GetPosition(self,theShape):
11724 Get position (LCS) of theShape.
11725 Origin of the LCS is situated at the shape's center of mass.
11726 Axes of the LCS are obtained from shape's location or,
11727 if the shape is a planar face, from position of its plane.
11730 theShape Shape to calculate position of.
11733 [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
11734 Ox,Oy,Oz: Coordinates of shape's LCS origin.
11735 Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
11736 Xx,Xy,Xz: Coordinates of shape's LCS X direction.
11738 # Example: see GEOM_TestMeasures.py
11739 aTuple = self.MeasuOp.GetPosition(theShape)
11740 RaiseIfFailed("GetPosition", self.MeasuOp)
11743 ## Get kind of theShape.
11745 # @param theShape Shape to get a kind of.
11746 # @return Returns a kind of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
11747 # and a list of parameters, describing the shape.
11748 # @note Concrete meaning of each value, returned via \a theIntegers
11749 # or \a theDoubles list depends on the kind() of the shape.
11751 # @ref swig_todo "Example"
11752 @ManageTransactions("MeasuOp")
11753 def KindOfShape(self,theShape):
11755 Get kind of theShape.
11758 theShape Shape to get a kind of.
11761 a kind of shape in terms of GEOM_IKindOfShape.shape_kind enumeration
11762 and a list of parameters, describing the shape.
11764 Concrete meaning of each value, returned via theIntegers
11765 or theDoubles list depends on the geompy.kind of the shape
11767 # Example: see GEOM_TestMeasures.py
11768 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
11769 RaiseIfFailed("KindOfShape", self.MeasuOp)
11771 aKind = aRoughTuple[0]
11772 anInts = aRoughTuple[1]
11773 aDbls = aRoughTuple[2]
11775 # Now there is no exception from this rule:
11776 aKindTuple = [aKind] + aDbls + anInts
11778 # If they are we will regroup parameters for such kind of shape.
11780 #if aKind == kind.SOME_KIND:
11781 # # SOME_KIND int int double int double double
11782 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
11786 ## Returns the string that describes if the shell is good for solid.
11787 # This is a support method for MakeSolid.
11789 # @param theShell the shell to be checked.
11790 # @return Returns a string that describes the shell validity for
11791 # solid construction.
11792 @ManageTransactions("MeasuOp")
11793 def _IsGoodForSolid(self, theShell):
11795 Returns the string that describes if the shell is good for solid.
11796 This is a support method for MakeSolid.
11799 theShell the shell to be checked.
11802 Returns a string that describes the shell validity for
11803 solid construction.
11805 aDescr = self.MeasuOp.IsGoodForSolid(theShell)
11808 # end of l2_measure
11811 ## @addtogroup l2_import_export
11814 ## Import a shape from the BREP, IGES, STEP or other file
11815 # (depends on given format) with given name.
11817 # Note: this function is deprecated, it is kept for backward compatibility only
11818 # Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
11820 # @param theFileName The file, containing the shape.
11821 # @param theFormatName Specify format for the file reading.
11822 # Available formats can be obtained with InsertOp.ImportTranslators() method.
11823 # If format 'IGES_SCALE' is used instead of 'IGES' or
11824 # format 'STEP_SCALE' is used instead of 'STEP',
11825 # length unit will be set to 'meter' and result model will be scaled.
11826 # @param theName Object name; when specified, this parameter is used
11827 # for result publication in the study. Otherwise, if automatic
11828 # publication is switched on, default value is used for result name.
11830 # @return New GEOM.GEOM_Object, containing the imported shape.
11831 # If material names are imported it returns the list of
11832 # objects. The first one is the imported object followed by
11834 # @note Auto publishing is allowed for the shape itself. Imported
11835 # material groups are not automatically published.
11837 # @ref swig_Import_Export "Example"
11838 @ManageTransactions("InsertOp")
11839 def ImportFile(self, theFileName, theFormatName, theName=None):
11841 Import a shape from the BREP, IGES, STEP or other file
11842 (depends on given format) with given name.
11844 Note: this function is deprecated, it is kept for backward compatibility only
11845 Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
11848 theFileName The file, containing the shape.
11849 theFormatName Specify format for the file reading.
11850 Available formats can be obtained with geompy.InsertOp.ImportTranslators() method.
11851 If format 'IGES_SCALE' is used instead of 'IGES' or
11852 format 'STEP_SCALE' is used instead of 'STEP',
11853 length unit will be set to 'meter' and result model will be scaled.
11854 theName Object name; when specified, this parameter is used
11855 for result publication in the study. Otherwise, if automatic
11856 publication is switched on, default value is used for result name.
11859 New GEOM.GEOM_Object, containing the imported shape.
11860 If material names are imported it returns the list of
11861 objects. The first one is the imported object followed by
11864 Auto publishing is allowed for the shape itself. Imported
11865 material groups are not automatically published.
11867 # Example: see GEOM_TestOthers.py
11869 WARNING: Function ImportFile is deprecated, use Import<FormatName> instead,
11870 where <FormatName> is a name of desirable format for importing.
11872 aListObj = self.InsertOp.ImportFile(theFileName, theFormatName)
11873 RaiseIfFailed("ImportFile", self.InsertOp)
11874 aNbObj = len(aListObj)
11876 self._autoPublish(aListObj[0], theName, "imported")
11881 ## Deprecated analog of ImportFile()
11882 def Import(self, theFileName, theFormatName, theName=None):
11884 Deprecated analog of geompy.ImportFile, kept for backward compatibility only.
11886 # note: auto-publishing is done in self.ImportFile()
11887 return self.ImportFile(theFileName, theFormatName, theName)
11889 ## Read a shape from the binary stream, containing its bounding representation (BRep).
11891 # @note As the byte-stream representing the shape data can be quite large, this method
11892 # is not automatically dumped to the Python script with the DumpStudy functionality;
11893 # so please use this method carefully, only for strong reasons.
11895 # @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's
11898 # @param theStream The BRep binary stream.
11899 # @param theName Object name; when specified, this parameter is used
11900 # for result publication in the study. Otherwise, if automatic
11901 # publication is switched on, default value is used for result name.
11903 # @return New GEOM_Object, containing the shape, read from theStream.
11905 # @ref swig_Import_Export "Example"
11906 @ManageTransactions("InsertOp")
11907 def RestoreShape (self, theStream, theName=None):
11909 Read a shape from the binary stream, containing its bounding representation (BRep).
11912 shape.GetShapeStream() method can be used to obtain the shape's BRep stream.
11915 theStream The BRep binary stream.
11916 theName Object name; when specified, this parameter is used
11917 for result publication in the study. Otherwise, if automatic
11918 publication is switched on, default value is used for result name.
11921 New GEOM_Object, containing the shape, read from theStream.
11923 # Example: see GEOM_TestOthers.py
11925 # this is the workaround to ignore invalid case when data stream is empty
11926 if int(os.getenv("GEOM_IGNORE_RESTORE_SHAPE", "0")) > 0:
11927 print("WARNING: Result of RestoreShape is a NULL shape!")
11929 anObj = self.InsertOp.RestoreShape(theStream)
11930 RaiseIfFailed("RestoreShape", self.InsertOp)
11931 self._autoPublish(anObj, theName, "restored")
11934 ## Export the given shape into a file with given name.
11936 # Note: this function is deprecated, it is kept for backward compatibility only
11937 # Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
11939 # @param theObject Shape to be stored in the file.
11940 # @param theFileName Name of the file to store the given shape in.
11941 # @param theFormatName Specify format for the shape storage.
11942 # Available formats can be obtained with
11943 # geompy.InsertOp.ExportTranslators()[0] method.
11945 # @ref swig_Import_Export "Example"
11946 @ManageTransactions("InsertOp")
11947 def Export(self, theObject, theFileName, theFormatName):
11949 Export the given shape into a file with given name.
11951 Note: this function is deprecated, it is kept for backward compatibility only
11952 Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
11955 theObject Shape to be stored in the file.
11956 theFileName Name of the file to store the given shape in.
11957 theFormatName Specify format for the shape storage.
11958 Available formats can be obtained with
11959 geompy.InsertOp.ExportTranslators()[0] method.
11961 # Example: see GEOM_TestOthers.py
11963 WARNING: Function Export is deprecated, use Export<FormatName> instead,
11964 where <FormatName> is a name of desirable format for exporting.
11966 self.InsertOp.Export(theObject, theFileName, theFormatName)
11967 if self.InsertOp.IsDone() == 0:
11968 raise RuntimeError("Export : " + self.InsertOp.GetErrorCode())
11972 # end of l2_import_export
11975 ## @addtogroup l3_blocks
11978 ## Create a quadrangle face from four edges. Order of Edges is not
11979 # important. It is not necessary that edges share the same vertex.
11980 # @param E1,E2,E3,E4 Edges for the face bound.
11981 # @param theName Object name; when specified, this parameter is used
11982 # for result publication in the study. Otherwise, if automatic
11983 # publication is switched on, default value is used for result name.
11985 # @return New GEOM.GEOM_Object, containing the created face.
11987 # @ref tui_building_by_blocks_page "Example"
11988 @ManageTransactions("BlocksOp")
11989 def MakeQuad(self, E1, E2, E3, E4, theName=None):
11991 Create a quadrangle face from four edges. Order of Edges is not
11992 important. It is not necessary that edges share the same vertex.
11995 E1,E2,E3,E4 Edges for the face bound.
11996 theName Object name; when specified, this parameter is used
11997 for result publication in the study. Otherwise, if automatic
11998 publication is switched on, default value is used for result name.
12001 New GEOM.GEOM_Object, containing the created face.
12004 qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
12006 # Example: see GEOM_Spanner.py
12007 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
12008 RaiseIfFailed("MakeQuad", self.BlocksOp)
12009 self._autoPublish(anObj, theName, "quad")
12012 ## Create a quadrangle face on two edges.
12013 # The missing edges will be built by creating the shortest ones.
12014 # @param E1,E2 Two opposite edges for the face.
12015 # @param theName Object name; when specified, this parameter is used
12016 # for result publication in the study. Otherwise, if automatic
12017 # publication is switched on, default value is used for result name.
12019 # @return New GEOM.GEOM_Object, containing the created face.
12021 # @ref tui_building_by_blocks_page "Example"
12022 @ManageTransactions("BlocksOp")
12023 def MakeQuad2Edges(self, E1, E2, theName=None):
12025 Create a quadrangle face on two edges.
12026 The missing edges will be built by creating the shortest ones.
12029 E1,E2 Two opposite edges for the face.
12030 theName Object name; when specified, this parameter is used
12031 for result publication in the study. Otherwise, if automatic
12032 publication is switched on, default value is used for result name.
12035 New GEOM.GEOM_Object, containing the created face.
12039 p1 = geompy.MakeVertex( 0., 0., 0.)
12040 p2 = geompy.MakeVertex(150., 30., 0.)
12041 p3 = geompy.MakeVertex( 0., 120., 50.)
12042 p4 = geompy.MakeVertex( 0., 40., 70.)
12044 edge1 = geompy.MakeEdge(p1, p2)
12045 edge2 = geompy.MakeEdge(p3, p4)
12046 # create a quadrangle face from two edges
12047 qface2 = geompy.MakeQuad2Edges(edge1, edge2)
12049 # Example: see GEOM_Spanner.py
12050 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
12051 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
12052 self._autoPublish(anObj, theName, "quad")
12055 ## Create a quadrangle face with specified corners.
12056 # The missing edges will be built by creating the shortest ones.
12057 # @param V1,V2,V3,V4 Corner vertices for the face.
12058 # @param theName Object name; when specified, this parameter is used
12059 # for result publication in the study. Otherwise, if automatic
12060 # publication is switched on, default value is used for result name.
12062 # @return New GEOM.GEOM_Object, containing the created face.
12064 # @ref tui_building_by_blocks_page "Example 1"
12065 # \n @ref swig_MakeQuad4Vertices "Example 2"
12066 @ManageTransactions("BlocksOp")
12067 def MakeQuad4Vertices(self, V1, V2, V3, V4, theName=None):
12069 Create a quadrangle face with specified corners.
12070 The missing edges will be built by creating the shortest ones.
12073 V1,V2,V3,V4 Corner vertices for the face.
12074 theName Object name; when specified, this parameter is used
12075 for result publication in the study. Otherwise, if automatic
12076 publication is switched on, default value is used for result name.
12079 New GEOM.GEOM_Object, containing the created face.
12083 p1 = geompy.MakeVertex( 0., 0., 0.)
12084 p2 = geompy.MakeVertex(150., 30., 0.)
12085 p3 = geompy.MakeVertex( 0., 120., 50.)
12086 p4 = geompy.MakeVertex( 0., 40., 70.)
12087 # create a quadrangle from four points in its corners
12088 qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
12090 # Example: see GEOM_Spanner.py
12091 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
12092 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
12093 self._autoPublish(anObj, theName, "quad")
12096 ## Create a hexahedral solid, bounded by the six given faces. Order of
12097 # faces is not important. It is not necessary that Faces share the same edge.
12098 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
12099 # @param theName Object name; when specified, this parameter is used
12100 # for result publication in the study. Otherwise, if automatic
12101 # publication is switched on, default value is used for result name.
12103 # @return New GEOM.GEOM_Object, containing the created solid.
12105 # @ref tui_building_by_blocks_page "Example 1"
12106 # \n @ref swig_MakeHexa "Example 2"
12107 @ManageTransactions("BlocksOp")
12108 def MakeHexa(self, F1, F2, F3, F4, F5, F6, theName=None):
12110 Create a hexahedral solid, bounded by the six given faces. Order of
12111 faces is not important. It is not necessary that Faces share the same edge.
12114 F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
12115 theName Object name; when specified, this parameter is used
12116 for result publication in the study. Otherwise, if automatic
12117 publication is switched on, default value is used for result name.
12120 New GEOM.GEOM_Object, containing the created solid.
12123 solid = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
12125 # Example: see GEOM_Spanner.py
12126 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
12127 RaiseIfFailed("MakeHexa", self.BlocksOp)
12128 self._autoPublish(anObj, theName, "hexa")
12131 ## Create a hexahedral solid between two given faces.
12132 # The missing faces will be built by creating the smallest ones.
12133 # @param F1,F2 Two opposite faces for the hexahedral solid.
12134 # @param theName Object name; when specified, this parameter is used
12135 # for result publication in the study. Otherwise, if automatic
12136 # publication is switched on, default value is used for result name.
12138 # @return New GEOM.GEOM_Object, containing the created solid.
12140 # @ref tui_building_by_blocks_page "Example 1"
12141 # \n @ref swig_MakeHexa2Faces "Example 2"
12142 @ManageTransactions("BlocksOp")
12143 def MakeHexa2Faces(self, F1, F2, theName=None):
12145 Create a hexahedral solid between two given faces.
12146 The missing faces will be built by creating the smallest ones.
12149 F1,F2 Two opposite faces for the hexahedral solid.
12150 theName Object name; when specified, this parameter is used
12151 for result publication in the study. Otherwise, if automatic
12152 publication is switched on, default value is used for result name.
12155 New GEOM.GEOM_Object, containing the created solid.
12158 solid1 = geompy.MakeHexa2Faces(qface1, qface2)
12160 # Example: see GEOM_Spanner.py
12161 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
12162 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
12163 self._autoPublish(anObj, theName, "hexa")
12169 ## @addtogroup l3_blocks_op
12172 ## Get a vertex, found in the given shape by its coordinates.
12173 # @param theShape Block or a compound of blocks.
12174 # @param theX,theY,theZ Coordinates of the sought vertex.
12175 # @param theEpsilon Maximum allowed distance between the resulting
12176 # vertex and point with the given coordinates.
12177 # @param theName Object name; when specified, this parameter is used
12178 # for result publication in the study. Otherwise, if automatic
12179 # publication is switched on, default value is used for result name.
12181 # @return New GEOM.GEOM_Object, containing the found vertex.
12183 # @ref swig_GetPoint "Example"
12184 @ManageTransactions("BlocksOp")
12185 def GetPoint(self, theShape, theX, theY, theZ, theEpsilon, theName=None):
12187 Get a vertex, found in the given shape by its coordinates.
12190 theShape Block or a compound of blocks.
12191 theX,theY,theZ Coordinates of the sought vertex.
12192 theEpsilon Maximum allowed distance between the resulting
12193 vertex and point with the given coordinates.
12194 theName Object name; when specified, this parameter is used
12195 for result publication in the study. Otherwise, if automatic
12196 publication is switched on, default value is used for result name.
12199 New GEOM.GEOM_Object, containing the found vertex.
12202 pnt = geompy.GetPoint(shape, -50, 50, 50, 0.01)
12204 # Example: see GEOM_TestOthers.py
12205 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
12206 RaiseIfFailed("GetPoint", self.BlocksOp)
12207 self._autoPublish(anObj, theName, "vertex")
12210 ## Find a vertex of the given shape, which has minimal distance to the given point.
12211 # @param theShape Any shape.
12212 # @param thePoint Point, close to the desired vertex.
12213 # @param theName Object name; when specified, this parameter is used
12214 # for result publication in the study. Otherwise, if automatic
12215 # publication is switched on, default value is used for result name.
12217 # @return New GEOM.GEOM_Object, containing the found vertex.
12219 # @ref swig_GetVertexNearPoint "Example"
12220 @ManageTransactions("BlocksOp")
12221 def GetVertexNearPoint(self, theShape, thePoint, theName=None):
12223 Find a vertex of the given shape, which has minimal distance to the given point.
12226 theShape Any shape.
12227 thePoint Point, close to the desired vertex.
12228 theName Object name; when specified, this parameter is used
12229 for result publication in the study. Otherwise, if automatic
12230 publication is switched on, default value is used for result name.
12233 New GEOM.GEOM_Object, containing the found vertex.
12236 pmidle = geompy.MakeVertex(50, 0, 50)
12237 edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
12239 # Example: see GEOM_TestOthers.py
12240 anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
12241 RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
12242 self._autoPublish(anObj, theName, "vertex")
12245 ## Get an edge, found in the given shape by two given vertices.
12246 # @param theShape Block or a compound of blocks.
12247 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
12248 # @param theName Object name; when specified, this parameter is used
12249 # for result publication in the study. Otherwise, if automatic
12250 # publication is switched on, default value is used for result name.
12252 # @return New GEOM.GEOM_Object, containing the found edge.
12254 # @ref swig_GetEdge "Example"
12255 @ManageTransactions("BlocksOp")
12256 def GetEdge(self, theShape, thePoint1, thePoint2, theName=None):
12258 Get an edge, found in the given shape by two given vertices.
12261 theShape Block or a compound of blocks.
12262 thePoint1,thePoint2 Points, close to the ends of the desired edge.
12263 theName Object name; when specified, this parameter is used
12264 for result publication in the study. Otherwise, if automatic
12265 publication is switched on, default value is used for result name.
12268 New GEOM.GEOM_Object, containing the found edge.
12270 # Example: see GEOM_Spanner.py
12271 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
12272 RaiseIfFailed("GetEdge", self.BlocksOp)
12273 self._autoPublish(anObj, theName, "edge")
12276 ## Find an edge of the given shape, which has minimal distance to the given point.
12277 # @param theShape Block or a compound of blocks.
12278 # @param thePoint Point, close to the desired edge.
12279 # @param theName Object name; when specified, this parameter is used
12280 # for result publication in the study. Otherwise, if automatic
12281 # publication is switched on, default value is used for result name.
12283 # @return New GEOM.GEOM_Object, containing the found edge.
12285 # @ref swig_GetEdgeNearPoint "Example"
12286 @ManageTransactions("BlocksOp")
12287 def GetEdgeNearPoint(self, theShape, thePoint, theName=None):
12289 Find an edge of the given shape, which has minimal distance to the given point.
12292 theShape Block or a compound of blocks.
12293 thePoint Point, close to the desired edge.
12294 theName Object name; when specified, this parameter is used
12295 for result publication in the study. Otherwise, if automatic
12296 publication is switched on, default value is used for result name.
12299 New GEOM.GEOM_Object, containing the found edge.
12301 # Example: see GEOM_TestOthers.py
12302 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
12303 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
12304 self._autoPublish(anObj, theName, "edge")
12307 ## Returns a face, found in the given shape by four given corner vertices.
12308 # @param theShape Block or a compound of blocks.
12309 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
12310 # @param theName Object name; when specified, this parameter is used
12311 # for result publication in the study. Otherwise, if automatic
12312 # publication is switched on, default value is used for result name.
12314 # @return New GEOM.GEOM_Object, containing the found face.
12316 # @ref swig_todo "Example"
12317 @ManageTransactions("BlocksOp")
12318 def GetFaceByPoints(self, theShape, thePoint1, thePoint2, thePoint3, thePoint4, theName=None):
12320 Returns a face, found in the given shape by four given corner vertices.
12323 theShape Block or a compound of blocks.
12324 thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
12325 theName Object name; when specified, this parameter is used
12326 for result publication in the study. Otherwise, if automatic
12327 publication is switched on, default value is used for result name.
12330 New GEOM.GEOM_Object, containing the found face.
12332 # Example: see GEOM_Spanner.py
12333 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
12334 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
12335 self._autoPublish(anObj, theName, "face")
12338 ## Get a face of block, found in the given shape by two given edges.
12339 # @param theShape Block or a compound of blocks.
12340 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
12341 # @param theName Object name; when specified, this parameter is used
12342 # for result publication in the study. Otherwise, if automatic
12343 # publication is switched on, default value is used for result name.
12345 # @return New GEOM.GEOM_Object, containing the found face.
12347 # @ref swig_todo "Example"
12348 @ManageTransactions("BlocksOp")
12349 def GetFaceByEdges(self, theShape, theEdge1, theEdge2, theName=None):
12351 Get a face of block, found in the given shape by two given edges.
12354 theShape Block or a compound of blocks.
12355 theEdge1,theEdge2 Edges, close to the edges of the desired face.
12356 theName Object name; when specified, this parameter is used
12357 for result publication in the study. Otherwise, if automatic
12358 publication is switched on, default value is used for result name.
12361 New GEOM.GEOM_Object, containing the found face.
12363 # Example: see GEOM_Spanner.py
12364 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
12365 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
12366 self._autoPublish(anObj, theName, "face")
12369 ## Find a face, opposite to the given one in the given block.
12370 # @param theBlock Must be a hexahedral solid.
12371 # @param theFace Face of \a theBlock, opposite to the desired face.
12372 # @param theName Object name; when specified, this parameter is used
12373 # for result publication in the study. Otherwise, if automatic
12374 # publication is switched on, default value is used for result name.
12376 # @return New GEOM.GEOM_Object, containing the found face.
12378 # @ref swig_GetOppositeFace "Example"
12379 @ManageTransactions("BlocksOp")
12380 def GetOppositeFace(self, theBlock, theFace, theName=None):
12382 Find a face, opposite to the given one in the given block.
12385 theBlock Must be a hexahedral solid.
12386 theFace Face of theBlock, opposite to the desired face.
12387 theName Object name; when specified, this parameter is used
12388 for result publication in the study. Otherwise, if automatic
12389 publication is switched on, default value is used for result name.
12392 New GEOM.GEOM_Object, containing the found face.
12394 # Example: see GEOM_Spanner.py
12395 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
12396 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
12397 self._autoPublish(anObj, theName, "face")
12400 ## Find a face of the given shape, which has minimal distance to the given point.
12401 # @param theShape Block or a compound of blocks.
12402 # @param thePoint Point, close to the desired face.
12403 # @param theName Object name; when specified, this parameter is used
12404 # for result publication in the study. Otherwise, if automatic
12405 # publication is switched on, default value is used for result name.
12407 # @return New GEOM.GEOM_Object, containing the found face.
12409 # @ref swig_GetFaceNearPoint "Example"
12410 @ManageTransactions("BlocksOp")
12411 def GetFaceNearPoint(self, theShape, thePoint, theName=None):
12413 Find a face of the given shape, which has minimal distance to the given point.
12416 theShape Block or a compound of blocks.
12417 thePoint Point, close to the desired face.
12418 theName Object name; when specified, this parameter is used
12419 for result publication in the study. Otherwise, if automatic
12420 publication is switched on, default value is used for result name.
12423 New GEOM.GEOM_Object, containing the found face.
12425 # Example: see GEOM_Spanner.py
12426 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
12427 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
12428 self._autoPublish(anObj, theName, "face")
12431 ## Find a face of block, whose outside normale has minimal angle with the given vector.
12432 # @param theBlock Block or a compound of blocks.
12433 # @param theVector Vector, close to the normale of the desired face.
12434 # @param theName Object name; when specified, this parameter is used
12435 # for result publication in the study. Otherwise, if automatic
12436 # publication is switched on, default value is used for result name.
12438 # @return New GEOM.GEOM_Object, containing the found face.
12440 # @ref swig_todo "Example"
12441 @ManageTransactions("BlocksOp")
12442 def GetFaceByNormale(self, theBlock, theVector, theName=None):
12444 Find a face of block, whose outside normale has minimal angle with the given vector.
12447 theBlock Block or a compound of blocks.
12448 theVector Vector, close to the normale of the desired face.
12449 theName Object name; when specified, this parameter is used
12450 for result publication in the study. Otherwise, if automatic
12451 publication is switched on, default value is used for result name.
12454 New GEOM.GEOM_Object, containing the found face.
12456 # Example: see GEOM_Spanner.py
12457 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
12458 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
12459 self._autoPublish(anObj, theName, "face")
12462 ## Find all sub-shapes of type \a theShapeType of the given shape,
12463 # which have minimal distance to the given point.
12464 # @param theShape Any shape.
12465 # @param thePoint Point, close to the desired shape.
12466 # @param theShapeType Defines what kind of sub-shapes is searched GEOM::shape_type
12467 # @param theTolerance The tolerance for distances comparison. All shapes
12468 # with distances to the given point in interval
12469 # [minimal_distance, minimal_distance + theTolerance] will be gathered.
12470 # @param 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.
12474 # @return New GEOM_Object, containing a group of all found shapes.
12476 # @ref swig_GetShapesNearPoint "Example"
12477 @ManageTransactions("BlocksOp")
12478 def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07, theName=None):
12480 Find all sub-shapes of type theShapeType of the given shape,
12481 which have minimal distance to the given point.
12484 theShape Any shape.
12485 thePoint Point, close to the desired shape.
12486 theShapeType Defines what kind of sub-shapes is searched (see GEOM::shape_type)
12487 theTolerance The tolerance for distances comparison. All shapes
12488 with distances to the given point in interval
12489 [minimal_distance, minimal_distance + theTolerance] will be gathered.
12490 theName Object name; when specified, this parameter is used
12491 for result publication in the study. Otherwise, if automatic
12492 publication is switched on, default value is used for result name.
12495 New GEOM_Object, containing a group of all found shapes.
12497 # Example: see GEOM_TestOthers.py
12498 anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
12499 RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
12500 self._autoPublish(anObj, theName, "group")
12503 # end of l3_blocks_op
12506 ## @addtogroup l4_blocks_measure
12509 ## Check, if the compound of blocks is given.
12510 # To be considered as a compound of blocks, the
12511 # given shape must satisfy the following conditions:
12512 # - Each element of the compound should be a Block (6 faces).
12513 # - Each face should be a quadrangle, i.e. it should have only 1 wire
12514 # with 4 edges. If <VAR>theIsUseC1</VAR> is set to True and
12515 # there are more than 4 edges in the only wire of a face,
12516 # this face is considered to be quadrangle if it has 4 bounds
12517 # (1 or more edge) of C1 continuity.
12518 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
12519 # - The compound should be connexe.
12520 # - The glue between two quadrangle faces should be applied.
12521 # @param theCompound The compound to check.
12522 # @param theIsUseC1 Flag to check if there are 4 bounds on a face
12523 # taking into account C1 continuity.
12524 # @param theAngTolerance the angular tolerance to check if two neighbor
12525 # edges are codirectional in the common vertex with this
12526 # tolerance. This parameter is used only if
12527 # <VAR>theIsUseC1</VAR> is set to True.
12528 # @return TRUE, if the given shape is a compound of blocks.
12529 # If theCompound is not valid, prints all discovered errors.
12531 # @ref tui_check_compound_of_blocks_page "Example 1"
12532 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
12533 @ManageTransactions("BlocksOp")
12534 def CheckCompoundOfBlocks(self,theCompound, theIsUseC1 = False,
12535 theAngTolerance = 1.e-12):
12537 Check, if the compound of blocks is given.
12538 To be considered as a compound of blocks, the
12539 given shape must satisfy the following conditions:
12540 - Each element of the compound should be a Block (6 faces).
12541 - Each face should be a quadrangle, i.e. it should have only 1 wire
12542 with 4 edges. If theIsUseC1 is set to True and
12543 there are more than 4 edges in the only wire of a face,
12544 this face is considered to be quadrangle if it has 4 bounds
12545 (1 or more edge) of C1 continuity.
12546 - A connection between two Blocks should be an entire quadrangle face or an entire edge.
12547 - The compound should be connexe.
12548 - The glue between two quadrangle faces should be applied.
12551 theCompound The compound to check.
12552 theIsUseC1 Flag to check if there are 4 bounds on a face
12553 taking into account C1 continuity.
12554 theAngTolerance the angular tolerance to check if two neighbor
12555 edges are codirectional in the common vertex with this
12556 tolerance. This parameter is used only if
12557 theIsUseC1 is set to True.
12560 TRUE, if the given shape is a compound of blocks.
12561 If theCompound is not valid, prints all discovered errors.
12563 # Example: see GEOM_Spanner.py
12566 aTolerance = theAngTolerance
12567 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound, aTolerance)
12568 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
12570 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
12574 ## Retrieve all non blocks solids and faces from \a theShape.
12575 # @param theShape The shape to explore.
12576 # @param theIsUseC1 Flag to check if there are 4 bounds on a face
12577 # taking into account C1 continuity.
12578 # @param theAngTolerance the angular tolerance to check if two neighbor
12579 # edges are codirectional in the common vertex with this
12580 # tolerance. This parameter is used only if
12581 # <VAR>theIsUseC1</VAR> is set to True.
12582 # @param theName Object name; when specified, this parameter is used
12583 # for result publication in the study. Otherwise, if automatic
12584 # publication is switched on, default value is used for result name.
12586 # @return A tuple of two GEOM_Objects. The first object is a group of all
12587 # non block solids (= not 6 faces, or with 6 faces, but with the
12588 # presence of non-quadrangular faces). The second object is a
12589 # group of all non quadrangular faces (= faces with more then
12590 # 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
12591 # with 1 wire with not 4 edges that do not form 4 bounds of
12594 # @ref tui_get_non_blocks_page "Example 1"
12595 # \n @ref swig_GetNonBlocks "Example 2"
12596 @ManageTransactions("BlocksOp")
12597 def GetNonBlocks (self, theShape, theIsUseC1 = False,
12598 theAngTolerance = 1.e-12, theName=None):
12600 Retrieve all non blocks solids and faces from theShape.
12603 theShape The shape to explore.
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.
12610 theName Object name; when specified, this parameter is used
12611 for result publication in the study. Otherwise, if automatic
12612 publication is switched on, default value is used for result name.
12615 A tuple of two GEOM_Objects. The first object is a group of all
12616 non block solids (= not 6 faces, or with 6 faces, but with the
12617 presence of non-quadrangular faces). The second object is a
12618 group of all non quadrangular faces (= faces with more then
12619 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
12620 with 1 wire with not 4 edges that do not form 4 bounds of
12624 (res_sols, res_faces) = geompy.GetNonBlocks(myShape1)
12626 # Example: see GEOM_Spanner.py
12629 aTolerance = theAngTolerance
12630 aTuple = self.BlocksOp.GetNonBlocks(theShape, aTolerance)
12631 RaiseIfFailed("GetNonBlocks", self.BlocksOp)
12632 self._autoPublish(aTuple, theName, ("groupNonHexas", "groupNonQuads"))
12635 ## Remove all seam and degenerated edges from \a theShape.
12636 # Unite faces and edges, sharing one surface. It means that
12637 # this faces must have references to one C++ surface object (handle).
12638 # @param theShape The compound or single solid to remove irregular edges from.
12639 # @param doUnionFaces If True, then unite faces. If False (the default value),
12640 # do not unite faces.
12641 # @param theName Object name; when specified, this parameter is used
12642 # for result publication in the study. Otherwise, if automatic
12643 # publication is switched on, default value is used for result name.
12645 # @return Improved shape.
12647 # @ref swig_RemoveExtraEdges "Example"
12648 @ManageTransactions("BlocksOp")
12649 def RemoveExtraEdges(self, theShape, doUnionFaces=False, theName=None):
12651 Remove all seam and degenerated edges from theShape.
12652 Unite faces and edges, sharing one surface. It means that
12653 this faces must have references to one C++ surface object (handle).
12656 theShape The compound or single solid to remove irregular edges from.
12657 doUnionFaces If True, then unite faces. If False (the default value),
12658 do not unite faces.
12659 theName Object name; when specified, this parameter is used
12660 for result publication in the study. Otherwise, if automatic
12661 publication is switched on, default value is used for result name.
12666 # Example: see GEOM_TestOthers.py
12667 nbFacesOptimum = -1 # -1 means do not unite faces
12668 if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
12669 anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
12670 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
12671 self._autoPublish(anObj, theName, "removeExtraEdges")
12674 ## Performs union faces of \a theShape
12675 # Unite faces sharing one surface. It means that
12676 # these faces must have references to one C++ surface object (handle).
12677 # @param theShape The compound or single solid that contains faces
12678 # to perform union.
12679 # @param theName Object name; when specified, this parameter is used
12680 # for result publication in the study. Otherwise, if automatic
12681 # publication is switched on, default value is used for result name.
12683 # @return Improved shape.
12685 # @ref swig_UnionFaces "Example"
12686 @ManageTransactions("BlocksOp")
12687 def UnionFaces(self, theShape, theName=None):
12689 Performs union faces of theShape.
12690 Unite faces sharing one surface. It means that
12691 these faces must have references to one C++ surface object (handle).
12694 theShape The compound or single solid that contains faces
12696 theName Object name; when specified, this parameter is used
12697 for result publication in the study. Otherwise, if automatic
12698 publication is switched on, default value is used for result name.
12703 # Example: see GEOM_TestOthers.py
12704 anObj = self.BlocksOp.UnionFaces(theShape)
12705 RaiseIfFailed("UnionFaces", self.BlocksOp)
12706 self._autoPublish(anObj, theName, "unionFaces")
12709 ## Check, if the given shape is a blocks compound.
12710 # Fix all detected errors.
12711 # \note Single block can be also fixed by this method.
12712 # @param theShape The compound to check and improve.
12713 # @param theName Object name; when specified, this parameter is used
12714 # for result publication in the study. Otherwise, if automatic
12715 # publication is switched on, default value is used for result name.
12717 # @return Improved compound.
12719 # @ref swig_CheckAndImprove "Example"
12720 @ManageTransactions("BlocksOp")
12721 def CheckAndImprove(self, theShape, theName=None):
12723 Check, if the given shape is a blocks compound.
12724 Fix all detected errors.
12727 Single block can be also fixed by this method.
12730 theShape The compound to check and improve.
12731 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.
12738 # Example: see GEOM_TestOthers.py
12739 anObj = self.BlocksOp.CheckAndImprove(theShape)
12740 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
12741 self._autoPublish(anObj, theName, "improved")
12744 # end of l4_blocks_measure
12747 ## @addtogroup l3_blocks_op
12750 ## Get all the blocks, contained in the given compound.
12751 # @param theCompound The compound to explode.
12752 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
12753 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
12754 # @param theName Object name; when specified, this parameter is used
12755 # for result publication in the study. Otherwise, if automatic
12756 # publication is switched on, default value is used for result name.
12758 # @note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
12760 # @return List of GEOM.GEOM_Object, containing the retrieved blocks.
12762 # @ref tui_explode_on_blocks "Example 1"
12763 # \n @ref swig_MakeBlockExplode "Example 2"
12764 @ManageTransactions("BlocksOp")
12765 def MakeBlockExplode(self, theCompound, theMinNbFaces, theMaxNbFaces, theName=None):
12767 Get all the blocks, contained in the given compound.
12770 theCompound The compound to explode.
12771 theMinNbFaces If solid has lower number of faces, it is not a block.
12772 theMaxNbFaces If solid has higher number of faces, it is not a block.
12773 theName Object name; when specified, this parameter is used
12774 for result publication in the study. Otherwise, if automatic
12775 publication is switched on, default value is used for result name.
12778 If theMaxNbFaces = 0, the maximum number of faces is not restricted.
12781 List of GEOM.GEOM_Object, containing the retrieved blocks.
12783 # Example: see GEOM_TestOthers.py
12784 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
12785 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
12786 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
12787 for anObj in aList:
12788 anObj.SetParameters(Parameters)
12790 self._autoPublish(aList, theName, "block")
12793 ## Find block, containing the given point inside its volume or on boundary.
12794 # @param theCompound Compound, to find block in.
12795 # @param thePoint Point, close to the desired block. If the point lays on
12796 # boundary between some blocks, we return block with nearest center.
12797 # @param theName Object name; when specified, this parameter is used
12798 # for result publication in the study. Otherwise, if automatic
12799 # publication is switched on, default value is used for result name.
12801 # @return New GEOM.GEOM_Object, containing the found block.
12803 # @ref swig_todo "Example"
12804 @ManageTransactions("BlocksOp")
12805 def GetBlockNearPoint(self, theCompound, thePoint, theName=None):
12807 Find block, containing the given point inside its volume or on boundary.
12810 theCompound Compound, to find block in.
12811 thePoint Point, close to the desired block. If the point lays on
12812 boundary between some blocks, we return block with nearest center.
12813 theName Object name; when specified, this parameter is used
12814 for result publication in the study. Otherwise, if automatic
12815 publication is switched on, default value is used for result name.
12818 New GEOM.GEOM_Object, containing the found block.
12820 # Example: see GEOM_Spanner.py
12821 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
12822 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
12823 self._autoPublish(anObj, theName, "block")
12826 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
12827 # @param theCompound Compound, to find block in.
12828 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
12829 # @param theName Object name; when specified, this parameter is used
12830 # for result publication in the study. Otherwise, if automatic
12831 # publication is switched on, default value is used for result name.
12833 # @return New GEOM.GEOM_Object, containing the found block.
12835 # @ref swig_GetBlockByParts "Example"
12836 @ManageTransactions("BlocksOp")
12837 def GetBlockByParts(self, theCompound, theParts, theName=None):
12839 Find block, containing all the elements, passed as the parts, or maximum quantity of them.
12842 theCompound Compound, to find block in.
12843 theParts List of faces and/or edges and/or vertices to be parts of the found block.
12844 theName Object name; when specified, this parameter is used
12845 for result publication in the study. Otherwise, if automatic
12846 publication is switched on, default value is used for result name.
12849 New GEOM_Object, containing the found block.
12851 # Example: see GEOM_TestOthers.py
12852 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
12853 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
12854 self._autoPublish(anObj, theName, "block")
12857 ## Return all blocks, containing all the elements, passed as the parts.
12858 # @param theCompound Compound, to find blocks in.
12859 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
12860 # @param theName Object name; when specified, this parameter is used
12861 # for result publication in the study. Otherwise, if automatic
12862 # publication is switched on, default value is used for result name.
12864 # @return List of GEOM.GEOM_Object, containing the found blocks.
12866 # @ref swig_todo "Example"
12867 @ManageTransactions("BlocksOp")
12868 def GetBlocksByParts(self, theCompound, theParts, theName=None):
12870 Return all blocks, containing all the elements, passed as the parts.
12873 theCompound Compound, to find blocks in.
12874 theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
12875 theName Object name; when specified, this parameter is used
12876 for result publication in the study. Otherwise, if automatic
12877 publication is switched on, default value is used for result name.
12880 List of GEOM.GEOM_Object, containing the found blocks.
12882 # Example: see GEOM_Spanner.py
12883 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
12884 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
12885 self._autoPublish(aList, theName, "block")
12888 ## Multi-transformate block and glue the result.
12889 # Transformation is defined so, as to superpose direction faces.
12890 # @param Block Hexahedral solid to be multi-transformed.
12891 # @param DirFace1 ID of First direction face.
12892 # @param DirFace2 ID of Second direction face.
12893 # @param NbTimes Quantity of transformations to be done.
12894 # @param theName Object name; when specified, this parameter is used
12895 # for result publication in the study. Otherwise, if automatic
12896 # publication is switched on, default value is used for result name.
12898 # @note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
12900 # @return New GEOM.GEOM_Object, containing the result shape.
12902 # @ref tui_multi_transformation "Example"
12903 @ManageTransactions("BlocksOp")
12904 def MakeMultiTransformation1D(self, Block, DirFace1, DirFace2, NbTimes, theName=None):
12906 Multi-transformate block and glue the result.
12907 Transformation is defined so, as to superpose direction faces.
12910 Block Hexahedral solid to be multi-transformed.
12911 DirFace1 ID of First direction face.
12912 DirFace2 ID of Second direction face.
12913 NbTimes Quantity of transformations to be done.
12914 theName Object name; when specified, this parameter is used
12915 for result publication in the study. Otherwise, if automatic
12916 publication is switched on, default value is used for result name.
12919 Unique ID of sub-shape can be obtained, using method GetSubShapeID().
12922 New GEOM.GEOM_Object, containing the result shape.
12924 # Example: see GEOM_Spanner.py
12925 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
12926 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
12927 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
12928 anObj.SetParameters(Parameters)
12929 self._autoPublish(anObj, theName, "transformed")
12932 ## Multi-transformate block and glue the result.
12933 # @param Block Hexahedral solid to be multi-transformed.
12934 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
12935 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
12936 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
12937 # @param theName Object name; when specified, this parameter is used
12938 # for result publication in the study. Otherwise, if automatic
12939 # publication is switched on, default value is used for result name.
12941 # @return New GEOM.GEOM_Object, containing the result shape.
12943 # @ref tui_multi_transformation "Example"
12944 @ManageTransactions("BlocksOp")
12945 def MakeMultiTransformation2D(self, Block, DirFace1U, DirFace2U, NbTimesU,
12946 DirFace1V, DirFace2V, NbTimesV, theName=None):
12948 Multi-transformate block and glue the result.
12951 Block Hexahedral solid to be multi-transformed.
12952 DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
12953 DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
12954 NbTimesU,NbTimesV Quantity of transformations to be done.
12955 theName Object name; when specified, this parameter is used
12956 for result publication in the study. Otherwise, if automatic
12957 publication is switched on, default value is used for result name.
12960 New GEOM.GEOM_Object, containing the result shape.
12962 # Example: see GEOM_Spanner.py
12963 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
12964 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
12965 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
12966 DirFace1V, DirFace2V, NbTimesV)
12967 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
12968 anObj.SetParameters(Parameters)
12969 self._autoPublish(anObj, theName, "transformed")
12972 ## Build all possible propagation groups.
12973 # Propagation group is a set of all edges, opposite to one (main)
12974 # edge of this group directly or through other opposite edges.
12975 # Notion of Opposite Edge make sense only on quadrangle face.
12976 # @param theShape Shape to build propagation groups on.
12977 # @param theName Object name; when specified, this parameter is used
12978 # for result publication in the study. Otherwise, if automatic
12979 # publication is switched on, default value is used for result name.
12981 # @return List of GEOM.GEOM_Object, each of them is a propagation group.
12983 # @ref swig_Propagate "Example"
12984 @ManageTransactions("BlocksOp")
12985 def Propagate(self, theShape, theName=None):
12987 Build all possible propagation groups.
12988 Propagation group is a set of all edges, opposite to one (main)
12989 edge of this group directly or through other opposite edges.
12990 Notion of Opposite Edge make sense only on quadrangle face.
12993 theShape Shape to build propagation groups on.
12994 theName Object name; when specified, this parameter is used
12995 for result publication in the study. Otherwise, if automatic
12996 publication is switched on, default value is used for result name.
12999 List of GEOM.GEOM_Object, each of them is a propagation group.
13001 # Example: see GEOM_TestOthers.py
13002 listChains = self.BlocksOp.Propagate(theShape)
13003 RaiseIfFailed("Propagate", self.BlocksOp)
13004 self._autoPublish(listChains, theName, "propagate")
13007 # end of l3_blocks_op
13010 ## @addtogroup l3_groups
13013 ## Creates a new group which will store sub-shapes of theMainShape
13014 # @param theMainShape is a GEOM object on which the group is selected
13015 # @param theShapeType defines a shape type of the group (see GEOM::shape_type)
13016 # @param theName Object name; when specified, this parameter is used
13017 # for result publication in the study. Otherwise, if automatic
13018 # publication is switched on, default value is used for result name.
13020 # @return a newly created GEOM group (GEOM.GEOM_Object)
13022 # @ref tui_working_with_groups_page "Example 1"
13023 # \n @ref swig_CreateGroup "Example 2"
13024 @ManageTransactions("GroupOp")
13025 def CreateGroup(self, theMainShape, theShapeType, theName=None):
13027 Creates a new group which will store sub-shapes of theMainShape
13030 theMainShape is a GEOM object on which the group is selected
13031 theShapeType defines a shape type of the group:"COMPOUND", "COMPSOLID",
13032 "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX", "SHAPE".
13033 theName Object name; when specified, this parameter is used
13034 for result publication in the study. Otherwise, if automatic
13035 publication is switched on, default value is used for result name.
13038 a newly created GEOM group
13041 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
13044 # Example: see GEOM_TestOthers.py
13045 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
13046 RaiseIfFailed("CreateGroup", self.GroupOp)
13047 self._autoPublish(anObj, theName, "group")
13050 ## Adds a sub-object with ID theSubShapeId to the group
13051 # @param theGroup is a GEOM group to which the new sub-shape is added
13052 # @param theSubShapeID is a sub-shape ID in the main object.
13053 # \note Use method GetSubShapeID() to get an unique ID of the sub-shape
13055 # @ref tui_working_with_groups_page "Example"
13056 @ManageTransactions("GroupOp")
13057 def AddObject(self,theGroup, theSubShapeID):
13059 Adds a sub-object with ID theSubShapeId to the group
13062 theGroup is a GEOM group to which the new sub-shape is added
13063 theSubShapeID is a sub-shape ID in the main object.
13066 Use method GetSubShapeID() to get an unique ID of the sub-shape
13068 # Example: see GEOM_TestOthers.py
13069 self.GroupOp.AddObject(theGroup, theSubShapeID)
13070 if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT":
13071 RaiseIfFailed("AddObject", self.GroupOp)
13075 ## Removes a sub-object with ID \a theSubShapeId from the group
13076 # @param theGroup is a GEOM group from which the new sub-shape is removed
13077 # @param theSubShapeID is a sub-shape ID in the main object.
13078 # \note Use method GetSubShapeID() to get an unique ID of the sub-shape
13080 # @ref tui_working_with_groups_page "Example"
13081 @ManageTransactions("GroupOp")
13082 def RemoveObject(self,theGroup, theSubShapeID):
13084 Removes a sub-object with ID theSubShapeId from the group
13087 theGroup is a GEOM group from which the new sub-shape is removed
13088 theSubShapeID is a sub-shape ID in the main object.
13091 Use method GetSubShapeID() to get an unique ID of the sub-shape
13093 # Example: see GEOM_TestOthers.py
13094 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
13095 RaiseIfFailed("RemoveObject", self.GroupOp)
13098 ## Adds to the group all the given shapes. No errors, if some shapes are already included.
13099 # @param theGroup is a GEOM group to which the new sub-shapes are added.
13100 # @param theSubShapes is a list of sub-shapes to be added.
13102 # @ref tui_working_with_groups_page "Example"
13103 @ManageTransactions("GroupOp")
13104 def UnionList (self,theGroup, theSubShapes):
13106 Adds to the group all the given shapes. No errors, if some shapes are already included.
13109 theGroup is a GEOM group to which the new sub-shapes are added.
13110 theSubShapes is a list of sub-shapes to be added.
13112 # Example: see GEOM_TestOthers.py
13113 self.GroupOp.UnionList(theGroup, theSubShapes)
13114 RaiseIfFailed("UnionList", self.GroupOp)
13117 ## Adds to the group all the given shapes. No errors, if some shapes are already included.
13118 # @param theGroup is a GEOM group to which the new sub-shapes are added.
13119 # @param theSubShapes is a list of indices of sub-shapes to be added.
13121 # @ref swig_UnionIDs "Example"
13122 @ManageTransactions("GroupOp")
13123 def UnionIDs(self,theGroup, theSubShapes):
13125 Adds to the group all the given shapes. No errors, if some shapes are already included.
13128 theGroup is a GEOM group to which the new sub-shapes are added.
13129 theSubShapes is a list of indices of sub-shapes to be added.
13131 # Example: see GEOM_TestOthers.py
13132 self.GroupOp.UnionIDs(theGroup, theSubShapes)
13133 RaiseIfFailed("UnionIDs", self.GroupOp)
13136 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
13137 # @param theGroup is a GEOM group from which the sub-shapes are removed.
13138 # @param theSubShapes is a list of sub-shapes to be removed.
13140 # @ref tui_working_with_groups_page "Example"
13141 @ManageTransactions("GroupOp")
13142 def DifferenceList (self,theGroup, theSubShapes):
13144 Removes from the group all the given shapes. No errors, if some shapes are not included.
13147 theGroup is a GEOM group from which the sub-shapes are removed.
13148 theSubShapes is a list of sub-shapes to be removed.
13150 # Example: see GEOM_TestOthers.py
13151 self.GroupOp.DifferenceList(theGroup, theSubShapes)
13152 RaiseIfFailed("DifferenceList", self.GroupOp)
13155 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
13156 # @param theGroup is a GEOM group from which the sub-shapes are removed.
13157 # @param theSubShapes is a list of indices of sub-shapes to be removed.
13159 # @ref swig_DifferenceIDs "Example"
13160 @ManageTransactions("GroupOp")
13161 def DifferenceIDs(self,theGroup, theSubShapes):
13163 Removes from the group all the given shapes. No errors, if some shapes are not included.
13166 theGroup is a GEOM group from which the sub-shapes are removed.
13167 theSubShapes is a list of indices of sub-shapes to be removed.
13169 # Example: see GEOM_TestOthers.py
13170 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
13171 RaiseIfFailed("DifferenceIDs", self.GroupOp)
13174 ## Union of two groups.
13175 # New group is created. It will contain all entities
13176 # which are present in groups theGroup1 and theGroup2.
13177 # @param theGroup1, theGroup2 are the initial GEOM groups
13178 # to create the united group from.
13179 # @param theName Object name; when specified, this parameter is used
13180 # for result publication in the study. Otherwise, if automatic
13181 # publication is switched on, default value is used for result name.
13183 # @return a newly created GEOM group.
13185 # @ref tui_union_groups_anchor "Example"
13186 @ManageTransactions("GroupOp")
13187 def UnionGroups (self, theGroup1, theGroup2, theName=None):
13189 Union of two groups.
13190 New group is created. It will contain all entities
13191 which are present in groups theGroup1 and theGroup2.
13194 theGroup1, theGroup2 are the initial GEOM groups
13195 to create the united group from.
13196 theName Object name; when specified, this parameter is used
13197 for result publication in the study. Otherwise, if automatic
13198 publication is switched on, default value is used for result name.
13201 a newly created GEOM group.
13203 # Example: see GEOM_TestOthers.py
13204 aGroup = self.GroupOp.UnionGroups(theGroup1, theGroup2)
13205 RaiseIfFailed("UnionGroups", self.GroupOp)
13206 self._autoPublish(aGroup, theName, "group")
13209 ## Intersection of two groups.
13210 # New group is created. It will contain only those entities
13211 # which are present in both groups theGroup1 and theGroup2.
13212 # @param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
13213 # @param theName Object name; when specified, this parameter is used
13214 # for result publication in the study. Otherwise, if automatic
13215 # publication is switched on, default value is used for result name.
13217 # @return a newly created GEOM group.
13219 # @ref tui_intersect_groups_anchor "Example"
13220 @ManageTransactions("GroupOp")
13221 def IntersectGroups (self, theGroup1, theGroup2, theName=None):
13223 Intersection of two groups.
13224 New group is created. It will contain only those entities
13225 which are present in both groups theGroup1 and theGroup2.
13228 theGroup1, theGroup2 are the initial GEOM groups to get common part of.
13229 theName Object name; when specified, this parameter is used
13230 for result publication in the study. Otherwise, if automatic
13231 publication is switched on, default value is used for result name.
13234 a newly created GEOM group.
13236 # Example: see GEOM_TestOthers.py
13237 aGroup = self.GroupOp.IntersectGroups(theGroup1, theGroup2)
13238 RaiseIfFailed("IntersectGroups", self.GroupOp)
13239 self._autoPublish(aGroup, theName, "group")
13242 ## Cut of two groups.
13243 # New group is created. It will contain entities which are
13244 # present in group theGroup1 but are not present in group theGroup2.
13245 # @param theGroup1 is a GEOM group to include elements of.
13246 # @param theGroup2 is a GEOM group to exclude elements of.
13247 # @param theName Object name; when specified, this parameter is used
13248 # for result publication in the study. Otherwise, if automatic
13249 # publication is switched on, default value is used for result name.
13251 # @return a newly created GEOM group.
13253 # @ref tui_cut_groups_anchor "Example"
13254 @ManageTransactions("GroupOp")
13255 def CutGroups (self, theGroup1, theGroup2, theName=None):
13258 New group is created. It will contain entities which are
13259 present in group theGroup1 but are not present in group theGroup2.
13262 theGroup1 is a GEOM group to include elements of.
13263 theGroup2 is a GEOM group to exclude elements of.
13264 theName Object name; when specified, this parameter is used
13265 for result publication in the study. Otherwise, if automatic
13266 publication is switched on, default value is used for result name.
13269 a newly created GEOM group.
13271 # Example: see GEOM_TestOthers.py
13272 aGroup = self.GroupOp.CutGroups(theGroup1, theGroup2)
13273 RaiseIfFailed("CutGroups", self.GroupOp)
13274 self._autoPublish(aGroup, theName, "group")
13277 ## Union of list of groups.
13278 # New group is created. It will contain all entities that are
13279 # present in groups listed in theGList.
13280 # @param theGList is a list of GEOM groups to create the united group from.
13281 # @param 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.
13285 # @return a newly created GEOM group.
13287 # @ref tui_union_groups_anchor "Example"
13288 @ManageTransactions("GroupOp")
13289 def UnionListOfGroups (self, theGList, theName=None):
13291 Union of list of groups.
13292 New group is created. It will contain all entities that are
13293 present in groups listed in theGList.
13296 theGList is a list of GEOM groups to create the united group from.
13297 theName Object name; when specified, this parameter is used
13298 for result publication in the study. Otherwise, if automatic
13299 publication is switched on, default value is used for result name.
13302 a newly created GEOM group.
13304 # Example: see GEOM_TestOthers.py
13305 aGroup = self.GroupOp.UnionListOfGroups(theGList)
13306 RaiseIfFailed("UnionListOfGroups", self.GroupOp)
13307 self._autoPublish(aGroup, theName, "group")
13310 ## Cut of lists of groups.
13311 # New group is created. It will contain only entities
13312 # which are present in groups listed in theGList.
13313 # @param theGList is a list of GEOM groups to include elements of.
13314 # @param theName Object name; when specified, this parameter is used
13315 # for result publication in the study. Otherwise, if automatic
13316 # publication is switched on, default value is used for result name.
13318 # @return a newly created GEOM group.
13320 # @ref tui_intersect_groups_anchor "Example"
13321 @ManageTransactions("GroupOp")
13322 def IntersectListOfGroups (self, theGList, theName=None):
13324 Cut of lists of groups.
13325 New group is created. It will contain only entities
13326 which are present in groups listed in theGList.
13329 theGList is a list of GEOM groups to include elements of.
13330 theName Object name; when specified, this parameter is used
13331 for result publication in the study. Otherwise, if automatic
13332 publication is switched on, default value is used for result name.
13335 a newly created GEOM group.
13337 # Example: see GEOM_TestOthers.py
13338 aGroup = self.GroupOp.IntersectListOfGroups(theGList)
13339 RaiseIfFailed("IntersectListOfGroups", self.GroupOp)
13340 self._autoPublish(aGroup, theName, "group")
13343 ## Cut of lists of groups.
13344 # New group is created. It will contain only entities
13345 # which are present in groups listed in theGList1 but
13346 # are not present in groups from theGList2.
13347 # @param theGList1 is a list of GEOM groups to include elements of.
13348 # @param theGList2 is a list of GEOM groups to exclude elements of.
13349 # @param 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.
13353 # @return a newly created GEOM group.
13355 # @ref tui_cut_groups_anchor "Example"
13356 @ManageTransactions("GroupOp")
13357 def CutListOfGroups (self, theGList1, theGList2, theName=None):
13359 Cut of lists of groups.
13360 New group is created. It will contain only entities
13361 which are present in groups listed in theGList1 but
13362 are not present in groups from theGList2.
13365 theGList1 is a list of GEOM groups to include elements of.
13366 theGList2 is a list of GEOM groups to exclude elements of.
13367 theName Object name; when specified, this parameter is used
13368 for result publication in the study. Otherwise, if automatic
13369 publication is switched on, default value is used for result name.
13372 a newly created GEOM group.
13374 # Example: see GEOM_TestOthers.py
13375 aGroup = self.GroupOp.CutListOfGroups(theGList1, theGList2)
13376 RaiseIfFailed("CutListOfGroups", self.GroupOp)
13377 self._autoPublish(aGroup, theName, "group")
13380 ## Returns a list of sub-objects ID stored in the group
13381 # @param theGroup is a GEOM group for which a list of IDs is requested
13383 # @ref swig_GetObjectIDs "Example"
13384 @ManageTransactions("GroupOp")
13385 def GetObjectIDs(self,theGroup):
13387 Returns a list of sub-objects ID stored in the group
13390 theGroup is a GEOM group for which a list of IDs is requested
13392 # Example: see GEOM_TestOthers.py
13393 ListIDs = self.GroupOp.GetObjects(theGroup)
13394 RaiseIfFailed("GetObjects", self.GroupOp)
13397 ## Returns a type of sub-objects stored in the group
13398 # @param theGroup is a GEOM group which type is returned.
13400 # @ref swig_GetType "Example"
13401 @ManageTransactions("GroupOp")
13402 def GetType(self,theGroup):
13404 Returns a type of sub-objects stored in the group
13407 theGroup is a GEOM group which type is returned.
13409 # Example: see GEOM_TestOthers.py
13410 aType = self.GroupOp.GetType(theGroup)
13411 RaiseIfFailed("GetType", self.GroupOp)
13414 ## Convert a type of geom object from id to string value
13415 # @param theId is a GEOM object type id.
13416 # @return type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
13417 # @ref swig_GetType "Example"
13418 def ShapeIdToType(self, theId):
13420 Convert a type of geom object from id to string value
13423 theId is a GEOM object type id.
13426 type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
13453 return "REVOLUTION"
13501 return "FREE_BOUNDS"
13509 return "THRUSECTIONS"
13511 return "COMPOUNDFILTER"
13513 return "SHAPES_ON_SHAPE"
13515 return "ELLIPSE_ARC"
13517 return "3DSKETCHER"
13523 return "PIPETSHAPE"
13524 return "Shape Id not exist."
13526 ## Returns a main shape associated with the group
13527 # @param theGroup is a GEOM group for which a main shape object is requested
13528 # @return a GEOM object which is a main shape for theGroup
13530 # @ref swig_GetMainShape "Example"
13531 @ManageTransactions("GroupOp")
13532 def GetMainShape(self,theGroup):
13534 Returns a main shape associated with the group
13537 theGroup is a GEOM group for which a main shape object is requested
13540 a GEOM object which is a main shape for theGroup
13542 Example of usage: BoxCopy = geompy.GetMainShape(CreateGroup)
13544 # Example: see GEOM_TestOthers.py
13545 anObj = self.GroupOp.GetMainShape(theGroup)
13546 RaiseIfFailed("GetMainShape", self.GroupOp)
13549 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
13550 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
13551 # @param theShape given shape (see GEOM.GEOM_Object)
13552 # @param min_length minimum length of edges of theShape
13553 # @param max_length maximum length of edges of theShape
13554 # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13555 # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13556 # @param theName Object name; when specified, this parameter is used
13557 # for result publication in the study. Otherwise, if automatic
13558 # publication is switched on, default value is used for result name.
13560 # @return a newly created GEOM group of edges
13562 # @@ref swig_todo "Example"
13563 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1, theName=None):
13565 Create group of edges of theShape, whose length is in range [min_length, max_length].
13566 If include_min/max == 0, edges with length == min/max_length will not be included in result.
13569 theShape given shape
13570 min_length minimum length of edges of theShape
13571 max_length maximum length of edges of theShape
13572 include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13573 include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13574 theName Object name; when specified, this parameter is used
13575 for result publication in the study. Otherwise, if automatic
13576 publication is switched on, default value is used for result name.
13579 a newly created GEOM group of edges.
13581 edges = self.SubShapeAll(theShape, self.ShapeType["EDGE"])
13582 edges_in_range = []
13584 Props = self.BasicProperties(edge)
13585 if min_length <= Props[0] and Props[0] <= max_length:
13586 if (not include_min) and (min_length == Props[0]):
13589 if (not include_max) and (Props[0] == max_length):
13592 edges_in_range.append(edge)
13594 if len(edges_in_range) <= 0:
13595 print("No edges found by given criteria")
13598 # note: auto-publishing is done in self.CreateGroup()
13599 group_edges = self.CreateGroup(theShape, self.ShapeType["EDGE"], theName)
13600 self.UnionList(group_edges, edges_in_range)
13604 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
13605 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
13606 # @param min_length minimum length of edges of selected shape
13607 # @param max_length maximum length of edges of selected shape
13608 # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13609 # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13610 # @return a newly created GEOM group of edges
13611 # @ref swig_todo "Example"
13612 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
13614 Create group of edges of selected shape, whose length is in range [min_length, max_length].
13615 If include_min/max == 0, edges with length == min/max_length will not be included in result.
13618 min_length minimum length of edges of selected shape
13619 max_length maximum length of edges of selected shape
13620 include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13621 include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13624 a newly created GEOM group of edges.
13626 nb_selected = sg.SelectedCount()
13627 if nb_selected < 1:
13628 print("Select a shape before calling this function, please.")
13630 if nb_selected > 1:
13631 print("Only one shape must be selected")
13634 id_shape = sg.getSelected(0)
13635 shape = IDToObject( id_shape )
13637 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
13641 if include_min: left_str = " <= "
13642 if include_max: right_str = " <= "
13644 self.addToStudyInFather(shape, group_edges, "Group of edges with " + repr(min_length)
13645 + left_str + "length" + right_str + repr(max_length))
13647 sg.updateObjBrowser()
13654 #@@ insert new functions before this line @@ do not remove this line @@#
13656 ## Create a copy of the given object
13658 # @param theOriginal geometry object for copy
13659 # @param theName Object name; when specified, this parameter is used
13660 # for result publication in the study. Otherwise, if automatic
13661 # publication is switched on, default value is used for result name.
13663 # @return New GEOM_Object, containing the copied shape.
13665 # @ingroup l1_geomBuilder_auxiliary
13666 # @ref swig_MakeCopy "Example"
13667 @ManageTransactions("InsertOp")
13668 def MakeCopy(self, theOriginal, theName=None):
13670 Create a copy of the given object
13673 theOriginal geometry object for copy
13674 theName Object name; when specified, this parameter is used
13675 for result publication in the study. Otherwise, if automatic
13676 publication is switched on, default value is used for result name.
13679 New GEOM_Object, containing the copied shape.
13681 Example of usage: Copy = geompy.MakeCopy(Box)
13683 # Example: see GEOM_TestAll.py
13684 anObj = self.InsertOp.MakeCopy(theOriginal)
13685 RaiseIfFailed("MakeCopy", self.InsertOp)
13686 self._autoPublish(anObj, theName, "copy")
13689 ## Add Path to load python scripts from
13690 # @param Path a path to load python scripts from
13691 # @ingroup l1_geomBuilder_auxiliary
13692 def addPath(self,Path):
13694 Add Path to load python scripts from
13697 Path a path to load python scripts from
13699 if (sys.path.count(Path) < 1):
13700 sys.path.append(Path)
13704 ## Load marker texture from the file
13705 # @param Path a path to the texture file
13706 # @return unique texture identifier
13707 # @ingroup l1_geomBuilder_auxiliary
13708 @ManageTransactions("InsertOp")
13709 def LoadTexture(self, Path):
13711 Load marker texture from the file
13714 Path a path to the texture file
13717 unique texture identifier
13719 # Example: see GEOM_TestAll.py
13720 ID = self.InsertOp.LoadTexture(Path)
13721 RaiseIfFailed("LoadTexture", self.InsertOp)
13724 ## Get internal name of the object based on its study entry
13725 # @note This method does not provide an unique identifier of the geometry object.
13726 # @note This is internal function of GEOM component, though it can be used outside it for
13727 # appropriate reason (e.g. for identification of geometry object).
13728 # @param obj geometry object
13729 # @return unique object identifier
13730 # @ingroup l1_geomBuilder_auxiliary
13731 def getObjectID(self, obj):
13733 Get internal name of the object based on its study entry.
13734 Note: this method does not provide an unique identifier of the geometry object.
13735 It is an internal function of GEOM component, though it can be used outside GEOM for
13736 appropriate reason (e.g. for identification of geometry object).
13739 obj geometry object
13742 unique object identifier
13745 entry = salome.ObjectToID(obj)
13746 if entry is not None:
13747 lst = entry.split(":")
13749 ID = lst[-1] # -1 means last item in the list
13750 return "GEOM_" + ID
13755 ## Add marker texture. @a Width and @a Height parameters
13756 # specify width and height of the texture in pixels.
13757 # If @a RowData is @c True, @a Texture parameter should represent texture data
13758 # packed into the byte array. If @a RowData is @c False (default), @a Texture
13759 # parameter should be unpacked string, in which '1' symbols represent opaque
13760 # pixels and '0' represent transparent pixels of the texture bitmap.
13762 # @param Width texture width in pixels
13763 # @param Height texture height in pixels
13764 # @param Texture texture data
13765 # @param RowData if @c True, @a Texture data are packed in the byte stream
13766 # @return unique texture identifier
13767 # @ingroup l1_geomBuilder_auxiliary
13768 @ManageTransactions("InsertOp")
13769 def AddTexture(self, Width, Height, Texture, RowData=False):
13771 Add marker texture. Width and Height parameters
13772 specify width and height of the texture in pixels.
13773 If RowData is True, Texture parameter should represent texture data
13774 packed into the byte array. If RowData is False (default), Texture
13775 parameter should be unpacked string, in which '1' symbols represent opaque
13776 pixels and '0' represent transparent pixels of the texture bitmap.
13779 Width texture width in pixels
13780 Height texture height in pixels
13781 Texture texture data
13782 RowData if True, Texture data are packed in the byte stream
13785 return unique texture identifier
13787 if not RowData: Texture = PackData(Texture)
13788 ID = self.InsertOp.AddTexture(Width, Height, Texture)
13789 RaiseIfFailed("AddTexture", self.InsertOp)
13792 ## Transfer not topological data from one GEOM object to another.
13794 # @param theObjectFrom the source object of non-topological data
13795 # @param theObjectTo the destination object of non-topological data
13796 # @param theFindMethod method to search sub-shapes of theObjectFrom
13797 # in shape theObjectTo. Possible values are: GEOM.FSM_GetInPlace,
13798 # GEOM.FSM_GetInPlaceByHistory and GEOM.FSM_GetInPlace_Old.
13799 # Other values of GEOM.find_shape_method are not supported.
13801 # @return True in case of success; False otherwise.
13803 # @ingroup l1_geomBuilder_auxiliary
13805 # @ref swig_TransferData "Example"
13806 @ManageTransactions("InsertOp")
13807 def TransferData(self, theObjectFrom, theObjectTo,
13808 theFindMethod=GEOM.FSM_GetInPlace):
13810 Transfer not topological data from one GEOM object to another.
13813 theObjectFrom the source object of non-topological data
13814 theObjectTo the destination object of non-topological data
13815 theFindMethod method to search sub-shapes of theObjectFrom
13816 in shape theObjectTo. Possible values are:
13817 GEOM.FSM_GetInPlace, GEOM.FSM_GetInPlaceByHistory
13818 and GEOM.FSM_GetInPlace_Old. Other values of
13819 GEOM.find_shape_method are not supported.
13822 True in case of success; False otherwise.
13824 # Example: see GEOM_TestOthers.py
13826 # Example: see GEOM_TestAll.py
13827 isOk = self.InsertOp.TransferData(theObjectFrom,
13828 theObjectTo, theFindMethod)
13829 RaiseIfFailed("TransferData", self.InsertOp)
13832 ## Creates a new folder object. It is a container for any GEOM objects.
13833 # @param Name name of the container
13834 # @param Father parent object. If None,
13835 # folder under 'Geometry' root object will be created.
13836 # @return a new created folder
13837 # @ingroup l1_publish_data
13838 def NewFolder(self, Name, Father=None):
13840 Create a new folder object. It is an auxiliary container for any GEOM objects.
13843 Name name of the container
13844 Father parent object. If None,
13845 folder under 'Geometry' root object will be created.
13848 a new created folder
13850 return self.CreateFolder(Name, Father)
13852 ## Move object to the specified folder
13853 # @param Object object to move
13854 # @param Folder target folder
13855 # @ingroup l1_publish_data
13856 def PutToFolder(self, Object, Folder):
13858 Move object to the specified folder
13861 Object object to move
13862 Folder target folder
13864 self.MoveToFolder(Object, Folder)
13867 ## Move list of objects to the specified folder
13868 # @param ListOfSO list of objects to move
13869 # @param Folder target folder
13870 # @ingroup l1_publish_data
13871 def PutListToFolder(self, ListOfSO, Folder):
13873 Move list of objects to the specified folder
13876 ListOfSO list of objects to move
13877 Folder target folder
13879 self.MoveListToFolder(ListOfSO, Folder)
13882 ## @addtogroup l2_field
13886 # @param shape the shape the field lies on
13887 # @param name the field name
13888 # @param type type of field data: 0 - bool, 1 - int, 2 - double, 3 - string
13889 # @param dimension dimension of the shape the field lies on
13890 # 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
13891 # @param componentNames names of components
13892 # @return a created field
13893 @ManageTransactions("FieldOp")
13894 def CreateField(self, shape, name, type, dimension, componentNames):
13899 shape the shape the field lies on
13900 name the field name
13901 type type of field data
13902 dimension dimension of the shape the field lies on
13903 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
13904 componentNames names of components
13909 if isinstance( type, int ):
13910 if type < 0 or type > 3:
13911 raise RuntimeError("CreateField : Error: data type must be within [0-3] range")
13912 type = [GEOM.FDT_Bool,GEOM.FDT_Int,GEOM.FDT_Double,GEOM.FDT_String][type]
13914 f = self.FieldOp.CreateField( shape, name, type, dimension, componentNames)
13915 RaiseIfFailed("CreateField", self.FieldOp)
13917 geom._autoPublish( f, "", name)
13920 ## Removes a field from the GEOM component
13921 # @param field the field to remove
13922 def RemoveField(self, field):
13923 "Removes a field from the GEOM component"
13925 if isinstance( field, GEOM._objref_GEOM_Field ):
13926 geom.RemoveObject( field )
13927 elif isinstance( field, geomField ):
13928 geom.RemoveObject( field.field )
13930 raise RuntimeError("RemoveField() : the object is not a field")
13933 ## Returns number of fields on a shape
13934 @ManageTransactions("FieldOp")
13935 def CountFields(self, shape):
13936 "Returns number of fields on a shape"
13937 nb = self.FieldOp.CountFields( shape )
13938 RaiseIfFailed("CountFields", self.FieldOp)
13941 ## Returns all fields on a shape
13942 @ManageTransactions("FieldOp")
13943 def GetFields(self, shape):
13944 "Returns all fields on a shape"
13945 ff = self.FieldOp.GetFields( shape )
13946 RaiseIfFailed("GetFields", self.FieldOp)
13949 ## Returns a field on a shape by its name
13950 @ManageTransactions("FieldOp")
13951 def GetField(self, shape, name):
13952 "Returns a field on a shape by its name"
13953 f = self.FieldOp.GetField( shape, name )
13954 RaiseIfFailed("GetField", self.FieldOp)
13960 ## @addtogroup l2_testing
13963 ## Build a mesh on the given shape.
13964 # @param shape the source shape
13965 # @param linear_deflection linear deflection coefficient
13966 # @param is_relative says if given value of deflection is relative to shape's bounding box
13967 # @param angular_deflection angular deflection for edges in degrees
13968 # @return True in case of success; otherwise False.
13969 @ManageTransactions("TestOp")
13970 def Tesselate(self, shape, linear_deflection=0, is_relative=True, angular_deflection=0):
13971 """Build a mesh on the given shape.
13974 shape the source shape
13975 linear_deflection linear deflection coefficient
13976 is_relative says if given value of deflection is relative to shape's bounding box
13977 angular_deflection angular deflection for edges in degrees
13980 True in case of success; otherwise False.
13982 if angular_deflection > 0:
13983 angular_deflection = angular_deflection * math.pi / 180.
13984 r = self.TestOp.Tesselate(shape, linear_deflection, is_relative, angular_deflection)
13985 RaiseIfFailed("Tesselate", self.TestOp)
13988 # end of l2_testing
13992 # Register the new proxy for GEOM_Gen
13993 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geomBuilder)
13996 ## Field on Geometry
13997 # @ingroup l2_field
13998 class geomField( GEOM._objref_GEOM_Field ):
14000 def __init__(self, *args):
14001 GEOM._objref_GEOM_Field.__init__(self, *args)
14002 self.field = GEOM._objref_GEOM_Field
14005 ## Returns the shape the field lies on
14006 def getShape(self):
14007 "Returns the shape the field lies on"
14008 return self.field.GetShape(self)
14010 ## Returns the field name
14012 "Returns the field name"
14013 return self.field.GetName(self)
14015 ## Returns type of field data as integer [0-3]
14017 "Returns type of field data"
14018 return EnumToLong(self.field.GetDataType(self))
14020 ## Returns type of field data:
14021 # one of GEOM.FDT_Bool, GEOM.FDT_Int, GEOM.FDT_Double, GEOM.FDT_String
14022 def getTypeEnum(self):
14023 "Returns type of field data"
14024 return self.field.GetDataType(self)
14026 ## Returns dimension of the shape the field lies on:
14027 # 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
14028 def getDimension(self):
14029 """Returns dimension of the shape the field lies on:
14030 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape"""
14031 return self.field.GetDimension(self)
14033 ## Returns names of components
14034 def getComponents(self):
14035 "Returns names of components"
14036 return self.field.GetComponents(self)
14038 ## Adds a time step to the field
14039 # @param step the time step number further used as the step identifier
14040 # @param stamp the time step time
14041 # @param values the values of the time step
14042 def addStep(self, step, stamp, values):
14043 "Adds a time step to the field"
14044 stp = self.field.AddStep( self, step, stamp )
14046 raise RuntimeError("Field.addStep() : Error: step %s already exists in this field"%step)
14048 geom._autoPublish( stp, "", "Step %s, %s"%(step,stamp))
14049 self.setValues( step, values )
14052 ## Remove a time step from the field
14053 def removeStep(self,step):
14054 "Remove a time step from the field"
14057 stepObj = self.field.GetStep( self, step )
14059 stepSO = geom.myStudy.FindObjectID( stepObj.GetStudyEntry() )
14062 #traceback.print_exc()
14064 self.field.RemoveStep( self, step )
14066 geom.myBuilder.RemoveObjectWithChildren( stepSO )
14069 ## Returns number of time steps in the field
14070 def countSteps(self):
14071 "Returns number of time steps in the field"
14072 return self.field.CountSteps(self)
14074 ## Returns a list of time step IDs in the field
14075 def getSteps(self):
14076 "Returns a list of time step IDs in the field"
14077 return self.field.GetSteps(self)
14079 ## Returns a time step by its ID
14080 def getStep(self,step):
14081 "Returns a time step by its ID"
14082 stp = self.field.GetStep(self, step)
14084 raise RuntimeError("Step %s is missing from this field"%step)
14087 ## Returns the time of the field step
14088 def getStamp(self,step):
14089 "Returns the time of the field step"
14090 return self.getStep(step).GetStamp()
14092 ## Changes the time of the field step
14093 def setStamp(self, step, stamp):
14094 "Changes the time of the field step"
14095 return self.getStep(step).SetStamp(stamp)
14097 ## Returns values of the field step
14098 def getValues(self, step):
14099 "Returns values of the field step"
14100 return self.getStep(step).GetValues()
14102 ## Changes values of the field step
14103 def setValues(self, step, values):
14104 "Changes values of the field step"
14105 stp = self.getStep(step)
14106 errBeg = "Field.setValues(values) : Error: "
14108 ok = stp.SetValues( values )
14109 except Exception as e:
14111 if excStr.find("WrongPythonType") > 0:
14112 raise RuntimeError(errBeg +\
14113 "wrong type of values, %s values are expected"%str(self.getTypeEnum())[4:])
14114 raise RuntimeError(errBeg + str(e))
14116 nbOK = self.field.GetArraySize(self)
14119 raise RuntimeError(errBeg + "len(values) must be %s but not %s"%(nbOK,nbKO))
14121 raise RuntimeError(errBeg + "failed")
14124 pass # end of class geomField
14126 # Register the new proxy for GEOM_Field
14127 omniORB.registerObjref(GEOM._objref_GEOM_Field._NP_RepositoryId, geomField)
14130 ## Create a new geomBuilder instance.The geomBuilder class provides the Python
14131 # interface to GEOM operations.
14136 # salome.salome_init()
14137 # from salome.geom import geomBuilder
14138 # geompy = geomBuilder.New()
14140 # @param instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
14141 # @return geomBuilder instance
14142 def New( instance=None):
14144 Create a new geomBuilder instance.The geomBuilder class provides the Python
14145 interface to GEOM operations.
14149 salome.salome_init()
14150 from salome.geom import geomBuilder
14151 geompy = geomBuilder.New()
14154 instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
14156 geomBuilder instance
14158 #print "New geomBuilder ", study, instance
14162 if instance and isinstance( instance, SALOMEDS._objref_Study ):
14164 sys.stderr.write("Warning: 'study' argument is no more needed in geomBuilder.New(). Consider updating your script!!!\n\n")
14169 geom = geomBuilder()
14170 assert isinstance(geom,geomBuilder), "Geom engine class is %s but should be geomBuilder.geomBuilder. Import geomBuilder before creating the instance."%geom.__class__
14175 # Register methods from the plug-ins in the geomBuilder class
14176 plugins_var = os.environ.get( "GEOM_PluginsList" )
14179 if plugins_var is not None:
14180 plugins = plugins_var.split( ":" )
14181 plugins=[x for x in plugins if len(x)>0]
14182 if plugins is not None:
14183 for pluginName in plugins:
14184 pluginBuilderName = pluginName + "Builder"
14186 exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
14187 except Exception as e:
14188 from salome_utils import verbose
14189 print("Exception while loading %s: %s" % ( pluginBuilderName, e ))
14191 exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
14192 plugin = eval( pluginBuilderName )
14194 # add methods from plugin module to the geomBuilder class
14195 for k in dir( plugin ):
14196 if k[0] == '_': continue
14197 method = getattr( plugin, k )
14198 if type( method ).__name__ == 'function':
14199 if not hasattr( geomBuilder, k ):
14200 setattr( geomBuilder, k, method )