Kopiuj element Dynamo Revit
import clr
import sys
import System
from System.Collections.Generic import List
# all imports and some code
# ...
# ...
# ...
# current_doc = ...
# ...
class CustomCopyHandler(IDuplicateTypeNamesHandler):
def OnDuplicateTypeNamesFound(self, args):
return DuplicateTypeAction.UseDestinationTypes
souceDoc = UnwrapElement(IN[0])
myElements = UnwrapElement(IN[1])
copyOptions = CopyPasteOptions()
copyOptions.SetDuplicateTypeNamesHandler(CustomCopyHandler())
# start transaction
TransactionManager.Instance.ForceCloseTransaction()
TransactionManager.Instance.EnsureInTransaction(current_doc)
myElementIds = List[ElementId]([x.Id for x in myElements])
newCopyElementIds = ElementTransformUtils.CopyElements(souceDoc, myElementIds, current_doc, None , copyOptions)
# rest of code
# ...
# ...
TransactionManager.Instance.TransactionTaskDone()
Sore Stork