]> SALOME platform Git repositories - modules/smesh.git/blob - doc/salome/examples/defining_hypotheses_ex02.py
Salome HOME
Fix for the '52701: SIGSEGV in Mesh creation dialog box after activating Viscous...
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex02.py
1 # Deflection 1D and Number of Segments
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 a face from arc and straight segment
14 px = geompy.MakeVertex(100., 0.  , 0.  )
15 py = geompy.MakeVertex(0.  , 100., 0.  )
16 pz = geompy.MakeVertex(0.  , 0.  , 100.)
17
18 exy = geompy.MakeEdge(px, py)
19 arc = geompy.MakeArc(py, pz, px)
20
21 wire = geompy.MakeWire([exy, arc])
22
23 isPlanarFace = 1
24 face1 = geompy.MakeFace(wire, isPlanarFace)
25 geompy.addToStudy(face1,"Face1")
26
27 # get edges from the face
28 e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
29 geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
30
31 # create hexahedral mesh
32 hexa = smesh.Mesh(face1, "Face : triangle mesh")
33
34 # define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
35 algo1D = hexa.Segment()
36 algo1D.NumberOfSegments(6)
37
38 # define "MaxElementArea" hypothesis
39 algo2D = hexa.Triangle()
40 algo2D.MaxElementArea(70.0)
41
42 # define a local "Deflection1D" hypothesis on the arc
43 algo_local = hexa.Segment(e_arc)
44 algo_local.Deflection1D(1.0)
45
46 # compute the mesh
47 hexa.Compute()