--- /dev/null
+#
+# Tetrahedrization of the geometry generated by the Python script
+# SMESH_fixation.py
+# The new Netgen algorithm is used that discretizes baoundaries itself
+#
+
+import StdMeshers
+import NETGENPlugin
+import SMESH_fixation
+import smesh
+
+compshell = SMESH_fixation.compshell
+idcomp = SMESH_fixation.idcomp
+geompy = SMESH_fixation.geompy
+salome = SMESH_fixation.salome
+
+print "Analysis of the geometry to be meshed :"
+subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
+
+print "number of Shells in compshell : ", len(subShellList)
+print "number of Faces in compshell : ", len(subFaceList)
+print "number of Edges in compshell : ", len(subEdgeList)
+
+status = geompy.CheckShape(compshell)
+print " check status ", status
+
+### ---------------------------- SMESH --------------------------------------
+
+print "-------------------------- create Mesh, algorithm, hypothesis"
+
+mesh = smesh.Mesh(compshell, "MeshcompShel");
+netgen = mesh.Netgen(1)
+hyp = netgen.Parameters()
+hyp.SetMaxSize( 50 )
+#hyp.SetSecondOrder( 0 )
+hyp.SetFineness( 3 )
+#hyp.SetOptimize( 1 )
+
+salome.sg.updateObjBrowser(1)
+
+print "-------------------------- compute mesh"
+ret = mesh.Compute()
+print ret
+if ret != 0:
+ print "Information about the MeshcompShel:"
+ print "Number of nodes : ", mesh.GetMesh().NbNodes()
+ print "Number of edges : ", mesh.GetMesh().NbEdges()
+ print "Number of faces : ", mesh.GetMesh().NbFaces()
+ print "Number of triangles : ", mesh.GetMesh().NbTriangles()
+ print "Number of volumes : ", mesh.GetMesh().NbVolumes()
+ print "Number of tetrahedrons : ", mesh.GetMesh().NbTetras()
+
+else:
+ print "problem when computing the mesh"
--- /dev/null
+#
+# Quadrangulation of the geometry generated by the Python script
+# SMESH_mechanic.py
+# The new Netgen algorithm is used that discretizes baoundaries itself
+#
+
+import salome
+import geompy
+
+geom = geompy.geom
+
+import StdMeshers
+import NETGENPlugin
+import smesh
+
+# ---------------------------- GEOM --------------------------------------
+
+# ---- define contigous arcs and segment to define a closed wire
+p1 = geompy.MakeVertex( 100.0, 0.0, 0.0 )
+p2 = geompy.MakeVertex( 50.0, 50.0, 0.0 )
+p3 = geompy.MakeVertex( 100.0, 100.0, 0.0 )
+arc1 = geompy.MakeArc( p1, p2, p3 )
+
+p4 = geompy.MakeVertex( 170.0, 100.0, 0.0 )
+seg1 = geompy.MakeVector( p3, p4 )
+
+p5 = geompy.MakeVertex( 200.0, 70.0, 0.0 )
+p6 = geompy.MakeVertex( 170.0, 40.0, 0.0 )
+arc2 = geompy.MakeArc( p4, p5, p6 )
+
+p7 = geompy.MakeVertex( 120.0, 30.0, 0.0 )
+arc3 = geompy.MakeArc( p6, p7, p1 )
+
+# ---- define a closed wire with arcs and segment
+List1 = []
+List1.append( arc1 )
+List1.append( seg1 )
+List1.append( arc2 )
+List1.append( arc3 )
+
+wire1 = geompy.MakeWire( List1 )
+Id_wire1 = geompy.addToStudy( wire1, "wire1" )
+
+# ---- define a planar face with wire
+WantPlanarFace = 1 #True
+face1 = geompy.MakeFace( wire1, WantPlanarFace )
+Id_face1 = geompy.addToStudy( face1, "face1" )
+
+# ---- create a shape by extrusion
+pO = geompy.MakeVertex( 0.0, 0.0, 0.0 )
+pz = geompy.MakeVertex( 0.0, 0.0, 100.0 )
+vz = geompy.MakeVector( pO, pz )
+
+prism1 = geompy.MakePrismVecH( face1, vz, 100.0 )
+Id_prism1 = geompy.addToStudy( prism1, "prism1")
+
+# ---- create two cylinders
+
+pc1 = geompy.MakeVertex( 90.0, 50.0, -40.0 )
+pc2 = geompy.MakeVertex( 170.0, 70.0, -40.0 )
+radius = 20.0
+height = 180.0
+cyl1 = geompy.MakeCylinder( pc1, vz, radius, height )
+cyl2 = geompy.MakeCylinder( pc2, vz, radius, height )
+
+Id_Cyl1 = geompy.addToStudy( cyl1, "cyl1" )
+Id_Cyl2 = geompy.addToStudy( cyl2, "cyl2" )
+
+# ---- cut with cyl1
+shape = geompy.MakeBoolean( prism1, cyl1, 2 )
+
+# ---- fuse with cyl2 to obtain the final mechanic piece :)
+mechanic = geompy.MakeBoolean( shape, cyl2, 3 )
+Id_mechanic = geompy.addToStudy( mechanic, "mechanic" )
+
+# ---- Analysis of the geometry
+
+print "Analysis of the geometry mechanic :"
+
+subShellList = geompy.SubShapeAll(mechanic,geompy.ShapeType["SHELL"])
+subFaceList = geompy.SubShapeAll(mechanic,geompy.ShapeType["FACE"])
+subEdgeList = geompy.SubShapeAll(mechanic,geompy.ShapeType["EDGE"])
+
+print "number of Shells in mechanic : ",len(subShellList)
+print "number of Faces in mechanic : ",len(subFaceList)
+print "number of Edges in mechanic : ",len(subEdgeList)
+
+### ---------------------------- SMESH --------------------------------------
+
+print "-------------------------- create Mesh, algorithm, hypothesis"
+
+mesh = smesh.Mesh(mechanic, "Mesh_mechanic");
+netgen = mesh.Netgen(0)
+hyp = netgen.Parameters()
+hyp.SetMaxSize( 50 )
+#hyp.SetSecondOrder( 0 )
+hyp.SetFineness( 3 )
+hyp.SetQuadAllowed( 1 )
+#hyp.SetOptimize( 1 )
+
+salome.sg.updateObjBrowser(1)
+
+print "-------------------------- compute mesh"
+ret = mesh.Compute()
+print ret
+if ret != 0:
+ print "Information about the MeshcompShel:"
+ print "Number of nodes : ", mesh.GetMesh().NbNodes()
+ print "Number of edges : ", mesh.GetMesh().NbEdges()
+ print "Number of faces : ", mesh.GetMesh().NbFaces()
+ print "Number of triangles : ", mesh.GetMesh().NbTriangles()
+ print "Number of quadrangles : ", mesh.GetMesh().NbQuadrangles()
+ print "Number of volumes : ", mesh.GetMesh().NbVolumes()
+ print "Number of tetrahedrons : ", mesh.GetMesh().NbTetras()
+
+else:
+ print "problem when computing the mesh"
"""
self.Create(mesh, geom, "Hexa_3D")
+# Public class: Mesh_Netgen
+# ------------------------------
+
+class Mesh_Netgen(Mesh_Algorithm):
+ """
+ Class to define a NETGEN-based 2D or 3D algorithm
+ that need no discrete boundary (i.e. independent)
+ """
+
+ is3D = 0
+
+ def __init__(self, mesh, is3D, geom=0):
+ """
+ Private constructor
+ """
+ self.is3D = is3D
+ if is3D:
+ self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
+ else:
+ self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
+
+ def Parameters(self):
+ """
+ Define hypothesis containing parameters of the algorithm
+ """
+ if self.is3D:
+ hyp = self.Hypothesis("NETGEN_Parameters", [], "libNETGENEngine.so")
+ else:
+ hyp = self.Hypothesis("NETGEN_Parameters_2D", [], "libNETGENEngine.so")
+ return hyp
+
# Public class: Mesh
# ==================
"""
return Mesh_Hexahedron(self, geom)
+ def Netgen(self, is3D, geom=0):
+ """
+ Creates a NETGEN-based 2D or 3D independent algorithm (i.e. needs no
+ discrete boundary).
+ If the optional \a geom parameter is not sets, this algorithm is global.
+ Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ \param is3D If 0 then algorithm is 2D, otherwise 3D
+ \param geom If defined, subshape to be meshed
+ """
+ return Mesh_Netgen(self, is3D, geom)
+
def Compute(self):
"""
Compute the mesh and return the status of the computation