Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

copy 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()
Source by forum.dynamobim.com #
 
PREVIOUS NEXT
Tagged: #copy #element #dynamo #revit
ADD COMMENT
Topic
Name
2+3 =