Issue with element numbering script in Dynamo Revit

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!

@lozsi ,

check out this topic

3 Likes

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 :

2 Likes

@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 :slight_smile:

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.

1 Like

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.