smesh/doc/examples/measurements_ex04.py

27 lines
539 B
Python
Raw Permalink Normal View History

# Angle measurement
import salome
salome.salome_init_without_session()
2022-04-11 18:28:01 +05:00
from salome.smesh import smeshBuilder
2022-04-11 18:28:01 +05:00
smesh_builder = smeshBuilder.New()
# use smeshBuilder.GetAngle() to compute angle between 3 arbitrary points
p0 = [1,0,0]
p1 = [0,0,0]
p2 = [0,1,0]
2022-04-11 18:28:01 +05:00
a1 = smesh_builder.GetAngle(p0, p1, p2)
print("Right angle measure", a1 )
# use Mesh.GetAngle() to compute angle between 3 nodes of a mesh
2022-04-11 18:28:01 +05:00
mesh = smesh_builder.Mesh()
n0 = mesh.AddNode( *p0 )
n1 = mesh.AddNode( *p1 )
n2 = mesh.AddNode( *p2 )
a2 = mesh.GetAngle( n0,n1,n2 )