public void testPalette()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                if (ps == null)
                {
                    // use constructor with Guid so that we can save/load user data
                    ps       = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set"); // New Guid("63B8DB5B-10E4-4924-B8A2-A9CF9158E4F6"))
                    ps.Style = PaletteSetStyles.ShowTabForSingle;
                    //ps.Style = 16; //PaletteSetStyles.NameEditable;
                    //ps.Style = 4; //PaletteSetStyles.ShowPropertiesMenu;
                    //ps.Style = 2; //PaletteSetStyles.ShowAutoHideButton;
                    //ps.Style = 8; //PaletteSetStyles.ShowCloseButton
                    ps.Opacity     = 90;
                    ps.MinimumSize = new System.Drawing.Size(300, 300);
                    System.Windows.Forms.UserControl myCtrl = new ModelessForm();
                    //ctrl.Dock = System.Windows.Forms.DockStyle.Fill;
                    ps.Add("test", myCtrl);
                    ps.Visible = true;
                }
            }
            catch
            {
                ed.WriteMessage("Error Showing Palette");
            }
        }
Beispiel #2
0
        public override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.Register <ISelectionType, Line_SelectionType>(typeof(Line_SelectionType).FullName);
            containerRegistry.Register <ISelectionType, Circle_SelectionType>(typeof(Circle_SelectionType).FullName);
            containerRegistry.Register <ISelectionType, Polyline_SelectionType>(typeof(Polyline_SelectionType).FullName);

            loggerfacade.Log("registered core types", Category.Info, Priority.Low);

#if ACAD2020
            containerRegistry.Register <ISelectionType, Blocks_SelectionType>(typeof(Blocks_SelectionType).FullName);
            loggerfacade.Log("registered specific acad 2020 - blocks", Category.Info, Priority.Low);
#endif
            if (PaletteSet is null)
            {
                PaletteSet = new AAW.PaletteSet(AppData.DISPLAYAPPNAME, AppData.DISPLAYAPPNAME, new Guid(AppData.APPID))
                {
                    MinimumSize = new System.Drawing.Size(350, 350)
                };

                loggerfacade.Log("Created instance of paletteset", Category.Info, Priority.Low);

                containerRegistry.RegisterInstance(PaletteSet);

                loggerfacade.Log("Registered instance of paletteset with the container", Category.Info, Priority.Low);
            }
        }
Beispiel #3
0
 public void AddPalette()
 {
     Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
     try
     {
         if (palSet == null)
         {
             // private Autodesk.AutoCAD.Windows.PaletteSet palSet;//�ⲿ����Ϊ���Ա����
             palSet = new Autodesk.AutoCAD.Windows.PaletteSet("�ҵ���弯");
             //palSet.Style = PaletteSetStyles.ShowTabForSingle;
             palSet.Style = PaletteSetStyles.NameEditable;
             palSet.Style = PaletteSetStyles.ShowPropertiesMenu;
             palSet.Style = PaletteSetStyles.ShowAutoHideButton;
             palSet.Style = PaletteSetStyles.ShowCloseButton;
             palSet.Opacity = 90;
             palSet.MinimumSize = new System.Drawing.Size(300, 300);
             System.Windows.Forms.UserControl myPageCtrl = new ModelessForm();
             //myPageCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
             palSet.Add("�ҵ�ҳ��", myPageCtrl);
             palSet.Visible = true;
         }
     }
     catch
     {
         ed.WriteMessage("������弯����");
     }
 }
 public void testPalette()
 {
     Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
     try
     {
         if (ps == null)
         {
             // use constructor with Guid so that we can save/load user data
             ps = new Autodesk.AutoCAD.Windows.PaletteSet("Test Palette Set"); // New Guid("63B8DB5B-10E4-4924-B8A2-A9CF9158E4F6"))
             ps.Style = PaletteSetStyles.ShowTabForSingle;
             //ps.Style = 16; //PaletteSetStyles.NameEditable;
             //ps.Style = 4; //PaletteSetStyles.ShowPropertiesMenu;
             //ps.Style = 2; //PaletteSetStyles.ShowAutoHideButton;
             //ps.Style = 8; //PaletteSetStyles.ShowCloseButton
             ps.Opacity = 90;
             ps.MinimumSize = new System.Drawing.Size(300, 300);
             System.Windows.Forms.UserControl myCtrl = new ModelessForm();
             //ctrl.Dock = System.Windows.Forms.DockStyle.Fill;
             ps.Add("test", myCtrl);
             ps.Visible = true;
         }
     }
     catch
     {
         ed.WriteMessage("Error Showing Palette");
     }
 }
