I came across a script from an old forum topic that changed the colours of floor/topography triangles when the slope exceeded a specified value. I’ve duplicated the script and updated a few parts to account for software changes since it was originally created.
However, I’ve now hit a roadblock. At a certain point in the graph, I receive the following error:
“Line.ByStartPointEndPoint operation failed. Unable to create Line. Points are likely coincident.”
I’m a bit stumped as to what’s causing it. My suspicion is that there may be some duplicate or overlapping points being generated somewhere in the process, but I haven’t been able to track it down.
The workspace is probably too large to export as a readable image, so I’ve attached the .dyn file instead.
I’d be very grateful if anyone could take a look and point me in the right direction. Any help would be much appreciated and might just stop my hair from going even greyer!
Heads up, the .dyn that came through is empty. It has no nodes, just a note that says “Populate with nodes…”. I think the wrong file got attached (maybe a save before the real one?). Can you upload it again?
While we wait, that error usually means a line is being built between two points that sit in the same spot. With floor/topo triangles, that’s typically one of these:
A triangle that is flat or degenerate (zero area), so the “slope” line has zero length
Duplicate vertices where neighbouring triangles share a point
To find the culprits, check the distance first and filter before building lines:
d = Point.DistanceTo(startPts, endPts);
keep = d > 0.001;
Then run keep through List.FilterByBoolMask on both point lists before Line.ByStartPointEndPoint. The out list will show which indices were the problem.
You could also skip the lines entirely and get the slope from each triangle’s normal:
would getting the topo points, then run it through a prune duplicate points, then rebuilt the topo from those points work? You might need to add a tolerance i.e for points that are very close
I also have a vague memory that you might get errors like this if a plane is vertical
I have attempted to copy your method but I have a similar issue as before but with the List.FilterByBoolMask this time. Any ideas what could be causing the code to not work at this point?
I have changed the slope angle to a steep slope of 1:3 to check if that would make a difference. Unfortunately is never.