Reputation: 11
I am using this code to have the user select specific points from a loaded point cloud. The point is to allow them to manually prune the pointcloud and later create an automatic outlier detection to prune these points. However, I can't find anywhere how these points could be deleted?
{
ObjRef[] obj_refs;
var rc = Rhino.Input.RhinoGet.GetMultipleObjects("Select point", false, ObjectType.Point, out obj_refs);
if (rc != Result.Success)
return rc;
foreach (var o_ref in obj_refs)
{
var point = o_ref.Point();
RhinoApp.WriteLine("Point: x:{0}, y:{1}, z:{2}",
point.Location.X,
point.Location.Y,
point.Location.Z);
}
doc.Objects.UnselectAll();
doc.Views.Redraw();
return Result.Success;
}```
Upvotes: 1
Views: 234
Reputation: 28
You can first try to grab the index of the specific point your are searching for in the PointCloud object. Next, by using this function
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_PointCloud_RemoveAt.htm
so I think the main line will be
obj_refs.RemoveAt(index);
Upvotes: 0
Reputation: 2129
In the ForEach loop, you can add an IF statement to select only those points you want. Something like this:
foreach (var o_ref in obj_refs)
{
if (o_ref.property == "only the one you want")
{
var point = o_ref.Point();
RhinoApp.WriteLine("Point: x:{0}, y:{1}, z:{2}",
point.Location.X,
point.Location.Y,
point.Location.Z);
}
}
Upvotes: 0