7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New()
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New()
15 box = geompy.MakeBoxDXDYDZ(100,100,100)
16 face = geompy.SubShapeAllSorted(box, geompy.ShapeType['FACE'])[0]
19 mesh = smesh.Mesh(box)
20 submesh_1d = mesh.Segment().NumberOfSegments(5)
21 submesh_2d = mesh.Quadrangle()
22 submesh_3d = mesh.Hexahedron()
23 submesh_2d_face = mesh.Triangle(face)
28 group_2d = mesh.Group(face)
30 # compute basic properties
32 print("Get basic properties: approach 1 (via measurements tool) ----")
34 measure = smesh.CreateMeasurements()
37 print(" length:", measure.Length(mesh.mesh))
38 print(" area:", measure.Area(mesh.mesh))
39 print(" volume:", measure.Volume(mesh.mesh))
41 print("* for group (2d):")
42 print(" length:", measure.Length(group_2d))
43 print(" area:", measure.Area(group_2d))
44 print(" volume:", measure.Volume(group_2d))
46 print("* for submesh (2d):")
47 print(" length:", measure.Length(submesh_2d_face.GetSubMesh()))
48 print(" area:", measure.Area(submesh_2d_face.GetSubMesh()))
49 print(" volume:", measure.Volume(submesh_2d_face.GetSubMesh()))
53 print("Get basic properties: approach 2 (via smeshBuilder) ----")
56 print(" length:", smesh.GetLength(mesh))
57 print(" area:", smesh.GetArea(mesh))
58 print(" volume:", smesh.GetVolume(mesh))
60 print("* for group (2d):")
61 print(" length:", smesh.GetLength(group_2d))
62 print(" area:", smesh.GetArea(group_2d))
63 print(" volume:", smesh.GetVolume(group_2d))
65 print("* for submesh (2d):")
66 print(" length:", smesh.GetLength(submesh_2d_face))
67 print(" area:", smesh.GetArea(submesh_2d_face))
68 print(" volume:", smesh.GetVolume(submesh_2d_face))
70 print("Get basic properties: approach 3 (via smeshBuilder.Mesh) ----")
73 print(" length:", mesh.GetLength())
74 print(" area:", mesh.GetArea())
75 print(" volume:", mesh.GetVolume())
77 print("* for group (2d): unsupported")
79 print("* for submesh (2d): unsupported")