话不多说,直接上代码

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);

 

posted on 2018-06-25 14:37  airforce094  阅读(400)  评论(0编辑  收藏  举报