Dynamo Script does not remember Beams created

I have a script that creates beams along the curves of a mass surface. However, after I close dynamo and rerun the script , instead of updating the previously created members, it simply creates a new set. the script currently ends with the StructuralFraming.Beambycurve node. so I was suspecting since there was no container to hold the output of that node the script will forget next time it reopens. Does anyone know why this happens?

However, one thing I noticed is I have beam systems that reference these beams and when i delete the previously generated beams that the system refers to and run the script to create a new set, the systems then refers to the new beams. Anyone have any idea why this happens? using this method to replace the disconnected beams with elements that the script updates has been an acceptable workaround, but would like to know more for future reference.

I’d think you’d have to save the elements’ IDs to an external file and read those data back in for that functionality.

I agree with @truevis as that’s the only viable solution at the moment.

I would also report this as a bug to Dynamo Dev team on their GitHub page: https://github.com/DynamoDS/Dynamo/issues

@truevis, @Konrad_K_Sobon thanks for the help!
But i dont really understand how to relink the ids,
the last node of script is the StructuralFraming.Beambycurve. when i restart the script, it will recreate the beams, so what node should follow or precede the StructuralFraming.Beambycurve node so that instead of recreating it will recognize the currently existing beams from external source of ids?


After your first run. What are you trying to update in your second run?

On the first run the script reads the edges of the mass and places the beams. After the creation of beams, i create a beam system that reference the beams.
During this first session the beams are updated if the mass is edited and the beam system is updated too, which is what i want. However on the second run, or second session, after i close everything and reopen, i hope that the script still remembers that the beams currently in the project are the product of the script and maintains the relationship, instead of recreating duplicates and the beam system are left referencing the previously created beams which have lost connection to the mass.

The workaround i mentioned suffices for this instance, but might not be for much larger projects.

Here’s an interesting thought experiment. You can try to manually “internalize” the elements into your graph. Let’s say you create some beams on the initial run. You then proceed to record their IDs as strings like so:

and paste the result into a new code block. Once the design has been revised, you fire up your graph once more, convert those id strings to revit elements with archi-lab’s node and modify their location and size like so:

One of the biggest limitations is that the number of beams has to remain the same between runs.


oh god that is fantastic!!! thanks alot dimitar.

thankfully the limitation you mention wont be a issue in this case because the end goal is to have the beam systems that i have manually created to adapt to the beams that the script created.

speaking of which, I had no luck finding any methods for creating beam systems in dynamo. is this not possible atm?

also as i mentioned, when i restart the project, which then is susceptible to the issue of the script not recognizing existing beams, something odd happens. before i launch dynamo, i can delete the previously created beams, which are highlighted in blue in the image i posted. then logically i would assume the connection between the beam system and the beams are lost. however after deleting them i can run the same exact script which recreates those beams, yet the beam system is still connected to the recreated beams.

this was my workaround until now, but im still curious why this happens. if the script that produced a set a unique elements before recognizes that the exact set does not exist in the project, does it recreate the set with the exact element id?

@Dimitar_Venkov I thought the same result yesterday :smile: Thanks Dimitar :+1: