2018-08-20 20:00:59 +05:00
|
|
|
# Usage of Medial Axis Projection algorithm
|
|
|
|
|
|
|
|
# for meshing a ring face with quadrangles
|
|
|
|
|
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2022-04-11 18:28:01 +05:00
|
|
|
|
2018-08-20 20:00:59 +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()
|
2018-08-20 20:00:59 +05:00
|
|
|
|
|
|
|
# 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]
|
2018-08-20 20:00:59 +05:00
|
|
|
|
|
|
|
# make a mesh
|
|
|
|
|
2022-04-11 18:28:01 +05:00
|
|
|
mesh = smesh_builder.Mesh( ring )
|
2018-08-20 20:00:59 +05:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-02-21 18:59:44 +05:00
|
|
|
if not mesh.Compute(): raise Exception("Error when computing Mesh")
|