Salome HOME
52976: Find Elements by Point - All does not find Ball element
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex07.py
1 # Length from Edges
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
13 # create sketchers
14 sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
15 sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
16
17 # create a face from two wires
18 isPlanarFace = 1
19 face1 = geompy.MakeFaces([sketcher1, sketcher2], isPlanarFace)
20 geompy.addToStudy(face1, "Face1")
21
22 # create a mesh
23 tria = smesh.Mesh(face1, "Face : triangle 2D mesh")
24
25 # Define 1D meshing
26 algo1D = tria.Segment()
27 algo1D.LocalLength(3.)
28
29 # create and assign the algorithm for 2D meshing with triangles
30 algo2D = tria.Triangle()
31
32 # create and assign "LengthFromEdges" hypothesis to build triangles with
33 # linear size close to the length of the segments generated on the face wires (3.)
34 algo2D.LengthFromEdges()
35
36 # compute the mesh
37 tria.Compute()