Salome HOME
PAL13473 (Build repetitive mesh):
[modules/smesh.git] / src / SMESH_SWIG / smesh.py
1 #  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 #
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.
8 #
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.
13 #
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
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 #  File   : smesh.py
21 #  Author : Francis KLOSS, OCC
22 #  Module : SMESH
23
24 """
25  \namespace smesh
26  \brief Module smesh
27 """
28
29 import salome
30 import geompy
31
32 import SMESH
33 from   SMESH import *
34
35 import StdMeshers
36
37 # import NETGENPlugin module if possible
38 noNETGENPlugin = 0
39 try:
40     import NETGENPlugin
41 except ImportError:
42     noNETGENPlugin = 1
43     pass
44     
45 # Types of algo
46 REGULAR = 1
47 PYTHON  = 2
48
49 MEFISTO = 3
50 NETGEN  = 4
51 GHS3D   = 5
52 FULL_NETGEN = 6
53
54 # MirrorType enumeration
55 POINT = SMESH_MeshEditor.POINT
56 AXIS =  SMESH_MeshEditor.AXIS 
57 PLANE = SMESH_MeshEditor.PLANE
58
59 # Smooth_Method enumeration
60 LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH
61 CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH
62
63 # Fineness enumeration(for NETGEN)
64 VeryCoarse = 0
65 Coarse = 1
66 Moderate = 2
67 Fine = 3
68 VeryFine = 4
69 Custom = 5
70
71
72 NO_NAME = "NoName"
73
74
75 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
76 smesh.SetCurrentStudy(salome.myStudy)
77
78 # Global functions
79
80 ## Gets object name
81 def GetName(obj):
82     ior  = salome.orb.object_to_string(obj)
83     sobj = salome.myStudy.FindObjectIOR(ior)
84     if sobj is None:
85         return NO_NAME
86     else:
87         attr = sobj.FindAttribute("AttributeName")[1]
88         return attr.Value()
89
90 ## Sets name to object
91 def SetName(obj, name):
92     ior  = salome.orb.object_to_string(obj)
93     sobj = salome.myStudy.FindObjectIOR(ior)
94     if not sobj is None:
95         attr = sobj.FindAttribute("AttributeName")[1]
96         attr.SetValue(name)
97         
98 ## Returns long value from enumeration
99 #  Uses for SMESH.FunctorType enumeration
100 def EnumToLong(theItem):
101     return theItem._v
102
103 ## Get PointStruct from vertex
104 #  @param theVertex is GEOM object(vertex)
105 #  @return SMESH.PointStruct
106 def GetPointStruct(theVertex):
107     [x, y, z] = geompy.PointCoordinates(theVertex)
108     return PointStruct(x,y,z)
109
110 ## Get DirStruct from vector
111 #  @param theVector is GEOM object(vector)
112 #  @return SMESH.DirStruct
113 def GetDirStruct(theVector):
114     vertices = geompy.SubShapeAll( theVector, geompy.ShapeType["VERTEX"] )
115     if(len(vertices) != 2):
116         print "Error: vector object is incorrect."
117         return None
118     p1 = geompy.PointCoordinates(vertices[0])
119     p2 = geompy.PointCoordinates(vertices[1])
120     pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
121     dir = DirStruct(pnt)
122     return dir
123
124 ## Get AxisStruct from object
125 #  @param theObj is GEOM object(line or plane)
126 #  @return SMESH.AxisStruct
127 def GetAxisStruct(theObj):
128     edges = geompy.SubShapeAll( theObj, geompy.ShapeType["EDGE"] )
129     if len(edges) > 1:
130         vertex1, vertex2 = geompy.SubShapeAll( edges[0], geompy.ShapeType["VERTEX"] )
131         vertex3, vertex4 = geompy.SubShapeAll( edges[1], geompy.ShapeType["VERTEX"] )
132         vertex1 = geompy.PointCoordinates(vertex1)
133         vertex2 = geompy.PointCoordinates(vertex2)
134         vertex3 = geompy.PointCoordinates(vertex3)
135         vertex4 = geompy.PointCoordinates(vertex4)
136         v1 = [vertex2[0]-vertex1[0], vertex2[1]-vertex1[1], vertex2[2]-vertex1[2]]
137         v2 = [vertex4[0]-vertex3[0], vertex4[1]-vertex3[1], vertex4[2]-vertex3[2]]
138         normal = [ v1[1]*v2[2]-v2[1]*v1[2], v1[2]*v2[0]-v2[2]*v1[0], v1[0]*v2[1]-v2[0]*v1[1] ]
139         axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2])
140         return axis
141     elif len(edges) == 1:
142         vertex1, vertex2 = geompy.SubShapeAll( edges[0], geompy.ShapeType["VERTEX"] )
143         p1 = geompy.PointCoordinates( vertex1 )
144         p2 = geompy.PointCoordinates( vertex2 )
145         axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
146         return axis
147     return None
148
149 # From SMESH_Gen interface:
150 # ------------------------
151
152 ## Set the current mode
153 def SetEmbeddedMode( theMode ):
154     smesh.SetEmbeddedMode(theMode)
155
156 ## Get the current mode
157 def IsEmbeddedMode():
158     return smesh.IsEmbeddedMode()
159
160 ## Set the current study
161 def SetCurrentStudy( theStudy ):
162     smesh.SetCurrentStudy(theStudy)
163
164 ## Get the current study
165 def GetCurrentStudy():
166     return smesh.GetCurrentStudy()
167
168 ## Create Mesh object importing data from given UNV file
169 #  @return an instance of Mesh class
170 def CreateMeshesFromUNV( theFileName ):
171     aSmeshMesh = smesh.CreateMeshesFromUNV(theFileName)
172     aMesh = Mesh(aSmeshMesh)
173     return aMesh
174
175 ## Create Mesh object(s) importing data from given MED file
176 #  @return a list of Mesh class instances
177 def CreateMeshesFromMED( theFileName ):
178     aSmeshMeshes, aStatus = smesh.CreateMeshesFromMED(theFileName)
179     aMeshes = []
180     for iMesh in range(len(aSmeshMeshes)) :
181         aMesh = Mesh(aSmeshMeshes[iMesh])
182         aMeshes.append(aMesh)
183     return aMeshes, aStatus
184
185 ## Create Mesh object importing data from given STL file
186 #  @return an instance of Mesh class
187 def CreateMeshesFromSTL( theFileName ):
188     aSmeshMesh = smesh.CreateMeshesFromSTL(theFileName)
189     aMesh = Mesh(aSmeshMesh)
190     return aMesh
191
192 ## From SMESH_Gen interface
193 def GetSubShapesId( theMainObject, theListOfSubObjects ):
194     return smesh.GetSubShapesId(theMainObject, theListOfSubObjects)
195
196 ## From SMESH_Gen interface. Creates pattern
197 def GetPattern():
198     return smesh.GetPattern()
199
200
201
202 # Filtering. Auxiliary functions:
203 # ------------------------------
204
205 ## Creates an empty criterion
206 #  @return SMESH.Filter.Criterion
207 def GetEmptyCriterion():
208     Type = EnumToLong(FT_Undefined)
209     Compare = EnumToLong(FT_Undefined)
210     Threshold = 0
211     ThresholdStr = ""
212     ThresholdID = ""
213     UnaryOp = EnumToLong(FT_Undefined)
214     BinaryOp = EnumToLong(FT_Undefined)
215     Tolerance = 1e-07
216     TypeOfElement = ALL
217     Precision = -1 ##@1e-07
218     return Filter.Criterion(Type, Compare, Threshold, ThresholdStr, ThresholdID,
219                             UnaryOp, BinaryOp, Tolerance, TypeOfElement, Precision)
220       
221 ## Creates a criterion by given parameters
222 #  @param elementType is the type of elements(NODE, EDGE, FACE, VOLUME)
223 #  @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
224 #  @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo}
225 #  @param Treshold is threshold value (range of ids as string, shape, numeric)
226 #  @param UnaryOp is FT_LogicalNOT or FT_Undefined
227 #  @param BinaryOp is binary logical operation FT_LogicalAND, FT_LogicalOR or
228 #                  FT_Undefined(must be for the last criterion in criteria)
229 #  @return SMESH.Filter.Criterion
230 def GetCriterion(elementType,
231                  CritType,
232                  Compare = FT_EqualTo,
233                  Treshold="",
234                  UnaryOp=FT_Undefined,
235                  BinaryOp=FT_Undefined):
236     aCriterion = GetEmptyCriterion()
237     aCriterion.TypeOfElement = elementType
238     aCriterion.Type = EnumToLong(CritType)
239         
240     aTreshold = Treshold
241         
242     if Compare in [FT_LessThan, FT_MoreThan, FT_EqualTo]:
243         aCriterion.Compare = EnumToLong(Compare)
244     else:
245         aCriterion.Compare = EnumToLong(FT_EqualTo)
246         aTreshold = Compare
247
248     if CritType in [FT_BelongToGeom,     FT_BelongToPlane,
249                     FT_BelongToCylinder, FT_LyingOnGeom]:
250         # Check treshold
251         if isinstance(aTreshold, geompy.GEOM._objref_GEOM_Object):
252             aCriterion.ThresholdStr = GetName(aTreshold)
253             aCriterion.ThresholdID = salome.ObjectToID(aTreshold)
254         else:
255             print "Error: Treshold should be a shape."
256             return None
257     elif CritType == FT_RangeOfIds:
258         # Check treshold
259         if isinstance(aTreshold, str):
260             aCriterion.ThresholdStr = aTreshold
261         else:
262             print "Error: Treshold should be a string."
263             return None
264     elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume]:
265         # Here we don't need treshold
266         if aTreshold ==  FT_LogicalNOT:
267             aCriterion.UnaryOp = EnumToLong(FT_LogicalNOT)
268         elif aTreshold in [FT_LogicalAND, FT_LogicalOR]:
269             aCriterion.BinaryOp = aTreshold
270     else:
271         # Check treshold
272         try:
273             aTreshold = float(aTreshold)
274             aCriterion.Threshold = aTreshold
275         except:
276             print "Error: Treshold should be a number."
277             return None
278
279     if Treshold ==  FT_LogicalNOT or UnaryOp ==  FT_LogicalNOT:
280         aCriterion.UnaryOp = EnumToLong(FT_LogicalNOT)
281
282     if Treshold in [FT_LogicalAND, FT_LogicalOR]:
283         aCriterion.BinaryOp = EnumToLong(Treshold)
284
285     if UnaryOp in [FT_LogicalAND, FT_LogicalOR]:
286         aCriterion.BinaryOp = EnumToLong(UnaryOp)
287
288     if BinaryOp in [FT_LogicalAND, FT_LogicalOR]:
289         aCriterion.BinaryOp = EnumToLong(BinaryOp)
290
291     return aCriterion
292
293 ## Creates filter by given parameters of criterion
294 #  @param elementType is the type of elements in the group
295 #  @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
296 #  @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo}
297 #  @param Treshold is threshold value (range of id ids as string, shape, numeric)
298 #  @param UnaryOp is FT_LogicalNOT or FT_Undefined
299 #  @return SMESH_Filter
300 def GetFilter(elementType,
301               CritType=FT_Undefined,
302               Compare=FT_EqualTo,
303               Treshold="",
304               UnaryOp=FT_Undefined):
305     aCriterion = GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined)
306     aFilterMgr = smesh.CreateFilterManager()
307     aFilter = aFilterMgr.CreateFilter()
308     aCriteria = []
309     aCriteria.append(aCriterion)
310     aFilter.SetCriteria(aCriteria)
311     return aFilter
312
313 ## Creates numerical functor by its type
314 #  @param theCrierion is FT_...; functor type
315 #  @return SMESH_NumericalFunctor
316 def GetFunctor(theCriterion):
317     aFilterMgr = smesh.CreateFilterManager()
318     if theCriterion == FT_AspectRatio:
319         return aFilterMgr.CreateAspectRatio()
320     elif theCriterion == FT_AspectRatio3D:
321         return aFilterMgr.CreateAspectRatio3D()
322     elif theCriterion == FT_Warping:
323         return aFilterMgr.CreateWarping()
324     elif theCriterion == FT_MinimumAngle:
325         return aFilterMgr.CreateMinimumAngle()
326     elif theCriterion == FT_Taper:
327         return aFilterMgr.CreateTaper()
328     elif theCriterion == FT_Skew:
329         return aFilterMgr.CreateSkew()
330     elif theCriterion == FT_Area:
331         return aFilterMgr.CreateArea()
332     elif theCriterion == FT_Volume3D:
333         return aFilterMgr.CreateVolume3D()
334     elif theCriterion == FT_MultiConnection:
335         return aFilterMgr.CreateMultiConnection()
336     elif theCriterion == FT_MultiConnection2D:
337         return aFilterMgr.CreateMultiConnection2D()
338     elif theCriterion == FT_Length:
339         return aFilterMgr.CreateLength()
340     elif theCriterion == FT_Length2D:
341         return aFilterMgr.CreateLength2D()
342     else:
343         print "Error: given parameter is not numerucal functor type."
344
345
346     
347     
348 ## Mother class to define algorithm, recommended to don't use directly.
349 #
350 #  More details.
351 class Mesh_Algorithm:
352     #  @class Mesh_Algorithm
353     #  @brief Class Mesh_Algorithm
354
355     mesh = 0
356     geom = 0
357     subm = 0
358     algo = 0
359
360     ## If the algorithm is global, return 0; \n
361     #  else return the submesh associated to this algorithm.
362     def GetSubMesh(self):
363         return self.subm
364
365     ## Return the wrapped mesher.
366     def GetAlgorithm(self):
367         return self.algo
368
369     ## Get list of hypothesis that can be used with this algorithm
370     def GetCompatibleHypothesis(self):
371         list = []
372         if self.algo:
373             list = self.algo.GetCompatibleHypothesis()
374         return list
375
376     ## Get name of algo
377     def GetName(self):
378         GetName(self.algo)
379
380     ## Set name to algo
381     def SetName(self, name):
382         SetName(self.algo, name)
383
384     ## Get id of algo
385     def GetId(self):
386         return self.algo.GetId()
387     
388     ## Private method. Print error message if a hypothesis was not assigned.
389     def TreatHypoStatus(self, status, hypName, geomName, isAlgo):
390         if isAlgo:
391             hypType = "algorithm"
392         else:
393             hypType = "hypothesis"
394         if status == HYP_UNKNOWN_FATAL :
395             reason = "for unknown reason"
396         elif status == HYP_INCOMPATIBLE :
397             reason = "this hypothesis mismatches algorithm"
398         elif status == HYP_NOTCONFORM :
399             reason = "not conform mesh would be built"
400         elif status == HYP_ALREADY_EXIST :
401             reason = hypType + " of the same dimension already assigned to this shape"
402         elif status == HYP_BAD_DIM :
403             reason = hypType + " mismatches shape"
404         elif status == HYP_CONCURENT :
405             reason = "there are concurrent hypotheses on sub-shapes"
406         elif status == HYP_BAD_SUBSHAPE :
407             reason = "shape is neither the main one, nor its subshape, nor a valid group"
408         elif status == HYP_BAD_GEOMETRY:
409             reason = "geometry mismatches algorithm's expectation"
410         else:
411             return
412         hypName = '"' + hypName + '"'
413         geomName= '"' + geomName+ '"'
414         if status < HYP_UNKNOWN_FATAL:
415             print hypName, "was assigned to",    geomName,"but", reason
416         else:
417             print hypName, "was not assigned to",geomName,":", reason
418         pass
419         
420     ## Private method.
421     def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
422         if geom is None:
423             raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
424         self.mesh = mesh
425         piece = mesh.geom
426         if geom==0:
427             self.geom = piece
428             name = GetName(piece)
429         else:
430             self.geom = geom
431             name = GetName(geom)
432             if name==NO_NAME:
433                 name = geompy.SubShapeName(geom, piece)
434                 geompy.addToStudyInFather(piece, geom, name)
435             self.subm = mesh.mesh.GetSubMesh(geom, hypo)
436
437         self.algo = smesh.CreateHypothesis(hypo, so)
438         SetName(self.algo, name + "/" + hypo)
439         status = mesh.mesh.AddHypothesis(self.geom, self.algo)
440         self.TreatHypoStatus( status, hypo, name, 1 )
441         
442     ## Private method
443     def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"):
444         hypo = smesh.CreateHypothesis(hyp, so)
445         a = ""
446         s = "="
447         i = 0
448         n = len(args)
449         while i<n:
450             a = a + s + str(args[i])
451             s = ","
452             i = i + 1
453         name = GetName(self.geom)
454         SetName(hypo, name + "/" + hyp + a)
455         status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
456         self.TreatHypoStatus( status, hyp, name, 0 )
457         return hypo
458
459
460 # Public class: Mesh_Segment
461 # --------------------------
462
463 ## Class to define a segment 1D algorithm for discretization
464 #
465 #  More details.
466 class Mesh_Segment(Mesh_Algorithm):
467
468     ## Private constructor.
469     def __init__(self, mesh, geom=0):
470         self.Create(mesh, geom, "Regular_1D")
471         
472     ## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
473     #  @param l for the length of segments that cut an edge
474     def LocalLength(self, l):
475         hyp = self.Hypothesis("LocalLength", [l])
476         hyp.SetLength(l)
477         return hyp
478         
479     ## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
480     #  @param n for the number of segments that cut an edge
481     #  @param s for the scale factor (optional)
482     def NumberOfSegments(self, n, s=[]):
483         if s == []:
484             hyp = self.Hypothesis("NumberOfSegments", [n])
485         else:
486             hyp = self.Hypothesis("NumberOfSegments", [n,s])
487             hyp.SetDistrType( 1 )
488             hyp.SetScaleFactor(s)
489         hyp.SetNumberOfSegments(n)
490         return hyp
491         
492     ## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
493     #  @param start for the length of the first segment
494     #  @param end   for the length of the last  segment
495     def Arithmetic1D(self, start, end):
496         hyp = self.Hypothesis("Arithmetic1D", [start, end])
497         hyp.SetLength(start, 1)
498         hyp.SetLength(end  , 0)
499         return hyp
500         
501     ## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
502     #  @param start for the length of the first segment
503     #  @param end   for the length of the last  segment
504     def StartEndLength(self, start, end):
505         hyp = self.Hypothesis("StartEndLength", [start, end])
506         hyp.SetLength(start, 1)
507         hyp.SetLength(end  , 0)
508         return hyp
509         
510     ## Define "Deflection1D" hypothesis
511     #  @param d for the deflection
512     def Deflection1D(self, d):
513         hyp = self.Hypothesis("Deflection1D", [d])
514         hyp.SetDeflection(d)
515         return hyp
516         
517     ## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
518     #  the opposite side in the case of quadrangular faces
519     def Propagation(self):
520         return self.Hypothesis("Propagation")
521
522     ## Define "AutomaticLength" hypothesis
523     #  @param fineness for the fineness [0-1]
524     def AutomaticLength(self, fineness=0):
525         hyp = self.Hypothesis("AutomaticLength")
526         hyp.SetFineness( fineness )
527         return hyp
528
529     ## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
530     #  If the 2D mesher sees that all boundary edges are quadratic ones,
531     #  it generates quadratic faces, else it generates linear faces using
532     #  medium nodes as if they were vertex ones.
533     #  The 3D mesher generates quadratic volumes only if all boundary faces
534     #  are quadratic ones, else it fails.
535     def QuadraticMesh(self):
536         hyp = self.Hypothesis("QuadraticMesh")
537         return hyp
538
539 # Public class: Mesh_Segment_Python
540 # ---------------------------------
541
542 ## Class to define a segment 1D algorithm for discretization with python function
543 #
544 #  More details.
545 class Mesh_Segment_Python(Mesh_Segment):
546
547     ## Private constructor.
548     def __init__(self, mesh, geom=0):
549         import Python1dPlugin
550         self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
551     
552     ## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
553     #  @param n for the number of segments that cut an edge
554     #  @param func for the python function that calculate the length of all segments
555     def PythonSplit1D(self, n, func):
556         hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so")
557         hyp.SetNumberOfSegments(n)
558         hyp.SetPythonLog10RatioFunction(func)
559         return hyp
560         
561 # Public class: Mesh_Triangle
562 # ---------------------------
563
564 ## Class to define a triangle 2D algorithm
565 #
566 #  More details.
567 class Mesh_Triangle(Mesh_Algorithm):
568
569     algoType = 0
570     params = 0
571    
572     ## Private constructor.
573     def __init__(self, mesh, algoType, geom=0):
574         if algoType == MEFISTO:
575             self.Create(mesh, geom, "MEFISTO_2D")
576         elif algoType == NETGEN:
577             if noNETGENPlugin:
578                 print "Warning: NETGENPlugin module has not been imported."
579             self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
580         self.algoType = algoType
581
582     ## Define "MaxElementArea" hypothesis to give the maximun area of each triangles
583     #  @param area for the maximum area of each triangles
584     def MaxElementArea(self, area):
585         if self.algoType == MEFISTO:
586             hyp = self.Hypothesis("MaxElementArea", [area])
587             hyp.SetMaxElementArea(area)
588             return hyp
589         elif self.algoType == NETGEN:
590             print "Netgen 1D-2D algo doesn't support this hypothesis"
591             return None
592             
593     ## Define "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
594     def LengthFromEdges(self):
595         if self.algoType == MEFISTO:
596             hyp = self.Hypothesis("LengthFromEdges")
597             return hyp
598         elif self.algoType == NETGEN:
599             print "Netgen 1D-2D algo doesn't support this hypothesis"
600             return None
601         
602     ## Define "Netgen 2D Parameters" hypothesis
603     def Parameters(self):
604         if self.algoType == NETGEN:
605             self.params = self.Hypothesis("NETGEN_Parameters_2D", [], "libNETGENEngine.so")
606             return self.params
607         elif self.algoType == MEFISTO:
608             print "Mefisto algo doesn't support this hypothesis"
609             return None
610
611     ## Set MaxSize
612     def SetMaxSize(self, theSize):
613         if self.params == 0:
614             self.Parameters()
615         self.params.SetMaxSize(theSize)
616         
617     ## Set SecondOrder flag
618     def SetSecondOrder(seld, theVal):
619         if self.params == 0:
620             self.Parameters()
621         self.params.SetSecondOrder(theVal)
622
623     ## Set Optimize flag
624     def SetOptimize(self, theVal):
625         if self.params == 0:
626             self.Parameters()
627         self.params.SetOptimize(theVal)
628
629     ## Set Fineness
630     #  @param theFineness is:
631     #  VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom
632     def SetFineness(self, theFineness):
633         if self.params == 0:
634             self.Parameters()
635         self.params.SetFineness(theFineness)
636         
637     ## Set GrowthRate  
638     def SetGrowthRate(self, theRate):
639         if self.params == 0:
640             self.Parameters()
641         self.params.SetGrowthRate(theRate)
642
643     ## Set NbSegPerEdge
644     def SetNbSegPerEdge(self, theVal):
645         if self.params == 0:
646             self.Parameters()
647         self.params.SetNbSegPerEdge(theVal)
648
649     ## Set NbSegPerRadius
650     def SetNbSegPerRadius(self, theVal):
651         if self.params == 0:
652             self.Parameters()
653         self.params.SetNbSegPerRadius(theVal)
654
655     ## Set QuadAllowed flag
656     def SetQuadAllowed(self, toAllow):
657         if self.params == 0:
658             self.Parameters()
659         self.params.SetQuadAllowed(toAllow)
660         
661     
662 # Public class: Mesh_Quadrangle
663 # -----------------------------
664
665 ## Class to define a quadrangle 2D algorithm
666 #
667 #  More details.
668 class Mesh_Quadrangle(Mesh_Algorithm):
669
670     ## Private constructor.
671     def __init__(self, mesh, geom=0):
672         self.Create(mesh, geom, "Quadrangle_2D")
673     
674     ## Define "QuadranglePreference" hypothesis, forcing construction
675     #  of quadrangles if the number of nodes on opposite edges is not the same
676     #  in the case where the global number of nodes on edges is even
677     def QuadranglePreference(self):
678         hyp = self.Hypothesis("QuadranglePreference")
679         return hyp
680     
681 # Public class: Mesh_Tetrahedron
682 # ------------------------------
683
684 ## Class to define a tetrahedron 3D algorithm
685 #
686 #  More details.
687 class Mesh_Tetrahedron(Mesh_Algorithm):
688
689     params = 0
690     algoType = 0
691
692     ## Private constructor.
693     def __init__(self, mesh, algoType, geom=0):
694         if algoType == NETGEN:
695             self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
696         elif algoType == GHS3D:
697             import GHS3DPlugin
698             self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
699         elif algoType == FULL_NETGEN:
700             if noNETGENPlugin:
701                 print "Warning: NETGENPlugin module has not been imported."
702             self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
703         self.algoType = algoType
704
705     ## Define "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedral
706     #  @param vol for the maximum volume of each tetrahedral
707     def MaxElementVolume(self, vol):
708         hyp = self.Hypothesis("MaxElementVolume", [vol])
709         hyp.SetMaxElementVolume(vol)
710         return hyp
711
712     ## Define "Netgen 3D Parameters" hypothesis
713     def Parameters(self):
714         if (self.algoType == FULL_NETGEN):
715             self.params = self.Hypothesis("NETGEN_Parameters", [], "libNETGENEngine.so")
716             return self.params
717         else:
718             print "Algo doesn't support this hypothesis"
719             return None 
720             
721     ## Set MaxSize
722     def SetMaxSize(self, theSize):
723         if self.params == 0:
724             self.Parameters()
725         self.params.SetMaxSize(theSize)
726         
727     ## Set SecondOrder flag
728     def SetSecondOrder(self, theVal):
729         if self.params == 0:
730             self.Parameters()
731         self.params.SetSecondOrder(theVal)
732
733     ## Set Optimize flag
734     def SetOptimize(self, theVal):
735         if self.params == 0:
736             self.Parameters()
737         self.params.SetOptimize(theVal)
738
739     ## Set Fineness
740     #  @param theFineness is:
741     #  VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom
742     def SetFineness(self, theFineness):
743         if self.params == 0:
744             self.Parameters()
745         self.params.SetFineness(theFineness)
746         
747     ## Set GrowthRate  
748     def SetGrowthRate(self, theRate):
749         if self.params == 0:
750             self.Parameters()
751         self.params.SetGrowthRate(theRate)
752
753     ## Set NbSegPerEdge
754     def SetNbSegPerEdge(self, theVal):
755         if self.params == 0:
756             self.Parameters()
757         self.params.SetNbSegPerEdge(theVal)
758
759     ## Set NbSegPerRadius
760     def SetNbSegPerRadius(self, theVal):
761         if self.params == 0:
762             self.Parameters()
763         self.params.SetNbSegPerRadius(theVal)
764
765 # Public class: Mesh_Hexahedron
766 # ------------------------------
767
768 ## Class to define a hexahedron 3D algorithm
769 #
770 #  More details.
771 class Mesh_Hexahedron(Mesh_Algorithm):
772
773     ## Private constructor.
774     def __init__(self, mesh, geom=0):
775         self.Create(mesh, geom, "Hexa_3D")
776
777 # Deprecated, only for compatibility!
778 # Public class: Mesh_Netgen
779 # ------------------------------
780
781 ## Class to define a NETGEN-based 2D or 3D algorithm
782 #  that need no discrete boundary (i.e. independent)
783 #
784 #  This class is deprecated, only for compatibility!
785 #
786 #  More details.
787 class Mesh_Netgen(Mesh_Algorithm):
788
789     is3D = 0
790
791     ## Private constructor.
792     def __init__(self, mesh, is3D, geom=0):
793         if noNETGENPlugin:
794             print "Warning: NETGENPlugin module has not been imported."
795             
796         self.is3D = is3D
797         if is3D:
798             self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
799         else:
800             self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
801
802     ## Define hypothesis containing parameters of the algorithm
803     def Parameters(self):
804         if self.is3D:
805             hyp = self.Hypothesis("NETGEN_Parameters", [], "libNETGENEngine.so")
806         else:
807             hyp = self.Hypothesis("NETGEN_Parameters_2D", [], "libNETGENEngine.so")
808         return hyp
809
810 # Public class: Mesh_Projection1D
811 # ------------------------------
812
813 ## Class to define a projection 1D algorithm
814 #
815 #  More details.
816 class Mesh_Projection1D(Mesh_Algorithm):
817
818     ## Private constructor.
819     def __init__(self, mesh, geom=0):
820         self.Create(mesh, geom, "Projection_1D")
821
822     ## Define "Source Edge" hypothesis, specifying a meshed edge to
823     #  take a mesh pattern from, and optionally association of vertices
824     #  between the source edge and a target one (where a hipothesis is assigned to)
825     #  @param edge to take nodes distribution from
826     #  @param mesh to take nodes distribution from (optional)
827     #  @param srcV is vertex of \a edge to associate with \a tgtV (optional)
828     #  @param tgtV is vertex of \a the edge where the algorithm is assigned,
829     #  to associate with \a srcV (optional)
830     def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None):
831         hyp = self.Hypothesis("ProjectionSource1D")
832         hyp.SetSourceEdge( edge )
833         if not mesh is None and isinstance(mesh, Mesh):
834             mesh = mesh.GetMesh()
835         hyp.SetSourceMesh( mesh )
836         hyp.SetVertexAssociation( srcV, tgtV )
837         return hyp
838
839
840 # Public class: Mesh_Projection2D
841 # ------------------------------
842
843 ## Class to define a projection 2D algorithm
844 #
845 #  More details.
846 class Mesh_Projection2D(Mesh_Algorithm):
847
848     ## Private constructor.
849     def __init__(self, mesh, geom=0):
850         self.Create(mesh, geom, "Projection_2D")
851
852     ## Define "Source Face" hypothesis, specifying a meshed face to
853     #  take a mesh pattern from, and optionally association of vertices
854     #  between the source face and a target one (where a hipothesis is assigned to)
855     #  @param face to take mesh pattern from
856     #  @param mesh to take mesh pattern from (optional)
857     #  @param srcV1 is vertex of \a face to associate with \a tgtV1 (optional)
858     #  @param tgtV1 is vertex of \a the face where the algorithm is assigned,
859     #  to associate with \a srcV1 (optional)
860     #  @param srcV2 is vertex of \a face to associate with \a tgtV1 (optional)
861     #  @param tgtV2 is vertex of \a the face where the algorithm is assigned,
862     #  to associate with \a srcV2 (optional)
863     #
864     #  Note: association vertices must belong to one edge of a face
865     def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None, srcV2=None, tgtV2=None):
866         hyp = self.Hypothesis("ProjectionSource2D")
867         hyp.SetSourceFace( face )
868         if not mesh is None and isinstance(mesh, Mesh):
869             mesh = mesh.GetMesh()
870         hyp.SetSourceMesh( mesh )
871         hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
872         return hyp
873
874 # Public class: Mesh_Projection3D
875 # ------------------------------
876
877 ## Class to define a projection 3D algorithm
878 #
879 #  More details.
880 class Mesh_Projection3D(Mesh_Algorithm):
881
882     ## Private constructor.
883     def __init__(self, mesh, geom=0):
884         self.Create(mesh, geom, "Projection_3D")
885
886     ## Define "Source Shape 3D" hypothesis, specifying a meshed solid to
887     #  take a mesh pattern from, and optionally association of vertices
888     #  between the source solid and a target one (where a hipothesis is assigned to)
889     #  @param solid to take mesh pattern from
890     #  @param mesh to take mesh pattern from (optional)
891     #  @param srcV1 is vertex of \a solid to associate with \a tgtV1 (optional)
892     #  @param tgtV1 is vertex of \a the solid where the algorithm is assigned,
893     #  to associate with \a srcV1 (optional)
894     #  @param srcV2 is vertex of \a solid to associate with \a tgtV1 (optional)
895     #  @param tgtV2 is vertex of \a the solid where the algorithm is assigned,
896     #  to associate with \a srcV2 (optional)
897     #
898     #  Note: association vertices must belong to one edge of a solid
899     def SourceShape3D(self, solid, mesh=0, srcV1=0, tgtV1=0, srcV2=0, tgtV2=0):
900         hyp = self.Hypothesis("ProjectionSource3D")
901         hyp.SetSource3DShape( solid )
902         if not mesh is None and isinstance(mesh, Mesh):
903             mesh = mesh.GetMesh()
904         hyp.SetSourceMesh( mesh )
905         hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
906         return hyp
907
908
909 # Public class: Mesh_Prism
910 # ------------------------
911
912 ## Class to define a Prism 3D algorithm
913 #
914 #  More details.
915 class Mesh_Prism3D(Mesh_Algorithm):
916
917     ## Private constructor.
918     def __init__(self, mesh, geom=0):
919         self.Create(mesh, geom, "Prism_3D")
920
921 # Public class: Mesh_RadialPrism
922 # -------------------------------
923
924 ## Class to define a Radial Prism 3D algorithm
925 #
926 #  More details.
927 class Mesh_RadialPrism3D(Mesh_Algorithm):
928
929     ## Private constructor.
930     def __init__(self, mesh, geom=0):
931         self.Create(mesh, geom, "RadialPrism_3D")
932         self.distribHyp = self.Hypothesis( "LayerDistribution" )
933
934     ## Return 3D hypothesis holding the 1D one
935     def Get3DHypothesis(self):
936         return self.distribHyp
937
938     ## Private method creating 1D hypothes and storing it in the LayerDistribution
939     #  hypothes. Returns the created hypothes
940     def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
941         study = GetCurrentStudy() # prevent publishing of own 1D hypothesis
942         hyp = smesh.CreateHypothesis(hypType, so)
943         SetCurrentStudy( study ) # anable publishing
944         self.distribHyp.SetLayerDistribution( hyp )
945         return hyp
946
947     ## Define "NumberOfLayers" hypothesis, specifying a number of layers of
948     #  prisms to build between the inner and outer shells
949     def NumberOfLayers(self, n ):
950         hyp = self.Hypothesis("NumberOfLayers")
951         hyp.SetNumberOfLayers( n )
952         return hyp
953
954     ## Define "LocalLength" hypothesis, specifying segment length
955     #  to build between the inner and outer shells
956     #  @param l for the length of segments
957     def LocalLength(self, l):
958         hyp = self.OwnHypothesis("LocalLength", [l])
959         hyp.SetLength(l)
960         return hyp
961         
962     ## Define "NumberOfSegments" hypothesis, specifying a number of layers of
963     #  prisms to build between the inner and outer shells
964     #  @param n for the number of segments
965     #  @param s for the scale factor (optional)
966     def NumberOfSegments(self, n, s=[]):
967         if s == []:
968             hyp = self.OwnHypothesis("NumberOfSegments", [n])
969         else:
970             hyp = self.OwnHypothesis("NumberOfSegments", [n,s])
971             hyp.SetDistrType( 1 )
972             hyp.SetScaleFactor(s)
973         hyp.SetNumberOfSegments(n)
974         return hyp
975         
976     ## Define "Arithmetic1D" hypothesis, specifying distribution of segments
977     #  to build between the inner and outer shells as arithmetic length increasing
978     #  @param start for the length of the first segment
979     #  @param end   for the length of the last  segment
980     def Arithmetic1D(self, start, end):
981         hyp = self.OwnHypothesis("Arithmetic1D", [start, end])
982         hyp.SetLength(start, 1)
983         hyp.SetLength(end  , 0)
984         return hyp
985         
986     ## Define "StartEndLength" hypothesis, specifying distribution of segments
987     #  to build between the inner and outer shells as geometric length increasing
988     #  @param start for the length of the first segment
989     #  @param end   for the length of the last  segment
990     def StartEndLength(self, start, end):
991         hyp = self.OwnHypothesis("StartEndLength", [start, end])
992         hyp.SetLength(start, 1)
993         hyp.SetLength(end  , 0)
994         return hyp
995         
996     ## Define "AutomaticLength" hypothesis, specifying number of segments
997     #  to build between the inner and outer shells
998     #  @param fineness for the fineness [0-1]
999     def AutomaticLength(self, fineness=0):
1000         hyp = self.OwnHypothesis("AutomaticLength")
1001         hyp.SetFineness( fineness )
1002         return hyp
1003
1004
1005 # Public class: Mesh
1006 # ==================
1007
1008 ## Class to define a mesh
1009 #
1010 #  The class contains mesh shape, SMESH_Mesh, SMESH_MeshEditor
1011 #  More details.
1012 class Mesh:
1013
1014     geom = 0
1015     mesh = 0
1016     editor = 0
1017
1018     ## Constructor
1019     #
1020     #  Creates mesh on the shape \a geom(or the empty mesh if geom equal to 0),
1021     #  sets GUI name of this mesh to \a name.
1022     #  @param obj Shape to be meshed or SMESH_Mesh object
1023     #  @param name Study name of the mesh
1024     def __init__(self, obj=0, name=0):
1025         if obj is None:
1026             obj = 0
1027         if obj != 0:
1028             if isinstance(obj, geompy.GEOM._objref_GEOM_Object):
1029                 self.geom = obj
1030                 self.mesh = smesh.CreateMesh(self.geom)
1031             elif isinstance(obj, SMESH._objref_SMESH_Mesh):
1032                 self.SetMesh(obj)
1033         else:
1034             self.mesh = smesh.CreateEmptyMesh()
1035         if name != 0:
1036             SetName(self.mesh, name)
1037         elif obj != 0:
1038             SetName(self.mesh, GetName(obj))
1039
1040         self.editor = self.mesh.GetMeshEditor()
1041
1042     ## Method that inits the Mesh object from SMESH_Mesh interface
1043     #  @param theMesh is SMESH_Mesh object
1044     def SetMesh(self, theMesh):
1045         self.mesh = theMesh
1046         self.geom = self.mesh.GetShapeToMesh()
1047             
1048     ## Method that returns the mesh
1049     #  @return SMESH_Mesh object
1050     def GetMesh(self):
1051         return self.mesh
1052
1053     ## Get mesh name
1054     def GetName(self):
1055         name = GetName(self.GetMesh())
1056         return name
1057
1058     ## Set name to mesh
1059     def SetName(self, name):
1060         SetName(self.GetMesh(), name)
1061     
1062     ## Get the subMesh object associated to a subShape. The subMesh object
1063     #  gives access to nodes and elements IDs.
1064     #  \n SubMesh will be used instead of SubShape in a next idl version to
1065     #  adress a specific subMesh...
1066     def GetSubMesh(self, theSubObject, name):
1067         submesh = self.mesh.GetSubMesh(theSubObject, name)
1068         return submesh
1069         
1070     ## Method that returns the shape associated to the mesh
1071     #  @return GEOM_Object
1072     def GetShape(self):
1073         return self.geom
1074
1075     ## Method that associates given shape to the mesh(entails the mesh recreation)
1076     #  @param geom shape to be meshed(GEOM_Object)
1077     def SetShape(self, geom):
1078         self.mesh = smesh.CreateMesh(geom)  
1079                 
1080     ## Return true if hypotheses are defined well
1081     #  @param theMesh is an instance of Mesh class
1082     #  @param theSubObject subshape of a mesh shape
1083     def IsReadyToCompute(self, theSubObject):
1084         return smesh.IsReadyToCompute(self.mesh, theSubObject)
1085
1086     ## Return errors of hypotheses definintion
1087     #  error list is empty if everything is OK
1088     #  @param theMesh is an instance of Mesh class
1089     #  @param theSubObject subshape of a mesh shape
1090     #  @return a list of errors
1091     def GetAlgoState(self, theSubObject):
1092         return smesh.GetAlgoState(self.mesh, theSubObject)
1093     
1094     ## Return geometrical object the given element is built on.
1095     #  The returned geometrical object, if not nil, is either found in the 
1096     #  study or is published by this method with the given name
1097     #  @param theMesh is an instance of Mesh class
1098     #  @param theElementID an id of the mesh element
1099     #  @param theGeomName user defined name of geometrical object
1100     #  @return GEOM::GEOM_Object instance
1101     def GetGeometryByMeshElement(self, theElementID, theGeomName):
1102         return smesh.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName )
1103         
1104     ## Returns mesh dimension depending on shape one
1105     def MeshDimension(self):
1106         shells = geompy.SubShapeAllIDs( self.geom, geompy.ShapeType["SHELL"] )
1107         if len( shells ) > 0 :
1108             return 3
1109         elif geompy.NumberOfFaces( self.geom ) > 0 :
1110             return 2
1111         elif geompy.NumberOfEdges( self.geom ) > 0 :
1112             return 1
1113         else:
1114             return 0;
1115         pass
1116         
1117     ## Creates a segment discretization 1D algorithm.
1118     #  If the optional \a algo parameter is not sets, this algorithm is REGULAR.
1119     #  If the optional \a geom parameter is not sets, this algorithm is global.
1120     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
1121     #  @param algo values are smesh.REGULAR or smesh.PYTHON for discretization via python function
1122     #  @param geom If defined, subshape to be meshed
1123     def Segment(self, algo=REGULAR, geom=0):
1124         ## if Segment(geom) is called by mistake
1125         if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)):
1126             algo, geom = geom, algo
1127             pass
1128         if algo == REGULAR:
1129             return Mesh_Segment(self, geom)
1130         elif algo == PYTHON:
1131             return Mesh_Segment_Python(self, geom)
1132         else:
1133             return Mesh_Segment(self, geom)
1134         
1135     ## Creates a triangle 2D algorithm for faces.
1136     #  If the optional \a geom parameter is not sets, this algorithm is global.
1137     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
1138     #  @param algo values are: smesh.MEFISTO or smesh.NETGEN
1139     #  @param geom If defined, subshape to be meshed
1140     def Triangle(self, algo=MEFISTO, geom=0):
1141         ## if Triangle(geom) is called by mistake
1142         if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)):
1143             geom = algo
1144             algo = MEFISTO
1145         
1146         return Mesh_Triangle(self, algo, geom)
1147         
1148     ## Creates a quadrangle 2D algorithm for faces.
1149     #  If the optional \a geom parameter is not sets, this algorithm is global.
1150     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
1151     #  @param geom If defined, subshape to be meshed
1152     def Quadrangle(self, geom=0):
1153         return Mesh_Quadrangle(self, geom)
1154
1155     ## Creates a tetrahedron 3D algorithm for solids.
1156     #  The parameter \a algo permits to choice the algorithm: NETGEN or GHS3D
1157     #  If the optional \a geom parameter is not sets, this algorithm is global.
1158     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
1159     #  @param algo values are: smesh.NETGEN, smesh.GHS3D, smesh.FULL_NETGEN
1160     #  @param geom If defined, subshape to be meshed
1161     def Tetrahedron(self, algo=NETGEN, geom=0):
1162         ## if Tetrahedron(geom) is called by mistake
1163         if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)):
1164             algo, geom = geom, algo
1165             pass
1166         return Mesh_Tetrahedron(self, algo, geom)
1167         
1168     ## Creates a hexahedron 3D algorithm for solids.
1169     #  If the optional \a geom parameter is not sets, this algorithm is global.
1170     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
1171     #  @param geom If defined, subshape to be meshed
1172     def Hexahedron(self, geom=0):
1173         return Mesh_Hexahedron(self, geom)
1174
1175     ## Deprecated, only for compatibility!
1176     def Netgen(self, is3D, geom=0):
1177         return Mesh_Netgen(self, is3D, geom)
1178
1179     ## Creates a projection 1D algorithm for edges.
1180     #  If the optional \a geom parameter is not sets, this algorithm is global.
1181     #  Otherwise, this algorithm define a submesh based on \a geom subshape.
1182     #  @param geom If defined, subshape to be meshed
1183     def Projection1D(self, geom=0):
1184         return Mesh_Projection1D(self, geom)
1185
1186     ## Creates a projection 2D algorithm for faces.
1187     #  If the optional \a geom parameter is not sets, this algorithm is global.
1188     #  Otherwise, this algorithm define a submesh based on \a geom subshape.
1189     #  @param geom If defined, subshape to be meshed
1190     def Projection2D(self, geom=0):
1191         return Mesh_Projection2D(self, geom)
1192
1193     ## Creates a projection 3D algorithm for solids.
1194     #  If the optional \a geom parameter is not sets, this algorithm is global.
1195     #  Otherwise, this algorithm define a submesh based on \a geom subshape.
1196     #  @param geom If defined, subshape to be meshed
1197     def Projection3D(self, geom=0):
1198         return Mesh_Projection3D(self, geom)
1199
1200     ## Creates a Prism 3D or RadialPrism 3D algorithm for solids.
1201     #  If the optional \a geom parameter is not sets, this algorithm is global.
1202     #  Otherwise, this algorithm define a submesh based on \a geom subshape.
1203     #  @param geom If defined, subshape to be meshed
1204     def Prism(self, geom=0):
1205         shape = geom
1206         if shape==0:
1207             shape = self.geom
1208         nbSolids = len( geompy.SubShapeAll( shape, geompy.ShapeType["SOLID"] ))
1209         nbShells = len( geompy.SubShapeAll( shape, geompy.ShapeType["SHELL"] ))
1210         if nbSolids == 0 or nbSolids == nbShells:
1211             return Mesh_Prism3D(self, geom)
1212         return Mesh_RadialPrism3D(self, geom)
1213
1214     ## Compute the mesh and return the status of the computation
1215     def Compute(self, geom=0):
1216         if geom == 0 or not isinstance(geom, geompy.GEOM._objref_GEOM_Object):
1217             if self.geom == 0:
1218                 print "Compute impossible: mesh is not constructed on geom shape."
1219                 return 0
1220             else:
1221                 geom = self.geom
1222         ok = smesh.Compute(self.mesh, geom)
1223         if not ok:
1224             errors = smesh.GetAlgoState( self.mesh, geom )
1225             allReasons = ""
1226             for err in errors:
1227                 if err.isGlobalAlgo:
1228                     glob = " global "
1229                 else:
1230                     glob = " local "
1231                     pass
1232                 dim = str(err.algoDim)
1233                 if err.name == MISSING_ALGO:
1234                     reason = glob + dim + "D algorithm is missing"
1235                 elif err.name == MISSING_HYPO:
1236                     name = '"' + err.algoName + '"'
1237                     reason = glob + dim + "D algorithm " + name + " misses " + dim + "D hypothesis"
1238                 elif err.name == NOT_CONFORM_MESH:
1239                     reason = "Global \"Not Conform mesh allowed\" hypothesis is missing"
1240                 elif err.name == BAD_PARAM_VALUE:
1241                     name = '"' + err.algoName + '"'
1242                     reason = "Hypothesis of" + glob + dim + "D algorithm " + name +\
1243                              " has a bad parameter value"
1244                 else:
1245                     reason = "For unknown reason."+\
1246                              " Revise Mesh.Compute() implementation in smesh.py!"
1247                     pass
1248                 if allReasons != "":
1249                     allReasons += "\n"
1250                     pass
1251                 allReasons += reason
1252                 pass
1253             if allReasons != "":
1254                 print '"' + GetName(self.mesh) + '"',"not computed:"
1255                 print allReasons
1256                 pass
1257             pass
1258         if salome.sg.hasDesktop():
1259             smeshgui = salome.ImportComponentGUI("SMESH")
1260             smeshgui.Init(salome.myStudyId)
1261             smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok )
1262             salome.sg.updateObjBrowser(1)
1263             pass
1264         return ok
1265
1266     ## Compute tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN
1267     #  The parameter \a fineness [0,-1] defines mesh fineness
1268     def AutomaticTetrahedralization(self, fineness=0):
1269         dim = self.MeshDimension()
1270         # assign hypotheses
1271         self.RemoveGlobalHypotheses()
1272         self.Segment().AutomaticLength(fineness)
1273         if dim > 1 :
1274             self.Triangle().LengthFromEdges()
1275             pass
1276         if dim > 2 :
1277             self.Tetrahedron(NETGEN)
1278             pass
1279         return self.Compute()
1280         
1281     ## Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
1282     #  The parameter \a fineness [0,-1] defines mesh fineness
1283     def AutomaticHexahedralization(self, fineness=0):
1284         dim = self.MeshDimension()
1285         # assign hypotheses
1286         self.RemoveGlobalHypotheses()
1287         self.Segment().AutomaticLength(fineness)
1288         if dim > 1 :
1289             self.Quadrangle()
1290             pass
1291         if dim > 2 :
1292             self.Hexahedron()            
1293             pass
1294         return self.Compute()
1295     
1296     ## Get the list of hypothesis added on a geom
1297     #  @param geom is subhape of mesh geometry
1298     def GetHypothesisList(self, geom):
1299         return self.mesh.GetHypothesisList( geom )
1300                 
1301     ## Removes all global hypotheses
1302     def RemoveGlobalHypotheses(self):
1303         current_hyps = self.mesh.GetHypothesisList( self.geom )
1304         for hyp in current_hyps:
1305             self.mesh.RemoveHypothesis( self.geom, hyp )
1306             pass
1307         pass
1308         
1309     ## Create a mesh group based on geometric object \a grp
1310     #  and give a \a name, \n if this parameter is not defined
1311     #  the name is the same as the geometric group name \n
1312     #  Note: Works like GroupOnGeom(). 
1313     #  @param grp  is a geometric group, a vertex, an edge, a face or a solid
1314     #  @param name is the name of the mesh group
1315     #  @return SMESH_GroupOnGeom
1316     def Group(self, grp, name=""):
1317         return self.GroupOnGeom(grp, name)
1318        
1319     ## Deprecated, only for compatibility! Please, use ExportMED() method instead.
1320     #  Export the mesh in a file with the MED format and choice the \a version of MED format
1321     #  @param f is the file name
1322     #  @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
1323     def ExportToMED(self, f, version, opt=0):
1324         self.mesh.ExportToMED(f, opt, version)
1325         
1326     ## Export the mesh in a file with the MED format
1327     #  @param f is the file name
1328     #  @param auto_groups boolean parameter for creating/not creating
1329     #  the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
1330     #  the typical use is auto_groups=false.
1331     #  @param version MED format version(MED_V2_1 or MED_V2_2)
1332     def ExportMED(self, f, auto_groups=0, version=MED_V2_2):
1333         self.mesh.ExportToMED(f, auto_groups, version)
1334         
1335     ## Export the mesh in a file with the DAT format
1336     #  @param f is the file name
1337     def ExportDAT(self, f):
1338         self.mesh.ExportDAT(f)
1339         
1340     ## Export the mesh in a file with the UNV format
1341     #  @param f is the file name
1342     def ExportUNV(self, f):
1343         self.mesh.ExportUNV(f)
1344         
1345     ## Export the mesh in a file with the STL format
1346     #  @param f is the file name
1347     #  @param ascii defined the kind of file contents
1348     def ExportSTL(self, f, ascii=1):
1349         self.mesh.ExportSTL(f, ascii)
1350    
1351         
1352     # Operations with groups:
1353     # ----------------------
1354
1355     ## Creates an empty mesh group
1356     #  @param elementType is the type of elements in the group
1357     #  @param name is the name of the mesh group
1358     #  @return SMESH_Group
1359     def CreateEmptyGroup(self, elementType, name):
1360         return self.mesh.CreateGroup(elementType, name)
1361     
1362     ## Creates a mesh group based on geometric object \a grp
1363     #  and give a \a name, \n if this parameter is not defined
1364     #  the name is the same as the geometric group name
1365     #  @param grp  is a geometric group, a vertex, an edge, a face or a solid
1366     #  @param name is the name of the mesh group
1367     #  @return SMESH_GroupOnGeom
1368     def GroupOnGeom(self, grp, name="", type=None):
1369         if name == "":
1370             name = grp.GetName()
1371
1372         if type == None:
1373             tgeo = str(grp.GetShapeType())
1374             if tgeo == "VERTEX":
1375                 type = NODE
1376             elif tgeo == "EDGE":
1377                 type = EDGE
1378             elif tgeo == "FACE":
1379                 type = FACE
1380             elif tgeo == "SOLID":
1381                 type = VOLUME
1382             elif tgeo == "SHELL":
1383                 type = VOLUME
1384             elif tgeo == "COMPOUND":
1385                 if len( geompy.GetObjectIDs( grp )) == 0:
1386                     print "Mesh.Group: empty geometric group", GetName( grp )
1387                     return 0
1388                 tgeo = geompy.GetType(grp)
1389                 if tgeo == geompy.ShapeType["VERTEX"]:
1390                     type = NODE
1391                 elif tgeo == geompy.ShapeType["EDGE"]:
1392                     type = EDGE
1393                 elif tgeo == geompy.ShapeType["FACE"]:
1394                     type = FACE
1395                 elif tgeo == geompy.ShapeType["SOLID"]:
1396                     type = VOLUME
1397
1398         if type == None:
1399             print "Mesh.Group: bad first argument: expected a group, a vertex, an edge, a face or a solid"
1400             return 0
1401         else:
1402             return self.mesh.CreateGroupFromGEOM(type, name, grp)
1403
1404     ## Create a mesh group by the given ids of elements
1405     #  @param groupName is the name of the mesh group
1406     #  @param elementType is the type of elements in the group
1407     #  @param elemIDs is the list of ids
1408     #  @return SMESH_Group
1409     def MakeGroupByIds(self, groupName, elementType, elemIDs):
1410         group = self.mesh.CreateGroup(elementType, groupName)
1411         group.Add(elemIDs)
1412         return group
1413     
1414     ## Create a mesh group by the given conditions
1415     #  @param groupName is the name of the mesh group
1416     #  @param elementType is the type of elements in the group
1417     #  @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
1418     #  @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo}
1419     #  @param Treshold is threshold value (range of id ids as string, shape, numeric)
1420     #  @param UnaryOp is FT_LogicalNOT or FT_Undefined
1421     #  @return SMESH_Group
1422     def MakeGroup(self,
1423                   groupName,
1424                   elementType,
1425                   CritType=FT_Undefined,
1426                   Compare=FT_EqualTo,
1427                   Treshold="",
1428                   UnaryOp=FT_Undefined):
1429         aCriterion = GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined)
1430         group = self.MakeGroupByCriterion(groupName, aCriterion)
1431         return group
1432
1433     ## Create a mesh group by the given criterion
1434     #  @param groupName is the name of the mesh group
1435     #  @param Criterion is the instance of Criterion class
1436     #  @return SMESH_Group
1437     def MakeGroupByCriterion(self, groupName, Criterion):
1438         aFilterMgr = smesh.CreateFilterManager()
1439         aFilter = aFilterMgr.CreateFilter()
1440         aCriteria = []
1441         aCriteria.append(Criterion)
1442         aFilter.SetCriteria(aCriteria)
1443         group = self.MakeGroupByFilter(groupName, aFilter)
1444         return group
1445     
1446     ## Create a mesh group by the given criteria(list of criterions)
1447     #  @param groupName is the name of the mesh group
1448     #  @param Criteria is the list of criterions
1449     #  @return SMESH_Group
1450     def MakeGroupByCriteria(self, groupName, theCriteria):
1451         aFilterMgr = smesh.CreateFilterManager()
1452         aFilter = aFilterMgr.CreateFilter()
1453         aFilter.SetCriteria(theCriteria)
1454         group = self.MakeGroupByFilter(groupName, aFilter)
1455         return group
1456     
1457     ## Create a mesh group by the given filter
1458     #  @param groupName is the name of the mesh group
1459     #  @param Criterion is the instance of Filter class
1460     #  @return SMESH_Group
1461     def MakeGroupByFilter(self, groupName, theFilter):
1462         anIds = theFilter.GetElementsId(self.mesh)
1463         anElemType = theFilter.GetElementType()
1464         group = self.MakeGroupByIds(groupName, anElemType, anIds)
1465         return group
1466
1467     ## Pass mesh elements through the given filter and return ids
1468     #  @param theFilter is SMESH_Filter
1469     #  @return list of ids
1470     def GetIdsFromFilter(self, theFilter):
1471         return theFilter.GetElementsId(self.mesh)
1472
1473     ## Verify whether 2D mesh element has free edges(edges connected to one face only)\n
1474     #  Returns list of special structures(borders).
1475     #  @return list of SMESH.FreeEdges.Border structure: edge id and two its nodes ids.
1476     def GetFreeBorders(self):
1477         aFilterMgr = smesh.CreateFilterManager()
1478         aPredicate = aFilterMgr.CreateFreeEdges()
1479         aPredicate.SetMesh(self.mesh)
1480         aBorders = aPredicate.GetBorders()
1481         return aBorders
1482                 
1483     ## Remove a group
1484     def RemoveGroup(self, group):
1485         self.mesh.RemoveGroup(group)
1486
1487     ## Remove group with its contents
1488     def RemoveGroupWithContents(self, group):
1489         self.mesh.RemoveGroupWithContents(group)
1490         
1491     ## Get the list of groups existing in the mesh
1492     def GetGroups(self):
1493         return self.mesh.GetGroups()
1494
1495     ## Get the list of names of groups existing in the mesh
1496     def GetGroupNames(self):
1497         groups = self.GetGroups()
1498         names = []
1499         for group in groups:
1500             names.append(group.GetName())
1501         return names
1502
1503     ## Union of two groups
1504     #  New group is created. All mesh elements that are
1505     #  present in initial groups are added to the new one
1506     def UnionGroups(self, group1, group2, name):
1507         return self.mesh.UnionGroups(group1, group2, name)
1508
1509     ## Intersection of two groups
1510     #  New group is created. All mesh elements that are
1511     #  present in both initial groups are added to the new one.
1512     def IntersectGroups(self, group1, group2, name):
1513         return self.mesh.IntersectGroups(group1, group2, name)
1514     
1515     ## Cut of two groups
1516     #  New group is created. All mesh elements that are present in
1517     #  main group but do not present in tool group are added to the new one
1518     def CutGroups(self, mainGroup, toolGroup, name):
1519         return self.mesh.CutGroups(mainGroup, toolGroup, name)
1520          
1521     
1522     # Get some info about mesh:
1523     # ------------------------
1524
1525     ## Get the log of nodes and elements added or removed since previous
1526     #  clear of the log.
1527     #  @param clearAfterGet log is emptied after Get (safe if concurrents access)
1528     #  @return list of log_block structures:
1529     #                                        commandType
1530     #                                        number
1531     #                                        coords
1532     #                                        indexes
1533     def GetLog(self, clearAfterGet):
1534         return self.mesh.GetLog(clearAfterGet)
1535
1536     ## Clear the log of nodes and elements added or removed since previous
1537     #  clear. Must be used immediately after GetLog if clearAfterGet is false.
1538     def ClearLog(self):
1539         self.mesh.ClearLog()
1540
1541     ## Get the internal Id
1542     def GetId(self):
1543         return self.mesh.GetId()
1544
1545     ## Get the study Id
1546     def GetStudyId(self):
1547         return self.mesh.GetStudyId()
1548
1549     ## Check group names for duplications.
1550     #  Consider maximum group name length stored in MED file.
1551     def HasDuplicatedGroupNamesMED(self):
1552         return self.mesh.GetStudyId()
1553         
1554     ## Obtain instance of SMESH_MeshEditor
1555     def GetMeshEditor(self):
1556         return self.mesh.GetMeshEditor()
1557
1558     ## Get MED Mesh
1559     def GetMEDMesh(self):
1560         return self.mesh.GetMEDMesh()
1561     
1562     
1563     # Get informations about mesh contents:
1564     # ------------------------------------
1565
1566     ## Returns number of nodes in mesh
1567     def NbNodes(self):
1568         return self.mesh.NbNodes()
1569
1570     ## Returns number of elements in mesh
1571     def NbElements(self):
1572         return self.mesh.NbElements()
1573
1574     ## Returns number of edges in mesh
1575     def NbEdges(self):
1576         return self.mesh.NbEdges()
1577
1578     ## Returns number of edges with given order in mesh
1579     #  @param elementOrder is order of elements:
1580     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1581     def NbEdgesOfOrder(self, elementOrder):
1582         return self.mesh.NbEdgesOfOrder(elementOrder)
1583     
1584     ## Returns number of faces in mesh
1585     def NbFaces(self):
1586         return self.mesh.NbFaces()
1587
1588     ## Returns number of faces with given order in mesh
1589     #  @param elementOrder is order of elements:
1590     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1591     def NbFacesOfOrder(self, elementOrder):
1592         return self.mesh.NbFacesOfOrder(elementOrder)
1593
1594     ## Returns number of triangles in mesh
1595     def NbTriangles(self):
1596         return self.mesh.NbTriangles()
1597
1598     ## Returns number of triangles with given order in mesh
1599     #  @param elementOrder is order of elements:
1600     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1601     def NbTrianglesOfOrder(self, elementOrder):
1602         return self.mesh.NbTrianglesOfOrder(elementOrder)
1603
1604     ## Returns number of quadrangles in mesh
1605     def NbQuadrangles(self):
1606         return self.mesh.NbQuadrangles()
1607
1608     ## Returns number of quadrangles with given order in mesh
1609     #  @param elementOrder is order of elements:
1610     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1611     def NbQuadranglesOfOrder(self, elementOrder):
1612         return self.mesh.NbQuadranglesOfOrder(elementOrder)
1613
1614     ## Returns number of polygons in mesh
1615     def NbPolygons(self):
1616         return self.mesh.NbPolygons()
1617
1618     ## Returns number of volumes in mesh
1619     def NbVolumes(self):
1620         return self.mesh.NbVolumes()
1621
1622     ## Returns number of volumes with given order in mesh
1623     #  @param elementOrder is order of elements:
1624     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1625     def NbVolumesOfOrder(self, elementOrder):
1626         return self.mesh.NbVolumesOfOrder(elementOrder)
1627
1628     ## Returns number of tetrahedrons in mesh
1629     def NbTetras(self):
1630         return self.mesh.NbTetras()
1631
1632     ## Returns number of tetrahedrons with given order in mesh
1633     #  @param elementOrder is order of elements:
1634     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1635     def NbTetrasOfOrder(self, elementOrder):
1636         return self.mesh.NbTetrasOfOrder(elementOrder)
1637
1638     ## Returns number of hexahedrons in mesh
1639     def NbHexas(self):
1640         return self.mesh.NbHexas()
1641
1642     ## Returns number of hexahedrons with given order in mesh
1643     #  @param elementOrder is order of elements:
1644     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1645     def NbHexasOfOrder(self, elementOrder):
1646         return self.mesh.NbHexasOfOrder(elementOrder)
1647
1648     ## Returns number of pyramids in mesh
1649     def NbPyramids(self):
1650         return self.mesh.NbPyramids()
1651
1652     ## Returns number of pyramids with given order in mesh
1653     #  @param elementOrder is order of elements:
1654     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1655     def NbPyramidsOfOrder(self, elementOrder):
1656         return self.mesh.NbPyramidsOfOrder(elementOrder)
1657
1658     ## Returns number of prisms in mesh
1659     def NbPrisms(self):
1660         return self.mesh.NbPrisms()
1661
1662     ## Returns number of prisms with given order in mesh
1663     #  @param elementOrder is order of elements:
1664     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
1665     def NbPrismsOfOrder(self, elementOrder):
1666         return self.mesh.NbPrismsOfOrder(elementOrder)
1667
1668     ## Returns number of polyhedrons in mesh
1669     def NbPolyhedrons(self):
1670         return self.mesh.NbPolyhedrons()
1671
1672     ## Returns number of submeshes in mesh
1673     def NbSubMesh(self):
1674         return self.mesh.NbSubMesh()
1675
1676     ## Returns list of mesh elements ids
1677     def GetElementsId(self):
1678         return self.mesh.GetElementsId()
1679
1680     ## Returns list of ids of mesh elements with given type
1681     #  @param elementType is required type of elements
1682     def GetElementsByType(self, elementType):
1683         return self.mesh.GetElementsByType(elementType)
1684
1685     ## Returns list of mesh nodes ids
1686     def GetNodesId(self):
1687         return self.mesh.GetNodesId()
1688     
1689     # Get informations about mesh elements:
1690     # ------------------------------------
1691     
1692     ## Returns type of mesh element
1693     def GetElementType(self, id, iselem):
1694         return self.mesh.GetElementType(id, iselem)
1695
1696     ## Returns list of submesh elements ids
1697     #  @param shapeID is geom object(subshape) IOR
1698     def GetSubMeshElementsId(self, shapeID):
1699         return self.mesh.GetSubMeshElementsId(shapeID)
1700
1701     ## Returns list of submesh nodes ids
1702     #  @param shapeID is geom object(subshape) IOR
1703     def GetSubMeshNodesId(self, shapeID, all):
1704         return self.mesh.GetSubMeshNodesId(shapeID, all)
1705     
1706     ## Returns list of ids of submesh elements with given type
1707     #  @param shapeID is geom object(subshape) IOR
1708     def GetSubMeshElementType(self, shapeID):
1709         return self.mesh.GetSubMeshElementType(shapeID)
1710       
1711     ## Get mesh description
1712     def Dump(self):
1713         return self.mesh.Dump()
1714
1715     
1716     # Get information about nodes and elements of mesh by its ids:
1717     # -----------------------------------------------------------
1718
1719     ## Get XYZ coordinates of node as list of double
1720     #  \n If there is not node for given ID - returns empty list
1721     def GetNodeXYZ(self, id):
1722         return self.mesh.GetNodeXYZ(id)
1723
1724     ## For given node returns list of IDs of inverse elements
1725     #  \n If there is not node for given ID - returns empty list
1726     def GetNodeInverseElements(self, id):
1727         return self.mesh.GetNodeInverseElements(id)
1728
1729     ## If given element is node returns IDs of shape from position
1730     #  \n If there is not node for given ID - returns -1
1731     def GetShapeID(self, id):
1732         return self.mesh.GetShapeID(id)
1733
1734     ## For given element returns ID of result shape after 
1735     #  FindShape() from SMESH_MeshEditor
1736     #  \n If there is not element for given ID - returns -1
1737     def GetShapeIDForElem(id):
1738         return self.mesh.GetShapeIDForElem(id)
1739     
1740     ## Returns number of nodes for given element
1741     #  \n If there is not element for given ID - returns -1
1742     def GetElemNbNodes(self, id):
1743         return self.mesh.GetElemNbNodes(id)
1744
1745     ## Returns ID of node by given index for given element
1746     #  \n If there is not element for given ID - returns -1
1747     #  \n If there is not node for given index - returns -2
1748     def GetElemNode(self, id, index):
1749         return self.mesh.GetElemNode(id, index)
1750
1751     ## Returns true if given node is medium node
1752     #  in given quadratic element
1753     def IsMediumNode(self, elementID, nodeID):
1754         return self.mesh.IsMediumNode(elementID, nodeID)
1755     
1756     ## Returns true if given node is medium node
1757     #  in one of quadratic elements
1758     def IsMediumNodeOfAnyElem(self, nodeID, elementType):
1759         return self.mesh.IsMediumNodeOfAnyElem(nodeID, elementType)
1760
1761     ## Returns number of edges for given element
1762     def ElemNbEdges(self, id):
1763         return self.mesh.ElemNbEdges(id)
1764         
1765     ## Returns number of faces for given element
1766     def ElemNbFaces(self, id):
1767         return self.mesh.ElemNbFaces(id)
1768
1769     ## Returns true if given element is polygon
1770     def IsPoly(self, id):
1771         return self.mesh.IsPoly(id)
1772
1773     ## Returns true if given element is quadratic
1774     def IsQuadratic(self, id):
1775         return self.mesh.IsQuadratic(id)
1776
1777     ## Returns XYZ coordinates of bary center for given element
1778     #  as list of double
1779     #  \n If there is not element for given ID - returns empty list
1780     def BaryCenter(self, id):
1781         return self.mesh.BaryCenter(id)
1782     
1783     
1784     # Mesh edition (SMESH_MeshEditor functionality):
1785     # ---------------------------------------------
1786
1787     ## Removes elements from mesh by ids
1788     #  @param IDsOfElements is list of ids of elements to remove
1789     def RemoveElements(self, IDsOfElements):
1790         return self.editor.RemoveElements(IDsOfElements)
1791
1792     ## Removes nodes from mesh by ids
1793     #  @param IDsOfNodes is list of ids of nodes to remove
1794     def RemoveNodes(self, IDsOfNodes):
1795         return self.editor.RemoveNodes(IDsOfNodes)
1796
1797     ## Add node to mesh by coordinates
1798     def AddNode(self, x, y, z):
1799         return self.editor.AddNode( x, y, z)
1800
1801     
1802     ## Create edge both similar and quadratic (this is determed
1803     #  by number of given nodes).
1804     #  @param IdsOfNodes List of node IDs for creation of element.
1805     #  Needed order of nodes in this list corresponds to description
1806     #  of MED. \n This description is located by the following link:
1807     #  http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
1808     def AddEdge(self, IDsOfNodes):
1809         return self.editor.AddEdge(IDsOfNodes)
1810
1811     ## Create face both similar and quadratic (this is determed
1812     #  by number of given nodes).
1813     #  @param IdsOfNodes List of node IDs for creation of element.
1814     #  Needed order of nodes in this list corresponds to description
1815     #  of MED. \n This description is located by the following link:
1816     #  http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
1817     def AddFace(self, IDsOfNodes):
1818         return self.editor.AddFace(IDsOfNodes)
1819     
1820     ## Add polygonal face to mesh by list of nodes ids
1821     def AddPolygonalFace(self, IdsOfNodes):
1822         return self.editor.AddPolygonalFace(IdsOfNodes)
1823     
1824     ## Create volume both similar and quadratic (this is determed
1825     #  by number of given nodes).
1826     #  @param IdsOfNodes List of node IDs for creation of element.
1827     #  Needed order of nodes in this list corresponds to description
1828     #  of MED. \n This description is located by the following link:
1829     #  http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
1830     def AddVolume(self, IDsOfNodes):
1831         return self.editor.AddVolume(IDsOfNodes)
1832
1833     ## Create volume of many faces, giving nodes for each face.
1834     #  @param IdsOfNodes List of node IDs for volume creation face by face.
1835     #  @param Quantities List of integer values, Quantities[i]
1836     #         gives quantity of nodes in face number i.
1837     def AddPolyhedralVolume (self, IdsOfNodes, Quantities):
1838         return self.editor.AddPolyhedralVolume(IdsOfNodes, Quantities)
1839
1840     ## Create volume of many faces, giving IDs of existing faces.
1841     #  @param IdsOfFaces List of face IDs for volume creation.
1842     #
1843     #  Note:  The created volume will refer only to nodes
1844     #         of the given faces, not to the faces itself.
1845     def AddPolyhedralVolumeByFaces (self, IdsOfFaces):
1846         return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces)
1847     
1848     ## Move node with given id
1849     #  @param NodeID id of the node
1850     #  @param x displacing along the X axis
1851     #  @param y displacing along the Y axis
1852     #  @param z displacing along the Z axis
1853     def MoveNode(self, NodeID, x, y, z):
1854         return self.editor.MoveNode(NodeID, x, y, z)
1855
1856     ## Replace two neighbour triangles sharing Node1-Node2 link
1857     #  with ones built on the same 4 nodes but having other common link.
1858     #  @param NodeID1 first node id
1859     #  @param NodeID2 second node id
1860     #  @return false if proper faces not found
1861     def InverseDiag(self, NodeID1, NodeID2):
1862         return self.editor.InverseDiag(NodeID1, NodeID2)
1863
1864     ## Replace two neighbour triangles sharing Node1-Node2 link
1865     #  with a quadrangle built on the same 4 nodes.
1866     #  @param NodeID1 first node id
1867     #  @param NodeID2 second node id
1868     #  @return false if proper faces not found
1869     def DeleteDiag(self, NodeID1, NodeID2):
1870         return self.editor.DeleteDiag(NodeID1, NodeID2)
1871
1872     ## Reorient elements by ids
1873     #  @param IDsOfElements if undefined reorient all mesh elements
1874     def Reorient(self, IDsOfElements=None):
1875         if IDsOfElements == None:
1876             IDsOfElements = self.GetElementsId()
1877         return self.editor.Reorient(IDsOfElements)
1878
1879     ## Reorient all elements of the object
1880     #  @param theObject is mesh, submesh or group
1881     def ReorientObject(self, theObject):
1882         return self.editor.ReorientObject(theObject)
1883
1884     ## Fuse neighbour triangles into quadrangles.
1885     #  @param IDsOfElements The triangles to be fused,
1886     #  @param theCriterion     is FT_...; used to choose a neighbour to fuse with.
1887     #  @param MaxAngle      is a max angle between element normals at which fusion
1888     #                       is still performed; theMaxAngle is mesured in radians.
1889     #  @return TRUE in case of success, FALSE otherwise.
1890     def TriToQuad(self, IDsOfElements, theCriterion, MaxAngle):
1891         if IDsOfElements == []:
1892             IDsOfElements = self.GetElementsId()
1893         return self.editor.TriToQuad(IDsOfElements, GetFunctor(theCriterion), MaxAngle)
1894
1895     ## Fuse neighbour triangles of the object into quadrangles
1896     #  @param theObject is mesh, submesh or group
1897     #  @param theCriterion is FT_...; used to choose a neighbour to fuse with.
1898     #  @param MaxAngle  is a max angle between element normals at which fusion
1899     #                   is still performed; theMaxAngle is mesured in radians.
1900     #  @return TRUE in case of success, FALSE otherwise.
1901     def TriToQuadObject (self, theObject, theCriterion, MaxAngle):
1902         return self.editor.TriToQuadObject(theObject, GetFunctor(theCriterion), MaxAngle)
1903
1904     ## Split quadrangles into triangles.
1905     #  @param IDsOfElements the faces to be splitted.
1906     #  @param theCriterion  is FT_...; used to choose a diagonal for splitting.
1907     #  @param @return TRUE in case of success, FALSE otherwise.
1908     def QuadToTri (self, IDsOfElements, theCriterion):
1909         if IDsOfElements == []:
1910             IDsOfElements = self.GetElementsId()
1911         return self.editor.QuadToTri(IDsOfElements, GetFunctor(theCriterion))
1912
1913     ## Split quadrangles into triangles.
1914     #  @param theObject object to taking list of elements from, is mesh, submesh or group
1915     #  @param theCriterion  is FT_...; used to choose a diagonal for splitting.
1916     def QuadToTriObject (self, theObject, theCriterion):
1917         return self.editor.QuadToTriObject(theObject, GetFunctor(theCriterion))
1918
1919     ## Split quadrangles into triangles.
1920     #  @param theElems  The faces to be splitted
1921     #  @param the13Diag is used to choose a diagonal for splitting.
1922     #  @return TRUE in case of success, FALSE otherwise.
1923     def SplitQuad (self, IDsOfElements, Diag13):
1924         if IDsOfElements == []:
1925             IDsOfElements = self.GetElementsId()
1926         return self.editor.SplitQuad(IDsOfElements, Diag13)
1927
1928     ## Split quadrangles into triangles.
1929     #  @param theObject is object to taking list of elements from, is mesh, submesh or group
1930     def SplitQuadObject (self, theObject, Diag13):
1931         return self.editor.SplitQuadObject(theObject, Diag13)
1932
1933     ## Find better splitting of the given quadrangle.
1934     #  @param IDOfQuad  ID of the quadrangle to be splitted.
1935     #  @param theCriterion is FT_...; a criterion to choose a diagonal for splitting.
1936     #  @return 1 if 1-3 diagonal is better, 2 if 2-4
1937     #          diagonal is better, 0 if error occurs.
1938     def BestSplit (self, IDOfQuad, theCriterion):
1939         return self.editor.BestSplit(IDOfQuad, GetFunctor(theCriterion))
1940     
1941     ## Smooth elements
1942     #  @param IDsOfElements list if ids of elements to smooth
1943     #  @param IDsOfFixedNodes list of ids of fixed nodes.
1944     #  Note that nodes built on edges and boundary nodes are always fixed.
1945     #  @param MaxNbOfIterations maximum number of iterations
1946     #  @param MaxAspectRatio varies in range [1.0, inf]
1947     #  @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
1948     def Smooth(self, IDsOfElements, IDsOfFixedNodes,
1949                MaxNbOfIterations, MaxAspectRatio, Method):
1950         if IDsOfElements == []:
1951             IDsOfElements = self.GetElementsId()
1952         return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes,
1953                                   MaxNbOfIterations, MaxAspectRatio, Method)
1954     
1955     ## Smooth elements belong to given object
1956     #  @param theObject object to smooth
1957     #  @param IDsOfFixedNodes list of ids of fixed nodes.
1958     #  Note that nodes built on edges and boundary nodes are always fixed.
1959     #  @param MaxNbOfIterations maximum number of iterations
1960     #  @param MaxAspectRatio varies in range [1.0, inf]
1961     #  @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
1962     def SmoothObject(self, theObject, IDsOfFixedNodes, 
1963                      MaxNbOfIterations, MaxxAspectRatio, Method):
1964         return self.editor.SmoothObject(theObject, IDsOfFixedNodes, 
1965                                         MaxNbOfIterations, MaxxAspectRatio, Method)
1966
1967     ## Parametric smooth the given elements
1968     #  @param IDsOfElements list if ids of elements to smooth
1969     #  @param IDsOfFixedNodes list of ids of fixed nodes.
1970     #  Note that nodes built on edges and boundary nodes are always fixed.
1971     #  @param MaxNbOfIterations maximum number of iterations
1972     #  @param MaxAspectRatio varies in range [1.0, inf]
1973     #  @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
1974     def SmoothParametric(IDsOfElements, IDsOfFixedNodes,
1975                          MaxNbOfIterations, MaxAspectRatio, Method):
1976         if IDsOfElements == []:
1977             IDsOfElements = self.GetElementsId()
1978         return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes,
1979                                             MaxNbOfIterations, MaxAspectRatio, Method)
1980     
1981     ## Parametric smooth elements belong to given object
1982     #  @param theObject object to smooth
1983     #  @param IDsOfFixedNodes list of ids of fixed nodes.
1984     #  Note that nodes built on edges and boundary nodes are always fixed.
1985     #  @param MaxNbOfIterations maximum number of iterations
1986     #  @param MaxAspectRatio varies in range [1.0, inf]
1987     #  @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
1988     def SmoothParametricObject(self, theObject, IDsOfFixedNodes,
1989                                MaxNbOfIterations, MaxAspectRatio, Method):
1990         return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
1991                                                   MaxNbOfIterations, MaxAspectRatio, Method)
1992
1993     ## Converts all mesh to quadratic one, deletes old elements, replacing 
1994     #  them with quadratic ones with the same id.
1995     def ConvertToQuadratic(self, theForce3d):
1996         self.editor.ConvertToQuadratic(theForce3d)
1997
1998     ## Converts all mesh from quadratic to ordinary ones,
1999     #  deletes old quadratic elements, \n replacing 
2000     #  them with ordinary mesh elements with the same id.
2001     def ConvertFromQuadratic(self):
2002         return self.editor.ConvertFromQuadratic()
2003
2004     ## Renumber mesh nodes
2005     def RenumberNodes(self):
2006         self.editor.RenumberNodes()
2007
2008     ## Renumber mesh elements
2009     def RenumberElements(self):
2010         self.editor.RenumberElements()
2011
2012     ## Generate new elements by rotation of the elements around the axis
2013     #  @param IDsOfElements list of ids of elements to sweep
2014     #  @param Axix axis of rotation, AxisStruct or line(geom object)
2015     #  @param AngleInRadians angle of Rotation
2016     #  @param NbOfSteps number of steps
2017     #  @param Tolerance tolerance
2018     def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance):
2019         if IDsOfElements == []:
2020             IDsOfElements = self.GetElementsId()
2021         if ( isinstance( Axix, geompy.GEOM._objref_GEOM_Object)):
2022             Axix = GetAxisStruct(Axix)
2023         self.editor.RotationSweep(IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance)
2024
2025     ## Generate new elements by rotation of the elements of object around the axis
2026     #  @param theObject object wich elements should be sweeped
2027     #  @param Axix axis of rotation, AxisStruct or line(geom object)
2028     #  @param AngleInRadians angle of Rotation
2029     #  @param NbOfSteps number of steps
2030     #  @param Tolerance tolerance
2031     def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance):
2032         if ( isinstance( Axix, geompy.GEOM._objref_GEOM_Object)):
2033             Axix = GetAxisStruct(Axix)
2034         self.editor.RotationSweepObject(theObject, Axix, AngleInRadians, NbOfSteps, Tolerance)
2035
2036     ## Generate new elements by extrusion of the elements with given ids
2037     #  @param IDsOfElements list of elements ids for extrusion
2038     #  @param StepVector vector, defining the direction and value of extrusion 
2039     #  @param NbOfSteps the number of steps
2040     def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps):
2041         if IDsOfElements == []:
2042             IDsOfElements = self.GetElementsId()
2043         if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
2044             StepVector = GetDirStruct(StepVector)
2045         self.editor.ExtrusionSweep(IDsOfElements, StepVector, NbOfSteps)
2046
2047     ## Generate new elements by extrusion of the elements with given ids
2048     #  @param IDsOfElements is ids of elements
2049     #  @param StepVector vector, defining the direction and value of extrusion 
2050     #  @param NbOfSteps the number of steps
2051     #  @param ExtrFlags set flags for performing extrusion
2052     #  @param SewTolerance uses for comparing locations of nodes if flag
2053     #         EXTRUSION_FLAG_SEW is set
2054     def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance):
2055         if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
2056             StepVector = GetDirStruct(StepVector)
2057         self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance)
2058
2059     ## Generate new elements by extrusion of the elements belong to object
2060     #  @param theObject object wich elements should be processed
2061     #  @param StepVector vector, defining the direction and value of extrusion 
2062     #  @param NbOfSteps the number of steps
2063     def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps):
2064         if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
2065             StepVector = GetDirStruct(StepVector)
2066         self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps)
2067
2068     ## Generate new elements by extrusion of the elements belong to object
2069     #  @param theObject object wich elements should be processed
2070     #  @param StepVector vector, defining the direction and value of extrusion 
2071     #  @param NbOfSteps the number of steps
2072     def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps):
2073         if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
2074             StepVector = GetDirStruct(StepVector)
2075         self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
2076     
2077     ## Generate new elements by extrusion of the elements belong to object
2078     #  @param theObject object wich elements should be processed
2079     #  @param StepVector vector, defining the direction and value of extrusion 
2080     #  @param NbOfSteps the number of steps    
2081     def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps):
2082         if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
2083             StepVector = GetDirStruct(StepVector)
2084         self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps)
2085
2086     ## Generate new elements by extrusion of the given elements
2087     #  A path of extrusion must be a meshed edge.
2088     #  @param IDsOfElements is ids of elements
2089     #  @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
2090     #  @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path
2091     #  @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion
2092     #  @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion
2093     #  @param Angles list of angles
2094     #  @param HasRefPoint allows to use base point 
2095     #  @param RefPoint point around which the shape is rotated(the mass center of the shape by default).
2096     #         User can specify any point as the Base Point and the shape will be rotated with respect to this point.
2097     def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart,
2098                            HasAngles, Angles, HasRefPoint, RefPoint):
2099         if IDsOfElements == []:
2100             IDsOfElements = self.GetElementsId()
2101         if ( isinstance( RefPoint, geompy.GEOM._objref_GEOM_Object)):
2102             RefPoint = GetPointStruct(RefPoint) 
2103         return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh.GetMesh(), PathShape, NodeStart,
2104                                               HasAngles, Angles, HasRefPoint, RefPoint)
2105
2106     ## Generate new elements by extrusion of the elements belong to object
2107     #  A path of extrusion must be a meshed edge.
2108     #  @param IDsOfElements is ids of elements
2109     #  @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
2110     #  @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path
2111     #  @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion
2112     #  @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion
2113     #  @param Angles list of angles
2114     #  @param HasRefPoint allows to use base point 
2115     #  @param RefPoint point around which the shape is rotated(the mass center of the shape by default).
2116     #         User can specify any point as the Base Point and the shape will be rotated with respect to this point.
2117     def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
2118                                  HasAngles, Angles, HasRefPoint, RefPoint):
2119         if ( isinstance( RefPoint, geompy.GEOM._objref_GEOM_Object)):
2120             RefPoint = GetPointStruct(RefPoint) 
2121         return self.editor.ExtrusionAlongPathObject(theObject, PathMesh.GetMesh(), PathShape, NodeStart,
2122                                                     HasAngles, Angles, HasRefPoint, RefPoint)
2123     
2124     ## Symmetrical copy of mesh elements
2125     #  @param IDsOfElements list of elements ids
2126     #  @param Mirror is AxisStruct or geom object(point, line, plane)
2127     #  @param theMirrorType is  POINT, AXIS or PLANE
2128     #  If the Mirror is geom object this parameter is unnecessary
2129     #  @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
2130     def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0):
2131         if IDsOfElements == []:
2132             IDsOfElements = self.GetElementsId()
2133         if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)):
2134             Mirror = GetAxisStruct(Mirror)
2135         self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy)
2136
2137     ## Symmetrical copy of object
2138     #  @param theObject mesh, submesh or group
2139     #  @param Mirror is AxisStruct or geom object(point, line, plane)
2140     #  @param theMirrorType is  POINT, AXIS or PLANE
2141     #  If the Mirror is geom object this parameter is unnecessary
2142     #  @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
2143     def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0):
2144         if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)):
2145             Mirror = GetAxisStruct(Mirror)
2146         self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy)
2147
2148     ## Translates the elements
2149     #  @param IDsOfElements list of elements ids
2150     #  @param Vector direction of translation(DirStruct or vector)
2151     #  @param Copy allows to copy the translated elements
2152     def Translate(self, IDsOfElements, Vector, Copy):
2153         if IDsOfElements == []:
2154             IDsOfElements = self.GetElementsId()
2155         if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)):
2156             Vector = GetDirStruct(Vector)
2157         self.editor.Translate(IDsOfElements, Vector, Copy)
2158
2159     ## Translates the object
2160     #  @param theObject object to translate(mesh, submesh, or group)
2161     #  @param Vector direction of translation(DirStruct or geom vector)
2162     #  @param Copy allows to copy the translated elements
2163     def TranslateObject(self, theObject, Vector, Copy):
2164         if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)):
2165             Vector = GetDirStruct(Vector)
2166         self.editor.TranslateObject(theObject, Vector, Copy)
2167
2168     ## Rotates the elements
2169     #  @param IDsOfElements list of elements ids
2170     #  @param Axis axis of rotation(AxisStruct or geom line)
2171     #  @param AngleInRadians angle of rotation(in radians)
2172     #  @param Copy allows to copy the rotated elements   
2173     def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy):
2174         if IDsOfElements == []:
2175             IDsOfElements = self.GetElementsId()
2176         if ( isinstance( Axis, geompy.GEOM._objref_GEOM_Object)):
2177             Axis = GetAxisStruct(Axis)
2178         self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy)
2179
2180     ## Rotates the object
2181     #  @param theObject object to rotate(mesh, submesh, or group)
2182     #  @param Axis axis of rotation(AxisStruct or geom line)
2183     #  @param AngleInRadians angle of rotation(in radians)
2184     #  @param Copy allows to copy the rotated elements
2185     def RotateObject (self, theObject, Axis, AngleInRadians, Copy):
2186         self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy)
2187
2188     ## Find group of nodes close to each other within Tolerance.
2189     #  @param Tolerance tolerance value
2190     #  @param list of group of nodes
2191     def FindCoincidentNodes (self, Tolerance):
2192         return self.editor.FindCoincidentNodes(Tolerance)
2193
2194     ## Merge nodes
2195     #  @param list of group of nodes
2196     def MergeNodes (self, GroupsOfNodes):
2197         self.editor.MergeNodes(GroupsOfNodes)
2198
2199     ## Remove all but one of elements built on the same nodes.
2200     def MergeEqualElements(self):
2201         self.editor.MergeEqualElements()
2202         
2203     ## Sew free borders
2204     def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
2205                         FirstNodeID2, SecondNodeID2, LastNodeID2,
2206                         CreatePolygons, CreatePolyedrs):
2207         return self.editor.SewFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
2208                                           FirstNodeID2, SecondNodeID2, LastNodeID2,
2209                                           CreatePolygons, CreatePolyedrs)
2210
2211     ## Sew conform free borders
2212     def SewConformFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
2213                                FirstNodeID2, SecondNodeID2):
2214         return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
2215                                                  FirstNodeID2, SecondNodeID2)
2216     
2217     ## Sew border to side
2218     def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
2219                          FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs):
2220         return self.editor.SewBorderToSide(FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
2221                                            FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs)
2222
2223     ## Sew two sides of a mesh. Nodes belonging to Side1 are
2224     #  merged with nodes of elements of Side2.
2225     #  Number of elements in theSide1 and in theSide2 must be
2226     #  equal and they should have similar node connectivity.
2227     #  The nodes to merge should belong to sides borders and
2228     #  the first node should be linked to the second.
2229     def SewSideElements (self, IDsOfSide1Elements, IDsOfSide2Elements,
2230                          NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge,
2231                          NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge):
2232         return self.editor.SewSideElements(IDsOfSide1Elements, IDsOfSide2Elements,
2233                                            NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge,
2234                                            NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge)
2235
2236     ## Set new nodes for given element.
2237     #  @param ide the element id
2238     #  @param newIDs nodes ids
2239     #  @return If number of nodes is not corresponded to type of element - returns false
2240     def ChangeElemNodes(self, ide, newIDs):
2241         return self.editor.ChangeElemNodes(ide, newIDs)
2242     
2243     ## If during last operation of MeshEditor some nodes were
2244     #  created this method returns list of it's IDs, \n
2245     #  if new nodes not created - returns empty list
2246     def GetLastCreatedNodes(self):
2247         return self.editor.GetLastCreatedNodes()
2248
2249     ## If during last operation of MeshEditor some elements were
2250     #  created this method returns list of it's IDs, \n
2251     #  if new elements not creared - returns empty list
2252     def GetLastCreatedElems(self):
2253         return self.editor.GetLastCreatedElems()