# Number Sequence By Curve

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?

If the lines and points were created in the correct order it would make things really easy. Where are you getting your geometry from?

You can also check out this post for ideas.

Nick,

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.

Thanks

How are the curves generated? If the curves are created in the correct order, the points should also be generated in the correct order.

These nodes will take your original curves and reorder them (clockwise) so it should get you your curves in the correct order.

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.

1 Like

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?

Thanks for your help, it’s much appreciated.

Can you post an image of how you’re getting the points and the curves they’re on? That might help me figure out how to sort them.

Here’s one option that might work.

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):

2 Likes

Thomas,

I tried to recreate your script, but I keep getting the following error. Not sure what I’m doing wrong. Any ideas?

Connect the output from the `PolyCurve.Curves` node into the curve input of the `Curve.PointAtCordLength` node.

@josephprouty See if this helps…
GroupingAndSequencingPointsByCurve.dyn (13.3 KB)

Shuffled Points…

Grouped and Sorted…

2 Likes

That did it. Thank you, sir.,

Interesting way to go about sorting remote points. May come in handy for some other scripts that are in the works.

Thanks Vikram

2 Likes