Hello,
Here is what I am trying to do:
- Import STL
- Grab all of the normals of each TRIANGLE in the STL, not surface
- Calculate the angle of those normals with respect to the XY Plane normal, ie (0,0,1)
Here is the code:
import rhinoscriptsyntax as rs
Mesh = rs.AllObjects()
Triangles = rs.ExplodeMeshes(Mesh)
Triangles = rs.AllObjects()
XYPlane = rs.CreateVector((0,0,1))
for normal in Triangles:
vector = rs.MeshFaceNormals(normal)
print(vector)
angle = rs.VectorAngle(XYPlane, vector)
print(angle)
However, I always get the same error when trying to use the Vector Angle function. Any idea? Here it is:
Message: Could not convert [<Rhino.Geometry.Vector3d object at 0x00000000000187F0 [-0.0249902363866568,0.996604800224304,0.0784497708082199]>, <Rhino.Geometry.Vector3d object at 0x00000000000187F1 [-0.0249902345240116,0.996604800224304,0.0784497782588005]>] to a Vector3d
Traceback:
line 715, in coerce3dvector, “C:\Users\toura\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py”
line 532, in VectorAngle, “C:\Users\toura\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\pointvector.py”
line 12, in , “C:\Users\toura\Documents\pythonfiles\RhinoMeshTriangles.py”