Exemplo n.º 1
0
        public void ListAttributes()
        {
            Dictionary <string, string> attrList = new Dictionary <string, string>();

            MainWindow window = new MainWindow(new BlockViewModel(attrList));

            Application.ShowModalWindow(window);

            if (window.isClicked == true)
            {
                //var objectIds = Utils.GetAllCurrentSpaceBlocksByName(window.NameBlock.Text);
                ObjectId           mSpaceId  = SymbolUtilityServices.GetBlockModelSpaceId(Active.Database);
                ObjectIdCollection objectIds = Utils.SelectDynamicBlockReferences(mSpaceId);

                List <Sheet>      dict        = new List <Sheet>();
                List <PrintModel> printModels = new List <PrintModel>();

                BlockAttribute objectNameEn = window.ComboObjectNameEn.SelectedItem as BlockAttribute;
                BlockAttribute objectNameRu = window.ComboObjectNameRu.SelectedItem as BlockAttribute;

                BlockAttribute position     = window.ComboBoxPosition.SelectedItem as BlockAttribute;
                BlockAttribute nomination   = window.ComboBoxNomination.SelectedItem as BlockAttribute;
                BlockAttribute comment      = window.ComboBoxComment.SelectedItem as BlockAttribute;
                BlockAttribute trItem       = window.ComboBoxTrItem.SelectedItem as BlockAttribute;
                BlockAttribute trDocNumber  = window.ComboBoxTrDocNumber.SelectedItem as BlockAttribute;
                BlockAttribute trDocTitleEn = window.ComboBoxTrDocTitleEn.SelectedItem as BlockAttribute;
                BlockAttribute trDocTitleRu = window.ComboBoxTrDocTitleRu.SelectedItem as BlockAttribute;

                AttributModel attributModel = new AttributModel(objectNameEn, objectNameRu, position, nomination,
                                                                comment, trItem, trDocNumber, trDocTitleEn, trDocTitleRu);

                using (Transaction tr = Active.Database.TransactionManager.StartTransaction())
                {
                    MyCommands.GetSheetsFromBlocks(Active.Editor, dict, tr, objectIds);
                    string selAttrName = "НОМЕР_ЛИСТА";
                    MyCommands.GetPrintParametersToPdf(Active.Editor, printModels, tr, objectIds, selAttrName);

                    if (window.transmittalCheckBox.IsChecked == true)
                    {
                        Utils utils = new Utils();
                        utils.CreateOnlyVed(dict);
                        utils.CreateOnlytrans(dict);
                        foreach (var printModel in printModels)
                        {
                            PlotCurrentLayout(printModel.DocNumber, printModel);
                        }
                    }
                    else
                    {
                        //Utils utils = new Utils();
                        //utils.CreateOnlyVed(dict);
                        foreach (var printModel in printModels)
                        {
                            //PlotCurrentLayout(printModel.DocNumber, printModel.BlockExtents3d, printModel.StampViewName);
                        }
                    }
                    tr.Commit();
                }
            }
        }
 private static void initProgressBar()
 {
     progressbar      = new ProgressBarFunc();
     progressbar.Left = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Left + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / 2 - progressbar.Width / 2;
     progressbar.Top  = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Top + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height / 2 - progressbar.Height / 2;
     Application.ShowModalWindow(null, progressbar, false);
     progressbar.Visibility = System.Windows.Visibility.Collapsed;
 }
Exemplo n.º 3
0
        public void CreatePdfName()
        {
            Active.Document.SendStringToExecute("REGENALL ", true, false, true);
            Dictionary <string, string> attrList = new Dictionary <string, string>();
            Window1 window = new Window1(new BlockViewModel(attrList));

            Application.ShowModalWindow(window);
            if (window.isClicked)
            {
                //ObjectIdCollection objectIds = Utils.SelectDynamicBlockReferences();
                List <Sheet> dict = new List <Sheet>();

                using (Transaction tr = Active.Database.TransactionManager.StartTransaction())
                {
                    BlockSelector blockSelector = new BlockSelector();
                    blockSelector.GetFilterForSelectBlockId(window.BlockName);
                    bool isExec = true;
                    var  res    = blockSelector.SelectionResult;

                    if (res.Status != PromptStatus.OK)
                    {
                        isExec = false;
                        Active.Editor.WriteMessage("Надо выбрать блок");
                    }

                    if (isExec)
                    {
                        SelectionSet selSet      = res.Value;
                        ObjectId[]   idArrayTemp = selSet.GetObjectIds();
                        //ObjectIdCollection idArray = new ObjectIdCollection(idArrayTemp);
                        //TODO printing X Y
                        //string selAttrName = attributeName.AttributeName;


                        FileNameCreator fileNameCreator = new FileNameCreator(window, idArrayTemp);

                        //GetPrintParametersToPdf(Active.Editor, printModels, tr, objectIds, selAttrName);

                        fileNameCreator.GetPrintParametersToPdf(tr);

                        Utils utils = new Utils();
                        utils.CreateJsonFile(dict);

                        foreach (var printModel in fileNameCreator.GetPrintModels())
                        {
                            PlotCurrentLayout(printModel.DocNumber, printModel);
                        }
                    }

                    tr.Commit();
                }
            }
        }
Exemplo n.º 4
0
Arquivo: Ac.cs Projeto: 15831944/Geo7
        public static bool ShowModal(System.Windows.Window wnd)
        {
            wnd.ShowInTaskbar         = false;
            wnd.Topmost               = true;
            wnd.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            wnd.ResizeMode            = Windows.ResizeMode.NoResize; // This hides window Minimize/Maximize buttons

#if AutoCAD
            return(AcApp.ShowModalWindow(null, wnd, false).GetValueOrDefault(false));
#else
            return(wnd.ShowDialog().GetValueOrDefault(false));
#endif
        }
Exemplo n.º 5
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);
            }
        }