Ejemplo n.º 1
0
        public void KojtoCAD_3D_Delete_Mesh_Data()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            Editor   ed = Application.DocumentManager.MdiActiveDocument.Editor;

            // if ((container != null) && (container.Bends.Count > 0) && (container.Triangles.Count > 0))
            {
                PromptKeywordOptions pKeyOpts = new PromptKeywordOptions("");
                pKeyOpts.Message = "\n Base or Second";

                pKeyOpts.Keywords.Add("Base");
                pKeyOpts.Keywords.Add("Second");
                pKeyOpts.Keywords.Default = "Base";
                pKeyOpts.AllowNone        = false;

                PromptResult pKeyRes = Application.DocumentManager.MdiActiveDocument.Editor.GetKeywords(pKeyOpts);
                if (pKeyRes.Status == PromptStatus.OK)
                {
                    Pair <string, PromptStatus> strOpt =
                        GlobalFunctions.GetKey(new[] { "Yes", "No" }, 1, "\nAre you sure you want to delete the data ?");
                    if ((strOpt.Second == PromptStatus.OK) && (strOpt.First == "Yes"))
                    {
                        bool addres = pKeyRes.StringResult == "Base";
                        try
                        {
                            bool b = container.Delete(addres);
                            if (b)
                            {
                                ed.WriteMessage("\nMesh data was erased from the Dictionary  !");

                                if (MessageBox.Show("\nMesh data was erased from the Dictionary  ! \n\nSave drawing ?",
                                                    "Save Drawing File ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    Application.DocumentManager.MdiActiveDocument.SendStringToExecute(".QSAVE ", true, false, false);
                                }
                            }
                        }
                        catch
                        {
                            MessageBox.Show("\nMesh data was NOT erasedd from the Dictionary !\n\n", "ERROR while erased from Dictionary", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            ed.WriteMessage("\nMesh data was NOT erased from the Dictionary !");
                        }
                    }
                }
            }
            // else
            // MessageBox.Show("\nData Base Empty !\n\nMissing Bends !", "Range Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }