4 salome.salome_init_without_session()
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
13 box = geom_builder.MakeBoxDXDYDZ(10., 10., 10.)
14 geom_builder.addToStudy(box, "Box")
16 # get one edge of the box to put local hypothesis on
17 p5 = geom_builder.MakeVertex(5., 0., 0.)
18 EdgeX = geom_builder.GetEdgeNearPoint(box, p5)
19 geom_builder.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
21 # create a hexahedral mesh on the box
22 hexa = smesh_builder.Mesh(box, "Box : hexahedrical mesh")
25 algo1D = hexa.Segment()
29 # define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
30 algo1D.NumberOfSegments(4)
32 # create a local hypothesis
33 algo_local = hexa.Segment(EdgeX)
35 # define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
36 algo_local.StartEndLength(1, 6)
38 # define "Propagation" hypothesis that propagates all other hypothesis
39 # on all edges on the opposite side in case of quadrangular faces
40 algo_local.Propagation()
43 if not hexa.Compute(): raise Exception("Error when computing Mesh")