Пример #1
0
        public override void Execute(object parameter)
        {
            var context = parameter as LayoutDesignerContext;

            if (context == null)
            {
                return;
            }

            var layoutTreeView = new LayoutTreeView(context.LayoutDesigner);

            context.LayoutDesigner.SetView(layoutTreeView);
        }
Пример #2
0
        public PageTreeViewItem([NotNull] LayoutTreeView layoutTreeView, [NotNull] PageModel page)
        {
            Assert.ArgumentNotNull(layoutTreeView, nameof(layoutTreeView));
            Assert.ArgumentNotNull(page, nameof(page));

            LayoutTreeView = layoutTreeView;
            PageModel      = page;
            Text           = "Layout";
            Icon           = new Icon("/Resources/16x16/View-Web-Layout.png");

            Loaded += ControlLoaded;
            PageModel.PropertyChanged += HandlePropertyChanged;

            RenderLayout();

            IsExpanded = true;
        }
        void group_SelectedPageChanged(object sender, LayoutTabPageChangedEventArgs e)
        {
            LayoutControlItem layoutControlItem = e.Page.Items[0] as LayoutControlItem;
            LayoutTreeView    tree = layoutControlItem.Control as LayoutTreeView;

            if (tree == null)
            {
                return;
            }
            foreach (BaseLayoutItemTreeNode item in tree.Nodes[0].Nodes)
            {
                EmptySpaceItem esItem = (item as BaseLayoutItemTreeNode).Item as EmptySpaceItem;
                if (esItem != null)
                {
                    item.Text = "\"" + esItem.CustomizationFormText + "\""; //customize captions here
                }
            }
        }
Пример #4
0
        public void CreateTransmitallFromLayout()
        {
            string fileName = (string)Application.GetSystemVariable("DWGNAME");
            string path     = (string)Application.GetSystemVariable("DWGPREFIX");
            string allPath  = Path.Combine(path, fileName);

            Active.Database.SaveAs(allPath, true, DwgVersion.Current, Active.Database.SecurityParameters);

            List <Sheet>          sheets = new List <Sheet>();
            LayoutModelCollection layoutModelCollection = new LayoutModelCollection();

            layoutModelCollection.ListLayouts("Model");
            string[] blockNames = { "ФорматM25", "Формат" };
            using (Transaction trans = Active.Database.TransactionManager.StartTransaction())
            {
                DynamicBlockFinder dynamicBlocks = new DynamicBlockFinder(layoutModelCollection)
                {
                    BlockNameToSearch = blockNames
                };

                dynamicBlocks.GetLayoutsWithDynBlocks(trans);

                layoutModelCollection.DeleteEmptyLayout();

                var blocksList = layoutModelCollection.LayoutModels.Select(x => x.BlocksObjectId).ToArray();
                if (blocksList.Length == 0)
                {
                    return;
                }

                layoutModelCollection.SetPrintModels(trans);
                layoutModelCollection.SetLayoutPlotSetting();
                trans.Commit();
            }

            using (Transaction trans = Active.Database.TransactionManager.StartTransaction())
            {
                string[] viewNames      = { "Форма 3 ГОСТ Р 21.1101-2009 M25", "Форма 3 ГОСТ Р 21.1101-2009" };
                var      packageCreator = new PrintPackageCreator(layoutModelCollection, viewNames);

                LayoutTreeView window = new LayoutTreeView(packageCreator.PrintPackageModels);
                Application.ShowModalWindow(window);

                if (!window.isClicked)
                {
                    return;
                }

                var printPackages = window._printPackages;
                packageCreator.PrintPackageModels = printPackages;

                packageCreator.PublishAllPackages();

                var blockIds = printPackages.SelectMany(x => x.Layouts.Select(y => y.BlocksObjectId)).ToArray();

                Utils utils = new Utils();
                GetSheetsFromBlocks(Active.Editor, sheets, trans, new ObjectIdCollection(blockIds));

                utils.CreateJsonFile(sheets);
            }
        }