How can I go about using Dynamo to number my elements in sequence based on the curve used to generate the element?
(See the below image for more clarification about the number sequence I’m trying to achieve.)
Not sure if that makes things easier, but each of these elements were placed in the model using the FamilyInstance.ByPoint node, which derived the points based on the same curve I attempting to use to do the numbering.
I can get the elements to number in sequence, but I’m unable to get them to number in sequence based on the curve it is located on. Any ideas on how I can go about accomplishing this?
I’m generating the Points along the curve based on certain rules for the spacing, then I’m projecting those points to a topography and placing my elements at those points.
That’s been part of the problem that I have been running into, since the points are not technically on the curve after they were projected to the Topography, so I cannot use the Geometry.DoesIntersect node or anything of that sort.
In regards to the suggested article, it’s similar to what I’m trying to achieve but he is sorting them based on a Level. But unfortunately he doesn’t need or even want to know which curve the point is hosted on.
But it did give me some ideas to play around with. I’ll let you know if I’m able to figure it out.
Thank you for the script. My issue is not with the order of the points though, I can get them to number in the correct order. The part in which I’ve hit a wall is when it comes to trying to get the elements to know which curve it is closest too and number in sequence based on that curve.
See the below image of my sketch and where I’ve ran into trouble associating the curves with the points.
Can you run Geometry.DoesIntersect before you project your points? It seems like it would be best to get the points all figured out first. Then you can project the onto the topography and create elements after the fact. After that, it’s just setting the parameters for the new elements.
Yes, I could do that. But how do I go about breaking up the list of points by curve? That’s where I’m at now… I’ve got my points and the curve that they are on.
But for the life of me I cannot figure out a way of telling Dynamo that I want to break up the list of points into sublists based on the curve they are on. Any ideas?
By the look of your diagram, it appears that you need your spacing to be as equal as possible on each line. This means using a parameter to define the point locations isn’t viable as it fixes the count, not the distance.
In addition, your lines may not always be in order and this should be a priority since ordered lines will automatically result in ordered points in sublists. Using PolyCurve.ByJoinedCurves and extracting the curves back out again is an effective way to achieve this without any complex processing. Then its a simple case of evaluating each line and spacing points according to a predefined distance.
Using the ~ symbol in a DesignScript sequence will find the nearest even divisor within the given range. The result will look like this (you will need to do some more list management on the final sequence to retain the final point):