RevitAPI: how to get point clouds?

From Revit > Insert > Point Cloud, we can insert point clouds into Revit, then how to get those points information via API?

Inspect with RevitLookup, we found the inserted point cloud is an object of class PointCloudInstance, and there is a method named GetPoints, which is what we want.

GetPoints() has 3 arguments

public PointCollection GetPoints(
PointCloudFilter filter, double averageDistance, int numPoints);

filter specifies the conditions for filtering points.

averageDistance stands for minimal distance between points, the smaller, the more points we will get.

numPoints stands for the maximum number of points to be returned.

The key is how to create the filter, there is no constructor of class PointCloudFilter, no static Create function, and no relative creation functions under Document.Create nor Application.Create, fortunately, we found method CreateMultiPlaneFilter in class PointCloudFilterFactory.

public static PointCloudFilter CreateMultiPlaneFilter(IList<Autodesk.Revit.DB.Plane> planes);
public static PointCloudFilter CreateMultiPlaneFilter(IList<Autodesk.Revit.DB.Plane> planes, int exactPlaneCount);

planes: defines a set of planes, all points returned should be in the positive direction of those planes, so we can use those planes to define a range to include all the points, and the range can be non-closure…

Read more

Leave a Comment