Willem
(Willem Derks)
1
Hi,
I’m not seeing a means to triangulate a mesh via RhinoCommon.
Am I missing something or should I stick with scripting the _TriangulateMesh command ?
I found the answer:
http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Collections_MeshFaceList_ConvertQuadsToTriangles.htm
Thanks
-Willem
fraguada
(Luis Fraguada)
2
Not sure if it is the same code, but a MeshFaceList has the ConvertQuadsToTriangles method.
2 Likes
Willem
(Willem Derks)
3
Hi Luis,
Yes, I just found the answer myself and edited the question. Thanks
DavAndLar
(DavAndLar)
5
Hi @Willem, I have a question to this somewhat old thread.
Faces.ConvertQuadsToTriangles
that you suggest returns a bool
. How do I get the actual triangluated mesh?
thanks,
david
dale
(Dale Fugier)
6
Hi @DavAndLar,
ConvertQuadsToTriangles
modifies the mesh in-place.
import Rhino
import scriptcontext as sc
def test_meshbox():
interval = Rhino.Geometry.Interval(0, 10)
plane = Rhino.Geometry.Plane.WorldXY
box = Rhino.Geometry.Box(plane, interval, interval, interval)
mesh = Rhino.Geometry.Mesh.CreateFromBox(box, 1, 1, 1)
# just triangles
mesh.Faces.ConvertQuadsToTriangles()
sc.doc.Objects.AddMesh(mesh)
sc.doc.Views.Redraw()
if __name__=="__main__":
test_meshbox()
– Dale