Message 1 of 3
How to add a new category to an existing project parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
string targetParamName = "测试";
BuiltInCategory newCategory = BuiltInCategory.OST_Ceilings;
DefinitionBindingMapIterator iter = document.ParameterBindings.ForwardIterator();
while (iter.MoveNext())
{
Definition def = iter.Key;
if (def.Name == targetParamName)
{
ElementBinding binding = iter.Current as ElementBinding;
CategorySet categories = binding.Categories;
using (Transaction t = new Transaction(document, "Insert Category"))
{
t.Start();
categories.Insert(document.Settings.Categories.get_Item(newCategory));
t.Commit();
}
break;
}
}
This method does not add a new category to the specified project parameter. Although the members of binding.Categories increase every time the method is executed, there is no Test parameter in the Ceiling properties in the software.
Please tell me where the problem is, thank you