smesh/doc/examples/defining_hypotheses_len_near_vertex.py

32 lines
729 B
Python
Raw Permalink Normal View History

# Usage of Segments around Vertex algorithm
# for meshing a box with quadrangles with refinement near vertices
import salome
salome.salome_init_without_session()
2022-04-11 18:28:01 +05:00
from salome.geom import geomBuilder
from salome.smesh import smeshBuilder
2022-04-11 18:28:01 +05:00
geom_builder = geomBuilder.New()
smesh_builder = smeshBuilder.New()
# create a box
2022-04-11 18:28:01 +05:00
box = geom_builder.MakeBoxDXDYDZ( 10, 10, 10 )
# make a mesh
2022-04-11 18:28:01 +05:00
mesh = smesh_builder.Mesh( box )
# define quadrangle meshing
algo1d = mesh.Segment()
algo1d.LocalLength( 1. )
mesh.Quadrangle()
# add Hexahedron algo to assure that there are no triangles
mesh.Hexahedron()
# define refinement near vertices
algo1d.LengthNearVertex( 0.2 )
if not mesh.Compute(): raise Exception("Error when computing Mesh")