2013-02-12 20:37:44 +06:00
|
|
|
# Quadrangle Parameters example 2 (using different types)
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2022-04-11 18:28:01 +05:00
|
|
|
|
2013-04-04 13:08:19 +06: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()
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# Make quadrangle face and explode it on edges.
|
2022-04-11 18:28:01 +05:00
|
|
|
Vertex_1 = geom_builder.MakeVertex(0, 0, 0)
|
|
|
|
Vertex_2 = geom_builder.MakeVertex(40, 0, 0)
|
|
|
|
Vertex_3 = geom_builder.MakeVertex(40, 30, 0)
|
|
|
|
Vertex_4 = geom_builder.MakeVertex(0, 30, 0)
|
|
|
|
Quadrangle_Face_1 = geom_builder.MakeQuad4Vertices(Vertex_1, Vertex_4, Vertex_3, Vertex_2)
|
|
|
|
[Edge_1,Edge_2,Edge_3,Edge_4] = geom_builder.SubShapeAllSorted(Quadrangle_Face_1, geom_builder.ShapeType["EDGE"])
|
|
|
|
geom_builder.addToStudy( Quadrangle_Face_1, "Quadrangle Face_1" )
|
|
|
|
geom_builder.addToStudyInFather( Quadrangle_Face_1, Edge_2, "Edge_2" )
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# Set the Geometry for meshing
|
2022-04-11 18:28:01 +05:00
|
|
|
Mesh_1 = smesh_builder.Mesh(Quadrangle_Face_1)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# Create Quadrangle parameters and
|
|
|
|
# define the Type as Quadrangle Preference
|
2019-07-12 17:15:38 +05:00
|
|
|
Quad_algo = Mesh_1.Quadrangle()
|
|
|
|
Quadrangle_Parameters_1 = Quad_algo.QuadrangleParameters( smeshBuilder.QUAD_QUADRANGLE_PREF )
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# Define other hypotheses and algorithms
|
|
|
|
Regular_1D = Mesh_1.Segment()
|
|
|
|
Nb_Segments_1 = Regular_1D.NumberOfSegments(4)
|
|
|
|
|
|
|
|
# Define submesh on one edge to provide different number of segments
|
|
|
|
Regular_1D_1 = Mesh_1.Segment(geom=Edge_2)
|
|
|
|
Nb_Segments_2 = Regular_1D_1.NumberOfSegments(10)
|
|
|
|
|
|
|
|
# Compute mesh (with Quadrangle Preference type)
|
2023-02-21 18:59:44 +05:00
|
|
|
if not Mesh_1.Compute(): raise Exception("Error when computing Mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# Change type to Reduced and compute again
|
2019-07-12 17:15:38 +05:00
|
|
|
Quadrangle_Parameters_1.SetQuadType( smeshBuilder.QUAD_REDUCED )
|
2023-02-21 18:59:44 +05:00
|
|
|
if not Mesh_1.Compute(): raise Exception("Error when computing Mesh")
|