Salome HOME
Merge from V6_main 19/03/2013
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex12.py
1 # 1D Mesh with Fixed Points example
2
3 import salome
4 import geompy
5 import smesh
6 import StdMeshers
7
8 # Create face and explode it on edges
9 face = geompy.MakeFaceHW(100, 100, 1)
10 edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"])
11 geompy.addToStudy( face, "Face" )
12
13 # get the first edge from exploded result
14 edge1 = geompy.GetSubShapeID(face, edges[0])
15
16 # Define Mesh on previously created face
17 Mesh_1 = smesh.Mesh(face)
18
19 # Create Fixed Point 1D hypothesis and define parameters.
20 # Note: values greater than 1.0 and less than 0.0 are not taken into account;
21 # duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0
22 # add added automatically.
23 # The number of segments should correspond to the number of points (NbSeg = NbPnt-1);
24 # extra values of segments splitting parameter are not taken into account,
25 # while missing values are considered to be equal to 1.
26 Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D')
27 Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] )
28 Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] )
29 Fixed_points_1D_1.SetReversedEdges( [edge1] )
30
31 # Add hypothesis to mesh and define 2D parameters
32 Mesh_1.AddHypothesis(Fixed_points_1D_1)
33 Regular_1D = Mesh_1.Segment()
34 Quadrangle_2D = Mesh_1.Quadrangle()
35 # Compute mesh
36 Mesh_1.Compute()