Message 1 of 2

Not applicable
03-22-2020
10:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys,
I managed to copy views from one Document to another, with all the annotation content on the view - however, as a result I get 2 views in destination Document (one with annotation, one without). Any hints, how to get only one with annotation?
foreach(T view in AllViews)
{
IList<ElementId> copyIds = new List<ElementId>();
copyIds.Add(view.Id);
// put view-specific elements on the view in the copyIdsViewSpecific collection
IList<ElementId> copyIdsViewSpecific = new List<ElementId>();
foreach (Element e in new FilteredElementCollector(doc).OwnedByView(view.Id))
{
// viewports and sunandshadowsettings cannot be copied
if (!(e is Viewport) && !(e is SunAndShadowSettings))
copyIdsViewSpecific.Add(e.Id);
}
Transaction t = new Transaction(otherDoc, "Copy View");
t.Start();
ICollection<ElementId> copiedElements = ElementTransformUtils.CopyElements(doc, copyIds, otherDoc, Transform.Identity, new CopyPasteOptions());
T newView = otherDoc.GetElement(copiedElements.First()) as T;
ElementTransformUtils.CopyElements(view, copyIdsViewSpecific, newView, Transform.Identity, new CopyPasteOptions());
t.Commit();
}
, how to
Solved! Go to Solution.