示例#1
0
        public bool AddSheet(ViewSheet sourceSheet)
        {
            if (sourceSheet != null)
            {
                string n = GetNewSheetNumber(sourceSheet.SheetNumber);
                string t = sourceSheet.Name + SheetCopierConstants.MenuItemCopy;
                ViewHosts.Add(new SheetCopierViewHost(n, t, this, sourceSheet));
                return(true);
            }
            return(false);

            // FIXME add error message,
        }
示例#2
0
        public SheetCopierViewHost GetFirstModelHost()
        {
            var modelHost = ViewHosts.Where(s => s.Type == ViewHostType.Model);

            if (modelHost.Count() > 0)
            {
                return(modelHost.First());
            }
            else
            {
                var newModelHost = new SheetCopierViewHost(this);
                ViewHosts.Add(newModelHost);
                return(newModelHost);
            }
        }
示例#3
0
        public bool AddView(View view)
        {
            if (view.ViewType == ViewType.ProjectBrowser)
            {
                var selection = uidoc.Selection.GetElementIds();
                foreach (var id in selection)
                {
                    var projectBrowserView = doc.GetElement(id);
                    if (projectBrowserView is View)
                    {
                        var v = (View)projectBrowserView;
                        if (v.ViewType == ViewType.ProjectBrowser)
                        {
                            continue;
                        }
                        AddView((View)projectBrowserView);
                    }
                }
                return(true);
            }

            if (view.ViewType == ViewType.DrawingSheet)
            {
                if (view != null)
                {
                    var    v = view as ViewSheet;
                    string n = GetNewSheetNumber(v.SheetNumber);
                    string t = v.Name + SheetCopierConstants.MenuItemCopy;
                    ViewHosts.Add(new SheetCopierViewHost(n, t, this, v));
                    return(true);
                }
                return(false);
            }
            else
            {
                var modelHost = GetFirstModelHost();
                modelHost.ChildViews.Add(new SheetCopierView(view.Name, view, this));
                modelHost.Title = "<" + modelHost.ChildViews.Count.ToString() + " Independent Views>";
                return(true);
            }
        }