2013-02-12 20:37:44 +06:00
|
|
|
# Length from Edges
|
|
|
|
|
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 sketchers
|
2022-04-11 18:28:01 +05:00
|
|
|
sketcher1 = geom_builder.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
|
|
|
|
sketcher2 = geom_builder.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a face from two wires
|
|
|
|
isPlanarFace = 1
|
2022-04-11 18:28:01 +05:00
|
|
|
face1 = geom_builder.MakeFaces([sketcher1, sketcher2], isPlanarFace)
|
|
|
|
geom_builder.addToStudy(face1, "Face1")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a mesh
|
2022-04-11 18:28:01 +05:00
|
|
|
tria = smesh_builder.Mesh(face1, "Face : triangle 2D mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# Define 1D meshing
|
|
|
|
algo1D = tria.Segment()
|
2016-03-17 23:47:21 +05:00
|
|
|
algo1D.LocalLength(3.)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create and assign the algorithm for 2D meshing with triangles
|
|
|
|
algo2D = tria.Triangle()
|
|
|
|
|
2016-03-17 23:47:21 +05:00
|
|
|
# create and assign "LengthFromEdges" hypothesis to build triangles with
|
|
|
|
# linear size close to the length of the segments generated on the face wires (3.)
|
2013-02-12 20:37:44 +06:00
|
|
|
algo2D.LengthFromEdges()
|
|
|
|
|
|
|
|
# compute the mesh
|
|
|
|
tria.Compute()
|