Revit里有一种参数叫项目参数,如何判断一个参数是否是项目参数:
思路:
首先通过Document.ParameterBindings,这里面包括了项目参数和共享参数
然后判断,如果参数不是共享参数,那么就是项目参数了。
UIDocument uiDoc = commandData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
BindingMap map = doc.ParameterBindings;
Element elemSelected = doc.GetElement(uiDoc.Selection.PickObject(ObjectType.Element));
string paraShared = "";
string paraProj = "";
foreach (Parameter param in elemSelected.Parameters)
{
if (param.IsShared)
{
paraShared += param.Definition.Name + "\n";
}
else if (map.Contains(param.Definition))
{
paraProj += param.Definition.Name + "\n";
}
}
TaskDialog.Show("Infor", "Shared:" + paraShared + "\n Project:" + paraProj);
如何使用代码添加项目参数呢?