- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everybody,
As mentioned in the title, I want to compute the deviations between points belonging to a point cloud and a wall and display the deviations with a colormap. I already managed to do the following steps:
1. Prompt the user to select a wall and a point cloud
2. Filter the points located in a given distance of the wall (to select points of interest)
PointCloudFilter filter = PointCloudFilterFactory.CreateMultiPlaneFilter(planes); PointCollection points = pointCloudInstance.GetPoints (filter,0.000001,999999);
3. Calculate the distances between the collected points and the wall using a foreach loop and the ReferenceIntersector class
List<double> list = new List<double>();
foreach (CloudPoint point in points)
{
XYZ tpoint = trf.OfPoint(point);
double length = CalculateDeviation(doc, wall, tpoint, orientation);
list.Add(length);
}
private Double CalculateDeviation(Document doc, Wall wall, XYZ origin, XYZ rayDirection)
{
FilteredElementCollector collector = new FilteredElementCollector(doc);
bool isNotTemplate(View v3) => !(v3.IsTemplate);
View3D view3D = collector.OfClass(typeof(View3D)).Cast<View3D().First<View3D (isNotTemplate);
ElementId eid = wall.Id as ElementId;
ReferenceIntersector refIntersector = new ReferenceIntersector(eid, FindReferenceTarget.All, view3D);
ReferenceWithContext referenceWithContext = refIntersector.FindNearest(origin, rayDirection);
if (referenceWithContext != null)
{
Reference reference = referenceWithContext.GetReference();
XYZ intersection = reference.GlobalPoint;
double length = intersection.DistanceTo(origin);
return length;
}
}I manage to calculate the deviations but since I would like to calculate deviations for as much as possible points (numPoints = 999999 for the GetPoints method of pointCloudInstance) to see small deformations, it takes really a long time.
I started programming in C# only two weeks ago so my first question is can I reduce the time required for the calculation of deviations either by modifying some functions or using an other method.
Moreover, I would like to display the deviations by applying a custom colormap to points. I already have a look at the help documentation (PointCloudColorSettings and PointCloudColorMode) but I’m not sure I can do that. Do you have any idea if it’s possible or not?
Thanks in advance,
Hélène
Solved! Go to Solution.