Skip to content

Instantly share code, notes, and snippets.

@fraguada
Created July 29, 2012 17:47
Show Gist options
  • Save fraguada/3200555 to your computer and use it in GitHub Desktop.
Save fraguada/3200555 to your computer and use it in GitHub Desktop.
Point Cloud Attributes
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
RhinoApp.WriteLine("The {0} command will get info from a pt cloud.", EnglishName);
Rhino.DocObjects.ObjRef obref;
Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select point cloud object", true, Rhino.DocObjects.ObjectType.PointSet, out obref);
if (rc != Rhino.Commands.Result.Success)
return rc;
Rhino.DocObjects.RhinoObject rhobj = obref.Object();
if (rhobj == null)
return Rhino.Commands.Result.Failure;
Rhino.Geometry.PointCloud pc = obref.PointCloud();
Point3d[] pts = pc.GetPoints();
Rhino.RhinoApp.WriteLine("The point cloud has '{0}' points", pc.Count);
Rhino.RhinoApp.WriteLine("The point cloud has colors '{0}'", pc.ContainsColors);
Rhino.RhinoApp.WriteLine("The point cloud has '{0}' colors", pc.GetColors().Length);
Rhino.RhinoApp.WriteLine("The point cloud has vectors '{0}'", pc.ContainsNormals);
Rhino.RhinoApp.WriteLine("The point cloud has '{0}' vectors", pc.GetNormals().Length);
return Result.Success;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment