1 # An enforced vertex can be added via:
2 # - the coordinates x,y,z
3 # - a GEOM vertex or compound (No geometry, TUI only)
5 # The created enforced nodes can also be stored in
8 # This feature is available only on meshes without geometry.
10 # Ex1: Add one enforced vertex with coordinates (50,50,100)
11 # and physical size 2.
16 from salome.geom import geomBuilder
17 geompy = geomBuilder.New()
20 from salome.smesh import smeshBuilder
21 smesh = smeshBuilder.New()
24 box = geompy.MakeBoxDXDYDZ(200., 200., 200.)
25 geompy.addToStudy(box, "box")
26 # create a mesh on the box
27 mgtetraMesh = smesh.Mesh(box,"box: MG-Tetra and MG-CADSurf mesh")
28 # create a MG-CADSurf algorithm for faces
29 mgtetraMesh.Triangle(algo=smeshBuilder.MG_CADSurf)
33 # Make a copy of the 2D mesh
34 mgtetraMesh_wo_geometry = smesh.CopyMesh( mgtetraMesh, 'MG-Tetra w/o geometry', 0, 0)
36 # create a MG_Tetra algorithm and hypothesis and assign them to the mesh
37 MG_Tetra = mgtetraMesh.Tetrahedron( smeshBuilder.MG_Tetra )
38 MG_Tetra_Parameters = MG_Tetra.Parameters()
39 # Create the enforced vertex
40 MG_Tetra_Parameters.SetEnforcedVertex( 50, 50, 100, 2) # no group
45 # Ex2: Add one vertex enforced by a GEOM vertex at (50,50,100)
46 # with physical size 5 and add it to a group called "My special nodes"
48 # Create another MG_Tetra hypothesis and assign it to the mesh without geometry
49 MG_Tetra_Parameters_wo_geometry = smesh.CreateHypothesis('MG-Tetra Parameters', 'GHS3DEngine')
50 mgtetraMesh_wo_geometry.AddHypothesis( MG_Tetra )
51 mgtetraMesh_wo_geometry.AddHypothesis( MG_Tetra_Parameters_wo_geometry )
53 # Create the enforced vertex
54 p1 = geompy.MakeVertex(150, 150, 100)
55 geompy.addToStudy(p1, "p1")
56 MG_Tetra_Parameters_wo_geometry.SetEnforcedVertexGeomWithGroup( p1, 5 , "My special nodes")
57 #MG_Tetra_Parameters.SetEnforcedVertexGeom( p1, 5 ) # no group
60 mgtetraMesh_wo_geometry.Compute()
62 # Erase all enforced vertices
63 MG_Tetra_Parameters.ClearEnforcedVertices()