Place new family instance each run

I am trying to create a graph, that would place new family instance in Revit in the given level and coordinates.
Now I’ve got this working (this is an example to illustrate the problem, in reality it’s more complex):

It works fine for the first run - the element is placed in the desired location.
Problems start, when I try to run it again, to place more elements.

So I changed input coordinates and ran the graph again. I was expecting to see a new element placed in the updated coordinates.
Instead what happened was the previously placed element was moved to some other location and no new elements were created.

It seems that Dynamo somehow ‘remembers’ the last item it placed and for all future placements uses that element. This persists even if the dyn file is reopened.
How can I reset this strange behavior?
I need to be able to place items, update the input coordinates and place more items.

Thanks in advance.

1 Like

Unfortunately you have to close and reopen the script

That doesn’t really help.
If I run the script, then save/close it, it still remembers the said information for the given Revit model. Even if entire Revit application is closed and reopened, the script still ‘remembers’ the placed element.

In this case, the only way would be to create and test the script on a special separate Revit test file. And then, when working in the actual working revit file, remember to never save the script file.

Is there no other way to resolve this?

If you close the script and reopen it you can place new objects without having dynamo delete the old ones. Anyways if you have a list of coordinates on which you want to place objects you can simply feed a list of coordinates all together, instead of doing them one at a time

Yes, but I can’t modify and save the script after the elements are placed.
Sure, I am already feeding entire list of coordinates into this, but I can never know if I won’t need to place additional elements few weeks later.

@Emi Why don’t you create a list of Family Types, Points and levels (assuming there are multiple levels) and place them all at once.
If I’ve understood your objective, that would be the proper way to go about it.

Oh ok maybe I understood. Correct me if I am wrong:
You have a list of n coordinates on which to place objects.
At some time you have to add elements, so you will have n+m elements.
You would like to run the script with all the n+m elements? If this is the case it’s best if you just run it for the new m elements.

Yes, that’s almost right:
I have list of n elements with coordinates, levels, parameter values, etc that I need to place in the Revit model. I run the script and place the elements.
Some time later I find out that I need to place additional list of m elements. So I would like to run the script again for the m elements only, without disturbing previously placed n elements.

Note that by then previous n elements might have already been edited a bit in Revit, so it wouldn’t be a good idea to delete them and place them anew together with m elements.

So I guess you should simply run a script and place the n elements, then after some time you will re-open your script, change some inputs to load only the m info and place corresponding elements.

There will be problems if I save the script after placing n elements, because the script will ‘remember’ those elements.
Later, even if I change input coordinates, the script will first move around the n elements and only when n elements run out (if the m element count is greater) will add additional m elements.

If I need to save the script after placing n elements, It seems that I need to open an empty placeholder Revit file and run the script to reassign the “element-memory” and save the script again.

Only then I will be able to place new m elements in the original rtv file without disturbing the n elements.

Could you post an image of your script? Dynamo shouldn’t behave like you’re saying, i.e. once you close and reopen the script, let alone Revit itself, it shouldn’t remember the last run

It “works” like that for the original script shown in the post image.
Just try it.
Run the script, save it, close it. Observe the placed element.
Then. Reopen the script, change some coordinate value and try to run it again.
It doesn’t place a new element, instead it moves around previously placed one.
Note sure what exactly resets it. Might be possible if some nodes are deleted and then re-inserted.

I’m running Revit 2016 with Dynamo 1.2.
Here’s the dyn file:
ExcelToRevit_v5_placeElements.dyn (8.3 KB)

I apologize, you are correct, I just tried it myself and it works as you say, while just some time ago it worked correctly. I tried it with some older versions of dynamo and the close/reopen trick worked. Don’t know why it’s happening ):

Thanks! Just out of curiosity, what versions of Dynamo did you try?
Maybe I can switch.

I tried with both 1.1 and 0.9.1 and the trick works.
Maybe someone knows why this is happening

After posting in github about this, I was told that this actually works as intended. I hope they will add a feature to break these links as well.

I think the link between Dynamo and Revit is stored in the dyn file if you save it after the first time you run it. Try to reopen the script without saving and see if that helps.

@Emi @GregX @Einar_Raknes I solved this before to one of the user. I will post soon the result.


… if you want to break this manually, you can delete the node serialization data inside the .dyn file… it will look like a bunch of random letters and numbers. tread carefully.

1 Like

I’ll be looking forward to that. Thanks in advance.