1 # Find Element by Point
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)
14 # Create a geometry to mesh
15 box = geompy.MakeBoxDXDYDZ(100,100,100)
18 mesh = smesh.Mesh(box,"Mesh")
19 mesh.AutomaticHexahedralization()
25 # Find all elements (except 0D ones) located at the point
26 all_elems_except_0D = mesh.FindElementsByPoint(x,y,z)
27 assert( len(all_elems_except_0D) == 4)
29 # Find nodes at the point
30 nodes = mesh.FindElementsByPoint(x,y,z, SMESH.NODE )
31 assert( len(nodes) == 0)
32 assert( len( mesh.FindElementsByPoint(x,y,0, SMESH.NODE)) == 1)
34 # Find an edge at the point
35 edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE )
36 assert( len(edges) == 1)
38 # Find faces at the point
39 edges = mesh.FindElementsByPoint(x,y,z, SMESH.FACE )
40 assert( len(edges) == 2)
42 # Find a volume at the point
43 vols = mesh.FindElementsByPoint(x,y,z, SMESH.VOLUME )
44 assert( len(vols) == 1)
46 # Find 0D elements at the point
47 elems0d = mesh.FindElementsByPoint(x,y,z, SMESH.ELEM0D )
48 assert( len(elems0d) == 0)
50 # Find edges within a group
51 group1D = mesh.MakeGroupByIds("1D", SMESH.EDGE, [1,2] )
52 edges = mesh.FindElementsByPoint(x,y,z, SMESH.EDGE, group1D )