Results 1 to 2 of 2

Thread: Cannot get the BindingMap of a family document Options

  1. #1
    Active Member
    Join Date
    2008-07
    Posts
    61
    Login to Give a bone
    0

    Default Cannot get the BindingMap of a family document Options

    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

  2. #2
    Member
    Join Date
    2012-09
    Posts
    34
    Login to Give a bone
    0

    Default Re: Cannot get the BindingMap of a family document Options

    From the Revit 2014 API Documentation on Document.ParameterBindings:

    Autodesk.Revit.Exceptions.InvalidOperationException When the document is a family document.
    As far as I can tell, you don't actually need any of the code relating to the BindingMap to accomplish what you're trying to do.

    What happens if you simply comment out the following lines?

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

Similar Threads

  1. Replies: 0
    Last Post: 2014-12-01, 03:59 AM
  2. Replies: 0
    Last Post: 2011-07-18, 07:06 AM
  3. saving a family document results in weird files
    By mpruna in forum Revit - API
    Replies: 0
    Last Post: 2011-02-04, 10:53 PM
  4. Family Upgrade Utility Failed to open document.
    By ctc in forum Revit Architecture - General
    Replies: 15
    Last Post: 2009-08-11, 12:10 PM
  5. Family Document Category
    By steven.88041 in forum Revit - API
    Replies: 8
    Last Post: 2009-06-15, 04:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •