Revit ElementTransformUtils.CopyElements returns ids of null elements ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using the Autodesk.Revit.DB.ElementTransformUtils.CopyElements method defined here:
https://www.revitapidocs.com/2016/b22df8f6-3fa3-e177-ffa5-ba6c639fb3dc.htm
This copies an element list from a document too another document.
I surprisingly found that when I copy the elements the command runs without errors ok and returns a list of ids.
Running the snippet below you my code prints the "Element is null" in my console multiple times.
It turns out that some of the elements of those IDs are null. Looking at the IDs sequence, I found that the elements from the source model which have the same sequence with the element IDs of the destination model which are missing, are doors elements.
It seems that elements were created (that is why the "CopyElements" methods returns the Element Ids), however, those probably gets deleted. Would that be a case that all hosted elements are null from this list? If yes, how can I get their ID of the hosted copied elements?
using (Transaction tx = new Transaction(doc_Source, ("copying elements ")))
{
tx.Start();
CopyPasteOptions copy_paste_options = new CopyPasteOptions();
translation = new XYZ();
transform = Transform.Identity;
ElementIDs_Destination=Autodesk.Revit.DB.ElementTransformUtils.CopyElements(doc_Source,ElementIDs_Source, doc_Destination, transform, copy_paste_options
);
tx.Commit();
foreach(ElementId i in CopiedElementsIDs)
{
if (doc_Destination.GetElement(i)== null)
{
Debug.Print("Element is null")
}
}
Let me know if anyone wants more clarification or information to provide for this issue.
Any answer or similar experience will be really appreciated.
Many thanks,
Alex