Hi @xliotx,
Maybe this helps?
public static class MeshExtensions
{
public static double[] ToDoubleArray(this Mesh mesh)
{
if (!mesh.Vertices.UseDoublePrecisionVertices)
return new double[0];
var rc = new double[mesh.Vertices.Count * 3];
int index = 0;
for (var i = 0; i < mesh.Vertices.Count; i++)
{
var pt = mesh.Vertices.Point3dAt(i);
rc[index++] = pt.X;
rc[index++] = pt.Y;
rc[index++] = pt.Z;
}
return rc;
}
}
You can use like this:
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
var filter = ObjectType.Mesh;
var rc = RhinoGet.GetOneObject("Select mesh", false, filter, out var objref);
if (rc != Rhino.Commands.Result.Success || null == objref)
return rc;
var mesh = objref.Mesh();
if (null == mesh || !mesh.Vertices.UseDoublePrecisionVertices)
return Result.Cancel;
var doubles = mesh.ToDoubleArray();
foreach (var d in doubles)
RhinoApp.WriteLine(d.ToString());
return Result.Success;
}
– Dale