I’ve a routine which places face based families over a select objects face – this works fine and places the families. But when I select another face and run the routine again it removed the previously created families from the model and places new ones on the new face.
I would like to keep all objects created.
Is there some sort of setting or node which will cause Dynamo to ‘release’ the objects it creates so that when the routine is run again on a different part of the model it simply creates more families.
This is intentional behavior. Imagine you modified the script cuz it didn’t make the elements at the right points, you would want the generated elements to disappear right? That’s why it works this way. To resolve this you have 3 options:
Force the creation of new elements every time using Python.
Close and reopen the script between runs.
Run the script via Dynamo player.
I like option 3 best, but option 1 is also rather nice.
mmm - that’s a bit frustrating… I can see that there are good reasons for this behavior, but there are also some instances where the user would want to turn off the ability.
As for the solutions you suggest:
I’m trying to avoid Python for the moment as the graph is almost there.
I’ve tried closing and reopening the script between runs - this option doesn’t work.
I don’t have Dynamo player as yet…
It seems strange that there is no option to turn this behaviors off?
@Kevin.Bell, there are actually two ways to workaround this behaviour:
a) Use python code to place family instances (like “family instance in transaction” node from the Bakery package);
b) Use groups: 1. Place your family instances with Dynamo; 2. Group these elements; 3. Run Dynamo graph again to place the next pack of elements (this is when Dynamo deletes all the previously placed instances); 4. Select your group and click “Restore All Excluded”.
@Kevin.Bell, one additional remedy for this is essentially copying the elements and breaking their association. Dynamo package beaker has a node called “Bake elements” that does this. (its a hit or miss when used on automatic though)
Is the issue of Dynamo retaining links to objects the reason why the Dynamo files I save suddenly get very big?
I created a graph to place some family instances, when I first used it to create 400 the Dynamo files was 87kb, I then increased the instances to 40,000 and the Dynamo file was 16.2MB after saving…
I need to run my Dynamo script until I’m satisfied with the instances created -hosted to a topo. surface; so, I want to avoid copying and pasting with additional re-hosting steps. Next, I want to leave them as-is and create a new set.
Run script for final instances
Save the Dynamo file
Find file folder and rename the filename with a new extension for opening in Notepad, e.g. “filename.dyn” becomes "filename.dyn.txt"
Open it in Notepad
Scroll down to the bottom to find the section "SessionTraceData"
Highlight and delete all the block of characters including the header text “SessionTraceData” all the way down to “/SessionTraceData” including that text and the “<” “>”, characters, too
Leave no extra blank lines
Leave the text “/Workspace” at the end
Save the edited file
(un)Rename it by removing the .txt you added earlier -ignore any error message about files becoming unusable or associated with another program because you are deliberately altering the file
Re-open the script and run a new set of instances unlinked to the previous set
Looks like a lot of steps and a little scary tinkering with the file innards, but it’s easy and convenient for me.
Thanks to all sharing their knowledge and the programmers pioneering Dynamo scripting for Revit. You people are saving thousands of mouse clicks!
glad it worked to you- although probably falls into the category of a nasty hack rather than a sound method.
(incidentally, you could just drag the .dyn file into notepad, rather than renaming & unrenaming to .txt)
It would be good if there was the ability to bake objects in the same way as Grasshopper- including ‘BakeName’
No idea of the file will allow write access in the same script as the one creating the geometry, as Dynamo will already have it open, but worth a shot right? Add it to the list of reasons we need to be able to access the path of the active dyn file inside of Dynamo if that does work.
This seems old but it still behaves in that underwhelming way for most of the cases you want resolve in Dynamo 2.0.3.
The most incredible thing is I can close Dynamo and the Revit file, I reopen again everything and I run to set different elements and it still deletes my old objects. So for some reason the file keeps all the information. I grouped them and they still were deleted within the group. The unique solution seems copy them.
This is VERY old. See here for information on element binding.
Getting used to element binding is a must for being above an intermediate level Dynamo user. I am teaching a course (and a replay course) on this at AU Vegas this year (search the course catalog for Pandora’s Box if you’re curious), where I’ll show as much of the advanced stuff as possible in the 90 minutes I have to demo in.