public void DuplicateViewOntoSheet( SheetCopierView view, SheetCopierViewHost sheet, XYZ sourceViewCentre) { var destViewId = DuplicateView(view); if (Settings.Default.DeleteRevisionClouds) { DeleteRevisionClouds(destViewId, doc); } var elem = doc.GetElement(destViewId); if (elem == null) { return; } var v = elem as View; string newName = sheet.GetNewViewName(view.OldView.Id); if (newName != null) { v.Name = newName; } else { SCaddinsApp.WindowManager.ShowMessageBox("ERROR", "New view name could not be set to: " + newName); } TryAssignViewTemplate(v, view.ViewTemplateName, view.OldView.ViewTemplateId); PlaceViewPortOnSheet(sheet.DestinationSheet, destViewId, sourceViewCentre); }
public void CreateViews(SheetCopierViewHost host, StringBuilder summaryText) { Dictionary <ElementId, XYZ> viewPorts = null; if (host.Type == ViewHostType.Sheet) { viewPorts = GetViewportDictionary(host.SourceSheet, doc); } foreach (SheetCopierView view in host.ChildViews) { if (host.Type == ViewHostType.Model) { var id = DuplicateView(view); var elem = doc.GetElement(id); if (elem != null) { var v = elem as View; string newName = host.GetNewViewName(view.OldView.Id); if (newName != null) { v.Name = newName; var msg = " View: " + view.OldView.Name + " copied to: " + newName; if (summaryText != null) { summaryText.Append(msg + Environment.NewLine); } } else { SCaddinsApp.WindowManager.ShowMessageBox("ERROR", "New view name could not be set to: " + newName); } } } else { XYZ sourceViewPortCentre = null; if (!viewPorts.TryGetValue(view.OldId, out sourceViewPortCentre)) { } else { switch (view.CreationMode) { case ViewPortPlacementMode.Copy: DuplicateViewOntoSheet(view, host, sourceViewPortCentre); break; case ViewPortPlacementMode.New: PlaceNewViewOnSheet(view, host, sourceViewPortCentre); break; case ViewPortPlacementMode.Legend: PlaceViewPortOnSheet(host.DestinationSheet, view.OldView.Id, sourceViewPortCentre); break; } } } } }