Hello to all,
I would like to ask for help with my simple script that is designed to number parking space families in Revit. I have a project containing only parkign spaces and the goal is to have a method of numbering and possibly renumbering these families in the future when one of them is deleted or their layout gets modified. These parking slots are in multible building blocks, however their number sequence is based on a spline as showed in the attached project. I would like to define the first instance and then let the script number the rest based on the sketched spline.
The script is somewhat working, it overwrites the selected parameter with the correct number code as defined in Dynamo, but does so only to a few instances and disregards the spline for some reason. I guesss there are some issues with the bounding boxes and their intersections with the spline, but unfortunately I am not so skilled in Dynamo and cannot find the issue.
Thank you for any help!
Thank You for Your reply, I will loook into it.
So I am not a fan of the ‘many point’ test for re-numbering stuff. It’s slower then it need be as you need to test 100’s of bouding boxes for containment of 1000’s of geoemtry elements, and when you get one element with multiple boxes that will renumber things randomly. It will also cause things to fail when you have changes in height - say a parking garage where the left and right side are a half level offset, or one which is two stories high. In such cases you need to offset the height of your spline, which is hard to do with Revit.
Instead I recommend using a “parameter at point” numbering method. Draw your spline as before, trying to keep part of the spline as close to the center of the spots as possible. Then get the mid point of every spot, and use a Curve.ParameterAtPoint node to identify the ‘relative distance’ along the curve that each spot is located. This means you have one test per spot instead of 1000’s of tests, and since you’re grouped you’re good to go with levels too.
However in your case you’ve got multiple levels per ‘spline trace’, and they may or may not be ordered according to elevation. This makes me think you might want to group by something other than level (story above might make sense, but you haven’t populated that parameter…), or otherwise alter how you do the collection (all elements of category in view perhaps, then using a different spline in each view would work).
For now this should get you started :
@jacob.small Hello. I am sorry for the late answer, I just got back from my vacation. Thank You very much for the script, it works prefectly well. Do You think it could be tewaked so that the numbering sequence is continuous for all the elements? I need the numbers to disregard their placement in a certain block, see the attached scheme. I hope it is somewhat understandable, if not, please let me know. Thank You again and also happy birthday ![]()
EDIT: I have moved all the elements into a global level and given them an offset. This way the script works well as I need it to. Thank You @jacob.small again.
You could also have built a surface by lofting the curve, found the point on the surface, converted to a UV, and then used the U parameter to sort.
The difficult bit with that (and the ‘flattened’ design method) is when you get to multiple levels (which you had in the original model I opened) as spot 1 would actually have two spots with the same parameter value, resulting in the sequence “1 2 3 4 5 6” actually reading as “1 3 5 8, 9 11” based on if you made the upper or lower level first.
Hi Guys, Firstly, thanks for the graph - it worked really well. Can anyone tell me why a couple of the desk numbering don’t follow the spline correctly ? I can’t work out why the jump in the numbering - the spline goes cleanly through the desks - and has a clear start/end point.
Any help would be appreciated.
Here’s the direction of the spline - and the direction i wanted:
2 - 1
4 - 3
Unfortunately, the numbering has returned:
2 - 1
3 - 4
Secondly, the end desks, don’t follow the numbering at all
First issue is that the Scale factor is set to 1, not 1/2. As a result you’re moving the minimum point to the maximum point, not half way between the minimum point and the maximum point.
And so the closest point on the curve isn’t the ‘centroid’ of the desk, and so the parameters aren’t where you expect them to be.
The second issue is that because you’re using bounding boxes the ‘centroid’ isn’t being identified around ‘where the geometry is’ but 'where everything is. Select ONE desk and look at how large the bounding box is compared to the geometry for an indication of the scope of that problem. Combining this with the scale factor means the x value of the point you sued for desk 24 is closer to the center of desk 23 than desk 24. Usually things being off this far is a result of nested families with incorrect insertion points, but I can’t confirm the root cause for you without a dataset.
Instead of bounding boxes you may want to consider using insertion points, but even that can require a greater level of refinement than your dataset may want to provide. Switching to a ‘mailman sequencing’ or other renumbering strategy may be in order.
Food for thought / slightly off-topic.
Sometimes i find using Splines very fiddly.
Especially in cases like yours.
I like to use a node which you can make you selected in order.
It keeps the list, in Dynamo, in de order you picked.
I (only) use the Spline method for like numbering parking spaces.
If it is only like 1-20 Elements i use the ‘pick in order’ node.
Thanks for the idea with the numbered model per click option - I didn’t know this existed - worked perfectly.





