Unexpected deletion of elements running a script a second time

I have created a simple dynamo script that allows the user to select a chain of lines in Revit and it calculates the length and places a text node with the length of the chain. I use python script from SteamNodes Tool.GetRevitSelection to get the selected lines from Revit, and then it’s pretty straight forward to add the lengths and place a text node with the value. I also added an integer slider at the front end to “refresh” the script so I could make a new selection and run the script again without having to close dynamo and open the script again.

Running the script works as expected the first time. I see text with the length of the path. But when I select the second path,refresh the script by clicking the integer slider, the script runs and gives the new length, but the previously selected path is deleted. If I close dynamo and reopen between selecting the paths, there isn’t an issue. Anyone have any ideas as to how I can prevent the deletion of the previous selection?

Hey that is annoying problem for the long time , dynamo cache the result all the time , i wish dynamo have a node to clear that after the run go through.

For my way to deal with it , was Undo [Ctrl+Z] and Redo [Ctrl+y ] on Revit project after dynamo go through.

then the next time dynamo is work again with out <span style=“font-weight: 300;”>deleted anything.</span>

i hope there have a better idea for this problem .

Thanks for the reply Johnes, I tried Undo and Redo on my file and it didn’t work. I guess for now, closing and reopening Dynamo will have to suffice.

Hi guys, I use the Dynamo player to solve this problem. It seems to do a good cleanup after starting the script for the first time. I hope however that someone will solve this boring topic. Thanks