Hi All,
following a discussion here. im experiencing odd result . The copied elements are not in the same location as the linked mo...
Reference reference = uidoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element);
RevitLinkInstance revitLinkInstance = doc.GetElement(reference) as RevitLinkInstance;
Document sourcedocument = revitLinkInstance.GetLinkDocument();
ICollection<ElementId> linkedElements = new FilteredElementCollector(sourcedocument)
.OfCategory(BuiltInCategory.OST_VolumeOfInterest)
.WhereElementIsNotElementType().ToElementIds();
CopyPasteOptions copyOptions = new CopyPasteOptions();
copyOptions.SetDuplicateTypeNamesHandler(new CopyUseDestination());
ElementTransformUtils.CopyElements(sourcedocument, linkedElements,doc, revitLinkInstance.GetTotalTransform(), copyOptions);
Have you tried by removing the CopyPasteHandler?, Create Directly by new CopyPasteOptions().
And Which element you're trying to copy?
I tried the following:
1. Copy without handler
2. Manual Copy form document to document via UI
3. Via Dynamo
and none works for me...very strange..I'm copying scope boxes
No For me its Wokring Fine. I use same code only.
Reference GIF:
Reference reference = revitUIDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element);
RevitLinkInstance revitLinkInstance = doc.GetElement(reference) as RevitLinkInstance;
Document sourcedocument = revitLinkInstance.GetLinkDocument();
ICollection<ElementId> linkedElements = new FilteredElementCollector(sourcedocument)
.OfCategory(BuiltInCategory.OST_VolumeOfInterest)
.WhereElementIsNotElementType()
.ToElementIds();
using (Transaction createTransaction = new Transaction(doc, "Create Transaction"))
{
createTransaction.Start();
ElementTransformUtils.CopyElements(sourcedocument, linkedElements, doc, Transform.Identity, new CopyPasteOptions());
createTransaction.Commit();
}
Can't find what you're looking for? Ask the community or share your knowledge.