How do I rerun my script and remove element binding (Revit)

How do I rerun my dyn on new elements without losing the old elements? How has this not been implemented in 2022

Try Monocle
It’s in the package manager
When installed there will be an option extra in the Help menu
You can also run your script on an empty Revit file (does nothing) and resave the script
Or run it on Dynamo player
There may be other options too
Correct me if i’m wrong here
@JacobSmall

1 Like

Thanks for the info @Marcel_Rijsmus . I’m running it through the Dynamo player which is a bit crude but it gets the job done.

Run through player or use function passing. There are options but the default is binding because even with binding on by default there are a few dozen models I see each day that have duplicated elements (with the matching warnings) as a result of someone trying to side step bindings and putting dozens of identical elements into the model.

Does that mean things slip by in my methods? Except player?
And what is “function passing” ?
(Not on God level yet.)

Remove the longest list input from the node which creates the elements (ie: a list of points in the FamilyInstance.ByPoint node), and you will see the node goes from a dark grey color unifications it is active, to a light grey color. If you look at the data preview of this node it will return “function”. This is one of the object types which we will pass onto the next node - passing a function.

Now place a Function.Apply node on canvas. This node has two inputs, one for the function we just made, and one for the argument (Like the List.Create node it can also be expanded, but that is for another day). Now take the data you disconnected from the last node (the list of points for our FamilyInstance.ByPoint node) and connect that to the argument input. Run the graph and you will see the elements are created.

Function.Apply (and similarly List.Map) do not create bindings, so if you run the graph again tomorrow and you will wind up with duplicate instances. This can be an advantage for a few, but really the best solution is to use Player or to use bindings to your advantage.

This also suppressed all warnings. This is nice for some instances (no users being worried about the warning message), but it also hurts as bulls mixed into your data will not show up until you do a deep manual review of the results.

This is however slow by comparison. This has to do with how functions are handled under the system, but the full ‘why’ is over my head and frankly not a concern to me, suffice to say I know about it and can tell others. Perhaps we will see an improvement with that speed in 2.13 or 2.14, but I am not aware of where this is on the development teams radar.

1 Like

Thanks @JacobSmall . I read through your other detailed post about bindings. While I understand the relevance to the platform, there are many instances where the process could benefit from something similar to grasshopper’s bake process which removes all the bindings. Sometimes one wants to run the same script but on different parts of the model for instance. Thanks for your explanations though, they are very helpful.

@JacobSmall on a similar note: how do I ensure that I am not filling the model with 1000s of instances? Would they be visible? Thanks!

Check your warnings and address any ‘duplicate elements. This should be done on every model 1x a week or more.

@JacobSmall Can you spell out the function apply for me again? I’m missing something. Even dynamo player is keeping the element binding so I’m not sure what to do at this point…

Just to vent a little, this whole element binding defeats the point of creating a reusable script. I had to duplicate all the nodes so that I can tweak two parameters and rerun the script on a separate segment of the model.

The element bindings are necessary otherwise running Dynamo in automatic mode wouldn’t work. A work around I like is to have the script select the newly created elements at the end of the run, if I don’t want them to bind then I’ll ‘ctrl-x’ , paste-aligned. Cutting and repasting unbinds them.

Hint: set up a shortcut for paste-aligned. eg. I type ‘ctrl-x,PA’ after a script has run

2 Likes

Run the reusable script via Dynamo player after stripping out the bindings. Done this way and the bindings never come into existence.

I’ll put a graph together on Monday showing the function passing.