2013-02-12 20:37:44 +06:00
|
|
|
# Start and End Length
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2013-04-04 13:08:19 +06:00
|
|
|
|
2022-04-11 18:28:01 +05:00
|
|
|
from salome.geom import geomBuilder
|
2013-04-04 13:08:19 +06:00
|
|
|
from salome.smesh import smeshBuilder
|
2022-04-11 18:28:01 +05:00
|
|
|
|
|
|
|
geom_builder = geomBuilder.New()
|
|
|
|
smesh_builder = smeshBuilder.New()
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a box
|
2022-04-11 18:28:01 +05:00
|
|
|
box = geom_builder.MakeBoxDXDYDZ(10., 10., 10.)
|
|
|
|
geom_builder.addToStudy(box, "Box")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# get one edge of the box to put local hypothesis on
|
2022-04-11 18:28:01 +05:00
|
|
|
p5 = geom_builder.MakeVertex(5., 0., 0.)
|
|
|
|
EdgeX = geom_builder.GetEdgeNearPoint(box, p5)
|
|
|
|
geom_builder.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a hexahedral mesh on the box
|
2022-04-11 18:28:01 +05:00
|
|
|
hexa = smesh_builder.Mesh(box, "Box : hexahedrical mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# set algorithms
|
|
|
|
algo1D = hexa.Segment()
|
|
|
|
hexa.Quadrangle()
|
|
|
|
hexa.Hexahedron()
|
|
|
|
|
|
|
|
# define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
|
|
|
|
algo1D.NumberOfSegments(4)
|
|
|
|
|
|
|
|
# create a local hypothesis
|
|
|
|
algo_local = hexa.Segment(EdgeX)
|
|
|
|
|
|
|
|
# define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
|
|
|
|
algo_local.StartEndLength(1, 6)
|
|
|
|
|
|
|
|
# define "Propagation" hypothesis that propagates all other hypothesis
|
|
|
|
# on all edges on the opposite side in case of quadrangular faces
|
|
|
|
algo_local.Propagation()
|
|
|
|
|
|
|
|
# compute the mesh
|
|
|
|
hexa.Compute()
|