public SettingSetValueSheet GetSetting(string filename)
        {
            DirectoryInfo d    = new DirectoryInfo(GetFolderPath());
            var           p    = d.GetFiles().ToList();
            List <string> list = new List <string>();

            p.ForEach(x => list.Add(x.Name));
            if (list.Count == 0)
            {
                SettingSetValueSheet setting = SettingExtension.GetSetting <SettingSetValueSheet>(GetFullFileName("%^^"));
                if (setting == null)
                {
                    setting = new SettingSetValueSheet();
                }
                return(setting);
            }
            else
            {
                var fg = GetFullFileName(filename);
                SettingSetValueSheet setting = SettingExtension.GetSetting <SettingSetValueSheet>(GetFullFileName(filename));
                if (setting == null)
                {
                    setting = new SettingSetValueSheet();
                }
                return(setting);
            }
        }
Ejemplo n.º 2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication application      = commandData.Application;
            UIDocument    activeUIDocument = application.ActiveUIDocument;
            Application   application2     = application.Application;
            Document      doc = activeUIDocument.Document;
            Selection     sel = activeUIDocument.Selection;

            if (doc.ActiveView.ViewType == ViewType.DrawingSheet)
            {
                Setting = SettingSetValueSheet.Instance.GetSetting("");
                FamilyInstance Titleblockc = SetValueTemplateSheet.Instance.Gettileblock(doc);
                dic = SetValueTemplateSheet.Instance.GetParameter(doc, Titleblockc);
                var form = new FrmSetValueTemplateSheet(this, doc);
                form.ShowDialog();
                return(Result.Succeeded);
            }
            else
            {
                TaskDialog.Show("Error", "Please go to Sheet");
                return(Result.Cancelled);
            }
        }
        public void SaveTemplateSheet(Document doc, CegParameterSet cegParameterSet, string filename, SettingSetValueSheet setting)
        {
            string path     = setting.GetFullFileName(filename);
            string contents = JsonConvert.SerializeObject(cegParameterSet, Formatting.Indented);

            File.WriteAllText(path, contents);
        }