public SettingTopDT GetSetting()
        {
            SettingTopDT setting = SettingExtension.GetSetting <SettingTopDT>(GetFullFileName());

            if (setting == null)
            {
                setting = new SettingTopDT();
            }
            return(setting);
        }
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;

            uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;

            doc           = uidoc.Document;
            sel           = uidoc.Selection;
            Setting       = SettingTopDT.Instance.GetSetting();
            listTextnotes = Getmodelelement.GetTextNoteTypes(doc);
            using (var form = new FrmTopDT(this))
            {
                if (form.ShowDialog() != true && form.check)
                {
                    while (iscontinue)
                    {
                        Transaction tran = new Transaction(doc, "Callout dimension");
                        tran.Start();
                        try
                        {
                            Reference reference = sel.PickObject(ObjectType.Element, new FilterSpotElevation(), "Select Spot Elevation");
                            var       element   = doc.GetElement(reference);
                            var       top       = element.LookupParameter("Single/Upper Value").AsValueString();
                            string    val1      = string.Empty;
                            string    n         = string.Empty;
                            double    val2      = double.MinValue;
                            if (!string.IsNullOrEmpty(form.val) && form.tru == "")
                            {
                                val2 = UnitConvert.StringToFeetAndInches(top, out val1) + UnitConvert.StringToFeetAndInches(form.val, out n);
                            }
                            if (!string.IsNullOrEmpty(form.tru) && form.val == "")
                            {
                                val2 = UnitConvert.StringToFeetAndInches(top, out val1) - UnitConvert.StringToFeetAndInches(form.tru, out n);
                            }
                            var    val3  = UnitConvert.DoubleToImperial(val2);
                            string empty = UnitConvert.StringToFeetAndInchesformattext(val3);
                            if (!string.IsNullOrEmpty(form.Suffix) && string.IsNullOrEmpty(form.Prefix))
                            {
                                CreteaTextnode(doc, empty + " " + form.Suffix, form.TextNoteType);
                            }
                            if (string.IsNullOrEmpty(form.Suffix) && !string.IsNullOrEmpty(form.Prefix))
                            {
                                CreteaTextnode(doc, form.Prefix + " " + empty, form.TextNoteType);
                            }
                            if (!string.IsNullOrEmpty(form.Suffix) && !string.IsNullOrEmpty(form.Prefix))
                            {
                                CreteaTextnode(doc, form.Prefix + " " + empty + " " + form.Suffix, form.TextNoteType);
                            }
                        }
                        catch (Exception)
                        {
                            this.iscontinue = false;
                        }
                        tran.Commit();
                    }
                }
            }
            return(Result.Succeeded);
        }