Salome HOME
0023580: [EDF] AsterStudy: more distinct display of selected items in 3D view
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex01.py
1 # Arithmetic Progression and Geometric Progression
2
3 import salome
4 salome.salome_init()
5
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8
9 from salome.smesh import smeshBuilder
10 smesh =  smeshBuilder.New(salome.myStudy)
11
12 # create a box
13 box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
14 geompy.addToStudy(box, "Box")
15
16 # create a hexahedral mesh on the box
17 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
18
19 # create a Regular 1D algorithm for edges
20 algo1D = hexa.Segment()
21
22 # optionally reverse node distribution on certain edges
23 allEdges = geompy.SubShapeAllSorted( box, geompy.ShapeType["EDGE"])
24 reversedEdges = [ allEdges[0], allEdges[4] ]
25
26 # define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length 
27 algo1D.Arithmetic1D(1, 4, reversedEdges)
28
29 # define "Geometric Progression" hypothesis on one edge to cut this edge in segments with length increasing by 20% starting from 1
30 gpAlgo = hexa.Segment( allEdges[1] )
31 gpAlgo.GeometricProgression( 1, 1.2 )
32
33 # propagate distribution of nodes computed using "Geometric Progression" to parallel edges
34 gpAlgo.PropagationOfDistribution() 
35
36
37 # create a quadrangle 2D algorithm for faces
38 hexa.Quadrangle()
39
40 # create a hexahedron 3D algorithm for solids
41 hexa.Hexahedron()
42
43 # compute the mesh
44 hexa.Compute()