Beispiel #5
0
 public void AddPlate()
 {
     System.Windows.Forms.UserControl    mycontrol = new UI1();
     Autodesk.AutoCAD.Windows.PaletteSet ps        = new Autodesk.AutoCAD.Windows.PaletteSet("PlateteSet");
     ps.Visible     = true;
     ps.Style       = PaletteSetStyles.ShowAutoHideButton;
     ps.Dock        = DockSides.None;
     ps.MinimumSize = new System.Drawing.Size(200, 100);
     ps.Size        = new System.Drawing.Size(200, 100);
     ps.Add("PaletteSet", mycontrol);
     ps.Visible = true;
 }
        public void Initialize()
        {
            if (PaletteSet is null)
            {
                PaletteSet = new AAW.PaletteSet("My Sweet App", Commands_Model.PALETTESET_COMMAND, new Guid("4d55ea36-b620-452b-8128-94147a934112"))
                {
                    MinimumSize = new Size(350, 350)
                };

                PaletteSet.AddVisual("General", new Main_View());
            }
        }
        public void ThreePalette()
        {
            _launchDoc = null;

            _3ps =
                ShowPalette(
                    _3ps,
                    new Guid("9CEE43FF-FDD7-406A-89B2-6A48D4169F71"),
                    "THREE",
                    "Three.js Examples",
                    GetHtmlPathThree()
                    );
        }
Beispiel #8
0
        public void AddPalette()
        {
            PaletteSet myPaletteSet = new PaletteSet();

            Autodesk.AutoCAD.Windows.PaletteSet ps = new Autodesk.AutoCAD.Windows.PaletteSet("PaletteSet");


            ps.Visible     = true;
            ps.Style       = PaletteSetStyles.ShowAutoHideButton;
            ps.Dock        = DockSides.None;
            ps.MinimumSize = new System.Drawing.Size(200, 100);
            ps.Add("PalettSet", myPaletteSet);
            ps.Visible = true;
        }
        public void MySweetApp()
        {
            if (paletteset is null)
            {
                paletteset = new AAW.PaletteSet("My Sweet App", "MySweetApp", new Guid("4d55ea36-b620-452b-8128-94147a934112"))
                {
                    MinimumSize = new Size(350, 350)
                };

                paletteset.AddVisual("General", new Main_View());
            }

            paletteset.Visible = true;
        }
Beispiel #10
0
 public void StlEx()
 {
     if (paletteSetKex == null)
     {
         try
         {
             paletteSetKex = new PaletteSet("Kex - STL export", new Guid("8ba5e63b-34ad-4dd2-a9aa-85ad686589ef"));
             paletteSetKex.Add("Kex - STL export", _kexControl);
             //paletteSetKex.KeepFocus = true;
             paletteSetKex.Style         = PaletteSetStyles.NameEditable | PaletteSetStyles.ShowCloseButton;
             paletteSetKex.StateChanged += new PaletteSetStateEventHandler(PaletteSetKex2_StateChanged);
             paletteSetKex.Location      = new System.Drawing.Point(200, 300);
             paletteSetKex.MinimumSize   = new System.Drawing.Size(502, 902);
             paletteSetKex.Size          = new System.Drawing.Size(502, 902);
             paletteSetKex.Visible       = true;
             paletteSetKex.DockEnabled   = DockSides.None;
             paletteSetKex.Dock          = DockSides.None;
             _kexControl.LoadSettings();
         }
         catch
         {
             MessageBox.Show("Failed to create the palette.");
         }
     }
     else
     {
         try
         {
             paletteSetKex.Visible = true;
         }
         catch (System.Exception ex)
         {
             MessageBox.Show("Original error: " + ex.Message);
         }
     }
 }
