Salome HOME
Merge from V6_main 01/04/2013
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex07.py
1 # Length from Edges
2
3 import geompy
4 import smesh
5
6 # create sketchers
7 sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
8 sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
9
10 # create a face from two wires
11 isPlanarFace = 1
12 face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
13 geompy.addToStudy(face1, "Face1")
14
15 # create a mesh
16 tria = smesh.Mesh(face1, "Face : triangle 2D mesh")
17
18 # Define 1D meshing
19 algo1D = tria.Segment()
20 algo1D.NumberOfSegments(2)
21
22 # create and assign the algorithm for 2D meshing with triangles
23 algo2D = tria.Triangle()
24
25 # create and assign "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
26 algo2D.LengthFromEdges()
27
28 # compute the mesh
29 tria.Compute()