1 # Add 0D Element on Element Nodes
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
17 box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
18 face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
21 mesh = smesh.Mesh( box )
22 mesh.AutomaticHexahedralization(0)
24 # create 0D elements on all nodes of the mesh
25 res = mesh.Add0DElementsToAllNodes( mesh )
27 # find 0D elements on all nodes of the mesh, all found nodes are added to a new group
29 res = mesh.Add0DElementsToAllNodes( mesh, groupName )
30 mesh.RemoveGroupWithContents( res ) # remove all found 0D elements
32 # create 0D elements on all nodes of a sub-mesh, with group creation
33 groupName = "0Dsubmesh"
34 submesh = mesh.GetSubMesh( face, "faceSM")
35 res = mesh.Add0DElementsToAllNodes( submesh, groupName )
37 # create 0D elements on all nodes of a group
38 group = mesh.Group( face, "faceGroup" )
39 res = mesh.Add0DElementsToAllNodes( group )
41 # remove all 0D elements
42 mesh.RemoveElements( mesh.GetIdsFromFilter( smesh.GetFilter( SMESH.ELEM0D,
43 SMESH.FT_ElemGeomType,
44 "=",SMESH.Geom_POINT )))
46 # create 0D elements on all nodes of some elements
47 res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() )
49 mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D ))
51 # create 0D elements on some nodes
53 res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE ))