70002368 User action to select a part of vdPointCloud points

Article 70002368
Type Wish
Product Engine
Version 1003
Date Added 6/16/2023 12:00:00 AM
Fixed 10.1004.0.4 (6/16/2023 12:00:00 AM)
Submitted by Soon Hui Ngu

Summary

Solution

In version 1004.0.4 a new method getUserSelection of vdpointCloud was added.
Int32UniqueArray Select(gPoints pts)

Select part of points
Parameters

pts
An array of points define the window polygon that enclose the desired selected points in current view Coordinate System.
If it contains one single point then select all points inside the rectangle defined by the passed point as center and with size equal to PickSize property of GlobalRenderProperties
If it is null then a new user action is started waiting the user to select points
Note user can type 'wp' for window polygon selection and 'w' for rectangle window selection

hightLightColor
The color used to draw the user selected points

Return Value
An array of zero based indexes of the selected points in the points

Example

1.Prompt the user to select points for a specific vdPointCloud in the Document and removes them from points of vdPointCloud object 

vdPointCloud pc = doc.Model.Entities.Last as vdPointCloud;
Int32UniqueArray items = pc.Select(null,Color.Red);
gPoints pts = new gPoints();
for (int i = 0; i<pc.points.Count; i++)
{
  if (items.FindValue(i) < 0) pts.Add(pc.points[i]);
}
pc.points = pts;
doc.Redraw(true);

2.Remove points from an existing vdPointCloud object that are inside a rectangle with center (0,0) in World Coordinate System and size 50 drawing units 

vdPointCloud pc = doc.Model.Entities.Last as vdPointCloud;
gPoint pt = new gPoint(0, 0, 0);
pt = doc.World2ViewMatrix.Transform(pt);
Box box = new Box();
box.AddPoint(pt);
box.AddWidth(50);
Int32UniqueArray items = pc.Select(box.TogPoints(),Color.Red);
gPoints pts = new gPoints();
for (int i = 0; i<pc.points.Count; i++)
{
  if (items.FindValue(i) < 0) pts.Add(pc.points[i]);
}
pc.points = pts;
doc.Redraw(true);


Send comments on this topic.