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.
Solved by Sean_Page. Go to Solution.
Check this post, I think you'll find the item marked as answer contains the answer your looking for.
Can't find what you're looking for? Ask the community or share your knowledge.