欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

【Revit API】创建共享参数

程序员文章站 2022-08-30 10:08:47
话不多说,直接上代码 ......

话不多说,直接上代码

var app = doc.Application;
app.SharedParametersFilename = sharedParamFilePath;
DefinitionFile definitionFile = app.OpenSharedParameterFile();
var groups = definitionFile.Groups;
var matchedGroup = groups.FirstOrDefault();
var edco = new ExternalDefinitionCreationOptions("ParamName", ParameterType.Text);
var definition = matchedGroup.Definitions.Create(edco) as ExternalDefinition;

Binding binding = doc.Application.Create.NewTypeBinding(categorySet);
doc.ParameterBindings.Insert(definition, binding, BuiltInParameterGroup.Text);