]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
adding scripts for meshing in 3D using Netgen or using LengthFromEdges 2D
authornadir <nadir>
Mon, 8 Dec 2003 13:23:20 +0000 (13:23 +0000)
committernadir <nadir>
Mon, 8 Dec 2003 13:23:20 +0000 (13:23 +0000)
meshing hypothesis !!.

src/SMESH_SWIG/SMESH_Partition1_tetra.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_fixation_hexa.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_fixation_tetra.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_flight_skin.py [new file with mode: 0644]

diff --git a/src/SMESH_SWIG/SMESH_Partition1_tetra.py b/src/SMESH_SWIG/SMESH_Partition1_tetra.py
new file mode 100644 (file)
index 0000000..1478f01
--- /dev/null
@@ -0,0 +1,245 @@
+#\r
+# Tetrahedrization of the geometry generated by the Python script GEOM_Partition1.py\r
+# Hypothesis and algorithms for the mesh generation are global\r
+#\r
+#%Make geometry (like CEA script (A1)) using Partition algorithm% from OCC\r
+# -- Rayon de la bariere\r
+\r
+barier_height = 7.0\r
+barier_radius = 5.6 / 2 # Rayon de la bariere\r
+colis_radius = 1.0 / 2  # Rayon du colis\r
+colis_step = 2.0        # Distance s\89parant deux colis\r
+cc_width = 0.11         # Epaisseur du complement de colisage\r
+\r
+# --\r
+\r
+cc_radius = colis_radius + cc_width\r
+from math import sqrt\r
+colis_center = sqrt(2.0)*colis_step/2\r
+\r
+# --\r
+\r
+import geompy\r
+geom = geompy.geom\r
+\r
+boolean_common  = 1\r
+boolean_cut     = 2\r
+boolean_fuse    = 3\r
+boolean_section = 4\r
+\r
+# --\r
+\r
+barier = geompy.MakeCylinder(\r
+    geom.MakePointStruct(0.,0.,0.),\r
+    geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),\r
+    barier_radius,\r
+    barier_height)\r
+\r
+# --\r
+\r
+colis = geompy.MakeCylinder(\r
+    geom.MakePointStruct(0.,0.,0.),\r
+    geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),\r
+    colis_radius,\r
+    barier_height)\r
+\r
+cc = geompy.MakeCylinder(\r
+    geom.MakePointStruct(0.,0.,0.),\r
+    geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),\r
+    cc_radius,\r
+    barier_height)\r
+\r
+colis_cc = geompy.MakeCompound(\r
+    [colis._get_Name(), cc._get_Name()])\r
+\r
+colis_cc = geompy.MakeTranslation(\r
+    colis_cc, colis_center, 0.0, 0.0)\r
+\r
+colis_cc_multi = geompy.MakeMultiRotation1D(\r
+    colis_cc,\r
+    geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),\r
+    geom.MakePointStruct(0.,0.,0.),\r
+    4)\r
+\r
+# --\r
+\r
+alveole = geompy.Partition(\r
+    [colis_cc_multi._get_Name(), barier._get_Name()])\r
+\r
+ShapeTypeShell     = 3\r
+ShapeTypeFace      = 4\r
+ShapeTypeEdge      = 6\r
+\r
+print "Analysis of the geometry to mesh (right after the Partition) :"\r
+\r
+subShellList=geompy.SubShapeAll(alveole,ShapeTypeShell)\r
+subFaceList=geompy.SubShapeAll(alveole,ShapeTypeFace)\r
+subEdgeList=geompy.SubShapeAll(alveole,ShapeTypeEdge)\r
+\r
+print "number of Shells in alveole : ",len(subShellList)\r
+print "number of Faces in alveole : ",len(subFaceList)\r
+print "number of Edges in alveole : ",len(subEdgeList)\r
+\r
+subshapes = geompy.SubShapeAll( alveole, geompy.ShapeType["SHAPE"] )\r
+\r
+## there are 9 subshapes\r
+\r
+comp1 = geompy.MakeCompound( [ subshapes[0]._get_Name(), subshapes[1]._get_Name() ] );\r
+comp2 = geompy.MakeCompound( [ subshapes[2]._get_Name(), subshapes[3]._get_Name() ] );\r
+comp3 = geompy.MakeCompound( [ subshapes[4]._get_Name(), subshapes[5]._get_Name() ] );\r
+comp4 = geompy.MakeCompound( [ subshapes[6]._get_Name(), subshapes[7]._get_Name() ] );\r
+\r
+compIORs = []\r
+compIORs.append( comp1._get_Name() );\r
+compIORs.append( comp2._get_Name() );\r
+compIORs.append( comp3._get_Name() );\r
+compIORs.append( comp4._get_Name() );\r
+comp = geompy.MakeCompound( compIORs );\r
+\r
+alveole = geompy.MakeCompound( [ comp._get_Name(), subshapes[8]._get_Name() ]);\r
+       \r
+idalveole= geompy.addToStudy(alveole, "alveole")\r
+\r
+print "Analysis of the geometry to mesh (right after the MakeCompound) :"\r
+\r
+subShellList=geompy.SubShapeAll(alveole,ShapeTypeShell)\r
+subFaceList=geompy.SubShapeAll(alveole,ShapeTypeFace)\r
+subEdgeList=geompy.SubShapeAll(alveole,ShapeTypeEdge)\r
+\r
+print "number of Shells in alveole : ",len(subShellList)\r
+print "number of Faces in alveole : ",len(subFaceList)\r
+print "number of Edges in alveole : ",len(subEdgeList)\r
+\r
+status=geompy.CheckShape(alveole)\r
+print " check status ", status\r
+\r
+# ---- launch SMESH\r
+\r
+import salome\r
+from salome import sg\r
+\r
+import SMESH\r
+import smeshpy\r
+\r
+smeshgui = salome.ImportComponentGUI("SMESH")\r
+smeshgui.Init(salome.myStudyId)\r
+\r
+gen=smeshpy.smeshpy()\r
+\r
+# ---- create Hypothesis\r
+\r
+print "-------------------------- create Hypothesis (In this case global hypothesis are used)"\r
+\r
+print "-------------------------- NumberOfSegments"\r
+\r
+numberOfSegments = 10\r
+\r
+hyp1=gen.CreateHypothesis("NumberOfSegments")\r
+hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)\r
+hypNbSeg.SetNumberOfSegments(numberOfSegments)\r
+hypNbSegID = hypNbSeg.GetId()\r
+print hypNbSeg.GetName()\r
+print hypNbSegID\r
+print hypNbSeg.GetNumberOfSegments()\r
+\r
+idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )\r
+smeshgui.SetName(idseg, "NumberOfSegments")\r
+\r
+print "-------------------------- MaxElementArea"\r
+\r
+maxElementArea = 0.1\r
+\r
+hyp2=gen.CreateHypothesis("MaxElementArea")\r
+hypArea=hyp2._narrow(SMESH.SMESH_MaxElementArea)\r
+hypArea.SetMaxElementArea(maxElementArea)\r
+print hypArea.GetName()\r
+print hypArea.GetId()\r
+print hypArea.GetMaxElementArea()\r
+\r
+idarea = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea) )\r
+smeshgui.SetName(idarea, "MaxElementArea")\r
+\r
+print "-------------------------- MaxElementVolume"\r
+\r
+maxElementVolume = 0.5\r
+\r
+hyp3=gen.CreateHypothesis("MaxElementVolume")\r
+hypVolume=hyp3._narrow(SMESH.SMESH_MaxElementVolume)\r
+hypVolume.SetMaxElementVolume(maxElementVolume)\r
+print hypVolume.GetName()\r
+print hypVolume.GetId()\r
+print hypVolume.GetMaxElementVolume()\r
+\r
+idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )\r
+smeshgui.SetName(idvolume, "MaxElementVolume")\r
+\r
+# ---- create Algorithms\r
+\r
+print "-------------------------- create Algorithms"\r
+\r
+print "-------------------------- Regular_1D"\r
+\r
+hypothesis=gen.CreateHypothesis("Regular_1D")\r
+regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)\r
+regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )\r
+smeshgui.SetName(regularID, "Wire Discretisation")\r
+\r
+print "-------------------------- MEFISTO_2D"\r
+\r
+hypothesis=gen.CreateHypothesis("MEFISTO_2D")\r
+mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)\r
+mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )\r
+smeshgui.SetName(mefistoID, "MEFISTO_2D")\r
+\r
+print "-------------------------- NETGEN_3D"\r
+\r
+hypothesis=gen.CreateHypothesis("NETGEN_3D")\r
+netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)\r
+netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )\r
+smeshgui.SetName(netgenID, "NETGEN_3D")\r
+\r
+# ---- init a Mesh with the alveole\r
+\r
+mesh=gen.Init(idalveole)\r
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )\r
+smeshgui.SetName(idmesh, "MeshAlveole")\r
+smeshgui.SetShape(idalveole, idmesh)\r
+\r
+# ---- add hypothesis to alveole\r
+\r
+print "-------------------------- add hypothesis to alveole"\r
+\r
+ret=mesh.AddHypothesis(alveole,regular1D)\r
+print ret\r
+ret=mesh.AddHypothesis(alveole,hypNbSeg)\r
+print ret\r
+ret=mesh.AddHypothesis(alveole,mefisto2D)\r
+print ret\r
+ret=mesh.AddHypothesis(alveole,hypArea)\r
+print ret\r
+ret=mesh.AddHypothesis(alveole,netgen3D)\r
+print ret\r
+ret=mesh.AddHypothesis(alveole,hypVolume)\r
+print ret\r
+\r
+smeshgui.SetAlgorithms( idmesh, regularID)\r
+smeshgui.SetHypothesis( idmesh, idseg )\r
+smeshgui.SetAlgorithms( idmesh, mefistoID )\r
+smeshgui.SetHypothesis( idmesh, idarea )\r
+smeshgui.SetAlgorithms( idmesh, netgenID )\r
+smeshgui.SetHypothesis( idmesh, idvolume )\r
+\r
+sg.updateObjBrowser(1)\r
+\r
+\r
+print "-------------------------- compute the mesh of alveole "\r
+ret=gen.Compute(mesh,idalveole)\r
+print ret\r
+if ret != 0:\r
+    log=mesh.GetLog(0) # no erase trace\r
+    for linelog in log:\r
+        print linelog\r
+else:\r
+    print "problem when computing the mesh"\r
+\r
+sg.updateObjBrowser(1)\r
diff --git a/src/SMESH_SWIG/SMESH_fixation_hexa.py b/src/SMESH_SWIG/SMESH_fixation_hexa.py
new file mode 100644 (file)
index 0000000..2916e6a
--- /dev/null
@@ -0,0 +1,122 @@
+#
+# Hexahedrization of the geometry generated by the Python script
+# SMESH_fixation.py
+# Hypothesis and algorithms for the mesh generation are global
+#
+
+import SMESH_fixation
+import SMESH
+import smeshpy
+
+compshell = SMESH_fixation.compshell
+idcomp = SMESH_fixation.idcomp
+geompy = SMESH_fixation.geompy
+salome = SMESH_fixation.salome
+sg = SMESH_fixation.sg
+
+ShapeTypeShell     = 3
+ShapeTypeFace      = 4
+ShapeTypeEdge      = 6
+
+print "Analysis of the geometry to be meshed :"
+subShellList=geompy.SubShapeAll(compshell,ShapeTypeShell)
+subFaceList=geompy.SubShapeAll(compshell,ShapeTypeFace)
+subEdgeList=geompy.SubShapeAll(compshell,ShapeTypeEdge)
+
+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
+
+### ---- launch SMESH
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+gen=smeshpy.smeshpy()
+
+### ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- NumberOfSegments"
+
+numberOfSegments = 5
+
+hyp1=gen.CreateHypothesis("NumberOfSegments")
+hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSeg.SetNumberOfSegments(numberOfSegments)
+hypNbSegID = hypNbSeg.GetId()
+print hypNbSeg.GetName()
+print hypNbSegID
+print hypNbSeg.GetNumberOfSegments()
+
+idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
+smeshgui.SetName(idseg, "NumberOfSegments")
+
+# ---- create Algorithms
+
+print "-------------------------- create Algorithms"
+
+print "-------------------------- Regular_1D"
+
+hypothesis=gen.CreateHypothesis("Regular_1D")
+regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
+regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
+smeshgui.SetName(regularID, "Wire Discretisation")
+
+print "-------------------------- Quadrangle_2D"
+
+hypothesis=gen.CreateHypothesis("Quadrangle_2D")
+quad2D = hypothesis._narrow(SMESH.SMESH_Quadrangle_2D)
+quadID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(quad2D) )
+smeshgui.SetName(quadID, "Quadrangle_2D")
+
+print "-------------------------- Hexa_3D"
+
+hypothesis=gen.CreateHypothesis("Hexa_3D")
+hexa3D = hypothesis._narrow(SMESH.SMESH_Hexa_3D)
+hexaID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(hexa3D) )
+smeshgui.SetName(hexaID, "Hexa_3D")
+
+# ---- init a Mesh with the compshell
+
+mesh=gen.Init(idcomp)
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
+smeshgui.SetName(idmesh, "MeshcompShel")
+smeshgui.SetShape(idcomp, idmesh)
+
+# ---- add hypothesis to compshell
+
+print "-------------------------- add hypothesis to compshell"
+
+ret=mesh.AddHypothesis(compshell,regular1D)
+print ret
+ret=mesh.AddHypothesis(compshell,hypNbSeg)
+print ret
+ret=mesh.AddHypothesis(compshell,quad2D)
+print ret
+ret=mesh.AddHypothesis(compshell,hexa3D)
+print ret
+
+smeshgui.SetAlgorithms( idmesh, regularID)
+smeshgui.SetHypothesis( idmesh, idseg )
+smeshgui.SetAlgorithms( idmesh, quadID )
+smeshgui.SetAlgorithms( idmesh, hexaID )
+
+sg.updateObjBrowser(1)
+
+
+print "-------------------------- compute compshell"
+ret=gen.Compute(mesh,idcomp)
+print ret
+if ret != 0:
+    log=mesh.GetLog(0) # no erase trace
+    for linelog in log:
+        print linelog
+else:
+    print "problem when Computing the mesh"
+
+sg.updateObjBrowser(1)
diff --git a/src/SMESH_SWIG/SMESH_fixation_tetra.py b/src/SMESH_SWIG/SMESH_fixation_tetra.py
new file mode 100644 (file)
index 0000000..57e9c91
--- /dev/null
@@ -0,0 +1,155 @@
+#
+# Tetrahedrization of the geometry generated by the Python script
+# SMESH_fixation.py
+# Hypothesis and algorithms for the mesh generation are global
+#
+
+import SMESH_fixation
+import SMESH
+import smeshpy
+
+compshell = SMESH_fixation.compshell
+idcomp = SMESH_fixation.idcomp
+geompy = SMESH_fixation.geompy
+salome = SMESH_fixation.salome
+sg = SMESH_fixation.sg
+
+ShapeTypeShell     = 3
+ShapeTypeFace      = 4
+ShapeTypeEdge      = 6
+
+print "Analysis of the geometry to be meshed :"
+subShellList=geompy.SubShapeAll(compshell,ShapeTypeShell)
+subFaceList=geompy.SubShapeAll(compshell,ShapeTypeFace)
+subEdgeList=geompy.SubShapeAll(compshell,ShapeTypeEdge)
+
+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
+
+### ---- launch SMESH
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+gen=smeshpy.smeshpy()
+
+### ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- NumberOfSegments"
+
+numberOfSegments = 5
+
+hypothesis=gen.CreateHypothesis("NumberOfSegments")
+hypNbSeg=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSeg.SetNumberOfSegments(numberOfSegments)
+hypNbSegID = hypNbSeg.GetId()
+print hypNbSeg.GetName()
+print hypNbSegID
+print hypNbSeg.GetNumberOfSegments()
+
+idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
+smeshgui.SetName(idseg, "NumberOfSegments")
+
+print "-------------------------- MaxElementArea"
+
+maxElementArea = 80
+
+hypothesis=gen.CreateHypothesis("MaxElementArea")
+hypArea=hypothesis._narrow(SMESH.SMESH_MaxElementArea)
+hypArea.SetMaxElementArea(maxElementArea)
+print hypArea.GetName()
+print hypArea.GetId()
+print hypArea.GetMaxElementArea()
+
+idarea = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea) )
+smeshgui.SetName(idarea, "MaxElementArea")
+
+print "-------------------------- MaxElementVolume"
+
+maxElementVolume = 150
+
+hypothesis=gen.CreateHypothesis("MaxElementVolume")
+hypVolume=hypothesis._narrow(SMESH.SMESH_MaxElementVolume)
+hypVolume.SetMaxElementVolume(maxElementVolume)
+print hypVolume.GetName()
+print hypVolume.GetId()
+print hypVolume.GetMaxElementVolume()
+
+idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
+smeshgui.SetName(idvolume, "MaxElementVolume")
+
+# ---- create Algorithms
+
+print "-------------------------- create Algorithms"
+
+print "-------------------------- Regular_1D"
+
+hypothesis=gen.CreateHypothesis("Regular_1D")
+regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
+regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
+smeshgui.SetName(regularID, "Wire Discretisation")
+
+print "-------------------------- MEFISTO_2D"
+
+hypothesis=gen.CreateHypothesis("MEFISTO_2D")
+mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
+mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
+smeshgui.SetName(mefistoID, "MEFISTO_2D")
+
+print "-------------------------- NETGEN_3D"
+
+hypothesis=gen.CreateHypothesis("NETGEN_3D")
+netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
+netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
+smeshgui.SetName(netgenID, "NETGEN_3D")
+
+# ---- init a Mesh with the compshell
+
+mesh=gen.Init(idcomp)
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
+smeshgui.SetName(idmesh, "MeshcompShell")
+smeshgui.SetShape(idcomp, idmesh)
+
+# ---- add hypothesis to compshell
+
+print "-------------------------- add hypothesis to compshell"
+
+ret=mesh.AddHypothesis(compshell,regular1D)
+print ret
+ret=mesh.AddHypothesis(compshell,hypNbSeg)
+print ret
+ret=mesh.AddHypothesis(compshell,mefisto2D)
+print ret
+ret=mesh.AddHypothesis(compshell,hypArea)
+print ret
+ret=mesh.AddHypothesis(compshell,netgen3D)
+print ret
+ret=mesh.AddHypothesis(compshell,hypVolume)
+print ret
+
+smeshgui.SetAlgorithms( idmesh, regularID)
+smeshgui.SetHypothesis( idmesh, idseg )
+smeshgui.SetAlgorithms( idmesh, mefistoID )
+smeshgui.SetHypothesis( idmesh, idarea )
+smeshgui.SetAlgorithms( idmesh, netgenID )
+smeshgui.SetHypothesis( idmesh, idvolume )
+
+sg.updateObjBrowser(1)
+
+print "-------------------------- compute compshell"
+ret=gen.Compute(mesh,idcomp)
+print ret
+if ret != 0:
+    log=mesh.GetLog(0) # no erase trace
+    for linelog in log:
+        print linelog
+else:
+    print "problem when computing the mesh"
+
+sg.updateObjBrowser(1)
diff --git a/src/SMESH_SWIG/SMESH_flight_skin.py b/src/SMESH_SWIG/SMESH_flight_skin.py
new file mode 100644 (file)
index 0000000..d815bbf
--- /dev/null
@@ -0,0 +1,146 @@
+#
+# Triangulation of the skin of the geometry from a Brep representing a plane
+# This geometry is from EADS
+# Hypothesis and algorithms for the mesh generation are global
+#
+
+import salome
+from salome import sg
+
+import geompy
+
+import SMESH
+import smeshpy
+
+geom = geompy.geom
+myBuilder = geompy.myBuilder
+
+ShapeTypeShell     = 3
+ShapeTypeFace      = 4
+ShapeTypeEdge      = 6
+
+import os
+
+# import a BRep
+#before running this script, please be sure about
+#the path the file fileName
+
+filePath=os.environ["SMESH_ROOT_DIR"]
+filePath=filePath+"/share/salome/resources/"
+
+filename = "flight_solid.brep"
+filename = filePath + filename
+
+shape = geompy.ImportBREP(filename)
+idShape = geompy.addToStudy(shape,"flight")
+
+print "Analysis of the geometry flight :"
+subShellList=geompy.SubShapeAll(shape,ShapeTypeShell)
+subFaceList=geompy.SubShapeAll(shape,ShapeTypeFace)
+subEdgeList=geompy.SubShapeAll(shape,ShapeTypeEdge)
+
+print "number of Shells in flight : ",len(subShellList)
+print "number of Faces in flight : ",len(subFaceList)
+print "number of Edges in flight : ",len(subEdgeList)
+
+# ---- launch SMESH
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+gen=smeshpy.smeshpy()
+
+# ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- LocalLength"
+
+lengthOfSegments = 0.3
+
+hypothesis=gen.CreateHypothesis("LocalLength")
+hypLength=hypothesis._narrow(SMESH.SMESH_LocalLength)
+hypLength.SetLength(lengthOfSegments)
+hypLengthID = hypLength.GetId()
+print hypLength.GetName()
+print hypLengthID
+print hypLength.GetLength()
+
+idlen = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLength) )
+smeshgui.SetName(idlen, "LocalLength")
+
+print "-------------------------- LengthFromEdges"
+
+hypothesis=gen.CreateHypothesis("LengthFromEdges")
+hypLengthFromEdge=hypothesis._narrow(SMESH.SMESH_LengthFromEdges)
+hypLengthFromEdgeID = hypLengthFromEdge.GetId()
+print hypLengthFromEdge.GetName()
+print hypLengthFromEdgeID
+
+idlenfromedge = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLengthFromEdge) )
+smeshgui.SetName(idlenfromedge, "LengthFromEdge")
+
+# ---- create Algorithms
+
+print "-------------------------- create Algorithms"
+
+print "-------------------------- Regular_1D"
+
+hypothesis=gen.CreateHypothesis("Regular_1D")
+regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
+regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
+smeshgui.SetName(regularID, "Wire Discretisation")
+
+print "-------------------------- MEFISTO_2D"
+
+hypothesis=gen.CreateHypothesis("MEFISTO_2D")
+mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
+mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
+smeshgui.SetName(mefistoID, "MEFISTO_2D")
+
+print "-------------------------- NETGEN_3D"
+
+hypothesis=gen.CreateHypothesis("NETGEN_3D")
+netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
+netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
+smeshgui.SetName(netgenID, "NETGEN_3D")
+
+# ---- init a Mesh with the shell
+
+mesh=gen.Init(idShape)
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
+smeshgui.SetName(idmesh, "MeshFlight")
+smeshgui.SetShape(idShape, idmesh)
+
+# ---- add hypothesis to flight
+
+print "-------------------------- add hypothesis to flight"
+
+ret=mesh.AddHypothesis(shape,regular1D)
+print ret
+ret=mesh.AddHypothesis(shape,hypLength)
+print ret
+ret=mesh.AddHypothesis(shape,mefisto2D)
+print ret
+ret=mesh.AddHypothesis(shape,hypLengthFromEdge)
+print ret
+
+smeshgui.SetAlgorithms( idmesh, regularID)
+smeshgui.SetHypothesis( idmesh, idlen )
+smeshgui.SetAlgorithms( idmesh, mefistoID )
+smeshgui.SetHypothesis( idmesh, idlenfromedge)
+
+sg.updateObjBrowser(1)
+
+
+print "-------------------------- compute the skin flight"
+ret=gen.Compute(mesh,idShape)
+print ret
+if ret != 0:
+    log=mesh.GetLog(0) # no erase trace
+    for linelog in log:
+        print linelog
+else:
+    print "probleme when computing the mesh"
+
+sg.updateObjBrowser(1)