Script removing previously created elements

Howdy, I made this sheet setup thing. I ran it the first time doing floor plans, elevations, sections. When I ran it the second time to get some more views. It deleted the sheets of floor plans and the sections view and sheets but left the elevations. I thought maybe it was a memory overwrite thing. So I closed Revit and it did the same thing after opening again. I’m pretty sure there’s nothing in the script that should be deleting anything. The script is rather large if anyone cares to take a look and sorry havn’t been exactly tidy with grouping in this one.

I think this is saved in R25, which is the one that deleted stuff on the second go
Packages
Vanning
Latest Datashapes
Latest Ironpython
Sheet Setup.dyn (949.4 KB)

An older one in R23 I think which I don’t remember it deleting anything on a second run.
Sheet Setup.dyn (929.7 KB)
Packages,
Vanning,
DataShapes - 2024 version or something
Iron python, 2.5 I think for data shapes to work

Read the post on Element Binding as the issue is there.

Thanks Jacob. Wasn’t to sure about a couple of things after reading the element bindings post.

It seems OOTB nodes can create element bindings?
image

Will running in dynamo player still have element bindings? Seems to be a yes after testing

Will it make new bindings if you delete them from the dyn text file after running again?

Is the the right selection to delete?

Many thanks! :smiley:

Yes - any node can create bindings if the author configured it to.

Player doesn’t serialized any bindings as the graph isn’t saved on update. However if bindings exist those elements will be replaced rather than new ones created. Best practice is to clear bindings before saving for use in player.

Any time you create elements bindings will be made. If you save the file they will be kept.

Tiiiiiny tiny tiny text to read on a phone… but you’re close. Use a better text editor (i.e. notepad++) or something which makes json editing easier. Basically you want the first line to read Bindings: [], with the square brackets opened and closed. All of the curly braces stuff between the open square bracket and the trailing one (not shown) can be removed. Note that if you mess this up you won’t be able to open the file again, so start with a ‘save as’.

1 Like

Amazing thanks, feeling confident around this whole element binding and handling now. Only thing I’m pondering is how I configured a node to have bindings?

All OOTB element creation nodes have bindings by default. If you run a graph that makes a thing and then save the graph you serialize the bindings into the file.

1 Like