<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Parameter Bindings in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/10691501#M37530</link>
    <description>&lt;P&gt;A note on this code sample. The reason Revit crashes without a "break" is the code is walks through the binding list at the same time it is asking Revit to modify the binding list. It would not exception if the data was collected separately than the calls to Insert and Reinsert.&lt;BR /&gt;One way this can be accomplished is putting the contents of the binding map into a list first and then looping through the list instead of using the binding map iterator directly.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Oct 2021 18:12:17 GMT</pubDate>
    <dc:creator>JesikaDG</dc:creator>
    <dc:date>2021-10-15T18:12:17Z</dc:date>
    <item>
      <title>Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/9235864#M37525</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using this code to add categories to existing parameters. Aim is to attach parameters defined in rooms automaticly to the generating walls of the room. I can do this manually via the userinterface, but ReInsert allways fails via API, any Idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            Document doc = target.Document;

            // Get the BingdingMap of current document.
            BindingMap bindingMap = doc.ParameterBindings;
            DefinitionBindingMapIterator it = bindingMap.ForwardIterator();
            it.Reset();
            while (it.MoveNext())
            {
                if (it.Key.Name.Contains(param)) 
                {
                    if (it.Current is InstanceBinding EB)
                    {
                        EB.Categories.Insert(target.Category);
                        bool success = bindingMap.ReInsert(it.Key, EB);
                        return success; // success;
                    }
                    else
                        return false;
                }
            }&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jan 2020 16:54:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/9235864#M37525</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-07T16:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/9236048#M37526</link>
      <description>&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2012/04/adding-a-category-to-a-shared-parameter-binding.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2012/04/adding-a-category-to-a-shared-parameter-binding.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 17:59:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/9236048#M37526</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-01-07T17:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/9237076#M37527</link>
      <description>&lt;P&gt;Hello Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx for the link I was aware of this, and I was trying to adapt the code provided. The parameter I want to bind to the new category (wall) is part of the project and currently only bound to rooms. I simply want to assign a new category to an existing binding.&amp;nbsp;&lt;BR /&gt;The provided code works well with parameters I insert via the api as shared parameters but it always fails when I want to update the categories of parameters that where added manually via the UI.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 07:23:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/9237076#M37527</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-08T07:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/9237079#M37528</link>
      <description>&lt;P&gt;I thought this kind of binding of parameters to categories only works for shared parameters anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you achieve the desired result manually in the user interface?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, you probably cannot do it in the API either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If yes, then the code provided should achieve exactly that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 07:26:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/9237079#M37528</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-01-08T07:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/10322510#M37529</link>
      <description>&lt;P&gt;This code works, it detects if parameter is already there, you need catSet and myDefinition coming into it.&lt;/P&gt;&lt;P&gt;Revit crashes if "break;" isn't there (even inside a try-catch).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;                        BindingMap bindingMap = doc.ParameterBindings;
                        DefinitionBindingMapIterator it = bindingMap.ForwardIterator();
                        it.Reset();
                        while (it.MoveNext())
                        {
                            if (it.Key.Name == myDefinition.Name)
                            {
                                if(it.Current is InstanceBinding)
                                {
                                    foreach (Category cat in catSet)
                                    {
                                        if (!((InstanceBinding)it.Current).Categories.Contains(cat))
                                        {
                                            ((InstanceBinding)it.Current).Categories.Insert(cat);
                                        }
                                    }
                                    bool success = bindingMap.ReInsert(myDefinition, (InstanceBinding)it.Current, BuiltInParameterGroup.PG_IDENTITY_DATA);
                                    bool_Reinserted = true;
                                }
                                if (it.Current is TypeBinding)
                                {
                                    foreach (Category cat in catSet)
                                    {
                                        if (!((TypeBinding)it.Current).Categories.Contains(cat))
                                        {
                                            ((TypeBinding)it.Current).Categories.Insert(cat);
                                        }
                                    }
                                    bool success = bindingMap.ReInsert(myDefinition, (TypeBinding)it.Current, BuiltInParameterGroup.PG_IDENTITY_DATA);
                                    bool_Reinserted = true;
                                }

                                break;
                            }
                        }

                        if (!bool_Reinserted)
                        {
                            Binding binding = IsTypeParameter ? uidoc.Application.Application.Create.NewTypeBinding(catSet) as Binding : uidoc.Application.Application.Create.NewInstanceBinding(catSet) as Binding;

                            doc.ParameterBindings.Insert(myDefinition, binding, BuiltInParameterGroup.PG_IDENTITY_DATA);
                        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 03:18:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/10322510#M37529</guid>
      <dc:creator>joshua.lumley</dc:creator>
      <dc:date>2021-05-19T03:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/10691501#M37530</link>
      <description>&lt;P&gt;A note on this code sample. The reason Revit crashes without a "break" is the code is walks through the binding list at the same time it is asking Revit to modify the binding list. It would not exception if the data was collected separately than the calls to Insert and Reinsert.&lt;BR /&gt;One way this can be accomplished is putting the contents of the binding map into a list first and then looping through the list instead of using the binding map iterator directly.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 18:12:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/10691501#M37530</guid>
      <dc:creator>JesikaDG</dc:creator>
      <dc:date>2021-10-15T18:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/11089188#M37531</link>
      <description>&lt;LI-CODE lang="general"&gt;    BindingMap All_Binding = doc.ParameterBindings;
    DefinitionBindingMapIterator Iterator = All_Binding.ForwardIterator();
    Iterator.Reset(); List&amp;lt;string&amp;gt; BindingList = new List&amp;lt;string&amp;gt;();
    while (Iterator.MoveNext())
    {
        Definition def = Iterator.Key;
        ElementBinding Binders = (ElementBinding)Iterator.Current;
        BindingList.Add(def.Name);
    }
    BindingList.Sort();&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 03:30:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/11089188#M37531</guid>
      <dc:creator>joshua.lumley</dc:creator>
      <dc:date>2022-04-07T03:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/11718685#M37532</link>
      <description>&lt;P&gt;Hello Richard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am facing the exact same problem. Not able to update the categories of project parameters that were added manually via the UI(even with ReInsert)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;have you found out any solution or work around for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 14:12:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/11718685#M37532</guid>
      <dc:creator>prasadNELXB</dc:creator>
      <dc:date>2023-01-31T14:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter Bindings</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/12005936#M37533</link>
      <description>&lt;P&gt;Please explain how to set MyDefinition&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 01:08:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/parameter-bindings/m-p/12005936#M37533</guid>
      <dc:creator>gdavis479JP</dc:creator>
      <dc:date>2023-06-02T01:08:51Z</dc:date>
    </item>
  </channel>
</rss>

