mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-18 17:30:33 +05:00
0021680: EDF 2288 SMESH: creation of 0D elements from other elements
+<h3>Add 0D Element on Element Nodes</h3>
This commit is contained in:
parent
c25fe950c2
commit
48b1714b35
@ -11,9 +11,9 @@
|
||||
<h3>Add Node</h3>
|
||||
|
||||
\code
|
||||
import SMESH_mechanic
|
||||
import smesh
|
||||
|
||||
mesh = SMESH_mechanic.mesh
|
||||
mesh = smesh.Mesh()
|
||||
|
||||
# add node
|
||||
new_id = mesh.AddNode(50, 10, 0)
|
||||
@ -27,9 +27,9 @@ else: print "New Node has been added with ID ", new_id
|
||||
<h3>Add 0D Element</h3>
|
||||
|
||||
\code
|
||||
import SMESH_mechanic
|
||||
import smesh
|
||||
|
||||
mesh = SMESH_mechanic.mesh
|
||||
mesh = smesh.Mesh()
|
||||
|
||||
# add node
|
||||
node_id = mesh.AddNode(50, 10, 0)
|
||||
@ -42,6 +42,54 @@ if new_id == 0: print "KO node addition."
|
||||
else: print "New 0D Element has been added with ID ", new_id
|
||||
\endcode
|
||||
|
||||
<br>
|
||||
\anchor tui_add_0DElement_on_all_nodes
|
||||
<h3>Add 0D Element on Element Nodes</h3>
|
||||
|
||||
\code
|
||||
import smesh, SMESH, geompy
|
||||
|
||||
# create a geometry
|
||||
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
|
||||
face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
|
||||
|
||||
# make 3D mesh
|
||||
mesh = smesh.Mesh( box )
|
||||
mesh.AutomaticHexahedralization(0)
|
||||
|
||||
# create 0D elements on all nodes of the mesh
|
||||
res = mesh.Add0DElementsToAllNodes( mesh )
|
||||
|
||||
# find 0D elements on all nodes of the mesh, all found nodes are added to a new group
|
||||
groupName = "0Dmesh"
|
||||
res = mesh.Add0DElementsToAllNodes( mesh, groupName )
|
||||
mesh.RemoveGroupWithContents( res ) # remove all found 0D elements
|
||||
|
||||
# create 0D elements on all nodes of a sub-mesh, with group creation
|
||||
groupName = "0Dsubmesh"
|
||||
submesh = mesh.GetSubMesh( face, "faceSM")
|
||||
res = mesh.Add0DElementsToAllNodes( submesh, groupName )
|
||||
|
||||
# create 0D elements on all nodes of a group
|
||||
group = mesh.Group( face, "faceGroup" )
|
||||
res = mesh.Add0DElementsToAllNodes( group )
|
||||
|
||||
# remove all 0D elements
|
||||
mesh.RemoveElements( mesh.GetIdsFromFilter( smesh.GetFilter( SMESH.ELEM0D,
|
||||
SMESH.FT_ElemGeomType,
|
||||
"=",SMESH.Geom_POINT )))
|
||||
|
||||
# create 0D elements on all nodes of some elements
|
||||
res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() )
|
||||
|
||||
mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D ))
|
||||
|
||||
# create 0D elements on some nodes
|
||||
nodes = range(1,10)
|
||||
res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE ))
|
||||
|
||||
\endcode
|
||||
|
||||
<br>
|
||||
\anchor tui_add_edge
|
||||
<h3>Add Edge</h3>
|
||||
|
Loading…
Reference in New Issue
Block a user