Placing element - Node remembers elemt ID

I have a function that gets selected elements from a linked file and place one of my own objects in the same place. I run the script and it works fine. All the objects I wantet have been “copied”

The same function also have filters to check if that element is already “copied” and if it is in the same place. So when I rerun the function Dynamo uses a long long time and all the elements are deleted.

I guess it is so that the node that set out the objects remembers the elements ID, so that Revit and Dynamo are syncronized. It remembers even if Dynamo and Revit are restarted. So since the node that are to place out the objects now gets no input, it deletes the element.

Is there a workaround to “reset” the node that places out the objects?

Hi Rune,
Yes there is. I think your issue is similar to this topic Dear developers of Dynamo, why is this happening? - #2 by Kulkul

Hi,
Try this:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument


a = UnwrapElement(IN[0])
pts = IN[1]
c = []
d = []
for i in pts:
	c.append(i.ToXyz())


for i in c:
	TransactionManager.Instance.EnsureInTransaction(doc)
	fi = doc.Create.NewFamilyInstance(i,a,Autodesk.Revit.DB.Structure.StructuralType.NonStructural)
	TransactionManager.Instance.TransactionTaskDone()
	d.append(fi) 
#Assign your output to the OUT variable.
OUT = d

I think that worked perfectly:)
Thanks.