]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
This commit was generated by cvs2git to create branch 'V1_4_1a'.
authoradmin <salome-admin@opencascade.com>
Thu, 1 Apr 2004 11:58:40 +0000 (11:58 +0000)
committeradmin <salome-admin@opencascade.com>
Thu, 1 Apr 2004 11:58:40 +0000 (11:58 +0000)
Sprout from master 2004-01-29 17:52:25 UTC jrt <jrt> 'Upgrade to version 1.4.0.'
Cherrypick from master 2004-04-01 11:58:39 UTC nadir <nadir> 'adding python scripts to illustrate the way to mesh a shape giving different hypothesis on its sub-shapes.':
    doc/html/SMESHTutorial_1/ControlFeature.png
    doc/html/SMESHTutorial_1/ImportResult.png
    doc/html/SMESHTutorial_1/MeshInit.png
    doc/html/SMESHTutorial_1/MeshResult.png
    doc/html/SMESHTutorial_1/MeshResult2.png
    doc/html/SMESHTutorial_1/SMESHOverview.png
    doc/html/SMESHTutorial_1/SMESHTutorial_1.html
    doc/html/SMESHTutorial_1/SelectAlgorithms.png
    doc/html/SMESHTutorial_1/SetColor.png
    doc/html/SMESHTutorial_1/SubMeshContruction.png
    doc/html/SMESHTutorial_1/SubShapesSelection.png
    src/SMESH_SWIG/SMESH_box_hexa.py
    src/SMESH_SWIG/SMESH_demo_hexa.py
    src/SMESH_SWIG/SMESH_demo_hexa2.py
    src/SMESH_SWIG/SMESH_demo_tetra.py
    src/SMESH_SWIG/SMESH_demo_tetra2.py
Cherrypick from master 2004-01-30 15:42:52 UTC jrt <jrt> 'update.':
    ChangeLog
Cherrypick from IMPORT 2003-07-10 08:13:02 UTC yfr <yfr@opencascade.com> 'sources v1.2':
    src/DriverMED/DriverMED_R_SMESHDS_Document.h
    src/DriverMED/DriverMED_W_SMESHDS_Document.h
    src/SMESHGUI/SMESHGUI_msg_en.po

17 files changed:
ChangeLog
doc/html/SMESHTutorial_1/ControlFeature.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/ImportResult.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/MeshInit.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/MeshResult.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/MeshResult2.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/SMESHOverview.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/SMESHTutorial_1.html [new file with mode: 0644]
doc/html/SMESHTutorial_1/SelectAlgorithms.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/SetColor.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/SubMeshContruction.png [new file with mode: 0644]
doc/html/SMESHTutorial_1/SubShapesSelection.png [new file with mode: 0644]
src/SMESH_SWIG/SMESH_box_hexa.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_demo_hexa.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_demo_hexa2.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_demo_tetra.py [new file with mode: 0644]
src/SMESH_SWIG/SMESH_demo_tetra2.py [new file with mode: 0644]

index 77da70fb183679fc0ba20615a8c12f455b7596f0..46cf0c99215365ade05a5bc57976e0487d492aa4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,20 @@
 #cvs2cl.pl -l "-b" -U users.cvs2cl --header header.cvs2cl -T -b --utc
 ###############################################################################
 
+2004-01-30 13:18  Nicolas Rejneri <nicolas.rejneri@opencascade.com>
+
+       * doc/html/INPUT/: doxyfile, sources/static/tree.js: NRI : 1.4.0
+         version
+
+2004-01-29 17:52  Jerome Robert <jerome.robert@eads.net>
+
+       * INSTALL, bin/VERSION: Upgrade to version 1.4.0.
+
+2004-01-29 17:33  Jerome Robert <jerome.robert@eads.net>
+
+       * src/: SMESHGUI/SMESHGUI_StudyAPI.cxx, SMESHGUI/SMESHGUI_Swig.cxx,
+         SMESH_I/SMESH_Gen_i.cxx: Merge branch merge_1_2_d
+
 2004-01-14 09:24  Nicolas Rejneri <nicolas.rejneri@opencascade.com>
 
        * doc/html/Makefile.in: NRI : bug KERNEL5014 fixed.
 
 2004-01-05 14:28  tag V1_3_1
 
-2004-01-05 14:28  Jerome Robert <jerome.robert@eads.net>
-
-       * ChangeLog, cvs-tags: update
-
 2004-01-05 13:53  Jerome Robert <jerome.robert@eads.net>
 
        * src/NETGEN/: ReadMeForNgUsers, netgen43ForSalome.patch: Add a
 
        * src/MEFISTO2/trte.f: Remove "pause" primitive call.
 
