Hello
We have an Add-in that allows users to load a list of their family parameters, then pick our family parameters from our family and have the program add their parameters and set them equal to ours. This allows them to keep the schedules how the want them and saves them from doing this manually. It has worked since 2009 with adjustments to the code every release. In 2014 we can not get it to work. It gives us the error cannot get the BindingMap of a family document. Here is the code that it errors on.
//doc.BeginTransaction();
Definition information = null;
DefinitionGroup informationCollection = null;
foreach (DefinitionGroup defGroup in informationCollections)
{
information = defGroup.Definitions.get_Item(sharedParam);
informationCollection = defGroup;
if (information != null)
{ break; }
}
//if (null == information)
//{
// informationCollection = informationCollections.Create("My Parameters");
// information = informationCollection.Definitions.Create(sharedParam, fam.Definition.ParameterType);
//}
if (information != null)
{
CategorySet cset = revitApp.Application.Create.NewCategorySet();
Category cat = doc.Settings.Categories.get_Item(BuiltInCategory.OST_MechanicalEquipment);
cset.Insert(cat);
InstanceBinding caseTying = revitApp.Application.Create.NewInstanceBinding(cset);
BindingMap bindingMap = doc.ParameterBindings;
bindingMap.Insert(information, caseTying);
if (fam == null)
{
FamilyParameter fam2 = doc.FamilyManager.AddParameter(information as ExternalDefinition, BuiltInParameterGroup.PG_MECHANICAL, true);
}
else
{
FamilyParameter fam2 = doc.FamilyManager.AddParameter(information as ExternalDefinition, fam.Definition.ParameterGroup, true);
}
}
//doc.EndTransaction();
trans.Commit();
Does anyone know what might have changed or how to resolve this.
Thanks
Brad