Copy elements between documents with same Project Base Point
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying via API to copy elements from one open document to another. They have the same project base point. However, on copying, the elements are not in the correct place. I assumed that using no Transform they would end up in the same place but it seems not. Is there a way to specify copying on Project Base Point?
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import BuiltInCategory as Bic
from Autodesk.Revit.DB import FilteredElementCollector as Fec
from Autodesk.Revit.DB import Transaction
import Autodesk.Revit.DB
docs = __revit__.Application.Documents
fmi = docs.ForwardIterator.__self__.GetEnumerator()
while fmi.MoveNext():
curDoc = fmi.Current
if (curDoc.Title.Contains("BASE")):
destDoc = curDoc
else:
sourceDoc = curDoc
columns = Fec(sourceDoc).OfCategory(Bic.OST_Columns).WhereElementIsNotElementType().ToElementIds()
txSource = Transaction(sourceDoc, 'Copy Columns')
txSource.Start()
txDest = Transaction(destDoc, 'Copy Columns')
txDest.Start()
ElementTransformUtils.CopyElements(sourceDoc, columns, destDoc, Transform.Identity, CopyPasteOptions())
txSource.Commit()
txDest.Commit()
I am using IronPython in RevitPythonShell.
Revit 2021.1
Windows 10
Link copied