public static DefinitionFile CreateOrGetSharedParameterFile(Document doc) { var spFile = doc.Application.OpenSharedParameterFile(); if (spFile == null) { var buildLocation = Path.GetDirectoryName(typeof(VentilationParameterUtility).Assembly.Location); var dirname = Path.Combine(buildLocation, "Data"); var paramFile = Path.Combine(dirname, ParameterFileName); spFile = RevitParameterUtility.CreateOrGetSharedParameterFile(doc.Application, paramFile); } return(spFile); }
/// <summary> /// Adds ventilation parameters necessary for scheduling to the model /// if they do not already exist /// </summary> /// <param name="doc"></param> public static void AddVentParametersToModel(Document doc) { var spaceCat = doc.Settings.Categories.get_Item(BuiltInCategory.OST_MEPSpaces); var buildLocation = Path.GetDirectoryName(typeof(VentilationParameterUtility).Assembly.Location); var dirname = Path.Combine(buildLocation, "Data"); var paramFile = Path.Combine(dirname, ParameterFileName); var spFile = RevitParameterUtility.AddSharedParameterFileToModel(doc.Application, paramFile); var ventParams = VentilationParameterFactory.GetVentParameterDefinitions(doc); foreach (var p in ventParams) { if (!doc.HasParameter(p)) { RevitParameterUtility.BindParameterToCategory(doc, spaceCat, p); } } }