Beispiel #11
0
        public void Edit()
        {
            try
            {
                string serverIP   = CIni.ReadINI("updateconfig", "ServerIP");
                int    serverPort = int.Parse(CIni.ReadINI("updateconfig", "ServerPort"));
                if (VersionHelper.HasNewVersion(serverIP, serverPort))
                {
                    if (MessageBox.Show("服务器端发布了更新,请退出AutoCAD然后运行获取更新程序", "提示",
                                        MessageBoxButtons.OKCancel
                                        , MessageBoxIcon.Warning) == DialogResult.OK)
                    {
                        AcadApplication AcadApp = (AcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject("AutoCAD.Application");
                        AcadApp.Quit();

                        return;
                    }
                }
            }
            finally
            {
                CADObjectEditCtrl pCADObjectEditCtrl = new CADObjectEditCtrl();

                Autodesk.AutoCAD.Windows.PaletteSet ps = new Autodesk.AutoCAD.Windows.PaletteSet("管网管理");

                ps.Style = PaletteSetStyles.ShowTabForSingle;
                ps.Style = PaletteSetStyles.NameEditable;
                ps.Style = PaletteSetStyles.ShowPropertiesMenu;
                ps.Style = PaletteSetStyles.ShowAutoHideButton;
                ps.Style = PaletteSetStyles.ShowCloseButton;

                ps.Dock        = DockSides.Left;
                ps.Visible     = true;
                ps.MinimumSize = new System.Drawing.Size(556, 490);
                ps.Size        = new System.Drawing.Size(556, 490);

                AcadApplication AcadApp = (AcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject("AutoCAD.Application");
                Autodesk.AutoCAD.Interop.AcadDocument AcadDoc = AcadApp.ActiveDocument;
                string CurCadfile = AcadDoc.FullName;
                string CurMdbName = System.IO.Path.GetDirectoryName(CurCadfile) + "\\" + System.IO.Path.GetFileNameWithoutExtension(CurCadfile) + ".db";
                //MessageBox.Show(CurMdbName);
                if (!System.IO.File.Exists(CurMdbName))
                {
                    System.Windows.Forms.OpenFileDialog pDlg = new System.Windows.Forms.OpenFileDialog();
                    pDlg.Filter      = "数据库文件|*.db|所有文件(*.*)|*.*";
                    pDlg.Multiselect = false;
                    if (pDlg.ShowDialog() == DialogResult.OK)
                    {
                        SysDBUnitiy.MDBPath = pDlg.FileName;
                        ps.Add("管网管理", pCADObjectEditCtrl);
                        ps.Activate(0);
                    }
                }
                else
                {
                    SysDBUnitiy.MDBPath = CurMdbName;

                    ps.Add("管网管理", pCADObjectEditCtrl);
                    ps.Activate(0);
                }
            }
        }
Beispiel #12
0
        public void komiwojazer_panel()
        {
            // check to make sure that the paletteset window is not already active
            if (myPaletteSet == null)
            {
                // create the paletteset window first
                myPaletteSet = new PaletteSet("Problem komiwojazera", new Guid("{B953F94A-6C3D-49ee-A07A-0A1F39FA2594}"));
                // create the palette window to go into the paletteset
                myPalette = new UserControl1();
                // now add the palette to the paletteset
                myPaletteSet.Add("Komiwojazer", myPalette);
            } // if (myPaletteSet == null)

            // double check that the window is actually displayed
            myPaletteSet.Visible = true;

            // Get the current document and database
            Document acDoc   = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            // Now start a transaction
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                // Open the Block table for read
                BlockTable acBlkTbl;
                acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable;

                // Open the Block table record Model space for write
                BlockTableRecord acBlkTblRec;
                acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord;

                punkty = new List <Punkt3d>();

                // Step through the Block table record
                foreach (ObjectId asObjId in acBlkTblRec)
                {
                    if (asObjId.ObjectClass.Name == "AcDb3dSolid")
                    {
                        Solid3d acEnt = acTrans.GetObject(asObjId, OpenMode.ForWrite) as Solid3d;
                        Punkt3d p     = new Punkt3d(acEnt.MassProperties.Centroid.X, acEnt.MassProperties.Centroid.Y, acEnt.MassProperties.Centroid.Z);
                        punkty.Add(p);

                        //acDoc.Editor.WriteMessage("\nName: " + acEnt.BlockName);
                        //acDoc.Editor.WriteMessage("\nObjectID: " + acEnt.ToString());
                        //acDoc.Editor.WriteMessage("\nCentroidPoint: (" + acEnt.MassProperties.Centroid.X + ", " + acEnt.MassProperties.Centroid.Y + ", " + acEnt.MassProperties.Centroid.Z + ")");
                        //acDoc.Editor.WriteMessage("\nHandle: " + asObjId.Handle.ToString());
                        //acDoc.Editor.WriteMessage("\n");
                    }
                }

                // Rozwiazanie problemu komiwojazera
                komiwojazer();

                // Returns the layer table for the current database
                LayerTable acLyrTbl;
                acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead) as LayerTable;

                string sLayerName = "Komiwojazer";

                // Usuniecie obiektow z warstwy Komiwojazer
                // Step through the Block table record
                foreach (ObjectId asObjId in acBlkTblRec)
                {
                    Entity acEnt = acTrans.GetObject(asObjId, OpenMode.ForRead) as Entity;
                    if (acEnt.Layer == sLayerName)
                    {
                        acEnt.UpgradeOpen();
                        acEnt.Erase(true);
                    }
                }

                // Check to see if MyLayer exists in the Layer table
                if (acLyrTbl.Has(sLayerName) == true)
                {
                    try
                    {
                        LayerTableRecord acLyrTblRec;
                        acLyrTblRec = acTrans.GetObject(acLyrTbl[sLayerName], OpenMode.ForWrite) as LayerTableRecord;
                        // Erase the unreferenced layer
                        acLyrTblRec.Erase(true);
                    }
                    catch (Autodesk.AutoCAD.Runtime.Exception Ex)
                    {
                        // Layer could not be deleted
                        Application.ShowAlertDialog("Error:\n" + Ex.Message);
                    }
                }

                // Check to see if MyLayer exists in the Layer table
                if (acLyrTbl.Has(sLayerName) != true)
                {
                    try
                    {
                        // Open the Layer Table for write
                        acLyrTbl.UpgradeOpen();
                        // Create a new layer table record and name the layer "MyLayer"
                        LayerTableRecord acLyrTblRec = new LayerTableRecord();

                        // Ustawienie wlasciwosci warstwy.
                        acLyrTblRec.Name       = sLayerName;
                        acLyrTblRec.Color      = Autodesk.AutoCAD.Colors.Color.FromRgb(0, 255, 0);
                        acLyrTblRec.LineWeight = LineWeight.LineWeight020;

                        // Add the new layer table record to the layer table and the transaction
                        acLyrTbl.Add(acLyrTblRec);
                        acTrans.AddNewlyCreatedDBObject(acLyrTblRec, true);

                        acBlkTblRec.UpgradeOpen();

                        // Dodanie linii pomiedzy punktem ostatnim i pierwszym
                        if (punkty.Count > 0)
                        {
                            Line acLine = new Line(new Point3d(punkty.Last().x, punkty.Last().y, punkty.Last().z), new Point3d(punkty[0].x, punkty[0].y, punkty[0].z));
                            acLine.Layer = sLayerName;

                            // Add the new object to the block table record and the transaction
                            acBlkTblRec.AppendEntity(acLine);
                            acTrans.AddNewlyCreatedDBObject(acLine, true);
                        }

                        // Dodanie pozostalych linii
                        for (int i = 0; i < punkty.Count - 1; i++)
                        {
                            Line acLine = new Line(new Point3d(punkty[i].x, punkty[i].y, punkty[i].z), new Point3d(punkty[i + 1].x, punkty[i + 1].y, punkty[i + 1].z));
                            acLine.Layer = sLayerName;

                            // Add the new object to the block table record and the transaction
                            acBlkTblRec.AppendEntity(acLine);
                            acTrans.AddNewlyCreatedDBObject(acLine, true);
                        }
                    }
                    catch (Autodesk.AutoCAD.Runtime.Exception Ex)
                    {
                        Application.ShowAlertDialog("Error:\n" + Ex.Message);
                    }
                }

                // Commit the changes
                acTrans.Commit();

                // Dispose of the transaction
            }
        }