Sort Points in PointCloud by Specific Angles to create Lines by Line.ByBestFitThroughPoints

Hi everyone,

I have a PointCloud inserted into Revit and I would like to get clean Cross Sections for further usage in Revit/ Dynamo. Since the PointCloud isn’t perfect (It never will be) some creative solutions have to be found.

Probably the best workflow I found so far is a modified/ inspired version of this Forum Post by @Ewan_Opie : Sort point cloud XYZ - to best fit lines - #6 by Ewan_Opie

The main Idea/ Workflow is as follows:

  1. The PointCloud gets cut into Cross Sections by BoundingBoxes, I used Revit Masses for that for now. This results in a Section of the PointCloud loaded into Revit.
  2. From here is a Plane created and are Points sorted around the Normals of that Plane/ It’s local CoordinateSystem. This results in clockwise sorted Points.
  3. Now these Points need to be split up into different lists according to their angle, see my handdraw image below on how this should look.
  4. When these groups are created Lines can be easily created by using the node Line.ByBestFitThroughPoints.
  5. At last each of these lines get extended to get their intersections, from these intersections a new PolyLine perimeter can be obtained and we’re done!

I have worked out a simple Dynamo Script. However in this script have I manually determined which Angles correspond to the PointCloud. In example: I used 0-38 and 313-360 degrees for the horizontal points and 42-68 degrees for the diagonal points (See CodeBlocks in image below).

I am now still looking for a way to automate this step as to have a completely automatic script.

Testing results:



Files:

PointCloud: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free (401 MB)
Revit Model: Testmodel PointClouds losstaand.rvt (1.6 MB)
Dynamo File: Point Cloud - Best Fit Lines Test.dyn (55.2 KB)

1 Like

I would approach this a bit differently.

Attempting to convert a point cloud to design data requires a degree of flexibility on the initial inputs as any point cloud data set will vary from the ‘ideal’ shape for design due to the nature of laser scanners and construction.

  • Relative accuracy is good, but specific accuracy won’t necessarily be
  • You so you can’t assume the scan will have found the corner where you’ve pulled the profiles
  • We conceputalize things as ‘straight’ but they aren’t, and lasers see those ‘bows’.

As such a ‘guided’ tool is likely better than a ‘do the work for me’ tool.

From your point 2, I would build a SERIOUSLY NOT GOOD™ polycurve though the points. Then get the angle between each line and the line which proceeds it, and compare that to a tolerance. If that angle is more than your desired tolerance, keep the point; otherwise filter it out. This can take some really awkward profiles and straighten them out without too much compute, and can be iterated (inside the node or by placing it in sequence with increasing tolerance control) as desired. You can then incorporate a Point.PruneDuplicates or a Point.Average method to narrow closer in on the corners, or allow the user to make additional modifications as needed. This should get you GOOD ENOUGH TO MAKE DECISIONS™ polycurves, which can be further refined by subsequent processing.

I’ll take a pass at this tomorrow on a real dataset if you can provide the RCP, or later this week /sometime next week after I get recap set up, but initial testing seems promising (1000 point profiles to ~150 in under a half second with a Python node).

1 Like

Hi Jacob,

I looked into this (or a very, very similar) Workflow before changing to the “Angle Aproach”. However I couldn’t get it to work reliable. (That was the .dyn file I have sent you in our DM thread,different one than this thread). PointCloud Script V0.7.dyn (340.8 KB)

Perhaps a combination of both approaches could work!


I’ll take a pass at this tomorrow on a real dataset if you can provide the RCP.

In the topic I supplied a .pts-file, you can load that staight into ReCap :slight_smile: .

I’ll be working on it more today, i’ll post an update when I do something worthy sharing :smiley: .