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