-2003-11-27 11:47  Jerome Robert <jerome.robert@eads.net>
-
-       * ChangeLog, cvs-tags: update
-
 2003-11-27 11:45  Jerome Robert <jerome.robert@eads.net>
 
        * resources/SMESH_en.xml, resources/SMESH_fr.xml,
          nadir_update_MED_v1_3_0 (branch to build the V1_3_0 version of
          the module.
 
-2003-11-17 09:22  Jerome Robert <jerome.robert@eads.net>
-
-       * cvs-tags: update
-
 2003-11-12 13:20  tag V1_3_0_b1
 
 2003-11-12 13:20  Jerome Robert <jerome.robert@eads.net>
        * src/SMDS/SMDS_Mesh.cxx: Fix a bug. Quadrangles were added as
          triangles.
 
-2003-10-17 12:35  Jerome Robert <jerome.robert@eads.net>
-
-       * cvs-tags: Create branch merge_1_2_c__1_2_2
-
 2003-10-06 10:50  tag MergeV1_2c-1
 
 2003-10-06 10:50  Jerome Robert <jerome.robert@eads.net>
        * src/SMDS/SMDS_VolumeOfNodes.cxx: Fix bug. Was always printing 8
          nodes
 
-2003-09-08 15:11  Jerome Robert <jerome.robert@eads.net>
-
-       * ChangeLog: update
-
 2003-09-08 15:04  Jerome Robert <jerome.robert@eads.net>
 
        * src/SMDS/: SMDS_Mesh.cxx, SMDS_VolumeOfNodes.cxx,
          SMDS_VertexPosition.cdl, SMDS_VertexPosition.ixx,
          SMDS_VertexPosition.jxx: Remove no longer needed files
 
-2003-09-04 14:09  Jerome Robert <jerome.robert@eads.net>
-
-       * ChangeLog: Add a ChangeLog file
-
 2003-09-04 13:28  Jerome Robert <jerome.robert@eads.net>
 
        * build_configure: It seems "make_omniorb" and "make_commence" need
          SMDS_VolumeOfNodes.cxx, SMDS_VolumeOfNodes.hxx: Add needed class
          for the new DS
 
-2003-07-18 12:19  tag V_02092003
-
-2003-07-18 12:19  tag V_03092003
-
-2003-07-18 12:19  tag V_04092003
-
-2003-07-18 12:19  tag V_05092003
-
-2003-07-18 12:19  tag V_06092003
-
-2003-07-18 12:19  tag V_07092003
-
-2003-07-18 12:19  tag V_08092003
-
-2003-07-18 12:19  tag V_09092003
-
-2003-07-18 12:19  tag V_10092003
-
-2003-07-18 12:19  tag V_11092003
-
-2003-07-18 12:19  tag V_12092003
-
-2003-07-18 12:19  tag V_13092003
-
-2003-07-18 12:19  tag V_14092003
-
-2003-07-18 12:19  tag V_15092003
-
-2003-07-18 12:19  tag V_16092003
-
-2003-07-18 12:19  tag V_17092003
-
-2003-07-18 12:19  tag V_18092003
-
 2003-07-18 12:19  Nicolas Rejneri <nicolas.rejneri@opencascade.com>
 
        * src/SMESHGUI/SMESHGUI_StudyAPI.cxx: NRI : correction wrong merge.
diff --git a/doc/html/SMESHTutorial_1/ControlFeature.png b/doc/html/SMESHTutorial_1/ControlFeature.png
new file mode 100644 (file)
index 0000000..82222c4
Binary files /dev/null and b/doc/html/SMESHTutorial_1/ControlFeature.png differ
diff --git a/doc/html/SMESHTutorial_1/ImportResult.png b/doc/html/SMESHTutorial_1/ImportResult.png
new file mode 100644 (file)
index 0000000..55c5a2b
Binary files /dev/null and b/doc/html/SMESHTutorial_1/ImportResult.png differ
diff --git a/doc/html/SMESHTutorial_1/MeshInit.png b/doc/html/SMESHTutorial_1/MeshInit.png
new file mode 100644 (file)
index 0000000..c9c4c16
Binary files /dev/null and b/doc/html/SMESHTutorial_1/MeshInit.png differ
diff --git a/doc/html/SMESHTutorial_1/MeshResult.png b/doc/html/SMESHTutorial_1/MeshResult.png
new file mode 100644 (file)
index 0000000..4072ea8
Binary files /dev/null and b/doc/html/SMESHTutorial_1/MeshResult.png differ
diff --git a/doc/html/SMESHTutorial_1/MeshResult2.png b/doc/html/SMESHTutorial_1/MeshResult2.png
new file mode 100644 (file)
index 0000000..c7e9e37
Binary files /dev/null and b/doc/html/SMESHTutorial_1/MeshResult2.png differ
diff --git a/doc/html/SMESHTutorial_1/SMESHOverview.png b/doc/html/SMESHTutorial_1/SMESHOverview.png
new file mode 100644 (file)
index 0000000..2e61dd3
Binary files /dev/null and b/doc/html/SMESHTutorial_1/SMESHOverview.png differ
diff --git a/doc/html/SMESHTutorial_1/SMESHTutorial_1.html b/doc/html/SMESHTutorial_1/SMESHTutorial_1.html
new file mode 100644 (file)
index 0000000..bac9ce6
--- /dev/null
@@ -0,0 +1,230 @@
+<!DOCTYPE HTML PUBLIC "HTML 4.01 Transitional">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html">
+  <title>Geometry module in SALOME environnement </title>
+</head>
+
+<body>
+<h1>SMESH starting tutorial</h1>
+
+<h2>2D meshing with MEFISTO</h2>
+
+<h3>Overview</h3>
+
+<p><i>Before following this tutorial you need to create or import a geometry.
+Please refere to the GEOM module documentation to do so.</i></p>
+
+<p>Now we have to load SMESH component. To do so&nbsp;: </p>
+<ul>
+  <li>click on the SMESH icon or on 'SMESH' into the combo box of resources
+    on botton left.</li>
+</ul>
+
+<p><i>SMESH is used to mesh edges, faces and volums each one thanks to a
+specialised algorithm. To mesh an entity which degree is n, one must have all
+its lower degree entities meshed. For instance, to mesh a face requires a
+previous meshing of all its edges. In the example MEFISTO meshes faces, and
+Regular_1D meshes edges. MEFISTO doesn't check how edges are meshed. The only
+test it does is to verify that edges are meshed before starting its work.
+MEFISTO requires an hypothesis&nbsp;: maximum area of triangles. Regular_1D
+requires one hypothesis among two: number of segments per edge <u>or</u>
+length of segment.</i>&nbsp; </p>
+
+<p>The entire operation is done by :</p>
+<ol>
+  <li>init a mesh object associated to a geometrical object</li>
+  <li>choosing an <u>algorithm</u> for meshing faces, here MEFISTO is
+  choosen</li>
+  <li>choosing an <u>algorithm</u> for meshing edges, here Regular1d is
+    choosen</li>
+  <li>creating <u>hypothesis</u> of calculation. We need to inform :
+    <ul>
+      <li>the number of segments per edge</li>
+      <li>the maximum area per triangle of meshing</li>
+    </ul>
+  </li>
+  <li>setting or attaching algorithm and hypothesis to the object loaded</li>
+  <li>launching computation</li>
+  <li>displaying the result in the best mode.</li>
+</ol>
+<img alt="" src="SMESHOverview.png">
+
+<h3>Details</h3>
+
+<p>Below are explained those 6 steps precisely&nbsp;: </p>
+<ol>
+  <li><p><u>init a mesh object associated to a geometrical object :</u></p>
+    <p><img src="MeshInit.png"></p>
+    <ul>
+      <li>In the menu bar on the top, find the <u>Mesh</u> menu and click on
+        <u>Init.</u></li>
+      <li>Then in the dialog box select the topology into Geometry field of
+        ObjectBrowser or Viewer, give a name an click on Ok.</li>
+      <li>The topology is now known inside SMESH component.</li>
+    </ul>
+  </li>
+  <li><p>define algorithms for meshing&nbsp;: </p>
+    <p><img src="SelectAlgorithms.png"></p>
+    <ul>
+      <li>In the menu bar, find <u>Hypothesis</u>, <u>Algorithm</u> then
+        click on <u>Mefisto.</u></li>
+      <li>Do the same to load 'Regular1D'.</li>
+      <li>Remember, Regular1D is needed for edge meshing.</li>
+    </ul>
+  </li>
+  <li><p>define <u>hypothesis</u> of calculation&nbsp;:<br>
+    In the menu bar, find <u>Hypothesis</u> then Hypothesis and click on
+    Segments. Then in the dialog box give a name for <u>hypothesis</u> and a
+    value that is the number of segments per edge. Enter 7 segments for
+    example.<br>
+    Do the same for 'Max. Element Area' argument that is the maximum surface
+    of triangles builded during meshing. Enter 2500 here.</p>
+  </li>
+  <li><p>Attach previous arguments (hypothesis) and algorithm to the
+    topology&nbsp;:<br>
+    Select the object in the Object Browser then using pop up menu (right
+    click on object),<br>
+    'Set algorithm' and 'Set Hypothesis' into specialized dialog boxes.<br>
+    You can also find these methods in the menu 'Hypothesis'.</p>
+  </li>
+  <li><p>Selecting the mesh object before, start computation in the pop up
+    menu; click on 'Compute'.</p>
+  </li>
+  <li><p>Update the display using '<i>Update'</i> if necessary.<br>
+    Note&nbsp;: in <i>Preferencies</i>&nbsp;/ <i>Mesh</i> menu there is an
+    option to have an automatic update of the display after operations that
+    modify it such as Compute, adding nodesâ&#x20ac;¦ If this option is not
+    setted user must make an update of the display manually.<br>
+    <br>
+    You may also adjust the display '<i>Properties' / 'Display Mode</i>' has
+    you prefer&nbsp;; shading, wireframe or shrink,<br>
+    and adjust color and size attributs in a specific dialog box shown
+    below.</p>
+    <p><img src="SetColor.png"></p>
+  </li>
+</ol>
+
+<h3>Final result of meshing</h3>
+
+<p>At this final step you can observe the result of 2D meshing of faces by
+MEFISTO.</p>
+
+<p>Note&nbsp;: it is possible to change an hypothesis by mean the pop up then
+<i>Edit</i> and finally compute again.</p>
+
+<p><img src="MeshResult.png"></p>
+
+<h2>Meshing with global and local hypothesis</h2>
+
+<h3>details</h3>
+
+<p><i>We would now make a mesh as before but with a local modification of
+parameter (hypothesis) on an edge. We first have to explode the initial
+topology in GEOMETRY component. This operation will give us access to sub
+shapes edges of geom.brep.</i></p>
+<ol>
+  <li><p>import or create a geometry as before</p>
+  </li>
+  <li><p>call 'Explode' method found in 'New Entity' on the menu bar&nbsp;;
+    (remember the tip about Automatic/Store&nbsp;!) </p>
+    <p><img src="SubShapesSelection.png"></p>
+  </li>
+  <li><p>select the main object, choose 'Edge' in the combo box and click on
+    Ok.<br>
+    <u>Note</u>&nbsp;: do not click on 'select sub shape' at anytime. This
+    function is used with OCC viewer for individual sub shape selection not
+    yet available with VTK.<br>
+    <br>
+    Now the object browser contents all edges as sub shapes of the main
+    topology. Select the first edge <i>Edge_&nbsp;1</i> and display only it.
+    Use the pop up 'Display only' mode for this.<br>
+    You may also rename the edge to remember it for future meshing.<br>
+    <i>Our scope&nbsp;: apply a local hypothesis on this edge.<br>
+    </i></p>
+  </li>
+  <li><p>The job is now finished for GEOMETRY component.</p>
+  </li>
+  <li><p>Load SMESH component and use menus 'Mesh' and 'Init' to load the
+    topology into SMESH as before.<br>
+    (Already defined if you have kept the previous study.)</p>
+  </li>
+  <li><p>Define algorithms Regular_1D and Mefisto using menus 'Hypothesis'
+    and 'Algorithm'.</p>
+  </li>
+  <li><p>Define hypothesis 'Segments' = 7 and 'Max. Element Area' = 2500.
+    (Already defined ifâ&#x20ac;¦) </p>
+  </li>
+  <li><p>Define another hypothesis 'Local length' = 100 to be used only as
+    local parameter for the edge.</p>
+  </li>
+  <li><p>Now we have to attach algorithms and hypothesis to topologies, the
+    global and the sub shape edge.<br>
+    For the main topology, select it and use 'Set algorithms' and 'Set
+    Hypothesis' and attach&nbsp;:<br>
+    hypothesis 'Segments' = 7 and 'Max. Element Area' = 2500.</p>
+  </li>
+  <li><p>To set a local parameter of meshing on the edge we do :<br>
+    click on 'Mesh' menu then 'Add Sub Mesh'. On the dialog box select the
+    main object then sub object edge from Object Browser and GEOMETRY field.
+    Give it a local name; for example <i>myEdge</i> or anyone.</p>
+    <p><img src="SubMeshContruction.png"></p>
+  </li>
+  <li><p>Set the algorithm used for edge meshing. Here use Regular_&nbsp;1D.
+    </p>
+  </li>
+  <li><p>Set a local hypothesis to the edge. Use 'Local length' = 100.</p>
+  </li>
+  <li><p>'<i>Compute'</i> (and '<i>Update'</i> display if necessary see
+    before) the main&nbsp;mesh object. This will compute also the edge sub
+    shape.<br>
+    Do not forget to activate the display&nbsp;mode Wireframe,
+    Shading&nbsp;or Shrink; see in pop up menu '<i>Properties'</i>,
+    '<i>Display mode'</i>â&#x20ac;¦ </p>
+  </li>
+  <li><p>Move the point of view&nbsp;to watch the edge meshed with a local
+    hypothesis 'Local length' = 100. </p>
+  </li>
+</ol>
+
+<h3>The result of second meshing</h3>
+
+<p>As we see below, the effect produced by setting a local hypothesis setted
+on the edge <i>Edge_&nbsp;1.</i></p>
+
+<p align="left">Compare to another edge that have the same physical
+length.</p>
+
+<p><img src="MeshResult2.png"></p>
+
+<h2>Using PYTHON interpretor to import an example script</h2>
+It is easy to import an example of meshing procedure using PYTHON interpretor
+:
+<ul>
+  <li>Load SMESH component with VTK viewer.</li>
+  <li>Just type <i>'import geomMesh.py'</i> in the textual window of
+  PYTHON.</li>
+  <li>Validate with the <i>Enter</i> key.</li>
+  <li>You just have to run 'Compute' then choose a display mode to see the
+    result.</li>
+</ul>
+This imported example is very similar to the last exercice. It uses a local
+hypothesis on an edge too.
+
+<p><img src="ImportResult.png"></p>
+
+<h2>Control features</h2>
+
+<p>Test now a control function of area for mesh resulting triangles.</p>
+
+<p>Find <i>Control</i> on the menu bar then <i>Cells</i> and <i>Area</i>. The
+image below displays areas with a color depending on its value in the scalar
+bar shown on the left.<br>
+Scalar bar general parameters are setted in <i>Preferencies</i>&nbsp;/
+<i>Mesh</i> / <i>Scalar Bar</i>.</p>
+
+<p>Specific range parameters are changed with the pop up menu.</p>
+
+<p><img src="ControlFeature.png"></p>
+</body>
+</html>
diff --git a/doc/html/SMESHTutorial_1/SelectAlgorithms.png b/doc/html/SMESHTutorial_1/SelectAlgorithms.png
new file mode 100644 (file)
index 0000000..c69f3e4
Binary files /dev/null and b/doc/html/SMESHTutorial_1/SelectAlgorithms.png differ
diff --git a/doc/html/SMESHTutorial_1/SetColor.png b/doc/html/SMESHTutorial_1/SetColor.png
new file mode 100644 (file)
index 0000000..bda5fd5
Binary files /dev/null and b/doc/html/SMESHTutorial_1/SetColor.png differ
diff --git a/doc/html/SMESHTutorial_1/SubMeshContruction.png b/doc/html/SMESHTutorial_1/SubMeshContruction.png
new file mode 100644 (file)
index 0000000..1080f08
Binary files /dev/null and b/doc/html/SMESHTutorial_1/SubMeshContruction.png differ
diff --git a/doc/html/SMESHTutorial_1/SubShapesSelection.png b/doc/html/SMESHTutorial_1/SubShapesSelection.png
new file mode 100644 (file)
index 0000000..c5df40b
Binary files /dev/null and b/doc/html/SMESHTutorial_1/SubShapesSelection.png differ
diff --git a/src/SMESH_SWIG/SMESH_box_hexa.py b/src/SMESH_SWIG/SMESH_box_hexa.py
new file mode 100644 (file)
index 0000000..2c6b20c
--- /dev/null
@@ -0,0 +1,215 @@
+#
+# Hexahedrization of a simple box. Hypothesis and algorithms for
+# the mesh generation are not global: the mesh of some edges is thinner
+#
+
+import salome
+from salome import sg
+
+import geompy
+
+import SMESH
+import smeshpy
+
+# -----------------------------------------------------------------------------
+
+geom = geompy.geom
+myBuilder = geompy.myBuilder
+
+ShapeTypeShell     = 3
+ShapeTypeFace      = 4
+ShapeTypeEdge      = 6
+
+# ---- define a boxe
+
+box = geompy.MakeBox(0., 0., 0., 1., 1., 1.)
+
+idbox = geompy.addToStudy(box,"box")
+
+print "Analysis of the geometry box :"
+subShellList=geompy.SubShapeAllSorted(box,ShapeTypeShell)
+subFaceList=geompy.SubShapeAllSorted(box,ShapeTypeFace)
+subEdgeList=geompy.SubShapeAllSorted(box,ShapeTypeEdge)
+
+print "number of Shells in box : ",len(subShellList)
+print "number of Faces in box : ",len(subFaceList)
+print "number of Edges in box : ",len(subEdgeList)
+
+idSubEdge = []
+for k in range(len(subEdgeList)):
+    idSubEdge.append(geompy.addToStudyInFather(box,subEdgeList[k],"SubEdge"+str(k)))
+
+edgeX = []
+edgeX.append(subEdgeList[4])
+edgeX.append(subEdgeList[5])
+edgeX.append(subEdgeList[6])
+edgeX.append(subEdgeList[7])
+
+edgeY = []
+edgeY.append(subEdgeList[1])
+edgeY.append(subEdgeList[2])
+edgeY.append(subEdgeList[9])
+edgeY.append(subEdgeList[10])
+
+edgeZ = []
+edgeZ.append(subEdgeList[0])
+edgeZ.append(subEdgeList[3])
+edgeZ.append(subEdgeList[8])
+edgeZ.append(subEdgeList[11])
+
+idEdgeX = []
+idEdgeY = []
+idEdgeZ = []
+for i in range(4):
+    idEdgeX.append(geompy.addToStudyInFather(box,edgeX[i],"EdgeX"+str(i+1)))
+    idEdgeY.append(geompy.addToStudyInFather(box,edgeY[i],"EdgeY"+str(i+1)))
+    idEdgeZ.append(geompy.addToStudyInFather(box,edgeZ[i],"EdgeZ"+str(i+1)))
+
+# ---- launch SMESH
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+gen=smeshpy.smeshpy()
+
+# ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- NumberOfSegments in X, Y, Z direction"
+
+numberOfSegmentsX = 10
+
+hyp1=gen.CreateHypothesis("NumberOfSegments")
+hypNbSegX=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSegX.SetNumberOfSegments(numberOfSegmentsX)
+hypNbSegXID = hypNbSegX.GetId()
+print hypNbSegX.GetName()
+print hypNbSegXID
+print hypNbSegX.GetNumberOfSegments()
+
+idsegX = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSegX) )
+smeshgui.SetName(idsegX, "NumberOfSegmentsX")
+
+print ""
+
+numberOfSegmentsY = 20
+
+hyp1=gen.CreateHypothesis("NumberOfSegments")
+hypNbSegY=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSegY.SetNumberOfSegments(numberOfSegmentsY)
+hypNbSegYID = hypNbSegY.GetId()
+print hypNbSegY.GetName()
+print hypNbSegYID
+print hypNbSegY.GetNumberOfSegments()
+
+idsegY = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSegY) )
+smeshgui.SetName(idsegY, "NumberOfSegmentsY")
+
+print ""
+
+numberOfSegmentsZ = 40
+
+hyp1=gen.CreateHypothesis("NumberOfSegments")
+hypNbSegZ=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSegZ.SetNumberOfSegments(numberOfSegmentsZ)
+hypNbSegZID = hypNbSegZ.GetId()
+print hypNbSegZ.GetName()
+print hypNbSegZID
+print hypNbSegZ.GetNumberOfSegments()
+
+idsegZ = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSegZ) )
+smeshgui.SetName(idsegZ, "NumberOfSegmentsZ")
+
+# ---- 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 boxe
+
+mesh=gen.Init(idbox)
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
+smeshgui.SetName(idmesh, "MeshBox")
+smeshgui.SetShape(idbox, idmesh)
+
+# ---- add hypothesis to the boxe
+
+print "-------------------------- add hypothesis to the boxe"
+print "                           the number of segments is globally set to"
+print "                           NumberOfSegmentsX = ", numberOfSegmentsX
+
+ret=mesh.AddHypothesis(box,regular1D)
+print ret
+ret=mesh.AddHypothesis(box,hypNbSegX)
+print ret
+ret=mesh.AddHypothesis(box,quad2D)
+print ret
+ret=mesh.AddHypothesis(box,hexa3D)
+print ret
+
+print "-------------------------- set algoritms"
+
+smeshgui.SetAlgorithms( idmesh, regularID)
+smeshgui.SetHypothesis( idmesh, idsegX )
+smeshgui.SetAlgorithms( idmesh, quadID )
+smeshgui.SetAlgorithms( idmesh, hexaID )
+
+for i in range(4):
+    print "-------------------------- add hypothesis to edge in the Y and Z directions", (i+1)
+
+    subMeshEdgeY = mesh.GetElementsOnShape(edgeY[i])
+    subMeshEdgeZ = mesh.GetElementsOnShape(edgeZ[i])
+
+    retY = mesh.AddHypothesis(edgeY[i],hypNbSegY)
+    retZ = mesh.AddHypothesis(edgeZ[i],hypNbSegZ)
+    print " add hyp Y ", retY, " Z ", retZ
+
+    idsmY = smeshgui.AddSubMeshOnShape(
+        idmesh,idEdgeY[i],salome.orb.object_to_string(subMeshEdgeY),
+        ShapeTypeEdge)
+    idsmZ = smeshgui.AddSubMeshOnShape(
+        idmesh,idEdgeZ[i],salome.orb.object_to_string(subMeshEdgeZ),
+        ShapeTypeEdge)
+
+    smeshgui.SetName(idsmY, "SubMeshEdgeY_"+str(i+1))
+    smeshgui.SetName(idsmZ, "SubMeshEdgeZ_"+str(i+1))
+
+    smeshgui.SetHypothesis(idsmY, idsegY)
+    smeshgui.SetHypothesis(idsmZ, idsegZ)
+
+sg.updateObjBrowser(1)
+
+print "-------------------------- compute the mesh of the boxe"
+ret=gen.Compute(mesh,idbox)
+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_demo_hexa.py b/src/SMESH_SWIG/SMESH_demo_hexa.py
new file mode 100644 (file)
index 0000000..5446936
--- /dev/null
@@ -0,0 +1,175 @@
+#
+# Tetrahedrization of a geometry (box minus a inner cylinder).
+# Hypothesis and algorithms for the mesh generation are global
+#
+
+import math
+import salome
+from salome import sg
+
+import geompy
+
+import SMESH
+import smeshpy
+
+# -----------------------------------------------------------------------------
+
+geom = geompy.geom
+myBuilder = geompy.myBuilder
+
+ShapeTypeShell     = 3
+ShapeTypeFace      = 4
+ShapeTypeEdge      = 6
+
+a = math.sqrt(2.)/4.
+ma = - a
+zero = 0.
+un = 1.
+mun= - un
+demi = 1./2.
+
+Orig = geom.MakePointStruct(zero,zero,zero)
+P0 = geom.MakePointStruct(a,a,zero)
+P1 = geom.MakePointStruct(zero,demi,zero)
+P2 = geom.MakePointStruct(ma,a,zero)
+P3 = geom.MakePointStruct(mun,un,zero)
+P4 = geom.MakePointStruct(un,un,zero)
+P5 = geom.MakePointStruct(zero,zero,un)
+
+arc = geompy.MakeArc(P0,P1,P2)
+e1 = geompy.MakeEdge(P2,P3)
+e2 = geompy.MakeEdge(P3,P4)
+e3 = geompy.MakeEdge(P4,P0)
+
+list = []
+list.append(arc._get_Name())
+list.append(e1._get_Name())
+list.append(e2._get_Name())
+list.append(e3._get_Name())
+
+wire = geompy.MakeWire(list)
+face = geompy.MakeFace(wire,1)
+
+dir = geompy.MakeVector(Orig,P5)
+vol1 = geompy.MakePipe(dir,face)
+
+angle = math.pi/2.
+dir = geom.MakeAxisStruct(zero,zero,zero,zero,zero,un)
+vol2 = geompy.MakeRotation(vol1,dir,angle)
+
+vol3 = geompy.MakeRotation(vol2,dir,angle)
+
+vol4 = geompy.MakeRotation(vol3,dir,angle)
+
+list = []
+list.append(vol1._get_Name())
+list.append(vol2._get_Name())
+list.append(vol3._get_Name())
+list.append(vol4._get_Name())
+
+volComp = geompy.MakeCompound(list)
+
+tol3d = 1.e-3
+vol = geom.MakeGlueFaces(volComp,tol3d)
+idVol = geompy.addToStudy(vol,"volume")
+
+print "Analysis of the final volume:"
+subShellList=geompy.SubShapeAll(vol,ShapeTypeShell)
+subFaceList=geompy.SubShapeAll(vol,ShapeTypeFace)
+subEdgeList=geompy.SubShapeAll(vol,ShapeTypeEdge)
+
+print "number of Shells in the volume : ",len(subShellList)
+print "number of Faces in the volume : ",len(subFaceList)
+print "number of Edges in the volume : ",len(subEdgeList)
+
+# ---- launch SMESH
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+gen=smeshpy.smeshpy()
+
+# ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- NumberOfSegments"
+
+numberOfSegments = 10
+
+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")
+
+# ---- 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 volume
+
+mesh=gen.Init(idVol)
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
+smeshgui.SetName(idmesh, "meshVolume")
+smeshgui.SetShape(idVol, idmesh)
+
+# ---- add hypothesis to the volume
+
+print "-------------------------- add hypothesis to the volume"
+
+ret=mesh.AddHypothesis(vol,regular1D)
+print ret
+ret=mesh.AddHypothesis(vol,hypNbSeg)
+print ret
+ret=mesh.AddHypothesis(vol,quad2D)
+print ret
+ret=mesh.AddHypothesis(vol,hexa3D)
+print ret
+
+print "-------------------------- set algoritms"
+
+smeshgui.SetAlgorithms( idmesh, regularID)
+smeshgui.SetHypothesis( idmesh, idseg )
+smeshgui.SetAlgorithms( idmesh, quadID )
+smeshgui.SetAlgorithms( idmesh, hexaID )
+
+sg.updateObjBrowser(1)
+
+print "-------------------------- compute the mesh of the volume"
+ret=gen.Compute(mesh,idVol)
+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_demo_hexa2.py b/src/SMESH_SWIG/SMESH_demo_hexa2.py
new file mode 100644 (file)
index 0000000..336bf01
--- /dev/null
@@ -0,0 +1,225 @@
+#
+# Tetrahedrization of a geometry (box minus a inner cylinder).
+# Hypothesis and algorithms for the mesh generation are not global:
+# the mesh of some edges is thinner
+#
+
+import math
+import salome
+from salome import sg
+
+import geompy
+
+import SMESH
+import smeshpy
+
+# -----------------------------------------------------------------------------
+
+geom = geompy.geom
+myBuilder = geompy.myBuilder
+
+ShapeTypeShell     = 3
+ShapeTypeFace      = 4
+ShapeTypeEdge      = 6
+
+a = math.sqrt(2.)/4.
+ma = - a
+zero = 0.
+un = 1.
+mun= - un
+demi = 1./2.
+
+Orig = geom.MakePointStruct(zero,zero,zero)
+P0 = geom.MakePointStruct(a,a,zero)
+P1 = geom.MakePointStruct(zero,demi,zero)
+P2 = geom.MakePointStruct(ma,a,zero)
+P3 = geom.MakePointStruct(mun,un,zero)
+P4 = geom.MakePointStruct(un,un,zero)
+P5 = geom.MakePointStruct(zero,zero,un)
+
+arc = geompy.MakeArc(P0,P1,P2)
+e1 = geompy.MakeEdge(P2,P3)
+e2 = geompy.MakeEdge(P3,P4)
+e3 = geompy.MakeEdge(P4,P0)
+
+list = []
+list.append(arc._get_Name())
+list.append(e1._get_Name())
+list.append(e2._get_Name())
+list.append(e3._get_Name())
+
+wire = geompy.MakeWire(list)
+face = geompy.MakeFace(wire,1)
+
+dir = geompy.MakeVector(Orig,P5)
+vol1 = geompy.MakePipe(dir,face)
+
+angle = math.pi/2.
+dir = geom.MakeAxisStruct(zero,zero,zero,zero,zero,un)
+vol2 = geompy.MakeRotation(vol1,dir,angle)
+
+vol3 = geompy.MakeRotation(vol2,dir,angle)
+
+vol4 = geompy.MakeRotation(vol3,dir,angle)
+
+list = []
+list.append(vol1._get_Name())
+list.append(vol2._get_Name())
+list.append(vol3._get_Name())
+list.append(vol4._get_Name())
+
+volComp = geompy.MakeCompound(list)
+
+tol3d = 1.e-3
+vol = geom.MakeGlueFaces(volComp,tol3d)
+idVol = geompy.addToStudy(vol,"volume")
+
+print "Analysis of the final volume:"
+subShellList=geompy.SubShapeAllSorted(vol,ShapeTypeShell)
+subFaceList=geompy.SubShapeAllSorted(vol,ShapeTypeFace)
+subEdgeList=geompy.SubShapeAllSorted(vol,ShapeTypeEdge)
+
+print "number of Shells in the volume : ",len(subShellList)
+print "number of Faces in the volume : ",len(subFaceList)
+print "number of Edges in the volume : ",len(subEdgeList)
+
+idSubEdge = []
+for k in range(len(subEdgeList)):
+    idSubEdge.append(geompy.addToStudyInFather(vol,subEdgeList[k],"SubEdge"+str(k)))
+
+edgeZ = []
+edgeZ.append(subEdgeList[0])
+edgeZ.append(subEdgeList[3])
+edgeZ.append(subEdgeList[10])
+edgeZ.append(subEdgeList[11])
+edgeZ.append(subEdgeList[20])
+edgeZ.append(subEdgeList[21])
+edgeZ.append(subEdgeList[28])
+edgeZ.append(subEdgeList[31])
+
+idEdgeZ = []
+for i in range(8):
+    idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1)))
+
+# ---- launch SMESH
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+gen=smeshpy.smeshpy()
+
+# ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- NumberOfSegments the global one"
+
+numberOfSegments = 10
+
+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 "-------------------------- NumberOfSegments in the Z direction"
+
+numberOfSegmentsZ = 40
+
+hypothesis=gen.CreateHypothesis("NumberOfSegments")
+hypNbSegZ=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSegZ.SetNumberOfSegments(numberOfSegmentsZ)
+hypNbSegZID = hypNbSegZ.GetId()
+print hypNbSegZ.GetName()
+print hypNbSegZID
+print hypNbSegZ.GetNumberOfSegments()
+
+idsegZ = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSegZ) )
+smeshgui.SetName(idsegZ, "NumberOfSegmentsZ")
+
+# ---- 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 volume
+
+mesh=gen.Init(idVol)
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
+smeshgui.SetName(idmesh, "meshVolume")
+smeshgui.SetShape(idVol, idmesh)
+
+# ---- add hypothesis to the volume
+
+print "-------------------------- add hypothesis to the volume"
+
+ret=mesh.AddHypothesis(vol,regular1D)
+print ret
+ret=mesh.AddHypothesis(vol,hypNbSeg)
+print ret
+ret=mesh.AddHypothesis(vol,quad2D)
+print ret
+ret=mesh.AddHypothesis(vol,hexa3D)
+print ret
+
+print "-------------------------- set algoritms"
+
+smeshgui.SetAlgorithms( idmesh, regularID)
+smeshgui.SetHypothesis( idmesh, idseg )
+smeshgui.SetAlgorithms( idmesh, quadID )
+smeshgui.SetAlgorithms( idmesh, hexaID )
+
+for i in range(8):
+    print "-------------------------- add hypothesis to edge in the Z directions", (i+1)
+
+    subMeshEdgeZ = mesh.GetElementsOnShape(edgeZ[i])
+
+    retZ = mesh.AddHypothesis(edgeZ[i],hypNbSegZ)
+    print " add hyp Z ", retZ
+
+    idsmZ = smeshgui.AddSubMeshOnShape(
+        idmesh,idEdgeZ[i],salome.orb.object_to_string(subMeshEdgeZ),
+        ShapeTypeEdge)
+
+    smeshgui.SetName(idsmZ, "SubMeshEdgeZ_"+str(i+1))
+
+    smeshgui.SetHypothesis(idsmZ, idsegZ)
+
+sg.updateObjBrowser(1)
+
+print "-------------------------- compute the mesh of the volume"
+ret=gen.Compute(mesh,idVol)
+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_demo_tetra.py b/src/SMESH_SWIG/SMESH_demo_tetra.py
new file mode 100644 (file)
index 0000000..95a5ef0
--- /dev/null
@@ -0,0 +1,176 @@
+#
+# Tetrahedrization of a geometry (box minus a inner cylinder).
+# 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
+
+# ---- define a boxe and a cylinder
+x0 = -1.
+y0 = -1.
+z0 = -1.
+
+x1 = 1.
+y1 = 1.
+z1 = 1.
+
+P0 = geom.MakePointStruct(0.,-1.,0.)
+P1 = geom.MakePointStruct(0.,1.,0.)
+Vect = geom.MakeDirection(P1)
+radius = 0.5
+height = 2.
+
+boxe = geompy.MakeBox(x0,y0,z0,x1,y1,z1)
+
+cylinder = geompy.MakeCylinder(P0,Vect,radius,height)
+
+shape = geompy.MakeBoolean(boxe,cylinder,2)
+idshape = geompy.addToStudy(shape,"shape")
+
+print ""
+
+print "Analysis of the shape :"
+subShellList=geompy.SubShapeAll(shape,ShapeTypeShell)
+subFaceList=geompy.SubShapeAll(shape,ShapeTypeFace)
+subEdgeList=geompy.SubShapeAll(shape,ShapeTypeEdge)
+
+print "number of Shells in the shape : ",len(subShellList)
+print "number of Faces in the shape : ",len(subFaceList)
+print "number of Edges in the shape : ",len(subEdgeList)
+
+# ---- launch SMESH
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+gen=smeshpy.smeshpy()
+
+# ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- NumberOfSegments"
+
+numberOfSegments = 10
+
+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 "-------------------------- 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")
+
+print "-------------------------- MaxElementVolume"
+
+maxElementVolume = 0.5
+
+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 shell
+
+mesh=gen.Init(idshape)
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
+smeshgui.SetName(idmesh, "MeshShape")
+smeshgui.SetShape(idshape, idmesh)
+
+# ---- add hypothesis to flight
+
+print "-------------------------- add hypothesis to the shape"
+
+ret=mesh.AddHypothesis(shape,regular1D)
+print ret
+ret=mesh.AddHypothesis(shape,hypNbSeg)
+print ret
+ret=mesh.AddHypothesis(shape,mefisto2D)
+print ret
+ret=mesh.AddHypothesis(shape,hypLengthFromEdge)
+print ret
+ret=mesh.AddHypothesis(shape,netgen3D)
+print ret
+ret=mesh.AddHypothesis(shape,hypVolume)
+print ret
+
+smeshgui.SetAlgorithms( idmesh, regularID)
+smeshgui.SetHypothesis( idmesh, idseg )
+smeshgui.SetAlgorithms( idmesh, mefistoID )
+smeshgui.SetHypothesis( idmesh, idlenfromedge)
+smeshgui.SetAlgorithms( idmesh, netgenID )
+smeshgui.SetHypothesis( idmesh, idvolume )
+
+sg.updateObjBrowser(1)
+
+
+print "-------------------------- compute the mesh of the shape"
+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)
diff --git a/src/SMESH_SWIG/SMESH_demo_tetra2.py b/src/SMESH_SWIG/SMESH_demo_tetra2.py
new file mode 100644 (file)
index 0000000..7aebfa5
--- /dev/null
@@ -0,0 +1,243 @@
+#
+# Tetrahedrization of a geometry (box minus a inner cylinder).
+# Hypothesis and algorithms for the mesh generation are not
+# global: the mesh of some edges is thinner.
+#
+
+import salome
+from salome import sg
+
+import geompy
+
+import SMESH
+import smeshpy
+
+# -----------------------------------------------------------------------------
+
+geom = geompy.geom
+myBuilder = geompy.myBuilder
+
+ShapeTypeShell     = 3
+ShapeTypeFace      = 4
+ShapeTypeEdge      = 6
+
+# ---- define a boxe and a cylinder
+x0 = -1.
+y0 = -1.
+z0 = -1.
+
+x1 = 1.
+y1 = 1.
+z1 = 1.
+
+P0 = geom.MakePointStruct(0.,-1.,0.)
+P1 = geom.MakePointStruct(0.,1.,0.)
+Vect = geom.MakeDirection(P1)
+radius = 0.5
+height = 2.
+
+boxe = geompy.MakeBox(x0,y0,z0,x1,y1,z1)
+
+cylinder = geompy.MakeCylinder(P0,Vect,radius,height)
+
+shape = geompy.MakeBoolean(boxe,cylinder,2)
+idshape = geompy.addToStudy(shape,"shape")
+
+print "Analysis of the shape :"
+subShellList=geompy.SubShapeAllSorted(shape,ShapeTypeShell)
+subFaceList=geompy.SubShapeAllSorted(shape,ShapeTypeFace)
+subEdgeList=geompy.SubShapeAllSorted(shape,ShapeTypeEdge)
+
+print "number of Shells in the shape : ",len(subShellList)
+print "number of Faces in the shape : ",len(subFaceList)
+print "number of Edges in the shape : ",len(subEdgeList)
+
+idSubEdge = []
+for k in range(len(subEdgeList)):
+    idSubEdge.append(geompy.addToStudyInFather(shape,subEdgeList[k],"SubEdge"+str(k)))
+
+circle1 = subEdgeList[5]
+idCircle1 = geompy.addToStudyInFather(shape,circle1,"circle1")
+
+circle2 = subEdgeList[9]
+idCircle2 = geompy.addToStudyInFather(shape,circle2,"circle2")
+
+height = subEdgeList[7]
+idHeight = geompy.addToStudyInFather(shape,height,"height")
+
+# ---- launch SMESH
+
+smeshgui = salome.ImportComponentGUI("SMESH")
+smeshgui.Init(salome.myStudyId)
+
+gen=smeshpy.smeshpy()
+
+# ---- create Hypothesis
+
+print "-------------------------- create Hypothesis"
+
+print "-------------------------- NumberOfSegments Edge of the boxe"
+
+numberOfSegmentsBoxe = 10
+
+hypothesis=gen.CreateHypothesis("NumberOfSegments")
+hypNbSegBoxe=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSegBoxe.SetNumberOfSegments(numberOfSegmentsBoxe)
+hypNbSegID = hypNbSegBoxe.GetId()
+print hypNbSegBoxe.GetName()
+print hypNbSegID
+print hypNbSegBoxe.GetNumberOfSegments()
+
+idSegBoxe = smeshgui.AddNewHypothesis(salome.orb.object_to_string(hypNbSegBoxe))
+smeshgui.SetName(idSegBoxe, "NumberOfSegmentsBoxe")
+
+print "-------------------------- NumberOfSegments Edge of the cylinder"
+
+numberOfSegmentsCylinder = 40
+
+hypothesis=gen.CreateHypothesis("NumberOfSegments")
+hypNbSegCylinder=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
+hypNbSegCylinder.SetNumberOfSegments(numberOfSegmentsCylinder)
+hypNbSegID = hypNbSegCylinder.GetId()
+print hypNbSegCylinder.GetName()
+print hypNbSegID
+print hypNbSegCylinder.GetNumberOfSegments()
+
+idSegCylinder = smeshgui.AddNewHypothesis(salome.orb.object_to_string(hypNbSegCylinder))
+smeshgui.SetName(idSegCylinder, "NumberOfSegmentsCylinder")
+
+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")
+
+print "-------------------------- MaxElementVolume"
+
+maxElementVolume = 0.5
+
+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 shell
+
+mesh=gen.Init(idshape)
+idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
+smeshgui.SetName(idmesh, "MeshShape")
+smeshgui.SetShape(idshape, idmesh)
+
+# ---- add hypothesis to flight
+
+print "-------------------------- add hypothesis to the shape"
+
+ret=mesh.AddHypothesis(shape,regular1D)
+print ret
+ret=mesh.AddHypothesis(shape,hypNbSegBoxe)
+print ret
+ret=mesh.AddHypothesis(shape,mefisto2D)
+print ret
+ret=mesh.AddHypothesis(shape,hypLengthFromEdge)
+print ret
+ret=mesh.AddHypothesis(shape,netgen3D)
+print ret
+ret=mesh.AddHypothesis(shape,hypVolume)
+print ret
+
+print "-------------------------- set algoritms"
+
+smeshgui.SetAlgorithms( idmesh, regularID)
+smeshgui.SetHypothesis( idmesh, idSegBoxe )
+smeshgui.SetAlgorithms( idmesh, mefistoID )
+smeshgui.SetHypothesis( idmesh, idlenfromedge)
+smeshgui.SetAlgorithms( idmesh, netgenID )
+smeshgui.SetHypothesis( idmesh, idvolume )
+
+print "-------------------------- add hypothesis to the first circle"
+
+subMeshEdgeCircle1 = mesh.GetElementsOnShape(circle1)
+retCircle1 = mesh.AddHypothesis(circle1,hypNbSegCylinder)
+print " add hyp to C1 ", retCircle1
+
+idsmCircle1 = smeshgui.AddSubMeshOnShape(
+    idmesh,idCircle1,salome.orb.object_to_string(subMeshEdgeCircle1),
+    ShapeTypeEdge)
+
+smeshgui.SetName(idsmCircle1, "SubMeshEdgeCircle1")
+smeshgui.SetHypothesis(idsmCircle1, idSegCylinder)
+
+print "-------------------------- add hypothesis to the second circle"
+
+subMeshEdgeCircle2 = mesh.GetElementsOnShape(circle2)
+retCircle2 = mesh.AddHypothesis(circle2,hypNbSegCylinder)
+print " add hyp to C2 ", retCircle2
+
+idsmCircle2 = smeshgui.AddSubMeshOnShape(
+    idmesh,idCircle2,salome.orb.object_to_string(subMeshEdgeCircle2),
+    ShapeTypeEdge)
+
+smeshgui.SetName(idsmCircle2, "SubMeshEdgeCircle2")
+smeshgui.SetHypothesis(idsmCircle2, idSegCylinder)
+
+print "-------------------------- add hypothesis to the height of the cylinder"
+
+subMeshEdgeHeight = mesh.GetElementsOnShape(height)
+retHeight = mesh.AddHypothesis(height,hypNbSegCylinder)
+print " add hyp to H ", retHeight
+
+idsmHeight = smeshgui.AddSubMeshOnShape(
+    idmesh,idHeight,salome.orb.object_to_string(subMeshEdgeHeight),
+    ShapeTypeEdge)
+
+smeshgui.SetName(idsmHeight, "SubMeshEdgeHeight")
+smeshgui.SetHypothesis(idsmHeight, idSegCylinder)
+
+sg.updateObjBrowser(1)
+
+print "-------------------------- compute the mesh of the shape"
+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)