1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # GEOM GEOM_SWIG : binding of C++ implementation with Python
22 # File : geomBuilder.py
23 # Author : Paul RASCLE, EDF
27 \namespace geomBuilder
28 \brief Module geomBuilder
32 ## @defgroup geomBuilder geomBuilder Python module
37 ## By default, all functions of geomBuilder Python module do not publish
38 ## resulting geometrical objects. This can be done in the Python script
39 ## by means of \ref geomBuilder.geomBuilder.addToStudy() "addToStudy()"
40 ## or \ref geomBuilder.geomBuilder.addToStudyInFather() "addToStudyInFather()"
43 ## However, it is possible to publish result data in the study
44 ## automatically. For this, almost each function of
45 ## \ref geomBuilder.geomBuilder "geomBuilder" class has
46 ## an additional @a theName parameter (@c None by default).
47 ## As soon as non-empty string value is passed to this parameter,
48 ## the result object is published in the study automatically.
50 ## For example, consider the following Python script:
54 ## from salome.geom import geomBuilder
55 ## geompy = geomBuilder.New()
56 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100) # box is not published in the study yet
57 ## geompy.addToStudy(box, "box") # explicit publishing
60 ## Last two lines can be replaced by one-line instruction:
63 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100, theName="box") # box is published in the study with "box" name
69 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100, "box") # box is published in the study with "box" name
72 ## Note, that some functions produce more than one geometrical objects. For example,
73 ## \ref geomBuilder.geomBuilder.GetNonBlocks() "GetNonBlocks()" function returns two objects:
74 ## group of all non-hexa solids and group of all non-quad faces.
75 ## For such functions it is possible to specify separate names for results.
80 ## # create and publish cylinder
81 ## cyl = geompy.MakeCylinderRH(100, 100, "cylinder")
82 ## # get non blocks from cylinder
83 ## g1, g2 = geompy.GetNonBlocks(cyl, theName="nonblock")
86 ## Above example will publish both result compounds (first with non-hexa solids and
87 ## second with non-quad faces) as two items, both named "nonblock".
88 ## However, if second command is invoked as
91 ## g1, g2 = geompy.GetNonBlocks(cyl, theName=("nonhexa", "nonquad"))
94 ## ... the first compound will be published with "nonhexa" name, and second will be named "nonquad".
96 ## Automatic publication of all results can be also enabled/disabled by means of the function
97 ## \ref geomBuilder.geomBuilder.addToStudyAuto() "addToStudyAuto()". The automatic publishing
98 ## is managed by the numeric parameter passed to this function:
99 ## - if @a maxNbSubShapes = 0, automatic publishing is disabled.
100 ## - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
101 ## maximum number of sub-shapes allowed for publishing is unlimited; any negative
102 ## value passed as parameter has the same effect.
103 ## - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
104 ## maximum number of sub-shapes allowed for publishing is set to specified value.
106 ## When automatic publishing is enabled, you even do not need to pass @a theName parameter
107 ## to the functions creating objects, instead default names will be used. However, you
108 ## can always change the behavior, by passing explicit name to the @a theName parameter
109 ## and it will be used instead default one.
110 ## The publishing of the collections of objects will be done according to the above
111 ## mentioned rules (maximum allowed number of sub-shapes).
117 ## from salome.geom import geomBuilder
118 ## geompy = geomBuilder.New()
119 ## geompy.addToStudyAuto() # enable automatic publication
120 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100)
121 ## # the box is created and published in the study with default name
122 ## geompy.addToStudyAuto(5) # set max allowed number of sub-shapes to 5
123 ## vertices = geompy.SubShapeAll(box, geomBuilder.ShapeType['VERTEX'])
124 ## # only 5 first vertices will be published, with default names
125 ## print len(vertices)
126 ## # note, that result value still contains all 8 vertices
127 ## geompy.addToStudyAuto(-1) # disable automatic publication
130 ## This feature can be used, for example, for debugging purposes.
133 ## - Use automatic publication feature with caution. When it is enabled, any function of
134 ## \ref geomBuilder.geomBuilder "geomBuilder" class publishes the results in the study,
135 ## that can lead to the huge size of the study data tree.
136 ## For example, repeating call of \ref geomBuilder.geomBuilder.SubShapeAll() "SubShapeAll()"
137 ## command on the same main shape each time will publish all child objects, that will lead
138 ## to a lot of duplicated items in the study.
139 ## - Sub-shapes are automatically published as child items of the parent main shape in the study if main
140 ## shape was also published before. Otherwise, sub-shapes are published as top-level objects.
141 ## - Some functions of \ref geomBuilder.geomBuilder "geomBuilder" class do not have
142 ## \a theName parameter (and, thus, do not support automatic publication).
143 ## For example, some transformation operations like
144 ## \ref geomBuilder.geomBuilder.TranslateDXDYDZ() "TranslateDXDYDZ()".
145 ## Refer to the documentation to check if some function has such possibility.
147 ## It is possible to customize the representation of the geometrical
148 ## data in the data tree; this can be done by using folders. A folder can
149 ## be created in the study tree using function
150 ## \ref geomBuilder.geomBuilder.NewFolder() "NewFolder()"
151 ## (by default it is created under the "Geometry" root object).
152 ## As soon as folder is created, any published geometry object
153 ## can be moved into it.
159 ## from salome.geom import geomBuilder
160 ## geompy = geomBuilder.New()
161 ## box = geompy.MakeBoxDXDYDZ(100, 100, 100, "Box")
162 ## # the box was created and published in the study
163 ## folder = geompy.NewFolder("Primitives")
164 ## # an empty "Primitives" folder was created under default "Geometry" root object
165 ## geompy.PutToFolder(box, folder)
166 ## # the box was moved into "Primitives" folder
169 ## Subfolders are also can be created by specifying another folder as a parent:
172 ## subfolder = geompy.NewFolder("3D", folder)
173 ## # "3D" folder was created under "Primitives" folder
177 ## - Folder container is just a representation layer object that
178 ## deals with already published objects only. So, any geometry object
179 ## should be published in the study (for example, with
180 ## \ref geomBuilder.geomBuilder.PutToFolder() "addToStudy()" function)
181 ## BEFORE moving it into any existing folder.
182 ## - \ref geomBuilder.geomBuilder.PutToFolder() "PutToFolder()" function
183 ## does not change physical position of geometry object in the study tree,
184 ## it only affects on the representation of the data tree.
185 ## - It is impossible to publish geometry object using any folder as father.
187 ## \defgroup l1_publish_data
188 ## \defgroup l1_geomBuilder_auxiliary
189 ## \defgroup l1_geomBuilder_purpose
192 ## @defgroup l1_publish_data Publishing results in SALOME study
194 ## @defgroup l1_geomBuilder_auxiliary Auxiliary data structures and methods
196 ## @defgroup l1_geomBuilder_purpose All package methods, grouped by their purpose
198 ## @defgroup l2_import_export Importing/exporting geometrical objects
199 ## @defgroup l2_creating Creating geometrical objects
201 ## @defgroup l3_basic_go Creating Basic Geometric Objects
203 ## @defgroup l4_curves Creating Curves
206 ## @defgroup l3_3d_primitives Creating 3D Primitives
207 ## @defgroup l3_complex Creating Complex Objects
208 ## @defgroup l3_groups Working with groups
209 ## @defgroup l3_blocks Building by blocks
211 ## @defgroup l4_blocks_measure Check and Improve
214 ## @defgroup l3_sketcher Sketcher
215 ## @defgroup l3_advanced Creating Advanced Geometrical Objects
217 ## @defgroup l4_decompose Decompose objects
218 ## @defgroup l4_decompose_d Decompose objects deprecated methods
219 ## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
220 ## @defgroup l4_obtain Access to sub-shapes by a criteria
221 ## @defgroup l4_advanced Advanced objects creation functions
226 ## @defgroup l2_transforming Transforming geometrical objects
228 ## @defgroup l3_basic_op Basic Operations
229 ## @defgroup l3_boolean Boolean Operations
230 ## @defgroup l3_transform Transformation Operations
231 ## @defgroup l3_transform_d Transformation Operations deprecated methods
232 ## @defgroup l3_local Local Operations (Fillet, Chamfer and other Features)
233 ## @defgroup l3_blocks_op Blocks Operations
234 ## @defgroup l3_healing Repairing Operations
235 ## @defgroup l3_restore_ss Restore presentation parameters and a tree of sub-shapes
238 ## @defgroup l2_measure Using measurement tools
239 ## @defgroup l2_field Field on Geometry
240 ## @defgroup l2_testing Testing
246 # initialize SALOME session in try/except block
247 # to avoid problems in some cases, e.g. when generating documentation
255 from salome_notebook import *
262 from salome.geom.gsketcher import Sketcher3D, Sketcher2D, Polyline2D
263 from salome.geom.canonicalrecognition import CanonicalRecognition
265 # In case the omniORBpy EnumItem class does not fully support Python 3
266 # (for instance in version 4.2.1-2), the comparison ordering methods must be
270 GEOM.COMPOUND < GEOM.SOLID
272 def enumitem_eq(self, other):
274 if isinstance(other, omniORB.EnumItem):
275 if other._parent_id == self._parent_id:
276 return self._v == other._v
278 return self._parent_id == other._parent_id
280 return id(self) == id(other)
282 return id(self) == id(other)
284 def enumitem_lt(self, other):
286 if isinstance(other, omniORB.EnumItem):
287 if other._parent_id == self._parent_id:
288 return self._v < other._v
290 return self._parent_id < other._parent_id
292 return id(self) < id(other)
294 return id(self) < id(other)
296 def enumitem_le(self, other):
298 if isinstance(other, omniORB.EnumItem):
299 if other._parent_id == self._parent_id:
300 return self._v <= other._v
302 return self._parent_id <= other._parent_id
304 return id(self) <= id(other)
306 return id(self) <= id(other)
308 def enumitem_gt(self, other):
310 if isinstance(other, omniORB.EnumItem):
311 if other._parent_id == self._parent_id:
312 return self._v > other._v
314 return self._parent_id > other._parent_id
316 return id(self) > id(other)
318 return id(self) > id(other)
320 def enumitem_ge(self, other):
322 if isinstance(other, omniORB.EnumItem):
323 if other._parent_id == self._parent_id:
324 return self._v >= other._v
326 return self._parent_id >= other._parent_id
328 return id(self) >= id(other)
330 return id(self) >= id(other)
332 GEOM.omniORB.EnumItem.__eq__ = enumitem_eq
333 GEOM.omniORB.EnumItem.__lt__ = enumitem_lt
334 GEOM.omniORB.EnumItem.__le__ = enumitem_le
335 GEOM.omniORB.EnumItem.__gt__ = enumitem_gt
336 GEOM.omniORB.EnumItem.__ge__ = enumitem_ge
337 omniORB.EnumItem.__eq__ = enumitem_eq
338 omniORB.EnumItem.__lt__ = enumitem_lt
339 omniORB.EnumItem.__le__ = enumitem_le
340 omniORB.EnumItem.__gt__ = enumitem_gt
341 omniORB.EnumItem.__ge__ = enumitem_ge
344 def _toListOfNames(_names, _size=-1):
347 if type(_names) in [list, tuple]:
348 for i in _names: l.append(i)
351 if l and len(l) < _size:
352 for i in range(len(l), _size): l.append("%s_%d"%(l[0],i))
355 # Decorator function to manage transactions for all geometric operations.
356 def ManageTransactions(theOpeName):
357 def MTDecorator(theFunction):
358 # To keep the original function name an documentation.
359 @functools.wraps(theFunction)
360 def OpenCallClose(self, *args, **kwargs):
362 anOperation = getattr(self, theOpeName)
363 anOperation.StartOperation()
366 res = theFunction(self, *args, **kwargs)
368 anOperation.FinishOperation()
372 anOperation.AbortOperation()
377 ## Raise an Error, containing the Method_name, if Operation is Failed
378 ## @ingroup l1_geomBuilder_auxiliary
379 def RaiseIfFailed (Method_name, Operation):
380 if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
381 raise RuntimeError(Method_name + " : " + Operation.GetErrorCode())
383 def PrintOrRaise(message, raiseException=False):
385 raise RuntimeError(message)
389 ## Return list of variables value from salome notebook
390 ## @ingroup l1_geomBuilder_auxiliary
391 def ParseParameters(*parameters):
394 for parameter in parameters:
395 if isinstance(parameter, list):
396 lResults = ParseParameters(*parameter)
397 if len(lResults) > 0:
398 Result.append(lResults[:-1])
399 StringResult += lResults[-1].split(":")
403 if isinstance(parameter,str):
404 if notebook.isVariable(parameter):
405 Result.append(notebook.get(parameter))
407 raise RuntimeError("Variable with name '" + parameter + "' doesn't exist!!!")
410 Result.append(parameter)
412 StringResult.append(str(parameter))
416 Result.append(":".join(StringResult))
418 Result = ":".join(StringResult)
421 ## Return list of variables value from salome notebook
422 ## @ingroup l1_geomBuilder_auxiliary
426 for parameter in list:
427 if isinstance(parameter,str) and notebook.isVariable(parameter):
428 Result.append(str(notebook.get(parameter)))
431 Result.append(str(parameter))
434 StringResult = StringResult + str(parameter)
435 StringResult = StringResult + ":"
437 StringResult = StringResult[:len(StringResult)-1]
438 return Result, StringResult
440 ## Return list of variables value from salome notebook
441 ## @ingroup l1_geomBuilder_auxiliary
442 def ParseSketcherCommand(command):
445 sections = command.split(":")
446 for section in sections:
447 parameters = section.split(" ")
449 for parameter in parameters:
450 if paramIndex > 1 and parameter.find("'") != -1:
451 parameter = parameter.replace("'","")
452 if notebook.isVariable(parameter):
453 Result = Result + str(notebook.get(parameter)) + " "
456 raise RuntimeError("Variable with name '" + parameter + "' doesn't exist!!!")
460 Result = Result + str(parameter) + " "
463 StringResult = StringResult + parameter
464 StringResult = StringResult + ":"
466 paramIndex = paramIndex + 1
468 Result = Result[:len(Result)-1] + ":"
470 Result = Result[:len(Result)-1]
471 return Result, StringResult
473 ## Helper function which can be used to pack the passed string to the byte data.
474 ## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
475 ## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
478 ## val = PackData("10001110") # val = 0xAE
479 ## val = PackData("1") # val = 0x80
481 ## @param data unpacked data - a string containing '1' and '0' symbols
482 ## @return data packed to the byte stream
483 ## @ingroup l1_geomBuilder_auxiliary
486 Helper function which can be used to pack the passed string to the byte data.
487 Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
488 If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
491 data unpacked data - a string containing '1' and '0' symbols
494 data packed to the byte stream
497 val = PackData("10001110") # val = 0xAE
498 val = PackData("1") # val = 0x80
501 if len(data)%8: bytes += 1
503 for b in range(bytes):
504 d = data[b*8:(b+1)*8]
509 if d[i] == "1": val += 1
511 raise "Invalid symbol %s" % d[i]
518 ## Read bitmap texture from the text file.
519 ## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
520 ## A zero symbol ('0') represents transparent pixel of the texture bitmap.
521 ## The function returns width and height of the pixmap in pixels and byte stream representing
522 ## texture bitmap itself.
524 ## This function can be used to read the texture to the byte stream in order to pass it to
525 ## the AddTexture() function of geomBuilder class.
528 ## from salome.geom import geomBuilder
529 ## geompy = geomBuilder.New()
530 ## texture = geompy.readtexture('mytexture.dat')
531 ## texture = geompy.AddTexture(*texture)
532 ## obj.SetMarkerTexture(texture)
534 ## @param fname texture file name
535 ## @return sequence of tree values: texture's width, height in pixels and its byte stream
536 ## @ingroup l1_geomBuilder_auxiliary
537 def ReadTexture(fname):
539 Read bitmap texture from the text file.
540 In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
541 A zero symbol ('0') represents transparent pixel of the texture bitmap.
542 The function returns width and height of the pixmap in pixels and byte stream representing
543 texture bitmap itself.
544 This function can be used to read the texture to the byte stream in order to pass it to
545 the AddTexture() function of geomBuilder class.
548 fname texture file name
551 sequence of tree values: texture's width, height in pixels and its byte stream
554 from salome.geom import geomBuilder
555 geompy = geomBuilder.New()
556 texture = geompy.readtexture('mytexture.dat')
557 texture = geompy.AddTexture(*texture)
558 obj.SetMarkerTexture(texture)
562 lines = [ l.strip() for l in f.readlines()]
565 if lines: maxlen = max([len(x) for x in lines])
567 if maxlen%8: lenbytes += 1
571 lenline = (len(line)/8+1)*8
574 lenline = (len(line)/8)*8
576 for i in range(lenline/8):
579 if i*8+j < len(line) and line[i*8+j] != "0": byte += "1"
582 bytedata += PackData(byte)
584 for i in range(lenline/8, lenbytes):
585 bytedata += PackData("0")
587 return lenbytes*8, len(lines), bytedata
592 ## Returns a long value from enumeration type
593 # Can be used for CORBA enumerator types like GEOM.shape_type
594 # @param theItem enumeration type
595 # @ingroup l1_geomBuilder_auxiliary
596 def EnumToLong(theItem):
598 Returns a long value from enumeration type
599 Can be used for CORBA enumerator types like geomBuilder.ShapeType
602 theItem enumeration type
605 if hasattr(theItem, "_v"): ret = theItem._v
608 ## Pack an argument into a list
610 if isinstance( arg, list ):
612 if hasattr( arg, "__getitem__" ):
616 ## Information about closed/unclosed state of shell or wire
617 # @ingroup l1_geomBuilder_auxiliary
620 Information about closed/unclosed state of shell or wire
626 ## Private class used to bind calls of plugin operations to geomBuilder
627 class PluginOperation:
628 def __init__(self, operation, function):
629 self.operation = operation
630 self.function = function
633 @ManageTransactions("operation")
634 def __call__(self, *args):
635 res = self.function(self.operation, *args)
636 RaiseIfFailed(self.function.__name__, self.operation)
639 # Warning: geom is a singleton
645 class geomBuilder(GEOM._objref_GEOM_Gen):
647 ## Enumeration ShapeType as a dictionary. \n
648 ## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details.
649 # @ingroup l1_geomBuilder_auxiliary
650 ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8, "FLAT":9}
652 ## Kinds of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
653 # and a list of parameters, describing the shape.
654 # List of parameters, describing the shape:
655 # - COMPOUND: [nb_solids nb_faces nb_edges nb_vertices]
656 # - COMPSOLID: [nb_solids nb_faces nb_edges nb_vertices]
658 # - SHELL: [info.CLOSED / info.UNCLOSED nb_faces nb_edges nb_vertices]
660 # - WIRE: [info.CLOSED / info.UNCLOSED nb_edges nb_vertices]
662 # - SPHERE: [xc yc zc R]
663 # - CYLINDER: [xb yb zb dx dy dz R H]
664 # - BOX: [xc yc zc ax ay az]
665 # - ROTATED_BOX: [xc yc zc zx zy zz xx xy xz ax ay az]
666 # - TORUS: [xc yc zc dx dy dz R_1 R_2]
667 # - CONE: [xb yb zb dx dy dz R_1 R_2 H]
668 # - POLYHEDRON: [nb_faces nb_edges nb_vertices]
669 # - SOLID: [nb_faces nb_edges nb_vertices]
671 # - SPHERE2D: [xc yc zc R]
672 # - CYLINDER2D: [xb yb zb dx dy dz R H]
673 # - TORUS2D: [xc yc zc dx dy dz R_1 R_2]
674 # - CONE2D: [xc yc zc dx dy dz R_1 R_2 H]
675 # - DISK_CIRCLE: [xc yc zc dx dy dz R]
676 # - DISK_ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
677 # - POLYGON: [xo yo zo dx dy dz nb_edges nb_vertices]
678 # - PLANE: [xo yo zo dx dy dz]
679 # - PLANAR: [xo yo zo dx dy dz nb_edges nb_vertices]
680 # - FACE: [nb_edges nb_vertices]
682 # - CIRCLE: [xc yc zc dx dy dz R]
683 # - ARC_CIRCLE: [xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2]
684 # - ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
685 # - ARC_ELLIPSE: [xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2]
686 # - LINE: [xo yo zo dx dy dz]
687 # - SEGMENT: [x1 y1 z1 x2 y2 z2]
688 # - EDGE: [nb_vertices]
692 # - LCS: [x y z xx xy xz yx yy yz zx zy zz]
693 # @ingroup l1_geomBuilder_auxiliary
694 kind = GEOM.GEOM_IKindOfShape
696 def __new__(cls, *args):
701 #print "==== __new__ ", engine, geom, doLcc, created
703 # geom engine is either retrieved from engine, or created
705 # Following test avoids a recursive loop
708 # geom engine not created: existing engine found
710 if doLcc and not created:
712 # FindOrLoadComponent called:
713 # 1. CORBA resolution of server
714 # 2. the __new__ method is called again
715 #print "==== FindOrLoadComponent ", engine, geom, doLcc, created
716 geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" )
719 # FindOrLoadComponent not called
721 # geomBuilder instance is created from lcc.FindOrLoadComponent
722 #print "==== super ", engine, geom, doLcc, created
723 geom = super(geomBuilder,cls).__new__(cls)
726 # geom engine not created: existing engine found
727 #print "==== existing ", engine, geom, doLcc, created
729 #print "return geom 1 ", geom
732 #print "return geom 2 ", geom
735 def __init__(self, *args):
737 #print "-------- geomBuilder __init__ --- ", created, self
740 GEOM._objref_GEOM_Gen.__init__(self, *args)
741 self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
742 self.myBuilder = None
759 ## Process object publication in the study, as follows:
760 # - if @a theName is specified (not None), the object is published in the study
761 # with this name, not taking into account "auto-publishing" option;
762 # - if @a theName is NOT specified, the object is published in the study
763 # (using default name, which can be customized using @a theDefaultName parameter)
764 # only if auto-publishing is switched on.
766 # @param theObj object, a subject for publishing
767 # @param theName object name for study
768 # @param theDefaultName default name for the auto-publishing
770 # @sa addToStudyAuto()
771 def _autoPublish(self, theObj, theName, theDefaultName="noname"):
773 def _item_name(_names, _defname, _idx=-1):
774 if not _names: _names = _defname
775 if type(_names) in [list, tuple]:
777 if _idx >= len(_names) or not _names[_idx]:
778 if type(_defname) not in [list, tuple]:
779 _name = "%s_%d"%(_defname, _idx+1)
780 elif len(_defname) > 0 and _idx >= 0 and _idx < len(_defname):
781 _name = _defname[_idx]
783 _name = "%noname_%d"%(dn, _idx+1)
789 # must be wrong usage
794 _name = "%s_%d"%(_names, _idx+1)
800 def _publish( _name, _obj ):
802 if isinstance( _obj, GEOM._objref_GEOM_Field ):
803 fatherObj = _obj.GetShape()
804 elif isinstance( _obj, GEOM._objref_GEOM_FieldStep ):
805 fatherObj = _obj.GetField()
806 elif not _obj.IsMainShape():
807 fatherObj = _obj.GetMainShape()
809 if fatherObj and fatherObj.GetStudyEntry():
810 self.addToStudyInFather(fatherObj, _obj, _name)
812 self.addToStudy(_obj, _name)
818 if not theName and not self.myMaxNbSubShapesAllowed:
819 return # nothing to do: auto-publishing is disabled
820 if not theName and not theDefaultName:
821 return # neither theName nor theDefaultName is given
823 if type(theObj) in [list, tuple]:
824 # list of objects is being published
827 if not obj: continue # bad object
828 name = _item_name(theName, theDefaultName, idx)
829 _publish( name, obj )
831 if not theName and idx == self.myMaxNbSubShapesAllowed: break
835 # single object is published
836 name = _item_name(theName, theDefaultName)
837 _publish( name, theObj )
840 ## @addtogroup l1_geomBuilder_auxiliary
843 self.myStudy = salome.myStudy
844 self.myBuilder = self.myStudy.NewBuilder()
846 # load data from the study file, if necessary
847 component = self.myStudy.FindComponent("GEOM")
849 self.myBuilder.LoadWith(component, self)
851 self.BasicOp = self.GetIBasicOperations ()
852 self.CurvesOp = self.GetICurvesOperations ()
853 self.PrimOp = self.GetI3DPrimOperations ()
854 self.ShapesOp = self.GetIShapesOperations ()
855 self.HealOp = self.GetIHealingOperations ()
856 self.InsertOp = self.GetIInsertOperations ()
857 self.BoolOp = self.GetIBooleanOperations ()
858 self.TrsfOp = self.GetITransformOperations()
859 self.LocalOp = self.GetILocalOperations ()
860 self.MeasuOp = self.GetIMeasureOperations ()
861 self.BlocksOp = self.GetIBlocksOperations ()
862 self.GroupOp = self.GetIGroupOperations ()
863 self.FieldOp = self.GetIFieldOperations ()
864 self.TestOp = self.GetITestOperations ()
866 notebook.myStudy = self.myStudy
869 def GetPluginOperations(self, libraryName):
870 op = GEOM._objref_GEOM_Gen.GetPluginOperations(self, libraryName)
873 ## Enable / disable results auto-publishing
875 # The automatic publishing is managed in the following way:
876 # - if @a maxNbSubShapes = 0, automatic publishing is disabled.
877 # - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
878 # maximum number of sub-shapes allowed for publishing is unlimited; any negative
879 # value passed as parameter has the same effect.
880 # - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
881 # maximum number of sub-shapes allowed for publishing is set to specified value.
883 # @param maxNbSubShapes maximum number of sub-shapes allowed for publishing.
884 # @ingroup l1_publish_data
885 def addToStudyAuto(self, maxNbSubShapes=-1):
887 Enable / disable results auto-publishing
889 The automatic publishing is managed in the following way:
890 - if @a maxNbSubShapes = 0, automatic publishing is disabled;
891 - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
892 maximum number of sub-shapes allowed for publishing is unlimited; any negative
893 value passed as parameter has the same effect.
894 - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
895 maximum number of sub-shapes allowed for publishing is set to this value.
898 maxNbSubShapes maximum number of sub-shapes allowed for publishing.
901 geompy.addToStudyAuto() # enable auto-publishing
902 geompy.MakeBoxDXDYDZ(100) # box is created and published with default name
903 geompy.addToStudyAuto(0) # disable auto-publishing
905 self.myMaxNbSubShapesAllowed = max(-1, maxNbSubShapes)
908 ## Dump component to the Python script
909 # This method overrides IDL function to allow default values for the parameters.
910 def DumpPython(self, theIsPublished=True, theIsMultiFile=True):
912 Dump component to the Python script
913 This method overrides IDL function to allow default values for the parameters.
915 return GEOM._objref_GEOM_Gen.DumpPython(self, theIsPublished, theIsMultiFile)
917 ## Get name for sub-shape aSubObj of shape aMainObj
919 # @ref swig_SubShapeName "Example"
920 @ManageTransactions("ShapesOp")
921 def SubShapeName(self,aSubObj, aMainObj):
923 Get name for sub-shape aSubObj of shape aMainObj
925 # Example: see GEOM_TestAll.py
927 #aSubId = orb.object_to_string(aSubObj)
928 #aMainId = orb.object_to_string(aMainObj)
929 #index = gg.getIndexTopology(aSubId, aMainId)
930 #name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
931 index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
932 name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
935 ## Publish in study aShape with name aName
937 # \param aShape the shape to be published
938 # \param aName the name for the shape
939 # \param doRestoreSubShapes if True, finds and publishes also
940 # sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
941 # and published sub-shapes of arguments
942 # \param theArgs,theFindMethod,theInheritFirstArg see RestoreSubShapes() for
943 # these arguments description
944 # \return study entry of the published shape in form of string
946 # @ingroup l1_publish_data
947 # @ref swig_all_addtostudy "Example"
948 def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
949 theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
951 Publish in study aShape with name aName
954 aShape the shape to be published
955 aName the name for the shape
956 doRestoreSubShapes if True, finds and publishes also
957 sub-shapes of aShape, corresponding to its arguments
958 and published sub-shapes of arguments
959 theArgs,theFindMethod,theInheritFirstArg see geompy.RestoreSubShapes() for
960 these arguments description
963 study entry of the published shape in form of string
966 id_block1 = geompy.addToStudy(Block1, "Block 1")
968 # Example: see GEOM_TestAll.py
970 aSObject = self.AddInStudy(aShape, aName, None)
971 if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
972 if doRestoreSubShapes:
973 self.RestoreSubShapesSO(aSObject, theArgs,
974 theFindMethod, theInheritFirstArg, True )
976 print("addToStudy() failed")
978 return aShape.GetStudyEntry()
980 ## Publish in study aShape with name aName as sub-object of previously published aFather
981 # \param aFather previously published object
982 # \param aShape the shape to be published as sub-object of <VAR>aFather</VAR>
983 # \param aName the name for the shape
985 # \return study entry of the published shape in form of string
987 # @ingroup l1_publish_data
988 # @ref swig_all_addtostudyInFather "Example"
989 def addToStudyInFather(self, aFather, aShape, aName):
991 Publish in study aShape with name aName as sub-object of previously published aFather
994 aFather previously published object
995 aShape the shape to be published as sub-object of aFather
996 aName the name for the shape
999 study entry of the published shape in form of string
1001 # Example: see GEOM_TestAll.py
1003 aSObject = self.AddInStudy(aShape, aName, aFather)
1004 if aSObject and aName: aSObject.SetAttrString("AttributeName", aName)
1006 print("addToStudyInFather() failed")
1008 return aShape.GetStudyEntry()
1010 ## Unpublish object in study
1012 # \param obj the object to be unpublished
1013 def hideInStudy(self, obj):
1015 Unpublish object in study
1018 obj the object to be unpublished
1020 ior = salome.orb.object_to_string(obj)
1021 aSObject = self.myStudy.FindObjectIOR(ior)
1022 if aSObject is not None:
1023 genericAttribute = self.myBuilder.FindOrCreateAttribute(aSObject, "AttributeDrawable")
1024 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
1025 drwAttribute.SetDrawable(False)
1026 # hide references if any
1027 vso = self.myStudy.FindDependances(aSObject);
1029 genericAttribute = self.myBuilder.FindOrCreateAttribute(refObj, "AttributeDrawable")
1030 drwAttribute = genericAttribute._narrow(SALOMEDS.AttributeDrawable)
1031 drwAttribute.SetDrawable(False)
1035 # end of l1_geomBuilder_auxiliary
1038 ## @addtogroup l3_restore_ss
1041 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
1042 # To be used from python scripts out of addToStudy() (non-default usage)
1043 # \param theObject published GEOM.GEOM_Object, arguments of which will be published
1044 # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1045 # If this list is empty, all operation arguments will be published
1046 # \param theFindMethod method to search sub-shapes, corresponding to arguments and
1047 # their sub-shapes. Value from enumeration GEOM.find_shape_method.
1048 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
1049 # Do not publish sub-shapes in place of arguments, but only
1050 # in place of sub-shapes of the first argument,
1051 # because the whole shape corresponds to the first argument.
1052 # Mainly to be used after transformations, but it also can be
1053 # useful after partition with one object shape, and some other
1054 # operations, where only the first argument has to be considered.
1055 # If theObject has only one argument shape, this flag is automatically
1056 # considered as True, not regarding really passed value.
1057 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
1058 # and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1059 # \return list of published sub-shapes
1061 # @ref tui_restore_prs_params "Example"
1062 def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
1063 theInheritFirstArg=False, theAddPrefix=True):
1065 Publish sub-shapes, standing for arguments and sub-shapes of arguments
1066 To be used from python scripts out of geompy.addToStudy (non-default usage)
1069 theObject published GEOM.GEOM_Object, arguments of which will be published
1070 theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1071 If this list is empty, all operation arguments will be published
1072 theFindMethod method to search sub-shapes, corresponding to arguments and
1073 their sub-shapes. Value from enumeration GEOM.find_shape_method.
1074 theInheritFirstArg set properties of the first argument for theObject.
1075 Do not publish sub-shapes in place of arguments, but only
1076 in place of sub-shapes of the first argument,
1077 because the whole shape corresponds to the first argument.
1078 Mainly to be used after transformations, but it also can be
1079 useful after partition with one object shape, and some other
1080 operations, where only the first argument has to be considered.
1081 If theObject has only one argument shape, this flag is automatically
1082 considered as True, not regarding really passed value.
1083 theAddPrefix add prefix "from_" to names of restored sub-shapes,
1084 and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1086 list of published sub-shapes
1088 # Example: see GEOM_TestAll.py
1089 return self.RestoreSubShapesO(theObject, theArgs,
1090 theFindMethod, theInheritFirstArg, theAddPrefix)
1092 ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
1093 # To be used from python scripts out of addToStudy() (non-default usage)
1094 # \param theObject published GEOM.GEOM_Object, arguments of which will be published
1095 # \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1096 # If this list is empty, all operation arguments will be published
1097 # \param theFindMethod method to search sub-shapes, corresponding to arguments and
1098 # their sub-shapes. Value from enumeration GEOM::find_shape_method.
1099 # \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
1100 # Do not publish sub-shapes in place of arguments, but only
1101 # in place of sub-shapes of the first argument,
1102 # because the whole shape corresponds to the first argument.
1103 # Mainly to be used after transformations, but it also can be
1104 # useful after partition with one object shape, and some other
1105 # operations, where only the first argument has to be considered.
1106 # If theObject has only one argument shape, this flag is automatically
1107 # considered as True, not regarding really passed value.
1108 # \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
1109 # and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1110 # \return list of published sub-shapes
1112 # @ref tui_restore_prs_params "Example"
1113 def RestoreGivenSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
1114 theInheritFirstArg=False, theAddPrefix=True):
1116 Publish sub-shapes, standing for arguments and sub-shapes of arguments
1117 To be used from python scripts out of geompy.addToStudy() (non-default usage)
1120 theObject published GEOM.GEOM_Object, arguments of which will be published
1121 theArgs list of GEOM.GEOM_Object, operation arguments to be published.
1122 If this list is empty, all operation arguments will be published
1123 theFindMethod method to search sub-shapes, corresponding to arguments and
1124 their sub-shapes. Value from enumeration GEOM::find_shape_method.
1125 theInheritFirstArg set properties of the first argument for theObject.
1126 Do not publish sub-shapes in place of arguments, but only
1127 in place of sub-shapes of the first argument,
1128 because the whole shape corresponds to the first argument.
1129 Mainly to be used after transformations, but it also can be
1130 useful after partition with one object shape, and some other
1131 operations, where only the first argument has to be considered.
1132 If theObject has only one argument shape, this flag is automatically
1133 considered as True, not regarding really passed value.
1134 theAddPrefix add prefix "from_" to names of restored sub-shapes,
1135 and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
1138 list of published sub-shapes
1140 # Example: see GEOM_TestAll.py
1141 return self.RestoreGivenSubShapesO(theObject, theArgs,
1142 theFindMethod, theInheritFirstArg, theAddPrefix)
1144 # end of l3_restore_ss
1147 ## @addtogroup l3_basic_go
1150 ## Create point by three coordinates.
1151 # @param theX The X coordinate of the point.
1152 # @param theY The Y coordinate of the point.
1153 # @param theZ The Z coordinate of the point.
1154 # @param theName Object name; when specified, this parameter is used
1155 # for result publication in the study. Otherwise, if automatic
1156 # publication is switched on, default value is used for result name.
1158 # @return New GEOM.GEOM_Object, containing the created point.
1160 # @ref tui_creation_point "Example"
1161 @ManageTransactions("BasicOp")
1162 def MakeVertex(self, theX, theY, theZ, theName=None):
1164 Create point by three coordinates.
1167 theX The X coordinate of the point.
1168 theY The Y coordinate of the point.
1169 theZ The Z coordinate of the point.
1170 theName Object name; when specified, this parameter is used
1171 for result publication in the study. Otherwise, if automatic
1172 publication is switched on, default value is used for result name.
1175 New GEOM.GEOM_Object, containing the created point.
1177 # Example: see GEOM_TestAll.py
1178 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
1179 anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
1180 RaiseIfFailed("MakePointXYZ", self.BasicOp)
1181 anObj.SetParameters(Parameters)
1182 self._autoPublish(anObj, theName, "vertex")
1185 ## Create a point, distant from the referenced point
1186 # on the given distances along the coordinate axes.
1187 # @param theReference The referenced point.
1188 # @param theX Displacement from the referenced point along OX axis.
1189 # @param theY Displacement from the referenced point along OY axis.
1190 # @param theZ Displacement from the referenced point along OZ axis.
1191 # @param theName Object name; when specified, this parameter is used
1192 # for result publication in the study. Otherwise, if automatic
1193 # publication is switched on, default value is used for result name.
1195 # @return New GEOM.GEOM_Object, containing the created point.
1197 # @ref tui_creation_point "Example"
1198 @ManageTransactions("BasicOp")
1199 def MakeVertexWithRef(self, theReference, theX, theY, theZ, theName=None):
1201 Create a point, distant from the referenced point
1202 on the given distances along the coordinate axes.
1205 theReference The referenced point.
1206 theX Displacement from the referenced point along OX axis.
1207 theY Displacement from the referenced point along OY axis.
1208 theZ Displacement from the referenced point along OZ axis.
1209 theName Object name; when specified, this parameter is used
1210 for result publication in the study. Otherwise, if automatic
1211 publication is switched on, default value is used for result name.
1214 New GEOM.GEOM_Object, containing the created point.
1216 # Example: see GEOM_TestAll.py
1217 theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
1218 anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
1219 RaiseIfFailed("MakePointWithReference", self.BasicOp)
1220 anObj.SetParameters(Parameters)
1221 self._autoPublish(anObj, theName, "vertex")
1224 ## Create a point, corresponding to the given parameter on the given curve.
1225 # @param theRefCurve The referenced curve.
1226 # @param theParameter Value of parameter on the referenced curve.
1227 # @param takeOrientationIntoAccount flag that tells if it is necessary
1228 # to take the curve's orientation into account for the
1229 # operation. I.e. if this flag is set, the results for the same
1230 # parameters (except the value 0.5) is different for forward
1231 # and reversed curves. If it is not set the result is the same.
1232 # @param theName Object name; when specified, this parameter is used
1233 # for result publication in the study. Otherwise, if automatic
1234 # publication is switched on, default value is used for result name.
1236 # @return New GEOM.GEOM_Object, containing the created point.
1238 # @ref tui_creation_point "Example"
1239 @ManageTransactions("BasicOp")
1240 def MakeVertexOnCurve(self, theRefCurve, theParameter,
1241 takeOrientationIntoAccount=False, theName=None):
1243 Create a point, corresponding to the given parameter on the given curve.
1246 theRefCurve The referenced curve.
1247 theParameter Value of parameter on the referenced curve.
1248 takeOrientationIntoAccount flag that tells if it is necessary
1249 to take the curve's orientation into account for the
1250 operation. I.e. if this flag is set, the results for
1251 the same parameters (except the value 0.5) is different
1252 for forward and reversed curves. If it is not set
1253 the result is the same.
1254 theName Object name; when specified, this parameter is used
1255 for result publication in the study. Otherwise, if automatic
1256 publication is switched on, default value is used for result name.
1259 New GEOM.GEOM_Object, containing the created point.
1262 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
1264 # Example: see GEOM_TestAll.py
1265 theParameter, takeOrientationIntoAccount, Parameters = ParseParameters(
1266 theParameter, takeOrientationIntoAccount)
1267 anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter,
1268 takeOrientationIntoAccount)
1269 RaiseIfFailed("MakePointOnCurve", self.BasicOp)
1270 anObj.SetParameters(Parameters)
1271 self._autoPublish(anObj, theName, "vertex")
1274 ## Create a point by projection give coordinates on the given curve
1275 # @param theRefCurve The referenced curve.
1276 # @param theX X-coordinate in 3D space
1277 # @param theY Y-coordinate in 3D space
1278 # @param theZ Z-coordinate in 3D space
1279 # @param theName Object name; when specified, this parameter is used
1280 # for result publication in the study. Otherwise, if automatic
1281 # publication is switched on, default value is used for result name.
1283 # @return New GEOM.GEOM_Object, containing the created point.
1285 # @ref tui_creation_point "Example"
1286 @ManageTransactions("BasicOp")
1287 def MakeVertexOnCurveByCoord(self, theRefCurve, theX, theY, theZ, theName=None):
1289 Create a point by projection give coordinates on the given curve
1292 theRefCurve The referenced curve.
1293 theX X-coordinate in 3D space
1294 theY Y-coordinate in 3D space
1295 theZ Z-coordinate in 3D space
1296 theName Object name; when specified, this parameter is used
1297 for result publication in the study. Otherwise, if automatic
1298 publication is switched on, default value is used for result name.
1301 New GEOM.GEOM_Object, containing the created point.
1304 p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
1306 # Example: see GEOM_TestAll.py
1307 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
1308 anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
1309 RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
1310 anObj.SetParameters(Parameters)
1311 self._autoPublish(anObj, theName, "vertex")
1314 ## Create a point, corresponding to the given length on the given curve.
1315 # @param theRefCurve The referenced curve.
1316 # @param theLength Length on the referenced curve. It can be negative.
1317 # @param theStartPoint Point allowing to choose the direction for the calculation
1318 # of the length. If None, start from the first point of theRefCurve.
1319 # @param theName Object name; when specified, this parameter is used
1320 # for result publication in the study. Otherwise, if automatic
1321 # publication is switched on, default value is used for result name.
1323 # @return New GEOM.GEOM_Object, containing the created point.
1325 # @ref tui_creation_point "Example"
1326 @ManageTransactions("BasicOp")
1327 def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
1329 Create a point, corresponding to the given length on the given curve.
1332 theRefCurve The referenced curve.
1333 theLength Length on the referenced curve. It can be negative.
1334 theStartPoint Point allowing to choose the direction for the calculation
1335 of the length. If None, start from the first point of theRefCurve.
1336 theName Object name; when specified, this parameter is used
1337 for result publication in the study. Otherwise, if automatic
1338 publication is switched on, default value is used for result name.
1341 New GEOM.GEOM_Object, containing the created point.
1343 # Example: see GEOM_TestAll.py
1344 theLength, Parameters = ParseParameters(theLength)
1345 anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
1346 RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
1347 anObj.SetParameters(Parameters)
1348 self._autoPublish(anObj, theName, "vertex")
1351 ## Create a point, corresponding to the given parameters on the
1353 # @param theRefSurf The referenced surface.
1354 # @param theUParameter Value of U-parameter on the referenced surface.
1355 # @param theVParameter Value of V-parameter on the referenced surface.
1356 # @param theName Object name; when specified, this parameter is used
1357 # for result publication in the study. Otherwise, if automatic
1358 # publication is switched on, default value is used for result name.
1360 # @return New GEOM.GEOM_Object, containing the created point.
1362 # @ref swig_MakeVertexOnSurface "Example"
1363 @ManageTransactions("BasicOp")
1364 def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter, theName=None):
1366 Create a point, corresponding to the given parameters on the
1370 theRefSurf The referenced surface.
1371 theUParameter Value of U-parameter on the referenced surface.
1372 theVParameter Value of V-parameter on the referenced surface.
1373 theName Object name; when specified, this parameter is used
1374 for result publication in the study. Otherwise, if automatic
1375 publication is switched on, default value is used for result name.
1378 New GEOM.GEOM_Object, containing the created point.
1381 p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8)
1383 theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
1384 # Example: see GEOM_TestAll.py
1385 anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
1386 RaiseIfFailed("MakePointOnSurface", self.BasicOp)
1387 anObj.SetParameters(Parameters);
1388 self._autoPublish(anObj, theName, "vertex")
1391 ## Create a point by projection give coordinates on the given surface
1392 # @param theRefSurf The referenced surface.
1393 # @param theX X-coordinate in 3D space
1394 # @param theY Y-coordinate in 3D space
1395 # @param theZ Z-coordinate in 3D space
1396 # @param theName Object name; when specified, this parameter is used
1397 # for result publication in the study. Otherwise, if automatic
1398 # publication is switched on, default value is used for result name.
1400 # @return New GEOM.GEOM_Object, containing the created point.
1402 # @ref swig_MakeVertexOnSurfaceByCoord "Example"
1403 @ManageTransactions("BasicOp")
1404 def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ, theName=None):
1406 Create a point by projection give coordinates on the given surface
1409 theRefSurf The referenced surface.
1410 theX X-coordinate in 3D space
1411 theY Y-coordinate in 3D space
1412 theZ Z-coordinate in 3D space
1413 theName Object name; when specified, this parameter is used
1414 for result publication in the study. Otherwise, if automatic
1415 publication is switched on, default value is used for result name.
1418 New GEOM.GEOM_Object, containing the created point.
1421 p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.)
1423 theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
1424 # Example: see GEOM_TestAll.py
1425 anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
1426 RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
1427 anObj.SetParameters(Parameters);
1428 self._autoPublish(anObj, theName, "vertex")
1431 ## Create a point, which lays on the given face.
1432 # The point will lay in arbitrary place of the face.
1433 # The only condition on it is a non-zero distance to the face boundary.
1434 # Such point can be used to uniquely identify the face inside any
1435 # shape in case, when the shape does not contain overlapped faces.
1436 # @param theFace The referenced face.
1437 # @param theName Object name; when specified, this parameter is used
1438 # for result publication in the study. Otherwise, if automatic
1439 # publication is switched on, default value is used for result name.
1441 # @return New GEOM.GEOM_Object, containing the created point.
1443 # @ref swig_MakeVertexInsideFace "Example"
1444 @ManageTransactions("BasicOp")
1445 def MakeVertexInsideFace (self, theFace, theNumberOfPnts=1, theName=None):
1447 Create a point, which lays on the given face.
1448 The point will lay in arbitrary place of the face.
1449 The only condition on it is a non-zero distance to the face boundary.
1450 Such point can be used to uniquely identify the face inside any
1451 shape in case, when the shape does not contain overlapped faces.
1454 theFace The referenced face.
1455 theNumberOfPnts The number of points we want to get, 1 by default.
1456 theName Object name; when specified, this parameter is used
1457 for result publication in the study. Otherwise, if automatic
1458 publication is switched on, default value is used for result name.
1461 New GEOM.GEOM_Object, containing the created point.
1464 p_on_face = geompy.MakeVertexInsideFace(Face)
1466 # Example: see GEOM_TestAll.py
1467 anObj = self.BasicOp.MakePointOnFace(theFace, theNumberOfPnts)
1468 RaiseIfFailed("MakeVertexInsideFace", self.BasicOp)
1469 self._autoPublish(anObj, theName, "vertex")
1472 ## Create a point on intersection of two lines.
1473 # @param theRefLine1, theRefLine2 The referenced lines.
1474 # @param theName Object name; when specified, this parameter is used
1475 # for result publication in the study. Otherwise, if automatic
1476 # publication is switched on, default value is used for result name.
1478 # @return New GEOM.GEOM_Object, containing the created point.
1480 # @ref swig_MakeVertexOnLinesIntersection "Example"
1481 @ManageTransactions("BasicOp")
1482 def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2, theName=None):
1484 Create a point on intersection of two lines.
1487 theRefLine1, theRefLine2 The referenced lines.
1488 theName Object name; when specified, this parameter is used
1489 for result publication in the study. Otherwise, if automatic
1490 publication is switched on, default value is used for result name.
1493 New GEOM.GEOM_Object, containing the created point.
1495 # Example: see GEOM_TestAll.py
1496 anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
1497 RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
1498 self._autoPublish(anObj, theName, "vertex")
1501 ## Create a tangent, corresponding to the given parameter on the given curve.
1502 # @param theRefCurve The referenced curve.
1503 # @param theParameter Value of parameter on the referenced curve.
1504 # @param theName Object name; when specified, this parameter is used
1505 # for result publication in the study. Otherwise, if automatic
1506 # publication is switched on, default value is used for result name.
1508 # @return New GEOM.GEOM_Object, containing the created tangent.
1510 # @ref swig_MakeTangentOnCurve "Example"
1511 @ManageTransactions("BasicOp")
1512 def MakeTangentOnCurve(self, theRefCurve, theParameter, theName=None):
1514 Create a tangent, corresponding to the given parameter on the given curve.
1517 theRefCurve The referenced curve.
1518 theParameter Value of parameter on the referenced curve.
1519 theName Object name; when specified, this parameter is used
1520 for result publication in the study. Otherwise, if automatic
1521 publication is switched on, default value is used for result name.
1524 New GEOM.GEOM_Object, containing the created tangent.
1527 tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7)
1529 anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
1530 RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
1531 self._autoPublish(anObj, theName, "tangent")
1534 ## Create a tangent plane, corresponding to the given parameter on the given face.
1535 # @param theFace The face for which tangent plane should be built.
1536 # @param theParameterV vertical value of the center point (0.0 - 1.0).
1537 # @param theParameterU horisontal value of the center point (0.0 - 1.0).
1538 # @param theTrimSize the size of plane.
1539 # @param theName Object name; when specified, this parameter is used
1540 # for result publication in the study. Otherwise, if automatic
1541 # publication is switched on, default value is used for result name.
1543 # @return New GEOM.GEOM_Object, containing the created tangent.
1545 # @ref swig_MakeTangentPlaneOnFace "Example"
1546 @ManageTransactions("BasicOp")
1547 def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize, theName=None):
1549 Create a tangent plane, corresponding to the given parameter on the given face.
1552 theFace The face for which tangent plane should be built.
1553 theParameterV vertical value of the center point (0.0 - 1.0).
1554 theParameterU horisontal value of the center point (0.0 - 1.0).
1555 theTrimSize the size of plane.
1556 theName Object name; when specified, this parameter is used
1557 for result publication in the study. Otherwise, if automatic
1558 publication is switched on, default value is used for result name.
1561 New GEOM.GEOM_Object, containing the created tangent.
1564 an_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
1566 anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
1567 RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
1568 self._autoPublish(anObj, theName, "tangent")
1571 ## Create a vector with the given components.
1572 # @param theDX X component of the vector.
1573 # @param theDY Y component of the vector.
1574 # @param theDZ Z component of the vector.
1575 # @param theName Object name; when specified, this parameter is used
1576 # for result publication in the study. Otherwise, if automatic
1577 # publication is switched on, default value is used for result name.
1579 # @return New GEOM.GEOM_Object, containing the created vector.
1581 # @ref tui_creation_vector "Example"
1582 @ManageTransactions("BasicOp")
1583 def MakeVectorDXDYDZ(self, theDX, theDY, theDZ, theName=None):
1585 Create a vector with the given components.
1588 theDX X component of the vector.
1589 theDY Y component of the vector.
1590 theDZ Z component of the vector.
1591 theName Object name; when specified, this parameter is used
1592 for result publication in the study. Otherwise, if automatic
1593 publication is switched on, default value is used for result name.
1596 New GEOM.GEOM_Object, containing the created vector.
1598 # Example: see GEOM_TestAll.py
1599 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
1600 anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
1601 RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
1602 anObj.SetParameters(Parameters)
1603 self._autoPublish(anObj, theName, "vector")
1606 ## Create a vector between two points.
1607 # @param thePnt1 Start point for the vector.
1608 # @param thePnt2 End point for the vector.
1609 # @param theName Object name; when specified, this parameter is used
1610 # for result publication in the study. Otherwise, if automatic
1611 # publication is switched on, default value is used for result name.
1613 # @return New GEOM.GEOM_Object, containing the created vector.
1615 # @ref tui_creation_vector "Example"
1616 @ManageTransactions("BasicOp")
1617 def MakeVector(self, thePnt1, thePnt2, theName=None):
1619 Create a vector between two points.
1622 thePnt1 Start point for the vector.
1623 thePnt2 End point for the vector.
1624 theName Object name; when specified, this parameter is used
1625 for result publication in the study. Otherwise, if automatic
1626 publication is switched on, default value is used for result name.
1629 New GEOM.GEOM_Object, containing the created vector.
1631 # Example: see GEOM_TestAll.py
1632 anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
1633 RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
1634 self._autoPublish(anObj, theName, "vector")
1637 ## Create a line, passing through the given point
1638 # and parallel to the given direction
1639 # @param thePnt Point. The resulting line will pass through it.
1640 # @param theDir Direction. The resulting line will be parallel to it.
1641 # @param theName Object name; when specified, this parameter is used
1642 # for result publication in the study. Otherwise, if automatic
1643 # publication is switched on, default value is used for result name.
1645 # @return New GEOM.GEOM_Object, containing the created line.
1647 # @ref tui_creation_line "Example"
1648 @ManageTransactions("BasicOp")
1649 def MakeLine(self, thePnt, theDir, theName=None):
1651 Create a line, passing through the given point
1652 and parallel to the given direction
1655 thePnt Point. The resulting line will pass through it.
1656 theDir Direction. The resulting line will be parallel to it.
1657 theName Object name; when specified, this parameter is used
1658 for result publication in the study. Otherwise, if automatic
1659 publication is switched on, default value is used for result name.
1662 New GEOM.GEOM_Object, containing the created line.
1664 # Example: see GEOM_TestAll.py
1665 anObj = self.BasicOp.MakeLine(thePnt, theDir)
1666 RaiseIfFailed("MakeLine", self.BasicOp)
1667 self._autoPublish(anObj, theName, "line")
1670 ## Create a line, passing through the given points
1671 # @param thePnt1 First of two points, defining the line.
1672 # @param thePnt2 Second of two points, defining the line.
1673 # @param theName Object name; when specified, this parameter is used
1674 # for result publication in the study. Otherwise, if automatic
1675 # publication is switched on, default value is used for result name.
1677 # @return New GEOM.GEOM_Object, containing the created line.
1679 # @ref tui_creation_line "Example"
1680 @ManageTransactions("BasicOp")
1681 def MakeLineTwoPnt(self, thePnt1, thePnt2, theName=None):
1683 Create a line, passing through the given points
1686 thePnt1 First of two points, defining the line.
1687 thePnt2 Second of two points, defining the line.
1688 theName Object name; when specified, this parameter is used
1689 for result publication in the study. Otherwise, if automatic
1690 publication is switched on, default value is used for result name.
1693 New GEOM.GEOM_Object, containing the created line.
1695 # Example: see GEOM_TestAll.py
1696 anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
1697 RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
1698 self._autoPublish(anObj, theName, "line")
1701 ## Create a line on two faces intersection.
1702 # @param theFace1 First of two faces, defining the line.
1703 # @param theFace2 Second of two faces, defining the line.
1704 # @param theName Object name; when specified, this parameter is used
1705 # for result publication in the study. Otherwise, if automatic
1706 # publication is switched on, default value is used for result name.
1708 # @return New GEOM.GEOM_Object, containing the created line.
1710 # @ref swig_MakeLineTwoFaces "Example"
1711 @ManageTransactions("BasicOp")
1712 def MakeLineTwoFaces(self, theFace1, theFace2, theName=None):
1714 Create a line on two faces intersection.
1717 theFace1 First of two faces, defining the line.
1718 theFace2 Second of two faces, defining the line.
1719 theName Object name; when specified, this parameter is used
1720 for result publication in the study. Otherwise, if automatic
1721 publication is switched on, default value is used for result name.
1724 New GEOM.GEOM_Object, containing the created line.
1726 # Example: see GEOM_TestAll.py
1727 anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
1728 RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
1729 self._autoPublish(anObj, theName, "line")
1732 ## Create a plane, passing through the given point
1733 # and normal to the given vector.
1734 # @param thePnt Point, the plane has to pass through.
1735 # @param theVec Vector, defining the plane normal direction.
1736 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1737 # @param theName Object name; when specified, this parameter is used
1738 # for result publication in the study. Otherwise, if automatic
1739 # publication is switched on, default value is used for result name.
1741 # @return New GEOM.GEOM_Object, containing the created plane.
1743 # @ref tui_creation_plane "Example"
1744 @ManageTransactions("BasicOp")
1745 def MakePlane(self, thePnt, theVec, theTrimSize, theName=None):
1747 Create a plane, passing through the given point
1748 and normal to the given vector.
1751 thePnt Point, the plane has to pass through.
1752 theVec Vector, defining the plane normal direction.
1753 theTrimSize Half size of a side of quadrangle face, representing the plane.
1754 theName Object name; when specified, this parameter is used
1755 for result publication in the study. Otherwise, if automatic
1756 publication is switched on, default value is used for result name.
1759 New GEOM.GEOM_Object, containing the created plane.
1761 # Example: see GEOM_TestAll.py
1762 theTrimSize, Parameters = ParseParameters(theTrimSize);
1763 anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
1764 RaiseIfFailed("MakePlanePntVec", self.BasicOp)
1765 anObj.SetParameters(Parameters)
1766 self._autoPublish(anObj, theName, "plane")
1769 ## Create a plane, passing through the three given points
1770 # @param thePnt1 First of three points, defining the plane.
1771 # @param thePnt2 Second of three points, defining the plane.
1772 # @param thePnt3 Third of three points, defining the plane.
1773 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1774 # @param theName Object name; when specified, this parameter is used
1775 # for result publication in the study. Otherwise, if automatic
1776 # publication is switched on, default value is used for result name.
1778 # @return New GEOM.GEOM_Object, containing the created plane.
1780 # @ref tui_creation_plane "Example"
1781 @ManageTransactions("BasicOp")
1782 def MakePlaneThreePnt(self, thePnt1, thePnt2, thePnt3, theTrimSize, theName=None):
1784 Create a plane, passing through the three given points
1787 thePnt1 First of three points, defining the plane.
1788 thePnt2 Second of three points, defining the plane.
1789 thePnt3 Third of three points, defining the plane.
1790 theTrimSize Half size of a side of quadrangle face, representing the plane.
1791 theName Object name; when specified, this parameter is used
1792 for result publication in the study. Otherwise, if automatic
1793 publication is switched on, default value is used for result name.
1796 New GEOM.GEOM_Object, containing the created plane.
1798 # Example: see GEOM_TestAll.py
1799 theTrimSize, Parameters = ParseParameters(theTrimSize);
1800 anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
1801 RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
1802 anObj.SetParameters(Parameters)
1803 self._autoPublish(anObj, theName, "plane")
1806 ## Create a plane, similar to the existing one, but with another size of representing face.
1807 # @param theFace Referenced plane or LCS(Marker).
1808 # @param theTrimSize New half size of a side of quadrangle face, representing the plane.
1809 # @param theName Object name; when specified, this parameter is used
1810 # for result publication in the study. Otherwise, if automatic
1811 # publication is switched on, default value is used for result name.
1813 # @return New GEOM.GEOM_Object, containing the created plane.
1815 # @ref tui_creation_plane "Example"
1816 @ManageTransactions("BasicOp")
1817 def MakePlaneFace(self, theFace, theTrimSize, theName=None):
1819 Create a plane, similar to the existing one, but with another size of representing face.
1822 theFace Referenced plane or LCS(Marker).
1823 theTrimSize New half size of a side of quadrangle face, representing the plane.
1824 theName Object name; when specified, this parameter is used
1825 for result publication in the study. Otherwise, if automatic
1826 publication is switched on, default value is used for result name.
1829 New GEOM.GEOM_Object, containing the created plane.
1831 # Example: see GEOM_TestAll.py
1832 theTrimSize, Parameters = ParseParameters(theTrimSize);
1833 anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
1834 RaiseIfFailed("MakePlaneFace", self.BasicOp)
1835 anObj.SetParameters(Parameters)
1836 self._autoPublish(anObj, theName, "plane")
1839 ## Create a plane, passing through the 2 vectors
1840 # with center in a start point of the first vector.
1841 # @param theVec1 Vector, defining center point and plane direction.
1842 # @param theVec2 Vector, defining the plane normal direction.
1843 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1844 # @param theName Object name; when specified, this parameter is used
1845 # for result publication in the study. Otherwise, if automatic
1846 # publication is switched on, default value is used for result name.
1848 # @return New GEOM.GEOM_Object, containing the created plane.
1850 # @ref tui_creation_plane "Example"
1851 @ManageTransactions("BasicOp")
1852 def MakePlane2Vec(self, theVec1, theVec2, theTrimSize, theName=None):
1854 Create a plane, passing through the 2 vectors
1855 with center in a start point of the first vector.
1858 theVec1 Vector, defining center point and plane direction.
1859 theVec2 Vector, defining the plane normal direction.
1860 theTrimSize Half size of a side of quadrangle face, representing the plane.
1861 theName Object name; when specified, this parameter is used
1862 for result publication in the study. Otherwise, if automatic
1863 publication is switched on, default value is used for result name.
1866 New GEOM.GEOM_Object, containing the created plane.
1868 # Example: see GEOM_TestAll.py
1869 theTrimSize, Parameters = ParseParameters(theTrimSize);
1870 anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
1871 RaiseIfFailed("MakePlane2Vec", self.BasicOp)
1872 anObj.SetParameters(Parameters)
1873 self._autoPublish(anObj, theName, "plane")
1876 ## Create a plane, based on a Local coordinate system.
1877 # @param theLCS coordinate system, defining plane.
1878 # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
1879 # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
1880 # @param theName Object name; when specified, this parameter is used
1881 # for result publication in the study. Otherwise, if automatic
1882 # publication is switched on, default value is used for result name.
1884 # @return New GEOM.GEOM_Object, containing the created plane.
1886 # @ref tui_creation_plane "Example"
1887 @ManageTransactions("BasicOp")
1888 def MakePlaneLCS(self, theLCS, theTrimSize, theOrientation, theName=None):
1890 Create a plane, based on a Local coordinate system.
1893 theLCS coordinate system, defining plane.
1894 theTrimSize Half size of a side of quadrangle face, representing the plane.
1895 theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
1896 theName Object name; when specified, this parameter is used
1897 for result publication in the study. Otherwise, if automatic
1898 publication is switched on, default value is used for result name.
1901 New GEOM.GEOM_Object, containing the created plane.
1903 # Example: see GEOM_TestAll.py
1904 theTrimSize, Parameters = ParseParameters(theTrimSize);
1905 anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
1906 RaiseIfFailed("MakePlaneLCS", self.BasicOp)
1907 anObj.SetParameters(Parameters)
1908 self._autoPublish(anObj, theName, "plane")
1911 ## Create a local coordinate system.
1912 # @param OX,OY,OZ Three coordinates of coordinate system origin.
1913 # @param XDX,XDY,XDZ Three components of OX direction
1914 # @param YDX,YDY,YDZ Three components of OY direction
1915 # @param theName Object name; when specified, this parameter is used
1916 # for result publication in the study. Otherwise, if automatic
1917 # publication is switched on, default value is used for result name.
1919 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1921 # @ref swig_MakeMarker "Example"
1922 @ManageTransactions("BasicOp")
1923 def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, theName=None):
1925 Create a local coordinate system.
1928 OX,OY,OZ Three coordinates of coordinate system origin.
1929 XDX,XDY,XDZ Three components of OX direction
1930 YDX,YDY,YDZ Three components of OY direction
1931 theName Object name; when specified, this parameter is used
1932 for result publication in the study. Otherwise, if automatic
1933 publication is switched on, default value is used for result name.
1936 New GEOM.GEOM_Object, containing the created coordinate system.
1938 # Example: see GEOM_TestAll.py
1939 OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
1940 anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
1941 RaiseIfFailed("MakeMarker", self.BasicOp)
1942 anObj.SetParameters(Parameters)
1943 self._autoPublish(anObj, theName, "lcs")
1946 ## Create a local coordinate system from shape.
1947 # @param theShape The initial shape to detect the coordinate system.
1948 # @param theName Object name; when specified, this parameter is used
1949 # for result publication in the study. Otherwise, if automatic
1950 # publication is switched on, default value is used for result name.
1952 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1954 # @ref tui_creation_lcs "Example"
1955 @ManageTransactions("BasicOp")
1956 def MakeMarkerFromShape(self, theShape, theName=None):
1958 Create a local coordinate system from shape.
1961 theShape The initial shape to detect the coordinate system.
1962 theName Object name; when specified, this parameter is used
1963 for result publication in the study. Otherwise, if automatic
1964 publication is switched on, default value is used for result name.
1967 New GEOM.GEOM_Object, containing the created coordinate system.
1969 anObj = self.BasicOp.MakeMarkerFromShape(theShape)
1970 RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
1971 self._autoPublish(anObj, theName, "lcs")
1974 ## Create a local coordinate system from point and two vectors.
1975 # @param theOrigin Point of coordinate system origin.
1976 # @param theXVec Vector of X direction
1977 # @param theYVec Vector of Y direction
1978 # @param theName Object name; when specified, this parameter is used
1979 # for result publication in the study. Otherwise, if automatic
1980 # publication is switched on, default value is used for result name.
1982 # @return New GEOM.GEOM_Object, containing the created coordinate system.
1984 # @ref tui_creation_lcs "Example"
1985 @ManageTransactions("BasicOp")
1986 def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec, theName=None):
1988 Create a local coordinate system from point and two vectors.
1991 theOrigin Point of coordinate system origin.
1992 theXVec Vector of X direction
1993 theYVec Vector of Y direction
1994 theName Object name; when specified, this parameter is used
1995 for result publication in the study. Otherwise, if automatic
1996 publication is switched on, default value is used for result name.
1999 New GEOM.GEOM_Object, containing the created coordinate system.
2002 anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
2003 RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
2004 self._autoPublish(anObj, theName, "lcs")
2007 # end of l3_basic_go
2010 ## @addtogroup l4_curves
2013 ## Create an arc of circle, passing through three given points.
2014 # @param thePnt1 Start point of the arc.
2015 # @param thePnt2 Middle point of the arc.
2016 # @param thePnt3 End point of the arc.
2017 # @param theName Object name; when specified, this parameter is used
2018 # for result publication in the study. Otherwise, if automatic
2019 # publication is switched on, default value is used for result name.
2021 # @return New GEOM.GEOM_Object, containing the created arc.
2023 # @ref swig_MakeArc "Example"
2024 @ManageTransactions("CurvesOp")
2025 def MakeArc(self, thePnt1, thePnt2, thePnt3, theName=None):
2027 Create an arc of circle, passing through three given points.
2030 thePnt1 Start point of the arc.
2031 thePnt2 Middle point of the arc.
2032 thePnt3 End point of the arc.
2033 theName Object name; when specified, this parameter is used
2034 for result publication in the study. Otherwise, if automatic
2035 publication is switched on, default value is used for result name.
2038 New GEOM.GEOM_Object, containing the created arc.
2040 # Example: see GEOM_TestAll.py
2041 anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
2042 RaiseIfFailed("MakeArc", self.CurvesOp)
2043 self._autoPublish(anObj, theName, "arc")
2046 ## Create an arc of circle from a center and 2 points.
2047 # @param thePnt1 Center of the arc
2048 # @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
2049 # @param thePnt3 End point of the arc (Gives also a direction)
2050 # @param theSense Orientation of the arc
2051 # @param theName Object name; when specified, this parameter is used
2052 # for result publication in the study. Otherwise, if automatic
2053 # publication is switched on, default value is used for result name.
2055 # @return New GEOM.GEOM_Object, containing the created arc.
2057 # @ref swig_MakeArc "Example"
2058 @ManageTransactions("CurvesOp")
2059 def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False, theName=None):
2061 Create an arc of circle from a center and 2 points.
2064 thePnt1 Center of the arc
2065 thePnt2 Start point of the arc. (Gives also the radius of the arc)
2066 thePnt3 End point of the arc (Gives also a direction)
2067 theSense Orientation of the arc
2068 theName Object name; when specified, this parameter is used
2069 for result publication in the study. Otherwise, if automatic
2070 publication is switched on, default value is used for result name.
2073 New GEOM.GEOM_Object, containing the created arc.
2075 # Example: see GEOM_TestAll.py
2076 anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
2077 RaiseIfFailed("MakeArcCenter", self.CurvesOp)
2078 self._autoPublish(anObj, theName, "arc")
2081 ## Create an arc of ellipse, of center and two points.
2082 # @param theCenter Center of the arc.
2083 # @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
2084 # @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2085 # @param theName Object name; when specified, this parameter is used
2086 # for result publication in the study. Otherwise, if automatic
2087 # publication is switched on, default value is used for result name.
2089 # @return New GEOM.GEOM_Object, containing the created arc.
2091 # @ref swig_MakeArc "Example"
2092 @ManageTransactions("CurvesOp")
2093 def MakeArcOfEllipse(self, theCenter, thePnt1, thePnt2, theName=None):
2095 Create an arc of ellipse, of center and two points.
2098 theCenter Center of the arc.
2099 thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
2100 thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2101 theName Object name; when specified, this parameter is used
2102 for result publication in the study. Otherwise, if automatic
2103 publication is switched on, default value is used for result name.
2106 New GEOM.GEOM_Object, containing the created arc.
2108 # Example: see GEOM_TestAll.py
2109 anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
2110 RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
2111 self._autoPublish(anObj, theName, "arc")
2114 ## Create a circle with given center, normal vector and radius.
2115 # @param thePnt Circle center.
2116 # @param theVec Vector, normal to the plane of the circle.
2117 # @param theR Circle radius.
2118 # @param theName Object name; when specified, this parameter is used
2119 # for result publication in the study. Otherwise, if automatic
2120 # publication is switched on, default value is used for result name.
2122 # @return New GEOM.GEOM_Object, containing the created circle.
2124 # @ref tui_creation_circle "Example"
2125 @ManageTransactions("CurvesOp")
2126 def MakeCircle(self, thePnt, theVec, theR, theName=None):
2128 Create a circle with given center, normal vector and radius.
2131 thePnt Circle center.
2132 theVec Vector, normal to the plane of the circle.
2134 theName Object name; when specified, this parameter is used
2135 for result publication in the study. Otherwise, if automatic
2136 publication is switched on, default value is used for result name.
2139 New GEOM.GEOM_Object, containing the created circle.
2141 # Example: see GEOM_TestAll.py
2142 theR, Parameters = ParseParameters(theR)
2143 anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
2144 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
2145 anObj.SetParameters(Parameters)
2146 self._autoPublish(anObj, theName, "circle")
2149 ## Create a circle with given radius.
2150 # Center of the circle will be in the origin of global
2151 # coordinate system and normal vector will be codirected with Z axis
2152 # @param theR Circle radius.
2153 # @param theName Object name; when specified, this parameter is used
2154 # for result publication in the study. Otherwise, if automatic
2155 # publication is switched on, default value is used for result name.
2157 # @return New GEOM.GEOM_Object, containing the created circle.
2158 @ManageTransactions("CurvesOp")
2159 def MakeCircleR(self, theR, theName=None):
2161 Create a circle with given radius.
2162 Center of the circle will be in the origin of global
2163 coordinate system and normal vector will be codirected with Z axis
2167 theName Object name; when specified, this parameter is used
2168 for result publication in the study. Otherwise, if automatic
2169 publication is switched on, default value is used for result name.
2172 New GEOM.GEOM_Object, containing the created circle.
2174 anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
2175 RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
2176 self._autoPublish(anObj, theName, "circle")
2179 ## Create a circle, passing through three given points
2180 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2181 # @param theName Object name; when specified, this parameter is used
2182 # for result publication in the study. Otherwise, if automatic
2183 # publication is switched on, default value is used for result name.
2185 # @return New GEOM.GEOM_Object, containing the created circle.
2187 # @ref tui_creation_circle "Example"
2188 @ManageTransactions("CurvesOp")
2189 def MakeCircleThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
2191 Create a circle, passing through three given points
2194 thePnt1,thePnt2,thePnt3 Points, defining the circle.
2195 theName Object name; when specified, this parameter is used
2196 for result publication in the study. Otherwise, if automatic
2197 publication is switched on, default value is used for result name.
2200 New GEOM.GEOM_Object, containing the created circle.
2202 # Example: see GEOM_TestAll.py
2203 anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
2204 RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
2205 self._autoPublish(anObj, theName, "circle")
2208 ## Create a circle, with given point1 as center,
2209 # passing through the point2 as radius and laying in the plane,
2210 # defined by all three given points.
2211 # @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2212 # @param theName Object name; when specified, this parameter is used
2213 # for result publication in the study. Otherwise, if automatic
2214 # publication is switched on, default value is used for result name.
2216 # @return New GEOM.GEOM_Object, containing the created circle.
2218 # @ref swig_MakeCircle "Example"
2219 @ManageTransactions("CurvesOp")
2220 def MakeCircleCenter2Pnt(self, thePnt1, thePnt2, thePnt3, theName=None):
2222 Create a circle, with given point1 as center,
2223 passing through the point2 as radius and laying in the plane,
2224 defined by all three given points.
2227 thePnt1,thePnt2,thePnt3 Points, defining the circle.
2228 theName Object name; when specified, this parameter is used
2229 for result publication in the study. Otherwise, if automatic
2230 publication is switched on, default value is used for result name.
2233 New GEOM.GEOM_Object, containing the created circle.
2235 # Example: see GEOM_example6.py
2236 anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
2237 RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
2238 self._autoPublish(anObj, theName, "circle")
2241 ## Create an ellipse with given center, normal vector and radiuses.
2242 # @param thePnt Ellipse center.
2243 # @param theVec Vector, normal to the plane of the ellipse.
2244 # @param theRMajor Major ellipse radius.
2245 # @param theRMinor Minor ellipse radius.
2246 # @param theVecMaj Vector, direction of the ellipse's main axis.
2247 # @param theName Object name; when specified, this parameter is used
2248 # for result publication in the study. Otherwise, if automatic
2249 # publication is switched on, default value is used for result name.
2251 # @return New GEOM.GEOM_Object, containing the created ellipse.
2253 # @ref tui_creation_ellipse "Example"
2254 @ManageTransactions("CurvesOp")
2255 def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None, theName=None):
2257 Create an ellipse with given center, normal vector and radiuses.
2260 thePnt Ellipse center.
2261 theVec Vector, normal to the plane of the ellipse.
2262 theRMajor Major ellipse radius.
2263 theRMinor Minor ellipse radius.
2264 theVecMaj Vector, direction of the ellipse's main axis.
2265 theName Object name; when specified, this parameter is used
2266 for result publication in the study. Otherwise, if automatic
2267 publication is switched on, default value is used for result name.
2270 New GEOM.GEOM_Object, containing the created ellipse.
2272 # Example: see GEOM_TestAll.py
2273 theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
2274 if theVecMaj is not None:
2275 anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
2277 anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
2279 RaiseIfFailed("MakeEllipse", self.CurvesOp)
2280 anObj.SetParameters(Parameters)
2281 self._autoPublish(anObj, theName, "ellipse")
2284 ## Create an ellipse with given radiuses.
2285 # Center of the ellipse will be in the origin of global
2286 # coordinate system and normal vector will be codirected with Z axis
2287 # @param theRMajor Major ellipse radius.
2288 # @param theRMinor Minor ellipse radius.
2289 # @param theName Object name; when specified, this parameter is used
2290 # for result publication in the study. Otherwise, if automatic
2291 # publication is switched on, default value is used for result name.
2293 # @return New GEOM.GEOM_Object, containing the created ellipse.
2294 @ManageTransactions("CurvesOp")
2295 def MakeEllipseRR(self, theRMajor, theRMinor, theName=None):
2297 Create an ellipse with given radiuses.
2298 Center of the ellipse will be in the origin of global
2299 coordinate system and normal vector will be codirected with Z axis
2302 theRMajor Major ellipse radius.
2303 theRMinor Minor ellipse radius.
2304 theName Object name; when specified, this parameter is used
2305 for result publication in the study. Otherwise, if automatic
2306 publication is switched on, default value is used for result name.
2309 New GEOM.GEOM_Object, containing the created ellipse.
2311 anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
2312 RaiseIfFailed("MakeEllipse", self.CurvesOp)
2313 self._autoPublish(anObj, theName, "ellipse")
2316 ## Create a polyline on the set of points.
2317 # @param thePoints Sequence of points for the polyline.
2318 # @param theIsClosed If True, build a closed wire.
2319 # @param theName Object name; when specified, this parameter is used
2320 # for result publication in the study. Otherwise, if automatic
2321 # publication is switched on, default value is used for result name.
2323 # @return New GEOM.GEOM_Object, containing the created polyline.
2325 # @ref tui_creation_curve "Example"
2326 @ManageTransactions("CurvesOp")
2327 def MakePolyline(self, thePoints, theIsClosed=False, theName=None):
2329 Create a polyline on the set of points.
2332 thePoints Sequence of points for the polyline.
2333 theIsClosed If True, build a closed wire.
2334 theName Object name; when specified, this parameter is used
2335 for result publication in the study. Otherwise, if automatic
2336 publication is switched on, default value is used for result name.
2339 New GEOM.GEOM_Object, containing the created polyline.
2341 # Example: see GEOM_TestAll.py
2342 anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
2343 RaiseIfFailed("MakePolyline", self.CurvesOp)
2344 self._autoPublish(anObj, theName, "polyline")
2347 ## Create bezier curve on the set of points.
2348 # @param thePoints Sequence of points for the bezier curve.
2349 # @param theIsClosed If True, build a closed curve.
2350 # @param theName Object name; when specified, this parameter is used
2351 # for result publication in the study. Otherwise, if automatic
2352 # publication is switched on, default value is used for result name.
2354 # @return New GEOM.GEOM_Object, containing the created bezier curve.
2356 # @ref tui_creation_curve "Example"
2357 @ManageTransactions("CurvesOp")
2358 def MakeBezier(self, thePoints, theIsClosed=False, theName=None):
2360 Create bezier curve on the set of points.
2363 thePoints Sequence of points for the bezier curve.
2364 theIsClosed If True, build a closed curve.
2365 theName Object name; when specified, this parameter is used
2366 for result publication in the study. Otherwise, if automatic
2367 publication is switched on, default value is used for result name.
2370 New GEOM.GEOM_Object, containing the created bezier curve.
2372 # Example: see GEOM_TestAll.py
2373 anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
2374 RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
2375 self._autoPublish(anObj, theName, "bezier")
2378 ## Create B-Spline curve on the set of points.
2379 # @param thePoints Sequence of points for the B-Spline curve.
2380 # @param theIsClosed If True, build a closed curve.
2381 # @param theDoReordering If TRUE, the algo does not follow the order of
2382 # \a thePoints but searches for the closest vertex.
2383 # @param theName Object name; when specified, this parameter is used
2384 # for result publication in the study. Otherwise, if automatic
2385 # publication is switched on, default value is used for result name.
2387 # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2389 # @ref tui_creation_curve "Example"
2390 @ManageTransactions("CurvesOp")
2391 def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False, theName=None):
2393 Create B-Spline curve on the set of points.
2396 thePoints Sequence of points for the B-Spline curve.
2397 theIsClosed If True, build a closed curve.
2398 theDoReordering If True, the algo does not follow the order of
2399 thePoints but searches for the closest vertex.
2400 theName Object name; when specified, this parameter is used
2401 for result publication in the study. Otherwise, if automatic
2402 publication is switched on, default value is used for result name.
2405 New GEOM.GEOM_Object, containing the created B-Spline curve.
2407 # Example: see GEOM_TestAll.py
2408 anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
2409 RaiseIfFailed("MakeInterpol", self.CurvesOp)
2410 self._autoPublish(anObj, theName, "bspline")
2413 ## Create B-Spline curve on the set of points.
2414 # @param thePoints Sequence of points for the B-Spline curve.
2415 # @param theFirstVec Vector object, defining the curve direction at its first point.
2416 # @param theLastVec Vector object, defining the curve direction at its last point.
2417 # @param theName Object name; when specified, this parameter is used
2418 # for result publication in the study. Otherwise, if automatic
2419 # publication is switched on, default value is used for result name.
2421 # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2423 # @ref tui_creation_curve "Example"
2424 @ManageTransactions("CurvesOp")
2425 def MakeInterpolWithTangents(self, thePoints, theFirstVec, theLastVec, theName=None):
2427 Create B-Spline curve on the set of points.
2430 thePoints Sequence of points for the B-Spline curve.
2431 theFirstVec Vector object, defining the curve direction at its first point.
2432 theLastVec Vector object, defining the curve direction at its last point.
2433 theName Object name; when specified, this parameter is used
2434 for result publication in the study. Otherwise, if automatic
2435 publication is switched on, default value is used for result name.
2438 New GEOM.GEOM_Object, containing the created B-Spline curve.
2440 # Example: see GEOM_TestAll.py
2441 anObj = self.CurvesOp.MakeSplineInterpolWithTangents(thePoints, theFirstVec, theLastVec)
2442 RaiseIfFailed("MakeInterpolWithTangents", self.CurvesOp)
2443 self._autoPublish(anObj, theName, "bspline")
2446 ## Creates a curve using the parametric definition of the basic points.
2447 # @param thexExpr parametric equation of the coordinates X.
2448 # @param theyExpr parametric equation of the coordinates Y.
2449 # @param thezExpr parametric equation of the coordinates Z.
2450 # @param theParamMin the minimal value of the parameter.
2451 # @param theParamMax the maximum value of the parameter.
2452 # @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2453 # @param theCurveType the type of the curve,
2454 # one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2455 # @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.
2456 # @param theName Object name; when specified, this parameter is used
2457 # for result publication in the study. Otherwise, if automatic
2458 # publication is switched on, default value is used for result name.
2460 # @return New GEOM.GEOM_Object, containing the created curve.
2462 # @ref tui_creation_curve "Example"
2463 @ManageTransactions("CurvesOp")
2464 def MakeCurveParametric(self, thexExpr, theyExpr, thezExpr,
2465 theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False, theName=None ):
2467 Creates a curve using the parametric definition of the basic points.
2470 thexExpr parametric equation of the coordinates X.
2471 theyExpr parametric equation of the coordinates Y.
2472 thezExpr parametric equation of the coordinates Z.
2473 theParamMin the minimal value of the parameter.
2474 theParamMax the maximum value of the parameter.
2475 theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2476 theCurveType the type of the curve,
2477 one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2478 theNewMethod flag for switching to the new method if the flag is set to false a deprecated
2479 method is used which can lead to a bug.
2480 theName Object name; when specified, this parameter is used
2481 for result publication in the study. Otherwise, if automatic
2482 publication is switched on, default value is used for result name.
2485 New GEOM.GEOM_Object, containing the created curve.
2487 theParamMin,theParamMax,theParamStep,Parameters = ParseParameters(theParamMin,theParamMax,theParamStep)
2489 anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
2491 anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
2492 RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
2493 anObj.SetParameters(Parameters)
2494 self._autoPublish(anObj, theName, "curve")
2497 ## Create an isoline curve on a face.
2498 # @param theFace the face for which an isoline is created.
2499 # @param IsUIsoline True for U-isoline creation; False for V-isoline
2501 # @param theParameter the U parameter for U-isoline or V parameter
2503 # @param theName Object name; when specified, this parameter is used
2504 # for result publication in the study. Otherwise, if automatic
2505 # publication is switched on, default value is used for result name.
2507 # @return New GEOM.GEOM_Object, containing the created isoline edge or
2508 # a compound of edges.
2510 # @ref tui_creation_curve "Example"
2511 @ManageTransactions("CurvesOp")
2512 def MakeIsoline(self, theFace, IsUIsoline, theParameter, theName=None):
2514 Create an isoline curve on a face.
2517 theFace the face for which an isoline is created.
2518 IsUIsoline True for U-isoline creation; False for V-isoline
2520 theParameter the U parameter for U-isoline or V parameter
2522 theName Object name; when specified, this parameter is used
2523 for result publication in the study. Otherwise, if automatic
2524 publication is switched on, default value is used for result name.
2527 New GEOM.GEOM_Object, containing the created isoline edge or a
2530 # Example: see GEOM_TestAll.py
2531 anObj = self.CurvesOp.MakeIsoline(theFace, IsUIsoline, theParameter)
2532 RaiseIfFailed("MakeIsoline", self.CurvesOp)
2534 self._autoPublish(anObj, theName, "U-Isoline")
2536 self._autoPublish(anObj, theName, "V-Isoline")
2542 ## @addtogroup l3_sketcher
2545 ## Create a sketcher (wire or face), following the textual description,
2546 # passed through <VAR>theCommand</VAR> argument. \n
2547 # Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
2548 # Format of the description string have to be the following:
2550 # "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
2553 # - x1, y1 are coordinates of the first sketcher point (zero by default),
2555 # - "R angle" : Set the direction by angle
2556 # - "D dx dy" : Set the direction by DX & DY
2559 # - "TT x y" : Create segment by point at X & Y
2560 # - "T dx dy" : Create segment by point with DX & DY
2561 # - "L length" : Create segment by direction & Length
2562 # - "IX x" : Create segment by direction & Intersect. X
2563 # - "IY y" : Create segment by direction & Intersect. Y
2566 # - "C radius length" : Create arc by direction, radius and length(in degree)
2567 # - "AA x y": Create arc by point at X & Y
2568 # - "A dx dy" : Create arc by point with DX & DY
2569 # - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
2570 # - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
2571 # - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
2572 # - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2575 # - "WW" : Close Wire (to finish)
2576 # - "WF" : Close Wire and build face (to finish)
2579 # - Flag1 (= reverse) is 0 or 2 ...
2580 # - if 0 the drawn arc is the one of lower angle (< Pi)
2581 # - if 2 the drawn arc ius the one of greater angle (> Pi)
2584 # - Flag2 (= control tolerance) is 0 or 1 ...
2585 # - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
2586 # - if 1 the wire is built only if the end point is on the arc
2587 # with a tolerance of 10^-7 on the distance else the creation fails
2589 # @param theCommand String, defining the sketcher in local
2590 # coordinates of the working plane.
2591 # @param theWorkingPlane Nine double values, defining origin,
2592 # OZ and OX directions of the working plane.
2593 # @param theName Object name; when specified, this parameter is used
2594 # for result publication in the study. Otherwise, if automatic
2595 # publication is switched on, default value is used for result name.
2597 # @return New GEOM.GEOM_Object, containing the created wire.
2599 # @ref tui_sketcher_page "Example"
2600 @ManageTransactions("CurvesOp")
2601 def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0], theName=None):
2603 Create a sketcher (wire or face), following the textual description, passed
2604 through theCommand argument.
2605 Edges of the resulting wire or face will be arcs of circles and/or linear segments.
2606 Format of the description string have to be the following:
2607 "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
2609 - x1, y1 are coordinates of the first sketcher point (zero by default),
2611 - "R angle" : Set the direction by angle
2612 - "D dx dy" : Set the direction by DX & DY
2614 - "TT x y" : Create segment by point at X & Y
2615 - "T dx dy" : Create segment by point with DX & DY
2616 - "L length" : Create segment by direction & Length
2617 - "IX x" : Create segment by direction & Intersect. X
2618 - "IY y" : Create segment by direction & Intersect. Y
2620 - "C radius length" : Create arc by direction, radius and length(in degree)
2621 - "AA x y": Create arc by point at X & Y
2622 - "A dx dy" : Create arc by point with DX & DY
2623 - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
2624 - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
2625 - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
2626 - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2628 - "WW" : Close Wire (to finish)
2629 - "WF" : Close Wire and build face (to finish)
2631 - Flag1 (= reverse) is 0 or 2 ...
2632 - if 0 the drawn arc is the one of lower angle (< Pi)
2633 - if 2 the drawn arc ius the one of greater angle (> Pi)
2635 - Flag2 (= control tolerance) is 0 or 1 ...
2636 - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
2637 - if 1 the wire is built only if the end point is on the arc
2638 with a tolerance of 10^-7 on the distance else the creation fails
2641 theCommand String, defining the sketcher in local
2642 coordinates of the working plane.
2643 theWorkingPlane Nine double values, defining origin,
2644 OZ and OX directions of the working plane.
2645 theName Object name; when specified, this parameter is used
2646 for result publication in the study. Otherwise, if automatic
2647 publication is switched on, default value is used for result name.
2650 New GEOM.GEOM_Object, containing the created wire.
2652 # Example: see GEOM_TestAll.py
2653 theCommand,Parameters = ParseSketcherCommand(theCommand)
2654 anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
2655 RaiseIfFailed("MakeSketcher", self.CurvesOp)
2656 anObj.SetParameters(Parameters)
2657 self._autoPublish(anObj, theName, "wire")
2660 ## Create a sketcher (wire or face), following the textual description,
2661 # passed through <VAR>theCommand</VAR> argument. \n
2662 # For format of the description string see MakeSketcher() method.\n
2663 # @param theCommand String, defining the sketcher in local
2664 # coordinates of the working plane.
2665 # @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2666 # @param theName Object name; when specified, this parameter is used
2667 # for result publication in the study. Otherwise, if automatic
2668 # publication is switched on, default value is used for result name.
2670 # @return New GEOM.GEOM_Object, containing the created wire.
2672 # @ref tui_sketcher_page "Example"
2673 @ManageTransactions("CurvesOp")
2674 def MakeSketcherOnPlane(self, theCommand, theWorkingPlane, theName=None):
2676 Create a sketcher (wire or face), following the textual description,
2677 passed through theCommand argument.
2678 For format of the description string see geompy.MakeSketcher() method.
2681 theCommand String, defining the sketcher in local
2682 coordinates of the working plane.
2683 theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2684 theName Object name; when specified, this parameter is used
2685 for result publication in the study. Otherwise, if automatic
2686 publication is switched on, default value is used for result name.
2689 New GEOM.GEOM_Object, containing the created wire.
2691 theCommand,Parameters = ParseSketcherCommand(theCommand)
2692 anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
2693 RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
2694 anObj.SetParameters(Parameters)
2695 self._autoPublish(anObj, theName, "wire")
2698 ## Obtain a 2D sketcher interface
2699 # @return An instance of @ref gsketcher.Sketcher2D "Sketcher2D" interface
2700 def Sketcher2D (self):
2702 Obtain a 2D sketcher interface.
2705 sk = geompy.Sketcher2D()
2707 sk.addSegmentRelative(15, 70)
2708 sk.addSegmentPerpY(50)
2709 sk.addArcRadiusRelative(25, 15, 14.5, 0)
2710 sk.addArcCenterAbsolute(1, 1, 50, 50, 0, 0)
2711 sk.addArcDirectionRadiusLength(20, 20, 101, 162.13)
2713 Sketch_1 = sk.wire(geomObj_1)
2715 sk = Sketcher2D (self)
2718 ## Create a sketcher wire, following the numerical description,
2719 # passed through <VAR>theCoordinates</VAR> argument. \n
2720 # @param theCoordinates double values, defining points to create a wire,
2722 # @param theName Object name; when specified, this parameter is used
2723 # for result publication in the study. Otherwise, if automatic
2724 # publication is switched on, default value is used for result name.
2726 # @return New GEOM.GEOM_Object, containing the created wire.
2728 # @ref tui_3dsketcher_page "Example"
2729 @ManageTransactions("CurvesOp")
2730 def Make3DSketcher(self, theCoordinates, theName=None):
2732 Create a sketcher wire, following the numerical description,
2733 passed through theCoordinates argument.
2736 theCoordinates double values, defining points to create a wire,
2738 theName Object name; when specified, this parameter is used
2739 for result publication in the study. Otherwise, if automatic
2740 publication is switched on, default value is used for result name.
2743 New GEOM_Object, containing the created wire.
2745 theCoordinates,Parameters = ParseParameters(theCoordinates)
2746 anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
2747 RaiseIfFailed("Make3DSketcher", self.CurvesOp)
2748 anObj.SetParameters(Parameters)
2749 self._autoPublish(anObj, theName, "wire")
2752 ## Obtain a 3D sketcher interface
2753 # @return An instance of @ref gsketcher.Sketcher3D "Sketcher3D" interface
2755 # @ref tui_3dsketcher_page "Example"
2756 def Sketcher3D (self):
2758 Obtain a 3D sketcher interface.
2761 sk = geompy.Sketcher3D()
2762 sk.addPointsAbsolute(0,0,0, 70,0,0)
2763 sk.addPointsRelative(0, 0, 130)
2764 sk.addPointAnglesLength("OXY", 50, 0, 100)
2765 sk.addPointAnglesLength("OXZ", 30, 80, 130)
2767 a3D_Sketcher_1 = sk.wire()
2769 sk = Sketcher3D (self)
2772 ## Obtain a 2D polyline creation interface
2773 # @return An instance of @ref gsketcher.Polyline2D "Polyline2D" interface
2775 # @ref tui_3dsketcher_page "Example"
2776 def Polyline2D (self):
2778 Obtain a 2D polyline creation interface.
2781 pl = geompy.Polyline2D()
2782 pl.addSection("section 1", GEOM.Polyline, True)
2783 pl.addPoints(0, 0, 10, 0, 10, 10)
2784 pl.addSection("section 2", GEOM.Interpolation, False)
2785 pl.addPoints(20, 0, 30, 0, 30, 10)
2786 resultObj = pl.result(WorkingPlane)
2788 pl = Polyline2D (self)
2791 # end of l3_sketcher
2794 ## @addtogroup l3_3d_primitives
2797 ## Create a box by coordinates of two opposite vertices.
2799 # @param x1,y1,z1 double values, defining first point it.
2800 # @param x2,y2,z2 double values, defining first point it.
2801 # @param theName Object name; when specified, this parameter is used
2802 # for result publication in the study. Otherwise, if automatic
2803 # publication is switched on, default value is used for result name.
2805 # @return New GEOM.GEOM_Object, containing the created box.
2807 # @ref tui_creation_box "Example"
2808 def MakeBox(self, x1, y1, z1, x2, y2, z2, theName=None):
2810 Create a box by coordinates of two opposite vertices.
2813 x1,y1,z1 double values, defining first point.
2814 x2,y2,z2 double values, defining second point.
2815 theName Object name; when specified, this parameter is used
2816 for result publication in the study. Otherwise, if automatic
2817 publication is switched on, default value is used for result name.
2820 New GEOM.GEOM_Object, containing the created box.
2822 # Example: see GEOM_TestAll.py
2823 pnt1 = self.MakeVertex(x1,y1,z1)
2824 pnt2 = self.MakeVertex(x2,y2,z2)
2825 # note: auto-publishing is done in self.MakeBoxTwoPnt()
2826 return self.MakeBoxTwoPnt(pnt1, pnt2, theName)
2828 ## Create a box with specified dimensions along the coordinate axes
2829 # and with edges, parallel to the coordinate axes.
2830 # Center of the box will be at point (DX/2, DY/2, DZ/2).
2831 # @param theDX Length of Box edges, parallel to OX axis.
2832 # @param theDY Length of Box edges, parallel to OY axis.
2833 # @param theDZ Length of Box edges, parallel to OZ axis.
2834 # @param theName Object name; when specified, this parameter is used
2835 # for result publication in the study. Otherwise, if automatic
2836 # publication is switched on, default value is used for result name.
2838 # @return New GEOM.GEOM_Object, containing the created box.
2840 # @ref tui_creation_box "Example"
2841 @ManageTransactions("PrimOp")
2842 def MakeBoxDXDYDZ(self, theDX, theDY, theDZ, theName=None):
2844 Create a box with specified dimensions along the coordinate axes
2845 and with edges, parallel to the coordinate axes.
2846 Center of the box will be at point (DX/2, DY/2, DZ/2).
2849 theDX Length of Box edges, parallel to OX axis.
2850 theDY Length of Box edges, parallel to OY axis.
2851 theDZ Length of Box edges, parallel to OZ axis.
2852 theName Object name; when specified, this parameter is used
2853 for result publication in the study. Otherwise, if automatic
2854 publication is switched on, default value is used for result name.
2857 New GEOM.GEOM_Object, containing the created box.
2859 # Example: see GEOM_TestAll.py
2860 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
2861 anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
2862 RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
2863 anObj.SetParameters(Parameters)
2864 self._autoPublish(anObj, theName, "box")
2867 ## Create a box with two specified opposite vertices,
2868 # and with edges, parallel to the coordinate axes
2869 # @param thePnt1 First of two opposite vertices.
2870 # @param thePnt2 Second of two opposite vertices.
2871 # @param theName Object name; when specified, this parameter is used
2872 # for result publication in the study. Otherwise, if automatic
2873 # publication is switched on, default value is used for result name.
2875 # @return New GEOM.GEOM_Object, containing the created box.
2877 # @ref tui_creation_box "Example"
2878 @ManageTransactions("PrimOp")
2879 def MakeBoxTwoPnt(self, thePnt1, thePnt2, theName=None):
2881 Create a box with two specified opposite vertices,
2882 and with edges, parallel to the coordinate axes
2885 thePnt1 First of two opposite vertices.
2886 thePnt2 Second of two opposite vertices.
2887 theName Object name; when specified, this parameter is used
2888 for result publication in the study. Otherwise, if automatic
2889 publication is switched on, default value is used for result name.
2892 New GEOM.GEOM_Object, containing the created box.
2894 # Example: see GEOM_TestAll.py
2895 anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
2896 RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
2897 self._autoPublish(anObj, theName, "box")
2900 ## Create a face with specified dimensions with edges parallel to coordinate axes.
2901 # @param theH height of Face.
2902 # @param theW width of Face.
2903 # @param theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2904 # @param theName Object name; when specified, this parameter is used
2905 # for result publication in the study. Otherwise, if automatic
2906 # publication is switched on, default value is used for result name.
2908 # @return New GEOM.GEOM_Object, containing the created face.
2910 # @ref tui_creation_face "Example"
2911 @ManageTransactions("PrimOp")
2912 def MakeFaceHW(self, theH, theW, theOrientation, theName=None):
2914 Create a face with specified dimensions with edges parallel to coordinate axes.
2917 theH height of Face.
2919 theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2920 theName Object name; when specified, this parameter is used
2921 for result publication in the study. Otherwise, if automatic
2922 publication is switched on, default value is used for result name.
2925 New GEOM.GEOM_Object, containing the created face.
2927 # Example: see GEOM_TestAll.py
2928 theH,theW,Parameters = ParseParameters(theH, theW)
2929 anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
2930 RaiseIfFailed("MakeFaceHW", self.PrimOp)
2931 anObj.SetParameters(Parameters)
2932 self._autoPublish(anObj, theName, "rectangle")
2935 ## Create a face from another plane and two sizes,
2936 # vertical size and horisontal size.
2937 # @param theObj Normale vector to the creating face or
2939 # @param theH Height (vertical size).
2940 # @param theW Width (horisontal size).
2941 # @param theName Object name; when specified, this parameter is used
2942 # for result publication in the study. Otherwise, if automatic
2943 # publication is switched on, default value is used for result name.
2945 # @return New GEOM.GEOM_Object, containing the created face.
2947 # @ref tui_creation_face "Example"
2948 @ManageTransactions("PrimOp")
2949 def MakeFaceObjHW(self, theObj, theH, theW, theName=None):
2951 Create a face from another plane and two sizes,
2952 vertical size and horisontal size.
2955 theObj Normale vector to the creating face or
2957 theH Height (vertical size).
2958 theW Width (horisontal size).
2959 theName Object name; when specified, this parameter is used
2960 for result publication in the study. Otherwise, if automatic
2961 publication is switched on, default value is used for result name.
2964 New GEOM_Object, containing the created face.
2966 # Example: see GEOM_TestAll.py
2967 theH,theW,Parameters = ParseParameters(theH, theW)
2968 anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
2969 RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
2970 anObj.SetParameters(Parameters)
2971 self._autoPublish(anObj, theName, "rectangle")
2974 ## Create a disk with given center, normal vector and radius.
2975 # @param thePnt Disk center.
2976 # @param theVec Vector, normal to the plane of the disk.
2977 # @param theR Disk radius.
2978 # @param theName Object name; when specified, this parameter is used
2979 # for result publication in the study. Otherwise, if automatic
2980 # publication is switched on, default value is used for result name.
2982 # @return New GEOM.GEOM_Object, containing the created disk.
2984 # @ref tui_creation_disk "Example"
2985 @ManageTransactions("PrimOp")
2986 def MakeDiskPntVecR(self, thePnt, theVec, theR, theName=None):
2988 Create a disk with given center, normal vector and radius.
2992 theVec Vector, normal to the plane of the disk.
2994 theName Object name; when specified, this parameter is used
2995 for result publication in the study. Otherwise, if automatic
2996 publication is switched on, default value is used for result name.
2999 New GEOM.GEOM_Object, containing the created disk.
3001 # Example: see GEOM_TestAll.py
3002 theR,Parameters = ParseParameters(theR)
3003 anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
3004 RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
3005 anObj.SetParameters(Parameters)
3006 self._autoPublish(anObj, theName, "disk")
3009 ## Create a disk, passing through three given points
3010 # @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
3011 # @param theName Object name; when specified, this parameter is used
3012 # for result publication in the study. Otherwise, if automatic
3013 # publication is switched on, default value is used for result name.
3015 # @return New GEOM.GEOM_Object, containing the created disk.
3017 # @ref tui_creation_disk "Example"
3018 @ManageTransactions("PrimOp")
3019 def MakeDiskThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
3021 Create a disk, passing through three given points
3024 thePnt1,thePnt2,thePnt3 Points, defining the disk.
3025 theName Object name; when specified, this parameter is used
3026 for result publication in the study. Otherwise, if automatic
3027 publication is switched on, default value is used for result name.
3030 New GEOM.GEOM_Object, containing the created disk.
3032 # Example: see GEOM_TestAll.py
3033 anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
3034 RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
3035 self._autoPublish(anObj, theName, "disk")
3038 ## Create a disk with specified dimensions along OX-OY coordinate axes.
3039 # @param theR Radius of Face.
3040 # @param theOrientation set the orientation belong axis OXY or OYZ or OZX
3041 # @param theName Object name; when specified, this parameter is used
3042 # for result publication in the study. Otherwise, if automatic
3043 # publication is switched on, default value is used for result name.
3045 # @return New GEOM.GEOM_Object, containing the created disk.
3047 # @ref tui_creation_face "Example"
3048 @ManageTransactions("PrimOp")
3049 def MakeDiskR(self, theR, theOrientation, theName=None):
3051 Create a disk with specified dimensions along OX-OY coordinate axes.
3054 theR Radius of Face.
3055 theOrientation set the orientation belong axis OXY or OYZ or OZX
3056 theName Object name; when specified, this parameter is used
3057 for result publication in the study. Otherwise, if automatic
3058 publication is switched on, default value is used for result name.
3061 New GEOM.GEOM_Object, containing the created disk.
3064 Disk3 = geompy.MakeDiskR(100., 1)
3066 # Example: see GEOM_TestAll.py
3067 theR,Parameters = ParseParameters(theR)
3068 anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
3069 RaiseIfFailed("MakeDiskR", self.PrimOp)
3070 anObj.SetParameters(Parameters)
3071 self._autoPublish(anObj, theName, "disk")
3074 ## Create a cylinder with given base point, axis, radius and height.
3075 # @param thePnt Central point of cylinder base.
3076 # @param theAxis Cylinder axis.
3077 # @param theR Cylinder radius.
3078 # @param theH Cylinder height.
3079 # @param theName Object name; when specified, this parameter is used
3080 # for result publication in the study. Otherwise, if automatic
3081 # publication is switched on, default value is used for result name.
3083 # @return New GEOM.GEOM_Object, containing the created cylinder.
3085 # @ref tui_creation_cylinder "Example"
3086 @ManageTransactions("PrimOp")
3087 def MakeCylinder(self, thePnt, theAxis, theR, theH, theName=None):
3089 Create a cylinder with given base point, axis, radius and height.
3092 thePnt Central point of cylinder base.
3093 theAxis Cylinder axis.
3094 theR Cylinder radius.
3095 theH Cylinder height.
3096 theName Object name; when specified, this parameter is used
3097 for result publication in the study. Otherwise, if automatic
3098 publication is switched on, default value is used for result name.
3101 New GEOM.GEOM_Object, containing the created cylinder.
3103 # Example: see GEOM_TestAll.py
3104 theR,theH,Parameters = ParseParameters(theR, theH)
3105 anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
3106 RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
3107 anObj.SetParameters(Parameters)
3108 self._autoPublish(anObj, theName, "cylinder")
3111 ## Create a portion of cylinder with given base point, axis, radius, height and angle.
3112 # @param thePnt Central point of cylinder base.
3113 # @param theAxis Cylinder axis.
3114 # @param theR Cylinder radius.
3115 # @param theH Cylinder height.
3116 # @param theA Cylinder angle in radians.
3117 # @param theName Object name; when specified, this parameter is used
3118 # for result publication in the study. Otherwise, if automatic
3119 # publication is switched on, default value is used for result name.
3121 # @return New GEOM.GEOM_Object, containing the created cylinder.
3123 # @ref tui_creation_cylinder "Example"
3124 @ManageTransactions("PrimOp")
3125 def MakeCylinderA(self, thePnt, theAxis, theR, theH, theA, theName=None):
3127 Create a portion of cylinder with given base point, axis, radius, height and angle.
3130 thePnt Central point of cylinder base.
3131 theAxis Cylinder axis.
3132 theR Cylinder radius.
3133 theH Cylinder height.
3134 theA Cylinder angle in radians.
3135 theName Object name; when specified, this parameter is used
3136 for result publication in the study. Otherwise, if automatic
3137 publication is switched on, default value is used for result name.
3140 New GEOM.GEOM_Object, containing the created cylinder.
3142 # Example: see GEOM_TestAll.py
3144 if isinstance(theA,str):
3146 theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
3148 theA = theA*math.pi/180.
3149 if theA<=0. or theA>=2*math.pi:
3150 raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
3151 anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
3152 RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
3153 anObj.SetParameters(Parameters)
3154 self._autoPublish(anObj, theName, "cylinder")
3157 ## Create a cylinder with given radius and height at
3158 # the origin of coordinate system. Axis of the cylinder
3159 # will be collinear to the OZ axis of the coordinate system.
3160 # @param theR Cylinder radius.
3161 # @param theH Cylinder height.
3162 # @param theName Object name; when specified, this parameter is used
3163 # for result publication in the study. Otherwise, if automatic
3164 # publication is switched on, default value is used for result name.
3166 # @return New GEOM.GEOM_Object, containing the created cylinder.
3168 # @ref tui_creation_cylinder "Example"
3169 @ManageTransactions("PrimOp")
3170 def MakeCylinderRH(self, theR, theH, theName=None):
3172 Create a cylinder with given radius and height at
3173 the origin of coordinate system. Axis of the cylinder
3174 will be collinear to the OZ axis of the coordinate system.
3177 theR Cylinder radius.
3178 theH Cylinder height.
3179 theName Object name; when specified, this parameter is used
3180 for result publication in the study. Otherwise, if automatic
3181 publication is switched on, default value is used for result name.
3184 New GEOM.GEOM_Object, containing the created cylinder.
3186 # Example: see GEOM_TestAll.py
3187 theR,theH,Parameters = ParseParameters(theR, theH)
3188 anObj = self.PrimOp.MakeCylinderRH(theR, theH)
3189 RaiseIfFailed("MakeCylinderRH", self.PrimOp)
3190 anObj.SetParameters(Parameters)
3191 self._autoPublish(anObj, theName, "cylinder")
3194 ## Create a portion of cylinder with given radius, height and angle at
3195 # the origin of coordinate system. Axis of the cylinder
3196 # will be collinear to the OZ axis of the coordinate system.
3197 # @param theR Cylinder radius.
3198 # @param theH Cylinder height.
3199 # @param theA Cylinder angle in radians.
3200 # @param theName Object name; when specified, this parameter is used
3201 # for result publication in the study. Otherwise, if automatic
3202 # publication is switched on, default value is used for result name.
3204 # @return New GEOM.GEOM_Object, containing the created cylinder.
3206 # @ref tui_creation_cylinder "Example"
3207 @ManageTransactions("PrimOp")
3208 def MakeCylinderRHA(self, theR, theH, theA, theName=None):
3210 Create a portion of cylinder with given radius, height and angle at
3211 the origin of coordinate system. Axis of the cylinder
3212 will be collinear to the OZ axis of the coordinate system.
3215 theR Cylinder radius.
3216 theH Cylinder height.
3217 theA Cylinder angle in radians.
3218 theName Object name; when specified, this parameter is used
3219 for result publication in the study. Otherwise, if automatic
3220 publication is switched on, default value is used for result name.
3223 New GEOM.GEOM_Object, containing the created cylinder.
3225 # Example: see GEOM_TestAll.py
3227 if isinstance(theA,str):
3229 theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
3231 theA = theA*math.pi/180.
3232 if theA<=0. or theA>=2*math.pi:
3233 raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
3234 anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
3235 RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
3236 anObj.SetParameters(Parameters)
3237 self._autoPublish(anObj, theName, "cylinder")
3240 ## Create a sphere with given center and radius.
3241 # @param thePnt Sphere center.
3242 # @param theR Sphere radius.
3243 # @param theName Object name; when specified, this parameter is used
3244 # for result publication in the study. Otherwise, if automatic
3245 # publication is switched on, default value is used for result name.
3247 # @return New GEOM.GEOM_Object, containing the created sphere.
3249 # @ref tui_creation_sphere "Example"
3250 @ManageTransactions("PrimOp")
3251 def MakeSpherePntR(self, thePnt, theR, theName=None):
3253 Create a sphere with given center and radius.
3256 thePnt Sphere center.
3258 theName Object name; when specified, this parameter is used
3259 for result publication in the study. Otherwise, if automatic
3260 publication is switched on, default value is used for result name.
3263 New GEOM.GEOM_Object, containing the created sphere.
3265 # Example: see GEOM_TestAll.py
3266 theR,Parameters = ParseParameters(theR)
3267 anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
3268 RaiseIfFailed("MakeSpherePntR", self.PrimOp)
3269 anObj.SetParameters(Parameters)
3270 self._autoPublish(anObj, theName, "sphere")
3273 ## Create a sphere with given center and radius.
3274 # @param x,y,z Coordinates of sphere center.
3275 # @param theR Sphere radius.
3276 # @param theName Object name; when specified, this parameter is used
3277 # for result publication in the study. Otherwise, if automatic
3278 # publication is switched on, default value is used for result name.
3280 # @return New GEOM.GEOM_Object, containing the created sphere.
3282 # @ref tui_creation_sphere "Example"
3283 def MakeSphere(self, x, y, z, theR, theName=None):
3285 Create a sphere with given center and radius.
3288 x,y,z Coordinates of sphere center.
3290 theName Object name; when specified, this parameter is used
3291 for result publication in the study. Otherwise, if automatic
3292 publication is switched on, default value is used for result name.
3295 New GEOM.GEOM_Object, containing the created sphere.
3297 # Example: see GEOM_TestAll.py
3298 point = self.MakeVertex(x, y, z)
3299 # note: auto-publishing is done in self.MakeSpherePntR()
3300 anObj = self.MakeSpherePntR(point, theR, theName)
3303 ## Create a sphere with given radius at the origin of coordinate system.
3304 # @param theR Sphere radius.
3305 # @param theName Object name; when specified, this parameter is used
3306 # for result publication in the study. Otherwise, if automatic
3307 # publication is switched on, default value is used for result name.
3309 # @return New GEOM.GEOM_Object, containing the created sphere.
3311 # @ref tui_creation_sphere "Example"
3312 @ManageTransactions("PrimOp")
3313 def MakeSphereR(self, theR, theName=None):
3315 Create a sphere with given radius at the origin of coordinate system.
3319 theName Object name; when specified, this parameter is used
3320 for result publication in the study. Otherwise, if automatic
3321 publication is switched on, default value is used for result name.
3324 New GEOM.GEOM_Object, containing the created sphere.
3326 # Example: see GEOM_TestAll.py
3327 theR,Parameters = ParseParameters(theR)
3328 anObj = self.PrimOp.MakeSphereR(theR)
3329 RaiseIfFailed("MakeSphereR", self.PrimOp)
3330 anObj.SetParameters(Parameters)
3331 self._autoPublish(anObj, theName, "sphere")
3334 ## Create a cone with given base point, axis, height and radiuses.
3335 # @param thePnt Central point of the first cone base.
3336 # @param theAxis Cone axis.
3337 # @param theR1 Radius of the first cone base.
3338 # @param theR2 Radius of the second cone base.
3339 # \note If both radiuses are non-zero, the cone will be truncated.
3340 # \note If the radiuses are equal, a cylinder will be created instead.
3341 # @param theH Cone height.
3342 # @param theName Object name; when specified, this parameter is used
3343 # for result publication in the study. Otherwise, if automatic
3344 # publication is switched on, default value is used for result name.
3346 # @return New GEOM.GEOM_Object, containing the created cone.
3348 # @ref tui_creation_cone "Example"
3349 @ManageTransactions("PrimOp")
3350 def MakeCone(self, thePnt, theAxis, theR1, theR2, theH, theName=None):
3352 Create a cone with given base point, axis, height and radiuses.
3355 thePnt Central point of the first cone base.
3357 theR1 Radius of the first cone base.
3358 theR2 Radius of the second cone base.
3360 theName Object name; when specified, this parameter is used
3361 for result publication in the study. Otherwise, if automatic
3362 publication is switched on, default value is used for result name.
3365 If both radiuses are non-zero, the cone will be truncated.
3366 If the radiuses are equal, a cylinder will be created instead.
3369 New GEOM.GEOM_Object, containing the created cone.
3371 # Example: see GEOM_TestAll.py
3372 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
3373 anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
3374 RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
3375 anObj.SetParameters(Parameters)
3376 self._autoPublish(anObj, theName, "cone")
3379 ## Create a cone with given height and radiuses at
3380 # the origin of coordinate system. Axis of the cone will
3381 # be collinear to the OZ axis of the coordinate system.
3382 # @param theR1 Radius of the first cone base.
3383 # @param theR2 Radius of the second cone base.
3384 # \note If both radiuses are non-zero, the cone will be truncated.
3385 # \note If the radiuses are equal, a cylinder will be created instead.
3386 # @param theH Cone height.
3387 # @param theName Object name; when specified, this parameter is used
3388 # for result publication in the study. Otherwise, if automatic
3389 # publication is switched on, default value is used for result name.
3391 # @return New GEOM.GEOM_Object, containing the created cone.
3393 # @ref tui_creation_cone "Example"
3394 @ManageTransactions("PrimOp")
3395 def MakeConeR1R2H(self, theR1, theR2, theH, theName=None):
3397 Create a cone with given height and radiuses at
3398 the origin of coordinate system. Axis of the cone will
3399 be collinear to the OZ axis of the coordinate system.
3402 theR1 Radius of the first cone base.
3403 theR2 Radius of the second cone base.
3405 theName Object name; when specified, this parameter is used
3406 for result publication in the study. Otherwise, if automatic
3407 publication is switched on, default value is used for result name.
3410 If both radiuses are non-zero, the cone will be truncated.
3411 If the radiuses are equal, a cylinder will be created instead.
3414 New GEOM.GEOM_Object, containing the created cone.
3416 # Example: see GEOM_TestAll.py
3417 theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
3418 anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
3419 RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
3420 anObj.SetParameters(Parameters)
3421 self._autoPublish(anObj, theName, "cone")
3424 ## Create a torus with given center, normal vector and radiuses.
3425 # @param thePnt Torus central point.
3426 # @param theVec Torus axis of symmetry.
3427 # @param theRMajor Torus major radius.
3428 # @param theRMinor Torus minor radius.
3429 # @param theName Object name; when specified, this parameter is used
3430 # for result publication in the study. Otherwise, if automatic
3431 # publication is switched on, default value is used for result name.
3433 # @return New GEOM.GEOM_Object, containing the created torus.
3435 # @ref tui_creation_torus "Example"
3436 @ManageTransactions("PrimOp")
3437 def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor, theName=None):
3439 Create a torus with given center, normal vector and radiuses.
3442 thePnt Torus central point.
3443 theVec Torus axis of symmetry.
3444 theRMajor Torus major radius.
3445 theRMinor Torus minor radius.
3446 theName Object name; when specified, this parameter is used
3447 for result publication in the study. Otherwise, if automatic
3448 publication is switched on, default value is used for result name.
3451 New GEOM.GEOM_Object, containing the created torus.
3453 # Example: see GEOM_TestAll.py
3454 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
3455 anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
3456 RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
3457 anObj.SetParameters(Parameters)
3458 self._autoPublish(anObj, theName, "torus")
3461 ## Create a torus with given radiuses at the origin of coordinate system.
3462 # @param theRMajor Torus major radius.
3463 # @param theRMinor Torus minor radius.
3464 # @param theName Object name; when specified, this parameter is used
3465 # for result publication in the study. Otherwise, if automatic
3466 # publication is switched on, default value is used for result name.
3468 # @return New GEOM.GEOM_Object, containing the created torus.
3470 # @ref tui_creation_torus "Example"
3471 @ManageTransactions("PrimOp")
3472 def MakeTorusRR(self, theRMajor, theRMinor, theName=None):
3474 Create a torus with given radiuses at the origin of coordinate system.
3477 theRMajor Torus major radius.
3478 theRMinor Torus minor radius.
3479 theName Object name; when specified, this parameter is used
3480 for result publication in the study. Otherwise, if automatic
3481 publication is switched on, default value is used for result name.
3484 New GEOM.GEOM_Object, containing the created torus.
3486 # Example: see GEOM_TestAll.py
3487 theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
3488 anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
3489 RaiseIfFailed("MakeTorusRR", self.PrimOp)
3490 anObj.SetParameters(Parameters)
3491 self._autoPublish(anObj, theName, "torus")
3494 # end of l3_3d_primitives
3497 ## @addtogroup l3_complex
3500 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
3501 # @param theBase Base shape to be extruded.
3502 # @param thePoint1 First end of extrusion vector.
3503 # @param thePoint2 Second end of extrusion vector.
3504 # @param theScaleFactor Use it to make prism with scaled second base.
3505 # Nagative value means not scaled second base.
3506 # @param theName Object name; when specified, this parameter is used
3507 # for result publication in the study. Otherwise, if automatic
3508 # publication is switched on, default value is used for result name.
3510 # @return New GEOM.GEOM_Object, containing the created prism.
3512 # @ref tui_creation_prism "Example"
3513 @ManageTransactions("PrimOp")
3514 def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0, theName=None):
3516 Create a shape by extrusion of the base shape along a vector, defined by two points.
3519 theBase Base shape to be extruded.
3520 thePoint1 First end of extrusion vector.
3521 thePoint2 Second end of extrusion vector.
3522 theScaleFactor Use it to make prism with scaled second base.
3523 Nagative value means not scaled second base.
3524 theName Object name; when specified, this parameter is used
3525 for result publication in the study. Otherwise, if automatic
3526 publication is switched on, default value is used for result name.
3529 New GEOM.GEOM_Object, containing the created prism.
3531 # Example: see GEOM_TestAll.py
3534 if theScaleFactor > 0:
3535 theScaleFactor,Parameters = ParseParameters(theScaleFactor)
3536 anObj = self.PrimOp.MakePrismTwoPntWithScaling(theBase, thePoint1, thePoint2, theScaleFactor)
3538 anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
3539 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
3540 anObj.SetParameters(Parameters)
3541 self._autoPublish(anObj, theName, "prism")
3544 ## Create a shape by extrusion of the base shape along a
3545 # vector, defined by two points, in 2 Ways (forward/backward).
3546 # @param theBase Base shape to be extruded.
3547 # @param thePoint1 First end of extrusion vector.
3548 # @param thePoint2 Second end of extrusion vector.
3549 # @param theName Object name; when specified, this parameter is used
3550 # for result publication in the study. Otherwise, if automatic
3551 # publication is switched on, default value is used for result name.
3553 # @return New GEOM.GEOM_Object, containing the created prism.
3555 # @ref tui_creation_prism "Example"
3556 @ManageTransactions("PrimOp")
3557 def MakePrism2Ways(self, theBase, thePoint1, thePoint2, theName=None):
3559 Create a shape by extrusion of the base shape along a
3560 vector, defined by two points, in 2 Ways (forward/backward).
3563 theBase Base shape to be extruded.
3564 thePoint1 First end of extrusion vector.
3565 thePoint2 Second end of extrusion vector.
3566 theName Object name; when specified, this parameter is used
3567 for result publication in the study. Otherwise, if automatic
3568 publication is switched on, default value is used for result name.
3571 New GEOM.GEOM_Object, containing the created prism.
3573 # Example: see GEOM_TestAll.py
3574 anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
3575 RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
3576 self._autoPublish(anObj, theName, "prism")
3579 ## Create a shape by extrusion of the base shape along the vector,
3580 # i.e. all the space, transfixed by the base shape during its translation
3581 # along the vector on the given distance.
3582 # @param theBase Base shape to be extruded.
3583 # @param theVec Direction of extrusion.
3584 # @param theH Prism dimension along theVec.
3585 # @param theScaleFactor Use it to make prism with scaled second base.
3586 # Negative value means not scaled second base.
3587 # @param theName Object name; when specified, this parameter is used
3588 # for result publication in the study. Otherwise, if automatic
3589 # publication is switched on, default value is used for result name.
3591 # @return New GEOM.GEOM_Object, containing the created prism.
3593 # @ref tui_creation_prism "Example"
3594 @ManageTransactions("PrimOp")
3595 def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0, theName=None):
3597 Create a shape by extrusion of the base shape along the vector,
3598 i.e. all the space, transfixed by the base shape during its translation
3599 along the vector on the given distance.
3602 theBase Base shape to be extruded.
3603 theVec Direction of extrusion.
3604 theH Prism dimension along theVec.
3605 theScaleFactor Use it to make prism with scaled second base.
3606 Negative value means not scaled second base.
3607 theName Object name; when specified, this parameter is used
3608 for result publication in the study. Otherwise, if automatic
3609 publication is switched on, default value is used for result name.
3612 New GEOM.GEOM_Object, containing the created prism.
3614 # Example: see GEOM_TestAll.py
3617 if theScaleFactor > 0:
3618 theH,theScaleFactor,Parameters = ParseParameters(theH,theScaleFactor)
3619 anObj = self.PrimOp.MakePrismVecHWithScaling(theBase, theVec, theH, theScaleFactor)
3621 theH,Parameters = ParseParameters(theH)
3622 anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
3623 RaiseIfFailed("MakePrismVecH", self.PrimOp)
3624 anObj.SetParameters(Parameters)
3625 self._autoPublish(anObj, theName, "prism")
3628 ## Create a shape by extrusion of the base shape along the vector,
3629 # i.e. all the space, transfixed by the base shape during its translation
3630 # along the vector on the given distance in 2 Ways (forward/backward).
3631 # @param theBase Base shape to be extruded.
3632 # @param theVec Direction of extrusion.
3633 # @param theH Prism dimension along theVec in forward direction.
3634 # @param theName Object name; when specified, this parameter is used
3635 # for result publication in the study. Otherwise, if automatic
3636 # publication is switched on, default value is used for result name.
3638 # @return New GEOM.GEOM_Object, containing the created prism.
3640 # @ref tui_creation_prism "Example"
3641 @ManageTransactions("PrimOp")
3642 def MakePrismVecH2Ways(self, theBase, theVec, theH, theName=None):
3644 Create a shape by extrusion of the base shape along the vector,
3645 i.e. all the space, transfixed by the base shape during its translation
3646 along the vector on the given distance in 2 Ways (forward/backward).
3649 theBase Base shape to be extruded.
3650 theVec Direction of extrusion.
3651 theH Prism dimension along theVec in forward direction.
3652 theName Object name; when specified, this parameter is used
3653 for result publication in the study. Otherwise, if automatic
3654 publication is switched on, default value is used for result name.
3657 New GEOM.GEOM_Object, containing the created prism.
3659 # Example: see GEOM_TestAll.py
3660 theH,Parameters = ParseParameters(theH)
3661 anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
3662 RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
3663 anObj.SetParameters(Parameters)
3664 self._autoPublish(anObj, theName, "prism")
3667 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
3668 # @param theBase Base shape to be extruded.
3669 # @param theDX, theDY, theDZ Directions of extrusion.
3670 # @param theScaleFactor Use it to make prism with scaled second base.
3671 # Nagative value means not scaled second base.
3672 # @param theName Object name; when specified, this parameter is used
3673 # for result publication in the study. Otherwise, if automatic
3674 # publication is switched on, default value is used for result name.
3676 # @return New GEOM.GEOM_Object, containing the created prism.
3678 # @ref tui_creation_prism "Example"
3679 @ManageTransactions("PrimOp")
3680 def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0, theName=None):
3682 Create a shape by extrusion of the base shape along the dx, dy, dz direction
3685 theBase Base shape to be extruded.
3686 theDX, theDY, theDZ Directions of extrusion.
3687 theScaleFactor Use it to make prism with scaled second base.
3688 Nagative value means not scaled second base.
3689 theName Object name; when specified, this parameter is used
3690 for result publication in the study. Otherwise, if automatic
3691 publication is switched on, default value is used for result name.
3694 New GEOM.GEOM_Object, containing the created prism.
3696 # Example: see GEOM_TestAll.py
3699 if theScaleFactor > 0:
3700 theDX,theDY,theDZ,theScaleFactor,Parameters = ParseParameters(theDX, theDY, theDZ, theScaleFactor)
3701 anObj = self.PrimOp.MakePrismDXDYDZWithScaling(theBase, theDX, theDY, theDZ, theScaleFactor)
3703 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
3704 anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
3705 RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
3706 anObj.SetParameters(Parameters)
3707 self._autoPublish(anObj, theName, "prism")
3710 ## Create a shape by extrusion of the base shape along the dx, dy, dz direction
3711 # i.e. all the space, transfixed by the base shape during its translation
3712 # along the vector on the given distance in 2 Ways (forward/backward).
3713 # @param theBase Base shape to be extruded.
3714 # @param theDX, theDY, theDZ Directions of extrusion.
3715 # @param theName Object name; when specified, this parameter is used
3716 # for result publication in the study. Otherwise, if automatic
3717 # publication is switched on, default value is used for result name.
3719 # @return New GEOM.GEOM_Object, containing the created prism.
3721 # @ref tui_creation_prism "Example"
3722 @ManageTransactions("PrimOp")
3723 def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ, theName=None):
3725 Create a shape by extrusion of the base shape along the dx, dy, dz direction
3726 i.e. all the space, transfixed by the base shape during its translation
3727 along the vector on the given distance in 2 Ways (forward/backward).
3730 theBase Base shape to be extruded.
3731 theDX, theDY, theDZ Directions of extrusion.
3732 theName Object name; when specified, this parameter is used
3733 for result publication in the study. Otherwise, if automatic
3734 publication is switched on, default value is used for result name.
3737 New GEOM.GEOM_Object, containing the created prism.
3739 # Example: see GEOM_TestAll.py
3740 theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
3741 anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
3742 RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
3743 anObj.SetParameters(Parameters)
3744 self._autoPublish(anObj, theName, "prism")
3747 ## Create a shape by revolution of the base shape around the axis
3748 # on the given angle, i.e. all the space, transfixed by the base
3749 # shape during its rotation around the axis on the given angle.
3750 # @param theBase Base shape to be rotated.
3751 # @param theAxis Rotation axis.
3752 # @param theAngle Rotation angle in radians.
3753 # @param theName Object name; when specified, this parameter is used
3754 # for result publication in the study. Otherwise, if automatic
3755 # publication is switched on, default value is used for result name.
3757 # @return New GEOM.GEOM_Object, containing the created revolution.
3759 # @ref tui_creation_revolution "Example"
3760 @ManageTransactions("PrimOp")
3761 def MakeRevolution(self, theBase, theAxis, theAngle, theName=None):
3763 Create a shape by revolution of the base shape around the axis
3764 on the given angle, i.e. all the space, transfixed by the base
3765 shape during its rotation around the axis on the given angle.
3768 theBase Base shape to be rotated.
3769 theAxis Rotation axis.
3770 theAngle Rotation angle in radians.
3771 theName Object name; when specified, this parameter is used
3772 for result publication in the study. Otherwise, if automatic
3773 publication is switched on, default value is used for result name.
3776 New GEOM.GEOM_Object, containing the created revolution.
3778 # Example: see GEOM_TestAll.py
3779 theAngle,Parameters = ParseParameters(theAngle)
3780 anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
3781 RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
3782 anObj.SetParameters(Parameters)
3783 self._autoPublish(anObj, theName, "revolution")
3786 ## Create a shape by revolution of the base shape around the axis
3787 # on the given angle, i.e. all the space, transfixed by the base
3788 # shape during its rotation around the axis on the given angle in
3789 # both directions (forward/backward)
3790 # @param theBase Base shape to be rotated.
3791 # @param theAxis Rotation axis.
3792 # @param theAngle Rotation angle in radians.
3793 # @param theName Object name; when specified, this parameter is used
3794 # for result publication in the study. Otherwise, if automatic
3795 # publication is switched on, default value is used for result name.
3797 # @return New GEOM.GEOM_Object, containing the created revolution.
3799 # @ref tui_creation_revolution "Example"
3800 @ManageTransactions("PrimOp")
3801 def MakeRevolution2Ways(self, theBase, theAxis, theAngle, theName=None):
3803 Create a shape by revolution of the base shape around the axis
3804 on the given angle, i.e. all the space, transfixed by the base
3805 shape during its rotation around the axis on the given angle in
3806 both directions (forward/backward).
3809 theBase Base shape to be rotated.
3810 theAxis Rotation axis.
3811 theAngle Rotation angle in radians.
3812 theName Object name; when specified, this parameter is used
3813 for result publication in the study. Otherwise, if automatic
3814 publication is switched on, default value is used for result name.
3817 New GEOM.GEOM_Object, containing the created revolution.
3819 theAngle,Parameters = ParseParameters(theAngle)
3820 anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
3821 RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
3822 anObj.SetParameters(Parameters)
3823 self._autoPublish(anObj, theName, "revolution")
3826 ## Create a face from a given set of contours.
3827 # @param theContours either a list or a compound of edges/wires.
3828 # @param theMinDeg a minimal degree of BSpline surface to create.
3829 # @param theMaxDeg a maximal degree of BSpline surface to create.
3830 # @param theTol2D a 2d tolerance to be reached.
3831 # @param theTol3D a 3d tolerance to be reached.
3832 # @param theNbIter a number of iteration of approximation algorithm.
3833 # @param theMethod Kind of method to perform filling operation
3834 # (see GEOM.filling_oper_method enum).
3835 # @param isApprox if True, BSpline curves are generated in the process
3836 # of surface construction. By default it is False, that means
3837 # the surface is created using given curves. The usage of
3838 # Approximation makes the algorithm work slower, but allows
3839 # building the surface for rather complex cases.
3840 # @param theName Object name; when specified, this parameter is used
3841 # for result publication in the study. Otherwise, if automatic
3842 # publication is switched on, default value is used for result name.
3844 # @return New GEOM.GEOM_Object (face), containing the created filling surface.
3846 # @ref tui_creation_filling "Example"
3847 @ManageTransactions("PrimOp")
3848 def MakeFilling(self, theContours, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001,
3849 theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0, theName=None):
3851 Create a face from a given set of contours.
3854 theContours either a list or a compound of edges/wires.
3855 theMinDeg a minimal degree of BSpline surface to create.
3856 theMaxDeg a maximal degree of BSpline surface to create.
3857 theTol2D a 2d tolerance to be reached.
3858 theTol3D a 3d tolerance to be reached.
3859 theNbIter a number of iteration of approximation algorithm.
3860 theMethod Kind of method to perform filling operation
3861 (see GEOM.filling_oper_method enum).
3862 isApprox if True, BSpline curves are generated in the process
3863 of surface construction. By default it is False, that means
3864 the surface is created using given curves. The usage of
3865 Approximation makes the algorithm work slower, but allows
3866 building the surface for rather complex cases.
3867 theName Object name; when specified, this parameter is used
3868 for result publication in the study. Otherwise, if automatic
3869 publication is switched on, default value is used for result name.
3872 New GEOM.GEOM_Object (face), containing the created filling surface.
3875 filling = geompy.MakeFilling(compound, 2, 5, 0.0001, 0.0001, 5)
3877 # Example: see GEOM_TestAll.py
3878 theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
3879 anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
3880 theTol2D, theTol3D, theNbIter,
3881 theMethod, isApprox)
3882 RaiseIfFailed("MakeFilling", self.PrimOp)
3883 anObj.SetParameters(Parameters)
3884 self._autoPublish(anObj, theName, "filling")
3888 ## Create a face from a given set of contours.
3889 # This method corresponds to MakeFilling() with isApprox=True.
3890 # @param theContours either a list or a compound of edges/wires.
3891 # @param theMinDeg a minimal degree of BSpline surface to create.
3892 # @param theMaxDeg a maximal degree of BSpline surface to create.
3893 # @param theTol3D a 3d tolerance to be reached.
3894 # @param theName Object name; when specified, this parameter is used
3895 # for result publication in the study. Otherwise, if automatic
3896 # publication is switched on, default value is used for result name.
3898 # @return New GEOM.GEOM_Object (face), containing the created filling surface.
3900 # @ref tui_creation_filling "Example"
3901 @ManageTransactions("PrimOp")
3902 def MakeFillingNew(self, theContours, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None):
3904 Create a filling from the given compound of contours.
3905 This method corresponds to MakeFilling() with isApprox=True.
3908 theContours either a list or a compound of edges/wires.
3909 theMinDeg a minimal degree of BSpline surface to create.
3910 theMaxDeg a maximal degree of BSpline surface to create.
3911 theTol3D a 3d tolerance to be reached.
3912 theName Object name; when specified, this parameter is used
3913 for result publication in the study. Otherwise, if automatic
3914 publication is switched on, default value is used for result name.
3917 New GEOM.GEOM_Object (face), containing the created filling surface.
3920 filling = geompy.MakeFillingNew(compound, 2, 5, 0.0001)
3922 # Example: see GEOM_TestAll.py
3923 theMinDeg,theMaxDeg,theTol3D,Parameters = ParseParameters(theMinDeg, theMaxDeg, theTol3D)
3924 anObj = self.PrimOp.MakeFilling(ToList(theContours), theMinDeg, theMaxDeg,
3925 0, theTol3D, 0, GEOM.FOM_Default, True)
3926 RaiseIfFailed("MakeFillingNew", self.PrimOp)
3927 anObj.SetParameters(Parameters)
3928 self._autoPublish(anObj, theName, "filling")
3931 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
3932 # @param theSeqSections - set of specified sections.
3933 # @param theModeSolid - mode defining building solid or shell
3934 # @param thePreci - precision 3D used for smoothing
3935 # @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
3936 # @param theName Object name; when specified, this parameter is used
3937 # for result publication in the study. Otherwise, if automatic
3938 # publication is switched on, default value is used for result name.
3940 # @return New GEOM.GEOM_Object, containing the created shell or solid.
3942 # @ref swig_todo "Example"
3943 @ManageTransactions("PrimOp")
3944 def MakeThruSections(self, theSeqSections, theModeSolid, thePreci, theRuled, theName=None):
3946 Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
3949 theSeqSections - set of specified sections.
3950 theModeSolid - mode defining building solid or shell
3951 thePreci - precision 3D used for smoothing
3952 theRuled - mode defining type of the result surfaces (ruled or smoothed).
3953 theName Object name; when specified, this parameter is used
3954 for result publication in the study. Otherwise, if automatic
3955 publication is switched on, default value is used for result name.
3958 New GEOM.GEOM_Object, containing the created shell or solid.
3960 # Example: see GEOM_TestAll.py
3961 anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
3962 RaiseIfFailed("MakeThruSections", self.PrimOp)
3963 self._autoPublish(anObj, theName, "filling")
3966 ## Create a shape by extrusion of the base shape along
3967 # the path shape. The path shape can be a wire or an edge. It is
3968 # possible to generate groups along with the result by means of
3969 # setting the flag \a IsGenerateGroups.<BR>
3970 # If \a thePath is a closed edge or wire and \a IsGenerateGroups is
3971 # set, an error is occurred. If \a thePath is not closed edge/wire,
3972 # the following groups are returned:
3973 # - If \a theBase is unclosed edge or wire: "Down", "Up", "Side1",
3975 # - If \a theBase is closed edge or wire, face or shell: "Down", "Up",
3978 # "Down" and "Up" groups contain:
3979 # - Edges if \a theBase is edge or wire;
3980 # - Faces if \a theBase is face or shell.<BR>
3982 # "Side1" and "Side2" groups contain edges generated from the first
3983 # and last vertices of \a theBase. The first and last vertices are
3984 # determined taking into account edge/wire orientation.<BR>
3985 # "Other" group represents faces generated from the bounding edges of
3988 # @param theBase Base shape to be extruded.
3989 # @param thePath Path shape to extrude the base shape along it.
3990 # @param IsGenerateGroups flag that tells if it is necessary to
3991 # create groups. It is equal to False by default.
3992 # @param theName Object name; when specified, this parameter is used
3993 # for result publication in the study. Otherwise, if automatic
3994 # publication is switched on, default value is used for result name.
3996 # @return New GEOM.GEOM_Object, containing the created pipe if
3997 # \a IsGenerateGroups is not set. Otherwise it returns a
3998 # list of GEOM.GEOM_Object. Its first element is the created pipe, the
3999 # remaining ones are created groups.
4001 # @ref tui_creation_pipe "Example"
4002 @ManageTransactions("PrimOp")
4003 def MakePipe(self, theBase, thePath,
4004 IsGenerateGroups=False, theName=None):
4006 Create a shape by extrusion of the base shape along
4007 the path shape. The path shape can be a wire or an edge. It is
4008 possible to generate groups along with the result by means of
4009 setting the flag IsGenerateGroups.
4010 If thePath is a closed edge or wire and IsGenerateGroups is
4011 set, an error is occurred. If thePath is not closed edge/wire,
4012 the following groups are returned:
4013 - If theBase is unclosed edge or wire: "Down", "Up", "Side1",
4015 - If theBase is closed edge or wire, face or shell: "Down", "Up",
4017 "Down" and "Up" groups contain:
4018 - Edges if theBase is edge or wire;
4019 - Faces if theBase is face or shell.
4020 "Side1" and "Side2" groups contain edges generated from the first
4021 and last vertices of theBase. The first and last vertices are
4022 determined taking into account edge/wire orientation.
4023 "Other" group represents faces generated from the bounding edges of
4027 theBase Base shape to be extruded.
4028 thePath Path shape to extrude the base shape along it.
4029 IsGenerateGroups flag that tells if it is necessary to
4030 create groups. It is equal to False by default.
4031 theName Object name; when specified, this parameter is used
4032 for result publication in the study. Otherwise, if automatic
4033 publication is switched on, default value is used for result name.
4036 New GEOM.GEOM_Object, containing the created pipe if
4037 IsGenerateGroups is not set. Otherwise it returns a
4038 list of GEOM.GEOM_Object. Its first element is the created pipe, the
4039 remaining ones are created groups.
4041 # Example: see GEOM_TestAll.py
4042 aList = self.PrimOp.MakePipe(theBase, thePath, IsGenerateGroups)
4043 RaiseIfFailed("MakePipe", self.PrimOp)
4045 if IsGenerateGroups:
4046 self._autoPublish(aList, theName, "pipe")
4049 self._autoPublish(aList[0], theName, "pipe")
4052 ## Create a shape by extrusion of the profile shape along
4053 # the path shape. The path shape can be a wire or an edge.
4054 # the several profiles can be specified in the several locations of path.
4055 # It is possible to generate groups along with the result by means of
4056 # setting the flag \a IsGenerateGroups. For detailed information on
4057 # groups that can be created please see the method MakePipe().
4058 # @param theSeqBases - list of Bases shape to be extruded.
4059 # @param theLocations - list of locations on the path corresponding
4060 # specified list of the Bases shapes. Number of locations
4061 # should be equal to number of bases or list of locations can be empty.
4062 # @param thePath - Path shape to extrude the base shape along it.
4063 # @param theWithContact - the mode defining that the section is translated to be in
4064 # contact with the spine.
4065 # @param theWithCorrection - defining that the section is rotated to be
4066 # orthogonal to the spine tangent in the correspondent point
4067 # @param IsGenerateGroups - flag that tells if it is necessary to
4068 # create groups. It is equal to False by default.
4069 # @param theName Object name; when specified, this parameter is used
4070 # for result publication in the study. Otherwise, if automatic
4071 # publication is switched on, default value is used for result name.
4073 # @return New GEOM.GEOM_Object, containing the created pipe if
4074 # \a IsGenerateGroups is not set. Otherwise it returns new
4075 # GEOM.ListOfGO. Its first element is the created pipe, the
4076 # remaining ones are created groups.
4078 # @ref tui_creation_pipe_with_diff_sec "Example"
4079 @ManageTransactions("PrimOp")
4080 def MakePipeWithDifferentSections(self, theSeqBases,
4081 theLocations, thePath,
4082 theWithContact, theWithCorrection,
4083 IsGenerateGroups=False, theName=None):
4085 Create a shape by extrusion of the profile shape along
4086 the path shape. The path shape can be a wire or an edge.
4087 the several profiles can be specified in the several locations of path.
4088 It is possible to generate groups along with the result by means of
4089 setting the flag IsGenerateGroups. For detailed information on
4090 groups that can be created please see the method geompy.MakePipe().
4093 theSeqBases - list of Bases shape to be extruded.
4094 theLocations - list of locations on the path corresponding
4095 specified list of the Bases shapes. Number of locations
4096 should be equal to number of bases or list of locations can be empty.
4097 thePath - Path shape to extrude the base shape along it.
4098 theWithContact - the mode defining that the section is translated to be in
4099 contact with the spine(0/1)
4100 theWithCorrection - defining that the section is rotated to be
4101 orthogonal to the spine tangent in the correspondent point (0/1)
4102 IsGenerateGroups - flag that tells if it is necessary to
4103 create groups. It is equal to False by default.
4104 theName Object name; when specified, this parameter is used
4105 for result publication in the study. Otherwise, if automatic
4106 publication is switched on, default value is used for result name.
4109 New GEOM.GEOM_Object, containing the created pipe if
4110 IsGenerateGroups is not set. Otherwise it returns new
4111 GEOM.ListOfGO. Its first element is the created pipe, the
4112 remaining ones are created groups.
4114 aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
4115 theLocations, thePath,
4116 theWithContact, theWithCorrection,
4117 False, IsGenerateGroups)
4118 RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
4120 if IsGenerateGroups:
4121 self._autoPublish(aList, theName, "pipe")
4124 self._autoPublish(aList[0], theName, "pipe")
4127 ## Create a shape by extrusion of the profile shape along
4128 # the path shape. This function is a version of
4129 # MakePipeWithDifferentSections() with the same parameters, except
4130 # eliminated theWithContact and theWithCorrection. So it is
4131 # possible to find the description of all parameters is in this
4132 # method. The difference is that this method performs the operation
4133 # step by step, i.e. it creates pipes between each pair of neighbor
4134 # sections and fuses them into a single shape.
4136 # @ref tui_creation_pipe_with_diff_sec "Example"
4137 @ManageTransactions("PrimOp")
4138 def MakePipeWithDifferentSectionsBySteps(self, theSeqBases,
4139 theLocations, thePath,
4140 IsGenerateGroups=False, theName=None):
4142 Create a shape by extrusion of the profile shape along
4143 the path shape. This function is a version of
4144 MakePipeWithDifferentSections() with the same parameters, except
4145 eliminated theWithContact and theWithCorrection. So it is
4146 possible to find the description of all parameters is in this
4147 method. The difference is that this method performs the operation
4148 step by step, i.e. it creates pipes between each pair of neighbor
4149 sections and fuses them into a single shape.
4151 aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
4152 theLocations, thePath,
4154 True, IsGenerateGroups)
4155 RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp)
4157 if IsGenerateGroups:
4158 self._autoPublish(aList, theName, "pipe")
4161 self._autoPublish(aList[0], theName, "pipe")
4164 ## Create a shape by extrusion of the profile shape along
4165 # the path shape. The path shape can be a wire or an edge.
4166 # the several profiles can be specified in the several locations of path.
4167 # It is possible to generate groups along with the result by means of
4168 # setting the flag \a IsGenerateGroups. For detailed information on
4169 # groups that can be created please see the method MakePipe().
4170 # @param theSeqBases - list of Bases shape to be extruded. Base shape must be
4171 # shell or face. If number of faces in neighbour sections
4172 # aren't coincided result solid between such sections will
4173 # be created using external boundaries of this shells.
4174 # @param theSeqSubBases - list of corresponding sub-shapes of section shapes.
4175 # This list is used for searching correspondences between
4176 # faces in the sections. Size of this list must be equal
4177 # to size of list of base shapes.
4178 # @param theLocations - list of locations on the path corresponding
4179 # specified list of the Bases shapes. Number of locations
4180 # should be equal to number of bases. First and last
4181 # locations must be coincided with first and last vertexes
4182 # of path correspondingly.
4183 # @param thePath - Path shape to extrude the base shape along it.
4184 # @param theWithContact - the mode defining that the section is translated to be in
4185 # contact with the spine.
4186 # @param theWithCorrection - defining that the section is rotated to be
4187 # orthogonal to the spine tangent in the correspondent point
4188 # @param IsGenerateGroups - flag that tells if it is necessary to
4189 # create groups. It is equal to False by default.
4190 # @param theName Object name; when specified, this parameter is used
4191 # for result publication in the study. Otherwise, if automatic
4192 # publication is switched on, default value is used for result name.
4194 # @return New GEOM.GEOM_Object, containing the created solids if
4195 # \a IsGenerateGroups is not set. Otherwise it returns new
4196 # GEOM.ListOfGO. Its first element is the created solids, the
4197 # remaining ones are created groups.
4199 # @ref tui_creation_pipe_with_shell_sec "Example"
4200 @ManageTransactions("PrimOp")
4201 def MakePipeWithShellSections(self, theSeqBases, theSeqSubBases,
4202 theLocations, thePath,
4203 theWithContact, theWithCorrection,
4204 IsGenerateGroups=False, theName=None):
4206 Create a shape by extrusion of the profile shape along
4207 the path shape. The path shape can be a wire or an edge.
4208 the several profiles can be specified in the several locations of path.
4209 It is possible to generate groups along with the result by means of
4210 setting the flag IsGenerateGroups. For detailed information on
4211 groups that can be created please see the method geompy.MakePipe().
4214 theSeqBases - list of Bases shape to be extruded. Base shape must be
4215 shell or face. If number of faces in neighbour sections
4216 aren't coincided result solid between such sections will
4217 be created using external boundaries of this shells.
4218 theSeqSubBases - list of corresponding sub-shapes of section shapes.
4219 This list is used for searching correspondences between
4220 faces in the sections. Size of this list must be equal
4221 to size of list of base shapes.
4222 theLocations - list of locations on the path corresponding
4223 specified list of the Bases shapes. Number of locations
4224 should be equal to number of bases. First and last
4225 locations must be coincided with first and last vertexes
4226 of path correspondingly.
4227 thePath - Path shape to extrude the base shape along it.
4228 theWithContact - the mode defining that the section is translated to be in
4229 contact with the spine (0/1)
4230 theWithCorrection - defining that the section is rotated to be
4231 orthogonal to the spine tangent in the correspondent point (0/1)
4232 IsGenerateGroups - flag that tells if it is necessary to
4233 create groups. It is equal to False by default.
4234 theName Object name; when specified, this parameter is used
4235 for result publication in the study. Otherwise, if automatic
4236 publication is switched on, default value is used for result name.
4239 New GEOM.GEOM_Object, containing the created solids if
4240 IsGenerateGroups is not set. Otherwise it returns new
4241 GEOM.ListOfGO. Its first element is the created solids, the
4242 remaining ones are created groups.
4244 aList = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
4245 theLocations, thePath,
4246 theWithContact, theWithCorrection,
4248 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
4250 if IsGenerateGroups:
4251 self._autoPublish(aList, theName, "pipe")
4254 self._autoPublish(aList[0], theName, "pipe")
4257 ## Create a shape by extrusion of the profile shape along
4258 # the path shape. This function is used only for debug pipe
4259 # functionality - it is a version of function MakePipeWithShellSections()
4260 # which give a possibility to receive information about
4261 # creating pipe between each pair of sections step by step.
4262 @ManageTransactions("PrimOp")
4263 def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
4264 theLocations, thePath,
4265 theWithContact, theWithCorrection,
4266 IsGenerateGroups=False, theName=None):
4268 Create a shape by extrusion of the profile shape along
4269 the path shape. This function is used only for debug pipe
4270 functionality - it is a version of previous function
4271 geompy.MakePipeWithShellSections() which give a possibility to
4272 receive information about creating pipe between each pair of
4273 sections step by step.
4276 nbsect = len(theSeqBases)
4277 nbsubsect = len(theSeqSubBases)
4278 #print "nbsect = ",nbsect
4279 for i in range(1,nbsect):
4281 tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
4282 tmpLocations = [ theLocations[i-1], theLocations[i] ]
4284 if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
4285 aList = self.PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
4286 tmpLocations, thePath,
4287 theWithContact, theWithCorrection,
4289 if self.PrimOp.IsDone() == 0:
4290 print("Problems with pipe creation between ",i," and ",i+1," sections")
4291 RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
4294 print("Pipe between ",i," and ",i+1," sections is OK")
4295 res.append(aList[0])
4299 resc = self.MakeCompound(res)
4300 #resc = self.MakeSewing(res, 0.001)
4301 #print "resc: ",resc
4302 self._autoPublish(resc, theName, "pipe")
4305 ## Create solids between given sections.
4306 # It is possible to generate groups along with the result by means of
4307 # setting the flag \a IsGenerateGroups. For detailed information on
4308 # groups that can be created please see the method MakePipe().
4309 # @param theSeqBases - list of sections (shell or face).
4310 # @param theLocations - list of corresponding vertexes
4311 # @param IsGenerateGroups - flag that tells if it is necessary to
4312 # create groups. It is equal to False by default.
4313 # @param theName Object name; when specified, this parameter is used
4314 # for result publication in the study. Otherwise, if automatic
4315 # publication is switched on, default value is used for result name.
4317 # @return New GEOM.GEOM_Object, containing the created solids if
4318 # \a IsGenerateGroups is not set. Otherwise it returns new
4319 # GEOM.ListOfGO. Its first element is the created solids, the
4320 # remaining ones are created groups.
4322 # @ref tui_creation_pipe_without_path "Example"
4323 @ManageTransactions("PrimOp")
4324 def MakePipeShellsWithoutPath(self, theSeqBases, theLocations,
4325 IsGenerateGroups=False, theName=None):
4327 Create solids between given sections.
4328 It is possible to generate groups along with the result by means of
4329 setting the flag IsGenerateGroups. For detailed information on
4330 groups that can be created please see the method geompy.MakePipe().
4333 theSeqBases - list of sections (shell or face).
4334 theLocations - list of corresponding vertexes
4335 IsGenerateGroups - flag that tells if it is necessary to
4336 create groups. It is equal to False by default.
4337 theName Object name; when specified, this parameter is used
4338 for result publication in the study. Otherwise, if automatic
4339 publication is switched on, default value is used for result name.
4342 New GEOM.GEOM_Object, containing the created solids if
4343 IsGenerateGroups is not set. Otherwise it returns new
4344 GEOM.ListOfGO. Its first element is the created solids, the
4345 remaining ones are created groups.
4347 aList = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations,
4349 RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
4351 if IsGenerateGroups:
4352 self._autoPublish(aList, theName, "pipe")
4355 self._autoPublish(aList[0], theName, "pipe")
4358 ## Create a shape by extrusion of the base shape along
4359 # the path shape with constant bi-normal direction along the given vector.
4360 # The path shape can be a wire or an edge.
4361 # It is possible to generate groups along with the result by means of
4362 # setting the flag \a IsGenerateGroups. For detailed information on
4363 # groups that can be created please see the method MakePipe().
4364 # @param theBase Base shape to be extruded.
4365 # @param thePath Path shape to extrude the base shape along it.
4366 # @param theVec Vector defines a constant binormal direction to keep the
4367 # same angle between the direction and the sections
4368 # along the sweep surface.
4369 # @param IsGenerateGroups flag that tells if it is necessary to
4370 # create groups. It is equal to False by default.
4371 # @param theName Object name; when specified, this parameter is used
4372 # for result publication in the study. Otherwise, if automatic
4373 # publication is switched on, default value is used for result name.
4375 # @return New GEOM.GEOM_Object, containing the created pipe if
4376 # \a IsGenerateGroups is not set. Otherwise it returns new
4377 # GEOM.ListOfGO. Its first element is the created pipe, the
4378 # remaining ones are created groups.
4380 # @ref tui_creation_pipe "Example"
4381 @ManageTransactions("PrimOp")
4382 def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec,
4383 IsGenerateGroups=False, theName=None):
4385 Create a shape by extrusion of the base shape along
4386 the path shape with constant bi-normal direction along the given vector.
4387 The path shape can be a wire or an edge.
4388 It is possible to generate groups along with the result by means of
4389 setting the flag IsGenerateGroups. For detailed information on
4390 groups that can be created please see the method geompy.MakePipe().
4393 theBase Base shape to be extruded.
4394 thePath Path shape to extrude the base shape along it.
4395 theVec Vector defines a constant binormal direction to keep the
4396 same angle between the direction and the sections
4397 along the sweep surface.
4398 IsGenerateGroups flag that tells if it is necessary to
4399 create groups. It is equal to False by default.
4400 theName Object name; when specified, this parameter is used
4401 for result publication in the study. Otherwise, if automatic
4402 publication is switched on, default value is used for result name.
4405 New GEOM.GEOM_Object, containing the created pipe if
4406 IsGenerateGroups is not set. Otherwise it returns new
4407 GEOM.ListOfGO. Its first element is the created pipe, the
4408 remaining ones are created groups.
4410 # Example: see GEOM_TestAll.py
4411 aList = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath,
4412 theVec, IsGenerateGroups)
4413 RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
4415 if IsGenerateGroups:
4416 self._autoPublish(aList, theName, "pipe")
4419 self._autoPublish(aList[0], theName, "pipe")
4422 ## Makes a thick solid from a shape. If the input is a surface shape
4423 # (face or shell) the result is a thick solid. If an input shape is
4424 # a solid the result is a hollowed solid with removed faces.
4425 # @param theShape Face or Shell to get thick solid or solid to get
4427 # @param theThickness Thickness of the resulting solid
4428 # @param theFacesIDs the list of face IDs to be removed from the
4429 # result. It is ignored if \a theShape is a face or a shell.
4430 # It is empty by default.
4431 # @param theInside If true the thickness is applied towards inside
4432 # @param theName Object name; when specified, this parameter is used
4433 # for result publication in the study. Otherwise, if automatic
4434 # publication is switched on, default value is used for result name.
4436 # @return New GEOM.GEOM_Object, containing the created solid
4438 # @ref tui_creation_thickness "Example"
4439 @ManageTransactions("PrimOp")
4440 def MakeThickSolid(self, theShape, theThickness,
4441 theFacesIDs=[], theInside=False, theName=None):
4443 Make a thick solid from a shape. If the input is a surface shape
4444 (face or shell) the result is a thick solid. If an input shape is
4445 a solid the result is a hollowed solid with removed faces.
4448 theShape Face or Shell to get thick solid or solid to get
4450 theThickness Thickness of the resulting solid
4451 theFacesIDs the list of face IDs to be removed from the
4452 result. It is ignored if theShape is a face or a
4453 shell. It is empty by default.
4454 theInside If true the thickness is applied towards inside
4455 theName Object name; when specified, this parameter is used
4456 for result publication in the study. Otherwise, if automatic
4457 publication is switched on, default value is used for result name.
4460 New GEOM.GEOM_Object, containing the created solid
4462 # Example: see GEOM_TestAll.py
4463 theThickness,Parameters = ParseParameters(theThickness)
4464 anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
4465 theThickness, True, theInside)
4466 RaiseIfFailed("MakeThickSolid", self.PrimOp)
4467 anObj.SetParameters(Parameters)
4468 self._autoPublish(anObj, theName, "thickSolid")
4472 ## Modifies a shape to make it a thick solid. If the input is a surface
4473 # shape (face or shell) the result is a thick solid. If an input shape
4474 # is a solid the result is a hollowed solid with removed faces.
4475 # @param theShape Face or Shell to get thick solid or solid to get
4477 # @param theThickness Thickness of the resulting solid
4478 # @param theFacesIDs the list of face IDs to be removed from the
4479 # result. It is ignored if \a theShape is a face or a shell.
4480 # It is empty by default.
4481 # @param theInside If true the thickness is applied towards inside
4483 # @return The modified shape
4485 # @ref tui_creation_thickness "Example"
4486 @ManageTransactions("PrimOp")
4487 def Thicken(self, theShape, theThickness, theFacesIDs=[], theInside=False):
4489 Modifies a shape to make it a thick solid. If the input is a
4490 surface shape (face or shell) the result is a thick solid. If
4491 an input shape is a solid the result is a hollowed solid with
4495 theShape Face or Shell to get thick solid or solid to get
4497 theThickness Thickness of the resulting solid
4498 theFacesIDs the list of face IDs to be removed from the
4499 result. It is ignored if \a theShape is a face or
4500 a shell. It is empty by default.
4501 theInside If true the thickness is applied towards inside
4506 # Example: see GEOM_TestAll.py
4507 theThickness,Parameters = ParseParameters(theThickness)
4508 anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
4509 theThickness, False, theInside)
4510 RaiseIfFailed("Thicken", self.PrimOp)
4511 anObj.SetParameters(Parameters)
4514 ## Build a middle path of a pipe-like shape.
4515 # The path shape can be a wire or an edge.
4516 # @param theShape It can be closed or unclosed pipe-like shell
4517 # or a pipe-like solid.
4518 # @param theBase1, theBase2 Two bases of the supposed pipe. This
4519 # should be wires or faces of theShape.
4520 # @param theName Object name; when specified, this parameter is used
4521 # for result publication in the study. Otherwise, if automatic
4522 # publication is switched on, default value is used for result name.
4524 # @note It is not assumed that exact or approximate copy of theShape
4525 # can be obtained by applying existing Pipe operation on the
4526 # resulting "Path" wire taking theBase1 as the base - it is not
4527 # always possible; though in some particular cases it might work
4528 # it is not guaranteed. Thus, RestorePath function should not be
4529 # considered as an exact reverse operation of the Pipe.
4531 # @return New GEOM.GEOM_Object, containing an edge or wire that represent
4532 # source pipe's "path".
4534 # @ref tui_creation_pipe_path "Example"
4535 @ManageTransactions("PrimOp")
4536 def RestorePath (self, theShape, theBase1, theBase2, theName=None):
4538 Build a middle path of a pipe-like shape.
4539 The path shape can be a wire or an edge.
4542 theShape It can be closed or unclosed pipe-like shell
4543 or a pipe-like solid.
4544 theBase1, theBase2 Two bases of the supposed pipe. This
4545 should be wires or faces of theShape.
4546 theName Object name; when specified, this parameter is used
4547 for result publication in the study. Otherwise, if automatic
4548 publication is switched on, default value is used for result name.
4551 New GEOM_Object, containing an edge or wire that represent
4554 anObj = self.PrimOp.RestorePath(theShape, theBase1, theBase2)
4555 RaiseIfFailed("RestorePath", self.PrimOp)
4556 self._autoPublish(anObj, theName, "path")
4559 ## Build a middle path of a pipe-like shape.
4560 # The path shape can be a wire or an edge.
4561 # @param theShape It can be closed or unclosed pipe-like shell
4562 # or a pipe-like solid.
4563 # @param listEdges1, listEdges2 Two bases of the supposed pipe. This
4564 # should be lists of edges of theShape.
4565 # @param theName Object name; when specified, this parameter is used
4566 # for result publication in the study. Otherwise, if automatic
4567 # publication is switched on, default value is used for result name.
4569 # @note It is not assumed that exact or approximate copy of theShape
4570 # can be obtained by applying existing Pipe operation on the
4571 # resulting "Path" wire taking theBase1 as the base - it is not
4572 # always possible; though in some particular cases it might work
4573 # it is not guaranteed. Thus, RestorePath function should not be
4574 # considered as an exact reverse operation of the Pipe.
4576 # @return New GEOM.GEOM_Object, containing an edge or wire that represent
4577 # source pipe's "path".
4579 # @ref tui_creation_pipe_path "Example"
4580 @ManageTransactions("PrimOp")
4581 def RestorePathEdges (self, theShape, listEdges1, listEdges2, theName=None):
4583 Build a middle path of a pipe-like shape.
4584 The path shape can be a wire or an edge.
4587 theShape It can be closed or unclosed pipe-like shell
4588 or a pipe-like solid.
4589 listEdges1, listEdges2 Two bases of the supposed pipe. This
4590 should be lists of edges of theShape.
4591 theName Object name; when specified, this parameter is used
4592 for result publication in the study. Otherwise, if automatic
4593 publication is switched on, default value is used for result name.
4596 New GEOM_Object, containing an edge or wire that represent
4599 anObj = self.PrimOp.RestorePathEdges(theShape, listEdges1, listEdges2)
4600 RaiseIfFailed("RestorePath", self.PrimOp)
4601 self._autoPublish(anObj, theName, "path")
4607 ## @addtogroup l3_basic_go
4610 ## Create a linear edge with specified ends.
4611 # @param thePnt1 Point for the first end of edge.
4612 # @param thePnt2 Point for the second end of edge.
4613 # @param theName Object name; when specified, this parameter is used
4614 # for result publication in the study. Otherwise, if automatic
4615 # publication is switched on, default value is used for result name.
4617 # @return New GEOM.GEOM_Object, containing the created edge.
4619 # @ref tui_creation_edge "Example"
4620 @ManageTransactions("ShapesOp")
4621 def MakeEdge(self, thePnt1, thePnt2, theName=None):
4623 Create a linear edge with specified ends.
4626 thePnt1 Point for the first end of edge.
4627 thePnt2 Point for the second end of edge.
4628 theName Object name; when specified, this parameter is used
4629 for result publication in the study. Otherwise, if automatic
4630 publication is switched on, default value is used for result name.
4633 New GEOM.GEOM_Object, containing the created edge.
4635 # Example: see GEOM_TestAll.py
4636 anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
4637 RaiseIfFailed("MakeEdge", self.ShapesOp)
4638 self._autoPublish(anObj, theName, "edge")
4641 ## Create a new edge, corresponding to the given length on the given curve.
4642 # @param theRefCurve The referenced curve (edge).
4643 # @param theLength Length on the referenced curve. It can be negative.
4644 # @param theStartPoint Any point can be selected for it, the new edge will begin
4645 # at the end of \a theRefCurve, close to the selected point.
4646 # If None, start from the first point of \a theRefCurve.
4647 # @param theName Object name; when specified, this parameter is used
4648 # for result publication in the study. Otherwise, if automatic
4649 # publication is switched on, default value is used for result name.
4651 # @return New GEOM.GEOM_Object, containing the created edge.
4653 # @ref tui_creation_edge "Example"
4654 @ManageTransactions("ShapesOp")
4655 def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
4657 Create a new edge, corresponding to the given length on the given curve.
4660 theRefCurve The referenced curve (edge).
4661 theLength Length on the referenced curve. It can be negative.
4662 theStartPoint Any point can be selected for it, the new edge will begin
4663 at the end of theRefCurve, close to the selected point.
4664 If None, start from the first point of theRefCurve.
4665 theName Object name; when specified, this parameter is used
4666 for result publication in the study. Otherwise, if automatic
4667 publication is switched on, default value is used for result name.
4670 New GEOM.GEOM_Object, containing the created edge.
4672 # Example: see GEOM_TestAll.py
4673 theLength, Parameters = ParseParameters(theLength)
4674 anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
4675 RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp)
4676 anObj.SetParameters(Parameters)
4677 self._autoPublish(anObj, theName, "edge")
4680 ## Create an edge from specified wire.
4681 # @param theWire source Wire
4682 # @param theLinearTolerance linear tolerance value (default = 1e-07)
4683 # @param theAngularTolerance angular tolerance value (default = 1e-12)
4684 # @param theName Object name; when specified, this parameter is used
4685 # for result publication in the study. Otherwise, if automatic
4686 # publication is switched on, default value is used for result name.
4688 # @return New GEOM.GEOM_Object, containing the created edge.
4690 # @ref tui_creation_edge "Example"
4691 @ManageTransactions("ShapesOp")
4692 def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12, theName=None):
4694 Create an edge from specified wire.
4698 theLinearTolerance linear tolerance value (default = 1e-07)
4699 theAngularTolerance angular tolerance value (default = 1e-12)
4700 theName Object name; when specified, this parameter is used
4701 for result publication in the study. Otherwise, if automatic
4702 publication is switched on, default value is used for result name.
4705 New GEOM.GEOM_Object, containing the created edge.
4707 # Example: see GEOM_TestAll.py
4708 anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
4709 RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
4710 self._autoPublish(anObj, theName, "edge")
4713 ## Create a wire from the set of edges and wires.
4714 # @param theEdgesAndWires List of edges and/or wires.
4715 # @param theTolerance Maximum distance between vertices, that will be merged.
4716 # Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion())
4717 # @param theName Object name; when specified, this parameter is used
4718 # for result publication in the study. Otherwise, if automatic
4719 # publication is switched on, default value is used for result name.
4721 # @return New GEOM.GEOM_Object, containing the created wire.
4723 # @ref tui_creation_wire "Example"
4724 @ManageTransactions("ShapesOp")
4725 def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07, theName=None):
4727 Create a wire from the set of edges and wires.
4730 theEdgesAndWires List of edges and/or wires.
4731 theTolerance Maximum distance between vertices, that will be merged.
4732 Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
4733 theName Object name; when specified, this parameter is used
4734 for result publication in the study. Otherwise, if automatic
4735 publication is switched on, default value is used for result name.
4738 New GEOM.GEOM_Object, containing the created wire.
4740 # Example: see GEOM_TestAll.py
4741 anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
4742 RaiseIfFailed("MakeWire", self.ShapesOp)
4743 self._autoPublish(anObj, theName, "wire")
4746 ## Create a face on the given wire.
4747 # @param theWire closed Wire or Edge to build the face on.
4748 # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4749 # If the tolerance of the obtained planar face is less
4750 # than 1e-06, this face will be returned, otherwise the
4751 # algorithm tries to build any suitable face on the given
4752 # wire and prints a warning message.
4753 # @param theName Object name; when specified, this parameter is used
4754 # for result publication in the study. Otherwise, if automatic
4755 # publication is switched on, default value is used for result name.
4757 # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
4759 # @ref tui_creation_face "Example"
4760 @ManageTransactions("ShapesOp")
4761 def MakeFace(self, theWire, isPlanarWanted, theName=None, raiseException=False):
4763 Create a face on the given wire.
4766 theWire closed Wire or Edge to build the face on.
4767 isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4768 If the tolerance of the obtained planar face is less
4769 than 1e-06, this face will be returned, otherwise the
4770 algorithm tries to build any suitable face on the given
4771 wire and prints a warning message.
4772 theName Object name; when specified, this parameter is used
4773 for result publication in the study. Otherwise, if automatic
4774 publication is switched on, default value is used for result name.
4777 New GEOM.GEOM_Object, containing the created face (compound of faces).
4779 # Example: see GEOM_TestAll.py
4780 anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
4781 if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
4782 PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
4784 RaiseIfFailed("MakeFace", self.ShapesOp)
4785 self._autoPublish(anObj, theName, "face")
4788 ## Create a face on the given wires set.
4789 # @param theWires List of closed wires or edges to build the face on.
4790 # @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4791 # If the tolerance of the obtained planar face is less
4792 # than 1e-06, this face will be returned, otherwise the
4793 # algorithm tries to build any suitable face on the given
4794 # wire and prints a warning message.
4795 # @param theName Object name; when specified, this parameter is used
4796 # for result publication in the study. Otherwise, if automatic
4797 # publication is switched on, default value is used for result name.
4799 # @return New GEOM.GEOM_Object, containing the created face (compound of faces).
4801 # @ref tui_creation_face "Example"
4802 @ManageTransactions("ShapesOp")
4803 def MakeFaceWires(self, theWires, isPlanarWanted, theName=None, raiseException=False):
4805 Create a face on the given wires set.
4808 theWires List of closed wires or edges to build the face on.
4809 isPlanarWanted If TRUE, the algorithm tries to build a planar face.
4810 If the tolerance of the obtained planar face is less
4811 than 1e-06, this face will be returned, otherwise the
4812 algorithm tries to build any suitable face on the given
4813 wire and prints a warning message.
4814 theName Object name; when specified, this parameter is used
4815 for result publication in the study. Otherwise, if automatic
4816 publication is switched on, default value is used for result name.
4819 New GEOM.GEOM_Object, containing the created face (compound of faces).
4821 # Example: see GEOM_TestAll.py
4822 anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
4823 if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
4824 PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
4826 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
4827 self._autoPublish(anObj, theName, "face")
4830 ## See MakeFaceWires() method for details.
4832 # @ref tui_creation_face "Example 1"
4833 # \n @ref swig_MakeFaces "Example 2"
4834 def MakeFaces(self, theWires, isPlanarWanted, theName=None):
4836 See geompy.MakeFaceWires() method for details.
4838 # Example: see GEOM_TestOthers.py
4839 # note: auto-publishing is done in self.MakeFaceWires()
4840 anObj = self.MakeFaceWires(theWires, isPlanarWanted, theName)
4843 ## Create a face based on a surface from given face bounded
4845 # @param theFace the face whose surface is used to create a new face.
4846 # @param theWire the wire that will bound a new face.
4847 # @param theName Object name; when specified, this parameter is used
4848 # for result publication in the study. Otherwise, if automatic
4849 # publication is switched on, default value is used for result name.
4851 # @return New GEOM.GEOM_Object, containing the created face.
4853 # @ref tui_creation_face "Example"
4854 @ManageTransactions("ShapesOp")
4855 def MakeFaceFromSurface(self, theFace, theWire, theName=None):
4857 Create a face based on a surface from given face bounded
4861 theFace the face whose surface is used to create a new face.
4862 theWire the wire that will bound a new face.
4863 theName Object name; when specified, this parameter is used
4864 for result publication in the study. Otherwise, if automatic
4865 publication is switched on, default value is used for result name.
4868 New GEOM.GEOM_Object, containing the created face.
4870 # Example: see GEOM_TestAll.py
4871 anObj = self.ShapesOp.MakeFaceFromSurface(theFace, theWire)
4872 RaiseIfFailed("MakeFaceFromSurface", self.ShapesOp)
4873 self._autoPublish(anObj, theName, "face")
4876 ## Create a face from a set of edges with the given constraints.
4877 # @param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
4878 # - edges should form a closed wire;
4879 # - for each edge, constraint face is optional: if a constraint face is missing
4880 # for some edge, this means that there no constraint associated with this edge.
4881 # @param theName Object name; when specified, this parameter is used
4882 # for result publication in the study. Otherwise, if automatic
4883 # publication is switched on, default value is used for result name.
4885 # @return New GEOM.GEOM_Object, containing the created face.
4887 # @ref tui_creation_face "Example"
4888 @ManageTransactions("ShapesOp")
4889 def MakeFaceWithConstraints(self, theConstraints, theName=None):
4891 Create a face from a set of edges with the given constraints.
4894 theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
4895 - edges should form a closed wire;
4896 - for each edge, constraint face is optional: if a constraint face is missing
4897 for some edge, this means that there no constraint associated with this edge.
4898 theName Object name; when specified, this parameter is used
4899 for result publication in the study. Otherwise, if automatic
4900 publication is switched on, default value is used for result name.
4903 New GEOM.GEOM_Object, containing the created face.
4905 # Example: see GEOM_TestAll.py
4906 anObj = self.ShapesOp.MakeFaceWithConstraints(theConstraints)
4908 RaiseIfFailed("MakeFaceWithConstraints", self.ShapesOp)
4909 self._autoPublish(anObj, theName, "face")
4912 ## Create a shell from the set of faces, shells and/or compounds of faces.
4913 # @param theFacesAndShells List of faces, shells and/or compounds of faces.
4914 # @param theName Object name; when specified, this parameter is used
4915 # for result publication in the study. Otherwise, if automatic
4916 # publication is switched on, default value is used for result name.
4918 # @return New GEOM.GEOM_Object, containing the created shell (compound of shells).
4920 # @ref tui_creation_shell "Example"
4921 @ManageTransactions("ShapesOp")
4922 def MakeShell(self, theFacesAndShells, theName=None):
4924 Create a shell from the set of faces and shells.
4927 theFacesAndShells List of faces and/or shells.
4928 theName Object name; when specified, this parameter is used
4929 for result publication in the study. Otherwise, if automatic
4930 publication is switched on, default value is used for result name.
4933 New GEOM.GEOM_Object, containing the created shell (compound of shells).
4935 # Example: see GEOM_TestAll.py
4936 anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells ))
4937 RaiseIfFailed("MakeShell", self.ShapesOp)
4938 self._autoPublish(anObj, theName, "shell")
4941 ## Create a solid, bounded by the given shells.
4942 # @param theShells Sequence of bounding shells.
4943 # @param theName Object name; when specified, this parameter is used
4944 # for result publication in the study. Otherwise, if automatic
4945 # publication is switched on, default value is used for result name.
4947 # @return New GEOM.GEOM_Object, containing the created solid.
4949 # @ref tui_creation_solid "Example"
4950 @ManageTransactions("ShapesOp")
4951 def MakeSolid(self, theShells, theName=None):
4953 Create a solid, bounded by the given shells.
4956 theShells Sequence of bounding shells.
4957 theName Object name; when specified, this parameter is used
4958 for result publication in the study. Otherwise, if automatic
4959 publication is switched on, default value is used for result name.
4962 New GEOM.GEOM_Object, containing the created solid.
4964 # Example: see GEOM_TestAll.py
4965 theShells = ToList(theShells)
4966 if len(theShells) == 1:
4967 descr = self._IsGoodForSolid(theShells[0])
4969 # raise RuntimeError, "MakeSolidShells : " + descr
4970 if descr == "WRN_SHAPE_UNCLOSED":
4971 raise RuntimeError("MakeSolidShells : Unable to create solid from unclosed shape")
4972 anObj = self.ShapesOp.MakeSolidShells(theShells)
4973 RaiseIfFailed("MakeSolidShells", self.ShapesOp)
4974 self._autoPublish(anObj, theName, "solid")
4977 ## Create a compound of the given shapes.
4978 # @param theShapes List of shapes to put in compound.
4979 # @param theName Object name; when specified, this parameter is used
4980 # for result publication in the study. Otherwise, if automatic
4981 # publication is switched on, default value is used for result name.
4983 # @return New GEOM.GEOM_Object, containing the created compound.
4985 # @ref tui_creation_compound "Example"
4986 @ManageTransactions("ShapesOp")
4987 def MakeCompound(self, theShapes, theName=None):
4989 Create a compound of the given shapes.
4992 theShapes List of shapes to put in compound.
4993 theName Object name; when specified, this parameter is used
4994 for result publication in the study. Otherwise, if automatic
4995 publication is switched on, default value is used for result name.
4998 New GEOM.GEOM_Object, containing the created compound.
5000 # Example: see GEOM_TestAll.py
5001 anObj = self.ShapesOp.MakeCompound(ToList(theShapes))
5002 RaiseIfFailed("MakeCompound", self.ShapesOp)
5003 self._autoPublish(anObj, theName, "compound")
5006 ## Create a solid (or solids) from the set of faces and/or shells.
5007 # @param theFacesOrShells List of faces and/or shells.
5008 # @param isIntersect If TRUE, forces performing intersections
5009 # between arguments; otherwise (default) intersection is not performed.
5010 # @param theName Object name; when specified, this parameter is used
5011 # for result publication in the study. Otherwise, if automatic
5012 # publication is switched on, default value is used for result name.
5014 # @return New GEOM.GEOM_Object, containing the created solid (or compound of solids).
5016 # @ref tui_creation_solid_from_faces "Example"
5017 @ManageTransactions("ShapesOp")
5018 def MakeSolidFromConnectedFaces(self, theFacesOrShells, isIntersect = False, theName=None):
5020 Create a solid (or solids) from the set of connected faces and/or shells.
5023 theFacesOrShells List of faces and/or shells.
5024 isIntersect If TRUE, forces performing intersections
5025 between arguments; otherwise (default) intersection is not performed
5026 theName Object name; when specified, this parameter is used.
5027 for result publication in the study. Otherwise, if automatic
5028 publication is switched on, default value is used for result name.
5031 New GEOM.GEOM_Object, containing the created solid (or compound of solids).
5033 # Example: see GEOM_TestAll.py
5034 anObj = self.ShapesOp.MakeSolidFromConnectedFaces(theFacesOrShells, isIntersect)
5035 RaiseIfFailed("MakeSolidFromConnectedFaces", self.ShapesOp)
5036 self._autoPublish(anObj, theName, "solid")
5039 # end of l3_basic_go
5042 ## @addtogroup l2_measure
5045 ## Gives quantity of faces in the given shape.
5046 # @param theShape Shape to count faces of.
5047 # @return Quantity of faces.
5049 # @ref swig_NumberOf "Example"
5050 @ManageTransactions("ShapesOp")
5051 def NumberOfFaces(self, theShape):
5053 Gives quantity of faces in the given shape.
5056 theShape Shape to count faces of.
5061 # Example: see GEOM_TestOthers.py
5062 nb_faces = self.ShapesOp.NumberOfFaces(theShape)
5063 RaiseIfFailed("NumberOfFaces", self.ShapesOp)
5066 ## Gives quantity of edges in the given shape.
5067 # @param theShape Shape to count edges of.
5068 # @return Quantity of edges.
5070 # @ref swig_NumberOf "Example"
5071 @ManageTransactions("ShapesOp")
5072 def NumberOfEdges(self, theShape):
5074 Gives quantity of edges in the given shape.
5077 theShape Shape to count edges of.
5082 # Example: see GEOM_TestOthers.py
5083 nb_edges = self.ShapesOp.NumberOfEdges(theShape)
5084 RaiseIfFailed("NumberOfEdges", self.ShapesOp)
5087 ## Gives quantity of sub-shapes of type theShapeType in the given shape.
5088 # @param theShape Shape to count sub-shapes of.
5089 # @param theShapeType Type of sub-shapes to count (see ShapeType())
5090 # @return Quantity of sub-shapes of given type.
5092 # @ref swig_NumberOf "Example"
5093 @ManageTransactions("ShapesOp")
5094 def NumberOfSubShapes(self, theShape, theShapeType):
5096 Gives quantity of sub-shapes of type theShapeType in the given shape.
5099 theShape Shape to count sub-shapes of.
5100 theShapeType Type of sub-shapes to count (see geompy.ShapeType)
5103 Quantity of sub-shapes of given type.
5105 # Example: see GEOM_TestOthers.py
5106 nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
5107 RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
5110 ## Gives quantity of solids in the given shape.
5111 # @param theShape Shape to count solids in.
5112 # @return Quantity of solids.
5114 # @ref swig_NumberOf "Example"
5115 @ManageTransactions("ShapesOp")
5116 def NumberOfSolids(self, theShape):
5118 Gives quantity of solids in the given shape.
5121 theShape Shape to count solids in.
5126 # Example: see GEOM_TestOthers.py
5127 nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, self.ShapeType["SOLID"])
5128 RaiseIfFailed("NumberOfSolids", self.ShapesOp)
5134 ## @addtogroup l3_healing
5137 ## Reverses an orientation the given shape.
5138 # @param theShape Shape to be reversed.
5139 # @param theName Object name; when specified, this parameter is used
5140 # for result publication in the study. Otherwise, if automatic
5141 # publication is switched on, default value is used for result name.
5143 # @return The reversed copy of theShape.
5145 # @ref swig_ChangeOrientation "Example"
5146 @ManageTransactions("ShapesOp")
5147 def ChangeOrientation(self, theShape, theName=None):
5149 Reverses an orientation the given shape.
5152 theShape Shape to be reversed.
5153 theName Object name; when specified, this parameter is used
5154 for result publication in the study. Otherwise, if automatic
5155 publication is switched on, default value is used for result name.
5158 The reversed copy of theShape.
5160 # Example: see GEOM_TestAll.py
5161 anObj = self.ShapesOp.ChangeOrientation(theShape)
5162 RaiseIfFailed("ChangeOrientation", self.ShapesOp)
5163 self._autoPublish(anObj, theName, "reversed")
5166 ## See ChangeOrientation() method for details.
5168 # @ref swig_OrientationChange "Example"
5169 def OrientationChange(self, theShape, theName=None):
5171 See geompy.ChangeOrientation method for details.
5173 # Example: see GEOM_TestOthers.py
5174 # note: auto-publishing is done in self.ChangeOrientation()
5175 anObj = self.ChangeOrientation(theShape, theName)
5181 ## @addtogroup l4_obtain
5184 ## Retrieve all free faces from the given shape.
5185 # Free face is a face, which is not shared between two shells of the shape.
5186 # @param theShape Shape to find free faces in.
5187 # @return List of IDs of all free faces, contained in theShape.
5189 # @ref tui_free_faces_page "Example"
5190 @ManageTransactions("ShapesOp")
5191 def GetFreeFacesIDs(self,theShape):
5193 Retrieve all free faces from the given shape.
5194 Free face is a face, which is not shared between two shells of the shape.
5197 theShape Shape to find free faces in.
5200 List of IDs of all free faces, contained in theShape.
5202 # Example: see GEOM_TestOthers.py
5203 anIDs = self.ShapesOp.GetFreeFacesIDs(theShape)
5204 RaiseIfFailed("GetFreeFacesIDs", self.ShapesOp)
5207 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
5208 # @param theShape1 Shape to find sub-shapes in.
5209 # @param theShape2 Shape to find shared sub-shapes with.
5210 # @param theShapeType Type of sub-shapes to be retrieved.
5211 # @param theName Object name; when specified, this parameter is used
5212 # for result publication in the study. Otherwise, if automatic
5213 # publication is switched on, default value is used for result name.
5215 # @return List of sub-shapes of theShape1, shared with theShape2.
5217 # @ref swig_GetSharedShapes "Example"
5218 @ManageTransactions("ShapesOp")
5219 def GetSharedShapes(self, theShape1, theShape2, theShapeType, theName=None):
5221 Get all sub-shapes of theShape1 of the given type, shared with theShape2.
5224 theShape1 Shape to find sub-shapes in.
5225 theShape2 Shape to find shared sub-shapes with.
5226 theShapeType Type of sub-shapes to be retrieved.
5227 theName Object name; when specified, this parameter is used
5228 for result publication in the study. Otherwise, if automatic
5229 publication is switched on, default value is used for result name.
5232 List of sub-shapes of theShape1, shared with theShape2.
5234 # Example: see GEOM_TestOthers.py
5235 aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
5236 RaiseIfFailed("GetSharedShapes", self.ShapesOp)
5237 self._autoPublish(aList, theName, "shared")
5240 ## Get sub-shapes, shared by input shapes.
5241 # @param theShapes Either a list or compound of shapes to find common sub-shapes of.
5242 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()).
5243 # @param theMultiShare Specifies what type of shares should be checked:
5244 # - @c True (default): search sub-shapes from 1st input shape shared with all other input shapes;
5245 # - @c False: causes to search sub-shapes shared between couples of input shapes.
5246 # @param theName Object name; when specified, this parameter is used
5247 # for result publication in the study. Otherwise, if automatic
5248 # publication is switched on, default value is used for result name.
5250 # @note If @a theShapes contains single compound, the shares between all possible couples of
5251 # its top-level shapes are returned; otherwise, only shares between 1st input shape
5252 # and all rest input shapes are returned.
5254 # @return List of all found sub-shapes.
5257 # - @ref tui_shared_shapes "Example 1"
5258 # - @ref swig_GetSharedShapes "Example 2"
5259 @ManageTransactions("ShapesOp")
5260 def GetSharedShapesMulti(self, theShapes, theShapeType, theMultiShare=True, theName=None):
5262 Get sub-shapes, shared by input shapes.
5265 theShapes Either a list or compound of shapes to find common sub-shapes of.
5266 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType).
5267 theMultiShare Specifies what type of shares should be checked:
5268 - True (default): search sub-shapes from 1st input shape shared with all other input shapes;
5269 - False: causes to search sub-shapes shared between couples of input shapes.
5270 theName Object name; when specified, this parameter is used
5271 for result publication in the study. Otherwise, if automatic
5272 publication is switched on, default value is used for result name.
5274 Note: if theShapes contains single compound, the shares between all possible couples of
5275 its top-level shapes are returned; otherwise, only shares between 1st input shape
5276 and all rest input shapes are returned.
5279 List of all found sub-shapes.
5281 # Example: see GEOM_TestOthers.py
5282 aList = self.ShapesOp.GetSharedShapesMulti(ToList(theShapes), theShapeType, theMultiShare)
5283 RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
5284 self._autoPublish(aList, theName, "shared")
5287 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5288 # situated relatively the specified plane by the certain way,
5289 # defined through <VAR>theState</VAR> parameter.
5290 # @param theShape Shape to find sub-shapes of.
5291 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5292 # @param theAx1 Vector (or line, or linear edge), specifying normal
5293 # direction and location of the plane to find shapes on.
5294 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5295 # @param theName Object name; when specified, this parameter is used
5296 # for result publication in the study. Otherwise, if automatic
5297 # publication is switched on, default value is used for result name.
5299 # @return List of all found sub-shapes.
5301 # @ref swig_GetShapesOnPlane "Example"
5302 @ManageTransactions("ShapesOp")
5303 def GetShapesOnPlane(self, theShape, theShapeType, theAx1, theState, theName=None):
5305 Find in theShape all sub-shapes of type theShapeType,
5306 situated relatively the specified plane by the certain way,
5307 defined through theState parameter.
5310 theShape Shape to find sub-shapes of.
5311 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5312 theAx1 Vector (or line, or linear edge), specifying normal
5313 direction and location of the plane to find shapes on.
5314 theState The state of the sub-shapes to find (see GEOM::shape_state)
5315 theName Object name; when specified, this parameter is used
5316 for result publication in the study. Otherwise, if automatic
5317 publication is switched on, default value is used for result name.
5320 List of all found sub-shapes.
5322 # Example: see GEOM_TestOthers.py
5323 aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
5324 RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
5325 self._autoPublish(aList, theName, "shapeOnPlane")
5328 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5329 # situated relatively the specified plane by the certain way,
5330 # defined through <VAR>theState</VAR> parameter.
5331 # @param theShape Shape to find sub-shapes of.
5332 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5333 # @param theAx1 Vector (or line, or linear edge), specifying normal
5334 # direction and location of the plane to find shapes on.
5335 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5337 # @return List of all found sub-shapes indices.
5339 # @ref swig_GetShapesOnPlaneIDs "Example"
5340 @ManageTransactions("ShapesOp")
5341 def GetShapesOnPlaneIDs(self, theShape, theShapeType, theAx1, theState):
5343 Find in theShape all sub-shapes of type theShapeType,
5344 situated relatively the specified plane by the certain way,
5345 defined through theState parameter.
5348 theShape Shape to find sub-shapes of.
5349 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5350 theAx1 Vector (or line, or linear edge), specifying normal
5351 direction and location of the plane to find shapes on.
5352 theState The state of the sub-shapes to find (see GEOM::shape_state)
5355 List of all found sub-shapes indices.
5357 # Example: see GEOM_TestOthers.py
5358 aList = self.ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
5359 RaiseIfFailed("GetShapesOnPlaneIDs", self.ShapesOp)
5362 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5363 # situated relatively the specified plane by the certain way,
5364 # defined through <VAR>theState</VAR> parameter.
5365 # @param theShape Shape to find sub-shapes of.
5366 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5367 # @param theAx1 Vector (or line, or linear edge), specifying normal
5368 # direction of the plane to find shapes on.
5369 # @param thePnt Point specifying location of the plane to find shapes on.
5370 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5371 # @param theName Object name; when specified, this parameter is used
5372 # for result publication in the study. Otherwise, if automatic
5373 # publication is switched on, default value is used for result name.
5375 # @return List of all found sub-shapes.
5377 # @ref swig_GetShapesOnPlaneWithLocation "Example"
5378 @ManageTransactions("ShapesOp")
5379 def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState, theName=None):
5381 Find in theShape all sub-shapes of type theShapeType,
5382 situated relatively the specified plane by the certain way,
5383 defined through theState parameter.
5386 theShape Shape to find sub-shapes of.
5387 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5388 theAx1 Vector (or line, or linear edge), specifying normal
5389 direction and location of the plane to find shapes on.
5390 thePnt Point specifying location of the plane to find shapes on.
5391 theState The state of the sub-shapes to find (see GEOM::shape_state)
5392 theName Object name; when specified, this parameter is used
5393 for result publication in the study. Otherwise, if automatic
5394 publication is switched on, default value is used for result name.
5397 List of all found sub-shapes.
5399 # Example: see GEOM_TestOthers.py
5400 aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
5401 theAx1, thePnt, theState)
5402 RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
5403 self._autoPublish(aList, theName, "shapeOnPlane")
5406 ## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
5407 # situated relatively the specified plane by the certain way,
5408 # defined through <VAR>theState</VAR> parameter.
5409 # @param theShape Shape to find sub-shapes of.
5410 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5411 # @param theAx1 Vector (or line, or linear edge), specifying normal
5412 # direction of the plane to find shapes on.
5413 # @param thePnt Point specifying location of the plane to find shapes on.
5414 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5416 # @return List of all found sub-shapes indices.
5418 # @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
5419 @ManageTransactions("ShapesOp")
5420 def GetShapesOnPlaneWithLocationIDs(self, theShape, theShapeType, theAx1, thePnt, theState):
5422 Find in theShape all sub-shapes of type theShapeType,
5423 situated relatively the specified plane by the certain way,
5424 defined through theState parameter.
5427 theShape Shape to find sub-shapes of.
5428 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5429 theAx1 Vector (or line, or linear edge), specifying normal
5430 direction and location of the plane to find shapes on.
5431 thePnt Point specifying location of the plane to find shapes on.
5432 theState The state of the sub-shapes to find (see GEOM::shape_state)
5435 List of all found sub-shapes indices.
5437 # Example: see GEOM_TestOthers.py
5438 aList = self.ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType,
5439 theAx1, thePnt, theState)
5440 RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", self.ShapesOp)
5443 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5444 # the specified cylinder by the certain way, defined through \a theState parameter.
5445 # @param theShape Shape to find sub-shapes of.
5446 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5447 # @param theAxis Vector (or line, or linear edge), specifying
5448 # axis of the cylinder to find shapes on.
5449 # @param theRadius Radius of the cylinder to find shapes on.
5450 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5451 # @param theName Object name; when specified, this parameter is used
5452 # for result publication in the study. Otherwise, if automatic
5453 # publication is switched on, default value is used for result name.
5455 # @return List of all found sub-shapes.
5457 # @ref swig_GetShapesOnCylinder "Example"
5458 @ManageTransactions("ShapesOp")
5459 def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState, theName=None):
5461 Find in theShape all sub-shapes of type theShapeType, situated relatively
5462 the specified cylinder by the certain way, defined through theState parameter.
5465 theShape Shape to find sub-shapes of.
5466 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5467 theAxis Vector (or line, or linear edge), specifying
5468 axis of the cylinder to find shapes on.
5469 theRadius Radius of the cylinder to find shapes on.
5470 theState The state of the sub-shapes to find (see GEOM::shape_state)
5471 theName Object name; when specified, this parameter is used
5472 for result publication in the study. Otherwise, if automatic
5473 publication is switched on, default value is used for result name.
5476 List of all found sub-shapes.
5478 # Example: see GEOM_TestOthers.py
5479 aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
5480 RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
5481 self._autoPublish(aList, theName, "shapeOnCylinder")
5484 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5485 # the specified cylinder by the certain way, defined through \a theState parameter.
5486 # @param theShape Shape to find sub-shapes of.
5487 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5488 # @param theAxis Vector (or line, or linear edge), specifying
5489 # axis of the cylinder to find shapes on.
5490 # @param theRadius Radius of the cylinder to find shapes on.
5491 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5493 # @return List of all found sub-shapes indices.
5495 # @ref swig_GetShapesOnCylinderIDs "Example"
5496 @ManageTransactions("ShapesOp")
5497 def GetShapesOnCylinderIDs(self, theShape, theShapeType, theAxis, theRadius, theState):
5499 Find in theShape all sub-shapes of type theShapeType, situated relatively
5500 the specified cylinder by the certain way, defined through theState parameter.
5503 theShape Shape to find sub-shapes of.
5504 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5505 theAxis Vector (or line, or linear edge), specifying
5506 axis of the cylinder to find shapes on.
5507 theRadius Radius of the cylinder to find shapes on.
5508 theState The state of the sub-shapes to find (see GEOM::shape_state)
5511 List of all found sub-shapes indices.
5513 # Example: see GEOM_TestOthers.py
5514 aList = self.ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
5515 RaiseIfFailed("GetShapesOnCylinderIDs", self.ShapesOp)
5518 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5519 # the specified cylinder by the certain way, defined through \a theState parameter.
5520 # @param theShape Shape to find sub-shapes of.
5521 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5522 # @param theAxis Vector (or line, or linear edge), specifying
5523 # axis of the cylinder to find shapes on.
5524 # @param thePnt Point specifying location of the bottom of the cylinder.
5525 # @param theRadius Radius of the cylinder to find shapes on.
5526 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5527 # @param theName Object name; when specified, this parameter is used
5528 # for result publication in the study. Otherwise, if automatic
5529 # publication is switched on, default value is used for result name.
5531 # @return List of all found sub-shapes.
5533 # @ref swig_GetShapesOnCylinderWithLocation "Example"
5534 @ManageTransactions("ShapesOp")
5535 def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState, theName=None):
5537 Find in theShape all sub-shapes of type theShapeType, situated relatively
5538 the specified cylinder by the certain way, defined through theState parameter.
5541 theShape Shape to find sub-shapes of.
5542 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5543 theAxis Vector (or line, or linear edge), specifying
5544 axis of the cylinder to find shapes on.
5545 theRadius Radius of the cylinder to find shapes on.
5546 theState The state of the sub-shapes to find (see GEOM::shape_state)
5547 theName Object name; when specified, this parameter is used
5548 for result publication in the study. Otherwise, if automatic
5549 publication is switched on, default value is used for result name.
5552 List of all found sub-shapes.
5554 # Example: see GEOM_TestOthers.py
5555 aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
5556 RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
5557 self._autoPublish(aList, theName, "shapeOnCylinder")
5560 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5561 # the specified cylinder by the certain way, defined through \a theState parameter.
5562 # @param theShape Shape to find sub-shapes of.
5563 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5564 # @param theAxis Vector (or line, or linear edge), specifying
5565 # axis of the cylinder to find shapes on.
5566 # @param thePnt Point specifying location of the bottom of the cylinder.
5567 # @param theRadius Radius of the cylinder to find shapes on.
5568 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5570 # @return List of all found sub-shapes indices
5572 # @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
5573 @ManageTransactions("ShapesOp")
5574 def GetShapesOnCylinderWithLocationIDs(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
5576 Find in theShape all sub-shapes of type theShapeType, situated relatively
5577 the specified cylinder by the certain way, defined through theState parameter.
5580 theShape Shape to find sub-shapes of.
5581 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5582 theAxis Vector (or line, or linear edge), specifying
5583 axis of the cylinder to find shapes on.
5584 theRadius Radius of the cylinder to find shapes on.
5585 theState The state of the sub-shapes to find (see GEOM::shape_state)
5588 List of all found sub-shapes indices.
5590 # Example: see GEOM_TestOthers.py
5591 aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
5592 RaiseIfFailed("GetShapesOnCylinderWithLocationIDs", self.ShapesOp)
5595 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5596 # the specified sphere by the certain way, defined through \a theState parameter.
5597 # @param theShape Shape to find sub-shapes of.
5598 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5599 # @param theCenter Point, specifying center of the sphere to find shapes on.
5600 # @param theRadius Radius of the sphere to find shapes on.
5601 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5602 # @param theName Object name; when specified, this parameter is used
5603 # for result publication in the study. Otherwise, if automatic
5604 # publication is switched on, default value is used for result name.
5606 # @return List of all found sub-shapes.
5608 # @ref swig_GetShapesOnSphere "Example"
5609 @ManageTransactions("ShapesOp")
5610 def GetShapesOnSphere(self, theShape, theShapeType, theCenter, theRadius, theState, theName=None):
5612 Find in theShape all sub-shapes of type theShapeType, situated relatively
5613 the specified sphere by the certain way, defined through theState parameter.
5616 theShape Shape to find sub-shapes of.
5617 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5618 theCenter Point, specifying center of the sphere to find shapes on.
5619 theRadius Radius of the sphere to find shapes on.
5620 theState The state of the sub-shapes to find (see GEOM::shape_state)
5621 theName Object name; when specified, this parameter is used
5622 for result publication in the study. Otherwise, if automatic
5623 publication is switched on, default value is used for result name.
5626 List of all found sub-shapes.
5628 # Example: see GEOM_TestOthers.py
5629 aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
5630 RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
5631 self._autoPublish(aList, theName, "shapeOnSphere")
5634 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5635 # the specified sphere by the certain way, defined through \a theState parameter.
5636 # @param theShape Shape to find sub-shapes of.
5637 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5638 # @param theCenter Point, specifying center of the sphere to find shapes on.
5639 # @param theRadius Radius of the sphere to find shapes on.
5640 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5642 # @return List of all found sub-shapes indices.
5644 # @ref swig_GetShapesOnSphereIDs "Example"
5645 @ManageTransactions("ShapesOp")
5646 def GetShapesOnSphereIDs(self, theShape, theShapeType, theCenter, theRadius, theState):
5648 Find in theShape all sub-shapes of type theShapeType, situated relatively
5649 the specified sphere by the certain way, defined through theState parameter.
5652 theShape Shape to find sub-shapes of.
5653 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5654 theCenter Point, specifying center of the sphere to find shapes on.
5655 theRadius Radius of the sphere to find shapes on.
5656 theState The state of the sub-shapes to find (see GEOM::shape_state)
5659 List of all found sub-shapes indices.
5661 # Example: see GEOM_TestOthers.py
5662 aList = self.ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
5663 RaiseIfFailed("GetShapesOnSphereIDs", self.ShapesOp)
5666 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5667 # the specified quadrangle by the certain way, defined through \a theState parameter.
5668 # @param theShape Shape to find sub-shapes of.
5669 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5670 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
5671 # @param theTopRightPoint Point, specifying top right corner of a quadrangle
5672 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5673 # @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5674 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5675 # @param theName Object name; when specified, this parameter is used
5676 # for result publication in the study. Otherwise, if automatic
5677 # publication is switched on, default value is used for result name.
5679 # @return List of all found sub-shapes.
5681 # @ref swig_GetShapesOnQuadrangle "Example"
5682 @ManageTransactions("ShapesOp")
5683 def GetShapesOnQuadrangle(self, theShape, theShapeType,
5684 theTopLeftPoint, theTopRightPoint,
5685 theBottomLeftPoint, theBottomRightPoint, theState, theName=None):
5687 Find in theShape all sub-shapes of type theShapeType, situated relatively
5688 the specified quadrangle by the certain way, defined through theState parameter.
5691 theShape Shape to find sub-shapes of.
5692 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5693 theTopLeftPoint Point, specifying top left corner of a quadrangle
5694 theTopRightPoint Point, specifying top right corner of a quadrangle
5695 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5696 theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5697 theState The state of the sub-shapes to find (see GEOM::shape_state)
5698 theName Object name; when specified, this parameter is used
5699 for result publication in the study. Otherwise, if automatic
5700 publication is switched on, default value is used for result name.
5703 List of all found sub-shapes.
5705 # Example: see GEOM_TestOthers.py
5706 aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
5707 theTopLeftPoint, theTopRightPoint,
5708 theBottomLeftPoint, theBottomRightPoint, theState)
5709 RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
5710 self._autoPublish(aList, theName, "shapeOnQuadrangle")
5713 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5714 # the specified quadrangle by the certain way, defined through \a theState parameter.
5715 # @param theShape Shape to find sub-shapes of.
5716 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5717 # @param theTopLeftPoint Point, specifying top left corner of a quadrangle
5718 # @param theTopRightPoint Point, specifying top right corner of a quadrangle
5719 # @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5720 # @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5721 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5723 # @return List of all found sub-shapes indices.
5725 # @ref swig_GetShapesOnQuadrangleIDs "Example"
5726 @ManageTransactions("ShapesOp")
5727 def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
5728 theTopLeftPoint, theTopRightPoint,
5729 theBottomLeftPoint, theBottomRightPoint, theState):
5731 Find in theShape all sub-shapes of type theShapeType, situated relatively
5732 the specified quadrangle by the certain way, defined through theState parameter.
5735 theShape Shape to find sub-shapes of.
5736 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5737 theTopLeftPoint Point, specifying top left corner of a quadrangle
5738 theTopRightPoint Point, specifying top right corner of a quadrangle
5739 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
5740 theBottomRightPoint Point, specifying bottom right corner of a quadrangle
5741 theState The state of the sub-shapes to find (see GEOM::shape_state)
5744 List of all found sub-shapes indices.
5747 # Example: see GEOM_TestOthers.py
5748 aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
5749 theTopLeftPoint, theTopRightPoint,
5750 theBottomLeftPoint, theBottomRightPoint, theState)
5751 RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
5754 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5755 # the specified \a theBox by the certain way, defined through \a theState parameter.
5756 # @param theBox Shape for relative comparing.
5757 # @param theShape Shape to find sub-shapes of.
5758 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5759 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5760 # @param theName Object name; when specified, this parameter is used
5761 # for result publication in the study. Otherwise, if automatic
5762 # publication is switched on, default value is used for result name.
5764 # @return List of all found sub-shapes.
5766 # @ref swig_GetShapesOnBox "Example"
5767 @ManageTransactions("ShapesOp")
5768 def GetShapesOnBox(self, theBox, theShape, theShapeType, theState, theName=None):
5770 Find in theShape all sub-shapes of type theShapeType, situated relatively
5771 the specified theBox by the certain way, defined through theState parameter.
5774 theBox Shape for relative comparing.
5775 theShape Shape to find sub-shapes of.
5776 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5777 theState The state of the sub-shapes to find (see GEOM::shape_state)
5778 theName Object name; when specified, this parameter is used
5779 for result publication in the study. Otherwise, if automatic
5780 publication is switched on, default value is used for result name.
5783 List of all found sub-shapes.
5785 # Example: see GEOM_TestOthers.py
5786 aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
5787 RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
5788 self._autoPublish(aList, theName, "shapeOnBox")
5791 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
5792 # the specified \a theBox by the certain way, defined through \a theState parameter.
5793 # @param theBox Shape for relative comparing.
5794 # @param theShape Shape to find sub-shapes of.
5795 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5796 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5798 # @return List of all found sub-shapes indices.
5800 # @ref swig_GetShapesOnBoxIDs "Example"
5801 @ManageTransactions("ShapesOp")
5802 def GetShapesOnBoxIDs(self, theBox, theShape, theShapeType, theState):
5804 Find in theShape all sub-shapes of type theShapeType, situated relatively
5805 the specified theBox by the certain way, defined through theState parameter.
5808 theBox Shape for relative comparing.
5809 theShape Shape to find sub-shapes of.
5810 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5811 theState The state of the sub-shapes to find (see GEOM::shape_state)
5814 List of all found sub-shapes indices.
5816 # Example: see GEOM_TestOthers.py
5817 aList = self.ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
5818 RaiseIfFailed("GetShapesOnBoxIDs", self.ShapesOp)
5821 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5822 # situated relatively the specified \a theCheckShape by the
5823 # certain way, defined through \a theState parameter.
5824 # @param theCheckShape Shape for relative comparing. It must be a solid.
5825 # @param theShape Shape to find sub-shapes of.
5826 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5827 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5828 # @param theName Object name; when specified, this parameter is used
5829 # for result publication in the study. Otherwise, if automatic
5830 # publication is switched on, default value is used for result name.
5832 # @return List of all found sub-shapes.
5834 # @ref swig_GetShapesOnShape "Example"
5835 @ManageTransactions("ShapesOp")
5836 def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theName=None):
5838 Find in theShape all sub-shapes of type theShapeType,
5839 situated relatively the specified theCheckShape by the
5840 certain way, defined through theState parameter.
5843 theCheckShape Shape for relative comparing. It must be a solid.
5844 theShape Shape to find sub-shapes of.
5845 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5846 theState The state of the sub-shapes to find (see GEOM::shape_state)
5847 theName Object name; when specified, this parameter is used
5848 for result publication in the study. Otherwise, if automatic
5849 publication is switched on, default value is used for result name.
5852 List of all found sub-shapes.
5854 # Example: see GEOM_TestOthers.py
5855 aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
5856 theShapeType, theState)
5857 RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
5858 self._autoPublish(aList, theName, "shapeOnShape")
5861 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5862 # situated relatively the specified \a theCheckShape by the
5863 # certain way, defined through \a theState parameter.
5864 # @param theCheckShape Shape for relative comparing. It must be a solid.
5865 # @param theShape Shape to find sub-shapes of.
5866 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5867 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5868 # @param theName Object name; when specified, this parameter is used
5869 # for result publication in the study. Otherwise, if automatic
5870 # publication is switched on, default value is used for result name.
5872 # @return All found sub-shapes as compound.
5874 # @ref swig_GetShapesOnShapeAsCompound "Example"
5875 @ManageTransactions("ShapesOp")
5876 def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theName=None):
5878 Find in theShape all sub-shapes of type theShapeType,
5879 situated relatively the specified theCheckShape by the
5880 certain way, defined through theState parameter.
5883 theCheckShape Shape for relative comparing. It must be a solid.
5884 theShape Shape to find sub-shapes of.
5885 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5886 theState The state of the sub-shapes to find (see GEOM::shape_state)
5887 theName Object name; when specified, this parameter is used
5888 for result publication in the study. Otherwise, if automatic
5889 publication is switched on, default value is used for result name.
5892 All found sub-shapes as compound.
5894 # Example: see GEOM_TestOthers.py
5895 anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
5896 theShapeType, theState)
5897 RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
5898 self._autoPublish(anObj, theName, "shapeOnShape")
5901 ## Find in \a theShape all sub-shapes of type \a theShapeType,
5902 # situated relatively the specified \a theCheckShape by the
5903 # certain way, defined through \a theState parameter.
5904 # @param theCheckShape Shape for relative comparing. It must be a solid.
5905 # @param theShape Shape to find sub-shapes of.
5906 # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
5907 # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
5909 # @return List of all found sub-shapes indices.
5911 # @ref swig_GetShapesOnShapeIDs "Example"
5912 @ManageTransactions("ShapesOp")
5913 def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
5915 Find in theShape all sub-shapes of type theShapeType,
5916 situated relatively the specified theCheckShape by the
5917 certain way, defined through theState parameter.
5920 theCheckShape Shape for relative comparing. It must be a solid.
5921 theShape Shape to find sub-shapes of.
5922 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
5923 theState The state of the sub-shapes to find (see GEOM::shape_state)
5926 List of all found sub-shapes indices.
5928 # Example: see GEOM_TestOthers.py
5929 aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
5930 theShapeType, theState)
5931 RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
5934 ## Get sub-shape(s) of theShapeWhere, which are
5935 # coincident with \a theShapeWhat or could be a part of it.
5936 # @param theShapeWhere Shape to find sub-shapes of.
5937 # @param theShapeWhat Shape, specifying what to find.
5938 # @param isNewImplementation implementation of GetInPlace functionality
5939 # (default = False, old alghorithm based on shape properties)
5940 # @param theName Object name; when specified, this parameter is used
5941 # for result publication in the study. Otherwise, if automatic
5942 # publication is switched on, default value is used for result name.
5944 # @return Compound which includes all found sub-shapes if they have different types;
5945 # or group of all found shapes of the equal type; or a single found sub-shape.
5947 # @note This function has a restriction on argument shapes.
5948 # If \a theShapeWhere has curved parts with significantly
5949 # outstanding centres (i.e. the mass centre of a part is closer to
5950 # \a theShapeWhat than to the part), such parts will not be found.
5951 # @image html get_in_place_lost_part.png
5953 # @ref swig_GetInPlace "Example"
5954 @ManageTransactions("ShapesOp")
5955 def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False, theName=None):
5957 Get sub-shape(s) of theShapeWhere, which are
5958 coincident with theShapeWhat or could be a part of it.
5961 theShapeWhere Shape to find sub-shapes of.
5962 theShapeWhat Shape, specifying what to find.
5963 isNewImplementation Implementation of GetInPlace functionality
5964 (default = False, old alghorithm based on shape properties)
5965 theName Object name; when specified, this parameter is used
5966 for result publication in the study. Otherwise, if automatic
5967 publication is switched on, default value is used for result name.
5970 Compound which includes all found sub-shapes if they have different types;
5971 or group of all found shapes of the equal type; or a single found sub-shape.
5975 This function has a restriction on argument shapes.
5976 If theShapeWhere has curved parts with significantly
5977 outstanding centres (i.e. the mass centre of a part is closer to
5978 theShapeWhat than to the part), such parts will not be found.
5980 # Example: see GEOM_TestOthers.py
5982 if isNewImplementation:
5983 anObj = self.ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
5985 anObj = self.ShapesOp.GetInPlaceOld(theShapeWhere, theShapeWhat)
5987 RaiseIfFailed("GetInPlace", self.ShapesOp)
5988 self._autoPublish(anObj, theName, "inplace")
5991 ## Get sub-shape(s) of \a theShapeWhere, which are
5992 # coincident with \a theShapeWhat or could be a part of it.
5994 # Implementation of this method is based on a saved history of an operation,
5995 # produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
5996 # arguments (an argument shape or a sub-shape of an argument shape).
5997 # The operation could be the Partition or one of boolean operations,
5998 # performed on simple shapes (not on compounds).
6000 # @param theShapeWhere Shape to find sub-shapes of.
6001 # @param theShapeWhat Shape, specifying what to find (must be in the
6002 # building history of the ShapeWhere).
6003 # @param theName Object name; when specified, this parameter is used
6004 # for result publication in the study. Otherwise, if automatic
6005 # publication is switched on, default value is used for result name.
6007 # @return Compound which includes all found sub-shapes if they have different types;
6008 # or group of all found shapes of the equal type; or a single found sub-shape.
6010 # @ref swig_GetInPlace "Example"
6011 @ManageTransactions("ShapesOp")
6012 def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat, theName=None):
6014 Implementation of this method is based on a saved history of an operation,
6015 produced theShapeWhere. The theShapeWhat must be among this operation's
6016 arguments (an argument shape or a sub-shape of an argument shape).
6017 The operation could be the Partition or one of boolean operations,
6018 performed on simple shapes (not on compounds).
6021 theShapeWhere Shape to find sub-shapes of.
6022 theShapeWhat Shape, specifying what to find (must be in the
6023 building history of the ShapeWhere).
6024 theName Object name; when specified, this parameter is used
6025 for result publication in the study. Otherwise, if automatic
6026 publication is switched on, default value is used for result name.
6029 Compound which includes all found sub-shapes if they have different types;
6030 or group of all found shapes of the equal type; or a single found sub-shape.
6032 # Example: see GEOM_TestOthers.py
6033 anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
6034 RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
6035 self._autoPublish(anObj, theName, "inplace")
6038 ## A sort of GetInPlace functionality, returning IDs of sub-shapes.
6039 # For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
6040 # IDs of @a theShapeWhere.
6041 # For example, if theShapeWhat is a box and theShapeWhere is this box cut into
6042 # two parts by a plane, then the result can be as this:
6043 # len( result_list ) = 35,
6044 # result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
6045 # solids with IDs 2 and 36 within theShapeWhere
6047 # @param theShapeWhere Shape to find sub-shapes of.
6048 # @param theShapeWhat Shape, specifying what to find.
6049 # @return List of lists of sub-shape IDS of theShapeWhere.
6050 def GetInPlaceMap(self, theShapeWhere, theShapeWhat):
6052 A sort of GetInPlace functionality, returning IDs of sub-shapes.
6053 For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
6054 IDs of @a theShapeWhere.
6055 For example, if theShapeWhat is a box and theShapeWhere is this box cut into
6056 two parts by a plane, then the result can be as this:
6057 len( result_list ) = 35,
6058 result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
6059 solids with IDs 2 and 36 within theShapeWhere
6062 theShapeWhere Shape to find sub-shapes of.
6063 theShapeWhat Shape, specifying what to find.
6066 List of lists of sub-shape IDS of theShapeWhere.
6068 return self.ShapesOp.GetInPlaceMap(theShapeWhere, theShapeWhat)
6070 ## Get sub-shape of theShapeWhere, which is
6071 # equal to \a theShapeWhat.
6072 # @param theShapeWhere Shape to find sub-shape of.
6073 # @param theShapeWhat Shape, specifying what to find.
6074 # @param theName Object name; when specified, this parameter is used
6075 # for result publication in the study. Otherwise, if automatic
6076 # publication is switched on, default value is used for result name.
6078 # @return New GEOM.GEOM_Object for found sub-shape.
6080 # @ref swig_GetSame "Example"
6081 @ManageTransactions("ShapesOp")
6082 def GetSame(self, theShapeWhere, theShapeWhat, theName=None):
6084 Get sub-shape of theShapeWhere, which is
6085 equal to theShapeWhat.
6088 theShapeWhere Shape to find sub-shape of.
6089 theShapeWhat Shape, specifying what to find.
6090 theName Object name; when specified, this parameter is used
6091 for result publication in the study. Otherwise, if automatic
6092 publication is switched on, default value is used for result name.
6095 New GEOM.GEOM_Object for found sub-shape.
6097 anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
6098 RaiseIfFailed("GetSame", self.ShapesOp)
6099 self._autoPublish(anObj, theName, "sameShape")
6103 ## Get sub-shape indices of theShapeWhere, which is
6104 # equal to \a theShapeWhat.
6105 # @param theShapeWhere Shape to find sub-shape of.
6106 # @param theShapeWhat Shape, specifying what to find.
6107 # @return List of all found sub-shapes indices.
6109 # @ref swig_GetSame "Example"
6110 @ManageTransactions("ShapesOp")
6111 def GetSameIDs(self, theShapeWhere, theShapeWhat):
6113 Get sub-shape indices of theShapeWhere, which is
6114 equal to theShapeWhat.
6117 theShapeWhere Shape to find sub-shape of.
6118 theShapeWhat Shape, specifying what to find.
6121 List of all found sub-shapes indices.
6123 anObj = self.ShapesOp.GetSameIDs(theShapeWhere, theShapeWhat)
6124 RaiseIfFailed("GetSameIDs", self.ShapesOp)
6127 ## Resize the input edge with the new Min and Max parameters.
6128 # The input edge parameters range is [0, 1]. If theMin parameter is
6129 # negative, the input edge is extended, otherwise it is shrinked by
6130 # theMin parameter. If theMax is greater than 1, the edge is extended,
6131 # otherwise it is shrinked by theMax parameter.
6132 # @param theEdge the input edge to be resized.
6133 # @param theMin the minimal parameter value.
6134 # @param theMax the maximal parameter value.
6135 # @param theName Object name; when specified, this parameter is used
6136 # for result publication in the study. Otherwise, if automatic
6137 # publication is switched on, default value is used for result name.
6138 # @return New GEOM.GEOM_Object, containing the created edge.
6140 # @ref tui_extend "Example"
6141 @ManageTransactions("ShapesOp")
6142 def ExtendEdge(self, theEdge, theMin, theMax, theName=None):
6144 Resize the input edge with the new Min and Max parameters.
6145 The input edge parameters range is [0, 1]. If theMin parameter is
6146 negative, the input edge is extended, otherwise it is shrinked by
6147 theMin parameter. If theMax is greater than 1, the edge is extended,
6148 otherwise it is shrinked by theMax parameter.
6151 theEdge the input edge to be resized.
6152 theMin the minimal parameter value.
6153 theMax the maximal parameter value.
6154 theName Object name; when specified, this parameter is used
6155 for result publication in the study. Otherwise, if automatic
6156 publication is switched on, default value is used for result name.
6159 New GEOM.GEOM_Object, containing the created edge.
6161 theMin, theMax, Parameters = ParseParameters(theMin, theMax)
6162 anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax)
6163 RaiseIfFailed("ExtendEdge", self.ShapesOp)
6164 anObj.SetParameters(Parameters)
6165 self._autoPublish(anObj, theName, "edge")
6168 ## Resize the input face with the new UMin, UMax, VMin and VMax
6169 # parameters. The input face U and V parameters range is [0, 1]. If
6170 # theUMin parameter is negative, the input face is extended, otherwise
6171 # it is shrinked along U direction by theUMin parameter. If theUMax is
6172 # greater than 1, the face is extended, otherwise it is shrinked along
6173 # U direction by theUMax parameter. So as for theVMin, theVMax and
6174 # V direction of the input face.
6175 # @param theFace the input face to be resized.
6176 # @param theUMin the minimal U parameter value.
6177 # @param theUMax the maximal U parameter value.
6178 # @param theVMin the minimal V parameter value.
6179 # @param theVMax the maximal V parameter value.
6180 # @param theName Object name; when specified, this parameter is used
6181 # for result publication in the study. Otherwise, if automatic
6182 # publication is switched on, default value is used for result name.
6183 # @return New GEOM.GEOM_Object, containing the created face.
6185 # @ref tui_extend "Example"
6186 @ManageTransactions("ShapesOp")
6187 def ExtendFace(self, theFace, theUMin, theUMax,
6188 theVMin, theVMax, theName=None):
6190 Resize the input face with the new UMin, UMax, VMin and VMax
6191 parameters. The input face U and V parameters range is [0, 1]. If
6192 theUMin parameter is negative, the input face is extended, otherwise
6193 it is shrinked along U direction by theUMin parameter. If theUMax is
6194 greater than 1, the face is extended, otherwise it is shrinked along
6195 U direction by theUMax parameter. So as for theVMin, theVMax and
6196 V direction of the input face.
6199 theFace the input face to be resized.
6200 theUMin the minimal U parameter value.
6201 theUMax the maximal U parameter value.
6202 theVMin the minimal V parameter value.
6203 theVMax the maximal V parameter value.
6204 theName Object name; when specified, this parameter is used
6205 for result publication in the study. Otherwise, if automatic
6206 publication is switched on, default value is used for result name.
6209 New GEOM.GEOM_Object, containing the created face.
6211 theUMin, theUMax, theVMin, theVMax, Parameters = ParseParameters(theUMin, theUMax, theVMin, theVMax)
6212 anObj = self.ShapesOp.ExtendFace(theFace, theUMin, theUMax,
6214 RaiseIfFailed("ExtendFace", self.ShapesOp)
6215 anObj.SetParameters(Parameters)
6216 self._autoPublish(anObj, theName, "face")
6219 ## This function takes some face as input parameter and creates new
6220 # GEOM_Object, i.e. topological shape by extracting underlying surface
6221 # of the source face and limiting it by the Umin, Umax, Vmin, Vmax
6222 # parameters of the source face (in the parametrical space).
6223 # @param theFace the input face.
6224 # @param theName Object name; when specified, this parameter is used
6225 # for result publication in the study. Otherwise, if automatic
6226 # publication is switched on, default value is used for result name.
6227 # @return New GEOM.GEOM_Object, containing the created face.
6229 # @ref tui_creation_surface "Example"
6230 @ManageTransactions("ShapesOp")
6231 def MakeSurfaceFromFace(self, theFace, theName=None):
6233 This function takes some face as input parameter and creates new
6234 GEOM_Object, i.e. topological shape by extracting underlying surface
6235 of the source face and limiting it by the Umin, Umax, Vmin, Vmax
6236 parameters of the source face (in the parametrical space).
6239 theFace the input face.
6240 theName Object name; when specified, this parameter is used
6241 for result publication in the study. Otherwise, if automatic
6242 publication is switched on, default value is used for result name.
6245 New GEOM.GEOM_Object, containing the created face.
6247 anObj = self.ShapesOp.MakeSurfaceFromFace(theFace)
6248 RaiseIfFailed("MakeSurfaceFromFace", self.ShapesOp)
6249 self._autoPublish(anObj, theName, "surface")
6255 ## @addtogroup l4_access
6258 ## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
6259 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
6260 # @param aShape Shape to get sub-shape of.
6261 # @param ListOfID List of sub-shapes indices.
6262 # @param theName Object name; when specified, this parameter is used
6263 # for result publication in the study. Otherwise, if automatic
6264 # publication is switched on, default value is used for result name.
6266 # @return Found sub-shape.
6268 # @ref swig_all_decompose "Example"
6269 def GetSubShape(self, aShape, ListOfID, theName=None):
6271 Obtain a composite sub-shape of aShape, composed from sub-shapes
6272 of aShape, selected by their unique IDs inside aShape
6275 aShape Shape to get sub-shape of.
6276 ListOfID List of sub-shapes indices.
6277 theName Object name; when specified, this parameter is used
6278 for result publication in the study. Otherwise, if automatic
6279 publication is switched on, default value is used for result name.
6284 # Example: see GEOM_TestAll.py
6285 anObj = self.AddSubShape(aShape,ListOfID)
6286 self._autoPublish(anObj, theName, "subshape")
6289 ## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
6290 # of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
6291 # @param aShape Shape to get sub-shape of.
6292 # @param aSubShape Sub-shapes of aShape.
6293 # @return ID of found sub-shape.
6295 # @ref swig_all_decompose "Example"
6296 @ManageTransactions("LocalOp")
6297 def GetSubShapeID(self, aShape, aSubShape):
6299 Obtain unique ID of sub-shape aSubShape inside aShape
6300 of aShape, selected by their unique IDs inside aShape
6303 aShape Shape to get sub-shape of.
6304 aSubShape Sub-shapes of aShape.
6307 ID of found sub-shape.
6309 # Example: see GEOM_TestAll.py
6310 anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
6311 RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
6314 ## Obtain unique IDs of sub-shapes <VAR>aSubShapes</VAR> inside <VAR>aShape</VAR>
6315 # This function is provided for performance purpose. The complexity is O(n) with n
6316 # the number of subobjects of aShape
6317 # @param aShape Shape to get sub-shape of.
6318 # @param aSubShapes Sub-shapes of aShape.
6319 # @return list of IDs of found sub-shapes.
6321 # @ref swig_all_decompose "Example"
6322 @ManageTransactions("ShapesOp")
6323 def GetSubShapesIDs(self, aShape, aSubShapes):
6325 Obtain a list of IDs of sub-shapes aSubShapes inside aShape
6326 This function is provided for performance purpose. The complexity is O(n) with n
6327 the number of subobjects of aShape
6330 aShape Shape to get sub-shape of.
6331 aSubShapes Sub-shapes of aShape.
6334 List of IDs of found sub-shape.
6336 # Example: see GEOM_TestAll.py
6337 anIDs = self.ShapesOp.GetSubShapesIndices(aShape, aSubShapes)
6338 RaiseIfFailed("GetSubShapesIndices", self.ShapesOp)
6344 ## @addtogroup l4_decompose
6347 ## Get all sub-shapes and groups of \a theShape,
6348 # that were created already by any other methods.
6349 # @param theShape Any shape.
6350 # @param theGroupsOnly If this parameter is TRUE, only groups will be
6351 # returned, else all found sub-shapes and groups.
6352 # @return List of existing sub-objects of \a theShape.
6354 # @ref swig_all_decompose "Example"
6355 @ManageTransactions("ShapesOp")
6356 def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
6358 Get all sub-shapes and groups of theShape,
6359 that were created already by any other methods.
6363 theGroupsOnly If this parameter is TRUE, only groups will be
6364 returned, else all found sub-shapes and groups.
6367 List of existing sub-objects of theShape.
6369 # Example: see GEOM_TestAll.py
6370 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
6371 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
6374 ## Get all groups of \a theShape,
6375 # that were created already by any other methods.
6376 # @param theShape Any shape.
6377 # @return List of existing groups of \a theShape.
6379 # @ref swig_all_decompose "Example"
6380 @ManageTransactions("ShapesOp")
6381 def GetGroups(self, theShape):
6383 Get all groups of theShape,
6384 that were created already by any other methods.
6390 List of existing groups of theShape.
6392 # Example: see GEOM_TestAll.py
6393 ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
6394 RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
6397 ## Explode a shape on sub-shapes of a given type.
6398 # If the shape itself matches the type, it is also returned.
6399 # @param aShape Shape to be exploded.
6400 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6401 # @param theName Object name; when specified, this parameter is used
6402 # for result publication in the study. Otherwise, if automatic
6403 # publication is switched on, default value is used for result name.
6405 # @return List of sub-shapes of type theShapeType, contained in theShape.
6407 # @ref swig_all_decompose "Example"
6408 @ManageTransactions("ShapesOp")
6409 def SubShapeAll(self, aShape, aType, theName=None):
6411 Explode a shape on sub-shapes of a given type.
6412 If the shape itself matches the type, it is also returned.
6415 aShape Shape to be exploded.
6416 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6417 theName Object name; when specified, this parameter is used
6418 for result publication in the study. Otherwise, if automatic
6419 publication is switched on, default value is used for result name.
6422 List of sub-shapes of type theShapeType, contained in theShape.
6424 # Example: see GEOM_TestAll.py
6425 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), False)
6426 RaiseIfFailed("SubShapeAll", self.ShapesOp)
6427 self._autoPublish(ListObj, theName, "subshape")
6430 ## Explode a shape on sub-shapes of a given type.
6431 # @param aShape Shape to be exploded.
6432 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6433 # @return List of IDs of sub-shapes.
6435 # @ref swig_all_decompose "Example"
6436 @ManageTransactions("ShapesOp")
6437 def SubShapeAllIDs(self, aShape, aType):
6439 Explode a shape on sub-shapes of a given type.
6442 aShape Shape to be exploded (see geompy.ShapeType)
6443 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6446 List of IDs of sub-shapes.
6448 ListObj = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), False)
6449 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6452 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
6453 # selected by their indices in list of all sub-shapes of type <VAR>aType</VAR>.
6454 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6455 # @param aShape Shape to get sub-shape of.
6456 # @param ListOfInd List of sub-shapes indices.
6457 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6458 # @param theName Object name; when specified, this parameter is used
6459 # for result publication in the study. Otherwise, if automatic
6460 # publication is switched on, default value is used for result name.
6462 # @return A compound of sub-shapes of aShape.
6464 # @ref swig_all_decompose "Example"
6465 def SubShape(self, aShape, aType, ListOfInd, theName=None):
6467 Obtain a compound of sub-shapes of aShape,
6468 selected by their indices in list of all sub-shapes of type aType.
6469 Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6472 aShape Shape to get sub-shape of.
6473 ListOfID List of sub-shapes indices.
6474 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6475 theName Object name; when specified, this parameter is used
6476 for result publication in the study. Otherwise, if automatic
6477 publication is switched on, default value is used for result name.
6480 A compound of sub-shapes of aShape.
6482 # Example: see GEOM_TestAll.py
6484 AllShapeIDsList = self.SubShapeAllIDs(aShape, EnumToLong( aType ))
6485 for ind in ListOfInd:
6486 ListOfIDs.append(AllShapeIDsList[ind - 1])
6487 # note: auto-publishing is done in self.GetSubShape()
6488 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6491 ## Explode a shape on sub-shapes of a given type.
6492 # Sub-shapes will be sorted taking into account their gravity centers,
6493 # to provide stable order of sub-shapes. Please see
6494 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6495 # If the shape itself matches the type, it is also returned.
6496 # @param aShape Shape to be exploded.
6497 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6498 # @param theName Object name; when specified, this parameter is used
6499 # for result publication in the study. Otherwise, if automatic
6500 # publication is switched on, default value is used for result name.
6502 # @return List of sub-shapes of type theShapeType, contained in theShape.
6504 # @ref swig_SubShapeAllSorted "Example"
6505 @ManageTransactions("ShapesOp")
6506 def SubShapeAllSortedCentres(self, aShape, aType, theName=None):
6508 Explode a shape on sub-shapes of a given type.
6509 Sub-shapes will be sorted taking into account their gravity centers,
6510 to provide stable order of sub-shapes.
6511 If the shape itself matches the type, it is also returned.
6514 aShape Shape to be exploded.
6515 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6516 theName Object name; when specified, this parameter is used
6517 for result publication in the study. Otherwise, if automatic
6518 publication is switched on, default value is used for result name.
6521 List of sub-shapes of type theShapeType, contained in theShape.
6523 # Example: see GEOM_TestAll.py
6524 ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), True)
6525 RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
6526 self._autoPublish(ListObj, theName, "subshape")
6529 ## Explode a shape on sub-shapes of a given type.
6530 # Sub-shapes will be sorted taking into account their gravity centers,
6531 # to provide stable order of sub-shapes. Please see
6532 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6533 # @param aShape Shape to be exploded.
6534 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6535 # @return List of IDs of sub-shapes.
6537 # @ref swig_all_decompose "Example"
6538 @ManageTransactions("ShapesOp")
6539 def SubShapeAllSortedCentresIDs(self, aShape, aType):
6541 Explode a shape on sub-shapes of a given type.
6542 Sub-shapes will be sorted taking into account their gravity centers,
6543 to provide stable order of sub-shapes.
6546 aShape Shape to be exploded.
6547 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6550 List of IDs of sub-shapes.
6552 ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), True)
6553 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6556 ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
6557 # selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
6558 # Please see @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6559 # Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6560 # @param aShape Shape to get sub-shape of.
6561 # @param ListOfInd List of sub-shapes indices.
6562 # @param aType Type of sub-shapes to be retrieved (see ShapeType())
6563 # @param theName Object name; when specified, this parameter is used
6564 # for result publication in the study. Otherwise, if automatic
6565 # publication is switched on, default value is used for result name.
6567 # @return A compound of sub-shapes of aShape.
6569 # @ref swig_all_decompose "Example"
6570 def SubShapeSortedCentres(self, aShape, aType, ListOfInd, theName=None):
6572 Obtain a compound of sub-shapes of aShape,
6573 selected by they indices in sorted list of all sub-shapes of type aType.
6574 Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
6577 aShape Shape to get sub-shape of.
6578 ListOfID List of sub-shapes indices.
6579 aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
6580 theName Object name; when specified, this parameter is used
6581 for result publication in the study. Otherwise, if automatic
6582 publication is switched on, default value is used for result name.
6585 A compound of sub-shapes of aShape.
6587 # Example: see GEOM_TestAll.py
6589 AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, EnumToLong( aType ))
6590 for ind in ListOfInd:
6591 ListOfIDs.append(AllShapeIDsList[ind - 1])
6592 # note: auto-publishing is done in self.GetSubShape()
6593 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6596 ## Extract shapes (excluding the main shape) of given type.
6597 # @param aShape The shape.
6598 # @param aType The shape type (see ShapeType())
6599 # @param isSorted Boolean flag to switch sorting on/off. Please see
6600 # @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
6601 # @param theName Object name; when specified, this parameter is used
6602 # for result publication in the study. Otherwise, if automatic
6603 # publication is switched on, default value is used for result name.
6605 # @return List of sub-shapes of type aType, contained in aShape.
6607 # @ref swig_FilletChamfer "Example"
6608 @ManageTransactions("ShapesOp")
6609 def ExtractShapes(self, aShape, aType, isSorted = False, theName=None):
6611 Extract shapes (excluding the main shape) of given type.
6615 aType The shape type (see geompy.ShapeType)
6616 isSorted Boolean flag to switch sorting on/off.
6617 theName Object name; when specified, this parameter is used
6618 for result publication in the study. Otherwise, if automatic
6619 publication is switched on, default value is used for result name.
6622 List of sub-shapes of type aType, contained in aShape.
6624 # Example: see GEOM_TestAll.py
6625 ListObj = self.ShapesOp.ExtractSubShapes(aShape, EnumToLong( aType ), isSorted)
6626 RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
6627 self._autoPublish(ListObj, theName, "subshape")
6630 ## Get a set of sub-shapes defined by their unique IDs inside <VAR>aShape</VAR>
6631 # @param aShape Main shape.
6632 # @param anIDs List of unique IDs of sub-shapes inside <VAR>aShape</VAR>.
6633 # @param theName Object name; when specified, this parameter is used
6634 # for result publication in the study. Otherwise, if automatic
6635 # publication is switched on, default value is used for result name.
6636 # @return List of GEOM.GEOM_Object, corresponding to found sub-shapes.
6638 # @ref swig_all_decompose "Example"
6639 @ManageTransactions("ShapesOp")
6640 def SubShapes(self, aShape, anIDs, theName=None):
6642 Get a set of sub-shapes defined by their unique IDs inside theMainShape
6646 anIDs List of unique IDs of sub-shapes inside theMainShape.
6647 theName Object name; when specified, this parameter is used
6648 for result publication in the study. Otherwise, if automatic
6649 publication is switched on, default value is used for result name.
6652 List of GEOM.GEOM_Object, corresponding to found sub-shapes.
6654 # Example: see GEOM_TestAll.py
6655 ListObj = self.ShapesOp.MakeSubShapes(aShape, anIDs)
6656 RaiseIfFailed("SubShapes", self.ShapesOp)
6657 self._autoPublish(ListObj, theName, "subshape")
6660 ## Explode a shape into edges sorted in a row from a starting point.
6661 # @param theShape the shape to be exploded on edges.
6662 # @param theStartPoint the starting point.
6663 # @param theName Object name; when specified, this parameter is used
6664 # for result publication in the study. Otherwise, if automatic
6665 # publication is switched on, default value is used for result name.
6666 # @return List of GEOM.GEOM_Object that is actually an ordered list
6667 # of edges sorted in a row from a starting point.
6669 # @ref swig_GetSubShapeEdgeSorted "Example"
6670 @ManageTransactions("ShapesOp")
6671 def GetSubShapeEdgeSorted(self, theShape, theStartPoint, theName=None):
6673 Explode a shape into edges sorted in a row from a starting point.
6676 theShape the shape to be exploded on edges.
6677 theStartPoint the starting point.
6678 theName Object name; when specified, this parameter is used
6679 for result publication in the study. Otherwise, if automatic
6680 publication is switched on, default value is used for result name.
6683 List of GEOM.GEOM_Object that is actually an ordered list
6684 of edges sorted in a row from a starting point.
6686 # Example: see GEOM_TestAll.py
6687 ListObj = self.ShapesOp.GetSubShapeEdgeSorted(theShape, theStartPoint)
6688 RaiseIfFailed("GetSubShapeEdgeSorted", self.ShapesOp)
6689 self._autoPublish(ListObj, theName, "SortedEdges")
6693 # Return the list of subshapes that satisfies a certain tolerance
6694 # criterion. The user defines the type of shapes to be returned, the
6695 # condition and the tolerance value. The operation is defined for
6696 # faces, edges and vertices only. E.g. for theShapeType FACE,
6697 # theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
6698 # all faces of theShape that have tolerances greater then 1.e7.
6700 # @param theShape the shape to be exploded
6701 # @param theShapeType the type of sub-shapes to be returned (see
6702 # ShapeType()). Can have the values FACE, EDGE and VERTEX only.
6703 # @param theCondition the condition type (see GEOM::comparison_condition).
6704 # @param theTolerance the tolerance filter.
6705 # @param theName Object name; when specified, this parameter is used
6706 # for result publication in the study. Otherwise, if automatic
6707 # publication is switched on, default value is used for result name.
6708 # @return the list of shapes that satisfy the conditions.
6710 # @ref swig_GetSubShapesWithTolerance "Example"
6711 @ManageTransactions("ShapesOp")
6712 def GetSubShapesWithTolerance(self, theShape, theShapeType,
6713 theCondition, theTolerance, theName=None):
6715 Return the list of subshapes that satisfies a certain tolerance
6716 criterion. The user defines the type of shapes to be returned, the
6717 condition and the tolerance value. The operation is defined for
6718 faces, edges and vertices only. E.g. for theShapeType FACE,
6719 theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
6720 all faces of theShape that have tolerances greater then 1.e7.
6723 theShape the shape to be exploded
6724 theShapeType the type of sub-shapes to be returned (see
6725 ShapeType()). Can have the values FACE,
6726 EDGE and VERTEX only.
6727 theCondition the condition type (see GEOM::comparison_condition).
6728 theTolerance the tolerance filter.
6729 theName Object name; when specified, this parameter is used
6730 for result publication in the study. Otherwise, if automatic
6731 publication is switched on, default value is used for result name.
6734 The list of shapes that satisfy the conditions.
6736 # Example: see GEOM_TestAll.py
6737 ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
6738 theCondition, theTolerance)
6739 RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
6740 self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
6743 ## Check if the object is a sub-object of another GEOM object.
6744 # @param aSubObject Checked sub-object (or its parent object, in case if
6745 # \a theSubObjectIndex is non-zero).
6746 # @param anObject An object that is checked for ownership (or its parent object,
6747 # in case if \a theObjectIndex is non-zero).
6748 # @param aSubObjectIndex When non-zero, specifies a sub-shape index that
6749 # identifies a sub-object within its parent specified via \a theSubObject.
6750 # @param anObjectIndex When non-zero, specifies a sub-shape index that
6751 # identifies an object within its parent specified via \a theObject.
6752 # @return TRUE, if the given object contains sub-object.
6753 @ManageTransactions("ShapesOp")
6754 def IsSubShapeBelongsTo(self, aSubObject, anObject, aSubObjectIndex = 0, anObjectIndex = 0):
6756 Check if the object is a sub-object of another GEOM object.
6759 aSubObject Checked sub-object (or its parent object, in case if
6760 \a theSubObjectIndex is non-zero).
6761 anObject An object that is checked for ownership (or its parent object,
6762 in case if \a theObjectIndex is non-zero).
6763 aSubObjectIndex When non-zero, specifies a sub-shape index that
6764 identifies a sub-object within its parent specified via \a theSubObject.
6765 anObjectIndex When non-zero, specifies a sub-shape index that
6766 identifies an object within its parent specified via \a theObject.
6769 TRUE, if the given object contains sub-object.
6771 IsOk = self.ShapesOp.IsSubShapeBelongsTo(aSubObject, aSubObjectIndex, anObject, anObjectIndex)
6772 RaiseIfFailed("IsSubShapeBelongsTo", self.ShapesOp)
6775 ## Perform extraction of sub-shapes from the main shape.
6777 # @param theShape the main shape
6778 # @param theListOfID the list of sub-shape IDs to be extracted from
6780 # @return New GEOM.GEOM_Object, containing the shape without
6781 # extracted sub-shapes.
6783 # @ref swig_MakeExtraction "Example"
6784 @ManageTransactions("ShapesOp")
6785 def MakeExtraction(self, theShape, theListOfID, theName=None):
6787 Perform extraction of sub-shapes from the main shape.
6790 theShape the main shape
6791 theListOfID the list of sub-shape IDs to be extracted from
6795 New GEOM.GEOM_Object, containing the shape without
6796 extracted sub-shapes.
6798 # Example: see GEOM_TestAll.py
6799 (anObj, aStat) = self.ShapesOp.MakeExtraction(theShape, theListOfID)
6800 RaiseIfFailed("MakeExtraction", self.ShapesOp)
6801 self._autoPublish(anObj, theName, "Extraction")
6804 # end of l4_decompose
6807 ## @addtogroup l4_decompose_d
6810 ## Deprecated method
6811 # It works like SubShapeAllSortedCentres(), but wrongly
6812 # defines centres of faces, shells and solids.
6813 @ManageTransactions("ShapesOp")
6814 def SubShapeAllSorted(self, aShape, aType, theName=None):
6817 It works like geompy.SubShapeAllSortedCentres, but wrongly
6818 defines centres of faces, shells and solids.
6820 ListObj = self.ShapesOp.MakeExplode(aShape, EnumToLong( aType ), True)
6821 RaiseIfFailed("MakeExplode", self.ShapesOp)
6822 self._autoPublish(ListObj, theName, "subshape")
6825 ## Deprecated method
6826 # It works like SubShapeAllSortedCentresIDs(), but wrongly
6827 # defines centres of faces, shells and solids.
6828 @ManageTransactions("ShapesOp")
6829 def SubShapeAllSortedIDs(self, aShape, aType):
6832 It works like geompy.SubShapeAllSortedCentresIDs, but wrongly
6833 defines centres of faces, shells and solids.
6835 ListIDs = self.ShapesOp.SubShapeAllIDs(aShape, EnumToLong( aType ), True)
6836 RaiseIfFailed("SubShapeAllIDs", self.ShapesOp)
6839 ## Deprecated method
6840 # It works like SubShapeSortedCentres(), but has a bug
6841 # (wrongly defines centres of faces, shells and solids).
6842 def SubShapeSorted(self, aShape, aType, ListOfInd, theName=None):
6845 It works like geompy.SubShapeSortedCentres, but has a bug
6846 (wrongly defines centres of faces, shells and solids).
6849 AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, EnumToLong( aType ))
6850 for ind in ListOfInd:
6851 ListOfIDs.append(AllShapeIDsList[ind - 1])
6852 # note: auto-publishing is done in self.GetSubShape()
6853 anObj = self.GetSubShape(aShape, ListOfIDs, theName)
6856 # end of l4_decompose_d
6859 ## @addtogroup l3_healing
6862 ## Apply a sequence of Shape Healing operators to the given object.
6863 # @param theShape Shape to be processed.
6864 # @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
6865 # @param theParameters List of names of parameters
6866 # ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
6867 # @param theValues List of values of parameters, in the same order
6868 # as parameters are listed in <VAR>theParameters</VAR> list.
6869 # @param theName Object name; when specified, this parameter is used
6870 # for result publication in the study. Otherwise, if automatic
6871 # publication is switched on, default value is used for result name.
6873 # <b> Operators and Parameters: </b> \n
6875 # * \b FixShape - corrects invalid shapes. \n
6876 # - \b FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them. \n
6877 # - \b FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction. \n
6879 # * \b FixFaceSize - removes small faces, such as spots and strips.\n
6880 # - \b FixFaceSize.Tolerance - defines minimum possible face size. \n
6881 # - \b DropSmallEdges - removes edges, which merge with neighbouring edges. \n
6882 # - \b DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.\n
6883 # - \b DropSmallSolids - either removes small solids or merges them with neighboring ones. \n
6884 # - \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
6885 # - \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
6886 # - \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
6888 # * \b SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical
6889 # surfaces in segments using a certain angle. \n
6890 # - \b SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
6891 # if Angle=180, four if Angle=90, etc). \n
6892 # - \b SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.\n
6894 # * \b SplitClosedFaces - splits closed faces in segments.
6895 # The number of segments depends on the number of splitting points.\n
6896 # - \b SplitClosedFaces.NbSplitPoints - the number of splitting points.\n
6898 # * \b SplitContinuity - splits shapes to reduce continuities of curves and surfaces.\n
6899 # - \b SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.\n
6900 # - \b SplitContinuity.SurfaceContinuity - required continuity for surfaces.\n
6901 # - \b SplitContinuity.CurveContinuity - required continuity for curves.\n
6902 # This and the previous parameters can take the following values:\n
6903 # \b Parametric \b Continuity \n
6904 # \b C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces
6905 # are coincidental. The curves or surfaces may still meet at an angle, giving rise to a sharp corner or edge).\n
6906 # \b C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces are parallel,
6907 # ruling out sharp edges).\n
6908 # \b C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves or surfaces
6909 # are of the same magnitude).\n
6910 # \b CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of curves
6911 # or surfaces (d/du C(u)) are the same at junction. \n
6912 # \b Geometric \b Continuity \n
6913 # \b G1: first derivatives are proportional at junction.\n
6914 # The curve tangents thus have the same direction, but not necessarily the same magnitude.
6915 # i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).\n
6916 # \b G2: first and second derivatives are proportional at junction.
6917 # As the names imply, geometric continuity requires the geometry to be continuous, while parametric
6918 # continuity requires that the underlying parameterization was continuous as well.
6919 # Parametric continuity of order n implies geometric continuity of order n, but not vice-versa.\n
6921 # * \b BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:\n
6922 # - \b BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.\n
6923 # - \b BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.\n
6924 # - \b BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.\n
6925 # - \b BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation
6926 # with the specified parameters.\n
6927 # - \b BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation
6928 # with the specified parameters.\n
6929 # - \b BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.\n
6930 # - \b BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.\n
6931 # - \b BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.\n
6932 # - \b BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.\n
6934 # * \b ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.\n
6935 # - \b ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.\n
6936 # - \b ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.\n
6937 # - \b ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.\n
6938 # - \b ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.\n
6940 # * \b SameParameter - fixes edges of 2D and 3D curves not having the same parameter.\n
6941 # - \b SameParameter.Tolerance3d - defines tolerance for fixing of edges.\n
6944 # @return New GEOM.GEOM_Object, containing processed shape.
6946 # \n @ref tui_shape_processing "Example"
6947 @ManageTransactions("HealOp")
6948 def ProcessShape(self, theShape, theOperators, theParameters, theValues, theName=None):
6950 Apply a sequence of Shape Healing operators to the given object.
6953 theShape Shape to be processed.
6954 theValues List of values of parameters, in the same order
6955 as parameters are listed in theParameters list.
6956 theOperators List of names of operators ('FixShape', 'SplitClosedFaces', etc.).
6957 theParameters List of names of parameters
6958 ('FixShape.Tolerance3d', 'SplitClosedFaces.NbSplitPoints', etc.).
6959 theName Object name; when specified, this parameter is used
6960 for result publication in the study. Otherwise, if automatic
6961 publication is switched on, default value is used for result name.
6963 Operators and Parameters:
6965 * FixShape - corrects invalid shapes.
6966 * FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them.
6967 * FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction.
6968 * FixFaceSize - removes small faces, such as spots and strips.
6969 * FixFaceSize.Tolerance - defines minimum possible face size.
6970 * DropSmallEdges - removes edges, which merge with neighbouring edges.
6971 * DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.
6972 * DropSmallSolids - either removes small solids or merges them with neighboring ones.
6973 * 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.
6974 * 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.
6975 * 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.
6977 * SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical surfaces
6978 in segments using a certain angle.
6979 * SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
6980 if Angle=180, four if Angle=90, etc).
6981 * SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.
6982 * SplitClosedFaces - splits closed faces in segments. The number of segments depends on the number of
6984 * SplitClosedFaces.NbSplitPoints - the number of splitting points.
6985 * SplitContinuity - splits shapes to reduce continuities of curves and surfaces.
6986 * SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.
6987 * SplitContinuity.SurfaceContinuity - required continuity for surfaces.
6988 * SplitContinuity.CurveContinuity - required continuity for curves.
6989 This and the previous parameters can take the following values:
6991 Parametric Continuity:
6992 C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces are
6993 coincidental. The curves or surfaces may still meet at an angle,
6994 giving rise to a sharp corner or edge).
6995 C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces
6996 are parallel, ruling out sharp edges).
6997 C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves
6998 or surfaces are of the same magnitude).
6999 CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of
7000 curves or surfaces (d/du C(u)) are the same at junction.
7002 Geometric Continuity:
7003 G1: first derivatives are proportional at junction.
7004 The curve tangents thus have the same direction, but not necessarily the same magnitude.
7005 i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).
7006 G2: first and second derivatives are proportional at junction. As the names imply,
7007 geometric continuity requires the geometry to be continuous, while parametric continuity requires
7008 that the underlying parameterization was continuous as well. Parametric continuity of order n implies
7009 geometric continuity of order n, but not vice-versa.
7010 * BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:
7011 * BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.
7012 * BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.
7013 * BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.
7014 * BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation with
7015 the specified parameters.
7016 * BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation with
7017 the specified parameters.
7018 * BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.
7019 * BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.
7020 * BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.
7021 * BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.
7022 * ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.
7023 * ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.
7024 * ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.
7025 * ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.
7026 * ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.
7027 * SameParameter - fixes edges of 2D and 3D curves not having the same parameter.
7028 * SameParameter.Tolerance3d - defines tolerance for fixing of edges.
7031 New GEOM.GEOM_Object, containing processed shape.
7033 Note: For more information look through SALOME Geometry User's Guide->
7034 -> Introduction to Geometry-> Repairing Operations-> Shape Processing
7036 # Example: see GEOM_TestHealing.py
7037 theValues,Parameters = ParseList(theValues)
7038 anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
7039 # To avoid script failure in case of good argument shape
7040 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
7042 RaiseIfFailed("ProcessShape", self.HealOp)
7043 for string in (theOperators + theParameters):
7044 Parameters = ":" + Parameters
7046 anObj.SetParameters(Parameters)
7047 self._autoPublish(anObj, theName, "healed")
7050 ## Remove faces from the given object (shape).
7051 # @param theObject Shape to be processed.
7052 # @param theFaces Indices of faces to be removed, if EMPTY then the method
7053 # removes ALL faces of the given object.
7054 # @param theName Object name; when specified, this parameter is used
7055 # for result publication in the study. Otherwise, if automatic
7056 # publication is switched on, default value is used for result name.
7058 # @return New GEOM.GEOM_Object, containing processed shape.
7060 # @ref tui_suppress_faces "Example"
7061 @ManageTransactions("HealOp")
7062 def SuppressFaces(self, theObject, theFaces, theName=None):
7064 Remove faces from the given object (shape).
7067 theObject Shape to be processed.
7068 theFaces Indices of faces to be removed, if EMPTY then the method
7069 removes ALL faces of the given object.
7070 theName Object name; when specified, this parameter is used
7071 for result publication in the study. Otherwise, if automatic
7072 publication is switched on, default value is used for result name.
7075 New GEOM.GEOM_Object, containing processed shape.
7077 # Example: see GEOM_TestHealing.py
7078 anObj = self.HealOp.SuppressFaces(theObject, theFaces)
7079 RaiseIfFailed("SuppressFaces", self.HealOp)
7080 self._autoPublish(anObj, theName, "suppressFaces")
7083 ## Sewing of faces into a single shell.
7084 # @param ListShape Shapes to be processed.
7085 # @param theTolerance Required tolerance value.
7086 # @param AllowNonManifold Flag that allows non-manifold sewing.
7087 # @param theName Object name; when specified, this parameter is used
7088 # for result publication in the study. Otherwise, if automatic
7089 # publication is switched on, default value is used for result name.
7091 # @return New GEOM.GEOM_Object, containing a result shell.
7093 # @ref tui_sewing "Example"
7094 def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
7096 Sewing of faces into a single shell.
7099 ListShape Shapes to be processed.
7100 theTolerance Required tolerance value.
7101 AllowNonManifold Flag that allows non-manifold sewing.
7102 theName Object name; when specified, this parameter is used
7103 for result publication in the study. Otherwise, if automatic
7104 publication is switched on, default value is used for result name.
7107 New GEOM.GEOM_Object, containing containing a result shell.
7109 # Example: see GEOM_TestHealing.py
7110 # note: auto-publishing is done in self.Sew()
7111 anObj = self.Sew(ListShape, theTolerance, AllowNonManifold, theName)
7114 ## Sewing of faces into a single shell.
7115 # @param ListShape Shapes to be processed.
7116 # @param theTolerance Required tolerance value.
7117 # @param AllowNonManifold Flag that allows non-manifold sewing.
7118 # @param theName Object name; when specified, this parameter is used
7119 # for result publication in the study. Otherwise, if automatic
7120 # publication is switched on, default value is used for result name.
7122 # @return New GEOM.GEOM_Object, containing a result shell.
7123 @ManageTransactions("HealOp")
7124 def Sew(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
7126 Sewing of faces into a single shell.
7129 ListShape Shapes to be processed.
7130 theTolerance Required tolerance value.
7131 AllowNonManifold Flag that allows non-manifold sewing.
7132 theName Object name; when specified, this parameter is used
7133 for result publication in the study. Otherwise, if automatic
7134 publication is switched on, default value is used for result name.
7137 New GEOM.GEOM_Object, containing a result shell.
7139 # Example: see MakeSewing() above
7140 theTolerance,Parameters = ParseParameters(theTolerance)
7141 if AllowNonManifold:
7142 anObj = self.HealOp.SewAllowNonManifold( ToList( ListShape ), theTolerance)
7144 anObj = self.HealOp.Sew( ToList( ListShape ), theTolerance)
7145 # To avoid script failure in case of good argument shape
7146 # (Fix of test cases geom/bugs11/L7,L8)
7147 if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
7149 RaiseIfFailed("Sew", self.HealOp)
7150 anObj.SetParameters(Parameters)
7151 self._autoPublish(anObj, theName, "sewed")
7154 ## Rebuild the topology of theSolids by removing
7155 # the faces that are shared by several solids.
7156 # @param theSolids A compound or a list of solids to be processed.
7157 # @param theName Object name; when specified, this parameter is used
7158 # for result publication in the study. Otherwise, if automatic
7159 # publication is switched on, default value is used for result name.
7161 # @return New GEOM.GEOM_Object, containing processed shape.
7163 # @ref tui_remove_webs "Example"
7164 @ManageTransactions("HealOp")
7165 def RemoveInternalFaces (self, theSolids, theName=None):
7167 Rebuild the topology of theSolids by removing
7168 the faces that are shared by several solids.
7171 theSolids A compound or a list of solids to be processed.
7172 theName Object name; when specified, this parameter is used
7173 for result publication in the study. Otherwise, if automatic
7174 publication is switched on, default value is used for result name.
7177 New GEOM.GEOM_Object, containing processed shape.
7179 # Example: see GEOM_TestHealing.py
7180 anObj = self.HealOp.RemoveInternalFaces(ToList(theSolids))
7181 RaiseIfFailed("RemoveInternalFaces", self.HealOp)
7182 self._autoPublish(anObj, theName, "removeWebs")
7185 ## Remove internal wires and edges from the given object (face).
7186 # @param theObject Shape to be processed.
7187 # @param theWires Indices of wires to be removed, if EMPTY then the method
7188 # removes ALL internal wires of the given object.
7189 # @param theName Object name; when specified, this parameter is used
7190 # for result publication in the study. Otherwise, if automatic
7191 # publication is switched on, default value is used for result name.
7193 # @return New GEOM.GEOM_Object, containing processed shape.
7195 # @ref tui_suppress_internal_wires "Example"
7196 @ManageTransactions("HealOp")
7197 def SuppressInternalWires(self, theObject, theWires, theName=None):
7199 Remove internal wires and edges from the given object (face).
7202 theObject Shape to be processed.
7203 theWires Indices of wires to be removed, if EMPTY then the method
7204 removes ALL internal wires of the given object.
7205 theName Object name; when specified, this parameter is used
7206 for result publication in the study. Otherwise, if automatic
7207 publication is switched on, default value is used for result name.
7210 New GEOM.GEOM_Object, containing processed shape.
7212 # Example: see GEOM_TestHealing.py
7213 anObj = self.HealOp.RemoveIntWires(theObject, theWires)
7214 RaiseIfFailed("RemoveIntWires", self.HealOp)
7215 self._autoPublish(anObj, theName, "suppressWires")
7218 ## Remove internal closed contours (holes) from the given object.
7219 # @param theObject Shape to be processed.
7220 # @param theWires Indices of wires to be removed, if EMPTY then the method
7221 # removes ALL internal holes of the given object
7222 # @param theName Object name; when specified, this parameter is used
7223 # for result publication in the study. Otherwise, if automatic
7224 # publication is switched on, default value is used for result name.
7226 # @return New GEOM.GEOM_Object, containing processed shape.
7228 # @ref tui_suppress_holes "Example"
7229 @ManageTransactions("HealOp")
7230 def SuppressHoles(self, theObject, theWires, theName=None):
7232 Remove internal closed contours (holes) from the given object.
7235 theObject Shape to be processed.
7236 theWires Indices of wires to be removed, if EMPTY then the method
7237 removes ALL internal holes of the given object
7238 theName Object name; when specified, this parameter is used
7239 for result publication in the study. Otherwise, if automatic
7240 publication is switched on, default value is used for result name.
7243 New GEOM.GEOM_Object, containing processed shape.
7245 # Example: see GEOM_TestHealing.py
7246 anObj = self.HealOp.FillHoles(theObject, theWires)
7247 RaiseIfFailed("FillHoles", self.HealOp)
7248 self._autoPublish(anObj, theName, "suppressHoles")
7251 ## Close an open wire.
7252 # @param theObject Shape to be processed.
7253 # @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
7254 # if [ ], then <VAR>theObject</VAR> itself is a wire.
7255 # @param isCommonVertex If True : closure by creation of a common vertex,
7256 # If False : closure by creation of an edge between ends.
7257 # @param theName Object name; when specified, this parameter is used
7258 # for result publication in the study. Otherwise, if automatic
7259 # publication is switched on, default value is used for result name.
7261 # @return New GEOM.GEOM_Object, containing processed shape.
7263 # @ref tui_close_contour "Example"
7264 @ManageTransactions("HealOp")
7265 def CloseContour(self,theObject, theWires, isCommonVertex, theName=None):
7270 theObject Shape to be processed.
7271 theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape,
7272 if [ ], then theObject itself is a wire.
7273 isCommonVertex If True : closure by creation of a common vertex,
7274 If False : closure by creation of an edge between ends.
7275 theName Object name; when specified, this parameter is used
7276 for result publication in the study. Otherwise, if automatic
7277 publication is switched on, default value is used for result name.
7280 New GEOM.GEOM_Object, containing processed shape.
7282 # Example: see GEOM_TestHealing.py
7283 anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
7284 RaiseIfFailed("CloseContour", self.HealOp)
7285 self._autoPublish(anObj, theName, "closeContour")
7288 ## Addition of a point to a given edge object.
7289 # @param theObject Shape to be processed.
7290 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
7291 # if -1, then theObject itself is the edge.
7292 # @param theValue Value of parameter on edge or length parameter,
7293 # depending on \a isByParameter.
7294 # @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], \n
7295 # if FALSE : \a theValue is treated as a length parameter [0..1]
7296 # @param theName Object name; when specified, this parameter is used
7297 # for result publication in the study. Otherwise, if automatic
7298 # publication is switched on, default value is used for result name.
7300 # @return New GEOM.GEOM_Object, containing processed shape.
7302 # @ref tui_add_point_on_edge "Example"
7303 @ManageTransactions("HealOp")
7304 def DivideEdge(self, theObject, theEdgeIndex, theValue, isByParameter, theName=None):
7306 Addition of a point to a given edge object.
7309 theObject Shape to be processed.
7310 theEdgeIndex Index of edge to be divided within theObject's shape,
7311 if -1, then theObject itself is the edge.
7312 theValue Value of parameter on edge or length parameter,
7313 depending on isByParameter.
7314 isByParameter If TRUE : theValue is treated as a curve parameter [0..1],
7315 if FALSE : theValue is treated as a length parameter [0..1]
7316 theName Object name; when specified, this parameter is used
7317 for result publication in the study. Otherwise, if automatic
7318 publication is switched on, default value is used for result name.
7321 New GEOM.GEOM_Object, containing processed shape.
7323 # Example: see GEOM_TestHealing.py
7324 theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
7325 anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
7326 RaiseIfFailed("DivideEdge", self.HealOp)
7327 anObj.SetParameters(Parameters)
7328 self._autoPublish(anObj, theName, "divideEdge")
7331 ## Addition of points to a given edge of \a theObject by projecting
7332 # other points to the given edge.
7333 # @param theObject Shape to be processed.
7334 # @param theEdgeIndex Index of edge to be divided within theObject's shape,
7335 # if -1, then theObject itself is the edge.
7336 # @param thePoints List of points to project to theEdgeIndex-th edge.
7337 # @param theName Object name; when specified, this parameter is used
7338 # for result publication in the study. Otherwise, if automatic
7339 # publication is switched on, default value is used for result name.
7341 # @return New GEOM.GEOM_Object, containing processed shape.
7343 # @ref tui_add_point_on_edge "Example"
7344 @ManageTransactions("HealOp")
7345 def DivideEdgeByPoint(self, theObject, theEdgeIndex, thePoints, theName=None):
7347 Addition of points to a given edge of \a theObject by projecting
7348 other points to the given edge.
7351 theObject Shape to be processed.
7352 theEdgeIndex The edge or its index to be divided within theObject's shape,
7353 if -1, then theObject itself is the edge.
7354 thePoints List of points to project to theEdgeIndex-th edge.
7355 theName Object name; when specified, this parameter is used
7356 for result publication in the study. Otherwise, if automatic
7357 publication is switched on, default value is used for result name.
7360 New GEOM.GEOM_Object, containing processed shape.
7362 # Example: see GEOM_TestHealing.py
7363 if isinstance( theEdgeIndex, GEOM._objref_GEOM_Object ):
7364 theEdgeIndex = self.GetSubShapeID( theObject, theEdgeIndex )
7365 anObj = self.HealOp.DivideEdgeByPoint(theObject, theEdgeIndex, ToList( thePoints ))
7366 RaiseIfFailed("DivideEdgeByPoint", self.HealOp)
7367 self._autoPublish(anObj, theName, "divideEdge")
7370 ## Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
7371 # @param theWire Wire to minimize the number of C1 continuous edges in.
7372 # @param theVertices A list of vertices to suppress. If the list
7373 # is empty, all vertices in a wire will be assumed.
7374 # @param theName Object name; when specified, this parameter is used
7375 # for result publication in the study. Otherwise, if automatic
7376 # publication is switched on, default value is used for result name.
7378 # @return New GEOM.GEOM_Object with modified wire.
7380 # @ref tui_fuse_collinear_edges "Example"
7381 @ManageTransactions("HealOp")
7382 def FuseCollinearEdgesWithinWire(self, theWire, theVertices = [], theName=None):
7384 Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
7387 theWire Wire to minimize the number of C1 continuous edges in.
7388 theVertices A list of vertices to suppress. If the list
7389 is empty, all vertices in a wire will be assumed.
7390 theName Object name; when specified, this parameter is used
7391 for result publication in the study. Otherwise, if automatic
7392 publication is switched on, default value is used for result name.
7395 New GEOM.GEOM_Object with modified wire.
7397 anObj = self.HealOp.FuseCollinearEdgesWithinWire(theWire, theVertices)
7398 RaiseIfFailed("FuseCollinearEdgesWithinWire", self.HealOp)
7399 self._autoPublish(anObj, theName, "fuseEdges")
7402 ## Change orientation of the given object. Updates given shape.
7403 # @param theObject Shape to be processed.
7404 # @return Updated <var>theObject</var>
7406 # @ref swig_todo "Example"
7407 @ManageTransactions("HealOp")
7408 def ChangeOrientationShell(self,theObject):
7410 Change orientation of the given object. Updates given shape.
7413 theObject Shape to be processed.
7418 theObject = self.HealOp.ChangeOrientation(theObject)
7419 RaiseIfFailed("ChangeOrientation", self.HealOp)
7422 ## Change orientation of the given object.
7423 # @param theObject Shape to be processed.
7424 # @param theName Object name; when specified, this parameter is used
7425 # for result publication in the study. Otherwise, if automatic
7426 # publication is switched on, default value is used for result name.
7428 # @return New GEOM.GEOM_Object, containing processed shape.
7430 # @ref swig_todo "Example"
7431 @ManageTransactions("HealOp")
7432 def ChangeOrientationShellCopy(self, theObject, theName=None):
7434 Change orientation of the given object.
7437 theObject Shape to be processed.
7438 theName Object name; when specified, this parameter is used
7439 for result publication in the study. Otherwise, if automatic
7440 publication is switched on, default value is used for result name.
7443 New GEOM.GEOM_Object, containing processed shape.
7445 anObj = self.HealOp.ChangeOrientationCopy(theObject)
7446 RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
7447 self._autoPublish(anObj, theName, "reversed")
7450 ## Try to limit tolerance of the given object by value \a theTolerance.
7451 # @param theObject Shape to be processed.
7452 # @param theTolerance Required tolerance value.
7453 # @param theName Object name; when specified, this parameter is used
7454 # for result publication in the study. Otherwise, if automatic
7455 # publication is switched on, default value is used for result name.
7457 # @return New GEOM.GEOM_Object, containing processed shape.
7459 # @ref tui_limit_tolerance "Example"
7460 @ManageTransactions("HealOp")
7461 def LimitTolerance(self, theObject, theTolerance = 1e-07, theName=None):
7463 Try to limit tolerance of the given object by value theTolerance.
7466 theObject Shape to be processed.
7467 theTolerance Required tolerance value.
7468 theName Object name; when specified, this parameter is used
7469 for result publication in the study. Otherwise, if automatic
7470 publication is switched on, default value is used for result name.
7473 New GEOM.GEOM_Object, containing processed shape.
7475 anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
7476 RaiseIfFailed("LimitTolerance", self.HealOp)
7477 self._autoPublish(anObj, theName, "limitTolerance")
7480 ## Get a list of wires (wrapped in GEOM.GEOM_Object-s),
7481 # that constitute a free boundary of the given shape.
7482 # @param theObject Shape to get free boundary of.
7483 # @param theName Object name; when specified, this parameter is used
7484 # for result publication in the study. Otherwise, if automatic
7485 # publication is switched on, default value is used for result name.
7487 # @return [\a status, \a theClosedWires, \a theOpenWires]
7488 # \n \a status: FALSE, if an error(s) occurred during the method execution.
7489 # \n \a theClosedWires: Closed wires on the free boundary of the given shape.
7490 # \n \a theOpenWires: Open wires on the free boundary of the given shape.
7492 # @ref tui_free_boundaries_page "Example"
7493 @ManageTransactions("HealOp")
7494 def GetFreeBoundary(self, theObject, theName=None):
7496 Get a list of wires (wrapped in GEOM.GEOM_Object-s),
7497 that constitute a free boundary of the given shape.
7500 theObject Shape to get free boundary of.
7501 theName Object name; when specified, this parameter is used
7502 for result publication in the study. Otherwise, if automatic
7503 publication is switched on, default value is used for result name.
7506 [status, theClosedWires, theOpenWires]
7507 status: FALSE, if an error(s) occurred during the method execution.
7508 theClosedWires: Closed wires on the free boundary of the given shape.
7509 theOpenWires: Open wires on the free boundary of the given shape.
7511 # Example: see GEOM_TestHealing.py
7512 anObj = self.HealOp.GetFreeBoundary( ToList( theObject ))
7513 RaiseIfFailed("GetFreeBoundary", self.HealOp)
7514 self._autoPublish(anObj[1], theName, "closedWire")
7515 self._autoPublish(anObj[2], theName, "openWire")
7518 ## Replace coincident faces in \a theShapes by one face.
7519 # @param theShapes Initial shapes, either a list or compound of shapes.
7520 # @param theTolerance Maximum distance between faces, which can be considered as coincident.
7521 # @param doKeepNonSolids If FALSE, only solids will present in the result,
7522 # otherwise all initial shapes.
7523 # @param theName Object name; when specified, this parameter is used
7524 # for result publication in the study. Otherwise, if automatic
7525 # publication is switched on, default value is used for result name.
7527 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7529 # @ref tui_glue_faces "Example"
7530 @ManageTransactions("ShapesOp")
7531 def MakeGlueFaces(self, theShapes, theTolerance, doKeepNonSolids=True, theName=None):
7533 Replace coincident faces in theShapes by one face.
7536 theShapes Initial shapes, either a list or compound of shapes.
7537 theTolerance Maximum distance between faces, which can be considered as coincident.
7538 doKeepNonSolids If FALSE, only solids will present in the result,
7539 otherwise all initial shapes.
7540 theName Object name; when specified, this parameter is used
7541 for result publication in the study. Otherwise, if automatic
7542 publication is switched on, default value is used for result name.
7545 New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7547 # Example: see GEOM_Spanner.py
7548 theTolerance,Parameters = ParseParameters(theTolerance)
7549 anObj = self.ShapesOp.MakeGlueFaces(ToList(theShapes), theTolerance, doKeepNonSolids)
7551 raise RuntimeError("MakeGlueFaces : " + self.ShapesOp.GetErrorCode())
7552 anObj.SetParameters(Parameters)
7553 self._autoPublish(anObj, theName, "glueFaces")
7556 ## Find coincident faces in \a theShapes for possible gluing.
7557 # @param theShapes Initial shapes, either a list or compound of shapes.
7558 # @param theTolerance Maximum distance between faces,
7559 # which can be considered as coincident.
7560 # @param theName Object name; when specified, this parameter is used
7561 # for result publication in the study. Otherwise, if automatic
7562 # publication is switched on, default value is used for result name.
7564 # @return GEOM.ListOfGO
7566 # @ref tui_glue_faces "Example"
7567 @ManageTransactions("ShapesOp")
7568 def GetGlueFaces(self, theShapes, theTolerance, theName=None):
7570 Find coincident faces in theShapes for possible gluing.
7573 theShapes Initial shapes, either a list or compound of shapes.
7574 theTolerance Maximum distance between faces,
7575 which can be considered as coincident.
7576 theName Object name; when specified, this parameter is used
7577 for result publication in the study. Otherwise, if automatic
7578 publication is switched on, default value is used for result name.
7583 anObj = self.ShapesOp.GetGlueFaces(ToList(theShapes), theTolerance)
7584 RaiseIfFailed("GetGlueFaces", self.ShapesOp)
7585 self._autoPublish(anObj, theName, "facesToGlue")
7588 ## Replace coincident faces in \a theShapes by one face
7589 # in compliance with given list of faces
7590 # @param theShapes Initial shapes, either a list or compound of shapes.
7591 # @param theTolerance Maximum distance between faces,
7592 # which can be considered as coincident.
7593 # @param theFaces List of faces for gluing.
7594 # @param doKeepNonSolids If FALSE, only solids will present in the result,
7595 # otherwise all initial shapes.
7596 # @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
7597 # will be glued, otherwise only the edges,
7598 # belonging to <VAR>theFaces</VAR>.
7599 # @param theName Object name; when specified, this parameter is used
7600 # for result publication in the study. Otherwise, if automatic
7601 # publication is switched on, default value is used for result name.
7603 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7605 # @ref tui_glue_faces "Example"
7606 @ManageTransactions("ShapesOp")
7607 def MakeGlueFacesByList(self, theShapes, theTolerance, theFaces,
7608 doKeepNonSolids=True, doGlueAllEdges=True, theName=None):
7610 Replace coincident faces in theShapes by one face
7611 in compliance with given list of faces
7614 theShapes theShapes Initial shapes, either a list or compound of shapes.
7615 theTolerance Maximum distance between faces,
7616 which can be considered as coincident.
7617 theFaces List of faces for gluing.
7618 doKeepNonSolids If FALSE, only solids will present in the result,
7619 otherwise all initial shapes.
7620 doGlueAllEdges If TRUE, all coincident edges of theShape
7621 will be glued, otherwise only the edges,
7622 belonging to theFaces.
7623 theName Object name; when specified, this parameter is used
7624 for result publication in the study. Otherwise, if automatic
7625 publication is switched on, default value is used for result name.
7628 New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
7630 anObj = self.ShapesOp.MakeGlueFacesByList(ToList(theShapes), theTolerance, ToList(theFaces),
7631 doKeepNonSolids, doGlueAllEdges)
7633 raise RuntimeError("MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode())
7634 self._autoPublish(anObj, theName, "glueFaces")
7637 ## Replace coincident edges in \a theShapes by one edge.
7638 # @param theShapes Initial shapes, either a list or compound of shapes.
7639 # @param theTolerance Maximum distance between edges, which can be considered as coincident.
7640 # @param theName Object name; when specified, this parameter is used
7641 # for result publication in the study. Otherwise, if automatic
7642 # publication is switched on, default value is used for result name.
7644 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7646 # @ref tui_glue_edges "Example"
7647 @ManageTransactions("ShapesOp")
7648 def MakeGlueEdges(self, theShapes, theTolerance, theName=None):
7650 Replace coincident edges in theShapes by one edge.
7653 theShapes Initial shapes, either a list or compound of shapes.
7654 theTolerance Maximum distance between edges, which can be considered as coincident.
7655 theName Object name; when specified, this parameter is used
7656 for result publication in the study. Otherwise, if automatic
7657 publication is switched on, default value is used for result name.
7660 New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7662 theTolerance,Parameters = ParseParameters(theTolerance)
7663 anObj = self.ShapesOp.MakeGlueEdges(ToList(theShapes), theTolerance)
7665 raise RuntimeError("MakeGlueEdges : " + self.ShapesOp.GetErrorCode())
7666 anObj.SetParameters(Parameters)
7667 self._autoPublish(anObj, theName, "glueEdges")
7670 ## Find coincident edges in \a theShapes for possible gluing.
7671 # @param theShapes Initial shapes, either a list or compound of shapes.
7672 # @param theTolerance Maximum distance between edges,
7673 # which can be considered as coincident.
7674 # @param theName Object name; when specified, this parameter is used
7675 # for result publication in the study. Otherwise, if automatic
7676 # publication is switched on, default value is used for result name.
7678 # @return GEOM.ListOfGO
7680 # @ref tui_glue_edges "Example"
7681 @ManageTransactions("ShapesOp")
7682 def GetGlueEdges(self, theShapes, theTolerance, theName=None):
7684 Find coincident edges in theShapes for possible gluing.
7687 theShapes Initial shapes, either a list or compound of shapes.
7688 theTolerance Maximum distance between edges,
7689 which can be considered as coincident.
7690 theName Object name; when specified, this parameter is used
7691 for result publication in the study. Otherwise, if automatic
7692 publication is switched on, default value is used for result name.
7697 anObj = self.ShapesOp.GetGlueEdges(ToList(theShapes), theTolerance)
7698 RaiseIfFailed("GetGlueEdges", self.ShapesOp)
7699 self._autoPublish(anObj, theName, "edgesToGlue")
7702 ## Replace coincident edges in theShapes by one edge
7703 # in compliance with given list of edges.
7704 # @param theShapes Initial shapes, either a list or compound of shapes.
7705 # @param theTolerance Maximum distance between edges,
7706 # which can be considered as coincident.
7707 # @param theEdges List of edges for gluing.
7708 # @param theName Object name; when specified, this parameter is used
7709 # for result publication in the study. Otherwise, if automatic
7710 # publication is switched on, default value is used for result name.
7712 # @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7714 # @ref tui_glue_edges "Example"
7715 @ManageTransactions("ShapesOp")
7716 def MakeGlueEdgesByList(self, theShapes, theTolerance, theEdges, theName=None):
7718 Replace coincident edges in theShapes by one edge
7719 in compliance with given list of edges.
7722 theShapes Initial shapes, either a list or compound of shapes.
7723 theTolerance Maximum distance between edges,
7724 which can be considered as coincident.
7725 theEdges List of edges for gluing.
7726 theName Object name; when specified, this parameter is used
7727 for result publication in the study. Otherwise, if automatic
7728 publication is switched on, default value is used for result name.
7731 New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
7733 anObj = self.ShapesOp.MakeGlueEdgesByList(ToList(theShapes), theTolerance, theEdges)
7735 raise RuntimeError("MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode())
7736 self._autoPublish(anObj, theName, "glueEdges")
7742 ## @addtogroup l3_boolean Boolean Operations
7745 # -----------------------------------------------------------------------------
7746 # Boolean (Common, Cut, Fuse, Section)
7747 # -----------------------------------------------------------------------------
7749 ## Perform one of boolean operations on two given shapes.
7750 # @param theShape1 First argument for boolean operation.
7751 # @param theShape2 Second argument for boolean operation.
7752 # @param theOperation Indicates the operation to be done:\n
7753 # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
7754 # @param checkSelfInte The flag that tells if the arguments should
7755 # be checked for self-intersection prior to the operation.
7756 # @param theName Object name; when specified, this parameter is used
7757 # for result publication in the study. Otherwise, if automatic
7758 # publication is switched on, default value is used for result name.
7760 # @note This algorithm doesn't find all types of self-intersections.
7761 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7762 # vertex/face and edge/face intersections. Face/face
7763 # intersections detection is switched off as it is a
7764 # time-consuming operation that gives an impact on performance.
7765 # To find all self-intersections please use
7766 # CheckSelfIntersections() method.
7768 # @return New GEOM.GEOM_Object, containing the result shape.
7770 # @ref tui_fuse "Example"
7771 @ManageTransactions("BoolOp")
7772 def MakeBoolean(self, theShape1, theShape2, theOperation, checkSelfInte=False, theName=None):
7774 Perform one of boolean operations on two given shapes.
7777 theShape1 First argument for boolean operation.
7778 theShape2 Second argument for boolean operation.
7779 theOperation Indicates the operation to be done:
7780 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
7781 checkSelfInte The flag that tells if the arguments should
7782 be checked for self-intersection prior to
7784 theName Object name; when specified, this parameter is used
7785 for result publication in the study. Otherwise, if automatic
7786 publication is switched on, default value is used for result name.
7789 This algorithm doesn't find all types of self-intersections.
7790 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7791 vertex/face and edge/face intersections. Face/face
7792 intersections detection is switched off as it is a
7793 time-consuming operation that gives an impact on performance.
7794 To find all self-intersections please use
7795 CheckSelfIntersections() method.
7798 New GEOM.GEOM_Object, containing the result shape.
7800 # Example: see GEOM_TestAll.py
7801 anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation, checkSelfInte)
7802 RaiseIfFailed("MakeBoolean", self.BoolOp)
7803 def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" }
7804 self._autoPublish(anObj, theName, def_names[theOperation])
7807 ## Perform Common boolean operation on two given shapes.
7808 # @param theShape1 First argument for boolean operation.
7809 # @param theShape2 Second argument for boolean operation.
7810 # @param checkSelfInte The flag that tells if the arguments should
7811 # be checked for self-intersection prior to the operation.
7812 # @param theName Object name; when specified, this parameter is used
7813 # for result publication in the study. Otherwise, if automatic
7814 # publication is switched on, default value is used for result name.
7816 # @note This algorithm doesn't find all types of self-intersections.
7817 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7818 # vertex/face and edge/face intersections. Face/face
7819 # intersections detection is switched off as it is a
7820 # time-consuming operation that gives an impact on performance.
7821 # To find all self-intersections please use
7822 # CheckSelfIntersections() method.
7824 # @return New GEOM.GEOM_Object, containing the result shape.
7826 # @ref tui_common "Example 1"
7827 # \n @ref swig_MakeCommon "Example 2"
7828 def MakeCommon(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7830 Perform Common boolean operation on two given shapes.
7833 theShape1 First argument for boolean operation.
7834 theShape2 Second argument for boolean operation.
7835 checkSelfInte The flag that tells if the arguments should
7836 be checked for self-intersection prior to
7838 theName Object name; when specified, this parameter is used
7839 for result publication in the study. Otherwise, if automatic
7840 publication is switched on, default value is used for result name.
7843 This algorithm doesn't find all types of self-intersections.
7844 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7845 vertex/face and edge/face intersections. Face/face
7846 intersections detection is switched off as it is a
7847 time-consuming operation that gives an impact on performance.
7848 To find all self-intersections please use
7849 CheckSelfIntersections() method.
7852 New GEOM.GEOM_Object, containing the result shape.
7854 # Example: see GEOM_TestOthers.py
7855 # note: auto-publishing is done in self.MakeBoolean()
7856 return self.MakeBoolean(theShape1, theShape2, 1, checkSelfInte, theName)
7858 ## Perform Cut boolean operation on two given shapes.
7859 # @param theShape1 First argument for boolean operation.
7860 # @param theShape2 Second argument for boolean operation.
7861 # @param checkSelfInte The flag that tells if the arguments should
7862 # be checked for self-intersection prior to the operation.
7863 # @param theName Object name; when specified, this parameter is used
7864 # for result publication in the study. Otherwise, if automatic
7865 # publication is switched on, default value is used for result name.
7867 # @note This algorithm doesn't find all types of self-intersections.
7868 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7869 # vertex/face and edge/face intersections. Face/face
7870 # intersections detection is switched off as it is a
7871 # time-consuming operation that gives an impact on performance.
7872 # To find all self-intersections please use
7873 # CheckSelfIntersections() method.
7875 # @return New GEOM.GEOM_Object, containing the result shape.
7877 # @ref tui_cut "Example 1"
7878 # \n @ref swig_MakeCommon "Example 2"
7879 def MakeCut(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7881 Perform Cut boolean operation on two given shapes.
7884 theShape1 First argument for boolean operation.
7885 theShape2 Second argument for boolean operation.
7886 checkSelfInte The flag that tells if the arguments should
7887 be checked for self-intersection prior to
7889 theName Object name; when specified, this parameter is used
7890 for result publication in the study. Otherwise, if automatic
7891 publication is switched on, default value is used for result name.
7894 This algorithm doesn't find all types of self-intersections.
7895 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7896 vertex/face and edge/face intersections. Face/face
7897 intersections detection is switched off as it is a
7898 time-consuming operation that gives an impact on performance.
7899 To find all self-intersections please use
7900 CheckSelfIntersections() method.
7903 New GEOM.GEOM_Object, containing the result shape.
7906 # Example: see GEOM_TestOthers.py
7907 # note: auto-publishing is done in self.MakeBoolean()
7908 return self.MakeBoolean(theShape1, theShape2, 2, checkSelfInte, theName)
7910 ## Perform Fuse boolean operation on two given shapes.
7911 # @param theShape1 First argument for boolean operation.
7912 # @param theShape2 Second argument for boolean operation.
7913 # @param checkSelfInte The flag that tells if the arguments should
7914 # be checked for self-intersection prior to the operation.
7915 # @param rmExtraEdges The flag that tells if Remove Extra Edges
7916 # operation should be performed during the operation.
7917 # @param theName Object name; when specified, this parameter is used
7918 # for result publication in the study. Otherwise, if automatic
7919 # publication is switched on, default value is used for result name.
7921 # @note This algorithm doesn't find all types of self-intersections.
7922 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7923 # vertex/face and edge/face intersections. Face/face
7924 # intersections detection is switched off as it is a
7925 # time-consuming operation that gives an impact on performance.
7926 # To find all self-intersections please use
7927 # CheckSelfIntersections() method.
7929 # @return New GEOM.GEOM_Object, containing the result shape.
7931 # @ref tui_fuse "Example 1"
7932 # \n @ref swig_MakeCommon "Example 2"
7933 @ManageTransactions("BoolOp")
7934 def MakeFuse(self, theShape1, theShape2, checkSelfInte=False,
7935 rmExtraEdges=False, theName=None):
7937 Perform Fuse boolean operation on two given shapes.
7940 theShape1 First argument for boolean operation.
7941 theShape2 Second argument for boolean operation.
7942 checkSelfInte The flag that tells if the arguments should
7943 be checked for self-intersection prior to
7945 rmExtraEdges The flag that tells if Remove Extra Edges
7946 operation should be performed during the operation.
7947 theName Object name; when specified, this parameter is used
7948 for result publication in the study. Otherwise, if automatic
7949 publication is switched on, default value is used for result name.
7952 This algorithm doesn't find all types of self-intersections.
7953 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
7954 vertex/face and edge/face intersections. Face/face
7955 intersections detection is switched off as it is a
7956 time-consuming operation that gives an impact on performance.
7957 To find all self-intersections please use
7958 CheckSelfIntersections() method.
7961 New GEOM.GEOM_Object, containing the result shape.
7964 # Example: see GEOM_TestOthers.py
7965 anObj = self.BoolOp.MakeFuse(theShape1, theShape2,
7966 checkSelfInte, rmExtraEdges)
7967 RaiseIfFailed("MakeFuse", self.BoolOp)
7968 self._autoPublish(anObj, theName, "fuse")
7971 ## Perform Section boolean operation on two given shapes.
7972 # @param theShape1 First argument for boolean operation.
7973 # @param theShape2 Second argument for boolean operation.
7974 # @param checkSelfInte The flag that tells if the arguments should
7975 # be checked for self-intersection prior to the operation.
7976 # If a self-intersection detected the operation fails.
7977 # @param theName Object name; when specified, this parameter is used
7978 # for result publication in the study. Otherwise, if automatic
7979 # publication is switched on, default value is used for result name.
7980 # @return New GEOM.GEOM_Object, containing the result shape.
7982 # @ref tui_section "Example 1"
7983 # \n @ref swig_MakeCommon "Example 2"
7984 def MakeSection(self, theShape1, theShape2, checkSelfInte=False, theName=None):
7986 Perform Section boolean operation on two given shapes.
7989 theShape1 First argument for boolean operation.
7990 theShape2 Second argument for boolean operation.
7991 checkSelfInte The flag that tells if the arguments should
7992 be checked for self-intersection prior to the operation.
7993 If a self-intersection detected the operation fails.
7994 theName Object name; when specified, this parameter is used
7995 for result publication in the study. Otherwise, if automatic
7996 publication is switched on, default value is used for result name.
7998 New GEOM.GEOM_Object, containing the result shape.
8001 # Example: see GEOM_TestOthers.py
8002 # note: auto-publishing is done in self.MakeBoolean()
8003 return self.MakeBoolean(theShape1, theShape2, 4, checkSelfInte, theName)
8005 ## Perform Fuse boolean operation on the list of shapes.
8006 # @param theShapesList Shapes to be fused.
8007 # @param checkSelfInte The flag that tells if the arguments should
8008 # be checked for self-intersection prior to the operation.
8009 # @param rmExtraEdges The flag that tells if Remove Extra Edges
8010 # operation should be performed during the operation.
8011 # @param theName Object name; when specified, this parameter is used
8012 # for result publication in the study. Otherwise, if automatic
8013 # publication is switched on, default value is used for result name.
8015 # @note This algorithm doesn't find all types of self-intersections.
8016 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8017 # vertex/face and edge/face intersections. Face/face
8018 # intersections detection is switched off as it is a
8019 # time-consuming operation that gives an impact on performance.
8020 # To find all self-intersections please use
8021 # CheckSelfIntersections() method.
8023 # @return New GEOM.GEOM_Object, containing the result shape.
8025 # @ref tui_fuse "Example 1"
8026 # \n @ref swig_MakeCommon "Example 2"
8027 @ManageTransactions("BoolOp")
8028 def MakeFuseList(self, theShapesList, checkSelfInte=False,
8029 rmExtraEdges=False, theName=None):
8031 Perform Fuse boolean operation on the list of shapes.
8034 theShapesList Shapes to be fused.
8035 checkSelfInte The flag that tells if the arguments should
8036 be checked for self-intersection prior to
8038 rmExtraEdges The flag that tells if Remove Extra Edges
8039 operation should be performed during the operation.
8040 theName Object name; when specified, this parameter is used
8041 for result publication in the study. Otherwise, if automatic
8042 publication is switched on, default value is used for result name.
8045 This algorithm doesn't find all types of self-intersections.
8046 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8047 vertex/face and edge/face intersections. Face/face
8048 intersections detection is switched off as it is a
8049 time-consuming operation that gives an impact on performance.
8050 To find all self-intersections please use
8051 CheckSelfIntersections() method.
8054 New GEOM.GEOM_Object, containing the result shape.
8057 # Example: see GEOM_TestOthers.py
8058 anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte,
8060 RaiseIfFailed("MakeFuseList", self.BoolOp)
8061 self._autoPublish(anObj, theName, "fuse")
8064 ## Perform Common boolean operation on the list of shapes.
8065 # @param theShapesList Shapes for Common operation.
8066 # @param checkSelfInte The flag that tells if the arguments should
8067 # be checked for self-intersection prior to the operation.
8068 # @param theName Object name; when specified, this parameter is used
8069 # for result publication in the study. Otherwise, if automatic
8070 # publication is switched on, default value is used for result name.
8072 # @note This algorithm doesn't find all types of self-intersections.
8073 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8074 # vertex/face and edge/face intersections. Face/face
8075 # intersections detection is switched off as it is a
8076 # time-consuming operation that gives an impact on performance.
8077 # To find all self-intersections please use
8078 # CheckSelfIntersections() method.
8080 # @return New GEOM.GEOM_Object, containing the result shape.
8082 # @ref tui_common "Example 1"
8083 # \n @ref swig_MakeCommon "Example 2"
8084 @ManageTransactions("BoolOp")
8085 def MakeCommonList(self, theShapesList, checkSelfInte=False, theName=None):
8087 Perform Common boolean operation on the list of shapes.
8090 theShapesList Shapes for Common operation.
8091 checkSelfInte The flag that tells if the arguments should
8092 be checked for self-intersection prior to
8094 theName Object name; when specified, this parameter is used
8095 for result publication in the study. Otherwise, if automatic
8096 publication is switched on, default value is used for result name.
8099 This algorithm doesn't find all types of self-intersections.
8100 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8101 vertex/face and edge/face intersections. Face/face
8102 intersections detection is switched off as it is a
8103 time-consuming operation that gives an impact on performance.
8104 To find all self-intersections please use
8105 CheckSelfIntersections() method.
8108 New GEOM.GEOM_Object, containing the result shape.
8111 # Example: see GEOM_TestOthers.py
8112 anObj = self.BoolOp.MakeCommonList(theShapesList, checkSelfInte)
8113 RaiseIfFailed("MakeCommonList", self.BoolOp)
8114 self._autoPublish(anObj, theName, "common")
8117 ## Perform Cut boolean operation on one object and the list of tools.
8118 # @param theMainShape The object of the operation.
8119 # @param theShapesList The list of tools of the operation.
8120 # @param checkSelfInte The flag that tells if the arguments should
8121 # be checked for self-intersection prior to the operation.
8122 # @param theName Object name; when specified, this parameter is used
8123 # for result publication in the study. Otherwise, if automatic
8124 # publication is switched on, default value is used for result name.
8126 # @note This algorithm doesn't find all types of self-intersections.
8127 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8128 # vertex/face and edge/face intersections. Face/face
8129 # intersections detection is switched off as it is a
8130 # time-consuming operation that gives an impact on performance.
8131 # To find all self-intersections please use
8132 # CheckSelfIntersections() method.
8134 # @return New GEOM.GEOM_Object, containing the result shape.
8136 # @ref tui_cut "Example 1"
8137 # \n @ref swig_MakeCommon "Example 2"
8138 @ManageTransactions("BoolOp")
8139 def MakeCutList(self, theMainShape, theShapesList, checkSelfInte=False, theName=None):
8141 Perform Cut boolean operation on one object and the list of tools.
8144 theMainShape The object of the operation.
8145 theShapesList The list of tools of the operation.
8146 checkSelfInte The flag that tells if the arguments should
8147 be checked for self-intersection prior to
8149 theName Object name; when specified, this parameter is used
8150 for result publication in the study. Otherwise, if automatic
8151 publication is switched on, default value is used for result name.
8154 This algorithm doesn't find all types of self-intersections.
8155 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8156 vertex/face and edge/face intersections. Face/face
8157 intersections detection is switched off as it is a
8158 time-consuming operation that gives an impact on performance.
8159 To find all self-intersections please use
8160 CheckSelfIntersections() method.
8163 New GEOM.GEOM_Object, containing the result shape.
8166 # Example: see GEOM_TestOthers.py
8167 anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList, checkSelfInte)
8168 RaiseIfFailed("MakeCutList", self.BoolOp)
8169 self._autoPublish(anObj, theName, "cut")
8175 ## @addtogroup l3_basic_op
8178 ## Perform partition operation.
8179 # @param ListShapes Shapes to be intersected.
8180 # @param ListTools Shapes to intersect theShapes.
8181 # @param Limit Type of resulting shapes (see ShapeType()).\n
8182 # If this parameter is set to -1 ("Auto"), most appropriate shape limit
8183 # type will be detected automatically.
8184 # @param KeepNonlimitShapes if this parameter == 0, then only shapes of
8185 # target type (equal to Limit) are kept in the result,
8186 # else standalone shapes of lower dimension
8187 # are kept also (if they exist).
8189 # @param theName Object name; when specified, this parameter is used
8190 # for result publication in the study. Otherwise, if automatic
8191 # publication is switched on, default value is used for result name.
8193 # @note Each compound from ListShapes and ListTools will be exploded
8194 # in order to avoid possible intersection between shapes from this compound.
8196 # After implementation new version of PartitionAlgo (October 2006)
8197 # other parameters are ignored by current functionality. They are kept
8198 # in this function only for support old versions.
8199 # @param ListKeepInside Shapes, outside which the results will be deleted.
8200 # Each shape from theKeepInside must belong to theShapes also.
8201 # @param ListRemoveInside Shapes, inside which the results will be deleted.
8202 # Each shape from theRemoveInside must belong to theShapes also.
8203 # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
8204 # @param ListMaterials Material indices for each shape. Make sense,
8205 # only if theRemoveWebs is TRUE.
8207 # @return New GEOM.GEOM_Object, containing the result shapes.
8209 # @ref tui_partition "Example"
8210 @ManageTransactions("BoolOp")
8211 def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
8212 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
8213 KeepNonlimitShapes=0, theName=None):
8215 Perform partition operation.
8218 ListShapes Shapes to be intersected.
8219 ListTools Shapes to intersect theShapes.
8220 Limit Type of resulting shapes (see geompy.ShapeType)
8221 If this parameter is set to -1 ("Auto"), most appropriate shape limit
8222 type will be detected automatically.
8223 KeepNonlimitShapes if this parameter == 0, then only shapes of
8224 target type (equal to Limit) are kept in the result,
8225 else standalone shapes of lower dimension
8226 are kept also (if they exist).
8228 theName Object name; when specified, this parameter is used
8229 for result publication in the study. Otherwise, if automatic
8230 publication is switched on, default value is used for result name.
8232 Each compound from ListShapes and ListTools will be exploded
8233 in order to avoid possible intersection between shapes from
8236 After implementation new version of PartitionAlgo (October 2006) other
8237 parameters are ignored by current functionality. They are kept in this
8238 function only for support old versions.
8241 ListKeepInside Shapes, outside which the results will be deleted.
8242 Each shape from theKeepInside must belong to theShapes also.
8243 ListRemoveInside Shapes, inside which the results will be deleted.
8244 Each shape from theRemoveInside must belong to theShapes also.
8245 RemoveWebs If TRUE, perform Glue 3D algorithm.
8246 ListMaterials Material indices for each shape. Make sense, only if theRemoveWebs is TRUE.
8249 New GEOM.GEOM_Object, containing the result shapes.
8251 # Example: see GEOM_TestAll.py
8252 if Limit == self.ShapeType["AUTO"]:
8253 # automatic detection of the most appropriate shape limit type
8255 for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
8256 Limit = EnumToLong(lim)
8258 anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
8259 ListKeepInside, ListRemoveInside,
8260 Limit, RemoveWebs, ListMaterials,
8261 KeepNonlimitShapes);
8262 RaiseIfFailed("MakePartition", self.BoolOp)
8263 self._autoPublish(anObj, theName, "partition")
8266 ## Perform partition operation.
8267 # This method may be useful if it is needed to make a partition for
8268 # compound contains nonintersected shapes. Performance will be better
8269 # since intersection between shapes from compound is not performed.
8271 # Description of all parameters as in previous method MakePartition().
8272 # One additional parameter is provided:
8273 # @param checkSelfInte The flag that tells if the arguments should
8274 # be checked for self-intersection prior to the operation.
8276 # @note This algorithm doesn't find all types of self-intersections.
8277 # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8278 # vertex/face and edge/face intersections. Face/face
8279 # intersections detection is switched off as it is a
8280 # time-consuming operation that gives an impact on performance.
8281 # To find all self-intersections please use
8282 # CheckSelfIntersections() method.
8284 # @note Passed compounds (via ListShapes or via ListTools)
8285 # have to consist of nonintersecting shapes.
8287 # @return New GEOM.GEOM_Object, containing the result shapes.
8289 # @ref swig_todo "Example"
8290 @ManageTransactions("BoolOp")
8291 def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
8292 ListKeepInside=[], ListRemoveInside=[],
8293 Limit=ShapeType["AUTO"], RemoveWebs=0,
8294 ListMaterials=[], KeepNonlimitShapes=0,
8295 checkSelfInte=False, theName=None):
8297 Perform partition operation.
8298 This method may be useful if it is needed to make a partition for
8299 compound contains nonintersected shapes. Performance will be better
8300 since intersection between shapes from compound is not performed.
8303 Description of all parameters as in method geompy.MakePartition.
8304 One additional parameter is provided:
8305 checkSelfInte The flag that tells if the arguments should
8306 be checked for self-intersection prior to
8310 This algorithm doesn't find all types of self-intersections.
8311 It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
8312 vertex/face and edge/face intersections. Face/face
8313 intersections detection is switched off as it is a
8314 time-consuming operation that gives an impact on performance.
8315 To find all self-intersections please use
8316 CheckSelfIntersections() method.
8319 Passed compounds (via ListShapes or via ListTools)
8320 have to consist of nonintersecting shapes.
8323 New GEOM.GEOM_Object, containing the result shapes.
8325 if Limit == self.ShapeType["AUTO"]:
8326 # automatic detection of the most appropriate shape limit type
8328 for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
8329 Limit = EnumToLong(lim)
8331 anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
8332 ListKeepInside, ListRemoveInside,
8333 Limit, RemoveWebs, ListMaterials,
8334 KeepNonlimitShapes, checkSelfInte);
8335 RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
8336 self._autoPublish(anObj, theName, "partition")
8339 ## See method MakePartition() for more information.
8341 # @ref tui_partition "Example 1"
8342 # \n @ref swig_Partition "Example 2"
8343 def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
8344 Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
8345 KeepNonlimitShapes=0, theName=None):
8347 See method geompy.MakePartition for more information.
8349 # Example: see GEOM_TestOthers.py
8350 # note: auto-publishing is done in self.MakePartition()
8351 anObj = self.MakePartition(ListShapes, ListTools,
8352 ListKeepInside, ListRemoveInside,
8353 Limit, RemoveWebs, ListMaterials,
8354 KeepNonlimitShapes, theName);
8357 ## Perform partition of the Shape with the Plane
8358 # @param theShape Shape to be intersected.
8359 # @param thePlane Tool shape, to intersect theShape.
8360 # @param theName Object name; when specified, this parameter is used
8361 # for result publication in the study. Otherwise, if automatic
8362 # publication is switched on, default value is used for result name.
8364 # @return New GEOM.GEOM_Object, containing the result shape.
8366 # @note This operation is a shortcut to the more general @ref MakePartition
8367 # operation, where @a theShape specifies single "object" (shape being partitioned)
8368 # and @a thePlane specifies single "tool" (intersector shape). Other parameters of
8369 # @ref MakePartition operation have default values:
8370 # - @a Limit: GEOM::SHAPE (shape limit corresponds to the type of @a theShape)
8371 # - @a KeepNonlimitShapes: 0
8372 # - @a KeepInside, @a RemoveInside, @a RemoveWebs,
8373 # @a Materials (obsolete parameters): empty
8375 # @note I.e. the following two operations are equivalent:
8377 # Result = geompy.MakeHalfPartition(Object, Plane)
8378 # Result = geompy.MakePartition([Object], [Plane])
8381 # @sa MakePartition, MakePartitionNonSelfIntersectedShape
8383 # @ref tui_partition "Example"
8384 @ManageTransactions("BoolOp")
8385 def MakeHalfPartition(self, theShape, thePlane, theName=None):
8387 Perform partition of the Shape with the Plane
8390 theShape Shape to be intersected.
8391 thePlane Tool shape, to intersect theShape.
8392 theName Object name; when specified, this parameter is used
8393 for result publication in the study. Otherwise, if automatic
8394 publication is switched on, default value is used for result name.
8397 New GEOM.GEOM_Object, containing the result shape.
8399 Note: This operation is a shortcut to the more general MakePartition
8400 operation, where theShape specifies single "object" (shape being partitioned)
8401 and thePlane specifies single "tool" (intersector shape). Other parameters of
8402 MakePartition operation have default values:
8403 - Limit: GEOM::SHAPE (shape limit corresponds to the type of theShape)
8404 - KeepNonlimitShapes: 0
8405 - KeepInside, RemoveInside, RemoveWebs, Materials (obsolete parameters): empty
8407 I.e. the following two operations are equivalent:
8408 Result = geompy.MakeHalfPartition(Object, Plane)
8409 Result = geompy.MakePartition([Object], [Plane])
8411 # Example: see GEOM_TestAll.py
8412 anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
8413 RaiseIfFailed("MakeHalfPartition", self.BoolOp)
8414 self._autoPublish(anObj, theName, "partition")
8417 # end of l3_basic_op
8420 ## @addtogroup l3_transform
8423 ## Translate the given object along the vector, specified
8424 # by its end points.
8425 # @param theObject The object to be translated.
8426 # @param thePoint1 Start point of translation vector.
8427 # @param thePoint2 End point of translation vector.
8428 # @param theCopy Flag used to translate object itself or create a copy.
8429 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8430 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8431 @ManageTransactions("TrsfOp")
8432 def TranslateTwoPoints(self, theObject, thePoint1, thePoint2, theCopy=False):
8434 Translate the given object along the vector, specified by its end points.
8437 theObject The object to be translated.
8438 thePoint1 Start point of translation vector.
8439 thePoint2 End point of translation vector.
8440 theCopy Flag used to translate object itself or create a copy.
8443 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8444 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8447 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
8449 anObj = self.TrsfOp.TranslateTwoPoints(theObject, thePoint1, thePoint2)
8450 RaiseIfFailed("TranslateTwoPoints", self.TrsfOp)
8453 ## Translate the given object along the vector, specified
8454 # by its end points, creating its copy before the translation.
8455 # @param theObject The object to be translated.
8456 # @param thePoint1 Start point of translation vector.
8457 # @param thePoint2 End point of translation vector.
8458 # @param theName Object name; when specified, this parameter is used
8459 # for result publication in the study. Otherwise, if automatic
8460 # publication is switched on, default value is used for result name.
8462 # @return New GEOM.GEOM_Object, containing the translated object.
8464 # @ref tui_translation "Example 1"
8465 # \n @ref swig_MakeTranslationTwoPoints "Example 2"
8466 @ManageTransactions("TrsfOp")
8467 def MakeTranslationTwoPoints(self, theObject, thePoint1, thePoint2, theName=None):
8469 Translate the given object along the vector, specified
8470 by its end points, creating its copy before the translation.
8473 theObject The object to be translated.
8474 thePoint1 Start point of translation vector.
8475 thePoint2 End point of translation vector.
8476 theName Object name; when specified, this parameter is used
8477 for result publication in the study. Otherwise, if automatic
8478 publication is switched on, default value is used for result name.
8481 New GEOM.GEOM_Object, containing the translated object.
8483 # Example: see GEOM_TestAll.py
8484 anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
8485 RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
8486 self._autoPublish(anObj, theName, "translated")
8489 ## Translate the given object along the vector, specified by its components.
8490 # @param theObject The object to be translated.
8491 # @param theDX,theDY,theDZ Components of translation vector.
8492 # @param theCopy Flag used to translate object itself or create a copy.
8493 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8494 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8496 # @ref tui_translation "Example"
8497 @ManageTransactions("TrsfOp")
8498 def TranslateDXDYDZ(self, theObject, theDX, theDY, theDZ, theCopy=False):
8500 Translate the given object along the vector, specified by its components.
8503 theObject The object to be translated.
8504 theDX,theDY,theDZ Components of translation vector.
8505 theCopy Flag used to translate object itself or create a copy.
8508 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8509 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8511 # Example: see GEOM_TestAll.py
8512 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
8514 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
8516 anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
8517 anObj.SetParameters(Parameters)
8518 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
8521 ## Translate the given object along the vector, specified
8522 # by its components, creating its copy before the translation.
8523 # @param theObject The object to be translated.
8524 # @param theDX,theDY,theDZ Components of translation vector.
8525 # @param theName Object name; when specified, this parameter is used
8526 # for result publication in the study. Otherwise, if automatic
8527 # publication is switched on, default value is used for result name.
8529 # @return New GEOM.GEOM_Object, containing the translated object.
8531 # @ref tui_translation "Example"
8532 @ManageTransactions("TrsfOp")
8533 def MakeTranslation(self,theObject, theDX, theDY, theDZ, theName=None):
8535 Translate the given object along the vector, specified
8536 by its components, creating its copy before the translation.
8539 theObject The object to be translated.
8540 theDX,theDY,theDZ Components of translation vector.
8541 theName Object name; when specified, this parameter is used
8542 for result publication in the study. Otherwise, if automatic
8543 publication is switched on, default value is used for result name.
8546 New GEOM.GEOM_Object, containing the translated object.
8548 # Example: see GEOM_TestAll.py
8549 theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
8550 anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
8551 anObj.SetParameters(Parameters)
8552 RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
8553 self._autoPublish(anObj, theName, "translated")
8556 ## Translate the given object along the given vector.
8557 # @param theObject The object to be translated.
8558 # @param theVector The translation vector.
8559 # @param theCopy Flag used to translate object itself or create a copy.
8560 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8561 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8562 @ManageTransactions("TrsfOp")
8563 def TranslateVector(self, theObject, theVector, theCopy=False):
8565 Translate the given object along the given vector.
8568 theObject The object to be translated.
8569 theVector The translation vector.
8570 theCopy Flag used to translate object itself or create a copy.
8573 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8574 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8577 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
8579 anObj = self.TrsfOp.TranslateVector(theObject, theVector)
8580 RaiseIfFailed("TranslateVector", self.TrsfOp)
8583 ## Translate the given object along the given vector,
8584 # creating its copy before the translation.
8585 # @param theObject The object to be translated.
8586 # @param theVector The translation vector.
8587 # @param theName Object name; when specified, this parameter is used
8588 # for result publication in the study. Otherwise, if automatic
8589 # publication is switched on, default value is used for result name.
8591 # @return New GEOM.GEOM_Object, containing the translated object.
8593 # @ref tui_translation "Example"
8594 @ManageTransactions("TrsfOp")
8595 def MakeTranslationVector(self, theObject, theVector, theName=None):
8597 Translate the given object along the given vector,
8598 creating its copy before the translation.
8601 theObject The object to be translated.
8602 theVector The translation vector.
8603 theName Object name; when specified, this parameter is used
8604 for result publication in the study. Otherwise, if automatic
8605 publication is switched on, default value is used for result name.
8608 New GEOM.GEOM_Object, containing the translated object.
8610 # Example: see GEOM_TestAll.py
8611 anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
8612 RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
8613 self._autoPublish(anObj, theName, "translated")
8616 ## Translate the given object along the given vector on given distance.
8617 # @param theObject The object to be translated.
8618 # @param theVector The translation vector.
8619 # @param theDistance The translation distance.
8620 # @param theCopy Flag used to translate object itself or create a copy.
8621 # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8622 # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
8624 # @ref tui_translation "Example"
8625 @ManageTransactions("TrsfOp")
8626 def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy=False):
8628 Translate the given object along the given vector on given distance.
8631 theObject The object to be translated.
8632 theVector The translation vector.
8633 theDistance The translation distance.
8634 theCopy Flag used to translate object itself or create a copy.
8637 Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8638 new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
8640 # Example: see GEOM_TestAll.py
8641 theDistance,Parameters = ParseParameters(theDistance)
8642 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
8643 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
8644 anObj.SetParameters(Parameters)
8647 ## Translate the given object along the given vector on given distance,
8648 # creating its copy before the translation.
8649 # @param theObject The object to be translated.
8650 # @param theVector The translation vector.
8651 # @param theDistance The translation distance.
8652 # @param theName Object name; when specified, this parameter is used
8653 # for result publication in the study. Otherwise, if automatic
8654 # publication is switched on, default value is used for result name.
8656 # @return New GEOM.GEOM_Object, containing the translated object.
8658 # @ref tui_translation "Example"
8659 @ManageTransactions("TrsfOp")
8660 def MakeTranslationVectorDistance(self, theObject, theVector, theDistance, theName=None):
8662 Translate the given object along the given vector on given distance,
8663 creating its copy before the translation.
8666 theObject The object to be translated.
8667 theVector The translation vector.
8668 theDistance The translation distance.
8669 theName Object name; when specified, this parameter is used
8670 for result publication in the study. Otherwise, if automatic
8671 publication is switched on, default value is used for result name.
8674 New GEOM.GEOM_Object, containing the translated object.
8676 # Example: see GEOM_TestAll.py
8677 theDistance,Parameters = ParseParameters(theDistance)
8678 anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
8679 RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
8680 anObj.SetParameters(Parameters)
8681 self._autoPublish(anObj, theName, "translated")
8684 ## Rotate the given object around the given axis on the given angle.
8685 # @param theObject The object to be rotated.
8686 # @param theAxis Rotation axis.
8687 # @param theAngle Rotation angle in radians.
8688 # @param theCopy Flag used to rotate object itself or create a copy.
8690 # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8691 # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
8693 # @ref tui_rotation "Example"
8694 @ManageTransactions("TrsfOp")
8695 def Rotate(self, theObject, theAxis, theAngle, theCopy=False):
8697 Rotate the given object around the given axis on the given angle.
8700 theObject The object to be rotated.
8701 theAxis Rotation axis.
8702 theAngle Rotation angle in radians.
8703 theCopy Flag used to rotate object itself or create a copy.
8706 Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8707 new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
8709 # Example: see GEOM_TestAll.py
8711 if isinstance(theAngle,str):
8713 theAngle, Parameters = ParseParameters(theAngle)
8715 theAngle = theAngle*math.pi/180.0
8717 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
8719 anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
8720 RaiseIfFailed("Rotate", self.TrsfOp)
8721 anObj.SetParameters(Parameters)
8724 ## Rotate the given object around the given axis
8725 # on the given angle, creating its copy before the rotation.
8726 # @param theObject The object to be rotated.
8727 # @param theAxis Rotation axis.
8728 # @param theAngle Rotation angle in radians.
8729 # @param theName Object name; when specified, this parameter is used
8730 # for result publication in the study. Otherwise, if automatic
8731 # publication is switched on, default value is used for result name.
8733 # @return New GEOM.GEOM_Object, containing the rotated object.
8735 # @ref tui_rotation "Example"
8736 @ManageTransactions("TrsfOp")
8737 def MakeRotation(self, theObject, theAxis, theAngle, theName=None):
8739 Rotate the given object around the given axis
8740 on the given angle, creating its copy before the rotatation.
8743 theObject The object to be rotated.
8744 theAxis Rotation axis.
8745 theAngle Rotation angle in radians.
8746 theName Object name; when specified, this parameter is used
8747 for result publication in the study. Otherwise, if automatic
8748 publication is switched on, default value is used for result name.
8751 New GEOM.GEOM_Object, containing the rotated object.
8753 # Example: see GEOM_TestAll.py
8755 if isinstance(theAngle,str):
8757 theAngle, Parameters = ParseParameters(theAngle)
8759 theAngle = theAngle*math.pi/180.0
8760 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
8761 RaiseIfFailed("RotateCopy", self.TrsfOp)
8762 anObj.SetParameters(Parameters)
8763 self._autoPublish(anObj, theName, "rotated")
8766 ## Rotate given object around vector perpendicular to plane
8767 # containing three points.
8768 # @param theObject The object to be rotated.
8769 # @param theCentPoint central point the axis is the vector perpendicular to the plane
8770 # containing the three points.
8771 # @param thePoint1,thePoint2 points in a perpendicular plane of the axis.
8772 # @param theCopy Flag used to rotate object itself or create a copy.
8773 # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8774 # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
8775 @ManageTransactions("TrsfOp")
8776 def RotateThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theCopy=False):
8778 Rotate given object around vector perpendicular to plane
8779 containing three points.
8782 theObject The object to be rotated.
8783 theCentPoint central point the axis is the vector perpendicular to the plane
8784 containing the three points.
8785 thePoint1,thePoint2 points in a perpendicular plane of the axis.
8786 theCopy Flag used to rotate object itself or create a copy.
8789 Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8790 new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
8793 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
8795 anObj = self.TrsfOp.RotateThreePoints(theObject, theCentPoint, thePoint1, thePoint2)
8796 RaiseIfFailed("RotateThreePoints", self.TrsfOp)
8799 ## Rotate given object around vector perpendicular to plane
8800 # containing three points, creating its copy before the rotatation.
8801 # @param theObject The object to be rotated.
8802 # @param theCentPoint central point the axis is the vector perpendicular to the plane
8803 # containing the three points.
8804 # @param thePoint1,thePoint2 in a perpendicular plane of the axis.
8805 # @param theName Object name; when specified, this parameter is used
8806 # for result publication in the study. Otherwise, if automatic
8807 # publication is switched on, default value is used for result name.
8809 # @return New GEOM.GEOM_Object, containing the rotated object.
8811 # @ref tui_rotation "Example"
8812 @ManageTransactions("TrsfOp")
8813 def MakeRotationThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theName=None):
8815 Rotate given object around vector perpendicular to plane
8816 containing three points, creating its copy before the rotatation.
8819 theObject The object to be rotated.
8820 theCentPoint central point the axis is the vector perpendicular to the plane
8821 containing the three points.
8822 thePoint1,thePoint2 in a perpendicular plane of the axis.
8823 theName Object name; when specified, this parameter is used
8824 for result publication in the study. Otherwise, if automatic
8825 publication is switched on, default value is used for result name.
8828 New GEOM.GEOM_Object, containing the rotated object.
8830 # Example: see GEOM_TestAll.py
8831 anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
8832 RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
8833 self._autoPublish(anObj, theName, "rotated")
8836 ## Scale the given object by the specified factor.
8837 # @param theObject The object to be scaled.
8838 # @param thePoint Center point for scaling.
8839 # Passing None for it means scaling relatively the origin of global CS.
8840 # @param theFactor Scaling factor value.
8841 # @param theCopy Flag used to scale object itself or create a copy.
8842 # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8843 # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
8844 @ManageTransactions("TrsfOp")
8845 def Scale(self, theObject, thePoint, theFactor, theCopy=False):
8847 Scale the given object by the specified factor.
8850 theObject The object to be scaled.
8851 thePoint Center point for scaling.
8852 Passing None for it means scaling relatively the origin of global CS.
8853 theFactor Scaling factor value.
8854 theCopy Flag used to scale object itself or create a copy.
8857 Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8858 new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
8860 # Example: see GEOM_TestAll.py
8861 theFactor, Parameters = ParseParameters(theFactor)
8863 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
8865 anObj = self.TrsfOp.ScaleShape(theObject, thePoint, theFactor)
8866 RaiseIfFailed("Scale", self.TrsfOp)
8867 anObj.SetParameters(Parameters)
8870 ## Scale the given object by the factor, creating its copy before the scaling.
8871 # @param theObject The object to be scaled.
8872 # @param thePoint Center point for scaling.
8873 # Passing None for it means scaling relatively the origin of global CS.
8874 # @param theFactor Scaling factor value.
8875 # @param theName Object name; when specified, this parameter is used
8876 # for result publication in the study. Otherwise, if automatic
8877 # publication is switched on, default value is used for result name.
8879 # @return New GEOM.GEOM_Object, containing the scaled shape.
8881 # @ref tui_scale "Example"
8882 @ManageTransactions("TrsfOp")
8883 def MakeScaleTransform(self, theObject, thePoint, theFactor, theName=None):
8885 Scale the given object by the factor, creating its copy before the scaling.
8888 theObject The object to be scaled.
8889 thePoint Center point for scaling.
8890 Passing None for it means scaling relatively the origin of global CS.
8891 theFactor Scaling factor value.
8892 theName Object name; when specified, this parameter is used
8893 for result publication in the study. Otherwise, if automatic
8894 publication is switched on, default value is used for result name.
8897 New GEOM.GEOM_Object, containing the scaled shape.
8899 # Example: see GEOM_TestAll.py
8900 theFactor, Parameters = ParseParameters(theFactor)
8901 anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
8902 RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
8903 anObj.SetParameters(Parameters)
8904 self._autoPublish(anObj, theName, "scaled")
8907 ## Scale the given object by different factors along coordinate axes.
8908 # @param theObject The object to be scaled.
8909 # @param thePoint Center point for scaling.
8910 # Passing None for it means scaling relatively the origin of global CS.
8911 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8912 # @param theCopy Flag used to scale object itself or create a copy.
8913 # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8914 # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
8915 @ManageTransactions("TrsfOp")
8916 def ScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theCopy=False):
8918 Scale the given object by different factors along coordinate axes.
8921 theObject The object to be scaled.
8922 thePoint Center point for scaling.
8923 Passing None for it means scaling relatively the origin of global CS.
8924 theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8925 theCopy Flag used to scale object itself or create a copy.
8928 Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
8929 new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
8931 # Example: see GEOM_TestAll.py
8932 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
8934 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
8935 theFactorX, theFactorY, theFactorZ)
8937 anObj = self.TrsfOp.ScaleShapeAlongAxes(theObject, thePoint,
8938 theFactorX, theFactorY, theFactorZ)
8939 RaiseIfFailed("ScaleAlongAxes", self.TrsfOp)
8940 anObj.SetParameters(Parameters)
8943 ## Scale the given object by different factors along coordinate axes,
8944 # creating its copy before the scaling.
8945 # @param theObject The object to be scaled.
8946 # @param thePoint Center point for scaling.
8947 # Passing None for it means scaling relatively the origin of global CS.
8948 # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8949 # @param theName Object name; when specified, this parameter is used
8950 # for result publication in the study. Otherwise, if automatic
8951 # publication is switched on, default value is used for result name.
8953 # @return New GEOM.GEOM_Object, containing the scaled shape.
8955 # @ref swig_scale "Example"
8956 @ManageTransactions("TrsfOp")
8957 def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theName=None):
8959 Scale the given object by different factors along coordinate axes,
8960 creating its copy before the scaling.
8963 theObject The object to be scaled.
8964 thePoint Center point for scaling.
8965 Passing None for it means scaling relatively the origin of global CS.
8966 theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
8967 theName Object name; when specified, this parameter is used
8968 for result publication in the study. Otherwise, if automatic
8969 publication is switched on, default value is used for result name.
8972 New GEOM.GEOM_Object, containing the scaled shape.
8974 # Example: see GEOM_TestAll.py
8975 theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
8976 anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
8977 theFactorX, theFactorY, theFactorZ)
8978 RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
8979 anObj.SetParameters(Parameters)
8980 self._autoPublish(anObj, theName, "scaled")
8983 ## Mirror an object relatively the given plane.
8984 # @param theObject The object to be mirrored.
8985 # @param thePlane Plane of symmetry.
8986 # @param theCopy Flag used to mirror object itself or create a copy.
8987 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
8988 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
8989 @ManageTransactions("TrsfOp")
8990 def MirrorByPlane(self, theObject, thePlane, theCopy=False):
8992 Mirror an object relatively the given plane.
8995 theObject The object to be mirrored.
8996 thePlane Plane of symmetry.
8997 theCopy Flag used to mirror object itself or create a copy.
9000 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9001 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9004 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
9006 anObj = self.TrsfOp.MirrorPlane(theObject, thePlane)
9007 RaiseIfFailed("MirrorByPlane", self.TrsfOp)
9010 ## Create an object, symmetrical
9011 # to the given one relatively the given plane.
9012 # @param theObject The object to be mirrored.
9013 # @param thePlane Plane of symmetry.
9014 # @param theName Object name; when specified, this parameter is used
9015 # for result publication in the study. Otherwise, if automatic
9016 # publication is switched on, default value is used for result name.
9018 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9020 # @ref tui_mirror "Example"
9021 @ManageTransactions("TrsfOp")
9022 def MakeMirrorByPlane(self, theObject, thePlane, theName=None):
9024 Create an object, symmetrical to the given one relatively the given plane.
9027 theObject The object to be mirrored.
9028 thePlane Plane of symmetry.
9029 theName Object name; when specified, this parameter is used
9030 for result publication in the study. Otherwise, if automatic
9031 publication is switched on, default value is used for result name.
9034 New GEOM.GEOM_Object, containing the mirrored shape.
9036 # Example: see GEOM_TestAll.py
9037 anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
9038 RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
9039 self._autoPublish(anObj, theName, "mirrored")
9042 ## Mirror an object relatively the given axis.
9043 # @param theObject The object to be mirrored.
9044 # @param theAxis Axis of symmetry.
9045 # @param theCopy Flag used to mirror object itself or create a copy.
9046 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9047 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
9048 @ManageTransactions("TrsfOp")
9049 def MirrorByAxis(self, theObject, theAxis, theCopy=False):
9051 Mirror an object relatively the given axis.
9054 theObject The object to be mirrored.
9055 theAxis Axis of symmetry.
9056 theCopy Flag used to mirror object itself or create a copy.
9059 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9060 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9063 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
9065 anObj = self.TrsfOp.MirrorAxis(theObject, theAxis)
9066 RaiseIfFailed("MirrorByAxis", self.TrsfOp)
9069 ## Create an object, symmetrical
9070 # to the given one relatively the given axis.
9071 # @param theObject The object to be mirrored.
9072 # @param theAxis Axis of symmetry.
9073 # @param theName Object name; when specified, this parameter is used
9074 # for result publication in the study. Otherwise, if automatic
9075 # publication is switched on, default value is used for result name.
9077 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9079 # @ref tui_mirror "Example"
9080 @ManageTransactions("TrsfOp")
9081 def MakeMirrorByAxis(self, theObject, theAxis, theName=None):
9083 Create an object, symmetrical to the given one relatively the given axis.
9086 theObject The object to be mirrored.
9087 theAxis Axis of symmetry.
9088 theName Object name; when specified, this parameter is used
9089 for result publication in the study. Otherwise, if automatic
9090 publication is switched on, default value is used for result name.
9093 New GEOM.GEOM_Object, containing the mirrored shape.
9095 # Example: see GEOM_TestAll.py
9096 anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
9097 RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
9098 self._autoPublish(anObj, theName, "mirrored")
9101 ## Mirror an object relatively the given point.
9102 # @param theObject The object to be mirrored.
9103 # @param thePoint Point of symmetry.
9104 # @param theCopy Flag used to mirror object itself or create a copy.
9105 # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9106 # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
9107 @ManageTransactions("TrsfOp")
9108 def MirrorByPoint(self, theObject, thePoint, theCopy=False):
9110 Mirror an object relatively the given point.
9113 theObject The object to be mirrored.
9114 thePoint Point of symmetry.
9115 theCopy Flag used to mirror object itself or create a copy.
9118 Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9119 new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
9121 # Example: see GEOM_TestAll.py
9123 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
9125 anObj = self.TrsfOp.MirrorPoint(theObject, thePoint)
9126 RaiseIfFailed("MirrorByPoint", self.TrsfOp)
9129 ## Create an object, symmetrical
9130 # to the given one relatively the given point.
9131 # @param theObject The object to be mirrored.
9132 # @param thePoint Point of symmetry.
9133 # @param theName Object name; when specified, this parameter is used
9134 # for result publication in the study. Otherwise, if automatic
9135 # publication is switched on, default value is used for result name.
9137 # @return New GEOM.GEOM_Object, containing the mirrored shape.
9139 # @ref tui_mirror "Example"
9140 @ManageTransactions("TrsfOp")
9141 def MakeMirrorByPoint(self, theObject, thePoint, theName=None):
9143 Create an object, symmetrical
9144 to the given one relatively the given point.
9147 theObject The object to be mirrored.
9148 thePoint Point of symmetry.
9149 theName Object name; when specified, this parameter is used
9150 for result publication in the study. Otherwise, if automatic
9151 publication is switched on, default value is used for result name.
9154 New GEOM.GEOM_Object, containing the mirrored shape.
9156 # Example: see GEOM_TestAll.py
9157 anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
9158 RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
9159 self._autoPublish(anObj, theName, "mirrored")
9162 ## Modify the location of the given object.
9163 # @param theObject The object to be displaced.
9164 # @param theStartLCS Coordinate system to perform displacement from it.\n
9165 # If \a theStartLCS is NULL, displacement
9166 # will be performed from global CS.\n
9167 # If \a theObject itself is used as \a theStartLCS,
9168 # its location will be changed to \a theEndLCS.
9169 # @param theEndLCS Coordinate system to perform displacement to it.
9170 # @param theCopy Flag used to displace object itself or create a copy.
9171 # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9172 # new GEOM.GEOM_Object, containing the displaced object if @a theCopy flag is @c True.
9173 @ManageTransactions("TrsfOp")
9174 def Position(self, theObject, theStartLCS, theEndLCS, theCopy=False):
9176 Modify the Location of the given object by LCS, creating its copy before the setting.
9179 theObject The object to be displaced.
9180 theStartLCS Coordinate system to perform displacement from it.
9181 If theStartLCS is NULL, displacement
9182 will be performed from global CS.
9183 If theObject itself is used as theStartLCS,
9184 its location will be changed to theEndLCS.
9185 theEndLCS Coordinate system to perform displacement to it.
9186 theCopy Flag used to displace object itself or create a copy.
9189 Displaced theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9190 new GEOM.GEOM_Object, containing the displaced object if theCopy flag is True.
9192 # Example: see GEOM_TestAll.py
9194 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
9196 anObj = self.TrsfOp.PositionShape(theObject, theStartLCS, theEndLCS)
9197 RaiseIfFailed("Displace", self.TrsfOp)
9200 ## Modify the Location of the given object by LCS,
9201 # creating its copy before the setting.
9202 # @param theObject The object to be displaced.
9203 # @param theStartLCS Coordinate system to perform displacement from it.\n
9204 # If \a theStartLCS is NULL, displacement
9205 # will be performed from global CS.\n
9206 # If \a theObject itself is used as \a theStartLCS,
9207 # its location will be changed to \a theEndLCS.
9208 # @param theEndLCS Coordinate system to perform displacement to it.
9209 # @param theName Object name; when specified, this parameter is used
9210 # for result publication in the study. Otherwise, if automatic
9211 # publication is switched on, default value is used for result name.
9213 # @return New GEOM.GEOM_Object, containing the displaced shape.
9215 # @ref tui_modify_location "Example"
9216 @ManageTransactions("TrsfOp")
9217 def MakePosition(self, theObject, theStartLCS, theEndLCS, theName=None):
9219 Modify the Location of the given object by LCS, creating its copy before the setting.
9222 theObject The object to be displaced.
9223 theStartLCS Coordinate system to perform displacement from it.
9224 If theStartLCS is NULL, displacement
9225 will be performed from global CS.
9226 If theObject itself is used as theStartLCS,
9227 its location will be changed to theEndLCS.
9228 theEndLCS Coordinate system to perform displacement to it.
9229 theName Object name; when specified, this parameter is used
9230 for result publication in the study. Otherwise, if automatic
9231 publication is switched on, default value is used for result name.
9234 New GEOM.GEOM_Object, containing the displaced shape.
9237 # create local coordinate systems
9238 cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
9239 cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
9240 # modify the location of the given object
9241 position = geompy.MakePosition(cylinder, cs1, cs2)
9243 # Example: see GEOM_TestAll.py
9244 anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
9245 RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
9246 self._autoPublish(anObj, theName, "displaced")
9249 ## Modify the Location of the given object by Path.
9250 # @param theObject The object to be displaced.
9251 # @param thePath Wire or Edge along that the object will be translated.
9252 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
9253 # @param theCopy is to create a copy objects if true.
9254 # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
9255 # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy is @c False or
9256 # new GEOM.GEOM_Object, containing the displaced shape if @a theCopy is @c True.
9258 # @ref tui_modify_location "Example"
9259 @ManageTransactions("TrsfOp")
9260 def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
9262 Modify the Location of the given object by Path.
9265 theObject The object to be displaced.
9266 thePath Wire or Edge along that the object will be translated.
9267 theDistance progress of Path (0 = start location, 1 = end of path location).
9268 theCopy is to create a copy objects if true.
9269 theReverse 0 - for usual direction, 1 - to reverse path direction.
9272 Displaced theObject (GEOM.GEOM_Object) if theCopy is False or
9273 new GEOM.GEOM_Object, containing the displaced shape if theCopy is True.
9276 position = geompy.PositionAlongPath(cylinder, circle, 0.75, 1, 1)
9278 # Example: see GEOM_TestAll.py
9279 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
9280 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
9283 ## Modify the Location of the given object by Path, creating its copy before the operation.
9284 # @param theObject The object to be displaced.
9285 # @param thePath Wire or Edge along that the object will be translated.
9286 # @param theDistance progress of Path (0 = start location, 1 = end of path location).
9287 # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
9288 # @param theName Object name; when specified, this parameter is used
9289 # for result publication in the study. Otherwise, if automatic
9290 # publication is switched on, default value is used for result name.
9292 # @return New GEOM.GEOM_Object, containing the displaced shape.
9293 @ManageTransactions("TrsfOp")
9294 def MakePositionAlongPath(self, theObject, thePath, theDistance, theReverse, theName=None):
9296 Modify the Location of the given object by Path, creating its copy before the operation.
9299 theObject The object to be displaced.
9300 thePath Wire or Edge along that the object will be translated.
9301 theDistance progress of Path (0 = start location, 1 = end of path location).
9302 theReverse 0 - for usual direction, 1 - to reverse path direction.
9303 theName Object name; when specified, this parameter is used
9304 for result publication in the study. Otherwise, if automatic
9305 publication is switched on, default value is used for result name.
9308 New GEOM.GEOM_Object, containing the displaced shape.
9310 # Example: see GEOM_TestAll.py
9311 anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, 1, theReverse)
9312 RaiseIfFailed("PositionAlongPath", self.TrsfOp)
9313 self._autoPublish(anObj, theName, "displaced")
9316 ## Offset given shape.
9317 # @param theObject The base object for the offset.
9318 # @param theOffset Offset value.
9319 # @param theCopy Flag used to offset object itself or create a copy.
9320 # @return Modified @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
9321 # new GEOM.GEOM_Object, containing the result of offset operation if @a theCopy flag is @c True.
9322 @ManageTransactions("TrsfOp")
9323 def Offset(self, theObject, theOffset, theCopy=False):
9328 theObject The base object for the offset.
9329 theOffset Offset value.
9330 theCopy Flag used to offset object itself or create a copy.
9333 Modified theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
9334 new GEOM.GEOM_Object, containing the result of offset operation if theCopy flag is True.
9336 theOffset, Parameters = ParseParameters(theOffset)
9338 anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset, True)
9340 anObj = self.TrsfOp.OffsetShape(theObject, theOffset, True)
9341 RaiseIfFailed("Offset", self.TrsfOp)
9342 anObj.SetParameters(Parameters)
9345 ## Create new object as offset of the given one. Gap between two adjacent
9346 # offset surfaces is filled by a pipe.
9347 # @param theObject The base object for the offset.
9348 # @param theOffset Offset value.
9349 # @param theName Object name; when specified, this parameter is used
9350 # for result publication in the study. Otherwise, if automatic
9351 # publication is switched on, default value is used for result name.
9353 # @return New GEOM.GEOM_Object, containing the offset object.
9355 # @sa MakeOffsetIntersectionJoin
9356 # @ref tui_offset "Example"
9357 @ManageTransactions("TrsfOp")
9358 def MakeOffset(self, theObject, theOffset, theName=None):
9360 Create new object as offset of the given one. Gap between adjacent
9361 offset surfaces is filled by a pipe.
9364 theObject The base object for the offset.
9365 theOffset Offset value.
9366 theName Object name; when specified, this parameter is used
9367 for result publication in the study. Otherwise, if automatic
9368 publication is switched on, default value is used for result name.
9371 New GEOM.GEOM_Object, containing the offset object.
9374 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
9375 # create a new object as offset of the given object
9376 offset = geompy.MakeOffset(box, 70.)
9378 # Example: see GEOM_TestAll.py
9379 theOffset, Parameters = ParseParameters(theOffset)
9380 anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, True )
9381 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
9382 anObj.SetParameters(Parameters)
9383 self._autoPublish(anObj, theName, "offset")
9386 ## Create new object as offset of the given one. Gap between adjacent
9387 # offset surfaces is filled by extending and intersecting them.
9388 # @param theObject The base object for the offset.
9389 # @param theOffset Offset value.
9390 # @param theName Object name; when specified, this parameter is used
9391 # for result publication in the study. Otherwise, if automatic
9392 # publication is switched on, default value is used for result name.
9394 # @return New GEOM.GEOM_Object, containing the offset object.
9397 # @ref tui_offset "Example"
9398 @ManageTransactions("TrsfOp")
9399 def MakeOffsetIntersectionJoin(self, theObject, theOffset, theName=None):
9401 Create new object as offset of the given one. Gap between adjacent
9402 offset surfaces is filled by extending and intersecting them.
9405 theObject The base object for the offset.
9406 theOffset Offset value.
9407 theName Object name; when specified, this parameter is used
9408 for result publication in the study. Otherwise, if automatic
9409 publication is switched on, default value is used for result name.
9412 New GEOM.GEOM_Object, containing the offset object.
9415 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
9416 # create a new box extended by 70
9417 offset = geompy.MakeOffsetIntersectionJoin(box, 70.)
9419 # Example: see GEOM_TestAll.py
9420 theOffset, Parameters = ParseParameters( theOffset )
9421 anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, False )
9422 RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
9423 anObj.SetParameters(Parameters)
9424 self._autoPublish(anObj, theName, "offset")
9427 ## Create new object as projection of the given one on another.
9428 # @param theSource The source object for the projection. It can be a point, edge or wire.
9429 # Edge and wire are acceptable if @a theTarget is a face.
9430 # @param theTarget The target object. It can be planar or cylindrical face, edge or wire.
9431 # @param theName Object name; when specified, this parameter is used
9432 # for result publication in the study. Otherwise, if automatic
9433 # publication is switched on, default value is used for result name.
9435 # @return New GEOM.GEOM_Object, containing the projection.
9437 # @ref tui_projection "Example"
9438 @ManageTransactions("TrsfOp")
9439 def MakeProjection(self, theSource, theTarget, theName=None):
9441 Create new object as projection of the given one on another.
9444 theSource The source object for the projection. It can be a point, edge or wire.
9445 Edge and wire are acceptable if theTarget is a face.
9446 theTarget The target object. It can be planar or cylindrical face, edge or wire.
9447 theName Object name; when specified, this parameter is used
9448 for result publication in the study. Otherwise, if automatic
9449 publication is switched on, default value is used for result name.
9452 New GEOM.GEOM_Object, containing the projection.
9454 # Example: see GEOM_TestAll.py
9455 anObj = self.TrsfOp.ProjectShapeCopy(theSource, theTarget)
9456 RaiseIfFailed("ProjectShapeCopy", self.TrsfOp)
9457 self._autoPublish(anObj, theName, "projection")
9460 ## Create a projection of the given point on a wire or an edge.
9461 # If there are no solutions or there are 2 or more solutions It throws an
9463 # @param thePoint the point to be projected.
9464 # @param theWire the wire. The edge is accepted as well.
9465 # @param theName Object name; when specified, this parameter is used
9466 # for result publication in the study. Otherwise, if automatic
9467 # publication is switched on, default value is used for result name.
9469 # @return [\a u, \a PointOnEdge, \a EdgeInWireIndex]
9470 # \n \a u: The parameter of projection point on edge.
9471 # \n \a PointOnEdge: The projection point.
9472 # \n \a EdgeInWireIndex: The index of an edge in a wire.
9474 # @ref tui_projection "Example"
9475 @ManageTransactions("TrsfOp")
9476 def MakeProjectionOnWire(self, thePoint, theWire, theName=None):
9478 Create a projection of the given point on a wire or an edge.
9479 If there are no solutions or there are 2 or more solutions It throws an
9483 thePoint the point to be projected.
9484 theWire the wire. The edge is accepted as well.
9485 theName Object name; when specified, this parameter is used
9486 for result publication in the study. Otherwise, if automatic
9487 publication is switched on, default value is used for result name.
9490 [u, PointOnEdge, EdgeInWireIndex]
9491 u: The parameter of projection point on edge.
9492 PointOnEdge: The projection point.
9493 EdgeInWireIndex: The index of an edge in a wire.
9495 # Example: see GEOM_TestAll.py
9496 anObj = self.TrsfOp.ProjectPointOnWire(thePoint, theWire)
9497 RaiseIfFailed("ProjectPointOnWire", self.TrsfOp)
9498 self._autoPublish(anObj[1], theName, "projection")
9501 # -----------------------------------------------------------------------------
9503 # -----------------------------------------------------------------------------
9505 ## Translate the given object along the given vector a given number times
9506 # @param theObject The object to be translated.
9507 # @param theVector Direction of the translation. DX if None.
9508 # @param theStep Distance to translate on.
9509 # @param theNbTimes Quantity of translations to be done.
9510 # @param theName Object name; when specified, this parameter is used
9511 # for result publication in the study. Otherwise, if automatic
9512 # publication is switched on, default value is used for result name.
9514 # @return New GEOM.GEOM_Object, containing compound of all
9515 # the shapes, obtained after each translation.
9517 # @ref tui_multi_translation "Example"
9518 @ManageTransactions("TrsfOp")
9519 def MakeMultiTranslation1D(self, theObject, theVector, theStep, theNbTimes, theName=None):
9521 Translate the given object along the given vector a given number times
9524 theObject The object to be translated.
9525 theVector Direction of the translation. DX if None.
9526 theStep Distance to translate on.
9527 theNbTimes Quantity of translations to be done.
9528 theName Object name; when specified, this parameter is used
9529 for result publication in the study. Otherwise, if automatic
9530 publication is switched on, default value is used for result name.
9533 New GEOM.GEOM_Object, containing compound of all
9534 the shapes, obtained after each translation.
9537 r1d = geompy.MakeMultiTranslation1D(prism, vect, 20, 4)
9539 # Example: see GEOM_TestAll.py
9540 theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
9541 anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
9542 RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
9543 anObj.SetParameters(Parameters)
9544 self._autoPublish(anObj, theName, "multitranslation")
9547 ## Conseqently apply two specified translations to theObject specified number of times.
9548 # @param theObject The object to be translated.
9549 # @param theVector1 Direction of the first translation. DX if None.
9550 # @param theStep1 Step of the first translation.
9551 # @param theNbTimes1 Quantity of translations to be done along theVector1.
9552 # @param theVector2 Direction of the second translation. DY if None.
9553 # @param theStep2 Step of the second translation.
9554 # @param theNbTimes2 Quantity of translations to be done along theVector2.
9555 # @param theName Object name; when specified, this parameter is used
9556 # for result publication in the study. Otherwise, if automatic
9557 # publication is switched on, default value is used for result name.
9559 # @return New GEOM.GEOM_Object, containing compound of all
9560 # the shapes, obtained after each translation.
9562 # @ref tui_multi_translation "Example"
9563 @ManageTransactions("TrsfOp")
9564 def MakeMultiTranslation2D(self, theObject, theVector1, theStep1, theNbTimes1,
9565 theVector2, theStep2, theNbTimes2, theName=None):
9567 Conseqently apply two specified translations to theObject specified number of times.
9570 theObject The object to be translated.
9571 theVector1 Direction of the first translation. DX if None.
9572 theStep1 Step of the first translation.
9573 theNbTimes1 Quantity of translations to be done along theVector1.
9574 theVector2 Direction of the second translation. DY if None.
9575 theStep2 Step of the second translation.
9576 theNbTimes2 Quantity of translations to be done along theVector2.
9577 theName Object name; when specified, this parameter is used
9578 for result publication in the study. Otherwise, if automatic
9579 publication is switched on, default value is used for result name.
9582 New GEOM.GEOM_Object, containing compound of all
9583 the shapes, obtained after each translation.
9586 tr2d = geompy.MakeMultiTranslation2D(prism, vect1, 20, 4, vect2, 80, 3)
9588 # Example: see GEOM_TestAll.py
9589 theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
9590 anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
9591 theVector2, theStep2, theNbTimes2)
9592 RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
9593 anObj.SetParameters(Parameters)
9594 self._autoPublish(anObj, theName, "multitranslation")
9597 ## Rotate the given object around the given axis a given number times.
9598 # Rotation angle will be 2*PI/theNbTimes.
9599 # @param theObject The object to be rotated.
9600 # @param theAxis The rotation axis. DZ if None.
9601 # @param theNbTimes Quantity of rotations to be done.
9602 # @param theName Object name; when specified, this parameter is used
9603 # for result publication in the study. Otherwise, if automatic
9604 # publication is switched on, default value is used for result name.
9606 # @return New GEOM.GEOM_Object, containing compound of all the
9607 # shapes, obtained after each rotation.
9609 # @ref tui_multi_rotation "Example"
9610 @ManageTransactions("TrsfOp")
9611 def MultiRotate1DNbTimes (self, theObject, theAxis, theNbTimes, theName=None):
9613 Rotate the given object around the given axis a given number times.
9614 Rotation angle will be 2*PI/theNbTimes.
9617 theObject The object to be rotated.
9618 theAxis The rotation axis. DZ if None.
9619 theNbTimes Quantity of rotations to be done.
9620 theName Object name; when specified, this parameter is used
9621 for result publication in the study. Otherwise, if automatic
9622 publication is switched on, default value is used for result name.
9625 New GEOM.GEOM_Object, containing compound of all the
9626 shapes, obtained after each rotation.
9629 rot1d = geompy.MultiRotate1DNbTimes(prism, vect, 4)
9631 # Example: see GEOM_TestAll.py
9632 theNbTimes, Parameters = ParseParameters(theNbTimes)
9633 anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
9634 RaiseIfFailed("MultiRotate1DNbTimes", self.TrsfOp)
9635 anObj.SetParameters(Parameters)
9636 self._autoPublish(anObj, theName, "multirotation")
9639 ## Rotate the given object around the given axis
9640 # a given number times on the given angle.
9641 # @param theObject The object to be rotated.
9642 # @param theAxis The rotation axis. DZ if None.
9643 # @param theAngleStep Rotation angle in radians.
9644 # @param theNbTimes Quantity of rotations to be done.
9645 # @param theName Object name; when specified, this parameter is used
9646 # for result publication in the study. Otherwise, if automatic
9647 # publication is switched on, default value is used for result name.
9649 # @return New GEOM.GEOM_Object, containing compound of all the
9650 # shapes, obtained after each rotation.
9652 # @ref tui_multi_rotation "Example"
9653 @ManageTransactions("TrsfOp")
9654 def MultiRotate1DByStep(self, theObject, theAxis, theAngleStep, theNbTimes, theName=None):
9656 Rotate the given object around the given axis
9657 a given number times on the given angle.
9660 theObject The object to be rotated.
9661 theAxis The rotation axis. DZ if None.
9662 theAngleStep Rotation angle in radians.
9663 theNbTimes Quantity of rotations to be done.
9664 theName Object name; when specified, this parameter is used
9665 for result publication in the study. Otherwise, if automatic
9666 publication is switched on, default value is used for result name.
9669 New GEOM.GEOM_Object, containing compound of all the
9670 shapes, obtained after each rotation.
9673 rot1d = geompy.MultiRotate1DByStep(prism, vect, math.pi/4, 4)
9675 # Example: see GEOM_TestAll.py
9676 theAngleStep, theNbTimes, Parameters = ParseParameters(theAngleStep, theNbTimes)
9677 anObj = self.TrsfOp.MultiRotate1DByStep(theObject, theAxis, theAngleStep, theNbTimes)
9678 RaiseIfFailed("MultiRotate1DByStep", self.TrsfOp)
9679 anObj.SetParameters(Parameters)
9680 self._autoPublish(anObj, theName, "multirotation")
9683 ## Rotate the given object around the given axis a given
9684 # number times and multi-translate each rotation result.
9685 # Rotation angle will be 2*PI/theNbTimes1.
9686 # Translation direction passes through center of gravity
9687 # of rotated shape and its projection on the rotation axis.
9688 # @param theObject The object to be rotated.
9689 # @param theAxis Rotation axis. DZ if None.
9690 # @param theNbTimes1 Quantity of rotations to be done.
9691 # @param theRadialStep Translation distance.
9692 # @param theNbTimes2 Quantity of translations to be done.
9693 # @param theName Object name; when specified, this parameter is used
9694 # for result publication in the study. Otherwise, if automatic
9695 # publication is switched on, default value is used for result name.
9697 # @return New GEOM.GEOM_Object, containing compound of all the
9698 # shapes, obtained after each transformation.
9700 # @ref tui_multi_rotation "Example"
9701 @ManageTransactions("TrsfOp")
9702 def MultiRotate2DNbTimes(self, theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
9704 Rotate the given object around the
9705 given axis on the given angle a given number
9706 times and multi-translate each rotation result.
9707 Translation direction passes through center of gravity
9708 of rotated shape and its projection on the rotation axis.
9711 theObject The object to be rotated.
9712 theAxis Rotation axis. DZ if None.
9713 theNbTimes1 Quantity of rotations to be done.
9714 theRadialStep Translation distance.
9715 theNbTimes2 Quantity of translations to be done.
9716 theName Object name; when specified, this parameter is used
9717 for result publication in the study. Otherwise, if automatic
9718 publication is switched on, default value is used for result name.
9721 New GEOM.GEOM_Object, containing compound of all the
9722 shapes, obtained after each transformation.
9725 rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
9727 # Example: see GEOM_TestAll.py
9728 theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theNbTimes1, theRadialStep, theNbTimes2)
9729 anObj = self.TrsfOp.MultiRotate2DNbTimes(theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2)
9730 RaiseIfFailed("MultiRotate2DNbTimes", self.TrsfOp)
9731 anObj.SetParameters(Parameters)
9732 self._autoPublish(anObj, theName, "multirotation")
9735 ## Rotate the given object around the
9736 # given axis on the given angle a given number
9737 # times and multi-translate each rotation result.
9738 # Translation direction passes through center of gravity
9739 # of rotated shape and its projection on the rotation axis.
9740 # @param theObject The object to be rotated.
9741 # @param theAxis Rotation axis. DZ if None.
9742 # @param theAngleStep Rotation angle in radians.
9743 # @param theNbTimes1 Quantity of rotations to be done.
9744 # @param theRadialStep Translation distance.
9745 # @param theNbTimes2 Quantity of translations to be done.
9746 # @param theName Object name; when specified, this parameter is used
9747 # for result publication in the study. Otherwise, if automatic
9748 # publication is switched on, default value is used for result name.
9750 # @return New GEOM.GEOM_Object, containing compound of all the
9751 # shapes, obtained after each transformation.
9753 # @ref tui_multi_rotation "Example"
9754 @ManageTransactions("TrsfOp")
9755 def MultiRotate2DByStep (self, theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
9757 Rotate the given object around the
9758 given axis on the given angle a given number
9759 times and multi-translate each rotation result.
9760 Translation direction passes through center of gravity
9761 of rotated shape and its projection on the rotation axis.
9764 theObject The object to be rotated.
9765 theAxis Rotation axis. DZ if None.
9766 theAngleStep Rotation angle in radians.
9767 theNbTimes1 Quantity of rotations to be done.
9768 theRadialStep Translation distance.
9769 theNbTimes2 Quantity of translations to be done.
9770 theName Object name; when specified, this parameter is used
9771 for result publication in the study. Otherwise, if automatic
9772 publication is switched on, default value is used for result name.
9775 New GEOM.GEOM_Object, containing compound of all the
9776 shapes, obtained after each transformation.
9779 rot2d = geompy.MultiRotate2D(prism, vect, math.pi/3, 4, 50, 5)
9781 # Example: see GEOM_TestAll.py
9782 theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
9783 anObj = self.TrsfOp.MultiRotate2DByStep(theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
9784 RaiseIfFailed("MultiRotate2DByStep", self.TrsfOp)
9785 anObj.SetParameters(Parameters)
9786 self._autoPublish(anObj, theName, "multirotation")
9789 ## The same, as MultiRotate1DNbTimes(), but axis is given by direction and point
9791 # @ref swig_MakeMultiRotation "Example"
9792 def MakeMultiRotation1DNbTimes(self, aShape, aDir, aPoint, aNbTimes, theName=None):
9794 The same, as geompy.MultiRotate1DNbTimes, but axis is given by direction and point
9797 pz = geompy.MakeVertex(0, 0, 100)
9798 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9799 MultiRot1D = geompy.MakeMultiRotation1DNbTimes(prism, vy, pz, 6)
9801 # Example: see GEOM_TestOthers.py
9802 aVec = self.MakeLine(aPoint,aDir)
9803 # note: auto-publishing is done in self.MultiRotate1D()
9804 anObj = self.MultiRotate1DNbTimes(aShape, aVec, aNbTimes, theName)
9807 ## The same, as MultiRotate1DByStep(), but axis is given by direction and point
9809 # @ref swig_MakeMultiRotation "Example"
9810 def MakeMultiRotation1DByStep(self, aShape, aDir, aPoint, anAngle, aNbTimes, theName=None):
9812 The same, as geompy.MultiRotate1D, but axis is given by direction and point
9815 pz = geompy.MakeVertex(0, 0, 100)
9816 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9817 MultiRot1D = geompy.MakeMultiRotation1DByStep(prism, vy, pz, math.pi/3, 6)
9819 # Example: see GEOM_TestOthers.py
9820 aVec = self.MakeLine(aPoint,aDir)
9821 # note: auto-publishing is done in self.MultiRotate1D()
9822 anObj = self.MultiRotate1DByStep(aShape, aVec, anAngle, aNbTimes, theName)
9825 ## The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
9827 # @ref swig_MakeMultiRotation "Example"
9828 def MakeMultiRotation2DNbTimes(self, aShape, aDir, aPoint, nbtimes1, aStep, nbtimes2, theName=None):
9830 The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
9833 pz = geompy.MakeVertex(0, 0, 100)
9834 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9835 MultiRot2D = geompy.MakeMultiRotation2DNbTimes(f12, vy, pz, 6, 30, 3)
9837 # Example: see GEOM_TestOthers.py
9838 aVec = self.MakeLine(aPoint,aDir)
9839 # note: auto-publishing is done in self.MultiRotate2DNbTimes()
9840 anObj = self.MultiRotate2DNbTimes(aShape, aVec, nbtimes1, aStep, nbtimes2, theName)
9843 ## The same, as MultiRotate2DByStep(), but axis is given by direction and point
9845 # @ref swig_MakeMultiRotation "Example"
9846 def MakeMultiRotation2DByStep(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
9848 The same, as MultiRotate2DByStep(), but axis is given by direction and point
9851 pz = geompy.MakeVertex(0, 0, 100)
9852 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9853 MultiRot2D = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4, 6, 30, 3)
9855 # Example: see GEOM_TestOthers.py
9856 aVec = self.MakeLine(aPoint,aDir)
9857 # note: auto-publishing is done in self.MultiRotate2D()
9858 anObj = self.MultiRotate2DByStep(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
9862 # Compute a wire or a face that represents a projection of the source
9863 # shape onto cylinder. The cylinder's coordinate system is the same
9864 # as the global coordinate system.
9866 # @param theObject The object to be projected. It can be either
9867 # a planar wire or a face.
9868 # @param theRadius The radius of the cylinder.
9869 # @param theStartAngle The starting angle in radians from
9870 # the cylinder's X axis around Z axis. The angle from which
9871 # the projection is started.
9872 # @param theAngleLength The projection length angle in radians.
9873 # The angle in which to project the total length of the wire.
9874 # If it is negative the projection is not scaled and natural
9875 # wire length is kept for the projection.
9876 # @param theAngleRotation The desired angle in radians between
9877 # the tangent vector to the first curve at the first point of
9878 # the theObject's projection in 2D space and U-direction of
9879 # cylinder's 2D space.
9880 # @param theName Object name; when specified, this parameter is used
9881 # for result publication in the study. Otherwise, if automatic
9882 # publication is switched on, default value is used for result name.
9884 # @return New GEOM.GEOM_Object, containing the result shape. The result
9885 # represents a wire or a face that represents a projection of
9886 # the source shape onto a cylinder.
9888 # @ref tui_projection "Example"
9889 def MakeProjectionOnCylinder (self, theObject, theRadius,
9890 theStartAngle=0.0, theAngleLength=-1.0,
9891 theAngleRotation=0.0,
9894 Compute a wire or a face that represents a projection of the source
9895 shape onto cylinder. The cylinder's coordinate system is the same
9896 as the global coordinate system.
9899 theObject The object to be projected. It can be either
9900 a planar wire or a face.
9901 theRadius The radius of the cylinder.
9902 theStartAngle The starting angle in radians from the cylinder's X axis
9903 around Z axis. The angle from which the projection is started.
9904 theAngleLength The projection length angle in radians. The angle in which
9905 to project the total length of the wire. If it is negative the
9906 projection is not scaled and natural wire length is kept for
9908 theAngleRotation The desired angle in radians between
9909 the tangent vector to the first curve at the first
9910 point of the theObject's projection in 2D space and
9911 U-direction of cylinder's 2D space.
9912 theName Object name; when specified, this parameter is used
9913 for result publication in the study. Otherwise, if automatic
9914 publication is switched on, default value is used for result name.
9917 New GEOM.GEOM_Object, containing the result shape. The result
9918 represents a wire or a face that represents a projection of
9919 the source shape onto a cylinder.
9921 # Example: see GEOM_TestAll.py
9922 flagStartAngle = False
9923 if isinstance(theStartAngle,str):
9924 flagStartAngle = True
9925 flagAngleLength = False
9926 if isinstance(theAngleLength,str):
9927 flagAngleLength = True
9928 flagAngleRotation = False
9929 if isinstance(theAngleRotation,str):
9930 flagAngleRotation = True
9931 theRadius, theStartAngle, theAngleLength, theAngleRotation, Parameters = ParseParameters(
9932 theRadius, theStartAngle, theAngleLength, theAngleRotation)
9934 theStartAngle = theStartAngle*math.pi/180.
9936 theAngleLength = theAngleLength*math.pi/180.
9937 if flagAngleRotation:
9938 theAngleRotation = theAngleRotation*math.pi/180.
9939 anObj = self.TrsfOp.MakeProjectionOnCylinder(theObject, theRadius,
9940 theStartAngle, theAngleLength, theAngleRotation)
9941 RaiseIfFailed("MakeProjectionOnCylinder", self.TrsfOp)
9942 anObj.SetParameters(Parameters)
9943 self._autoPublish(anObj, theName, "projection")
9946 # end of l3_transform
9949 ## @addtogroup l3_transform_d
9952 ## Deprecated method. Use MultiRotate1DNbTimes instead.
9953 def MultiRotate1D(self, theObject, theAxis, theNbTimes, theName=None):
9955 Deprecated method. Use MultiRotate1DNbTimes instead.
9957 print("The method MultiRotate1D is DEPRECATED. Use MultiRotate1DNbTimes instead.")
9958 return self.MultiRotate1DNbTimes(theObject, theAxis, theNbTimes, theName)
9960 ## The same, as MultiRotate2DByStep(), but theAngle is in degrees.
9961 # This method is DEPRECATED. Use MultiRotate2DByStep() instead.
9962 @ManageTransactions("TrsfOp")
9963 def MultiRotate2D(self, theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2, theName=None):
9965 The same, as MultiRotate2DByStep(), but theAngle is in degrees.
9966 This method is DEPRECATED. Use MultiRotate2DByStep() instead.
9969 rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
9971 print("The method MultiRotate2D is DEPRECATED. Use MultiRotate2DByStep instead.")
9972 theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
9973 anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
9974 RaiseIfFailed("MultiRotate2D", self.TrsfOp)
9975 anObj.SetParameters(Parameters)
9976 self._autoPublish(anObj, theName, "multirotation")
9979 ## The same, as MultiRotate1D(), but axis is given by direction and point
9980 # This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
9981 def MakeMultiRotation1D(self, aShape, aDir, aPoint, aNbTimes, theName=None):
9983 The same, as geompy.MultiRotate1D, but axis is given by direction and point.
9984 This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
9987 pz = geompy.MakeVertex(0, 0, 100)
9988 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
9989 MultiRot1D = geompy.MakeMultiRotation1D(prism, vy, pz, 6)
9991 print("The method MakeMultiRotation1D is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.")
9992 aVec = self.MakeLine(aPoint,aDir)
9993 # note: auto-publishing is done in self.MultiRotate1D()
9994 anObj = self.MultiRotate1D(aShape, aVec, aNbTimes, theName)
9997 ## The same, as MultiRotate2D(), but axis is given by direction and point
9998 # This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
9999 def MakeMultiRotation2D(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
10001 The same, as MultiRotate2D(), but axis is given by direction and point
10002 This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
10005 pz = geompy.MakeVertex(0, 0, 100)
10006 vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
10007 MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
10009 print("The method MakeMultiRotation2D is DEPRECATED. Use MakeMultiRotation2DByStep instead.")
10010 aVec = self.MakeLine(aPoint,aDir)
10011 # note: auto-publishing is done in self.MultiRotate2D()
10012 anObj = self.MultiRotate2D(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
10015 # end of l3_transform_d
10018 ## @addtogroup l3_local
10021 ## Perform a fillet on all edges of the given shape.
10022 # @param theShape Shape, to perform fillet on.
10023 # @param theR Fillet radius.
10024 # @param theName Object name; when specified, this parameter is used
10025 # for result publication in the study. Otherwise, if automatic
10026 # publication is switched on, default value is used for result name.
10028 # @return New GEOM.GEOM_Object, containing the result shape.
10030 # @ref tui_fillet "Example 1"
10031 # \n @ref swig_MakeFilletAll "Example 2"
10032 @ManageTransactions("LocalOp")
10033 def MakeFilletAll(self, theShape, theR, theName=None):
10035 Perform a fillet on all edges of the given shape.
10038 theShape Shape, to perform fillet on.
10039 theR Fillet radius.
10040 theName Object name; when specified, this parameter is used
10041 for result publication in the study. Otherwise, if automatic
10042 publication is switched on, default value is used for result name.
10045 New GEOM.GEOM_Object, containing the result shape.
10048 filletall = geompy.MakeFilletAll(prism, 10.)
10050 # Example: see GEOM_TestOthers.py
10051 theR,Parameters = ParseParameters(theR)
10052 anObj = self.LocalOp.MakeFilletAll(theShape, theR)
10053 RaiseIfFailed("MakeFilletAll", self.LocalOp)
10054 anObj.SetParameters(Parameters)
10055 self._autoPublish(anObj, theName, "fillet")
10058 ## Perform a fillet on the specified edges/faces of the given shape
10059 # @param theShape Shape, to perform fillet on.
10060 # @param theR Fillet radius.
10061 # @param theShapeType Type of shapes in <VAR>theListShapes</VAR> (see ShapeType())
10062 # @param theListShapes Global indices of edges/faces to perform fillet on.
10063 # @param theName Object name; when specified, this parameter is used
10064 # for result publication in the study. Otherwise, if automatic
10065 # publication is switched on, default value is used for result name.
10067 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10069 # @return New GEOM.GEOM_Object, containing the result shape.
10071 # @ref tui_fillet "Example"
10072 @ManageTransactions("LocalOp")
10073 def MakeFillet(self, theShape, theR, theShapeType, theListShapes, theName=None):
10075 Perform a fillet on the specified edges/faces of the given shape
10078 theShape Shape, to perform fillet on.
10079 theR Fillet radius.
10080 theShapeType Type of shapes in theListShapes (see geompy.ShapeTypes)
10081 theListShapes Global indices of edges/faces to perform fillet on.
10082 theName Object name; when specified, this parameter is used
10083 for result publication in the study. Otherwise, if automatic
10084 publication is switched on, default value is used for result name.
10087 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10090 New GEOM.GEOM_Object, containing the result shape.
10093 # get the list of IDs (IDList) for the fillet
10094 prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"])
10096 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
10097 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
10098 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
10099 # make a fillet on the specified edges of the given shape
10100 fillet = geompy.MakeFillet(prism, 10., geompy.ShapeType["EDGE"], IDlist_e)
10102 # Example: see GEOM_TestAll.py
10103 theR,Parameters = ParseParameters(theR)
10105 if theShapeType == self.ShapeType["EDGE"]:
10106 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
10107 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
10109 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
10110 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
10111 anObj.SetParameters(Parameters)
10112 self._autoPublish(anObj, theName, "fillet")
10115 ## The same that MakeFillet() but with two Fillet Radius R1 and R2
10116 @ManageTransactions("LocalOp")
10117 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes, theName=None):
10119 The same that geompy.MakeFillet but with two Fillet Radius R1 and R2
10122 # get the list of IDs (IDList) for the fillet
10123 prism_edges = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["EDGE"])
10125 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
10126 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
10127 IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
10128 # make a fillet on the specified edges of the given shape
10129 fillet = geompy.MakeFillet(prism, 10., 15., geompy.ShapeType["EDGE"], IDlist_e)
10131 theR1,theR2,Parameters = ParseParameters(theR1,theR2)
10133 if theShapeType == self.ShapeType["EDGE"]:
10134 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
10135 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
10137 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
10138 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
10139 anObj.SetParameters(Parameters)
10140 self._autoPublish(anObj, theName, "fillet")
10143 ## Perform a fillet on the specified edges of the given shape
10144 # @param theShape Wire Shape to perform fillet on.
10145 # @param theR Fillet radius.
10146 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
10147 # \note Global index of sub-shape can be obtained, using method GetSubShapeID()
10148 # \note The list of vertices could be empty,
10149 # in this case fillet will done done at all vertices in wire
10150 # @param doIgnoreSecantVertices If FALSE, fillet radius is always limited
10151 # by the length of the edges, nearest to the fillet vertex.
10152 # But sometimes the next edge is C1 continuous with the one, nearest to
10153 # the fillet point, and such two (or more) edges can be united to allow
10154 # bigger radius. Set this flag to TRUE to allow collinear edges union,
10155 # thus ignoring the secant vertex (vertices).
10156 # @param theName Object name; when specified, this parameter is used
10157 # for result publication in the study. Otherwise, if automatic
10158 # publication is switched on, default value is used for result name.
10160 # @return New GEOM.GEOM_Object, containing the result shape.
10162 # @ref tui_fillet2d "Example"
10163 @ManageTransactions("LocalOp")
10164 def MakeFillet1D(self, theShape, theR, theListOfVertexes, doIgnoreSecantVertices = True, theName=None):
10166 Perform a fillet on the specified edges of the given shape
10169 theShape Wire Shape to perform fillet on.
10170 theR Fillet radius.
10171 theListOfVertexes Global indices of vertexes to perform fillet on.
10172 doIgnoreSecantVertices If FALSE, fillet radius is always limited
10173 by the length of the edges, nearest to the fillet vertex.
10174 But sometimes the next edge is C1 continuous with the one, nearest to
10175 the fillet point, and such two (or more) edges can be united to allow
10176 bigger radius. Set this flag to TRUE to allow collinear edges union,
10177 thus ignoring the secant vertex (vertices).
10178 theName Object name; when specified, this parameter is used
10179 for result publication in the study. Otherwise, if automatic
10180 publication is switched on, default value is used for result name.
10182 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10184 The list of vertices could be empty,in this case fillet will done done at all vertices in wire
10187 New GEOM.GEOM_Object, containing the result shape.
10191 Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
10192 # make fillet at given wire vertices with giver radius
10193 Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
10195 # Example: see GEOM_TestAll.py
10196 theR,doIgnoreSecantVertices,Parameters = ParseParameters(theR,doIgnoreSecantVertices)
10197 anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes, doIgnoreSecantVertices)
10198 RaiseIfFailed("MakeFillet1D", self.LocalOp)
10199 anObj.SetParameters(Parameters)
10200 self._autoPublish(anObj, theName, "fillet")
10203 ## Perform a fillet at the specified vertices of the given face/shell.
10204 # @param theShape Face or Shell shape to perform fillet on.
10205 # @param theR Fillet radius.
10206 # @param theListOfVertexes Global indices of vertexes to perform fillet on.
10207 # @param theName Object name; when specified, this parameter is used
10208 # for result publication in the study. Otherwise, if automatic
10209 # publication is switched on, default value is used for result name.
10211 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10213 # @return New GEOM.GEOM_Object, containing the result shape.
10215 # @ref tui_fillet2d "Example"
10216 @ManageTransactions("LocalOp")
10217 def MakeFillet2D(self, theShape, theR, theListOfVertexes, theName=None):
10219 Perform a fillet at the specified vertices of the given face/shell.
10222 theShape Face or Shell shape to perform fillet on.
10223 theR Fillet radius.
10224 theListOfVertexes Global indices of vertexes to perform fillet on.
10225 theName Object name; when specified, this parameter is used
10226 for result publication in the study. Otherwise, if automatic
10227 publication is switched on, default value is used for result name.
10229 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10232 New GEOM.GEOM_Object, containing the result shape.
10235 face = geompy.MakeFaceHW(100, 100, 1)
10236 fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
10238 # Example: see GEOM_TestAll.py
10239 theR,Parameters = ParseParameters(theR)
10240 anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
10241 RaiseIfFailed("MakeFillet2D", self.LocalOp)
10242 anObj.SetParameters(Parameters)
10243 self._autoPublish(anObj, theName, "fillet")
10246 ## Perform a symmetric chamfer on all edges of the given shape.
10247 # @param theShape Shape, to perform chamfer on.
10248 # @param theD Chamfer size along each face.
10249 # @param theName Object name; when specified, this parameter is used
10250 # for result publication in the study. Otherwise, if automatic
10251 # publication is switched on, default value is used for result name.
10253 # @return New GEOM.GEOM_Object, containing the result shape.
10255 # @ref tui_chamfer "Example 1"
10256 # \n @ref swig_MakeChamferAll "Example 2"
10257 @ManageTransactions("LocalOp")
10258 def MakeChamferAll(self, theShape, theD, theName=None):
10260 Perform a symmetric chamfer on all edges of the given shape.
10263 theShape Shape, to perform chamfer on.
10264 theD Chamfer size along each face.
10265 theName Object name; when specified, this parameter is used
10266 for result publication in the study. Otherwise, if automatic
10267 publication is switched on, default value is used for result name.
10270 New GEOM.GEOM_Object, containing the result shape.
10273 chamfer_all = geompy.MakeChamferAll(prism, 10.)
10275 # Example: see GEOM_TestOthers.py
10276 theD,Parameters = ParseParameters(theD)
10277 anObj = self.LocalOp.MakeChamferAll(theShape, theD)
10278 RaiseIfFailed("MakeChamferAll", self.LocalOp)
10279 anObj.SetParameters(Parameters)
10280 self._autoPublish(anObj, theName, "chamfer")
10283 ## Perform a chamfer on edges, common to the specified faces,
10284 # with distance D1 on the Face1
10285 # @param theShape Shape, to perform chamfer on.
10286 # @param theD1 Chamfer size along \a theFace1.
10287 # @param theD2 Chamfer size along \a theFace2.
10288 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
10289 # @param theName Object name; when specified, this parameter is used
10290 # for result publication in the study. Otherwise, if automatic
10291 # publication is switched on, default value is used for result name.
10293 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10295 # @return New GEOM.GEOM_Object, containing the result shape.
10297 # @ref tui_chamfer "Example"
10298 @ManageTransactions("LocalOp")
10299 def MakeChamferEdge(self, theShape, theD1, theD2, theFace1, theFace2, theName=None):
10301 Perform a chamfer on edges, common to the specified faces,
10302 with distance D1 on the Face1
10305 theShape Shape, to perform chamfer on.
10306 theD1 Chamfer size along theFace1.
10307 theD2 Chamfer size along theFace2.
10308 theFace1,theFace2 Global indices of two faces of theShape.
10309 theName Object name; when specified, this parameter is used
10310 for result publication in the study. Otherwise, if automatic
10311 publication is switched on, default value is used for result name.
10314 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10317 New GEOM.GEOM_Object, containing the result shape.
10320 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
10321 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
10322 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
10323 chamfer_e = geompy.MakeChamferEdge(prism, 10., 10., f_ind_1, f_ind_2)
10325 # Example: see GEOM_TestAll.py
10326 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10327 anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
10328 RaiseIfFailed("MakeChamferEdge", self.LocalOp)
10329 anObj.SetParameters(Parameters)
10330 self._autoPublish(anObj, theName, "chamfer")
10333 ## Perform a chamfer on edges
10334 # @param theShape Shape, to perform chamfer on.
10335 # @param theD Chamfer length
10336 # @param theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10337 # @param theFace1,theFace2 Global indices of two faces of \a theShape.
10338 # @param theName Object name; when specified, this parameter is used
10339 # for result publication in the study. Otherwise, if automatic
10340 # publication is switched on, default value is used for result name.
10342 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10344 # @return New GEOM.GEOM_Object, containing the result shape.
10345 @ManageTransactions("LocalOp")
10346 def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2, theName=None):
10348 Perform a chamfer on edges
10351 theShape Shape, to perform chamfer on.
10352 theD1 Chamfer size along theFace1.
10353 theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees).
10354 theFace1,theFace2 Global indices of two faces of theShape.
10355 theName Object name; when specified, this parameter is used
10356 for result publication in the study. Otherwise, if automatic
10357 publication is switched on, default value is used for result name.
10360 Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
10363 New GEOM.GEOM_Object, containing the result shape.
10366 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
10367 f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
10368 f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
10370 chamfer_e = geompy.MakeChamferEdge(prism, 10., ang, f_ind_1, f_ind_2)
10373 if isinstance(theAngle,str):
10375 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10377 theAngle = theAngle*math.pi/180.0
10378 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
10379 RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
10380 anObj.SetParameters(Parameters)
10381 self._autoPublish(anObj, theName, "chamfer")
10384 ## Perform a chamfer on all edges of the specified faces,
10385 # with distance D1 on the first specified face (if several for one edge)
10386 # @param theShape Shape, to perform chamfer on.
10387 # @param theD1 Chamfer size along face from \a theFaces. If both faces,
10388 # connected to the edge, are in \a theFaces, \a theD1
10389 # will be get along face, which is nearer to \a theFaces beginning.
10390 # @param theD2 Chamfer size along another of two faces, connected to the edge.
10391 # @param theFaces Sequence of global indices of faces of \a theShape.
10392 # @param theName Object name; when specified, this parameter is used
10393 # for result publication in the study. Otherwise, if automatic
10394 # publication is switched on, default value is used for result name.
10396 # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
10398 # @return New GEOM.GEOM_Object, containing the result shape.
10400 # @ref tui_chamfer "Example"
10401 @ManageTransactions("LocalOp")
10402 def MakeChamferFaces(self, theShape, theD1, theD2, theFaces, theName=None):
10404 Perform a chamfer on all edges of the specified faces,
10405 with distance D1 on the first specified face (if several for one edge)
10408 theShape Shape, to perform chamfer on.
10409 theD1 Chamfer size along face from theFaces. If both faces,
10410 connected to the edge, are in theFaces, theD1
10411 will be get along face, which is nearer to theFaces beginning.
10412 theD2 Chamfer size along another of two faces, connected to the edge.
10413 theFaces Sequence of global indices of faces of theShape.
10414 theName Object name; when specified, this parameter is used
10415 for result publication in the study. Otherwise, if automatic
10416 publication is switched on, default value is used for result name.
10418 Note: Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
10421 New GEOM.GEOM_Object, containing the result shape.
10423 # Example: see GEOM_TestAll.py
10424 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10425 anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
10426 RaiseIfFailed("MakeChamferFaces", self.LocalOp)
10427 anObj.SetParameters(Parameters)
10428 self._autoPublish(anObj, theName, "chamfer")
10431 ## The Same that MakeChamferFaces() but with params theD is chamfer length and
10432 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10434 # @ref swig_FilletChamfer "Example"
10435 @ManageTransactions("LocalOp")
10436 def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces, theName=None):
10438 The Same that geompy.MakeChamferFaces but with params theD is chamfer length and
10439 theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10442 if isinstance(theAngle,str):
10444 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10446 theAngle = theAngle*math.pi/180.0
10447 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
10448 RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
10449 anObj.SetParameters(Parameters)
10450 self._autoPublish(anObj, theName, "chamfer")
10453 ## Perform a chamfer on edges,
10454 # with distance D1 on the first specified face (if several for one edge)
10455 # @param theShape Shape, to perform chamfer on.
10456 # @param theD1,theD2 Chamfer size
10457 # @param theEdges Sequence of edges of \a theShape.
10458 # @param theName Object name; when specified, this parameter is used
10459 # for result publication in the study. Otherwise, if automatic
10460 # publication is switched on, default value is used for result name.
10462 # @return New GEOM.GEOM_Object, containing the result shape.
10464 # @ref swig_FilletChamfer "Example"
10465 @ManageTransactions("LocalOp")
10466 def MakeChamferEdges(self, theShape, theD1, theD2, theEdges, theName=None):
10468 Perform a chamfer on edges,
10469 with distance D1 on the first specified face (if several for one edge)
10472 theShape Shape, to perform chamfer on.
10473 theD1,theD2 Chamfer size
10474 theEdges Sequence of edges of theShape.
10475 theName Object name; when specified, this parameter is used
10476 for result publication in the study. Otherwise, if automatic
10477 publication is switched on, default value is used for result name.
10480 New GEOM.GEOM_Object, containing the result shape.
10482 theD1,theD2,Parameters = ParseParameters(theD1,theD2)
10483 anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
10484 RaiseIfFailed("MakeChamferEdges", self.LocalOp)
10485 anObj.SetParameters(Parameters)
10486 self._autoPublish(anObj, theName, "chamfer")
10489 ## The Same that MakeChamferEdges() but with params theD is chamfer length and
10490 # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10491 @ManageTransactions("LocalOp")
10492 def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges, theName=None):
10494 The Same that geompy.MakeChamferEdges but with params theD is chamfer length and
10495 theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
10498 if isinstance(theAngle,str):
10500 theD,theAngle,Parameters = ParseParameters(theD,theAngle)
10502 theAngle = theAngle*math.pi/180.0
10503 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
10504 RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
10505 anObj.SetParameters(Parameters)
10506 self._autoPublish(anObj, theName, "chamfer")
10509 ## @sa MakeChamferEdge(), MakeChamferFaces()
10511 # @ref swig_MakeChamfer "Example"
10512 def MakeChamfer(self, aShape, d1, d2, aShapeType, ListShape, theName=None):
10514 See geompy.MakeChamferEdge() and geompy.MakeChamferFaces() functions for more information.
10516 # Example: see GEOM_TestOthers.py
10518 # note: auto-publishing is done in self.MakeChamferEdge() or self.MakeChamferFaces()
10519 if aShapeType == self.ShapeType["EDGE"]:
10520 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1],theName)
10522 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape,theName)
10525 ## Remove material from a solid by extrusion of the base shape on the given distance.
10526 # @param theInit Shape to remove material from. It must be a solid or
10527 # a compound made of a single solid.
10528 # @param theBase Closed edge or wire defining the base shape to be extruded.
10529 # @param theH Prism dimension along the normal to theBase
10530 # @param theAngle Draft angle in degrees.
10531 # @param theInvert If true material changes the direction
10532 # @param theName Object name; when specified, this parameter is used
10533 # for result publication in the study. Otherwise, if automatic
10534 # publication is switched on, default value is used for result name.
10536 # @return New GEOM.GEOM_Object, containing the initial shape with removed material
10538 # @ref tui_creation_prism "Example"
10539 @ManageTransactions("PrimOp")
10540 def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
10542 Add material to a solid by extrusion of the base shape on the given distance.
10545 theInit Shape to remove material from. It must be a solid or a compound made of a single solid.
10546 theBase Closed edge or wire defining the base shape to be extruded.
10547 theH Prism dimension along the normal to theBase
10548 theAngle Draft angle in degrees.
10549 theInvert If true material changes the direction.
10550 theName Object name; when specified, this parameter is used
10551 for result publication in the study. Otherwise, if automatic
10552 publication is switched on, default value is used for result name.
10555 New GEOM.GEOM_Object, containing the initial shape with removed material.
10557 # Example: see GEOM_TestAll.py
10558 theH,theAngle,Parameters = ParseParameters(theH,theAngle)
10559 anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False, theInvert)
10560 RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
10561 anObj.SetParameters(Parameters)
10562 self._autoPublish(anObj, theName, "extrudedCut")
10565 ## Add material to a solid by extrusion of the base shape on the given distance.
10566 # @param theInit Shape to add material to. It must be a solid or
10567 # a compound made of a single solid.
10568 # @param theBase Closed edge or wire defining the base shape to be extruded.
10569 # @param theH Prism dimension along the normal to theBase
10570 # @param theAngle Draft angle in degrees.
10571 # @param theInvert If true material changes the direction
10572 # @param theName Object name; when specified, this parameter is used
10573 # for result publication in the study. Otherwise, if automatic
10574 # publication is switched on, default value is used for result name.
10576 # @return New GEOM.GEOM_Object, containing the initial shape with added material
10578 # @ref tui_creation_prism "Example"
10579 @ManageTransactions("PrimOp")
10580 def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
10582 Add material to a solid by extrusion of the base shape on the given distance.
10585 theInit Shape to add material to. It must be a solid or a compound made of a single solid.
10586 theBase Closed edge or wire defining the base shape to be extruded.
10587 theH Prism dimension along the normal to theBase
10588 theAngle Draft angle in degrees.
10589 theInvert If true material changes the direction.
10590 theName Object name; when specified, this parameter is used
10591 for result publication in the study. Otherwise, if automatic
10592 publication is switched on, default value is used for result name.
10595 New GEOM.GEOM_Object, containing the initial shape with added material.
10597 # Example: see GEOM_TestAll.py
10598 theH,theAngle,Parameters = ParseParameters(theH,theAngle)
10599 anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True, theInvert)
10600 RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
10601 anObj.SetParameters(Parameters)
10602 self._autoPublish(anObj, theName, "extrudedBoss")
10608 ## @addtogroup l3_basic_op
10611 ## Perform an Archimde operation on the given shape with given parameters.
10612 # The object presenting the resulting face is returned.
10613 # @param theShape Shape to be put in water.
10614 # @param theWeight Weight of the shape.
10615 # @param theWaterDensity Density of the water.
10616 # @param theMeshDeflection Deflection of the mesh, using to compute the section.
10617 # @param theName Object name; when specified, this parameter is used
10618 # for result publication in the study. Otherwise, if automatic
10619 # publication is switched on, default value is used for result name.
10621 # @return New GEOM.GEOM_Object, containing a section of \a theShape
10622 # by a plane, corresponding to water level.
10624 # @ref tui_archimede "Example"
10625 @ManageTransactions("LocalOp")
10626 def Archimede(self, theShape, theWeight, theWaterDensity, theMeshDeflection, theName=None):
10628 Perform an Archimde operation on the given shape with given parameters.
10629 The object presenting the resulting face is returned.
10632 theShape Shape to be put in water.
10633 theWeight Weight of the shape.
10634 theWaterDensity Density of the water.
10635 theMeshDeflection Deflection of the mesh, using to compute the section.
10636 theName Object name; when specified, this parameter is used
10637 for result publication in the study. Otherwise, if automatic
10638 publication is switched on, default value is used for result name.
10641 New GEOM.GEOM_Object, containing a section of theShape
10642 by a plane, corresponding to water level.
10644 # Example: see GEOM_TestAll.py
10645 theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
10646 theWeight,theWaterDensity,theMeshDeflection)
10647 anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
10648 RaiseIfFailed("MakeArchimede", self.LocalOp)
10649 anObj.SetParameters(Parameters)
10650 self._autoPublish(anObj, theName, "archimede")
10653 # end of l3_basic_op
10656 ## @addtogroup l2_measure
10659 ## Get point coordinates
10660 # @return [x, y, z]
10662 # @ref tui_point_coordinates_page "Example"
10663 @ManageTransactions("MeasuOp")
10664 def PointCoordinates(self,Point):
10666 Get point coordinates
10671 # Example: see GEOM_TestMeasures.py
10672 aTuple = self.MeasuOp.PointCoordinates(Point)
10673 RaiseIfFailed("PointCoordinates", self.MeasuOp)
10676 ## Get vector coordinates
10677 # @return [x, y, z]
10679 # @ref tui_measurement_tools_page "Example"
10680 def VectorCoordinates(self,Vector):
10682 Get vector coordinates
10688 p1=self.GetFirstVertex(Vector)
10689 p2=self.GetLastVertex(Vector)
10691 X1=self.PointCoordinates(p1)
10692 X2=self.PointCoordinates(p2)
10694 return (X2[0]-X1[0],X2[1]-X1[1],X2[2]-X1[2])
10697 ## Compute cross product
10698 # @return vector w=u^v
10700 # @ref tui_measurement_tools_page "Example"
10701 def CrossProduct(self, Vector1, Vector2):
10703 Compute cross product
10705 Returns: vector w=u^v
10707 u=self.VectorCoordinates(Vector1)
10708 v=self.VectorCoordinates(Vector2)
10709 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])
10713 ## Compute cross product
10714 # @return dot product p=u.v
10716 # @ref tui_measurement_tools_page "Example"
10717 def DotProduct(self, Vector1, Vector2):
10719 Compute cross product
10721 Returns: dot product p=u.v
10723 u=self.VectorCoordinates(Vector1)
10724 v=self.VectorCoordinates(Vector2)
10725 p=u[0]*v[0]+u[1]*v[1]+u[2]*v[2]
10730 ## Get summarized length of all wires,
10731 # area of surface and volume of the given shape.
10732 # @param theShape Shape to define properties of.
10733 # @param theTolerance maximal relative error of area
10734 # and volume computation.
10735 # @return [theLength, theSurfArea, theVolume]\n
10736 # theLength: Summarized length of all wires of the given shape.\n
10737 # theSurfArea: Area of surface of the given shape.\n
10738 # theVolume: Volume of the given shape.
10740 # @ref tui_basic_properties_page "Example"
10741 @ManageTransactions("MeasuOp")
10742 def BasicProperties(self,theShape, theTolerance=1.e-6):
10744 Get summarized length of all wires,
10745 area of surface and volume of the given shape.
10748 theShape Shape to define properties of.
10749 theTolerance maximal relative error of area
10750 and volume computation.
10753 [theLength, theSurfArea, theVolume]
10754 theLength: Summarized length of all wires of the given shape.
10755 theSurfArea: Area of surface of the given shape.
10756 theVolume: Volume of the given shape.
10758 # Example: see GEOM_TestMeasures.py
10759 aTuple = self.MeasuOp.GetBasicProperties(theShape, theTolerance)
10760 RaiseIfFailed("GetBasicProperties", self.MeasuOp)
10763 ## Get parameters of bounding box of the given shape
10764 # @param theShape Shape to obtain bounding box of.
10765 # @param precise TRUE for precise computation; FALSE for fast one.
10766 # @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
10767 # Xmin,Xmax: Limits of shape along OX axis.
10768 # Ymin,Ymax: Limits of shape along OY axis.
10769 # Zmin,Zmax: Limits of shape along OZ axis.
10771 # @ref tui_bounding_box_page "Example"
10772 @ManageTransactions("MeasuOp")
10773 def BoundingBox (self, theShape, precise=False):
10775 Get parameters of bounding box of the given shape
10778 theShape Shape to obtain bounding box of.
10779 precise TRUE for precise computation; FALSE for fast one.
10782 [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
10783 Xmin,Xmax: Limits of shape along OX axis.
10784 Ymin,Ymax: Limits of shape along OY axis.
10785 Zmin,Zmax: Limits of shape along OZ axis.
10787 # Example: see GEOM_TestMeasures.py
10788 aTuple = self.MeasuOp.GetBoundingBox(theShape, precise)
10789 RaiseIfFailed("GetBoundingBox", self.MeasuOp)
10792 ## Get bounding box of the given shape
10793 # @param theShape Shape to obtain bounding box of.
10794 # @param precise TRUE for precise computation; FALSE for fast one.
10795 # @param theName Object name; when specified, this parameter is used
10796 # for result publication in the study. Otherwise, if automatic
10797 # publication is switched on, default value is used for result name.
10799 # @return New GEOM.GEOM_Object, containing the created box.
10801 # @ref tui_bounding_box_page "Example"
10802 @ManageTransactions("MeasuOp")
10803 def MakeBoundingBox (self, theShape, precise=False, theName=None):
10805 Get bounding box of the given shape
10808 theShape Shape to obtain bounding box of.
10809 precise TRUE for precise computation; FALSE for fast one.
10810 theName Object name; when specified, this parameter is used
10811 for result publication in the study. Otherwise, if automatic
10812 publication is switched on, default value is used for result name.
10815 New GEOM.GEOM_Object, containing the created box.
10817 # Example: see GEOM_TestMeasures.py
10818 anObj = self.MeasuOp.MakeBoundingBox(theShape, precise)
10819 RaiseIfFailed("MakeBoundingBox", self.MeasuOp)
10820 self._autoPublish(anObj, theName, "bndbox")
10823 ## Get inertia matrix and moments of inertia of theShape.
10824 # @param theShape Shape to calculate inertia of.
10825 # @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
10826 # I(1-3)(1-3): Components of the inertia matrix of the given shape.
10827 # Ix,Iy,Iz: Moments of inertia of the given shape.
10829 # @ref tui_inertia_page "Example"
10830 @ManageTransactions("MeasuOp")
10831 def Inertia(self,theShape):
10833 Get inertia matrix and moments of inertia of theShape.
10836 theShape Shape to calculate inertia of.
10839 [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
10840 I(1-3)(1-3): Components of the inertia matrix of the given shape.
10841 Ix,Iy,Iz: Moments of inertia of the given shape.
10843 # Example: see GEOM_TestMeasures.py
10844 aTuple = self.MeasuOp.GetInertia(theShape)
10845 RaiseIfFailed("GetInertia", self.MeasuOp)
10848 ## Get if coords are included in the shape (ST_IN or ST_ON)
10849 # @param theShape Shape
10850 # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
10851 # @param tolerance to be used (default is 1.0e-7)
10852 # @return list_of_boolean = [res1, res2, ...]
10853 @ManageTransactions("MeasuOp")
10854 def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
10856 Get if coords are included in the shape (ST_IN or ST_ON)
10860 coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
10861 tolerance to be used (default is 1.0e-7)
10864 list_of_boolean = [res1, res2, ...]
10866 return self.MeasuOp.AreCoordsInside(theShape, coords, tolerance)
10868 ## Get minimal distance between the given shapes.
10869 # @param theShape1,theShape2 Shapes to find minimal distance between.
10870 # @return Value of the minimal distance between the given shapes.
10872 # @ref tui_min_distance_page "Example"
10873 @ManageTransactions("MeasuOp")
10874 def MinDistance(self, theShape1, theShape2):
10876 Get minimal distance between the given shapes.
10879 theShape1,theShape2 Shapes to find minimal distance between.
10882 Value of the minimal distance between the given shapes.
10884 # Example: see GEOM_TestMeasures.py
10885 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
10886 RaiseIfFailed("GetMinDistance", self.MeasuOp)
10889 ## Get minimal distance between the given shapes.
10890 # @param theShape1,theShape2 Shapes to find minimal distance between.
10891 # @return Value of the minimal distance between the given shapes, in form of list
10892 # [Distance, DX, DY, DZ].
10894 # @ref tui_min_distance_page "Example"
10895 @ManageTransactions("MeasuOp")
10896 def MinDistanceComponents(self, theShape1, theShape2):
10898 Get minimal distance between the given shapes.
10901 theShape1,theShape2 Shapes to find minimal distance between.
10904 Value of the minimal distance between the given shapes, in form of list
10905 [Distance, DX, DY, DZ]
10907 # Example: see GEOM_TestMeasures.py
10908 aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
10909 RaiseIfFailed("GetMinDistance", self.MeasuOp)
10910 aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
10913 ## Get closest points of the given shapes.
10914 # @param theShape1,theShape2 Shapes to find closest points of.
10915 # @return The number of found solutions (-1 in case of infinite number of
10916 # solutions) and a list of (X, Y, Z) coordinates for all couples of points.
10918 # @ref tui_min_distance_page "Example"
10919 @ManageTransactions("MeasuOp")
10920 def ClosestPoints (self, theShape1, theShape2):
10922 Get closest points of the given shapes.
10925 theShape1,theShape2 Shapes to find closest points of.
10928 The number of found solutions (-1 in case of infinite number of
10929 solutions) and a list of (X, Y, Z) coordinates for all couples of points.
10931 # Example: see GEOM_TestMeasures.py
10932 aTuple = self.MeasuOp.ClosestPoints(theShape1, theShape2)
10933 RaiseIfFailed("ClosestPoints", self.MeasuOp)
10936 ## Get angle between the given shapes in degrees.
10937 # @param theShape1,theShape2 Lines or linear edges to find angle between.
10938 # @note If both arguments are vectors, the angle is computed in accordance
10939 # with their orientations, otherwise the minimum angle is computed.
10940 # @return Value of the angle between the given shapes in degrees.
10942 # @ref tui_angle_page "Example"
10943 @ManageTransactions("MeasuOp")
10944 def GetAngle(self, theShape1, theShape2):
10946 Get angle between the given shapes in degrees.
10949 theShape1,theShape2 Lines or linear edges to find angle between.
10952 If both arguments are vectors, the angle is computed in accordance
10953 with their orientations, otherwise the minimum angle is computed.
10956 Value of the angle between the given shapes in degrees.
10958 # Example: see GEOM_TestMeasures.py
10959 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
10960 RaiseIfFailed("GetAngle", self.MeasuOp)
10963 ## Get angle between the given shapes in radians.
10964 # @param theShape1,theShape2 Lines or linear edges to find angle between.
10965 # @note If both arguments are vectors, the angle is computed in accordance
10966 # with their orientations, otherwise the minimum angle is computed.
10967 # @return Value of the angle between the given shapes in radians.
10969 # @ref tui_angle_page "Example"
10970 @ManageTransactions("MeasuOp")
10971 def GetAngleRadians(self, theShape1, theShape2):
10973 Get angle between the given shapes in radians.
10976 theShape1,theShape2 Lines or linear edges to find angle between.
10980 If both arguments are vectors, the angle is computed in accordance
10981 with their orientations, otherwise the minimum angle is computed.
10984 Value of the angle between the given shapes in radians.
10986 # Example: see GEOM_TestMeasures.py
10987 anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)*math.pi/180.
10988 RaiseIfFailed("GetAngle", self.MeasuOp)
10991 ## Get angle between the given vectors in degrees.
10992 # @param theShape1,theShape2 Vectors to find angle between.
10993 # @param theFlag If True, the normal vector is defined by the two vectors cross,
10994 # if False, the opposite vector to the normal vector is used.
10995 # @return Value of the angle between the given vectors in degrees.
10997 # @ref tui_angle_page "Example"
10998 @ManageTransactions("MeasuOp")
10999 def GetAngleVectors(self, theShape1, theShape2, theFlag = True):
11001 Get angle between the given vectors in degrees.
11004 theShape1,theShape2 Vectors to find angle between.
11005 theFlag If True, the normal vector is defined by the two vectors cross,
11006 if False, the opposite vector to the normal vector is used.
11009 Value of the angle between the given vectors in degrees.
11011 anAngle = self.MeasuOp.GetAngleBtwVectors(theShape1, theShape2)
11013 anAngle = 360. - anAngle
11014 RaiseIfFailed("GetAngleVectors", self.MeasuOp)
11017 ## The same as GetAngleVectors, but the result is in radians.
11018 def GetAngleRadiansVectors(self, theShape1, theShape2, theFlag = True):
11020 Get angle between the given vectors in radians.
11023 theShape1,theShape2 Vectors to find angle between.
11024 theFlag If True, the normal vector is defined by the two vectors cross,
11025 if False, the opposite vector to the normal vector is used.
11028 Value of the angle between the given vectors in radians.
11030 anAngle = self.GetAngleVectors(theShape1, theShape2, theFlag)*math.pi/180.
11033 ## @name Curve Curvature Measurement
11034 # Methods for receiving radius of curvature of curves
11035 # in the given point
11038 ## Measure curvature of a curve at a point, set by parameter.
11039 # @param theCurve a curve.
11040 # @param theParam parameter.
11041 # @return radius of curvature of \a theCurve.
11043 # @ref swig_todo "Example"
11044 @ManageTransactions("MeasuOp")
11045 def CurveCurvatureByParam(self, theCurve, theParam):
11047 Measure curvature of a curve at a point, set by parameter.
11051 theParam parameter.
11054 radius of curvature of theCurve.
11056 # Example: see GEOM_TestMeasures.py
11057 aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam)
11058 RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp)
11061 ## Measure curvature of a curve at a point.
11062 # @param theCurve a curve.
11063 # @param thePoint given point.
11064 # @return radius of curvature of \a theCurve.
11066 # @ref swig_todo "Example"
11067 @ManageTransactions("MeasuOp")
11068 def CurveCurvatureByPoint(self, theCurve, thePoint):
11070 Measure curvature of a curve at a point.
11074 thePoint given point.
11077 radius of curvature of theCurve.
11079 aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
11080 RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
11084 ## @name Surface Curvature Measurement
11085 # Methods for receiving max and min radius of curvature of surfaces
11086 # in the given point
11089 ## Measure max radius of curvature of surface.
11090 # @param theSurf the given surface.
11091 # @param theUParam Value of U-parameter on the referenced surface.
11092 # @param theVParam Value of V-parameter on the referenced surface.
11093 # @return max radius of curvature of theSurf.
11095 ## @ref swig_todo "Example"
11096 @ManageTransactions("MeasuOp")
11097 def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
11099 Measure max radius of curvature of surface.
11102 theSurf the given surface.
11103 theUParam Value of U-parameter on the referenced surface.
11104 theVParam Value of V-parameter on the referenced surface.
11107 max radius of curvature of theSurf.
11109 # Example: see GEOM_TestMeasures.py
11110 aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
11111 RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp)
11114 ## Measure max radius of curvature of surface in the given point
11115 # @param theSurf the given surface.
11116 # @param thePoint given point.
11117 # @return max radius of curvature of theSurf.
11119 ## @ref swig_todo "Example"
11120 @ManageTransactions("MeasuOp")
11121 def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint):
11123 Measure max radius of curvature of surface in the given point.
11126 theSurf the given surface.
11127 thePoint given point.
11130 max radius of curvature of theSurf.
11132 aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
11133 RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
11136 ## Measure min radius of curvature of surface.
11137 # @param theSurf the given surface.
11138 # @param theUParam Value of U-parameter on the referenced surface.
11139 # @param theVParam Value of V-parameter on the referenced surface.
11140 # @return min radius of curvature of theSurf.
11142 ## @ref swig_todo "Example"
11143 @ManageTransactions("MeasuOp")
11144 def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
11146 Measure min radius of curvature of surface.
11149 theSurf the given surface.
11150 theUParam Value of U-parameter on the referenced surface.
11151 theVParam Value of V-parameter on the referenced surface.
11154 Min radius of curvature of theSurf.
11156 aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
11157 RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp)
11160 ## Measure min radius of curvature of surface in the given point
11161 # @param theSurf the given surface.
11162 # @param thePoint given point.
11163 # @return min radius of curvature of theSurf.
11165 ## @ref swig_todo "Example"
11166 @ManageTransactions("MeasuOp")
11167 def MinSurfaceCurvatureByPoint(self, theSurf, thePoint):
11169 Measure min radius of curvature of surface in the given point.
11172 theSurf the given surface.
11173 thePoint given point.
11176 Min radius of curvature of theSurf.
11178 aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
11179 RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
11183 ## Measure curvature radius of surface in the given point along the given direction.
11184 # @param theSurf the given face.
11185 # @param thePoint given point.
11186 # @param theDirection given direction.
11187 # @param theName Object name; when specified, this parameter is used
11188 # for result publication in the study. Otherwise, if automatic
11189 # publication is switched on, default value is used for result name.
11191 # @return New GEOM.GEOM_Object, containing vector of curvature of theSurf.
11192 # The returned vector is codirectional with the normal to the face
11193 # in the given point in case of positive curvature value
11194 # and opposite to the normal in case of negative curvature.
11195 # The normal of the returned vector is equal to the
11196 # absolute value of the curvature radius.
11197 # Null shape is returned in case of infinite radius
11198 # (zero curvature), for example, in case of flat face.
11200 ## @ref swig_CurvatureOnFace "Example"
11201 @ManageTransactions("MeasuOp")
11202 def CurvatureOnFace(self, theSurf, thePoint, theDirection, theName=None):
11204 Measure curvature radius of surface in the given point along the given direction.
11207 theSurf the given face.
11208 thePoint given point.
11209 theDirection given direction.
11210 theName Object name; when specified, this parameter is used
11211 for result publication in the study. Otherwise, if automatic
11212 publication is switched on, default value is used for result name.
11215 New GEOM.GEOM_Object, containing vector of curvature of theSurf.
11216 The returned vector is codirectional with the normal to the face
11217 in the given point in case of positive curvature value
11218 and opposite to the normal in case of negative curvature.
11219 The normal of the returned vector is equal to the
11220 absolute value of the curvature radius.
11221 Null shape is returned in case of infinite radius
11222 (zero curvature), for example, in case of flat face.
11225 curvature_1 = geompy.CurvatureOnFace(Face_1, Vertex_1, OX)
11227 aVec = self.MeasuOp.SurfaceCurvatureByPointAndDirection(theSurf,thePoint,theDirection)
11228 if self.MeasuOp.GetErrorCode() != "ZERO_CURVATURE":
11229 RaiseIfFailed("CurvatureOnFace", self.MeasuOp)
11230 self._autoPublish(aVec, theName, "curvature")
11233 ## Get min and max tolerances of sub-shapes of theShape
11234 # @param theShape Shape, to get tolerances of.
11235 # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]\n
11236 # FaceMin,FaceMax: Min and max tolerances of the faces.\n
11237 # EdgeMin,EdgeMax: Min and max tolerances of the edges.\n
11238 # VertMin,VertMax: Min and max tolerances of the vertices.
11240 # @ref tui_tolerance_page "Example"
11241 @ManageTransactions("MeasuOp")
11242 def Tolerance(self,theShape):
11244 Get min and max tolerances of sub-shapes of theShape
11247 theShape Shape, to get tolerances of.
11250 [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
11251 FaceMin,FaceMax: Min and max tolerances of the faces.
11252 EdgeMin,EdgeMax: Min and max tolerances of the edges.
11253 VertMin,VertMax: Min and max tolerances of the vertices.
11255 # Example: see GEOM_TestMeasures.py
11256 aTuple = self.MeasuOp.GetTolerance(theShape)
11257 RaiseIfFailed("GetTolerance", self.MeasuOp)
11260 ## Obtain description of the given shape (number of sub-shapes of each type)
11261 # @param theShape Shape to be described.
11262 # @return Description of the given shape.
11264 # @ref tui_whatis_page "Example"
11265 @ManageTransactions("MeasuOp")
11266 def WhatIs(self,theShape):
11268 Obtain description of the given shape (number of sub-shapes of each type)
11271 theShape Shape to be described.
11274 Description of the given shape.
11276 # Example: see GEOM_TestMeasures.py
11277 aDescr = self.MeasuOp.WhatIs(theShape)
11278 RaiseIfFailed("WhatIs", self.MeasuOp)
11281 ## Obtain quantity of shapes of the given type in \a theShape.
11282 # If \a theShape is of type \a theType, it is also counted.
11283 # @param theShape Shape to be described.
11284 # @param theType the given ShapeType().
11285 # @return Quantity of shapes of type \a theType in \a theShape.
11287 # @ref tui_measurement_tools_page "Example"
11288 def NbShapes (self, theShape, theType):
11290 Obtain quantity of shapes of the given type in theShape.
11291 If theShape is of type theType, it is also counted.
11294 theShape Shape to be described.
11295 theType the given geompy.ShapeType
11298 Quantity of shapes of type theType in theShape.
11300 # Example: see GEOM_TestMeasures.py
11301 listSh = self.SubShapeAllIDs(theShape, theType)
11305 ## Obtain quantity of shapes of each type in \a theShape.
11306 # The \a theShape is also counted.
11307 # @param theShape Shape to be described.
11308 # @return Dictionary of ShapeType() with bound quantities of shapes.
11310 # @ref tui_measurement_tools_page "Example"
11311 def ShapeInfo (self, theShape):
11313 Obtain quantity of shapes of each type in theShape.
11314 The theShape is also counted.
11317 theShape Shape to be described.
11320 Dictionary of geompy.ShapeType with bound quantities of shapes.
11322 # Example: see GEOM_TestMeasures.py
11324 for typeSh in self.ShapeType:
11325 if typeSh in ( "AUTO", "SHAPE" ): continue
11326 listSh = self.SubShapeAllIDs(theShape, self.ShapeType[typeSh])
11332 def GetCreationInformation(self, theShape):
11334 infos = theShape.GetCreationInformation()
11337 opName = info.operationName
11338 if not opName: opName = "no info available"
11339 if res: res += "\n"
11340 res += "Operation: " + opName
11342 for parVal in info.params:
11343 res += "\n \t%s = %s" % ( parVal.name, parVal.value )
11346 ## Get a point, situated at the centre of mass of theShape.
11347 # @param theShape Shape to define centre of mass of.
11348 # @param theName Object name; when specified, this parameter is used
11349 # for result publication in the study. Otherwise, if automatic
11350 # publication is switched on, default value is used for result name.
11352 # @return New GEOM.GEOM_Object, containing the created point.
11354 # @ref tui_center_of_mass_page "Example"
11355 @ManageTransactions("MeasuOp")
11356 def MakeCDG(self, theShape, theName=None):
11358 Get a point, situated at the centre of mass of theShape.
11361 theShape Shape to define centre of mass of.
11362 theName Object name; when specified, this parameter is used
11363 for result publication in the study. Otherwise, if automatic
11364 publication is switched on, default value is used for result name.
11367 New GEOM.GEOM_Object, containing the created point.
11369 # Example: see GEOM_TestMeasures.py
11370 anObj = self.MeasuOp.GetCentreOfMass(theShape)
11371 RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
11372 self._autoPublish(anObj, theName, "centerOfMass")
11375 ## Get a vertex sub-shape by index.
11376 # @param theShape Shape to find sub-shape.
11377 # @param theIndex Index to find vertex by this index (starting from zero)
11378 # @param theUseOri To consider edge/wire orientation or not
11379 # @param theName Object name; when specified, this parameter is used
11380 # for result publication in the study. Otherwise, if automatic
11381 # publication is switched on, default value is used for result name.
11383 # @return New GEOM.GEOM_Object, containing the created vertex.
11385 # @ref tui_measurement_tools_page "Example"
11386 @ManageTransactions("MeasuOp")
11387 def GetVertexByIndex(self, theShape, theIndex, theUseOri=True, theName=None):
11389 Get a vertex sub-shape by index.
11392 theShape Shape to find sub-shape.
11393 theIndex Index to find vertex by this index (starting from zero)
11394 theUseOri To consider edge/wire orientation or not
11395 theName Object name; when specified, this parameter is used
11396 for result publication in the study. Otherwise, if automatic
11397 publication is switched on, default value is used for result name.
11400 New GEOM.GEOM_Object, containing the created vertex.
11402 # Example: see GEOM_TestMeasures.py
11403 if isinstance( theUseOri, str ): # theUseOri was inserted before theName
11404 theUseOri, theName = True, theUseOri
11405 anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex, theUseOri)
11406 RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
11407 self._autoPublish(anObj, theName, "vertex")
11410 ## Get the first vertex of wire/edge depended orientation.
11411 # @param theShape Shape to find first vertex.
11412 # @param theName Object name; when specified, this parameter is used
11413 # for result publication in the study. Otherwise, if automatic
11414 # publication is switched on, default value is used for result name.
11416 # @return New GEOM.GEOM_Object, containing the created vertex.
11418 # @ref tui_measurement_tools_page "Example"
11419 def GetFirstVertex(self, theShape, theName=None):
11421 Get the first vertex of wire/edge depended orientation.
11424 theShape Shape to find first vertex.
11425 theName Object name; when specified, this parameter is used
11426 for result publication in the study. Otherwise, if automatic
11427 publication is switched on, default value is used for result name.
11430 New GEOM.GEOM_Object, containing the created vertex.
11432 # Example: see GEOM_TestMeasures.py
11433 # note: auto-publishing is done in self.GetVertexByIndex()
11434 return self.GetVertexByIndex(theShape, 0, True, theName)
11436 ## Get the last vertex of wire/edge depended orientation.
11437 # @param theShape Shape to find last vertex.
11438 # @param theName Object name; when specified, this parameter is used
11439 # for result publication in the study. Otherwise, if automatic
11440 # publication is switched on, default value is used for result name.
11442 # @return New GEOM.GEOM_Object, containing the created vertex.
11444 # @ref tui_measurement_tools_page "Example"
11445 def GetLastVertex(self, theShape, theName=None):
11447 Get the last vertex of wire/edge depended orientation.
11450 theShape Shape to find last vertex.
11451 theName Object name; when specified, this parameter is used
11452 for result publication in the study. Otherwise, if automatic
11453 publication is switched on, default value is used for result name.
11456 New GEOM.GEOM_Object, containing the created vertex.
11458 # Example: see GEOM_TestMeasures.py
11459 nb_vert = self.NumberOfSubShapes(theShape, self.ShapeType["VERTEX"])
11460 # note: auto-publishing is done in self.GetVertexByIndex()
11461 return self.GetVertexByIndex(theShape, (nb_vert-1), True, theName)
11463 ## Get a normale to the given face. If the point is not given,
11464 # the normale is calculated at the center of mass.
11465 # @param theFace Face to define normale of.
11466 # @param theOptionalPoint Point to compute the normale at.
11467 # @param theName Object name; when specified, this parameter is used
11468 # for result publication in the study. Otherwise, if automatic
11469 # publication is switched on, default value is used for result name.
11471 # @return New GEOM.GEOM_Object, containing the created vector.
11473 # @ref swig_todo "Example"
11474 @ManageTransactions("MeasuOp")
11475 def GetNormal(self, theFace, theOptionalPoint = None, theName=None):
11477 Get a normale to the given face. If the point is not given,
11478 the normale is calculated at the center of mass.
11481 theFace Face to define normale of.
11482 theOptionalPoint Point to compute the normale at.
11483 theName Object name; when specified, this parameter is used
11484 for result publication in the study. Otherwise, if automatic
11485 publication is switched on, default value is used for result name.
11488 New GEOM.GEOM_Object, containing the created vector.
11490 # Example: see GEOM_TestMeasures.py
11491 anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
11492 RaiseIfFailed("GetNormal", self.MeasuOp)
11493 self._autoPublish(anObj, theName, "normal")
11496 ## Print shape errors obtained from CheckShape.
11497 # @param theShape Shape that was checked.
11498 # @param theShapeErrors the shape errors obtained by CheckShape.
11499 # @param theReturnStatus If 0 the description of problem is printed.
11500 # If 1 the description of problem is returned.
11501 # @return If theReturnStatus is equal to 1 the description is returned.
11502 # Otherwise doesn't return anything.
11504 # @ref tui_check_shape_page "Example"
11505 @ManageTransactions("MeasuOp")
11506 def PrintShapeErrors(self, theShape, theShapeErrors, theReturnStatus = 0):
11508 Print shape errors obtained from CheckShape.
11511 theShape Shape that was checked.
11512 theShapeErrors the shape errors obtained by CheckShape.
11513 theReturnStatus If 0 the description of problem is printed.
11514 If 1 the description of problem is returned.
11517 If theReturnStatus is equal to 1 the description is returned.
11518 Otherwise doesn't return anything.
11520 # Example: see GEOM_TestMeasures.py
11521 Descr = self.MeasuOp.PrintShapeErrors(theShape, theShapeErrors)
11522 if theReturnStatus == 1:
11527 ## Check a topology of the given shape.
11528 # @param theShape Shape to check validity of.
11529 # @param theIsCheckGeom If FALSE, only the shape's topology will be checked, \n
11530 # if TRUE, the shape's geometry will be checked also.
11531 # @param theReturnStatus If 0 and if theShape is invalid, a description
11532 # of problem is printed.
11533 # If 1 isValid flag and the description of
11534 # problem is returned.
11535 # If 2 isValid flag and the list of error data
11537 # @return TRUE, if the shape "seems to be valid".
11538 # If theShape is invalid, prints a description of problem.
11539 # If theReturnStatus is equal to 1 the description is returned
11540 # along with IsValid flag.
11541 # If theReturnStatus is equal to 2 the list of error data is
11542 # returned along with IsValid flag.
11544 # @ref tui_check_shape_page "Example"
11545 @ManageTransactions("MeasuOp")
11546 def CheckShape(self,theShape, theIsCheckGeom = 0, theReturnStatus = 0):
11548 Check a topology of the given shape.
11551 theShape Shape to check validity of.
11552 theIsCheckGeom If FALSE, only the shape's topology will be checked,
11553 if TRUE, the shape's geometry will be checked also.
11554 theReturnStatus If 0 and if theShape is invalid, a description
11555 of problem is printed.
11556 If 1 IsValid flag and the description of
11557 problem is returned.
11558 If 2 IsValid flag and the list of error data
11562 TRUE, if the shape "seems to be valid".
11563 If theShape is invalid, prints a description of problem.
11564 If theReturnStatus is equal to 1 the description is returned
11565 along with IsValid flag.
11566 If theReturnStatus is equal to 2 the list of error data is
11567 returned along with IsValid flag.
11569 # Example: see GEOM_TestMeasures.py
11571 (IsValid, ShapeErrors) = self.MeasuOp.CheckShapeWithGeometry(theShape)
11572 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
11574 (IsValid, ShapeErrors) = self.MeasuOp.CheckShape(theShape)
11575 RaiseIfFailed("CheckShape", self.MeasuOp)
11577 if theReturnStatus == 0:
11578 Descr = self.MeasuOp.PrintShapeErrors(theShape, ShapeErrors)
11580 if theReturnStatus == 1:
11581 Descr = self.MeasuOp.PrintShapeErrors(theShape, ShapeErrors)
11582 return (IsValid, Descr)
11583 elif theReturnStatus == 2:
11584 return (IsValid, ShapeErrors)
11587 ## Detect self-intersections in the given shape.
11588 # @param theShape Shape to check.
11589 # @param theCheckLevel is the level of self-intersection check.
11590 # Possible input values are:
11591 # - GEOM.SI_V_V(0) - only V/V interferences
11592 # - GEOM.SI_V_E(1) - V/V and V/E interferences
11593 # - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
11594 # - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
11595 # - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
11596 # - GEOM.SI_ALL(5) - all interferences.
11597 # @return TRUE, if the shape contains no self-intersections.
11599 # @ref tui_check_self_intersections_page "Example"
11600 @ManageTransactions("MeasuOp")
11601 def CheckSelfIntersections(self, theShape, theCheckLevel = GEOM.SI_ALL):
11603 Detect self-intersections in the given shape.
11606 theShape Shape to check.
11607 theCheckLevel is the level of self-intersection check.
11608 Possible input values are:
11609 - GEOM.SI_V_V(0) - only V/V interferences
11610 - GEOM.SI_V_E(1) - V/V and V/E interferences
11611 - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
11612 - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
11613 - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
11614 - GEOM.SI_ALL(5) - all interferences.
11617 TRUE, if the shape contains no self-intersections.
11619 # Example: see GEOM_TestMeasures.py
11620 (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersections(theShape, EnumToLong(theCheckLevel))
11621 RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
11624 ## Detect self-intersections of the given shape with algorithm based on mesh intersections.
11625 # @param theShape Shape to check.
11626 # @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
11627 # - if \a theDeflection <= 0, default deflection 0.001 is used
11628 # @param theTolerance Specifies a distance between sub-shapes used for detecting gaps:
11629 # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
11630 # - if \a theTolerance > 0, algorithm detects gaps
11631 # @return TRUE, if the shape contains no self-intersections.
11633 # @ref tui_check_self_intersections_fast_page "Example"
11634 @ManageTransactions("MeasuOp")
11635 def CheckSelfIntersectionsFast(self, theShape, theDeflection = 0.001, theTolerance = 0.0):
11637 Detect self-intersections of the given shape with algorithm based on mesh intersections.
11640 theShape Shape to check.
11641 theDeflection Linear deflection coefficient that specifies quality of tessellation:
11642 - if theDeflection <= 0, default deflection 0.001 is used
11643 theTolerance Specifies a distance between shapes used for detecting gaps:
11644 - if theTolerance <= 0, algorithm detects intersections (default behavior)
11645 - if theTolerance > 0, algorithm detects gaps
11648 TRUE, if the shape contains no self-intersections.
11650 # Example: see GEOM_TestMeasures.py
11651 (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance)
11652 RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
11655 ## Check boolean and partition operations arguments.
11656 # @param theShape the argument of an operation to be checked
11657 # @return TRUE if the argument is valid for a boolean or partition
11658 # operation; FALSE otherwise.
11659 @ManageTransactions("MeasuOp")
11660 def CheckBOPArguments(self, theShape):
11662 Check boolean and partition operations arguments.
11665 theShape the argument of an operation to be checked
11668 TRUE if the argument is valid for a boolean or partition
11669 operation; FALSE otherwise.
11671 return self.MeasuOp.CheckBOPArguments(theShape)
11673 ## Detect intersections of the given shapes with algorithm based on mesh intersections.
11674 # @param theShape1 First source object
11675 # @param theShape2 Second source object
11676 # @param theTolerance Specifies a distance between shapes used for detecting gaps:
11677 # - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
11678 # - if \a theTolerance > 0, algorithm detects gaps
11679 # @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
11680 # - if \a theDeflection <= 0, default deflection 0.001 is used
11681 # @return TRUE, if there are intersections (gaps) between source shapes
11682 # @return List of sub-shapes IDs from 1st shape that localize intersection.
11683 # @return List of sub-shapes IDs from 2nd shape that localize intersection.
11685 # @ref tui_fast_intersection_page "Example"
11686 @ManageTransactions("MeasuOp")
11687 def FastIntersect(self, theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001):
11689 Detect intersections of the given shapes with algorithm based on mesh intersections.
11692 theShape1 First source object
11693 theShape2 Second source object
11694 theTolerance Specifies a distance between shapes used for detecting gaps:
11695 - if theTolerance <= 0, algorithm detects intersections (default behavior)
11696 - if theTolerance > 0, algorithm detects gaps
11697 theDeflection Linear deflection coefficient that specifies quality of tessellation:
11698 - if theDeflection <= 0, default deflection 0.001 is used
11701 TRUE, if there are intersections (gaps) between source shapes
11702 List of sub-shapes IDs from 1st shape that localize intersection.
11703 List of sub-shapes IDs from 2nd shape that localize intersection.
11705 # Example: see GEOM_TestMeasures.py
11706 IsOk, Res1, Res2 = self.MeasuOp.FastIntersect(theShape1, theShape2, theTolerance, theDeflection)
11707 RaiseIfFailed("FastIntersect", self.MeasuOp)
11708 return IsOk, Res1, Res2
11710 ## Get position (LCS) of theShape.
11712 # Origin of the LCS is situated at the shape's center of mass.
11713 # Axes of the LCS are obtained from shape's location or,
11714 # if the shape is a planar face, from position of its plane.
11716 # @param theShape Shape to calculate position of.
11717 # @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
11718 # Ox,Oy,Oz: Coordinates of shape's LCS origin.
11719 # Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
11720 # Xx,Xy,Xz: Coordinates of shape's LCS X direction.
11722 # @ref swig_todo "Example"
11723 @ManageTransactions("MeasuOp")
11724 def GetPosition(self,theShape):
11726 Get position (LCS) of theShape.
11727 Origin of the LCS is situated at the shape's center of mass.
11728 Axes of the LCS are obtained from shape's location or,
11729 if the shape is a planar face, from position of its plane.
11732 theShape Shape to calculate position of.
11735 [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
11736 Ox,Oy,Oz: Coordinates of shape's LCS origin.
11737 Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
11738 Xx,Xy,Xz: Coordinates of shape's LCS X direction.
11740 # Example: see GEOM_TestMeasures.py
11741 aTuple = self.MeasuOp.GetPosition(theShape)
11742 RaiseIfFailed("GetPosition", self.MeasuOp)
11745 ## Get kind of theShape.
11747 # @param theShape Shape to get a kind of.
11748 # @return Returns a kind of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
11749 # and a list of parameters, describing the shape.
11750 # @note Concrete meaning of each value, returned via \a theIntegers
11751 # or \a theDoubles list depends on the kind() of the shape.
11753 # @ref swig_todo "Example"
11754 @ManageTransactions("MeasuOp")
11755 def KindOfShape(self,theShape):
11757 Get kind of theShape.
11760 theShape Shape to get a kind of.
11763 a kind of shape in terms of GEOM_IKindOfShape.shape_kind enumeration
11764 and a list of parameters, describing the shape.
11766 Concrete meaning of each value, returned via theIntegers
11767 or theDoubles list depends on the geompy.kind of the shape
11769 # Example: see GEOM_TestMeasures.py
11770 aRoughTuple = self.MeasuOp.KindOfShape(theShape)
11771 RaiseIfFailed("KindOfShape", self.MeasuOp)
11773 aKind = aRoughTuple[0]
11774 anInts = aRoughTuple[1]
11775 aDbls = aRoughTuple[2]
11777 # Now there is no exception from this rule:
11778 aKindTuple = [aKind] + aDbls + anInts
11780 # If they are we will regroup parameters for such kind of shape.
11782 #if aKind == kind.SOME_KIND:
11783 # # SOME_KIND int int double int double double
11784 # aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
11788 ## The function takes a single face with holes and returns a list of faces,
11789 # first of them is the original face without holes, and the other faces are placed
11790 # on the same surface as the original face but bounded by each hole wire.
11791 # If the original face has no holes, it will be returned as an output
11792 # @param theShape Face to perform operation on.
11794 # @return GEOM.ListOfGO, list created faces, where first of them is the original face without holes
11795 @ManageTransactions("MeasuOp")
11796 def PatchFace(self, theShape):
11798 The function takes a single face with holes and returns a list of faces,
11799 first of them is the original face without holes, and the other faces are placed
11800 on the same surface as the original face but bounded by each hole wire.
11801 If the original face has no holes, it will be returned as an output
11804 theShape Face to perform operation on.
11807 GEOM.ListOfGO, list created faces, where first of them is the original face without holes
11810 Circle_1 = geompy.MakeCircle(None, None, 190)
11811 Circle_2 = geompy.MakeCircle(None, None, 100)
11812 Face_1 = geompy.MakeFaceWires([Circle_1], 1)
11813 Face_2 = geompy.MakeFaceWires([Circle_2], 1)
11814 Cut_1 = geompy.MakeCutList(Face_1, [Face_2], True)
11815 faces = geompy.PatchFace(Cut_1)
11817 aList = self.MeasuOp.PatchFace(theShape)
11818 RaiseIfFailed("PatchFace", self.MeasuOp)
11821 ## Returns the string that describes if the shell is good for solid.
11822 # This is a support method for MakeSolid.
11824 # @param theShell the shell to be checked.
11825 # @return Returns a string that describes the shell validity for
11826 # solid construction.
11827 @ManageTransactions("MeasuOp")
11828 def _IsGoodForSolid(self, theShell):
11830 Returns the string that describes if the shell is good for solid.
11831 This is a support method for MakeSolid.
11834 theShell the shell to be checked.
11837 Returns a string that describes the shell validity for
11838 solid construction.
11840 aDescr = self.MeasuOp.IsGoodForSolid(theShell)
11843 ## Obtain a canonical recognition interface.
11844 # @return An instance of
11845 # @ref canonicalrecognition.CanonicalRecognition "CanonicalRecognition" interface
11847 # @ref tui_3dsketcher_page "Example"
11848 def CanonicalRecognition (self):
11850 Obtain a canonical recognition interface.
11853 cr = geompy.CanonicalRecognition()
11854 cr.isLine(aLine, tolerance)
11856 cr = CanonicalRecognition (self)
11859 # end of l2_measure
11862 ## @addtogroup l2_import_export
11865 ## Import a shape from the BREP, IGES, STEP or other file
11866 # (depends on given format) with given name.
11868 # Note: this function is deprecated, it is kept for backward compatibility only
11869 # Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
11871 # @param theFileName The file, containing the shape.
11872 # @param theFormatName Specify format for the file reading.
11873 # Available formats can be obtained with InsertOp.ImportTranslators() method.
11874 # If format 'IGES_SCALE' is used instead of 'IGES' or
11875 # format 'STEP_SCALE' is used instead of 'STEP',
11876 # length unit will be set to 'meter' and result model will be scaled.
11877 # @param theName Object name; when specified, this parameter is used
11878 # for result publication in the study. Otherwise, if automatic
11879 # publication is switched on, default value is used for result name.
11881 # @return New GEOM.GEOM_Object, containing the imported shape.
11882 # If material names are imported it returns the list of
11883 # objects. The first one is the imported object followed by
11885 # @note Auto publishing is allowed for the shape itself. Imported
11886 # material groups are not automatically published.
11888 # @ref swig_Import_Export "Example"
11889 @ManageTransactions("InsertOp")
11890 def ImportFile(self, theFileName, theFormatName, theName=None):
11892 Import a shape from the BREP, IGES, STEP or other file
11893 (depends on given format) with given name.
11895 Note: this function is deprecated, it is kept for backward compatibility only
11896 Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
11899 theFileName The file, containing the shape.
11900 theFormatName Specify format for the file reading.
11901 Available formats can be obtained with geompy.InsertOp.ImportTranslators() method.
11902 If format 'IGES_SCALE' is used instead of 'IGES' or
11903 format 'STEP_SCALE' is used instead of 'STEP',
11904 length unit will be set to 'meter' and result model will be scaled.
11905 theName Object name; when specified, this parameter is used
11906 for result publication in the study. Otherwise, if automatic
11907 publication is switched on, default value is used for result name.
11910 New GEOM.GEOM_Object, containing the imported shape.
11911 If material names are imported it returns the list of
11912 objects. The first one is the imported object followed by
11915 Auto publishing is allowed for the shape itself. Imported
11916 material groups are not automatically published.
11918 # Example: see GEOM_TestOthers.py
11920 WARNING: Function ImportFile is deprecated, use Import<FormatName> instead,
11921 where <FormatName> is a name of desirable format for importing.
11923 aListObj = self.InsertOp.ImportFile(theFileName, theFormatName)
11924 RaiseIfFailed("ImportFile", self.InsertOp)
11925 aNbObj = len(aListObj)
11927 self._autoPublish(aListObj[0], theName, "imported")
11932 ## Deprecated analog of ImportFile()
11933 def Import(self, theFileName, theFormatName, theName=None):
11935 Deprecated analog of geompy.ImportFile, kept for backward compatibility only.
11937 # note: auto-publishing is done in self.ImportFile()
11938 return self.ImportFile(theFileName, theFormatName, theName)
11940 ## Read a shape from the binary stream, containing its bounding representation (BRep).
11942 # @note As the byte-stream representing the shape data can be quite large, this method
11943 # is not automatically dumped to the Python script with the DumpStudy functionality;
11944 # so please use this method carefully, only for strong reasons.
11946 # @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's
11949 # @param theStream The BRep binary stream.
11950 # @param theName Object name; when specified, this parameter is used
11951 # for result publication in the study. Otherwise, if automatic
11952 # publication is switched on, default value is used for result name.
11954 # @return New GEOM_Object, containing the shape, read from theStream.
11956 # @ref swig_Import_Export "Example"
11957 @ManageTransactions("InsertOp")
11958 def RestoreShape (self, theStream, theName=None):
11960 Read a shape from the binary stream, containing its bounding representation (BRep).
11963 shape.GetShapeStream() method can be used to obtain the shape's BRep stream.
11966 theStream The BRep binary stream.
11967 theName Object name; when specified, this parameter is used
11968 for result publication in the study. Otherwise, if automatic
11969 publication is switched on, default value is used for result name.
11972 New GEOM_Object, containing the shape, read from theStream.
11974 # Example: see GEOM_TestOthers.py
11976 # this is the workaround to ignore invalid case when data stream is empty
11977 if int(os.getenv("GEOM_IGNORE_RESTORE_SHAPE", "0")) > 0:
11978 print("WARNING: Result of RestoreShape is a NULL shape!")
11980 anObj = self.InsertOp.RestoreShape(theStream)
11981 RaiseIfFailed("RestoreShape", self.InsertOp)
11982 self._autoPublish(anObj, theName, "restored")
11985 ## Export the given shape into a file with given name.
11987 # Note: this function is deprecated, it is kept for backward compatibility only
11988 # Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
11990 # @param theObject Shape to be stored in the file.
11991 # @param theFileName Name of the file to store the given shape in.
11992 # @param theFormatName Specify format for the shape storage.
11993 # Available formats can be obtained with
11994 # geompy.InsertOp.ExportTranslators()[0] method.
11996 # @ref swig_Import_Export "Example"
11997 @ManageTransactions("InsertOp")
11998 def Export(self, theObject, theFileName, theFormatName):
12000 Export the given shape into a file with given name.
12002 Note: this function is deprecated, it is kept for backward compatibility only
12003 Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
12006 theObject Shape to be stored in the file.
12007 theFileName Name of the file to store the given shape in.
12008 theFormatName Specify format for the shape storage.
12009 Available formats can be obtained with
12010 geompy.InsertOp.ExportTranslators()[0] method.
12012 # Example: see GEOM_TestOthers.py
12014 WARNING: Function Export is deprecated, use Export<FormatName> instead,
12015 where <FormatName> is a name of desirable format for exporting.
12017 self.InsertOp.Export(theObject, theFileName, theFormatName)
12018 if self.InsertOp.IsDone() == 0:
12019 raise RuntimeError("Export : " + self.InsertOp.GetErrorCode())
12023 # end of l2_import_export
12026 ## @addtogroup l3_blocks
12029 ## Create a quadrangle face from four edges. Order of Edges is not
12030 # important. It is not necessary that edges share the same vertex.
12031 # @param E1,E2,E3,E4 Edges for the face bound.
12032 # @param theName Object name; when specified, this parameter is used
12033 # for result publication in the study. Otherwise, if automatic
12034 # publication is switched on, default value is used for result name.
12036 # @return New GEOM.GEOM_Object, containing the created face.
12038 # @ref tui_building_by_blocks_page "Example"
12039 @ManageTransactions("BlocksOp")
12040 def MakeQuad(self, E1, E2, E3, E4, theName=None):
12042 Create a quadrangle face from four edges. Order of Edges is not
12043 important. It is not necessary that edges share the same vertex.
12046 E1,E2,E3,E4 Edges for the face bound.
12047 theName Object name; when specified, this parameter is used
12048 for result publication in the study. Otherwise, if automatic
12049 publication is switched on, default value is used for result name.
12052 New GEOM.GEOM_Object, containing the created face.
12055 qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
12057 # Example: see GEOM_Spanner.py
12058 anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
12059 RaiseIfFailed("MakeQuad", self.BlocksOp)
12060 self._autoPublish(anObj, theName, "quad")
12063 ## Create a quadrangle face on two edges.
12064 # The missing edges will be built by creating the shortest ones.
12065 # @param E1,E2 Two opposite edges for the face.
12066 # @param theName Object name; when specified, this parameter is used
12067 # for result publication in the study. Otherwise, if automatic
12068 # publication is switched on, default value is used for result name.
12070 # @return New GEOM.GEOM_Object, containing the created face.
12072 # @ref tui_building_by_blocks_page "Example"
12073 @ManageTransactions("BlocksOp")
12074 def MakeQuad2Edges(self, E1, E2, theName=None):
12076 Create a quadrangle face on two edges.
12077 The missing edges will be built by creating the shortest ones.
12080 E1,E2 Two opposite edges for the face.
12081 theName Object name; when specified, this parameter is used
12082 for result publication in the study. Otherwise, if automatic
12083 publication is switched on, default value is used for result name.
12086 New GEOM.GEOM_Object, containing the created face.
12090 p1 = geompy.MakeVertex( 0., 0., 0.)
12091 p2 = geompy.MakeVertex(150., 30., 0.)
12092 p3 = geompy.MakeVertex( 0., 120., 50.)
12093 p4 = geompy.MakeVertex( 0., 40., 70.)
12095 edge1 = geompy.MakeEdge(p1, p2)
12096 edge2 = geompy.MakeEdge(p3, p4)
12097 # create a quadrangle face from two edges
12098 qface2 = geompy.MakeQuad2Edges(edge1, edge2)
12100 # Example: see GEOM_Spanner.py
12101 anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
12102 RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
12103 self._autoPublish(anObj, theName, "quad")
12106 ## Create a quadrangle face with specified corners.
12107 # The missing edges will be built by creating the shortest ones.
12108 # @param V1,V2,V3,V4 Corner vertices for the face.
12109 # @param theName Object name; when specified, this parameter is used
12110 # for result publication in the study. Otherwise, if automatic
12111 # publication is switched on, default value is used for result name.
12113 # @return New GEOM.GEOM_Object, containing the created face.
12115 # @ref tui_building_by_blocks_page "Example 1"
12116 # \n @ref swig_MakeQuad4Vertices "Example 2"
12117 @ManageTransactions("BlocksOp")
12118 def MakeQuad4Vertices(self, V1, V2, V3, V4, theName=None):
12120 Create a quadrangle face with specified corners.
12121 The missing edges will be built by creating the shortest ones.
12124 V1,V2,V3,V4 Corner vertices for the face.
12125 theName Object name; when specified, this parameter is used
12126 for result publication in the study. Otherwise, if automatic
12127 publication is switched on, default value is used for result name.
12130 New GEOM.GEOM_Object, containing the created face.
12134 p1 = geompy.MakeVertex( 0., 0., 0.)
12135 p2 = geompy.MakeVertex(150., 30., 0.)
12136 p3 = geompy.MakeVertex( 0., 120., 50.)
12137 p4 = geompy.MakeVertex( 0., 40., 70.)
12138 # create a quadrangle from four points in its corners
12139 qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
12141 # Example: see GEOM_Spanner.py
12142 anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
12143 RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
12144 self._autoPublish(anObj, theName, "quad")
12147 ## Create a hexahedral solid, bounded by the six given faces. Order of
12148 # faces is not important. It is not necessary that Faces share the same edge.
12149 # @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
12150 # @param 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.
12154 # @return New GEOM.GEOM_Object, containing the created solid.
12156 # @ref tui_building_by_blocks_page "Example 1"
12157 # \n @ref swig_MakeHexa "Example 2"
12158 @ManageTransactions("BlocksOp")
12159 def MakeHexa(self, F1, F2, F3, F4, F5, F6, theName=None):
12161 Create a hexahedral solid, bounded by the six given faces. Order of
12162 faces is not important. It is not necessary that Faces share the same edge.
12165 F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
12166 theName Object name; when specified, this parameter is used
12167 for result publication in the study. Otherwise, if automatic
12168 publication is switched on, default value is used for result name.
12171 New GEOM.GEOM_Object, containing the created solid.
12174 solid = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
12176 # Example: see GEOM_Spanner.py
12177 anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
12178 RaiseIfFailed("MakeHexa", self.BlocksOp)
12179 self._autoPublish(anObj, theName, "hexa")
12182 ## Create a hexahedral solid between two given faces.
12183 # The missing faces will be built by creating the smallest ones.
12184 # @param F1,F2 Two opposite faces for the hexahedral solid.
12185 # @param theName Object name; when specified, this parameter is used
12186 # for result publication in the study. Otherwise, if automatic
12187 # publication is switched on, default value is used for result name.
12189 # @return New GEOM.GEOM_Object, containing the created solid.
12191 # @ref tui_building_by_blocks_page "Example 1"
12192 # \n @ref swig_MakeHexa2Faces "Example 2"
12193 @ManageTransactions("BlocksOp")
12194 def MakeHexa2Faces(self, F1, F2, theName=None):
12196 Create a hexahedral solid between two given faces.
12197 The missing faces will be built by creating the smallest ones.
12200 F1,F2 Two opposite faces for the hexahedral solid.
12201 theName Object name; when specified, this parameter is used
12202 for result publication in the study. Otherwise, if automatic
12203 publication is switched on, default value is used for result name.
12206 New GEOM.GEOM_Object, containing the created solid.
12209 solid1 = geompy.MakeHexa2Faces(qface1, qface2)
12211 # Example: see GEOM_Spanner.py
12212 anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
12213 RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
12214 self._autoPublish(anObj, theName, "hexa")
12220 ## @addtogroup l3_blocks_op
12223 ## Get a vertex, found in the given shape by its coordinates.
12224 # @param theShape Block or a compound of blocks.
12225 # @param theX,theY,theZ Coordinates of the sought vertex.
12226 # @param theEpsilon Maximum allowed distance between the resulting
12227 # vertex and point with the given coordinates.
12228 # @param 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.
12232 # @return New GEOM.GEOM_Object, containing the found vertex.
12234 # @ref swig_GetPoint "Example"
12235 @ManageTransactions("BlocksOp")
12236 def GetPoint(self, theShape, theX, theY, theZ, theEpsilon, theName=None):
12238 Get a vertex, found in the given shape by its coordinates.
12241 theShape Block or a compound of blocks.
12242 theX,theY,theZ Coordinates of the sought vertex.
12243 theEpsilon Maximum allowed distance between the resulting
12244 vertex and point with the given coordinates.
12245 theName Object name; when specified, this parameter is used
12246 for result publication in the study. Otherwise, if automatic
12247 publication is switched on, default value is used for result name.
12250 New GEOM.GEOM_Object, containing the found vertex.
12253 pnt = geompy.GetPoint(shape, -50, 50, 50, 0.01)
12255 # Example: see GEOM_TestOthers.py
12256 anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
12257 RaiseIfFailed("GetPoint", self.BlocksOp)
12258 self._autoPublish(anObj, theName, "vertex")
12261 ## Find a vertex of the given shape, which has minimal distance to the given point.
12262 # @param theShape Any shape.
12263 # @param thePoint Point, close to the desired vertex.
12264 # @param theName Object name; when specified, this parameter is used
12265 # for result publication in the study. Otherwise, if automatic
12266 # publication is switched on, default value is used for result name.
12268 # @return New GEOM.GEOM_Object, containing the found vertex.
12270 # @ref swig_GetVertexNearPoint "Example"
12271 @ManageTransactions("BlocksOp")
12272 def GetVertexNearPoint(self, theShape, thePoint, theName=None):
12274 Find a vertex of the given shape, which has minimal distance to the given point.
12277 theShape Any shape.
12278 thePoint Point, close to the desired vertex.
12279 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.
12284 New GEOM.GEOM_Object, containing the found vertex.
12287 pmidle = geompy.MakeVertex(50, 0, 50)
12288 edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
12290 # Example: see GEOM_TestOthers.py
12291 anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
12292 RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
12293 self._autoPublish(anObj, theName, "vertex")
12296 ## Get an edge, found in the given shape by two given vertices.
12297 # @param theShape Block or a compound of blocks.
12298 # @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
12299 # @param theName Object name; when specified, this parameter is used
12300 # for result publication in the study. Otherwise, if automatic
12301 # publication is switched on, default value is used for result name.
12303 # @return New GEOM.GEOM_Object, containing the found edge.
12305 # @ref swig_GetEdge "Example"
12306 @ManageTransactions("BlocksOp")
12307 def GetEdge(self, theShape, thePoint1, thePoint2, theName=None):
12309 Get an edge, found in the given shape by two given vertices.
12312 theShape Block or a compound of blocks.
12313 thePoint1,thePoint2 Points, close to the ends of the desired edge.
12314 theName Object name; when specified, this parameter is used
12315 for result publication in the study. Otherwise, if automatic
12316 publication is switched on, default value is used for result name.
12319 New GEOM.GEOM_Object, containing the found edge.
12321 # Example: see GEOM_Spanner.py
12322 anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
12323 RaiseIfFailed("GetEdge", self.BlocksOp)
12324 self._autoPublish(anObj, theName, "edge")
12327 ## Find an edge of the given shape, which has minimal distance to the given point.
12328 # @param theShape Block or a compound of blocks.
12329 # @param thePoint Point, close to the desired edge.
12330 # @param theName Object name; when specified, this parameter is used
12331 # for result publication in the study. Otherwise, if automatic
12332 # publication is switched on, default value is used for result name.
12334 # @return New GEOM.GEOM_Object, containing the found edge.
12336 # @ref swig_GetEdgeNearPoint "Example"
12337 @ManageTransactions("BlocksOp")
12338 def GetEdgeNearPoint(self, theShape, thePoint, theName=None):
12340 Find an edge of the given shape, which has minimal distance to the given point.
12343 theShape Block or a compound of blocks.
12344 thePoint Point, close to the desired edge.
12345 theName Object name; when specified, this parameter is used
12346 for result publication in the study. Otherwise, if automatic
12347 publication is switched on, default value is used for result name.
12350 New GEOM.GEOM_Object, containing the found edge.
12352 # Example: see GEOM_TestOthers.py
12353 anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
12354 RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
12355 self._autoPublish(anObj, theName, "edge")
12358 ## Returns a face, found in the given shape by four given corner vertices.
12359 # @param theShape Block or a compound of blocks.
12360 # @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
12361 # @param theName Object name; when specified, this parameter is used
12362 # for result publication in the study. Otherwise, if automatic
12363 # publication is switched on, default value is used for result name.
12365 # @return New GEOM.GEOM_Object, containing the found face.
12367 # @ref swig_todo "Example"
12368 @ManageTransactions("BlocksOp")
12369 def GetFaceByPoints(self, theShape, thePoint1, thePoint2, thePoint3, thePoint4, theName=None):
12371 Returns a face, found in the given shape by four given corner vertices.
12374 theShape Block or a compound of blocks.
12375 thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
12376 theName Object name; when specified, this parameter is used
12377 for result publication in the study. Otherwise, if automatic
12378 publication is switched on, default value is used for result name.
12381 New GEOM.GEOM_Object, containing the found face.
12383 # Example: see GEOM_Spanner.py
12384 anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
12385 RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
12386 self._autoPublish(anObj, theName, "face")
12389 ## Get a face of block, found in the given shape by two given edges.
12390 # @param theShape Block or a compound of blocks.
12391 # @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
12392 # @param theName Object name; when specified, this parameter is used
12393 # for result publication in the study. Otherwise, if automatic
12394 # publication is switched on, default value is used for result name.
12396 # @return New GEOM.GEOM_Object, containing the found face.
12398 # @ref swig_todo "Example"
12399 @ManageTransactions("BlocksOp")
12400 def GetFaceByEdges(self, theShape, theEdge1, theEdge2, theName=None):
12402 Get a face of block, found in the given shape by two given edges.
12405 theShape Block or a compound of blocks.
12406 theEdge1,theEdge2 Edges, close to the edges of the desired face.
12407 theName Object name; when specified, this parameter is used
12408 for result publication in the study. Otherwise, if automatic
12409 publication is switched on, default value is used for result name.
12412 New GEOM.GEOM_Object, containing the found face.
12414 # Example: see GEOM_Spanner.py
12415 anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
12416 RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
12417 self._autoPublish(anObj, theName, "face")
12420 ## Find a face, opposite to the given one in the given block.
12421 # @param theBlock Must be a hexahedral solid.
12422 # @param theFace Face of \a theBlock, opposite to the desired face.
12423 # @param theName Object name; when specified, this parameter is used
12424 # for result publication in the study. Otherwise, if automatic
12425 # publication is switched on, default value is used for result name.
12427 # @return New GEOM.GEOM_Object, containing the found face.
12429 # @ref swig_GetOppositeFace "Example"
12430 @ManageTransactions("BlocksOp")
12431 def GetOppositeFace(self, theBlock, theFace, theName=None):
12433 Find a face, opposite to the given one in the given block.
12436 theBlock Must be a hexahedral solid.
12437 theFace Face of theBlock, opposite to the desired face.
12438 theName Object name; when specified, this parameter is used
12439 for result publication in the study. Otherwise, if automatic
12440 publication is switched on, default value is used for result name.
12443 New GEOM.GEOM_Object, containing the found face.
12445 # Example: see GEOM_Spanner.py
12446 anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
12447 RaiseIfFailed("GetOppositeFace", self.BlocksOp)
12448 self._autoPublish(anObj, theName, "face")
12451 ## Find a face of the given shape, which has minimal distance to the given point.
12452 # @param theShape Block or a compound of blocks.
12453 # @param thePoint Point, close to the desired face.
12454 # @param theName Object name; when specified, this parameter is used
12455 # for result publication in the study. Otherwise, if automatic
12456 # publication is switched on, default value is used for result name.
12458 # @return New GEOM.GEOM_Object, containing the found face.
12460 # @ref swig_GetFaceNearPoint "Example"
12461 @ManageTransactions("BlocksOp")
12462 def GetFaceNearPoint(self, theShape, thePoint, theName=None):
12464 Find a face of the given shape, which has minimal distance to the given point.
12467 theShape Block or a compound of blocks.
12468 thePoint Point, close to the desired face.
12469 theName Object name; when specified, this parameter is used
12470 for result publication in the study. Otherwise, if automatic
12471 publication is switched on, default value is used for result name.
12474 New GEOM.GEOM_Object, containing the found face.
12476 # Example: see GEOM_Spanner.py
12477 anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
12478 RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
12479 self._autoPublish(anObj, theName, "face")
12482 ## Find a face of block, whose outside normale has minimal angle with the given vector.
12483 # @param theBlock Block or a compound of blocks.
12484 # @param theVector Vector, close to the normale of the desired face.
12485 # @param theName Object name; when specified, this parameter is used
12486 # for result publication in the study. Otherwise, if automatic
12487 # publication is switched on, default value is used for result name.
12489 # @return New GEOM.GEOM_Object, containing the found face.
12491 # @ref swig_todo "Example"
12492 @ManageTransactions("BlocksOp")
12493 def GetFaceByNormale(self, theBlock, theVector, theName=None):
12495 Find a face of block, whose outside normale has minimal angle with the given vector.
12498 theBlock Block or a compound of blocks.
12499 theVector Vector, close to the normale of the desired face.
12500 theName Object name; when specified, this parameter is used
12501 for result publication in the study. Otherwise, if automatic
12502 publication is switched on, default value is used for result name.
12505 New GEOM.GEOM_Object, containing the found face.
12507 # Example: see GEOM_Spanner.py
12508 anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
12509 RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
12510 self._autoPublish(anObj, theName, "face")
12513 ## Find all sub-shapes of type \a theShapeType of the given shape,
12514 # which have minimal distance to the given point.
12515 # @param theShape Any shape.
12516 # @param thePoint Point, close to the desired shape.
12517 # @param theShapeType Defines what kind of sub-shapes is searched GEOM::shape_type
12518 # @param theTolerance The tolerance for distances comparison. All shapes
12519 # with distances to the given point in interval
12520 # [minimal_distance, minimal_distance + theTolerance] will be gathered.
12521 # @param theName Object name; when specified, this parameter is used
12522 # for result publication in the study. Otherwise, if automatic
12523 # publication is switched on, default value is used for result name.
12525 # @return New GEOM_Object, containing a group of all found shapes.
12527 # @ref swig_GetShapesNearPoint "Example"
12528 @ManageTransactions("BlocksOp")
12529 def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07, theName=None):
12531 Find all sub-shapes of type theShapeType of the given shape,
12532 which have minimal distance to the given point.
12535 theShape Any shape.
12536 thePoint Point, close to the desired shape.
12537 theShapeType Defines what kind of sub-shapes is searched (see GEOM::shape_type)
12538 theTolerance The tolerance for distances comparison. All shapes
12539 with distances to the given point in interval
12540 [minimal_distance, minimal_distance + theTolerance] will be gathered.
12541 theName Object name; when specified, this parameter is used
12542 for result publication in the study. Otherwise, if automatic
12543 publication is switched on, default value is used for result name.
12546 New GEOM_Object, containing a group of all found shapes.
12548 # Example: see GEOM_TestOthers.py
12549 anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
12550 RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
12551 self._autoPublish(anObj, theName, "group")
12554 # end of l3_blocks_op
12557 ## @addtogroup l4_blocks_measure
12560 ## Check, if the compound of blocks is given.
12561 # To be considered as a compound of blocks, the
12562 # given shape must satisfy the following conditions:
12563 # - Each element of the compound should be a Block (6 faces).
12564 # - Each face should be a quadrangle, i.e. it should have only 1 wire
12565 # with 4 edges. If <VAR>theIsUseC1</VAR> is set to True and
12566 # there are more than 4 edges in the only wire of a face,
12567 # this face is considered to be quadrangle if it has 4 bounds
12568 # (1 or more edge) of C1 continuity.
12569 # - A connection between two Blocks should be an entire quadrangle face or an entire edge.
12570 # - The compound should be connexe.
12571 # - The glue between two quadrangle faces should be applied.
12572 # @param theCompound The compound to check.
12573 # @param theIsUseC1 Flag to check if there are 4 bounds on a face
12574 # taking into account C1 continuity.
12575 # @param theAngTolerance the angular tolerance to check if two neighbor
12576 # edges are codirectional in the common vertex with this
12577 # tolerance. This parameter is used only if
12578 # <VAR>theIsUseC1</VAR> is set to True.
12579 # @return TRUE, if the given shape is a compound of blocks.
12580 # If theCompound is not valid, prints all discovered errors.
12582 # @ref tui_check_compound_of_blocks_page "Example 1"
12583 # \n @ref swig_CheckCompoundOfBlocks "Example 2"
12584 @ManageTransactions("BlocksOp")
12585 def CheckCompoundOfBlocks(self,theCompound, theIsUseC1 = False,
12586 theAngTolerance = 1.e-12):
12588 Check, if the compound of blocks is given.
12589 To be considered as a compound of blocks, the
12590 given shape must satisfy the following conditions:
12591 - Each element of the compound should be a Block (6 faces).
12592 - Each face should be a quadrangle, i.e. it should have only 1 wire
12593 with 4 edges. If theIsUseC1 is set to True and
12594 there are more than 4 edges in the only wire of a face,
12595 this face is considered to be quadrangle if it has 4 bounds
12596 (1 or more edge) of C1 continuity.
12597 - A connection between two Blocks should be an entire quadrangle face or an entire edge.
12598 - The compound should be connexe.
12599 - The glue between two quadrangle faces should be applied.
12602 theCompound The compound to check.
12603 theIsUseC1 Flag to check if there are 4 bounds on a face
12604 taking into account C1 continuity.
12605 theAngTolerance the angular tolerance to check if two neighbor
12606 edges are codirectional in the common vertex with this
12607 tolerance. This parameter is used only if
12608 theIsUseC1 is set to True.
12611 TRUE, if the given shape is a compound of blocks.
12612 If theCompound is not valid, prints all discovered errors.
12614 # Example: see GEOM_Spanner.py
12617 aTolerance = theAngTolerance
12618 (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound, aTolerance)
12619 RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
12621 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
12625 ## Retrieve all non blocks solids and faces from \a theShape.
12626 # @param theShape The shape to explore.
12627 # @param theIsUseC1 Flag to check if there are 4 bounds on a face
12628 # taking into account C1 continuity.
12629 # @param theAngTolerance the angular tolerance to check if two neighbor
12630 # edges are codirectional in the common vertex with this
12631 # tolerance. This parameter is used only if
12632 # <VAR>theIsUseC1</VAR> is set to True.
12633 # @param theName Object name; when specified, this parameter is used
12634 # for result publication in the study. Otherwise, if automatic
12635 # publication is switched on, default value is used for result name.
12637 # @return A tuple of two GEOM_Objects. The first object is a group of all
12638 # non block solids (= not 6 faces, or with 6 faces, but with the
12639 # presence of non-quadrangular faces). The second object is a
12640 # group of all non quadrangular faces (= faces with more then
12641 # 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
12642 # with 1 wire with not 4 edges that do not form 4 bounds of
12645 # @ref tui_get_non_blocks_page "Example 1"
12646 # \n @ref swig_GetNonBlocks "Example 2"
12647 @ManageTransactions("BlocksOp")
12648 def GetNonBlocks (self, theShape, theIsUseC1 = False,
12649 theAngTolerance = 1.e-12, theName=None):
12651 Retrieve all non blocks solids and faces from theShape.
12654 theShape The shape to explore.
12655 theIsUseC1 Flag to check if there are 4 bounds on a face
12656 taking into account C1 continuity.
12657 theAngTolerance the angular tolerance to check if two neighbor
12658 edges are codirectional in the common vertex with this
12659 tolerance. This parameter is used only if
12660 theIsUseC1 is set to True.
12661 theName Object name; when specified, this parameter is used
12662 for result publication in the study. Otherwise, if automatic
12663 publication is switched on, default value is used for result name.
12666 A tuple of two GEOM_Objects. The first object is a group of all
12667 non block solids (= not 6 faces, or with 6 faces, but with the
12668 presence of non-quadrangular faces). The second object is a
12669 group of all non quadrangular faces (= faces with more then
12670 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
12671 with 1 wire with not 4 edges that do not form 4 bounds of
12675 (res_sols, res_faces) = geompy.GetNonBlocks(myShape1)
12677 # Example: see GEOM_Spanner.py
12680 aTolerance = theAngTolerance
12681 aTuple = self.BlocksOp.GetNonBlocks(theShape, aTolerance)
12682 RaiseIfFailed("GetNonBlocks", self.BlocksOp)
12683 self._autoPublish(aTuple, theName, ("groupNonHexas", "groupNonQuads"))
12686 ## Remove all seam and degenerated edges from \a theShape.
12687 # Unite faces and edges, sharing one surface. It means that
12688 # this faces must have references to one C++ surface object (handle).
12689 # @param theShape The compound or single solid to remove irregular edges from.
12690 # @param doUnionFaces If True, then unite faces. If False (the default value),
12691 # do not unite faces.
12692 # @param theName Object name; when specified, this parameter is used
12693 # for result publication in the study. Otherwise, if automatic
12694 # publication is switched on, default value is used for result name.
12696 # @return Improved shape.
12698 # @ref swig_RemoveExtraEdges "Example"
12699 @ManageTransactions("BlocksOp")
12700 def RemoveExtraEdges(self, theShape, doUnionFaces=False, theName=None):
12702 Remove all seam and degenerated edges from theShape.
12703 Unite faces and edges, sharing one surface. It means that
12704 this faces must have references to one C++ surface object (handle).
12707 theShape The compound or single solid to remove irregular edges from.
12708 doUnionFaces If True, then unite faces. If False (the default value),
12709 do not unite faces.
12710 theName Object name; when specified, this parameter is used
12711 for result publication in the study. Otherwise, if automatic
12712 publication is switched on, default value is used for result name.
12717 # Example: see GEOM_TestOthers.py
12718 nbFacesOptimum = -1 # -1 means do not unite faces
12719 if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
12720 anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
12721 RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
12722 self._autoPublish(anObj, theName, "removeExtraEdges")
12725 ## Performs union faces of \a theShape
12726 # Unite faces sharing one surface. It means that
12727 # these faces must have references to one C++ surface object (handle).
12728 # @param theShape The compound or single solid that contains faces
12729 # to perform union.
12730 # @param theName Object name; when specified, this parameter is used
12731 # for result publication in the study. Otherwise, if automatic
12732 # publication is switched on, default value is used for result name.
12734 # @return Improved shape.
12736 # @ref swig_UnionFaces "Example"
12737 @ManageTransactions("BlocksOp")
12738 def UnionFaces(self, theShape, theName=None):
12740 Performs union faces of theShape.
12741 Unite faces sharing one surface. It means that
12742 these faces must have references to one C++ surface object (handle).
12745 theShape The compound or single solid that contains faces
12747 theName Object name; when specified, this parameter is used
12748 for result publication in the study. Otherwise, if automatic
12749 publication is switched on, default value is used for result name.
12754 # Example: see GEOM_TestOthers.py
12755 anObj = self.BlocksOp.UnionFaces(theShape)
12756 RaiseIfFailed("UnionFaces", self.BlocksOp)
12757 self._autoPublish(anObj, theName, "unionFaces")
12760 ## Check, if the given shape is a blocks compound.
12761 # Fix all detected errors.
12762 # \note Single block can be also fixed by this method.
12763 # @param theShape The compound to check and improve.
12764 # @param theName Object name; when specified, this parameter is used
12765 # for result publication in the study. Otherwise, if automatic
12766 # publication is switched on, default value is used for result name.
12768 # @return Improved compound.
12770 # @ref swig_CheckAndImprove "Example"
12771 @ManageTransactions("BlocksOp")
12772 def CheckAndImprove(self, theShape, theName=None):
12774 Check, if the given shape is a blocks compound.
12775 Fix all detected errors.
12778 Single block can be also fixed by this method.
12781 theShape The compound to check and improve.
12782 theName Object name; when specified, this parameter is used
12783 for result publication in the study. Otherwise, if automatic
12784 publication is switched on, default value is used for result name.
12789 # Example: see GEOM_TestOthers.py
12790 anObj = self.BlocksOp.CheckAndImprove(theShape)
12791 RaiseIfFailed("CheckAndImprove", self.BlocksOp)
12792 self._autoPublish(anObj, theName, "improved")
12795 # end of l4_blocks_measure
12798 ## @addtogroup l3_blocks_op
12801 ## Get all the blocks, contained in the given compound.
12802 # @param theCompound The compound to explode.
12803 # @param theMinNbFaces If solid has lower number of faces, it is not a block.
12804 # @param theMaxNbFaces If solid has higher number of faces, it is not a block.
12805 # @param theName Object name; when specified, this parameter is used
12806 # for result publication in the study. Otherwise, if automatic
12807 # publication is switched on, default value is used for result name.
12809 # @note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
12811 # @return List of GEOM.GEOM_Object, containing the retrieved blocks.
12813 # @ref tui_explode_on_blocks "Example 1"
12814 # \n @ref swig_MakeBlockExplode "Example 2"
12815 @ManageTransactions("BlocksOp")
12816 def MakeBlockExplode(self, theCompound, theMinNbFaces, theMaxNbFaces, theName=None):
12818 Get all the blocks, contained in the given compound.
12821 theCompound The compound to explode.
12822 theMinNbFaces If solid has lower number of faces, it is not a block.
12823 theMaxNbFaces If solid has higher number of faces, it is not a block.
12824 theName Object name; when specified, this parameter is used
12825 for result publication in the study. Otherwise, if automatic
12826 publication is switched on, default value is used for result name.
12829 If theMaxNbFaces = 0, the maximum number of faces is not restricted.
12832 List of GEOM.GEOM_Object, containing the retrieved blocks.
12834 # Example: see GEOM_TestOthers.py
12835 theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
12836 aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
12837 RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
12838 for anObj in aList:
12839 anObj.SetParameters(Parameters)
12841 self._autoPublish(aList, theName, "block")
12844 ## Find block, containing the given point inside its volume or on boundary.
12845 # @param theCompound Compound, to find block in.
12846 # @param thePoint Point, close to the desired block. If the point lays on
12847 # boundary between some blocks, we return block with nearest center.
12848 # @param theName Object name; when specified, this parameter is used
12849 # for result publication in the study. Otherwise, if automatic
12850 # publication is switched on, default value is used for result name.
12852 # @return New GEOM.GEOM_Object, containing the found block.
12854 # @ref swig_todo "Example"
12855 @ManageTransactions("BlocksOp")
12856 def GetBlockNearPoint(self, theCompound, thePoint, theName=None):
12858 Find block, containing the given point inside its volume or on boundary.
12861 theCompound Compound, to find block in.
12862 thePoint Point, close to the desired block. If the point lays on
12863 boundary between some blocks, we return block with nearest center.
12864 theName Object name; when specified, this parameter is used
12865 for result publication in the study. Otherwise, if automatic
12866 publication is switched on, default value is used for result name.
12869 New GEOM.GEOM_Object, containing the found block.
12871 # Example: see GEOM_Spanner.py
12872 anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
12873 RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
12874 self._autoPublish(anObj, theName, "block")
12877 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
12878 # @param theCompound Compound, to find block in.
12879 # @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
12880 # @param theName Object name; when specified, this parameter is used
12881 # for result publication in the study. Otherwise, if automatic
12882 # publication is switched on, default value is used for result name.
12884 # @return New GEOM.GEOM_Object, containing the found block.
12886 # @ref swig_GetBlockByParts "Example"
12887 @ManageTransactions("BlocksOp")
12888 def GetBlockByParts(self, theCompound, theParts, theName=None):
12890 Find block, containing all the elements, passed as the parts, or maximum quantity of them.
12893 theCompound Compound, to find block in.
12894 theParts List of faces and/or edges and/or vertices to be parts of the found block.
12895 theName Object name; when specified, this parameter is used
12896 for result publication in the study. Otherwise, if automatic
12897 publication is switched on, default value is used for result name.
12900 New GEOM_Object, containing the found block.
12902 # Example: see GEOM_TestOthers.py
12903 anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
12904 RaiseIfFailed("GetBlockByParts", self.BlocksOp)
12905 self._autoPublish(anObj, theName, "block")
12908 ## Return all blocks, containing all the elements, passed as the parts.
12909 # @param theCompound Compound, to find blocks in.
12910 # @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
12911 # @param theName Object name; when specified, this parameter is used
12912 # for result publication in the study. Otherwise, if automatic
12913 # publication is switched on, default value is used for result name.
12915 # @return List of GEOM.GEOM_Object, containing the found blocks.
12917 # @ref swig_todo "Example"
12918 @ManageTransactions("BlocksOp")
12919 def GetBlocksByParts(self, theCompound, theParts, theName=None):
12921 Return all blocks, containing all the elements, passed as the parts.
12924 theCompound Compound, to find blocks in.
12925 theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
12926 theName Object name; when specified, this parameter is used
12927 for result publication in the study. Otherwise, if automatic
12928 publication is switched on, default value is used for result name.
12931 List of GEOM.GEOM_Object, containing the found blocks.
12933 # Example: see GEOM_Spanner.py
12934 aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
12935 RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
12936 self._autoPublish(aList, theName, "block")
12939 ## Multi-transformate block and glue the result.
12940 # Transformation is defined so, as to superpose direction faces.
12941 # @param Block Hexahedral solid to be multi-transformed.
12942 # @param DirFace1 ID of First direction face.
12943 # @param DirFace2 ID of Second direction face.
12944 # @param NbTimes Quantity of transformations to be done.
12945 # @param theName Object name; when specified, this parameter is used
12946 # for result publication in the study. Otherwise, if automatic
12947 # publication is switched on, default value is used for result name.
12949 # @note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
12951 # @return New GEOM.GEOM_Object, containing the result shape.
12953 # @ref tui_multi_transformation "Example"
12954 @ManageTransactions("BlocksOp")
12955 def MakeMultiTransformation1D(self, Block, DirFace1, DirFace2, NbTimes, theName=None):
12957 Multi-transformate block and glue the result.
12958 Transformation is defined so, as to superpose direction faces.
12961 Block Hexahedral solid to be multi-transformed.
12962 DirFace1 ID of First direction face.
12963 DirFace2 ID of Second direction face.
12964 NbTimes Quantity of transformations to be done.
12965 theName Object name; when specified, this parameter is used
12966 for result publication in the study. Otherwise, if automatic
12967 publication is switched on, default value is used for result name.
12970 Unique ID of sub-shape can be obtained, using method GetSubShapeID().
12973 New GEOM.GEOM_Object, containing the result shape.
12975 # Example: see GEOM_Spanner.py
12976 DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
12977 anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
12978 RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
12979 anObj.SetParameters(Parameters)
12980 self._autoPublish(anObj, theName, "transformed")
12983 ## Multi-transformate block and glue the result.
12984 # @param Block Hexahedral solid to be multi-transformed.
12985 # @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
12986 # @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
12987 # @param NbTimesU,NbTimesV Quantity of transformations to be done.
12988 # @param theName Object name; when specified, this parameter is used
12989 # for result publication in the study. Otherwise, if automatic
12990 # publication is switched on, default value is used for result name.
12992 # @return New GEOM.GEOM_Object, containing the result shape.
12994 # @ref tui_multi_transformation "Example"
12995 @ManageTransactions("BlocksOp")
12996 def MakeMultiTransformation2D(self, Block, DirFace1U, DirFace2U, NbTimesU,
12997 DirFace1V, DirFace2V, NbTimesV, theName=None):
12999 Multi-transformate block and glue the result.
13002 Block Hexahedral solid to be multi-transformed.
13003 DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
13004 DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
13005 NbTimesU,NbTimesV Quantity of transformations to be done.
13006 theName Object name; when specified, this parameter is used
13007 for result publication in the study. Otherwise, if automatic
13008 publication is switched on, default value is used for result name.
13011 New GEOM.GEOM_Object, containing the result shape.
13013 # Example: see GEOM_Spanner.py
13014 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
13015 DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
13016 anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
13017 DirFace1V, DirFace2V, NbTimesV)
13018 RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
13019 anObj.SetParameters(Parameters)
13020 self._autoPublish(anObj, theName, "transformed")
13023 ## Build all possible propagation groups.
13024 # Propagation group is a set of all edges, opposite to one (main)
13025 # edge of this group directly or through other opposite edges.
13026 # Notion of Opposite Edge make sense only on quadrangle face.
13027 # @param theShape Shape to build propagation groups on.
13028 # @param theName Object name; when specified, this parameter is used
13029 # for result publication in the study. Otherwise, if automatic
13030 # publication is switched on, default value is used for result name.
13032 # @return List of GEOM.GEOM_Object, each of them is a propagation group.
13034 # @ref swig_Propagate "Example"
13035 @ManageTransactions("BlocksOp")
13036 def Propagate(self, theShape, theName=None):
13038 Build all possible propagation groups.
13039 Propagation group is a set of all edges, opposite to one (main)
13040 edge of this group directly or through other opposite edges.
13041 Notion of Opposite Edge make sense only on quadrangle face.
13044 theShape Shape to build propagation groups on.
13045 theName Object name; when specified, this parameter is used
13046 for result publication in the study. Otherwise, if automatic
13047 publication is switched on, default value is used for result name.
13050 List of GEOM.GEOM_Object, each of them is a propagation group.
13052 # Example: see GEOM_TestOthers.py
13053 listChains = self.BlocksOp.Propagate(theShape)
13054 RaiseIfFailed("Propagate", self.BlocksOp)
13055 self._autoPublish(listChains, theName, "propagate")
13058 # end of l3_blocks_op
13061 ## @addtogroup l3_groups
13064 ## Creates a new group which will store sub-shapes of theMainShape
13065 # @param theMainShape is a GEOM object on which the group is selected
13066 # @param theShapeType defines a shape type of the group (see GEOM::shape_type)
13067 # @param theName Object name; when specified, this parameter is used
13068 # for result publication in the study. Otherwise, if automatic
13069 # publication is switched on, default value is used for result name.
13071 # @return a newly created GEOM group (GEOM.GEOM_Object)
13073 # @ref tui_working_with_groups_page "Example 1"
13074 # \n @ref swig_CreateGroup "Example 2"
13075 @ManageTransactions("GroupOp")
13076 def CreateGroup(self, theMainShape, theShapeType, theName=None):
13078 Creates a new group which will store sub-shapes of theMainShape
13081 theMainShape is a GEOM object on which the group is selected
13082 theShapeType defines a shape type of the group:"COMPOUND", "COMPSOLID",
13083 "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX", "SHAPE".
13084 theName Object name; when specified, this parameter is used
13085 for result publication in the study. Otherwise, if automatic
13086 publication is switched on, default value is used for result name.
13089 a newly created GEOM group
13092 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
13095 # Example: see GEOM_TestOthers.py
13096 anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
13097 RaiseIfFailed("CreateGroup", self.GroupOp)
13098 self._autoPublish(anObj, theName, "group")
13101 ## Adds a sub-object with ID theSubShapeId to the group
13102 # @param theGroup is a GEOM group to which the new sub-shape is added
13103 # @param theSubShapeID is a sub-shape ID in the main object.
13104 # \note Use method GetSubShapeID() to get an unique ID of the sub-shape
13106 # @ref tui_working_with_groups_page "Example"
13107 @ManageTransactions("GroupOp")
13108 def AddObject(self,theGroup, theSubShapeID):
13110 Adds a sub-object with ID theSubShapeId to the group
13113 theGroup is a GEOM group to which the new sub-shape is added
13114 theSubShapeID is a sub-shape ID in the main object.
13117 Use method GetSubShapeID() to get an unique ID of the sub-shape
13119 # Example: see GEOM_TestOthers.py
13120 self.GroupOp.AddObject(theGroup, theSubShapeID)
13121 if self.GroupOp.GetErrorCode() != "PAL_ELEMENT_ALREADY_PRESENT":
13122 RaiseIfFailed("AddObject", self.GroupOp)
13126 ## Removes a sub-object with ID \a theSubShapeId from the group
13127 # @param theGroup is a GEOM group from which the new sub-shape is removed
13128 # @param theSubShapeID is a sub-shape ID in the main object.
13129 # \note Use method GetSubShapeID() to get an unique ID of the sub-shape
13131 # @ref tui_working_with_groups_page "Example"
13132 @ManageTransactions("GroupOp")
13133 def RemoveObject(self,theGroup, theSubShapeID):
13135 Removes a sub-object with ID theSubShapeId from the group
13138 theGroup is a GEOM group from which the new sub-shape is removed
13139 theSubShapeID is a sub-shape ID in the main object.
13142 Use method GetSubShapeID() to get an unique ID of the sub-shape
13144 # Example: see GEOM_TestOthers.py
13145 self.GroupOp.RemoveObject(theGroup, theSubShapeID)
13146 RaiseIfFailed("RemoveObject", self.GroupOp)
13149 ## Adds to the group all the given shapes. No errors, if some shapes are already included.
13150 # @param theGroup is a GEOM group to which the new sub-shapes are added.
13151 # @param theSubShapes is a list of sub-shapes to be added.
13153 # @ref tui_working_with_groups_page "Example"
13154 @ManageTransactions("GroupOp")
13155 def UnionList (self,theGroup, theSubShapes):
13157 Adds to the group all the given shapes. No errors, if some shapes are already included.
13160 theGroup is a GEOM group to which the new sub-shapes are added.
13161 theSubShapes is a list of sub-shapes to be added.
13163 # Example: see GEOM_TestOthers.py
13164 self.GroupOp.UnionList(theGroup, theSubShapes)
13165 RaiseIfFailed("UnionList", self.GroupOp)
13168 ## Adds to the group all the given shapes. No errors, if some shapes are already included.
13169 # @param theGroup is a GEOM group to which the new sub-shapes are added.
13170 # @param theSubShapes is a list of indices of sub-shapes to be added.
13172 # @ref swig_UnionIDs "Example"
13173 @ManageTransactions("GroupOp")
13174 def UnionIDs(self,theGroup, theSubShapes):
13176 Adds to the group all the given shapes. No errors, if some shapes are already included.
13179 theGroup is a GEOM group to which the new sub-shapes are added.
13180 theSubShapes is a list of indices of sub-shapes to be added.
13182 # Example: see GEOM_TestOthers.py
13183 self.GroupOp.UnionIDs(theGroup, theSubShapes)
13184 RaiseIfFailed("UnionIDs", self.GroupOp)
13187 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
13188 # @param theGroup is a GEOM group from which the sub-shapes are removed.
13189 # @param theSubShapes is a list of sub-shapes to be removed.
13191 # @ref tui_working_with_groups_page "Example"
13192 @ManageTransactions("GroupOp")
13193 def DifferenceList (self,theGroup, theSubShapes):
13195 Removes from the group all the given shapes. No errors, if some shapes are not included.
13198 theGroup is a GEOM group from which the sub-shapes are removed.
13199 theSubShapes is a list of sub-shapes to be removed.
13201 # Example: see GEOM_TestOthers.py
13202 self.GroupOp.DifferenceList(theGroup, theSubShapes)
13203 RaiseIfFailed("DifferenceList", self.GroupOp)
13206 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
13207 # @param theGroup is a GEOM group from which the sub-shapes are removed.
13208 # @param theSubShapes is a list of indices of sub-shapes to be removed.
13210 # @ref swig_DifferenceIDs "Example"
13211 @ManageTransactions("GroupOp")
13212 def DifferenceIDs(self,theGroup, theSubShapes):
13214 Removes from the group all the given shapes. No errors, if some shapes are not included.
13217 theGroup is a GEOM group from which the sub-shapes are removed.
13218 theSubShapes is a list of indices of sub-shapes to be removed.
13220 # Example: see GEOM_TestOthers.py
13221 self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
13222 RaiseIfFailed("DifferenceIDs", self.GroupOp)
13225 ## Union of two groups.
13226 # New group is created. It will contain all entities
13227 # which are present in groups theGroup1 and theGroup2.
13228 # @param theGroup1, theGroup2 are the initial GEOM groups
13229 # to create the united group from.
13230 # @param theName Object name; when specified, this parameter is used
13231 # for result publication in the study. Otherwise, if automatic
13232 # publication is switched on, default value is used for result name.
13234 # @return a newly created GEOM group.
13236 # @ref tui_union_groups_anchor "Example"
13237 @ManageTransactions("GroupOp")
13238 def UnionGroups (self, theGroup1, theGroup2, theName=None):
13240 Union of two groups.
13241 New group is created. It will contain all entities
13242 which are present in groups theGroup1 and theGroup2.
13245 theGroup1, theGroup2 are the initial GEOM groups
13246 to create the united group from.
13247 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.
13252 a newly created GEOM group.
13254 # Example: see GEOM_TestOthers.py
13255 aGroup = self.GroupOp.UnionGroups(theGroup1, theGroup2)
13256 RaiseIfFailed("UnionGroups", self.GroupOp)
13257 self._autoPublish(aGroup, theName, "group")
13260 ## Intersection of two groups.
13261 # New group is created. It will contain only those entities
13262 # which are present in both groups theGroup1 and theGroup2.
13263 # @param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
13264 # @param 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.
13268 # @return a newly created GEOM group.
13270 # @ref tui_intersect_groups_anchor "Example"
13271 @ManageTransactions("GroupOp")
13272 def IntersectGroups (self, theGroup1, theGroup2, theName=None):
13274 Intersection of two groups.
13275 New group is created. It will contain only those entities
13276 which are present in both groups theGroup1 and theGroup2.
13279 theGroup1, theGroup2 are the initial GEOM groups to get common part of.
13280 theName Object name; when specified, this parameter is used
13281 for result publication in the study. Otherwise, if automatic
13282 publication is switched on, default value is used for result name.
13285 a newly created GEOM group.
13287 # Example: see GEOM_TestOthers.py
13288 aGroup = self.GroupOp.IntersectGroups(theGroup1, theGroup2)
13289 RaiseIfFailed("IntersectGroups", self.GroupOp)
13290 self._autoPublish(aGroup, theName, "group")
13293 ## Cut of two groups.
13294 # New group is created. It will contain entities which are
13295 # present in group theGroup1 but are not present in group theGroup2.
13296 # @param theGroup1 is a GEOM group to include elements of.
13297 # @param theGroup2 is a GEOM group to exclude elements of.
13298 # @param theName Object name; when specified, this parameter is used
13299 # for result publication in the study. Otherwise, if automatic
13300 # publication is switched on, default value is used for result name.
13302 # @return a newly created GEOM group.
13304 # @ref tui_cut_groups_anchor "Example"
13305 @ManageTransactions("GroupOp")
13306 def CutGroups (self, theGroup1, theGroup2, theName=None):
13309 New group is created. It will contain entities which are
13310 present in group theGroup1 but are not present in group theGroup2.
13313 theGroup1 is a GEOM group to include elements of.
13314 theGroup2 is a GEOM group to exclude elements of.
13315 theName Object name; when specified, this parameter is used
13316 for result publication in the study. Otherwise, if automatic
13317 publication is switched on, default value is used for result name.
13320 a newly created GEOM group.
13322 # Example: see GEOM_TestOthers.py
13323 aGroup = self.GroupOp.CutGroups(theGroup1, theGroup2)
13324 RaiseIfFailed("CutGroups", self.GroupOp)
13325 self._autoPublish(aGroup, theName, "group")
13328 ## Union of list of groups.
13329 # New group is created. It will contain all entities that are
13330 # present in groups listed in theGList.
13331 # @param theGList is a list of GEOM groups to create the united group from.
13332 # @param theName Object name; when specified, this parameter is used
13333 # for result publication in the study. Otherwise, if automatic
13334 # publication is switched on, default value is used for result name.
13336 # @return a newly created GEOM group.
13338 # @ref tui_union_groups_anchor "Example"
13339 @ManageTransactions("GroupOp")
13340 def UnionListOfGroups (self, theGList, theName=None):
13342 Union of list of groups.
13343 New group is created. It will contain all entities that are
13344 present in groups listed in theGList.
13347 theGList is a list of GEOM groups to create the united group from.
13348 theName Object name; when specified, this parameter is used
13349 for result publication in the study. Otherwise, if automatic
13350 publication is switched on, default value is used for result name.
13353 a newly created GEOM group.
13355 # Example: see GEOM_TestOthers.py
13356 aGroup = self.GroupOp.UnionListOfGroups(theGList)
13357 RaiseIfFailed("UnionListOfGroups", self.GroupOp)
13358 self._autoPublish(aGroup, theName, "group")
13361 ## Cut of lists of groups.
13362 # New group is created. It will contain only entities
13363 # which are present in groups listed in theGList.
13364 # @param theGList is a list of GEOM groups to include elements of.
13365 # @param theName Object name; when specified, this parameter is used
13366 # for result publication in the study. Otherwise, if automatic
13367 # publication is switched on, default value is used for result name.
13369 # @return a newly created GEOM group.
13371 # @ref tui_intersect_groups_anchor "Example"
13372 @ManageTransactions("GroupOp")
13373 def IntersectListOfGroups (self, theGList, theName=None):
13375 Cut of lists of groups.
13376 New group is created. It will contain only entities
13377 which are present in groups listed in theGList.
13380 theGList is a list of GEOM groups to include elements of.
13381 theName Object name; when specified, this parameter is used
13382 for result publication in the study. Otherwise, if automatic
13383 publication is switched on, default value is used for result name.
13386 a newly created GEOM group.
13388 # Example: see GEOM_TestOthers.py
13389 aGroup = self.GroupOp.IntersectListOfGroups(theGList)
13390 RaiseIfFailed("IntersectListOfGroups", self.GroupOp)
13391 self._autoPublish(aGroup, theName, "group")
13394 ## Cut of lists of groups.
13395 # New group is created. It will contain only entities
13396 # which are present in groups listed in theGList1 but
13397 # are not present in groups from theGList2.
13398 # @param theGList1 is a list of GEOM groups to include elements of.
13399 # @param theGList2 is a list of GEOM groups to exclude elements of.
13400 # @param theName Object name; when specified, this parameter is used
13401 # for result publication in the study. Otherwise, if automatic
13402 # publication is switched on, default value is used for result name.
13404 # @return a newly created GEOM group.
13406 # @ref tui_cut_groups_anchor "Example"
13407 @ManageTransactions("GroupOp")
13408 def CutListOfGroups (self, theGList1, theGList2, theName=None):
13410 Cut of lists of groups.
13411 New group is created. It will contain only entities
13412 which are present in groups listed in theGList1 but
13413 are not present in groups from theGList2.
13416 theGList1 is a list of GEOM groups to include elements of.
13417 theGList2 is a list of GEOM groups to exclude elements of.
13418 theName Object name; when specified, this parameter is used
13419 for result publication in the study. Otherwise, if automatic
13420 publication is switched on, default value is used for result name.
13423 a newly created GEOM group.
13425 # Example: see GEOM_TestOthers.py
13426 aGroup = self.GroupOp.CutListOfGroups(theGList1, theGList2)
13427 RaiseIfFailed("CutListOfGroups", self.GroupOp)
13428 self._autoPublish(aGroup, theName, "group")
13431 ## Returns a list of sub-objects ID stored in the group
13432 # @param theGroup is a GEOM group for which a list of IDs is requested
13434 # @ref swig_GetObjectIDs "Example"
13435 @ManageTransactions("GroupOp")
13436 def GetObjectIDs(self,theGroup):
13438 Returns a list of sub-objects ID stored in the group
13441 theGroup is a GEOM group for which a list of IDs is requested
13443 # Example: see GEOM_TestOthers.py
13444 ListIDs = self.GroupOp.GetObjects(theGroup)
13445 RaiseIfFailed("GetObjects", self.GroupOp)
13448 ## Returns a type of sub-objects stored in the group
13449 # @param theGroup is a GEOM group which type is returned.
13451 # @ref swig_GetType "Example"
13452 @ManageTransactions("GroupOp")
13453 def GetType(self,theGroup):
13455 Returns a type of sub-objects stored in the group
13458 theGroup is a GEOM group which type is returned.
13460 # Example: see GEOM_TestOthers.py
13461 aType = self.GroupOp.GetType(theGroup)
13462 RaiseIfFailed("GetType", self.GroupOp)
13465 ## Convert a type of geom object from id to string value
13466 # @param theId is a GEOM object type id.
13467 # @return type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
13468 # @ref swig_GetType "Example"
13469 def ShapeIdToType(self, theId):
13471 Convert a type of geom object from id to string value
13474 theId is a GEOM object type id.
13477 type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
13504 return "REVOLUTION"
13552 return "FREE_BOUNDS"
13560 return "THRUSECTIONS"
13562 return "COMPOUNDFILTER"
13564 return "SHAPES_ON_SHAPE"
13566 return "ELLIPSE_ARC"
13568 return "3DSKETCHER"
13574 return "PIPETSHAPE"
13575 return "Shape Id not exist."
13577 ## Returns a main shape associated with the group
13578 # @param theGroup is a GEOM group for which a main shape object is requested
13579 # @return a GEOM object which is a main shape for theGroup
13581 # @ref swig_GetMainShape "Example"
13582 @ManageTransactions("GroupOp")
13583 def GetMainShape(self,theGroup):
13585 Returns a main shape associated with the group
13588 theGroup is a GEOM group for which a main shape object is requested
13591 a GEOM object which is a main shape for theGroup
13593 Example of usage: BoxCopy = geompy.GetMainShape(CreateGroup)
13595 # Example: see GEOM_TestOthers.py
13596 anObj = self.GroupOp.GetMainShape(theGroup)
13597 RaiseIfFailed("GetMainShape", self.GroupOp)
13600 ## Create group of edges of theShape, whose length is in range [min_length, max_length].
13601 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
13602 # @param theShape given shape (see GEOM.GEOM_Object)
13603 # @param min_length minimum length of edges of theShape
13604 # @param max_length maximum length of edges of theShape
13605 # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13606 # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13607 # @param theName Object name; when specified, this parameter is used
13608 # for result publication in the study. Otherwise, if automatic
13609 # publication is switched on, default value is used for result name.
13611 # @return a newly created GEOM group of edges
13613 # @@ref swig_todo "Example"
13614 def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1, theName=None):
13616 Create group of edges of theShape, whose length is in range [min_length, max_length].
13617 If include_min/max == 0, edges with length == min/max_length will not be included in result.
13620 theShape given shape
13621 min_length minimum length of edges of theShape
13622 max_length maximum length of edges of theShape
13623 include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13624 include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13625 theName Object name; when specified, this parameter is used
13626 for result publication in the study. Otherwise, if automatic
13627 publication is switched on, default value is used for result name.
13630 a newly created GEOM group of edges.
13632 edges = self.SubShapeAll(theShape, self.ShapeType["EDGE"])
13633 edges_in_range = []
13635 Props = self.BasicProperties(edge)
13636 if min_length <= Props[0] and Props[0] <= max_length:
13637 if (not include_min) and (min_length == Props[0]):
13640 if (not include_max) and (Props[0] == max_length):
13643 edges_in_range.append(edge)
13645 if len(edges_in_range) <= 0:
13646 print("No edges found by given criteria")
13649 # note: auto-publishing is done in self.CreateGroup()
13650 group_edges = self.CreateGroup(theShape, self.ShapeType["EDGE"], theName)
13651 self.UnionList(group_edges, edges_in_range)
13655 ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
13656 # If include_min/max == 0, edges with length == min/max_length will not be included in result.
13657 # @param min_length minimum length of edges of selected shape
13658 # @param max_length maximum length of edges of selected shape
13659 # @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13660 # @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13661 # @return a newly created GEOM group of edges
13662 # @ref swig_todo "Example"
13663 def SelectEdges (self, min_length, max_length, include_min = 1, include_max = 1):
13665 Create group of edges of selected shape, whose length is in range [min_length, max_length].
13666 If include_min/max == 0, edges with length == min/max_length will not be included in result.
13669 min_length minimum length of edges of selected shape
13670 max_length maximum length of edges of selected shape
13671 include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
13672 include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
13675 a newly created GEOM group of edges.
13677 nb_selected = sg.SelectedCount()
13678 if nb_selected < 1:
13679 print("Select a shape before calling this function, please.")
13681 if nb_selected > 1:
13682 print("Only one shape must be selected")
13685 id_shape = sg.getSelected(0)
13686 shape = IDToObject( id_shape )
13688 group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
13692 if include_min: left_str = " <= "
13693 if include_max: right_str = " <= "
13695 self.addToStudyInFather(shape, group_edges, "Group of edges with " + repr(min_length)
13696 + left_str + "length" + right_str + repr(max_length))
13698 sg.updateObjBrowser()
13705 #@@ insert new functions before this line @@ do not remove this line @@#
13707 ## Create a copy of the given object
13709 # @param theOriginal geometry object for copy
13710 # @param theName Object name; when specified, this parameter is used
13711 # for result publication in the study. Otherwise, if automatic
13712 # publication is switched on, default value is used for result name.
13714 # @return New GEOM_Object, containing the copied shape.
13716 # @ingroup l1_geomBuilder_auxiliary
13717 # @ref swig_MakeCopy "Example"
13718 @ManageTransactions("InsertOp")
13719 def MakeCopy(self, theOriginal, theName=None):
13721 Create a copy of the given object
13724 theOriginal geometry object for copy
13725 theName Object name; when specified, this parameter is used
13726 for result publication in the study. Otherwise, if automatic
13727 publication is switched on, default value is used for result name.
13730 New GEOM_Object, containing the copied shape.
13732 Example of usage: Copy = geompy.MakeCopy(Box)
13734 # Example: see GEOM_TestAll.py
13735 anObj = self.InsertOp.MakeCopy(theOriginal)
13736 RaiseIfFailed("MakeCopy", self.InsertOp)
13737 self._autoPublish(anObj, theName, "copy")
13740 ## Add Path to load python scripts from
13741 # @param Path a path to load python scripts from
13742 # @ingroup l1_geomBuilder_auxiliary
13743 def addPath(self,Path):
13745 Add Path to load python scripts from
13748 Path a path to load python scripts from
13750 if (sys.path.count(Path) < 1):
13751 sys.path.append(Path)
13755 ## Load marker texture from the file
13756 # @param Path a path to the texture file
13757 # @return unique texture identifier
13758 # @ingroup l1_geomBuilder_auxiliary
13759 @ManageTransactions("InsertOp")
13760 def LoadTexture(self, Path):
13762 Load marker texture from the file
13765 Path a path to the texture file
13768 unique texture identifier
13770 # Example: see GEOM_TestAll.py
13771 ID = self.InsertOp.LoadTexture(Path)
13772 RaiseIfFailed("LoadTexture", self.InsertOp)
13775 ## Get internal name of the object based on its study entry
13776 # @note This method does not provide an unique identifier of the geometry object.
13777 # @note This is internal function of GEOM component, though it can be used outside it for
13778 # appropriate reason (e.g. for identification of geometry object).
13779 # @param obj geometry object
13780 # @return unique object identifier
13781 # @ingroup l1_geomBuilder_auxiliary
13782 def getObjectID(self, obj):
13784 Get internal name of the object based on its study entry.
13785 Note: this method does not provide an unique identifier of the geometry object.
13786 It is an internal function of GEOM component, though it can be used outside GEOM for
13787 appropriate reason (e.g. for identification of geometry object).
13790 obj geometry object
13793 unique object identifier
13796 entry = salome.ObjectToID(obj)
13797 if entry is not None:
13798 lst = entry.split(":")
13800 ID = lst[-1] # -1 means last item in the list
13801 return "GEOM_" + ID
13806 ## Add marker texture. @a Width and @a Height parameters
13807 # specify width and height of the texture in pixels.
13808 # If @a RowData is @c True, @a Texture parameter should represent texture data
13809 # packed into the byte array. If @a RowData is @c False (default), @a Texture
13810 # parameter should be unpacked string, in which '1' symbols represent opaque
13811 # pixels and '0' represent transparent pixels of the texture bitmap.
13813 # @param Width texture width in pixels
13814 # @param Height texture height in pixels
13815 # @param Texture texture data
13816 # @param RowData if @c True, @a Texture data are packed in the byte stream
13817 # @return unique texture identifier
13818 # @ingroup l1_geomBuilder_auxiliary
13819 @ManageTransactions("InsertOp")
13820 def AddTexture(self, Width, Height, Texture, RowData=False):
13822 Add marker texture. Width and Height parameters
13823 specify width and height of the texture in pixels.
13824 If RowData is True, Texture parameter should represent texture data
13825 packed into the byte array. If RowData is False (default), Texture
13826 parameter should be unpacked string, in which '1' symbols represent opaque
13827 pixels and '0' represent transparent pixels of the texture bitmap.
13830 Width texture width in pixels
13831 Height texture height in pixels
13832 Texture texture data
13833 RowData if True, Texture data are packed in the byte stream
13836 return unique texture identifier
13838 if not RowData: Texture = PackData(Texture)
13839 ID = self.InsertOp.AddTexture(Width, Height, Texture)
13840 RaiseIfFailed("AddTexture", self.InsertOp)
13843 ## Transfer not topological data from one GEOM object to another.
13845 # @param theObjectFrom the source object of non-topological data
13846 # @param theObjectTo the destination object of non-topological data
13847 # @param theFindMethod method to search sub-shapes of theObjectFrom
13848 # in shape theObjectTo. Possible values are: GEOM.FSM_GetInPlace,
13849 # GEOM.FSM_GetInPlaceByHistory and GEOM.FSM_GetInPlace_Old.
13850 # Other values of GEOM.find_shape_method are not supported.
13852 # @return True in case of success; False otherwise.
13854 # @ingroup l1_geomBuilder_auxiliary
13856 # @ref swig_TransferData "Example"
13857 @ManageTransactions("InsertOp")
13858 def TransferData(self, theObjectFrom, theObjectTo,
13859 theFindMethod=GEOM.FSM_GetInPlace):
13861 Transfer not topological data from one GEOM object to another.
13864 theObjectFrom the source object of non-topological data
13865 theObjectTo the destination object of non-topological data
13866 theFindMethod method to search sub-shapes of theObjectFrom
13867 in shape theObjectTo. Possible values are:
13868 GEOM.FSM_GetInPlace, GEOM.FSM_GetInPlaceByHistory
13869 and GEOM.FSM_GetInPlace_Old. Other values of
13870 GEOM.find_shape_method are not supported.
13873 True in case of success; False otherwise.
13875 # Example: see GEOM_TestOthers.py
13877 # Example: see GEOM_TestAll.py
13878 isOk = self.InsertOp.TransferData(theObjectFrom,
13879 theObjectTo, theFindMethod)
13880 RaiseIfFailed("TransferData", self.InsertOp)
13883 ## Creates a new folder object. It is a container for any GEOM objects.
13884 # @param Name name of the container
13885 # @param Father parent object. If None,
13886 # folder under 'Geometry' root object will be created.
13887 # @return a new created folder
13888 # @ingroup l1_publish_data
13889 def NewFolder(self, Name, Father=None):
13891 Create a new folder object. It is an auxiliary container for any GEOM objects.
13894 Name name of the container
13895 Father parent object. If None,
13896 folder under 'Geometry' root object will be created.
13899 a new created folder
13901 return self.CreateFolder(Name, Father)
13903 ## Move object to the specified folder
13904 # @param Object object to move
13905 # @param Folder target folder
13906 # @ingroup l1_publish_data
13907 def PutToFolder(self, Object, Folder):
13909 Move object to the specified folder
13912 Object object to move
13913 Folder target folder
13915 self.MoveToFolder(Object, Folder)
13918 ## Move list of objects to the specified folder
13919 # @param ListOfSO list of objects to move
13920 # @param Folder target folder
13921 # @ingroup l1_publish_data
13922 def PutListToFolder(self, ListOfSO, Folder):
13924 Move list of objects to the specified folder
13927 ListOfSO list of objects to move
13928 Folder target folder
13930 self.MoveListToFolder(ListOfSO, Folder)
13933 ## @addtogroup l2_field
13937 # @param shape the shape the field lies on
13938 # @param name the field name
13939 # @param type type of field data: 0 - bool, 1 - int, 2 - double, 3 - string
13940 # @param dimension dimension of the shape the field lies on
13941 # 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
13942 # @param componentNames names of components
13943 # @return a created field
13944 @ManageTransactions("FieldOp")
13945 def CreateField(self, shape, name, type, dimension, componentNames):
13950 shape the shape the field lies on
13951 name the field name
13952 type type of field data
13953 dimension dimension of the shape the field lies on
13954 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
13955 componentNames names of components
13960 if isinstance( type, int ):
13961 if type < 0 or type > 3:
13962 raise RuntimeError("CreateField : Error: data type must be within [0-3] range")
13963 type = [GEOM.FDT_Bool,GEOM.FDT_Int,GEOM.FDT_Double,GEOM.FDT_String][type]
13965 f = self.FieldOp.CreateField( shape, name, type, dimension, componentNames)
13966 RaiseIfFailed("CreateField", self.FieldOp)
13968 geom._autoPublish( f, "", name)
13971 ## Removes a field from the GEOM component
13972 # @param field the field to remove
13973 def RemoveField(self, field):
13974 "Removes a field from the GEOM component"
13976 if isinstance( field, GEOM._objref_GEOM_Field ):
13977 geom.RemoveObject( field )
13978 elif isinstance( field, geomField ):
13979 geom.RemoveObject( field.field )
13981 raise RuntimeError("RemoveField() : the object is not a field")
13984 ## Returns number of fields on a shape
13985 @ManageTransactions("FieldOp")
13986 def CountFields(self, shape):
13987 "Returns number of fields on a shape"
13988 nb = self.FieldOp.CountFields( shape )
13989 RaiseIfFailed("CountFields", self.FieldOp)
13992 ## Returns all fields on a shape
13993 @ManageTransactions("FieldOp")
13994 def GetFields(self, shape):
13995 "Returns all fields on a shape"
13996 ff = self.FieldOp.GetFields( shape )
13997 RaiseIfFailed("GetFields", self.FieldOp)
14000 ## Returns a field on a shape by its name
14001 @ManageTransactions("FieldOp")
14002 def GetField(self, shape, name):
14003 "Returns a field on a shape by its name"
14004 f = self.FieldOp.GetField( shape, name )
14005 RaiseIfFailed("GetField", self.FieldOp)
14011 ## @addtogroup l2_testing
14014 ## Build a mesh on the given shape.
14015 # @param shape the source shape
14016 # @param linear_deflection linear deflection coefficient
14017 # @param is_relative says if given value of deflection is relative to shape's bounding box
14018 # @param angular_deflection angular deflection for edges in degrees
14019 # @return True in case of success; otherwise False.
14020 @ManageTransactions("TestOp")
14021 def Tesselate(self, shape, linear_deflection=0, is_relative=True, angular_deflection=0):
14022 """Build a mesh on the given shape.
14025 shape the source shape
14026 linear_deflection linear deflection coefficient
14027 is_relative says if given value of deflection is relative to shape's bounding box
14028 angular_deflection angular deflection for edges in degrees
14031 True in case of success; otherwise False.
14033 if angular_deflection > 0:
14034 angular_deflection = angular_deflection * math.pi / 180.
14035 r = self.TestOp.Tesselate(shape, linear_deflection, is_relative, angular_deflection)
14036 RaiseIfFailed("Tesselate", self.TestOp)
14039 # end of l2_testing
14043 # Register the new proxy for GEOM_Gen
14044 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geomBuilder)
14047 ## Field on Geometry
14048 # @ingroup l2_field
14049 class geomField( GEOM._objref_GEOM_Field ):
14051 def __init__(self, *args):
14052 GEOM._objref_GEOM_Field.__init__(self, *args)
14053 self.field = GEOM._objref_GEOM_Field
14056 ## Returns the shape the field lies on
14057 def getShape(self):
14058 "Returns the shape the field lies on"
14059 return self.field.GetShape(self)
14061 ## Returns the field name
14063 "Returns the field name"
14064 return self.field.GetName(self)
14066 ## Returns type of field data as integer [0-3]
14068 "Returns type of field data"
14069 return EnumToLong(self.field.GetDataType(self))
14071 ## Returns type of field data:
14072 # one of GEOM.FDT_Bool, GEOM.FDT_Int, GEOM.FDT_Double, GEOM.FDT_String
14073 def getTypeEnum(self):
14074 "Returns type of field data"
14075 return self.field.GetDataType(self)
14077 ## Returns dimension of the shape the field lies on:
14078 # 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
14079 def getDimension(self):
14080 """Returns dimension of the shape the field lies on:
14081 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape"""
14082 return self.field.GetDimension(self)
14084 ## Returns names of components
14085 def getComponents(self):
14086 "Returns names of components"
14087 return self.field.GetComponents(self)
14089 ## Adds a time step to the field
14090 # @param step the time step number further used as the step identifier
14091 # @param stamp the time step time
14092 # @param values the values of the time step
14093 def addStep(self, step, stamp, values):
14094 "Adds a time step to the field"
14095 stp = self.field.AddStep( self, step, stamp )
14097 raise RuntimeError("Field.addStep() : Error: step %s already exists in this field"%step)
14099 geom._autoPublish( stp, "", "Step %s, %s"%(step,stamp))
14100 self.setValues( step, values )
14103 ## Remove a time step from the field
14104 def removeStep(self,step):
14105 "Remove a time step from the field"
14108 stepObj = self.field.GetStep( self, step )
14110 stepSO = geom.myStudy.FindObjectID( stepObj.GetStudyEntry() )
14113 #traceback.print_exc()
14115 self.field.RemoveStep( self, step )
14117 geom.myBuilder.RemoveObjectWithChildren( stepSO )
14120 ## Returns number of time steps in the field
14121 def countSteps(self):
14122 "Returns number of time steps in the field"
14123 return self.field.CountSteps(self)
14125 ## Returns a list of time step IDs in the field
14126 def getSteps(self):
14127 "Returns a list of time step IDs in the field"
14128 return self.field.GetSteps(self)
14130 ## Returns a time step by its ID
14131 def getStep(self,step):
14132 "Returns a time step by its ID"
14133 stp = self.field.GetStep(self, step)
14135 raise RuntimeError("Step %s is missing from this field"%step)
14138 ## Returns the time of the field step
14139 def getStamp(self,step):
14140 "Returns the time of the field step"
14141 return self.getStep(step).GetStamp()
14143 ## Changes the time of the field step
14144 def setStamp(self, step, stamp):
14145 "Changes the time of the field step"
14146 return self.getStep(step).SetStamp(stamp)
14148 ## Returns values of the field step
14149 def getValues(self, step):
14150 "Returns values of the field step"
14151 return self.getStep(step).GetValues()
14153 ## Changes values of the field step
14154 def setValues(self, step, values):
14155 "Changes values of the field step"
14156 stp = self.getStep(step)
14157 errBeg = "Field.setValues(values) : Error: "
14159 ok = stp.SetValues( values )
14160 except Exception as e:
14162 if excStr.find("WrongPythonType") > 0:
14163 raise RuntimeError(errBeg +\
14164 "wrong type of values, %s values are expected"%str(self.getTypeEnum())[4:])
14165 raise RuntimeError(errBeg + str(e))
14167 nbOK = self.field.GetArraySize(self)
14170 raise RuntimeError(errBeg + "len(values) must be %s but not %s"%(nbOK,nbKO))
14172 raise RuntimeError(errBeg + "failed")
14175 pass # end of class geomField
14177 # Register the new proxy for GEOM_Field
14178 omniORB.registerObjref(GEOM._objref_GEOM_Field._NP_RepositoryId, geomField)
14181 ## Create a new geomBuilder instance.The geomBuilder class provides the Python
14182 # interface to GEOM operations.
14187 # salome.salome_init()
14188 # from salome.geom import geomBuilder
14189 # geompy = geomBuilder.New()
14191 # @param instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
14192 # @return geomBuilder instance
14193 def New( instance=None):
14195 Create a new geomBuilder instance.The geomBuilder class provides the Python
14196 interface to GEOM operations.
14200 salome.salome_init()
14201 from salome.geom import geomBuilder
14202 geompy = geomBuilder.New()
14205 instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
14207 geomBuilder instance
14209 #print "New geomBuilder ", study, instance
14213 if instance and isinstance( instance, SALOMEDS._objref_Study ):
14215 sys.stderr.write("Warning: 'study' argument is no more needed in geomBuilder.New(). Consider updating your script!!!\n\n")
14220 geom = geomBuilder()
14221 assert isinstance(geom,geomBuilder), "Geom engine class is %s but should be geomBuilder.geomBuilder. Import geomBuilder before creating the instance."%geom.__class__
14226 # Register methods from the plug-ins in the geomBuilder class
14227 plugins_var = os.environ.get( "GEOM_PluginsList" )
14230 if plugins_var is not None:
14231 plugins = plugins_var.split( ":" )
14232 plugins=[x for x in plugins if len(x)>0]
14233 if plugins is not None:
14234 for pluginName in plugins:
14235 pluginBuilderName = pluginName + "Builder"
14237 exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
14238 except Exception as e:
14239 from salome_utils import verbose
14240 print("Exception while loading %s: %s" % ( pluginBuilderName, e ))
14242 exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
14243 plugin = eval( pluginBuilderName )
14245 # add methods from plugin module to the geomBuilder class
14246 for k in dir( plugin ):
14247 if k[0] == '_': continue
14248 method = getattr( plugin, k )
14249 if type( method ).__name__ == 'function':
14250 if not hasattr( geomBuilder, k ):
14251 setattr( geomBuilder, k, method )