Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to bind a shared parameter to certain subcategories such as Roof Soffits and Fascias. I can see the categories being added to the categoryset, however, the parameters are not being bonded to these subcategories. Here is a snippet of what i'm trying to achieve:
Categories categories = doc.Settings.Categories;
CategorySet catSet = app.Create.NewCategorySet();
foreach (Category c in categories)
{
if (c.AllowsBoundParameters)
{
catSet.Insert(c);
CategoryNameMap subcats = c.SubCategories;
foreach (Category c1 in subcats)
{
if (c1.AllowsBoundParameters)
{
catSet.Insert(c1);
}
}
}
}
if (defGroup.Name == "Test")
{
var v = (from ExternalDefinition d in defGroup.Definitions select d);
using (Transaction t = new Transaction(doc))
{
t.Start("Add Shared Parameters");
foreach (ExternalDefinition eD in v)
{
InstanceBinding newIB = app.Create.NewInstanceBinding(catSet);
doc.ParameterBindings.Insert(eD, newIB, BuiltInParameterGroup.PG_GENERAL);
}
t.Commit();
}
}
Any help is much appreciated.
Regards,
M.
Solved! Go to Solution.