smesh/doc/examples/quad_medial_axis_algo.py

33 lines
919 B
Python
Raw Normal View History

# Usage of Medial Axis Projection algorithm
# for meshing a ring face with quadrangles
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 ring face
2022-04-11 18:28:01 +05:00
circleEdge1 = geom_builder.MakeCircleR( 3 )
circleEdge2 = geom_builder.MakeCircleR( 7 )
ring = geom_builder.MakeFaceWires( [ circleEdge1, circleEdge2 ], True, theName='Ring' )
circleLen1 = geom_builder.BasicProperties( circleEdge1 )[0]
circleLen2 = geom_builder.BasicProperties( circleEdge2 )[0]
# make a mesh
2022-04-11 18:28:01 +05:00
mesh = smesh_builder.Mesh( ring )
circNbSeg = 60
algo1d = mesh.Segment()
algo1d.NumberOfSegments( circNbSeg ) # division of circle edges
algo2d = mesh.Quadrangle( smeshBuilder.QUAD_MA_PROJ )
algo2d.StartEndLength( circleLen2 / circNbSeg, circleLen1 / circNbSeg ) # radial division
mesh.Compute()