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);
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);
HI @ICON-MIJ
Kindly use Transform.Identity instead of GetTotalTransform()
ElementTransformUtils.CopyElements(sourcedocument, linkedElements,doc, Transform.Identity, new CopyPasteOptions());
Hope this will Helps 🙂
HI @ICON-MIJ
Kindly use Transform.Identity instead of GetTotalTransform()
ElementTransformUtils.CopyElements(sourcedocument, linkedElements,doc, Transform.Identity, new CopyPasteOptions());
Hope this will Helps 🙂
Have you tried by removing the CopyPasteHandler?, Create Directly by new CopyPasteOptions().
And Which element you're trying to copy?
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
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
Which Element you're trying to copy?
Which Element you're trying to copy?
It's working on other elements such as walls, floors, furnitures but not on Scopeboxes
It's working on other elements such as walls, floors, furnitures but not on Scopeboxes
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();
}
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.