X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fexamples%2Fdefining_hypotheses_ex12.py;fp=doc%2Fexamples%2Fdefining_hypotheses_ex12.py;h=d7f9ff5b6af07b66472c127906d7e0521d04fb0e;hb=4cf07a14111e98e8889620ee7e6371574c31a50c;hp=0000000000000000000000000000000000000000;hpb=d9f4b53e489dd5857db264ede6acded7b076c9f1;p=modules%2Fsmesh.git diff --git a/doc/examples/defining_hypotheses_ex12.py b/doc/examples/defining_hypotheses_ex12.py new file mode 100644 index 000000000..d7f9ff5b6 --- /dev/null +++ b/doc/examples/defining_hypotheses_ex12.py @@ -0,0 +1,40 @@ +# 1D Mesh with Fixed Points example + +import salome +salome.salome_init_without_session() + +from salome.geom import geomBuilder +from salome.smesh import smeshBuilder + +geom_builder = geomBuilder.New() +smesh_builder = smeshBuilder.New() + +# Create face and explode it on edges +face = geom_builder.MakeFaceHW(100, 100, 1) +edges = geom_builder.SubShapeAllSorted(face, geom_builder.ShapeType["EDGE"]) +geom_builder.addToStudy( face, "Face" ) + +# get the first edge from exploded result +edge1 = geom_builder.GetSubShapeID(face, edges[0]) + +# Define Mesh on previously created face +Mesh_1 = smesh_builder.Mesh(face) + +# Create Fixed Point 1D hypothesis and define parameters. +# Note: values greater than 1.0 and less than 0.0 are not taken into account; +# duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0 +# add added automatically. +# The number of segments should correspond to the number of points (NbSeg = NbPnt-1); +# extra values of segments splitting parameter are not taken into account, +# while missing values are considered to be equal to 1. +Fixed_points_1D_1 = smesh_builder.CreateHypothesis('FixedPoints1D') +Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] ) +Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] ) +Fixed_points_1D_1.SetReversedEdges( [edge1] ) + +# Add hypothesis to mesh and define 2D parameters +Mesh_1.AddHypothesis(Fixed_points_1D_1) +Regular_1D = Mesh_1.Segment() +Quadrangle_2D = Mesh_1.Quadrangle() +# Compute mesh +Mesh_1.Compute()