Mesh.CreateFromTessellation

Hello,
There are strange behaviors of the Rhino method from Mesh, CreateFromTessellation that I can’t understand and would appreciate some enlightenment on:
The method is functioning if I feed it with this :
ptobj = scriptcontext.doc.Objects.Find(pointID)
points.append(ptobj.PointGeometry.Location)
and not with this :
points.append(rs.PointCoordinates(pointID))
but the two seems to produce exactly the same results with objects of type Point3d in both cases
?

Thank you

Hi @Jray,

This seems to work:

#! python 3
import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

def Test1():
    object_ids = rs.GetObjects("Select points", 1)
    if not object_ids:
        return

    points = []
    for obj_id in object_ids:
        points.append(rs.PointCoordinates(obj_id))

    rc, plane = Rhino.Geometry.Plane.FitPlaneToPoints(points)
    if rc != Rhino.Geometry.PlaneFitResult.Success:
        return

    mesh = Rhino.Geometry.Mesh.CreateFromTessellation(points, None, plane, True)
    if mesh:
        sc.doc.Objects.AddMesh(mesh)
        sc.doc.Views.Redraw()

if __name__ == "__main__":
    Test1()

– Dale

Yes, thank you, I swear I had an issue in previous tests, but it was probably another mistake of my fault…

But I take the opportunity of your response for a new question : I actually wanted to make a mesh as a constrained Delaunay triangulation, thus with a list of list of points as second argument to CreateFromTessellation, and with Iron Python, I get also a strange error on this nested list :

“Message: Error in IEnumeratorOfTWrapper.Current. Could not cast: System.Collections.Generic.IEnumerable`1[Rhino.Geometry.Point3d] in IronPython.Runtime.List”

That does not occur in python 3: can you explain this ?