public static void CS_GenerateRings()
        {
            Document acDoc   = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            using (Transaction acTrans = acDoc.TransactionManager.StartTransaction())
            {
                SiteFoundations sf = acDoc.GetDocumentStore <CivilStructureDocumentStore>().SiteFoundations;
                sf.GenerateTreeRings();

                acTrans.Commit();
            }
        }
        public override void Load()
        {
            Transaction  tr  = acCurDb.TransactionManager.TopTransaction;
            DBDictionary nod = (DBDictionary)tr.GetObject(acCurDb.NamedObjectsDictionaryId, OpenMode.ForWrite);

            SiteFoundations = LoadBinary <SiteFoundations>(CSConstants.FoundationID);

            if (SiteFoundations == null)
            {
                SiteFoundations = new SiteFoundations();
            }

            SiteFoundations.UpdateDrawingObjects();

            base.Load();
        }
        public static void NewTree()
        {
            Document acDoc   = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            using (Transaction acTrans = acDoc.TransactionManager.StartTransaction())
            {
                NHBCTree newTree = new NHBCTree();
                newTree.Generate();

                //TODO: Add tree determination in here
                PromptKeywordOptions pKeyOpts = new PromptKeywordOptions("");
                pKeyOpts.Message = "\nTree Type ";
                pKeyOpts.Keywords.Add("Deciduous");
                pKeyOpts.Keywords.Add("Coniferous");
                pKeyOpts.AllowNone = false;

                PromptResult pKeyRes = acDoc.Editor.GetKeywords(pKeyOpts);
                if (pKeyRes.StringResult == "Deciduous")
                {
                    newTree.TreeType = TreeType.Deciduous;
                }
                else
                {
                    newTree.TreeType = TreeType.Coniferous;
                }

                pKeyOpts         = new PromptKeywordOptions("");
                pKeyOpts.Message = "\nWater deamnd ";
                pKeyOpts.Keywords.Add("High");
                pKeyOpts.Keywords.Add("Medium");
                if (newTree.TreeType == TreeType.Deciduous)
                {
                    pKeyOpts.Keywords.Add("Low");
                }
                pKeyOpts.AllowNone = false;

                pKeyRes = acDoc.Editor.GetKeywords(pKeyOpts);
                Dictionary <string, int> speciesList = NHBCTree.DeciduousHigh;
                switch (pKeyRes.StringResult)
                {
                case "High":
                    newTree.WaterDemand = WaterDemand.High;
                    if (newTree.TreeType == TreeType.Deciduous)
                    {
                        speciesList = NHBCTree.DeciduousHigh;
                    }
                    else
                    {
                        speciesList = NHBCTree.ConiferousHigh;
                    }
                    break;

                case "Medium":
                    newTree.WaterDemand = WaterDemand.Medium;
                    if (newTree.TreeType == TreeType.Deciduous)
                    {
                        speciesList = NHBCTree.DeciduousMedium;
                    }
                    else
                    {
                        speciesList = NHBCTree.ConiferousMedium;
                    }
                    break;

                case "Low":
                    newTree.WaterDemand = WaterDemand.Low;
                    if (newTree.TreeType == TreeType.Deciduous)
                    {
                        speciesList = NHBCTree.DeciduousLow;
                    }
                    else
                    {
                        throw new ArgumentException();     //Doesnt exist!!
                    }
                    break;
                }

                pKeyOpts         = new PromptKeywordOptions("");
                pKeyOpts.Message = "\nSpecies ";
                foreach (string s in speciesList.Keys)
                {
                    pKeyOpts.Keywords.Add(s);
                }

                pKeyOpts.AllowNone = false;
                pKeyRes            = acDoc.Editor.GetKeywords(pKeyOpts);
                newTree.Species    = pKeyRes.StringResult;

                float maxHeight = (float)speciesList[newTree.Species];

                PromptStringOptions pStrOptsPlot = new PromptStringOptions("\nEnter tree height: ")
                {
                    AllowSpaces = false, DefaultValue = maxHeight.ToString()
                };
                PromptResult pStrResPlot = acDoc.Editor.GetString(pStrOptsPlot);

                float actualHeight = float.Parse(pStrResPlot.StringResult);

                if (actualHeight < maxHeight / 2)
                {
                    newTree.Height = actualHeight;
                }
                else
                {
                    newTree.Height = maxHeight;
                }

                PromptPointOptions pPtOpts = new PromptPointOptions("\nClick to enter location: ");
                PromptPointResult  pPtRes  = acDoc.Editor.GetPoint(pPtOpts);
                newTree.Location = new Autodesk.AutoCAD.Geometry.Point3d(pPtRes.Value.X, pPtRes.Value.Y, 0);

                SiteFoundations sf = acDoc.GetDocumentStore <CivilStructureDocumentStore>().SiteFoundations;

                sf.Trees.Add(newTree);
                sf.GenerateTreeRings();

                acTrans.Commit();
            }
        }