GetPoints Method


Extracts a collection of points based on a filter.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2014

Syntax

C#
public PointCollection GetPoints(
	PointCloudFilter filter,
	double averageDistance,
	int numPoints
)
Visual Basic
Public Function GetPoints ( _
	filter As PointCloudFilter, _
	averageDistance As Double, _
	numPoints As Integer _
) As PointCollection
Visual C++
public:
PointCollection^ GetPoints(
	PointCloudFilter^ filter, 
	double averageDistance, 
	int numPoints
)

Parameters

filter
Type: Autodesk.Revit.DB.PointClouds PointCloudFilter
The filter to control which points are extracted. The filter should be passed in the coordinates of the Revit model.
averageDistance
Type: System Double
Desired average distance between "adjacent" cloud points (Revit units of length). The smaller the averageDistance the larger number of points will be returned up to the numPoints limit. Specifying this parameter makes actual number of points returned for a given filter independent of the density of coverage produced by the scanner.
numPoints
Type: System Int32
The maximum number of points requested.

Return Value

A collection object containing points that pass the filter, but no more than the maximum number requested.

Remarks

If there are more points in the cloud passing the filter than the number requested in this function, the results may not be consistent if the same call is made again.

Examples

Copy C#
private void GetPointCloudDataByIteration(PointCloudInstance pcInstance, PointCloudFilter pointCloudFilter)
{
    // read points by iteration
    double averageDistance = 0.001;
    int numberOfPoints= 10000;
    // Get points. Number of points is determined by the needs of the client. 
    PointCollection points = pcInstance.GetPoints(pointCloudFilter, averageDistance, numberOfPoints);
    foreach (CloudPoint point in points)
    {
        // Process each point 
        System.Drawing.Color color = System.Drawing.ColorTranslator.FromWin32(point.Color);
        String pointDescription = String.Format("({0}, {1}, {2}, {3}", point.X, point.Y, point.Z, color.ToString());
    }
}
// read points by pointer
public unsafe void GetPointCloudDataByPointer(PointCloudInstance pcInstance, PointCloudFilter pointCloudFilter)
{
    double averageDistance = 0.001;
    int numOfPoints = 10000;
    // Get points. Number of points is determined by the needs of the client.
    PointCollection points = pcInstance.GetPoints(pointCloudFilter, averageDistance, numOfPoints);
    CloudPoint* pointBuffer = (CloudPoint*)points.GetPointBufferPointer().ToPointer();
    int totalCount = points.Count;
    for (int numberOfPoints = 0; numberOfPoints < totalCount; numberOfPoints++)
    {
        CloudPoint point = *(pointBuffer + numberOfPoints);
        // Process each point 
        System.Drawing.Color color = System.Drawing.ColorTranslator.FromWin32(point.Color);
        String pointDescription = String.Format("({0}, {1}, {2}, {3}", point.X, point.Y, point.Z, color.ToString());
    }
}

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The number of points read must range from 1 to 1000000.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions ArgumentOutOfRangeException The given value for averageDistance must be no more than 30000 feet in absolute value.

See Also