]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
This commit was generated by cvs2git to create branch 'V2_2_0_maintainance'.
authoradmin <salome-admin@opencascade.com>
Mon, 21 Mar 2005 08:38:23 +0000 (08:38 +0000)
committeradmin <salome-admin@opencascade.com>
Mon, 21 Mar 2005 08:38:23 +0000 (08:38 +0000)
Cherrypick from master 2005-03-21 08:38:22 UTC jfa <jfa@opencascade.com> 'New updated and tested smesh.py with some examples. Provided by FKL.':
    src/SMESH_SWIG/ex00_all.py
    src/SMESH_SWIG/ex01_cube2build.py
    src/SMESH_SWIG/ex02_cube2primitive.py
    src/SMESH_SWIG/ex03_cube2partition.py
    src/SMESH_SWIG/ex04_cube5tetraHexa.py
    src/SMESH_SWIG/ex05_hole1build.py
    src/SMESH_SWIG/ex06_hole1boolean.py
    src/SMESH_SWIG/ex07_hole1partition.py
    src/SMESH_SWIG/ex08_hole2build.py
    src/SMESH_SWIG/ex09_grid4build.py
    src/SMESH_SWIG/ex10_grid4geometry.py
    src/SMESH_SWIG/ex11_grid3partition.py
    src/SMESH_SWIG/ex12_grid17partition.py
    src/SMESH_SWIG/ex13_hole1partial.py
    src/SMESH_SWIG/ex14_cyl1holed.py
    src/SMESH_SWIG/ex15_cyl2geometry.py
    src/SMESH_SWIG/ex16_cyl2complementary.py
    src/SMESH_SWIG/ex17_dome1.py
    src/SMESH_SWIG/ex18_dome2.py
    src/SMESH_SWIG/ex19_sphereINcube.py
    src/SMESH_SWIG/smesh.py

21 files changed:
src/SMESH_SWIG/ex00_all.py [new file with mode: 0644]
src/SMESH_SWIG/ex01_cube2build.py [new file with mode: 0644]
src/SMESH_SWIG/ex02_cube2primitive.py [new file with mode: 0644]
src/SMESH_SWIG/ex03_cube2partition.py [new file with mode: 0644]
src/SMESH_SWIG/ex04_cube5tetraHexa.py [new file with mode: 0644]
src/SMESH_SWIG/ex05_hole1build.py [new file with mode: 0644]
src/SMESH_SWIG/ex06_hole1boolean.py [new file with mode: 0644]
src/SMESH_SWIG/ex07_hole1partition.py [new file with mode: 0644]
src/SMESH_SWIG/ex08_hole2build.py [new file with mode: 0644]
src/SMESH_SWIG/ex09_grid4build.py [new file with mode: 0644]
src/SMESH_SWIG/ex10_grid4geometry.py [new file with mode: 0644]
src/SMESH_SWIG/ex11_grid3partition.py [new file with mode: 0644]
src/SMESH_SWIG/ex12_grid17partition.py [new file with mode: 0644]
src/SMESH_SWIG/ex13_hole1partial.py [new file with mode: 0644]
src/SMESH_SWIG/ex14_cyl1holed.py [new file with mode: 0644]
src/SMESH_SWIG/ex15_cyl2geometry.py [new file with mode: 0644]
src/SMESH_SWIG/ex16_cyl2complementary.py [new file with mode: 0644]
src/SMESH_SWIG/ex17_dome1.py [new file with mode: 0644]
src/SMESH_SWIG/ex18_dome2.py [new file with mode: 0644]
src/SMESH_SWIG/ex19_sphereINcube.py [new file with mode: 0644]
src/SMESH_SWIG/smesh.py [new file with mode: 0644]

