Reorder or rename Doors and Windows Instant Mark in Revit using dynamo

Hello Everyone.
I have build a dynamo graph to reorder/rename my doors and windows instant Mark parameters.

So in this graph I have two inputs

  1. A boolean to select either a door or window category
  2. A dropdown input to select the door or window type to reorder the Mark parameters of all the instances of the type.
    My doors and windows types are names as D1, D2, D3… and W1, W2, W3… respectively

The graph works fine but has a limitation in the sense that I have to run the grash as many times as the number of door and window types I have in the revit project.

I need to take it to a step further, where I will run the graph only once to reorder all the Instant Mark of all the door types and window types in the model.

I’m new to Python, and I’m sure I will need to perform a For Loop and Setparameter definition to achieve this.

I have also attached the dyn file and also screen shots
Anyone with a solution can help me out.

Thanks in advance

19_ReOrder_Doors_&_Windows_Marks_Data-Shapes.dyn (62.6 KB)

Hi @MaKarf,
See if this works for you:
19_ReOrder_Doors_&_Windows_Marks.dyn (36.0 KB)

I wouldn’t recommend jumping into Python alternatives all the time.
Sometimes the easiest solutions are obtained by just using the OOTB nodes.

For instance,
I don’t see a need to use a for loop here or even Python.
image
You could have just used a simple code block or an OOTB node

3 Likes

Thanks very much @AmolShah, your solution worked like magic. I actually was able to try it right now. Sorry for the delay in my response.
Thanks once again

1 Like

Hello @AmolShah, please can you briefly explain to me the script in the code block. Especially the ? Symbol, what does is really mean in the design script. Also the 0:1, what it means.
Thanks

It’s how you write a if condition in a DesignScript
condition ? ifTrue : ifFalse

So you use a condition to get the index (0 or 1) and then just like you do x[0] or x[1] to fetch something from the list x.

1 Like

@AmolShah
Thank you very much
Please is there anything like Design script primer like that of Dynamo primer to be downloaded. Any other resource to boost my DesignScript language is also appreciable

Check out these topics for more resources on learning about DesignScript:

1 Like

Thanks very much @AmolShah for the resource. I’m really grateful

1 Like

@MaKarf Also, by no means I would discourage you to learn python.
It’s very efficient and I would definitely recommend that you dive deeper in it.

What I wanted to highlight is you should be careful in making a proper selection as to which method is more efficient for a given problem? OOTB nodes or DesignScript or Python?

Don’t just blindly stick to enforce 1 method in your workflows. Just aim for efficiency and you would do good.

Cheers!

2 Likes

Thanks for the tips

Hi Amol, Thank you for your answer. May I please ask from which package I can find the node element.sortbylevelandparameter? Thank you very much

@ben.huynh That would be Zebra package.
image

1 Like