X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=doc%2Fsalome%2Fgui%2FSMESH%2Finput%2Ftui_modifying_meshes.doc;h=8eee4e048699bc9827af342f78838fc78f7b4cfd;hb=e533bcb1d7b568a1e63e952a9a3c7ecf9e11bcb1;hp=66b6361fa0b724214ad4fc2481bc234471388625;hpb=2daa321efae3d0c6ce41199fa5a2482630d505d9;p=modules%2Fsmesh.git
diff --git a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc
index 66b6361fa..8eee4e048 100644
--- a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc
+++ b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc
@@ -22,6 +22,26 @@ if new_id == 0: print "KO node addition."
else: print "New Node has been added with ID ", new_id
\endcode
+
+\anchor tui_add_0DElement
+
Add 0D Element
+
+\code
+import SMESH_mechanic
+
+mesh = SMESH_mechanic.mesh
+
+# add node
+node_id = mesh.AddNode(50, 10, 0)
+
+# add 0D Element
+new_id = mesh.Add0DElement(node_id)
+
+print ""
+if new_id == 0: print "KO node addition."
+else: print "New 0D Element has been added with ID ", new_id
+\endcode
+
\anchor tui_add_edge
Add Edge
@@ -279,19 +299,6 @@ mesh.RenumberElements()
\anchor tui_moving_nodes
Moving Nodes
-\code
-import SMESH_mechanic
-
-mesh = SMESH_mechanic.mesh
-
-# move node #38
-mesh.MoveNode(38, 20., 10., 0.)
-\endcode
-
-
-\anchor tui_mesh_through_point
-Mesh through point
-
\code
from geompy import *
from smesh import *
@@ -324,16 +331,11 @@ n = mesh.FindNodeClosestTo( -1,-1,-1 )
if not n == node000:
raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 )
-# check if any node will be found for a point inside a box
-n = mesh.FindNodeClosestTo( 100, 100, 100 )
-if not n > 0:
- raise "FindNodeClosestTo( 100, 100, 100 ) fails"
-
# move node000 to a new location
x,y,z = -10, -10, -10
-n = mesh.MeshToPassThroughAPoint( x,y,z )
-if not n == node000:
- raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 )
+n = mesh.MoveNode( n,x,y,z )
+if not n:
+ raise "MoveNode() returns " + n
# check the coordinates of the node000
xyz = mesh.GetNodeXYZ( node000 )
@@ -768,7 +770,6 @@ mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5)
\code
import geompy
-
import smesh
# define the geometry
@@ -802,17 +803,100 @@ algo2D.MaxElementArea(240)
isDone = Mesh_2.Compute()
if not isDone: print 'Mesh Mesh_2 : computation failed'
-# create a pattern
+# create a 2d pattern
pattern = smesh.GetPattern()
isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), Face_2, 0)
if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode()
# apply the pattern to a face of the first mesh
-pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), [17], 0, 0)
-
+facesToSplit = Mesh_1.GetElementsByType(smesh.SMESH.FACE)
+print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit))
+pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0)
isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0)
if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode()
+
+# create quadrangle mesh
+Mesh_3 = smesh.Mesh(Box_1)
+Mesh_3.Segment().NumberOfSegments(1)
+Mesh_3.Quadrangle()
+Mesh_3.Hexahedron()
+isDone = Mesh_3.Compute()
+if not isDone: print 'Mesh Mesh_3 : computation failed'
+
+# create a 3d pattern (hexahedrons)
+pattern_hexa = smesh.GetPattern()
+
+smp_hexa = """!!! Nb of points:
+15
+ 0 0 0 !- 0
+ 1 0 0 !- 1
+ 0 1 0 !- 2
+ 1 1 0 !- 3
+ 0 0 1 !- 4
+ 1 0 1 !- 5
+ 0 1 1 !- 6
+ 1 1 1 !- 7
+ 0.5 0 0.5 !- 8
+ 0.5 0 1 !- 9
+ 0.5 0.5 0.5 !- 10
+ 0.5 0.5 1 !- 11
+ 1 0 0.5 !- 12
+ 1 0.5 0.5 !- 13
+ 1 0.5 1 !- 14
+ !!! Indices of points of 4 elements:
+ 8 12 5 9 10 13 14 11
+ 0 8 9 4 2 10 11 6
+ 2 10 11 6 3 13 14 7
+ 0 1 12 8 2 3 13 10"""
+
+pattern_hexa.LoadFromFile(smp_hexa)
+
+# apply the pattern to a mesh
+volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME)
+print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit))
+pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3)
+isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True)
+if (isDone != 1): print 'MakeMesh :', pattern_hexa.GetErrorCode()
+
+# create one more quadrangle mesh
+Mesh_4 = smesh.Mesh(Box_1)
+Mesh_4.Segment().NumberOfSegments(1)
+Mesh_4.Quadrangle()
+Mesh_4.Hexahedron()
+isDone = Mesh_4.Compute()
+if not isDone: print 'Mesh Mesh_4 : computation failed'
+
+# create another 3d pattern (pyramids)
+pattern_pyra = smesh.GetPattern()
+
+smp_pyra = """!!! Nb of points:
+9
+ 0 0 0 !- 0
+ 1 0 0 !- 1
+ 0 1 0 !- 2
+ 1 1 0 !- 3
+ 0 0 1 !- 4
+ 1 0 1 !- 5
+ 0 1 1 !- 6
+ 1 1 1 !- 7
+ 0.5 0.5 0.5 !- 8
+ !!! Indices of points of 6 elements:
+ 0 1 5 4 8
+ 7 5 1 3 8
+ 3 2 6 7 8
+ 2 0 4 6 8
+ 0 2 3 1 8
+ 4 5 7 6 8"""
+
+pattern_pyra.LoadFromFile(smp_pyra)
+
+# apply the pattern to a face mesh
+volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME)
+print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit))
+pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0)
+isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True)
+if (isDone != 1): print 'MakeMesh :', pattern_pyra.GetErrorCode()
\endcode