diff --git a/src/SMESH_SWIG/ex00_all.py b/src/SMESH_SWIG/ex00_all.py
new file mode 100644 (file)
index 0000000..aba2b43
--- /dev/null
@@ -0,0 +1,25 @@
+# CEA/LGLS 2005, Francis KLOSS (OCC)
+# ==================================
+
+# Load all examples
+# -----------------
+
+import ex01_cube2build
+import ex02_cube2primitive
+#import ex03_cube2partition
+import ex04_cube5tetraHexa
+import ex05_hole1build
+import ex06_hole1boolean
+import ex07_hole1partition
+import ex08_hole2build
+import ex09_grid4build
+import ex10_grid4geometry
+import ex11_grid3partition
+import ex12_grid17partition
+import ex13_hole1partial
+import ex14_cyl1holed
+import ex15_cyl2geometry
+import ex16_cyl2complementary
+import ex17_dome1
+#import ex18_dome2
+import ex19_sphereINcube
diff --git a/src/SMESH_SWIG/ex01_cube2build.py b/src/SMESH_SWIG/ex01_cube2build.py
new file mode 100644 (file)
index 0000000..02b5b15
--- /dev/null
@@ -0,0 +1,293 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# A small cube centered and put on a great cube build by points, edges, faces and solids
+
+# Points
+# ------
+
+greatPoint111 = MakeVertex( 0,  0,  0)
+greatPoint211 = MakeVertex(10,  0,  0)
+greatPoint311 = MakeVertex(20,  0,  0)
+greatPoint411 = MakeVertex(30,  0,  0)
+
+greatPoint121 = MakeVertex( 0, 10,  0)
+greatPoint221 = MakeVertex(10, 10,  0)
+greatPoint321 = MakeVertex(20, 10,  0)
+greatPoint421 = MakeVertex(30, 10,  0)
+
+greatPoint112 = MakeVertex( 0,  0, 10)
+greatPoint212 = MakeVertex(10,  0, 10)
+greatPoint312 = MakeVertex(20,  0, 10)
+greatPoint412 = MakeVertex(30,  0, 10)
+
+greatPoint122 = MakeVertex( 0, 10, 10)
+greatPoint222 = MakeVertex(10, 10, 10)
+greatPoint322 = MakeVertex(20, 10, 10)
+greatPoint422 = MakeVertex(30, 10, 10)
+
+greatPoint113 = MakeVertex( 0,  0, 20)
+greatPoint213 = MakeVertex(10,  0, 20)
+greatPoint313 = MakeVertex(20,  0, 20)
+greatPoint413 = MakeVertex(30,  0, 20)
+
+greatPoint123 = MakeVertex( 0, 10, 20)
+greatPoint223 = MakeVertex(10, 10, 20)
+greatPoint323 = MakeVertex(20, 10, 20)
+greatPoint423 = MakeVertex(30, 10, 20)
+
+greatPoint114 = MakeVertex( 0,  0, 30)
+greatPoint214 = MakeVertex(10,  0, 30)
+greatPoint314 = MakeVertex(20,  0, 30)
+greatPoint414 = MakeVertex(30,  0, 30)
+
+greatPoint124 = MakeVertex( 0, 10, 30)
+greatPoint224 = MakeVertex(10, 10, 30)
+greatPoint324 = MakeVertex(20, 10, 30)
+greatPoint424 = MakeVertex(30, 10, 30)
+
+
+smallPoint111 = greatPoint222
+smallPoint211 = greatPoint322
+smallPoint121 = MakeVertex(10, 20, 10)
+smallPoint221 = MakeVertex(20, 20, 10)
+
+smallPoint112 = greatPoint223
+smallPoint212 = greatPoint323
+smallPoint122 = MakeVertex(10, 20, 20)
+smallPoint222 = MakeVertex(20, 20, 20)
+
+# Edges
+# -----
+
+smallEdgeX11 = MakeEdge(smallPoint111, smallPoint211)
+smallEdgeX21 = MakeEdge(smallPoint121, smallPoint221)
+smallEdgeX12 = MakeEdge(smallPoint112, smallPoint212)
+smallEdgeX22 = MakeEdge(smallPoint122, smallPoint222)
+
+smallEdgeY11 = MakeEdge(smallPoint111, smallPoint121)
+smallEdgeY21 = MakeEdge(smallPoint211, smallPoint221)
+smallEdgeY12 = MakeEdge(smallPoint112, smallPoint122)
+smallEdgeY22 = MakeEdge(smallPoint212, smallPoint222)
+
+smallEdgeZ11 = MakeEdge(smallPoint111, smallPoint112)
+smallEdgeZ21 = MakeEdge(smallPoint211, smallPoint212)
+smallEdgeZ12 = MakeEdge(smallPoint121, smallPoint122)
+smallEdgeZ22 = MakeEdge(smallPoint221, smallPoint222)
+
+
+greatEdgeX111 = MakeEdge(greatPoint111, greatPoint211)
+greatEdgeX211 = MakeEdge(greatPoint211, greatPoint311)
+greatEdgeX311 = MakeEdge(greatPoint311, greatPoint411)
+greatEdgeX121 = MakeEdge(greatPoint121, greatPoint221)
+greatEdgeX221 = MakeEdge(greatPoint221, greatPoint321)
+greatEdgeX321 = MakeEdge(greatPoint321, greatPoint421)
+
+greatEdgeX112 = MakeEdge(greatPoint112, greatPoint212)
+greatEdgeX212 = MakeEdge(greatPoint212, greatPoint312)
+greatEdgeX312 = MakeEdge(greatPoint312, greatPoint412)
+greatEdgeX122 = MakeEdge(greatPoint122, greatPoint222)
+greatEdgeX222 = smallEdgeX11
+greatEdgeX322 = MakeEdge(greatPoint322, greatPoint422)
+
+greatEdgeX113 = MakeEdge(greatPoint113, greatPoint213)
+greatEdgeX213 = MakeEdge(greatPoint213, greatPoint313)
+greatEdgeX313 = MakeEdge(greatPoint313, greatPoint413)
+greatEdgeX123 = MakeEdge(greatPoint123, greatPoint223)
+greatEdgeX223 = smallEdgeX12
+greatEdgeX323 = MakeEdge(greatPoint323, greatPoint423)
+
+greatEdgeX114 = MakeEdge(greatPoint114, greatPoint214)
+greatEdgeX214 = MakeEdge(greatPoint214, greatPoint314)
+greatEdgeX314 = MakeEdge(greatPoint314, greatPoint414)
+greatEdgeX124 = MakeEdge(greatPoint124, greatPoint224)
+greatEdgeX224 = MakeEdge(greatPoint224, greatPoint324)
+greatEdgeX324 = MakeEdge(greatPoint324, greatPoint424)
+
+greatEdgeY11 = MakeEdge(greatPoint111, greatPoint121)
+greatEdgeY21 = MakeEdge(greatPoint211, greatPoint221)
+greatEdgeY31 = MakeEdge(greatPoint311, greatPoint321)
+greatEdgeY41 = MakeEdge(greatPoint411, greatPoint421)
+
+greatEdgeY12 = MakeEdge(greatPoint112, greatPoint122)
+greatEdgeY22 = MakeEdge(greatPoint212, greatPoint222)
+greatEdgeY32 = MakeEdge(greatPoint312, greatPoint322)
+greatEdgeY42 = MakeEdge(greatPoint412, greatPoint422)
+
+greatEdgeY13 = MakeEdge(greatPoint113, greatPoint123)
+greatEdgeY23 = MakeEdge(greatPoint213, greatPoint223)
+greatEdgeY33 = MakeEdge(greatPoint313, greatPoint323)
+greatEdgeY43 = MakeEdge(greatPoint413, greatPoint423)
+
+greatEdgeY14 = MakeEdge(greatPoint114, greatPoint124)
+greatEdgeY24 = MakeEdge(greatPoint214, greatPoint224)
+greatEdgeY34 = MakeEdge(greatPoint314, greatPoint324)
+greatEdgeY44 = MakeEdge(greatPoint414, greatPoint424)
+
+greatEdgeZ111 = MakeEdge(greatPoint111, greatPoint112)
+greatEdgeZ211 = MakeEdge(greatPoint211, greatPoint212)
+greatEdgeZ311 = MakeEdge(greatPoint311, greatPoint312)
+greatEdgeZ411 = MakeEdge(greatPoint411, greatPoint412)
+
+greatEdgeZ121 = MakeEdge(greatPoint121, greatPoint122)
+greatEdgeZ221 = MakeEdge(greatPoint221, greatPoint222)
+greatEdgeZ321 = MakeEdge(greatPoint321, greatPoint322)
+greatEdgeZ421 = MakeEdge(greatPoint421, greatPoint422)
+
+greatEdgeZ112 = MakeEdge(greatPoint112, greatPoint113)
+greatEdgeZ212 = MakeEdge(greatPoint212, greatPoint213)
+greatEdgeZ312 = MakeEdge(greatPoint312, greatPoint313)
+greatEdgeZ412 = MakeEdge(greatPoint412, greatPoint413)
+
+greatEdgeZ122 = MakeEdge(greatPoint122, greatPoint123)
+greatEdgeZ222 = smallEdgeZ11
+greatEdgeZ322 = smallEdgeZ21
+greatEdgeZ422 = MakeEdge(greatPoint422, greatPoint423)
+
+greatEdgeZ113 = MakeEdge(greatPoint113, greatPoint114)
+greatEdgeZ213 = MakeEdge(greatPoint213, greatPoint214)
+greatEdgeZ313 = MakeEdge(greatPoint313, greatPoint314)
+greatEdgeZ413 = MakeEdge(greatPoint413, greatPoint414)
+
+greatEdgeZ123 = MakeEdge(greatPoint123, greatPoint124)
+greatEdgeZ223 = MakeEdge(greatPoint223, greatPoint224)
+greatEdgeZ323 = MakeEdge(greatPoint323, greatPoint324)
+greatEdgeZ423 = MakeEdge(greatPoint423, greatPoint424)
+
+# Faces
+# -----
+
+smallFaceX1 = MakeQuad(smallEdgeY11, smallEdgeZ11, smallEdgeY12, smallEdgeZ12)
+smallFaceX2 = MakeQuad(smallEdgeY21, smallEdgeZ21, smallEdgeY22, smallEdgeZ22)
+smallFaceY1 = MakeQuad(smallEdgeX11, smallEdgeZ11, smallEdgeX12, smallEdgeZ21)
+smallFaceY2 = MakeQuad(smallEdgeX21, smallEdgeZ12, smallEdgeX22, smallEdgeZ22)
+smallFaceZ1 = MakeQuad(smallEdgeX11, smallEdgeY11, smallEdgeX21, smallEdgeY21)
+smallFaceZ2 = MakeQuad(smallEdgeX12, smallEdgeY12, smallEdgeX22, smallEdgeY22)
+
+
+greatFaceX11 = MakeQuad(greatEdgeY11, greatEdgeZ111, greatEdgeY12, greatEdgeZ121)
+greatFaceX21 = MakeQuad(greatEdgeY21, greatEdgeZ211, greatEdgeY22, greatEdgeZ221)
+greatFaceX31 = MakeQuad(greatEdgeY31, greatEdgeZ311, greatEdgeY32, greatEdgeZ321)
+greatFaceX41 = MakeQuad(greatEdgeY41, greatEdgeZ411, greatEdgeY42, greatEdgeZ421)
+
+greatFaceX12 = MakeQuad(greatEdgeY12, greatEdgeZ112, greatEdgeY13, greatEdgeZ122)
+greatFaceX22 = MakeQuad(greatEdgeY22, greatEdgeZ212, greatEdgeY23, greatEdgeZ222)
+greatFaceX32 = MakeQuad(greatEdgeY32, greatEdgeZ312, greatEdgeY33, greatEdgeZ322)
+greatFaceX42 = MakeQuad(greatEdgeY42, greatEdgeZ412, greatEdgeY43, greatEdgeZ422)
+
+greatFaceX13 = MakeQuad(greatEdgeY13, greatEdgeZ113, greatEdgeY14, greatEdgeZ123)
+greatFaceX23 = MakeQuad(greatEdgeY23, greatEdgeZ213, greatEdgeY24, greatEdgeZ223)
+greatFaceX33 = MakeQuad(greatEdgeY33, greatEdgeZ313, greatEdgeY34, greatEdgeZ323)
+greatFaceX43 = MakeQuad(greatEdgeY43, greatEdgeZ413, greatEdgeY44, greatEdgeZ423)
+
+greatFaceY111 = MakeQuad(greatEdgeX111, greatEdgeZ111, greatEdgeX112, greatEdgeZ211)
+greatFaceY211 = MakeQuad(greatEdgeX211, greatEdgeZ211, greatEdgeX212, greatEdgeZ311)
+greatFaceY311 = MakeQuad(greatEdgeX311, greatEdgeZ311, greatEdgeX312, greatEdgeZ411)
+greatFaceY121 = MakeQuad(greatEdgeX121, greatEdgeZ121, greatEdgeX122, greatEdgeZ221)
+greatFaceY221 = MakeQuad(greatEdgeX221, greatEdgeZ221, greatEdgeX222, greatEdgeZ321)
+greatFaceY321 = MakeQuad(greatEdgeX321, greatEdgeZ321, greatEdgeX322, greatEdgeZ421)
+
+greatFaceY112 = MakeQuad(greatEdgeX112, greatEdgeZ112, greatEdgeX113, greatEdgeZ212)
+greatFaceY212 = MakeQuad(greatEdgeX212, greatEdgeZ212, greatEdgeX213, greatEdgeZ312)
+greatFaceY312 = MakeQuad(greatEdgeX312, greatEdgeZ312, greatEdgeX313, greatEdgeZ412)
+greatFaceY122 = MakeQuad(greatEdgeX122, greatEdgeZ122, greatEdgeX123, greatEdgeZ222)
+greatFaceY222 = smallFaceY1
+greatFaceY322 = MakeQuad(greatEdgeX322, greatEdgeZ322, greatEdgeX323, greatEdgeZ422)
+
+greatFaceY113 = MakeQuad(greatEdgeX113, greatEdgeZ113, greatEdgeX114, greatEdgeZ213)
+greatFaceY213 = MakeQuad(greatEdgeX213, greatEdgeZ213, greatEdgeX214, greatEdgeZ313)
+greatFaceY313 = MakeQuad(greatEdgeX313, greatEdgeZ313, greatEdgeX314, greatEdgeZ413)
+greatFaceY123 = MakeQuad(greatEdgeX123, greatEdgeZ123, greatEdgeX124, greatEdgeZ223)
+greatFaceY223 = MakeQuad(greatEdgeX223, greatEdgeZ223, greatEdgeX224, greatEdgeZ323)
+greatFaceY323 = MakeQuad(greatEdgeX323, greatEdgeZ323, greatEdgeX324, greatEdgeZ423)
+
+greatFaceZ11 = MakeQuad(greatEdgeX111, greatEdgeY11, greatEdgeX121, greatEdgeY21)
+greatFaceZ21 = MakeQuad(greatEdgeX211, greatEdgeY21, greatEdgeX221, greatEdgeY31)
+greatFaceZ31 = MakeQuad(greatEdgeX311, greatEdgeY31, greatEdgeX321, greatEdgeY41)
+
+greatFaceZ12 = MakeQuad(greatEdgeX112, greatEdgeY12, greatEdgeX122, greatEdgeY22)
+greatFaceZ22 = MakeQuad(greatEdgeX212, greatEdgeY22, greatEdgeX222, greatEdgeY32)
+greatFaceZ32 = MakeQuad(greatEdgeX312, greatEdgeY32, greatEdgeX322, greatEdgeY42)
+
+greatFaceZ13 = MakeQuad(greatEdgeX113, greatEdgeY13, greatEdgeX123, greatEdgeY23)
+greatFaceZ23 = MakeQuad(greatEdgeX213, greatEdgeY23, greatEdgeX223, greatEdgeY33)
+greatFaceZ33 = MakeQuad(greatEdgeX313, greatEdgeY33, greatEdgeX323, greatEdgeY43)
+
+greatFaceZ14 = MakeQuad(greatEdgeX114, greatEdgeY14, greatEdgeX124, greatEdgeY24)
+greatFaceZ24 = MakeQuad(greatEdgeX214, greatEdgeY24, greatEdgeX224, greatEdgeY34)
+greatFaceZ34 = MakeQuad(greatEdgeX314, greatEdgeY34, greatEdgeX324, greatEdgeY44)
+
+# Solids
+# ------
+
+smallBlock   = MakeHexa(smallFaceX1, smallFaceX2, smallFaceY1, smallFaceY2, smallFaceZ1, smallFaceZ2)
+
+greatBlock11 = MakeHexa(greatFaceX11, greatFaceX21, greatFaceY111, greatFaceY121, greatFaceZ11, greatFaceZ12)
+greatBlock21 = MakeHexa(greatFaceX21, greatFaceX31, greatFaceY211, greatFaceY221, greatFaceZ21, greatFaceZ22)
+greatBlock31 = MakeHexa(greatFaceX31, greatFaceX41, greatFaceY311, greatFaceY321, greatFaceZ31, greatFaceZ32)
+
+greatBlock12 = MakeHexa(greatFaceX12, greatFaceX22, greatFaceY112, greatFaceY122, greatFaceZ12, greatFaceZ13)
+greatBlock22 = MakeHexa(greatFaceX22, greatFaceX32, greatFaceY212, greatFaceY222, greatFaceZ22, greatFaceZ23)
+greatBlock32 = MakeHexa(greatFaceX32, greatFaceX42, greatFaceY312, greatFaceY322, greatFaceZ32, greatFaceZ33)
+
+greatBlock13 = MakeHexa(greatFaceX13, greatFaceX23, greatFaceY113, greatFaceY123, greatFaceZ13, greatFaceZ14)
+greatBlock23 = MakeHexa(greatFaceX23, greatFaceX33, greatFaceY213, greatFaceY223, greatFaceZ23, greatFaceZ24)
+greatBlock33 = MakeHexa(greatFaceX33, greatFaceX43, greatFaceY313, greatFaceY323, greatFaceZ33, greatFaceZ34)
+
+# Compound
+# --------
+
+c_l = []
+c_l.append(smallBlock)
+c_l.append(greatBlock11)
+c_l.append(greatBlock21)
+c_l.append(greatBlock31)
+c_l.append(greatBlock12)
+c_l.append(greatBlock22)
+c_l.append(greatBlock32)
+c_l.append(greatBlock13)
+c_l.append(greatBlock23)
+c_l.append(greatBlock33)
+
+piece = MakeCompound(c_l)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex01_cube2build")
+
+# Meshing
+# =======
+
+# Create hexahedrical mesh on piece
+# ---------------------------------
+
+hexa = smesh.Mesh(piece, "ex01_cube2build:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(4)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Create local hypothesis
+# -----------------------
+
+algo = hexa.Segment(greatEdgeX111)
+
+algo.Arithmetic1D(1, 4)
+
+algo.Propagation()
+
+# Compute the mesh
+# ----------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex02_cube2primitive.py b/src/SMESH_SWIG/ex02_cube2primitive.py
new file mode 100644 (file)
index 0000000..7475072
--- /dev/null
@@ -0,0 +1,95 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# A small cube centered and put on a great cube build by primitive geometric functionalities
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+arete = 10
+
+# Points
+# ------
+
+blockPoint111 = MakeVertex(ox      , oy, oz)
+blockPoint211 = MakeVertex(ox+arete, oy, oz)
+blockPoint112 = MakeVertex(ox      , oy, oz+arete)
+blockPoint212 = MakeVertex(ox+arete, oy, oz+arete)
+
+# Face and solid
+# --------------
+
+blockFace1 = MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112)
+
+blockSolid11  = MakePrismVecH(blockFace1, MakeVectorDXDYDZ(0, 1, 0), arete)
+
+# Translations
+# ------------
+
+blockSolid21  = MakeTranslation(blockSolid11, arete, 0, 0)
+blockSolid31  = MakeTranslation(blockSolid21, arete, 0, 0)
+
+blockSolid12  = MakeTranslation(blockSolid11, 0, 0, arete)
+blockSolid22  = MakeTranslation(blockSolid12, arete, 0, 0)
+blockSolid32  = MakeTranslation(blockSolid22, arete, 0, 0)
+
+blockSolid13  = MakeTranslation(blockSolid12, 0, 0, arete)
+blockSolid23  = MakeTranslation(blockSolid13, arete, 0, 0)
+blockSolid33  = MakeTranslation(blockSolid23, arete, 0, 0)
+
+blockSolid111 = MakeTranslation(blockSolid22, 0, arete, 0)
+
+# Compound and glue
+# -----------------
+
+c_l = []
+c_l.append(blockSolid11)
+c_l.append(blockSolid21)
+c_l.append(blockSolid31)
+c_l.append(blockSolid12)
+c_l.append(blockSolid22)
+c_l.append(blockSolid32)
+c_l.append(blockSolid13)
+c_l.append(blockSolid23)
+c_l.append(blockSolid33)
+c_l.append(blockSolid111)
+
+c_cpd = MakeCompound(c_l)
+
+piece = MakeGlueFaces(c_cpd, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex02_cube2primitive")
+
+# Meshing
+# =======
+
+# Create hexahedrical mesh on piece
+# ---------------------------------
+
+hexa = smesh.Mesh(piece, "ex02_cube2primitive:hexa")
+
+algo = hexa.Segment()
+algo.LocalLength(1)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Compute the mesh
+# ----------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex03_cube2partition.py b/src/SMESH_SWIG/ex03_cube2partition.py
new file mode 100644 (file)
index 0000000..cc56689
--- /dev/null
@@ -0,0 +1,82 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# A small cube centered and put on a great cube build with partition
+
+# Values
+# ------
+
+g_ox = 0
+g_oy = 0
+g_oz = 0
+
+g_arete = 10
+
+g_trim = 1000
+
+# Points
+# ------
+
+v_arete2 = g_arete*2
+v_arete3 = g_arete*3
+
+v_1 = MakeVertex(g_ox         , g_oy         , g_oz         )
+v_2 = MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3)
+
+v_3 = MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete )
+v_4 = MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2)
+
+# Solids
+# ------
+
+s_base = MakeBoxTwoPnt(v_1, v_2)
+s_haut = MakeBoxTwoPnt(v_3, v_4)
+
+# Partition
+# ---------
+
+p_dir1 = MakeVectorDXDYDZ(1, 0, 0)
+p_dir2 = MakeVectorDXDYDZ(0, 0, 1)
+p_dir3 = MakeVectorDXDYDZ(0, 1, 0)
+
+p_tools = []
+
+p_tools.append(MakePlane(v_3, p_dir1, g_trim))
+p_tools.append(MakePlane(v_4, p_dir1, g_trim))
+p_tools.append(MakePlane(v_3, p_dir2, g_trim))
+p_tools.append(MakePlane(v_4, p_dir2, g_trim))
+p_tools.append(MakePlane(v_3, p_dir3, g_trim))
+
+piece = MakePartition([s_base, s_haut], p_tools, [], [], ShapeType["SOLID"])
+
+# Study
+# -----
+
+piece_id = addToStudy(piece, "ex03_cube2partition")
+
+# Meshing
+# =======
+
+# Create hexahedrical mesh on piece
+# ---------------------------------
+
+hexa = smesh.Mesh(piece, "ex03_cube2partition:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(5)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Compute the mesh
+# ----------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex04_cube5tetraHexa.py b/src/SMESH_SWIG/ex04_cube5tetraHexa.py
new file mode 100644 (file)
index 0000000..5bb4a1c
--- /dev/null
@@ -0,0 +1,87 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# 5 box with a hexahedral mesh and with 2 box in tetrahedral mesh
+
+# Values
+# ------
+
+arete = 100
+
+arete0 = 0
+arete1 = arete
+arete2 = arete*2
+arete3 = arete*3
+
+# Solids
+# ------
+
+box_tetra1 = MakeBox(arete0, arete0, 0,  arete1, arete1, arete)
+
+box_ijk1   = MakeBox(arete1, arete0, 0,  arete2, arete1, arete)
+
+box_hexa   = MakeBox(arete1, arete1, 0,  arete2, arete2, arete)
+
+box_ijk2   = MakeBox(arete2, arete1, 0,  arete3, arete2, arete)
+
+box_tetra2 = MakeBox(arete2, arete2, 0,  arete3 ,arete3, arete)
+
+# Piece
+# -----
+
+piece_cpd = MakeCompound([box_tetra1, box_ijk1, box_hexa, box_ijk2, box_tetra2])
+
+piece = MakeGlueFaces(piece_cpd, 1e-4)
+
+piece_id = addToStudy(piece, "ex04_cube5tetraHexa")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+mixed = smesh.Mesh(piece, "ex04_cube5tetraHexa:mixed")
+
+algo = mixed.Segment()
+
+algo.StartEndLength(3, 25)
+
+mixed.Quadrangle()
+
+mixed.Hexahedron()
+
+# Tetrahedral local mesh
+# ----------------------
+
+def localMesh(b, hyp):
+    box   = GetInPlace(piece, b)
+    faces = SubShapeAll(box, ShapeType["FACE"])
+
+    i = 0
+    n = len(faces)
+    while i<n:
+        algo = mixed.Triangle(faces[i])
+        if hyp:
+            algo.MaxElementArea(80)
+        else:
+            algo.LengthFromEdges()
+        i = i + 1
+
+    algo = mixed.Tetrahedron(smesh.NETGEN, box)
+    algo.MaxElementVolume(400)
+
+localMesh(box_tetra1, 1)
+localMesh(box_tetra2, 0)
+
+# Mesh calculus
+# -------------
+
+mixed.Compute()
diff --git a/src/SMESH_SWIG/ex05_hole1build.py b/src/SMESH_SWIG/ex05_hole1build.py
new file mode 100644 (file)
index 0000000..ecaa211
--- /dev/null
@@ -0,0 +1,122 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+import math
+
+# Geometry
+# ========
+
+# A centered holed cube build by  build by points, edges, faces and solids
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+longueur = 100
+largeur  =  80
+hauteur  =  50
+
+rayon = 10
+
+# Points
+# ------
+
+basePoint111 = MakeVertex(ox         ,  oy, oz)
+basePoint211 = MakeVertex(ox+longueur,  oy, oz)
+basePoint112 = MakeVertex(ox         ,  oy, oz+largeur)
+basePoint212 = MakeVertex(ox+longueur,  oy, oz+largeur)
+
+cx = ox+longueur/2
+cy = oy
+cz = oz+largeur/2
+
+ll = longueur/largeur
+ll = ll*ll
+dx = rayon/math.sqrt(1+ll)
+dz = rayon/math.sqrt(1+1/ll)
+
+circlePoint1 = MakeVertex(cx-dx, cy, cz-dz)
+circlePoint2 = MakeVertex(cx+dx, cy, cz-dz)
+circlePoint3 = MakeVertex(cx+dx, cy, cz+dz)
+circlePoint4 = MakeVertex(cx-dx, cy, cz+dz)
+
+# Edges
+# -----
+
+squareEdge1 = MakeEdge(basePoint111, basePoint211)
+squareEdge2 = MakeEdge(basePoint211, basePoint212)
+squareEdge3 = MakeEdge(basePoint212, basePoint112)
+squareEdge4 = MakeEdge(basePoint112, basePoint111)
+
+diagEdge1   = MakeEdge(basePoint111, circlePoint1)
+diagEdge2   = MakeEdge(basePoint211, circlePoint2)
+diagEdge3   = MakeEdge(basePoint212, circlePoint3)
+diagEdge4   = MakeEdge(basePoint112, circlePoint4)
+
+arcEdge1    = MakeArc(circlePoint1, MakeVertex(cx      , cy, cz-rayon), circlePoint2)
+arcEdge2    = MakeArc(circlePoint2, MakeVertex(cx+rayon, cy, cz      ), circlePoint3)
+arcEdge3    = MakeArc(circlePoint3, MakeVertex(cx      , cy, cz+rayon), circlePoint4)
+arcEdge4    = MakeArc(circlePoint4, MakeVertex(cx-rayon, cy, cz      ), circlePoint1)
+
+# Faces
+# -----
+
+baseFace1 = MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1)
+baseFace2 = MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2)
+baseFace3 = MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3)
+baseFace4 = MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4)
+
+# Solids
+# ------
+
+baseVector = MakeVectorDXDYDZ(0, 1, 0)
+
+baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur)
+baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur)
+baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur)
+baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur)
+
+# Compound
+# --------
+
+c_l = []
+c_l.append(baseSolid1)
+c_l.append(baseSolid2)
+c_l.append(baseSolid3)
+c_l.append(baseSolid4)
+
+c_cpd = MakeCompound(c_l)
+piece = MakeGlueFaces(c_cpd, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex05_hole1build")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex05_hole1build:hexa")
+
+algo = hexa.Segment()
+
+algo.NumberOfSegments(6, 3)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex06_hole1boolean.py b/src/SMESH_SWIG/ex06_hole1boolean.py
new file mode 100644 (file)
index 0000000..5e461e4
--- /dev/null
@@ -0,0 +1,139 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# A not centered holed cube build by boolean geometric operations
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+longueur1 = 30
+longueur2 = 70
+
+largeur1  = 30
+largeur2  = 50
+
+hauteur   = 50
+
+rayon = 10
+
+# Triangular face
+# ---------------
+
+def triangle(p1, p2, p3):
+    l = []
+    l.append(MakeEdge(p1, p2))
+    l.append(MakeEdge(p2, p3))
+    l.append(MakeEdge(p3, p1))
+    w = MakeWire(l)
+    return MakeFace(w, 1)
+
+# Points
+# ------
+
+basePoint111 = MakeVertex(ox-longueur1,  oy, oz-largeur1)
+basePoint211 = MakeVertex(ox+longueur2,  oy, oz-largeur1)
+basePoint112 = MakeVertex(ox-longueur1,  oy, oz+largeur2)
+basePoint212 = MakeVertex(ox+longueur2,  oy, oz+largeur2)
+
+holePoint    = MakeVertex(ox, oy, oz)
+
+# Faces
+# -----
+
+baseFace1 = triangle(basePoint111, basePoint211, holePoint)
+baseFace2 = triangle(basePoint211, basePoint212, holePoint)
+baseFace3 = triangle(basePoint212, basePoint112, holePoint)
+baseFace4 = triangle(basePoint112, basePoint111, holePoint)
+
+# Solids
+# ------
+
+baseVector = MakeVectorDXDYDZ(0, 1, 0)
+
+baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur)
+baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur)
+baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur)
+baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur)
+
+holeSolid = MakeCylinder(holePoint, baseVector, rayon, hauteur)
+
+# Boolean operations
+# ------------------
+
+baseHexa1 = MakeCut(baseSolid1, holeSolid)
+baseHexa2 = MakeCut(baseSolid2, holeSolid)
+baseHexa3 = MakeCut(baseSolid3, holeSolid)
+baseHexa4 = MakeCut(baseSolid4, holeSolid)
+
+# Compound, glue and repair
+# -------------------------
+
+c_l = []
+c_l.append(baseHexa1)
+c_l.append(baseHexa2)
+c_l.append(baseHexa3)
+c_l.append(baseHexa4)
+
+c_cpd = MakeCompound(c_l)
+c_glu = MakeGlueFaces(c_cpd, 1.e-5)
+piece = RemoveExtraEdges(c_glu)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex06_hole1boolean")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex06_hole1boolean:hexa")
+
+algo = hexa.Segment()
+
+algo.NumberOfSegments(11)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Create local hypothesis
+# -----------------------
+
+edge1 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz-largeur1))
+algo1 = hexa.Segment(edge1)
+algo1.NumberOfSegments(3)
+algo1.Propagation()
+
+edge2 = GetEdgeNearPoint(piece, MakeVertex(ox-longueur1, oy, oz))
+algo2 = hexa.Segment(edge2)
+algo2.NumberOfSegments(5)
+algo2.Propagation()
+
+edge3 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz+largeur2))
+algo3 = hexa.Segment(edge3)
+algo3.NumberOfSegments(7)
+algo3.Propagation()
+
+edge4 = GetEdgeNearPoint(piece, MakeVertex(ox+longueur2, oy, oz))
+algo4 = hexa.Segment(edge4)
+algo4.NumberOfSegments(9)
+algo4.Propagation()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex07_hole1partition.py b/src/SMESH_SWIG/ex07_hole1partition.py
new file mode 100644 (file)
index 0000000..592e5f8
--- /dev/null
@@ -0,0 +1,79 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# A holed cube build by partitioning geometric operations
+
+# Values
+# ------
+
+g_x = 0
+g_y = 0
+g_z = 0
+
+g_longueur = 50.0
+g_largeur  = 40.0
+g_hauteur  = 25.0
+
+g_rayon = 10
+
+g_trim = 1000
+
+# Box
+# ---
+
+b_boite = MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur,  g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur)
+
+# Cylinder
+# --------
+
+c_axe = MakeVectorDXDYDZ(0, 1, 0)
+
+c_cyl = MakeCylinder(MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2)
+
+c_piece = MakeCut(b_boite, c_cyl)
+
+# Partition and reperation
+# ------------------------
+
+p_centre = MakeVertex(g_x, g_y, g_z)
+
+p_tools = []
+p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim))
+p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim))
+
+p_part = MakePartition([c_piece], p_tools, [], [], ShapeType["SOLID"])
+
+p_blocs = RemoveExtraEdges(p_part)
+piece   = MakeGlueFaces(p_blocs, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex07_hole1partition")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex07_hole1partition:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(20)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex08_hole2build.py b/src/SMESH_SWIG/ex08_hole2build.py
new file mode 100644 (file)
index 0000000..ab23cb7
--- /dev/null
@@ -0,0 +1,112 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# A twice holed cube build by points, edges, faces and solids
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+longueur = 200
+largeur  = 100
+hauteur  =  80
+
+cylindre = 50
+
+rayon = 20
+
+# Points
+# ------
+
+piecePoint1 = MakeVertex(ox         , oy, oz)
+piecePoint2 = MakeVertex(ox+longueur, oy, oz)
+piecePoint3 = MakeVertex(ox+longueur, oy, oz+largeur)
+piecePoint4 = MakeVertex(ox         , oy, oz+largeur)
+
+cz = oz+largeur/2
+
+cylPoint1    = MakeVertex(ox+cylindre         , oy, cz-rayon)
+cylPoint2    = MakeVertex(ox+longueur-cylindre, oy, cz-rayon)
+cylPoint3    = MakeVertex(ox+longueur-cylindre, oy, cz+rayon)
+cylPoint4    = MakeVertex(ox+cylindre         , oy, cz+rayon)
+
+# Edges
+# -----
+
+pieceEdge1 = MakeEdge(piecePoint1, piecePoint4)
+pieceEdge2 = MakeEdge(piecePoint1, cylPoint1)
+pieceEdge3 = MakeEdge(piecePoint4, cylPoint4)
+
+pieceEdge4 = MakeEdge(piecePoint2, piecePoint3)
+pieceEdge5 = MakeEdge(piecePoint2, cylPoint2)
+pieceEdge6 = MakeEdge(piecePoint3, cylPoint3)
+
+pieceEdge7 = MakeEdge(cylPoint1, cylPoint2)
+pieceEdge8 = MakeEdge(cylPoint3, cylPoint4)
+
+cylEdge1 = MakeArc(cylPoint1, MakeVertex(ox+cylindre-rayon         , oy, cz), cylPoint4)
+cylEdge2 = MakeArc(cylPoint1, MakeVertex(ox+cylindre+rayon         , oy, cz), cylPoint4)
+cylEdge3 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3)
+cylEdge4 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3)
+
+# Faces
+# -----
+
+pieceFace1 = MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 )
+pieceFace2 = MakeQuad         (pieceEdge1 , pieceEdge2 , cylEdge1  , pieceEdge3)
+pieceFace3 = MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 )
+pieceFace4 = MakeQuad         (pieceEdge4 , pieceEdge5 , cylEdge4  , pieceEdge6)
+pieceFace5 = MakeQuad         (pieceEdge7 , cylEdge3   , pieceEdge8, cylEdge2  )
+
+# Solids
+# ------
+
+pieceVector = MakeVectorDXDYDZ(0, 1, 0)
+
+pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur)
+pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur)
+pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur)
+pieceSolid4 = MakePrismVecH(pieceFace4, pieceVector, hauteur)
+pieceSolid5 = MakePrismVecH(pieceFace5, pieceVector, hauteur)
+
+# Compound and glue
+# -----------------
+
+c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3, pieceSolid4, pieceSolid5])
+
+piece = MakeGlueFaces(c_cpd, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex08_hole2build")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex08_hole2build:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(7)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex09_grid4build.py b/src/SMESH_SWIG/ex09_grid4build.py
new file mode 100644 (file)
index 0000000..681a31f
--- /dev/null
@@ -0,0 +1,115 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+import math
+
+# Geometry
+# ========
+
+# Element of a grid compound by a square with a cylinder on each vertex build by points, edges, faces and solids
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+arete   =  50
+hauteur = 100
+
+rayon = 10
+
+demi = rayon/2
+r3   = demi*math.sqrt(3)
+
+# Points
+# ------
+
+piecePoint111 = MakeVertex(ox+rayon      , oy, oz)
+piecePoint211 = MakeVertex(ox+arete-rayon, oy, oz)
+piecePoint112 = MakeVertex(ox            , oy, oz+rayon)
+piecePoint212 = MakeVertex(ox+arete      , oy, oz+rayon)
+piecePoint113 = MakeVertex(ox            , oy, oz+arete-rayon)
+piecePoint213 = MakeVertex(ox+arete      , oy, oz+arete-rayon)
+piecePoint114 = MakeVertex(ox+rayon      , oy, oz+arete)
+piecePoint214 = MakeVertex(ox+arete-rayon, oy, oz+arete)
+
+pieceCenter1  = MakeVertex(ox            , oy, oz)
+pieceCenter2  = MakeVertex(ox+arete      , oy, oz)
+pieceCenter3  = MakeVertex(ox            , oy, oz+arete)
+pieceCenter4  = MakeVertex(ox+arete      , oy, oz+arete)
+
+piecePass1    = MakeVertex(ox+demi       , oy, oz+r3)
+piecePass2    = MakeVertex(ox+arete-demi , oy, oz+r3)
+piecePass3    = MakeVertex(ox+arete-demi , oy, oz+arete-r3)
+piecePass4    = MakeVertex(ox+demi       , oy, oz+arete-r3)
+
+# Edges
+# -----
+
+pieceEdgeSquare1   = MakeEdge(piecePoint111, piecePoint211)
+pieceEdgeSquare2   = MakeEdge(piecePoint114, piecePoint214)
+pieceEdgeSquare3   = MakeEdge(piecePoint112, piecePoint113)
+pieceEdgeSquare4   = MakeEdge(piecePoint212, piecePoint213)
+
+pieceEdgeDiagonal1 = MakeEdge(piecePoint111, piecePoint213)
+pieceEdgeDiagonal2 = MakeEdge(piecePoint112, piecePoint214)
+
+pieceEdgeArc1 = MakeArc(piecePoint111, piecePass1, piecePoint112)
+pieceEdgeArc2 = MakeArc(piecePoint211, piecePass2, piecePoint212)
+pieceEdgeArc3 = MakeArc(piecePoint213, piecePass3, piecePoint214)
+pieceEdgeArc4 = MakeArc(piecePoint113, piecePass4, piecePoint114)
+
+# Faces
+# -----
+
+pieceFace1 = MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1)
+pieceFace2 = MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2)
+
+pieceFace3 = MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2)
+
+# Solids
+# ------
+
+pieceVector = MakeVectorDXDYDZ(0, 1, 0)
+
+pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur)
+pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur)
+pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur)
+
+# Compound and glue
+# -----------------
+
+c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3])
+
+piece = MakeGlueFaces(c_cpd, 1.e-5)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex09_grid4build")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex09_grid4build:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(6)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex10_grid4geometry.py b/src/SMESH_SWIG/ex10_grid4geometry.py
new file mode 100644 (file)
index 0000000..bcd5637
--- /dev/null
@@ -0,0 +1,77 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# Element of a grid compound by a square with a cylinder on each vertex build by using partition
+
+# Values
+# ------
+
+ox = 0
+oy = 0
+oz = 0
+
+arete   =  50
+hauteur = 100
+rayon   =  10
+
+g_trim = 1000
+
+# Box
+# ---
+
+piecePoint = MakeVertex(ox, oy, oz)
+
+pieceBox = MakeBoxTwoPnt(piecePoint, MakeVertex(ox+arete, oy+hauteur, oz+arete))
+
+# Cut by cylinders
+# ----------------
+
+dirUp = MakeVectorDXDYDZ(0, 1, 0)
+
+pieceCut1 = MakeCut(pieceBox , MakeCylinder(piecePoint                        , dirUp, rayon, hauteur))
+pieceCut2 = MakeCut(pieceCut1, MakeCylinder(MakeVertex(ox+arete, oy, oz      ), dirUp, rayon, hauteur))
+pieceCut3 = MakeCut(pieceCut2, MakeCylinder(MakeVertex(ox      , oy, oz+arete), dirUp, rayon, hauteur))
+pieceCut4 = MakeCut(pieceCut3, MakeCylinder(MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur))
+
+# Compound by make a partition of a solid
+# ---------------------------------------
+
+dir = MakeVectorDXDYDZ(-1, 0, 1)
+
+tools = []
+tools.append(MakePlane(MakeVertex(ox+rayon, oy, oz      ), dir, g_trim))
+tools.append(MakePlane(MakeVertex(ox      , oy, oz+rayon), dir, g_trim))
+
+piece = MakePartition([pieceCut4], tools, [], [], ShapeType["SOLID"])
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex10_grid4geometry")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex10_grid4geometry:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(10)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex11_grid3partition.py b/src/SMESH_SWIG/ex11_grid3partition.py
new file mode 100644 (file)
index 0000000..4327775
--- /dev/null
@@ -0,0 +1,98 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# grid compound of 3 x 3 elements
+# an element is compound of 3 cylinders concentriques
+# an element is centered in a square of the grid
+# the smaller cylinder is a hole
+
+# prism the grid, and mesh it in hexahedral way
+
+# Values
+# ------
+
+g_x = 0
+g_y = 0
+g_z = 0
+
+g_arete   = 50
+g_hauteur = 30
+
+g_rayon1 = 20
+g_rayon2 = 30
+g_rayon3 = 40
+
+g_grid = 3
+
+g_trim = 1000
+
+# Element
+# -------
+
+e_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete,  g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
+
+e_hauteur = 2*g_hauteur
+e_centre  = MakeVertex(g_x, g_y-g_hauteur, g_z)
+e_dir     = MakeVectorDXDYDZ(0, 1, 0)
+
+e_cyl1 = MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur)
+
+e_blo1 = MakeCut(e_boite, e_cyl1)
+
+e_cyl2 = MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur)
+
+e_blo2 = MakeCut(e_cyl1, e_cyl2)
+
+e_cyl3 = MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur)
+
+e_blo3 = MakeCut(e_cyl2, e_cyl3)
+
+# Partition and repair
+# --------------------
+
+p_tools = []
+p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim))
+p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim))
+
+p_part = MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], ShapeType["SOLID"])
+
+p_element = RemoveExtraEdges(p_part)
+
+# Grid and glue
+# -------------
+
+grid = MakeMultiTranslation2D(p_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
+
+piece = MakeGlueFaces(grid, 1e-5)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex11_grid3partition")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex11_grid3partition:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(3)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex12_grid17partition.py b/src/SMESH_SWIG/ex12_grid17partition.py
new file mode 100644 (file)
index 0000000..f83de14
--- /dev/null
@@ -0,0 +1,113 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# grid compound of 17 x 17 elements
+# an element is compound of 3 concentric cylinders
+# an element is centered in a square of the grid
+
+# prism the grid, and mesh it in hexahedral way
+
+# Values
+# ------
+
+g_x = 0
+g_y = 0
+g_z = 0
+
+g_arete   = 50
+g_hauteur = 30
+
+g_rayon1 = 20
+g_rayon2 = 30
+g_rayon3 = 40
+
+g_grid = 17
+
+g_trim = 1000
+
+# Solids and rotation to prevent repair
+# -------------------------------------
+
+s_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete,  g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
+
+s_pi4     = 3.141592653/4
+s_hauteur = 2*g_hauteur
+s_centre  = MakeVertex(g_x, g_y-g_hauteur, g_z)
+s_dir     = MakeVectorDXDYDZ(0, 1, 0)
+
+s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon3, s_hauteur)
+s_cyl1 = MakeRotation(s_cyl0, s_dir, s_pi4)
+
+s_blo1 = MakeCut(s_boite, s_cyl1)
+
+s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon2, s_hauteur)
+s_cyl2 = MakeRotation(s_cyl0, s_dir, s_pi4)
+
+s_blo2 = MakeCut(s_cyl1, s_cyl2)
+
+s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon1, s_hauteur)
+s_cyl3 = MakeRotation(s_cyl0, s_dir, s_pi4)
+
+s_blo3 = MakeCut(s_cyl2, s_cyl3)
+
+s_arete = g_rayon1/2
+
+s_blo4 = MakeBox(g_x-s_arete, g_y-g_hauteur, g_z-s_arete,  g_x+s_arete, g_y+g_hauteur, g_z+s_arete)
+
+s_blo5 = MakeCut(s_cyl3, s_blo4)
+
+# Partition
+# ---------
+
+p_tools = []
+p_tools.append(MakePlane(s_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim))
+p_tools.append(MakePlane(s_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim))
+
+p_partie = MakePartition([s_blo1, s_blo2, s_blo3, s_blo5], p_tools, [], [], ShapeType["SOLID"])
+
+# Compound and glue
+# -----------------
+
+c_blocs = SubShapeAll(p_partie, ShapeType["SOLID"])
+c_blocs.append(s_blo4)
+
+c_cpd = MakeCompound(c_blocs)
+
+c_element = MakeGlueFaces(c_cpd, 1e-4)
+
+# Grid
+# ----
+
+piece = MakeMultiTranslation2D(c_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
+
+# Add in study
+# ------------
+
+piece_id = addToStudy(piece, "ex12_grid17partition")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex12_grid17partition:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(2)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex13_hole1partial.py b/src/SMESH_SWIG/ex13_hole1partial.py
new file mode 100644 (file)
index 0000000..c97ccb8
--- /dev/null
@@ -0,0 +1,231 @@
+# CEA/LGLS 2005, Francis KLOSS (OCC)
+# ==================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# With hexahedral, build a box partially holed by a not centered cylinder with a thickness
+
+# Values
+# ------
+
+box_dx = 1000
+box_dy =  900
+box_dz =  800
+
+cyl_x      = 500
+cyl_y      = 300
+cyl_dz     = 600
+cyl_radius = 150
+cyl_thick  =  30
+
+# Triangular face
+# ---------------
+
+def triangle(p1, p2, p3):
+    l = []
+    l.append(MakeEdge(p1, p2))
+    l.append(MakeEdge(p2, p3))
+    l.append(MakeEdge(p3, p1))
+    w = MakeWire(l)
+    return MakeFace(w, 1)
+
+# The holed part
+# ==============
+
+# Vertex of the holed part
+# ------------------------
+
+hole_point_11 = MakeVertex(0     , 0     , 0)
+hole_point_21 = MakeVertex(box_dx, 0     , 0)
+hole_point_12 = MakeVertex(0     , box_dy, 0)
+hole_point_22 = MakeVertex(box_dx, box_dy, 0)
+
+hole_center   = MakeVertex(cyl_x, cyl_y, 0)
+
+# Faces of the holed part
+# -----------------------
+
+hole_face_1 = triangle(hole_point_11, hole_point_21, hole_center)
+hole_face_2 = triangle(hole_point_21, hole_point_22, hole_center)
+hole_face_3 = triangle(hole_point_12, hole_point_22, hole_center)
+hole_face_4 = triangle(hole_point_11, hole_point_12, hole_center)
+
+# Solids of the holed part
+# ------------------------
+
+cyl_dir = MakeVectorDXDYDZ(0, 0, 1)
+
+hole_solid_1 = MakePrismVecH(hole_face_1, cyl_dir, cyl_dz)
+hole_solid_2 = MakePrismVecH(hole_face_2, cyl_dir, cyl_dz)
+hole_solid_3 = MakePrismVecH(hole_face_3, cyl_dir, cyl_dz)
+hole_solid_4 = MakePrismVecH(hole_face_4, cyl_dir, cyl_dz)
+
+hole_internal = MakeCylinder(hole_center, cyl_dir, cyl_radius          , cyl_dz)
+hole_external = MakeCylinder(hole_center, cyl_dir, cyl_radius+cyl_thick, cyl_dz)
+hole_median   = MakeCut(hole_external, hole_internal)
+
+# Boolean operations
+# ------------------
+
+blocks = []
+
+blocks.append(   MakeCut(hole_solid_1, hole_external))
+blocks.append(MakeCommon(hole_solid_1, hole_median  ))
+
+blocks.append(   MakeCut(hole_solid_2, hole_external))
+blocks.append(MakeCommon(hole_solid_2, hole_median  ))
+
+blocks.append(   MakeCut(hole_solid_3, hole_external))
+blocks.append(MakeCommon(hole_solid_3, hole_median  ))
+
+blocks.append(   MakeCut(hole_solid_4, hole_external))
+blocks.append(MakeCommon(hole_solid_4, hole_median  ))
+
+# The full part
+# =============
+
+# Vertex of the full part
+# -----------------------
+
+full_point_11 = MakeVertex(0     , 0     , cyl_dz)
+full_point_21 = MakeVertex(box_dx, 0     , cyl_dz)
+full_point_12 = MakeVertex(0     , box_dy, cyl_dz)
+full_point_22 = MakeVertex(box_dx, box_dy, cyl_dz)
+
+full_center = MakeVertex(cyl_x, cyl_y, cyl_dz)
+
+# Faces of the full part
+# ----------------------
+
+full_face_1 = triangle(full_point_11, full_point_21, full_center)
+full_face_2 = triangle(full_point_21, full_point_22, full_center)
+full_face_3 = triangle(full_point_12, full_point_22, full_center)
+full_face_4 = triangle(full_point_11, full_point_12, full_center)
+
+# Solids of the full part
+# ------------------------
+
+full_dz = box_dz - cyl_dz
+
+full_solid_1 = MakePrismVecH(full_face_1, cyl_dir, full_dz)
+full_solid_2 = MakePrismVecH(full_face_2, cyl_dir, full_dz)
+full_solid_3 = MakePrismVecH(full_face_3, cyl_dir, full_dz)
+full_solid_4 = MakePrismVecH(full_face_4, cyl_dir, full_dz)
+
+full_internal = MakeCylinder(full_center, cyl_dir, cyl_radius          , full_dz)
+full_external = MakeCylinder(full_center, cyl_dir, cyl_radius+cyl_thick, full_dz)
+full_median   = MakeCut(full_external, full_internal)
+
+# Boolean operations
+# ------------------
+
+full = []
+
+full.append(   MakeCut(full_solid_1, full_external))
+full.append(MakeCommon(full_solid_1, full_median))
+
+full.append(   MakeCut(full_solid_2, full_external))
+full.append(MakeCommon(full_solid_2, full_median ))
+
+full.append(   MakeCut(full_solid_3, full_external))
+full.append(MakeCommon(full_solid_3, full_median))
+
+full.append(   MakeCut(full_solid_4, full_external))
+full.append(MakeCommon(full_solid_4, full_median))
+
+# Filling the hole
+# ----------------
+
+box_d = cyl_radius/3
+
+x = cyl_x-box_d
+y = x * cyl_y / cyl_x
+box_point_11 = MakeVertex(x, y, cyl_dz)
+
+x = cyl_x+box_d
+y = (box_dx - x) * cyl_y / (box_dx - cyl_x)
+box_point_12 = MakeVertex(x, y, cyl_dz)
+
+x = cyl_x-box_d
+y = box_dy - x * (box_dy - cyl_y) / cyl_x
+box_point_21 = MakeVertex(x, y, cyl_dz)
+
+x = cyl_x+box_d
+y = box_dy - (box_dx - x) * (box_dy - cyl_y) / (box_dx - cyl_x)
+box_point_22 = MakeVertex(x, y, cyl_dz)
+
+box_face = MakeQuad4Vertices(box_point_11, box_point_12, box_point_21, box_point_22)
+
+box = MakePrismVecH(box_face, cyl_dir, full_dz)
+
+full.append(box)
+
+full.append(MakeCut(MakeCommon(full_solid_1, full_internal), box))
+full.append(MakeCut(MakeCommon(full_solid_2, full_internal), box))
+full.append(MakeCut(MakeCommon(full_solid_3, full_internal), box))
+full.append(MakeCut(MakeCommon(full_solid_4, full_internal), box))
+
+# Cut the cylinder thikness
+# -------------------------
+
+full_plan = MakePlane(MakeVertex(0, 0, cyl_dz+cyl_thick), cyl_dir, 5000)
+
+full_parts = MakePartition(full, [full_plan], [], [], ShapeType["SOLID"])
+
+# Geometry result
+# ---------------
+
+blocks.append(full_parts)
+
+piece_cpd = MakeCompound(blocks)
+
+piece_ok = RemoveExtraEdges(piece_cpd)
+
+piece = MakeGlueFaces(piece_ok, 1.e-3)
+
+piece_id = addToStudy(piece, "ex13_hole1partial")
+
+# Meshing
+# =======
+
+# Create a mesh
+# -------------
+
+hexa = smesh.Mesh(piece, "ex13_hole1partial:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(2)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Local hypothesis
+# ----------------
+
+def local(x, y, z, d):
+    edge = GetEdgeNearPoint(piece, MakeVertex(x, y, z))
+    algo = hexa.Segment(edge)
+    algo.NumberOfSegments(d)
+    algo.Propagation()
+
+local(0, 0, 100, 40)
+local(0, 0, 700, 15)
+
+local(100, 0, 0, 20)
+local(0, 100, 0, 20)
+
+local(100, 100, 0, 25)
+
+d = cyl_radius-3*cyl_thick
+local(cyl_x+d, cyl_y+d, box_dz, 10)
+
+# Compute the mesh
+# ----------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex14_cyl1holed.py b/src/SMESH_SWIG/ex14_cyl1holed.py
new file mode 100644 (file)
index 0000000..6a2127a
--- /dev/null
@@ -0,0 +1,116 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometrie
+# =========
+
+# Creer un cylindre avec un trou cylindrique excentre, decoupage en hexahedre et mailler.
+
+# Donnees
+# -------
+
+# unite: millimetre
+
+g_ox = 0
+g_oy = 0
+g_oz = 0
+
+g_cyl_rayon       = 1000
+g_cyl_demiHauteur = 3000
+
+g_trou_rayon       =   5
+g_trou_centre      = 300
+
+g_trim = 15000
+
+# Construire le cylindre
+# ----------------------
+
+c_point    = MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur)
+c_dir      = MakeVectorDXDYDZ(0, 0, 1)
+c_hauteur  = 2*g_cyl_demiHauteur
+c_cylindre = MakeCylinder(c_point, c_dir, g_cyl_rayon, c_hauteur)
+
+# Trouer le cylindre par un minuscule cylindre excentre
+# -----------------------------------------------------
+
+t_hauteur = g_cyl_demiHauteur
+t_point   = MakeVertex(g_ox-g_trou_centre, g_oy, g_oz-t_hauteur)
+t_trou    = MakeCylinder(t_point, c_dir, g_trou_rayon, 2*t_hauteur)
+
+t_piece   = MakeCut(c_cylindre, t_trou)
+
+# Geometrie hexahedrique
+# ======================
+
+# Decouper
+# --------
+
+h_outils = []
+h_outils.append(MakePlane(t_point, MakeVectorDXDYDZ(1, 0, 0), g_trim))
+h_outils.append(MakePlane(t_point, MakeVectorDXDYDZ(0, 1, 0), g_trim))
+
+h_piece = MakePartition([t_piece], h_outils, [], [], ShapeType["SOLID"])
+
+# Decouper pour les conditions locales
+# ------------------------------------
+
+l_outils = []
+l_i = 1
+l_n = 12
+l_hauteur = c_hauteur/l_n
+
+while l_i<l_n:
+    l_outils.append(MakePlane(MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur+l_i*l_hauteur), c_dir, g_trim))
+    l_i = l_i+1
+
+piece = MakePartition([h_piece], l_outils, [], [], ShapeType["SOLID"])
+
+# Ajouter la piece dans l'etude
+# -----------------------------
+
+piece_id = addToStudy(piece, "ex14_cyl1holed")
+
+# Maillage
+# ========
+
+# Creer un maillage hexahedrique
+# ------------------------------
+
+hexa = smesh.Mesh(piece, "ex14_cyl1holed:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(4)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Poser les hypotheses locales
+# ----------------------------
+
+m_i = 0
+m_n = 12
+m_h = c_hauteur/m_n
+m_d = [4, 6, 8, 10, 10, 9, 8, 7, 6, 5, 4, 3]
+
+m_x = g_ox+g_cyl_rayon
+m_y = g_oy
+m_z = g_oz-g_cyl_demiHauteur+m_h/2
+
+while m_i<m_n:
+    m_p = MakeVertex(m_x, m_y, m_z + m_i*m_h)
+    m_e = GetEdgeNearPoint(piece, m_p)
+    m_a = hexa.Segment(m_e)
+    m_a.NumberOfSegments(m_d[m_i])
+    m_a.Propagation()
+    m_i = m_i + 1
+
+# Calculer le maillage
+# --------------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex15_cyl2geometry.py b/src/SMESH_SWIG/ex15_cyl2geometry.py
new file mode 100644 (file)
index 0000000..c7de688
--- /dev/null
@@ -0,0 +1,175 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometrie
+# =========
+
+# Construire avec des hexahedres une piece faite de 2 cylindres de diametre different
+# et dont les axes se coupent orthogonalement, puis mailler.
+
+# Valeurs
+# -------
+
+cx = 0
+cy = 0
+cz = 0
+
+g_rayon   = 100.0
+g_hauteur = 500
+
+p_rayon   =  50.0
+p_hauteur = 500
+
+g_trim = 1000
+
+# Gros cylindre
+# -------------
+
+cpd = []
+
+g_base = MakeVertex(cx, cy, cz)
+g_dir  = MakeVectorDXDYDZ(0, 0, 1)
+t_hauteur = p_rayon+10.0
+
+g_cyl = MakeCylinder(g_base, g_dir, g_rayon, g_hauteur)
+
+g_coupe   = MakeVectorDXDYDZ(1, 0, 0)
+
+g_tools = []
+g_tools.append(MakePlane(MakeVertex(cx+t_hauteur, cy, cz), g_coupe, g_trim))
+g_tools.append(MakePlane(MakeVertex(cx-t_hauteur, cy, cz), g_coupe, g_trim))
+
+g_partie = MakePartition([g_cyl], g_tools, [], [], ShapeType["SOLID"])
+g_bas, g_centre, g_haut = SubShapeAllSorted(g_partie, ShapeType["SOLID"])
+
+# Partie basse du gros cylindre
+# -----------------------------
+
+b_hauteur = 10
+b_base    = 20
+
+b_boite = MakeBox(cx-t_hauteur, cy-b_base, cz,  cx-t_hauteur-b_hauteur, cy+b_base, cz+g_hauteur)
+cpd.append(b_boite)
+
+b_cyl = MakeCut(g_bas, b_boite)
+
+b_tools = []
+b_tools.append(MakePlane(MakeVertex(cx-t_hauteur-b_hauteur, cy+b_base, cz), MakeVectorDXDYDZ( 1, 1, 0), g_trim))
+b_tools.append(MakePlane(MakeVertex(cx-t_hauteur-b_hauteur, cy-b_base, cz), MakeVectorDXDYDZ(-1, 1, 0), g_trim))
+
+b_partie = MakePartition([b_cyl], b_tools, [], [], ShapeType["SOLID"])
+b_element = SubShapeAll(b_partie, ShapeType["SOLID"])
+cpd = cpd + b_element
+
+# Partie haute du gros cylindre
+# -----------------------------
+
+h_plan = MakePlane(g_base, g_coupe, g_trim)
+
+cpd.append(MakeMirrorByPlane(b_boite, h_plan))
+
+for h in b_element:
+    h_symetrie = MakeMirrorByPlane(h, h_plan)
+    cpd.append(h_symetrie)
+
+# Petit cylindre
+# --------------
+
+z_arete = p_rayon/2
+x_arete = z_arete*t_hauteur*2/g_hauteur
+
+px = cx-x_arete
+py = cy-1.5*g_rayon
+pz = cz+g_hauteur/2
+
+p_base = MakeVertex(cx, py, pz)
+p_dir  = MakeVectorDXDYDZ(0, 1, 0)
+p_cyl  = MakeCylinder(p_base, p_dir, p_rayon, p_hauteur)
+
+p_boite = MakeBox(px, py, pz-z_arete,  cx+x_arete, py+p_hauteur, pz+z_arete)
+
+# Partie interieure du petit cylindre
+# -----------------------------------
+
+i_cyl   = MakeCommon(p_cyl, g_cyl)
+i_tuyau = MakeCut(i_cyl, p_boite)
+i_boite = MakeCommon(p_boite, g_cyl)
+
+# Partie exterieure du petit cylindre
+# -----------------------------------
+
+e_cyl0 = MakeCut(p_cyl, g_cyl)
+e_cyl  = SubShapeAllSorted(e_cyl0, ShapeType["SOLID"])
+
+e_tuyau = MakeCut(e_cyl[1], p_boite)
+
+e_boite0 = MakeCut(p_boite, g_cyl)
+e_boite  = SubShapeAllSorted(e_boite0, ShapeType["SOLID"])
+
+cpd.append(e_boite[1])
+
+# Partie centrale du gros cylindre
+# --------------------------------
+
+c_cyl = MakeCut(g_centre, p_cyl)
+
+# Partitionner
+# ------------
+
+p_tools = []
+p_tools.append(MakePlane(MakeVertex(px, py, pz-z_arete), MakeVectorDXDYDZ(-z_arete, 0, x_arete), g_trim))
+p_tools.append(MakePlane(MakeVertex(px, py, pz+z_arete), MakeVectorDXDYDZ( z_arete, 0, x_arete), g_trim))
+
+p_partie = MakePartition([e_tuyau], p_tools, [], [], ShapeType["SOLID"])
+p_element = SubShapeAll(p_partie, ShapeType["SOLID"])
+cpd = cpd + p_element
+
+q_partie = MakePartition([i_tuyau, c_cyl], p_tools, [], [], ShapeType["SOLID"])
+q_element = SubShapeAll(q_partie, ShapeType["SOLID"])
+
+q_element = q_element + [i_boite]
+
+q_tools = []
+q_tools.append(MakePlane(MakeVertex(cx, cy-b_base, cz), MakeVectorDXDYDZ(0, 1, 0), g_trim))
+q_tools.append(MakePlane(MakeVertex(cx, cy+b_base, cz), MakeVectorDXDYDZ(0, 1, 0), g_trim))
+
+r_element = []
+for e in q_element:
+    r_partie = MakePartition([e], q_tools, [], [], ShapeType["SOLID"])
+    r_element = r_element + SubShapeAll(r_partie, ShapeType["SOLID"])
+
+cpd = cpd + r_element
+
+# Compound
+# --------
+
+piece = RemoveExtraEdges(MakeCompound(cpd))
+
+# Ajouter la piece dans l'etude
+# -----------------------------
+
+piece_id = addToStudy(piece, "ex15_cyl2geometry")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex15_cyl2geometry:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(12)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex16_cyl2complementary.py b/src/SMESH_SWIG/ex16_cyl2complementary.py
new file mode 100644 (file)
index 0000000..e38aba2
--- /dev/null
@@ -0,0 +1,118 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometry
+# ========
+
+# Create the hexahedrical block geometry of a holed parallelepipede.
+# The hole has a T form composed by 2 cylinders with different radius, and their axis are normal.
+# This piece is meshed in hexahedrical.
+
+# Values
+# ------
+
+gx = 0
+gy = 0
+gz = 0
+
+g_dx = 250
+g_dy = 200
+g_dz = 150
+
+g_rayonGrand = 70
+g_rayonPetit = 50
+
+g_trim = 1000
+
+# The parallelepipede
+# -------------------
+
+p_boite = MakeBox(gx-g_dx, gy-g_dy, gz-g_dz,  gx+g_dx, gy+g_dy, gz+g_dz)
+
+# The great cylinder
+# ------------------
+
+g_base = MakeVertex(gx-g_dx, gy, gz)
+g_dir  = MakeVectorDXDYDZ(1, 0, 0)
+g_cyl  = MakeCylinder(g_base, g_dir, g_rayonGrand, g_dx*2)
+
+# The first hole
+# --------------
+
+b_boite = MakeCut(p_boite , g_cyl)
+
+# Partitioning
+# ------------
+
+p_base = MakeVertex(gx, gy, gz)
+
+p_tools = []
+
+p_tools.append(MakePlane(p_base, MakeVectorDXDYDZ(0,  1   , 0   ), g_trim))
+p_tools.append(MakePlane(p_base, MakeVectorDXDYDZ(0,  g_dz, g_dy), g_trim))
+p_tools.append(MakePlane(p_base, MakeVectorDXDYDZ(0, -g_dz, g_dy), g_trim))
+
+p_tools.append(MakePlane(MakeVertex(gx-g_rayonPetit, gy, gz), g_dir, g_trim))
+p_tools.append(MakePlane(MakeVertex(gx+g_rayonPetit, gy, gz), g_dir, g_trim))
+
+p_piece = MakePartition([b_boite], p_tools, [], [], ShapeType["SOLID"])
+
+# The small cylinder
+# ------------------
+
+c_cyl = MakeCylinder(p_base, MakeVectorDXDYDZ(0, 0, 1), g_rayonPetit, g_dz)
+
+# The second hole
+# ---------------
+
+d_element = SubShapeAllSorted(p_piece, ShapeType["SOLID"])
+
+d_element[ 8] = MakeCut(d_element[ 8], c_cyl)
+d_element[10] = MakeCut(d_element[10], c_cyl)
+
+# Compound
+# --------
+
+piece = RemoveExtraEdges(MakeCompound(d_element))
+
+# Add piece in study
+# ------------------
+
+piece_id = addToStudy(piece, "ex16_cyl2complementary")
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex16_cyl2complementary:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(12)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Define local hypothesis
+# -----------------------
+
+def local(x, y, z, d):
+    edge = GetEdgeNearPoint(piece, MakeVertex(x, y, z))
+    algo = hexa.Segment(edge)
+    algo.NumberOfSegments(d)
+    algo.Propagation()
+
+local(gx     , gy+g_dy, gz+g_dz, 7)
+local(gx+g_dx, gy+g_dy, gz     , 21)
+local(gx+g_dx, gy-g_dy, gz     , 21)
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex17_dome1.py b/src/SMESH_SWIG/ex17_dome1.py
new file mode 100644 (file)
index 0000000..5064a93
--- /dev/null
@@ -0,0 +1,78 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+# Geometrie
+# =========
+
+# Creer un cylindre surplombe d'une demi-sphere le tout troue par un petit cylindre.
+# Decouper en hexahedre et mailler.
+
+# Donnees
+# -------
+
+cylindre_rayon   = 100
+cylindre_hauteur = 400
+
+trou_rayon = 20
+trou_z     = cylindre_rayon/2
+
+plan_trim = 2000
+
+# Cylindre
+# --------
+
+cylindre_base = MakeVertex(0, 0, 0)
+cylindre_dir  = MakeVectorDXDYDZ(1, 0, 0)
+cylindre      = MakeCylinder(cylindre_base, cylindre_dir, cylindre_rayon, cylindre_hauteur)
+
+# Dome
+# ----
+
+dome_sphere = MakeSpherePntR(cylindre_base, cylindre_rayon)
+dome        = MakeFuse(dome_sphere, cylindre)
+
+# Cheminee
+# --------
+
+cheminee_base = MakeVertex(-cylindre_hauteur/2, 0, trou_z)
+cheminee_trou = MakeCylinder(cheminee_base, cylindre_dir, trou_rayon, 2*cylindre_hauteur)
+cheminee      = MakeCut(dome, cheminee_trou)
+
+# Decoupage et reparation
+# -----------------------
+
+blocs_plan1 = MakePlane(cheminee_base, MakeVectorDXDYDZ(0, 1, 0), plan_trim)
+blocs_plan2 = MakePlane(cheminee_base, MakeVectorDXDYDZ(0, 0, 1), plan_trim)
+
+blocs_part = MakePartition([cheminee], [blocs_plan1, blocs_plan2], [], [], ShapeType["SOLID"])
+
+piece = RemoveExtraEdges(blocs_part)
+
+# Etude
+# -----
+
+piece_id = addToStudy(piece, "ex17_dome1")
+
+# Maillage
+# ========
+
+# Maillage hexahedrique
+# ---------------------
+
+hexa = smesh.Mesh(piece, "ex17_dome1:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(20)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Calcul du maillage
+# ------------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex18_dome2.py b/src/SMESH_SWIG/ex18_dome2.py
new file mode 100644 (file)
index 0000000..96d8738
--- /dev/null
@@ -0,0 +1,115 @@
+# CEA/LGLS 2004-2005, Francis KLOSS (OCC)
+# =======================================
+
+from geompy import *
+
+import smesh
+
+import math
+
+# Geometrie
+# =========
+
+# Creer un cylindre ayant a chaque bout un morceau de sphere et le tout troue par un petit cylindrique excentre.
+# Decouper en hexahedre et mailler.
+
+# Donnees
+# -------
+
+# unite: millimetre
+
+g_ox = 0
+g_oy = 0
+g_oz = 0
+
+g_cyl_rayon       = 1000
+g_cyl_demiHauteur = 3000
+
+g_trou_rayon       =   5
+g_trou_centre      = 300
+
+g_sphere_rayon = 3500
+
+g_trim = 15000
+
+# Cylindre
+# --------
+
+c_point    = MakeVertex(g_ox, g_oy, g_oz-g_cyl_demiHauteur)
+c_dir      = MakeVectorDXDYDZ(0, 0, 1)
+c_hauteur  = 2*g_cyl_demiHauteur
+
+c_cylindre = MakeCylinder(c_point, c_dir, g_cyl_rayon, c_hauteur)
+
+# Sphere
+# ------
+
+s_hauteur = math.sqrt(g_sphere_rayon*g_sphere_rayon - g_cyl_rayon*g_cyl_rayon) - g_cyl_demiHauteur
+
+s_sphere  = MakeSphere(g_ox, g_oy, g_oz-s_hauteur, g_sphere_rayon)
+
+# Calottes
+# --------
+
+c_outils = []
+c_outils.append(MakePlane(MakeVertex(g_ox, g_oy, g_oz+g_cyl_demiHauteur), MakeVectorDXDYDZ(0, 0, 1), g_trim))
+
+c_cpd = MakePartition([s_sphere], c_outils, [], [], ShapeType["SOLID"])
+c_calotte_haut, c_reste = SubShapeAllSorted(c_cpd, ShapeType["SOLID"])
+
+c_plan = MakePlane(MakeVertex(g_ox, g_oy, g_oz), MakeVectorDXDYDZ(0, 0, 1), g_trim)
+c_calotte_bas = MakeMirrorByPlane(c_calotte_haut, c_plan)
+
+# Fusionner
+# ---------
+
+f_piece1 = MakeFuse(c_cylindre, c_calotte_haut)
+f_piece  = MakeFuse(f_piece1, c_calotte_bas)
+
+# Trouer
+# ------
+
+t_hauteur = g_sphere_rayon
+t_point   = MakeVertex(g_ox-g_trou_centre, g_oy, g_oz-t_hauteur)
+t_trou    = MakeCylinder(t_point, c_dir, g_trou_rayon, 2*t_hauteur)
+
+t_piece   = MakeCut(f_piece, t_trou)
+
+# Decouper
+# --------
+
+h_outils = []
+h_outils.append(MakePlane(t_point, MakeVectorDXDYDZ(1, 0, 0), g_trim))
+h_outils.append(MakePlane(t_point, MakeVectorDXDYDZ(0, 1, 0), g_trim))
+
+h_piece = MakePartition([t_piece], h_outils, [], [], ShapeType["SOLID"])
+
+# Reparer
+# -------
+
+piece = RemoveExtraEdges(h_piece)
+
+# Ajouter la piece dans l'etude
+# -----------------------------
+
+piece_id = addToStudy(piece, "ex18_dome2")
+
+# Maillage
+# ========
+
+# Maillage hexahedrique
+# ---------------------
+
+hexa = smesh.Mesh(piece, "ex18_dome2:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(2)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Calcul du maillage
+# ------------------
+
+hexa.Compute()
diff --git a/src/SMESH_SWIG/ex19_sphereINcube.py b/src/SMESH_SWIG/ex19_sphereINcube.py
new file mode 100644 (file)
index 0000000..295a95f
--- /dev/null
@@ -0,0 +1,138 @@
+# CEA/LGLS 2005, Francis KLOSS (OCC)
+# ==================================
+
+from geompy import *
+
+import smesh
+
+# Geometrie
+# =========
+
+# Mailler en hexahedre une sphere dans un cube.
+
+# Donnees
+# -------
+
+sphere_rayon = 100
+
+cube_cote = 200
+
+plan_trim = 1000
+
+# Sphere
+# ------
+
+sphere_centre = MakeVertex(0, 0, 0)
+
+sphere_pleine = MakeSpherePntR(sphere_centre, sphere_rayon)
+
+# Cube interieur
+# --------------
+
+boite_cote = sphere_rayon / 2
+
+boite = MakeBox(-boite_cote, -boite_cote, -boite_cote,  +boite_cote, +boite_cote, +boite_cote)
+
+blocs = [boite]
+
+# Decoupage sphere
+# ----------------
+
+sphere_troue = MakeCut(sphere_pleine, boite)
+
+sphere_outils = []
+sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 0,  1), plan_trim))
+sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 0, -1), plan_trim))
+sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ( 1, 1,  0), plan_trim))
+sphere_outils.append(MakePlane(sphere_centre, MakeVectorDXDYDZ(-1, 1,  0), plan_trim))
+
+sphere_decoupee = MakePartition([sphere_troue], sphere_outils, [], [], ShapeType["SOLID"])
+
+sphere_partie   = GetBlockNearPoint(sphere_decoupee, MakeVertex(-sphere_rayon, 0, 0))
+sphere_bloc     = RemoveExtraEdges(sphere_partie)
+
+blocs.append(sphere_bloc)
+
+pi2 = 3.141592653/2
+
+sphere_dir1 = MakeVectorDXDYDZ(0, 1,  0)
+sphere_dir2 = MakeVectorDXDYDZ(0, 0,  1)
+
+blocs.append(MakeRotation(sphere_bloc, sphere_dir1, +pi2))
+blocs.append(MakeRotation(sphere_bloc, sphere_dir1, -pi2))
+
+blocs.append(MakeRotation(sphere_bloc, sphere_dir2, +pi2))
+blocs.append(MakeRotation(sphere_bloc, sphere_dir2, -pi2))
+
+blocs.append(MakeMirrorByPoint(sphere_bloc, sphere_centre))
+
+# Cube exterieur
+# --------------
+
+cube_plein   = MakeBox(-cube_cote, -cube_cote, -cube_cote,  +cube_cote, +cube_cote, +cube_cote)
+cube_trou    = MakeCut(cube_plein, sphere_pleine)
+cube_decoupe = MakePartition([cube_trou], sphere_outils, [], [], ShapeType["SOLID"])
+cube_partie  = GetBlockNearPoint(cube_decoupe, MakeVertex(-cube_cote, 0, 0))
+cube_bloc    = RemoveExtraEdges(cube_partie)
+
+blocs.append(cube_bloc)
+
+blocs.append(MakeRotation(cube_bloc, sphere_dir1, +pi2))
+blocs.append(MakeRotation(cube_bloc, sphere_dir1, -pi2))
+
+blocs.append(MakeRotation(cube_bloc, sphere_dir2, +pi2))
+blocs.append(MakeRotation(cube_bloc, sphere_dir2, -pi2))
+
+blocs.append(MakeMirrorByPoint(cube_bloc, sphere_centre))
+
+# Piece
+# -----
+
+piece_cpd = MakeCompound(blocs)
+piece = MakeGlueFaces(piece_cpd, 1.e-3)
+
+piece_id = addToStudy(piece, "ex19_sphereINcube")
+
+# Groupe geometrique
+# ==================
+
+# Definition du groupe
+# --------------------
+
+groupe = CreateGroup(piece, ShapeType["SOLID"])
+
+groupe_nom = "ex19_sphereINcube_interieur"
+addToStudy(groupe, groupe_nom)
+groupe.SetName(groupe_nom)
+
+# Contenu du groupe
+# -----------------
+
+groupe_sphere = GetShapesOnSphere(piece, ShapeType["SOLID"], sphere_centre, sphere_rayon, GEOM.ST_ONIN)
+
+UnionList(groupe, groupe_sphere)
+
+# Meshing
+# =======
+
+# Create a hexahedral mesh
+# ------------------------
+
+hexa = smesh.Mesh(piece, "ex19_sphereINcube:hexa")
+
+algo = hexa.Segment()
+algo.NumberOfSegments(10)
+
+hexa.Quadrangle()
+
+hexa.Hexahedron()
+
+# Mesh calculus
+# -------------
+
+hexa.Compute()
+
+# Le groupe de mailles
+# --------------------
+
+hexa_groupe = hexa.Group(groupe)
diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py
new file mode 100644 (file)
index 0000000..36f3454
--- /dev/null
@@ -0,0 +1,462 @@
+#  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#  File   : smesh.py
+#  Author : Francis KLOSS, OCC
+#  Module : SMESH
+
+"""
+ \namespace smesh
+ \brief Module smesh
+"""
+
+import salome
+import geompy
+import StdMeshers
+import SMESH
+
+# Public variables
+# ----------------
+
+REGULAR = 1
+PYTHON  = 2
+
+NETGEN  = 3
+GHS3D   = 4
+
+smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+smesh.SetCurrentStudy(salome.myStudy)
+
+# Private functions
+# -----------------
+
+def GetName(obj):
+    ior  = salome.orb.object_to_string(obj)
+    sobj = salome.myStudy.FindObjectIOR(ior)
+    attr = sobj.FindAttribute("AttributeName")[1]
+    return attr.Value()
+
+def SetName(obj, name):
+    ior  = salome.orb.object_to_string(obj)
+    sobj = salome.myStudy.FindObjectIOR(ior)
+    attr = sobj.FindAttribute("AttributeName")[1]
+    attr.SetValue(name)
+
+# Algorithms and hypothesis
+# =========================
+
+# Private class: Mesh_Algorithm
+# -----------------------------
+
+class Mesh_Algorithm:
+    """
+    Mother class to define algorithm, recommended to don't use directly
+    """
+
+    mesh = 0
+    geom = 0
+    subm = 0
+
+    def GetSubMesh(self):
+        """
+         If the algorithm is global, return 0
+         else return the submesh associated to this algorithm
+        """
+        return self.subm
+
+    def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
+        """
+         Private method
+        """
+        self.mesh = mesh
+        piece = mesh.geom
+        if geom==0:
+            self.geom = piece
+            name = GetName(piece)
+        else:
+            self.geom = geom
+            name = geompy.SubShapeName(geom, piece)
+            geompy.addToStudyInFather(piece, geom, name)
+            self.subm = mesh.mesh.GetSubMesh(geom, hypo)
+
+        algo = smesh.CreateHypothesis(hypo, so)
+        SetName(algo, name + "/" + hypo)
+        mesh.mesh.AddHypothesis(self.geom, algo)
+
+    def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"):
+        """
+         Private method
+        """
+        hypo = smesh.CreateHypothesis(hyp, so)
+        a = ""
+        s = "="
+        i = 0
+        n = len(args)
+        while i<n:
+            a = a + s + str(args[i])
+            s = ","
+            i = i + 1
+        SetName(hypo, GetName(self.geom) + "/" + hyp + a)
+        self.mesh.mesh.AddHypothesis(self.geom, hypo)
+        return hypo
+
+# Public class: Mesh_Segment
+# --------------------------
+
+class Mesh_Segment(Mesh_Algorithm):
+    """
+    Class to define a segment 1D algorithm for discretization
+    """
+
+    def __init__(self, mesh, geom=0):
+        """
+         Private constructor
+        """
+        self.Create(mesh, geom, "Regular_1D")
+
+    def LocalLength(self, l):
+        """
+         Define "LocalLength" hypothesis to cut an edge in several segments with the same length
+         \param l for the length of segments that cut an edge
+        """
+        hyp = self.Hypothesis("LocalLength", [l])
+        hyp.SetLength(l)
+        return hyp
+
+    def NumberOfSegments(self, n, s=[]):
+        """
+         Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
+         \param n for the number of segments that cut an edge
+         \param s for the scale factor (optional)
+        """
+        if s == []:
+            hyp = self.Hypothesis("NumberOfSegments", [n])
+        else:
+            hyp = self.Hypothesis("NumberOfSegments", [n,s])
+            hyp.SetScaleFactor(s)
+        hyp.SetNumberOfSegments(n)
+        return hyp
+
+    def Arithmetic1D(self, start, end):
+        """
+         Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
+         \param start for the length of the first segment
+         \param end   for the length of the last  segment
+        """
+        hyp = self.Hypothesis("Arithmetic1D", [start, end])
+        hyp.SetLength(start, 1)
+        hyp.SetLength(end  , 0)
+        return hyp
+
+    def StartEndLength(self, start, end):
+        """
+         Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
+         \param start for the length of the first segment
+         \param end   for the length of the last  segment
+        """
+        hyp = self.Hypothesis("StartEndLength", [start, end])
+        hyp.SetLength(start, 1)
+        hyp.SetLength(end  , 0)
+        return hyp
+
+    def Deflection1D(self, d):
+        """
+         Define "Deflection1D" hypothesis
+         \param d for the deflection
+        """
+        hyp = self.Hypothesis("Deflection1D", [d])
+        hyp.SetDeflection(d)
+        return hyp
+
+    def Propagation(self):
+        """
+         Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
+         the opposite side in the case of quadrangular faces
+        """
+        return self.Hypothesis("Propagation")
+
+# Public class: Mesh_Segment_Python
+# ---------------------------------
+
+class Mesh_Segment_Python(Mesh_Segment):
+    """
+    Class to define a segment 1D algorithm for discretization with python function
+    """
+
+    def __init__(self, mesh, geom=0):
+        """
+         Private constructor
+        """
+        import Python1dPlugin
+        self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
+
+    def PythonSplit1D(self, n, func):
+        """
+         Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
+         \param n for the number of segments that cut an edge
+         \param func for the python function that calculate the length of all segments
+        """
+        hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so")
+        hyp.SetNumberOfSegments(n)
+        hyp.SetPythonLog10RatioFunction(func)
+        return hyp
+
+# Public class: Mesh_Triangle
+# ---------------------------
+
+class Mesh_Triangle(Mesh_Algorithm):
+    """
+    Class to define a triangle 2D algorithm
+    """
+
+    def __init__(self, mesh, geom=0):
+        """
+         Private constructor
+        """
+        self.Create(mesh, geom, "MEFISTO_2D")
+
+    def MaxElementArea(self, area):
+        """
+         Define "MaxElementArea" hypothesis to give the maximun area of each triangles
+         \param area for the maximum area of each triangles
+        """
+        hyp = self.Hypothesis("MaxElementArea", [area])
+        hyp.SetMaxElementArea(area)
+        return hyp
+
+    def LengthFromEdges(self):
+        """
+         Define "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
+        """
+        return self.Hypothesis("LengthFromEdges")
+
+# Public class: Mesh_Quadrangle
+# -----------------------------
+
+class Mesh_Quadrangle(Mesh_Algorithm):
+    """
+    Class to define a quadrangle 2D algorithm
+    """
+
+    def __init__(self, mesh, geom=0):
+        """
+         Private constructor
+        """
+        self.Create(mesh, geom, "Quadrangle_2D")
+
+# Public class: Mesh_Tetrahedron
+# ------------------------------
+
+class Mesh_Tetrahedron(Mesh_Algorithm):
+    """
+    Class to define a tetrahedron 3D algorithm
+    """
+
+    def __init__(self, mesh, algo, geom=0):
+        """
+         Private constructor
+        """
+        if algo == NETGEN:
+            self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
+        elif algo == GHS3D:
+            import GHS3DPlugin
+            self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
+
+    def MaxElementVolume(self, vol):
+        """
+         Define "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedral
+         \param vol for the maximum volume of each tetrahedral
+        """
+        hyp = self.Hypothesis("MaxElementVolume", [vol])
+        hyp.SetMaxElementVolume(vol)
+        return hyp
+
+# Public class: Mesh_Hexahedron
+# ------------------------------
+
+class Mesh_Hexahedron(Mesh_Algorithm):
+    """
+    Class to define a hexahedron 3D algorithm
+    """
+
+    def __init__(self, mesh, geom=0):
+        """
+         Private constructor
+        """
+        self.Create(mesh, geom, "Hexa_3D")
+
+# Public class: Mesh
+# ==================
+
+class Mesh:
+    """
+    Class to define a mesh
+    """
+
+    geom = 0
+    mesh = 0
+
+    def __init__(self, geom, name=0):
+        """
+         Constructor
+
+         Creates mesh on the shape \a geom,
+         sets GUI name of this mesh to \a name.
+         \param geom Shape to be meshed
+         \param name Study name of the mesh
+        """
+        self.geom = geom
+        self.mesh = smesh.CreateMesh(geom)
+        if name == 0:
+            SetName(self.mesh, GetName(geom))
+        else:
+            SetName(self.mesh, name)
+
+    def GetMesh(self):
+        """
+         Method that returns the mesh
+        """
+        return self.mesh
+
+    def GetShape(self):
+        """
+         Method that returns the shape associated to the mesh
+        """
+        return self.geom
+
+    def Segment(self, algo=REGULAR, geom=0):
+        """
+         Creates a segment discretization 1D algorithm.
+         If the optional \a algo parameter is not sets, this algorithm is REGULAR.
+         If the optional \a geom parameter is not sets, this algorithm is global.
+         Otherwise, this algorithm define a submesh based on \a geom subshape.
+         \param algo values are smesh.REGULAR or smesh.PYTHON for discretization via python function
+         \param geom If defined, subshape to be meshed
+        """
+        if algo == REGULAR:
+            return Mesh_Segment(self, geom)
+        elif algo == PYTHON:
+            return Mesh_Segment_Python(self, geom)
+        else:
+            return Mesh_Segment(self, algo)
+
+    def Triangle(self, geom=0):
+        """
+         Creates a triangle 2D algorithm for faces.
+         If the optional \a geom parameter is not sets, this algorithm is global.
+         Otherwise, this algorithm define a submesh based on \a geom subshape.
+         \param geom If defined, subshape to be meshed
+        """
+        return Mesh_Triangle(self, geom)
+
+    def Quadrangle(self, geom=0):
+        """
+         Creates a quadrangle 2D algorithm for faces.
+         If the optional \a geom parameter is not sets, this algorithm is global.
+         Otherwise, this algorithm define a submesh based on \a geom subshape.
+         \param geom If defined, subshape to be meshed
+        """
+        return Mesh_Quadrangle(self, geom)
+
+    def Tetrahedron(self, algo, geom=0):
+        """
+         Creates a tetrahedron 3D algorithm for solids.
+         The parameter \a algo permits to choice the algorithm: NETGEN or GHS3D
+         If the optional \a geom parameter is not sets, this algorithm is global.
+         Otherwise, this algorithm define a submesh based on \a geom subshape.
+         \param algo values are: smesh.NETGEN, smesh.GHS3D
+         \param geom If defined, subshape to be meshed
+        """
+        return Mesh_Tetrahedron(self, algo, geom)
+
+    def Hexahedron(self, geom=0):
+        """
+         Creates a hexahedron 3D algorithm for solids.
+         If the optional \a geom parameter is not sets, this algorithm is global.
+         Otherwise, this algorithm define a submesh based on \a geom subshape.
+         \param geom If defined, subshape to be meshed
+        """
+        return Mesh_Hexahedron(self, geom)
+
+    def Compute(self):
+        """
+         Compute the mesh and return the status of the computation
+        """
+        b = smesh.Compute(self.mesh, self.geom)
+        if salome.sg.hasDesktop():
+            salome.sg.updateObjBrowser(1)
+        return b
+
+    def Group(self, grp, name=""):
+        """
+         Create a mesh group based on geometric object \a grp
+         and give a \a name, if this parameter is not defined
+         the name is the same as the geometric group name
+         \param grp  is a geometric group
+         \param name is the name of the mesh group
+        """
+        if name == "":
+            name = grp.GetName()
+        tgeo = geompy.GetType(grp)
+        if tgeo == geompy.ShapeType["VERTEX"]:
+            type = SMESH.NODE
+        elif tgeo == geompy.ShapeType["EDGE"]:
+            type = SMESH.EDGE
+        elif tgeo == geompy.ShapeType["FACE"]:
+            type = SMESH.FACE
+        elif tgeo == geompy.ShapeType["SOLID"]:
+            type = SMESH.VOLUME
+        return self.mesh.CreateGroupFromGEOM(type, name, grp)
+
+    def ExportToMED(self, f, version, opt=0):
+        """
+         Export the mesh in a file with the MED format and choice the \a version of MED format
+         \param f is the file name
+         \param version values are smesh.MED_V2_1, smesh.MED_V2_2
+        """
+        self.mesh.ExportToMED(f, opt, version)
+
+    def ExportMED(self, f, opt=0):
+        """
+         Export the mesh in a file with the MED format
+         \param f is the file name
+        """
+        self.mesh.ExportMED(f, opt)
+
+    def ExportDAT(self, f):
+        """
+         Export the mesh in a file with the DAT format
+         \param f is the file name
+        """
+        self.mesh.ExportDAT(f)
+
+    def ExportUNV(self, f):
+        """
+         Export the mesh in a file with the UNV format
+         \param f is the file name
+        """
+        self.mesh.ExportUNV(f)
+
+    def ExportSTL(self, f, ascii=1):
+        """
+         Export the mesh in a file with the STL format
+         \param f is the file name
+         \param ascii defined the kind of file contents
+        """
+        self.mesh.ExportSTL(f, ascii)