Example #1
0
        public void KojtoCAD_3D_Method_Read_Old_From_Dictionary()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            Editor   ed = Application.DocumentManager.MdiActiveDocument.Editor;

            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)
            {
                bool addres = pKeyRes.StringResult == "Base";

                try
                {
                    ContextVariablesProvider.Container = new Containers();
                    container.Read(addres);
                    ed.UpdateScreen();

                    int notfictive = 0;
                    foreach (Bend b in container.Bends)
                    {
                        if (!b.Fictive)
                        {
                            notfictive++;
                        }
                    }

                    string formatString = "{0,-20}\t{1,-12}\n\n";

                    string mess = "\n";
                    mess += string.Format(formatString, "Nodes:", container.Nodes.Count);
                    mess += string.Format(formatString, "All Bends:", container.Bends.Count);
                    mess += string.Format(formatString, "Bends:", notfictive);
                    mess += string.Format(formatString, "Fictive Bends:", container.Bends.Count - notfictive);
                    mess += string.Format(formatString, "Peripheral Bends:", container.peripheralBendsNumers.Count);
                    mess += string.Format(formatString, "Triangles:", container.Triangles.Count);
                    mess += string.Format(formatString, "Polygons:", container.Polygons.Count);

                    MessageBox.Show("\nMesh data was loaded from the Dictionary !\n\n" + mess +
                                    "\n\n" + ConstantsAndSettings.GetString(), "Reading from the Dictionary ...", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ed.WriteMessage("\nMesh data was loaded from the Dictionary !");
                }
                catch
                {
                    ed.UpdateScreen();
                    MessageBox.Show("\nMesh data was NOT loaded from the Dictionary !", "ERROR while reading form Dictionary", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    ed.WriteMessage("\nMesh data was NOT loaded from the Dictionary !");
                }
            }
        }