From 2a9fe7357b58b3fb6610a40660aec2a12caaff5e Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 20 Aug 2013 14:25:57 +0000 Subject: [PATCH] 0021920: [CEA 689] Get some measure functions on groups available in GUI and TUI - improve test script --- doc/salome/examples/measurements_ex03.py | 77 +++++++++++++++++++----- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/doc/salome/examples/measurements_ex03.py b/doc/salome/examples/measurements_ex03.py index ef15e7e25..5a44cdaca 100644 --- a/doc/salome/examples/measurements_ex03.py +++ b/doc/salome/examples/measurements_ex03.py @@ -10,25 +10,70 @@ geompy = geomBuilder.New(salome.myStudy) import SMESH, SALOMEDS from salome.smesh import smeshBuilder smesh = smeshBuilder.New(salome.myStudy) -import salome_notebook -from SMESH_mechanic import mesh as mesh1 +# create a box +box = geompy.MakeBoxDXDYDZ(100,100,100) +face = geompy.SubShapeAllSorted(box, geompy.ShapeType['FACE'])[0] -mesh1.Compute() +# mesh a box +mesh = smesh.Mesh(box) +submesh_1d = mesh.Segment().NumberOfSegments(5) +submesh_2d = mesh.Quadrangle() +submesh_3d = mesh.Hexahedron() +submesh_2d_face = mesh.Triangle(face) +mesh.Compute() -# compute length for mesh1 -length = mesh1.GetLength() +# create a group -# compute area for mesh1 -area = mesh1.GetArea() +group_2d = mesh.Group(face) -# compute volume for mesh1 -volume = mesh1.GetVolume() +# compute basic properties -# print basic properties -print -print "Basic Properties for mesh:" -print "* length =", length -print "* area =", area -print "* volume =", volume -print +print "Get basic properties: approach 1 (via measurements tool) ----" + +measure = smesh.CreateMeasurements() + +print "* for mesh:" +print " length:", measure.Length(mesh.mesh) +print " area:", measure.Area(mesh.mesh) +print " volume:", measure.Volume(mesh.mesh) + +print "* for group (2d):" +print " length:", measure.Length(group_2d) +print " area:", measure.Area(group_2d) +print " volume:", measure.Volume(group_2d) + +print "* for submesh (2d):" +print " length:", measure.Length(submesh_2d_face.GetSubMesh()) +print " area:", measure.Area(submesh_2d_face.GetSubMesh()) +print " volume:", measure.Volume(submesh_2d_face.GetSubMesh()) + +measure.UnRegister() + +print "Get basic properties: approach 2 (via smeshBuilder) ----" + +print "* for mesh:" +print " length:", smesh.GetLength(mesh) +print " area:", smesh.GetArea(mesh) +print " volume:", smesh.GetVolume(mesh) + +print "* for group (2d):" +print " length:", smesh.GetLength(group_2d) +print " area:", smesh.GetArea(group_2d) +print " volume:", smesh.GetVolume(group_2d) + +print "* for submesh (2d):" +print " length:", smesh.GetLength(submesh_2d_face) +print " area:", smesh.GetArea(submesh_2d_face) +print " volume:", smesh.GetVolume(submesh_2d_face) + +print "Get basic properties: approach 3 (via smeshBuilder.Mesh) ----" + +print "* for mesh:" +print " length:", mesh.GetLength() +print " area:", mesh.GetArea() +print " volume:", mesh.GetVolume() + +print "* for group (2d): unsupported" + +print "* for submesh (2d): unsupported" -- 2.39.2