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
@jacob.small
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.
Thanks @jacob.small . 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.
@jacob.small 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.
@jacob.small 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
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.
@jacob.small Sir, I tried something like this:
TransactionManager.Instance.TransactionTaskDone();
TransactionManager.Instance.EnsureInTransaction(doc);
//createRails = new Autodesk.Revit.DB.SubTransaction(doc);
//createRails.Start();
//some code calling FamilyInstance.ByGeometry by Spring
//createRails.Commit();
TransactionManager.Instance.TransactionTaskDone();
And my Zero-Touch node still delete the instances created by first running:
I even tried subtransaction, as comment in my code, and it doesnât work neither.
Iâm sure itâs the last âDynamo-51297CB5 Scriptâ that deleted the instances created in the first running, cause when I UnDo the last additional âDynamo-51297CB5 Scriptâ operation, the instances created in the first running came back.
Could you please tell me what did I miss.I think Iâm quite close to my purpose. Thank you very much!
BTW Iâm restricted to revit 2018and no heigher version
Hi,
@john_pierson made a video about this.
Never had issues with his Zero-Touch node and element binding.
Hope this helps.
Iâm restricted to Revit 2018and no heigher version. Look like Dynamo 2.5+ has the functionality shown in the vedio. And walk around please?
See this post and the linked content: Element Binding in Revit
@sascari If you want to auto-delete the element binding in your .dyn you can use my batch and powershell code from here:
Thank you sir and so much! Now I totally understand!