<?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: Update ProjectParameter CategorySet without loosing values in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175322#M10162</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6435443"&gt;@lwlXUTTT&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I already answered for the issue. Kindly Check the Below Link and Reference Code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;URL :&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/adding-categories-to-existing-parameter-binding/m-p/12088231#M72638" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/revit-api-forum/adding-categories-to-existing-parameter-binding/m-p/12088231#M72638&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Script&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; //Global Variables
            InstanceBinding instanceBinding = null;
            Definition def = null;

            //Category Need to Add to the Existing Prameter Bindings
            Category cat = Category.GetCategory(doc, BuiltInCategory.OST_Assemblies);

            //Get Instance Binding From Document
            var map = doc.ParameterBindings.ForwardIterator();

            //Iterate using Iterator
            while (map.MoveNext())
            {
                //Get the Parameter need to add
                def = map.Key as Definition;

                if (def.Name == "Demo")
                {
                    instanceBinding = map.Current as InstanceBinding;
                }

            }

            //Get Existing Category Set From the Binding
            CategorySet existingSet = instanceBinding.Categories;

            if(!existingSet.Contains(cat))
            {
                existingSet.Insert(cat);
            }

            //Adding Category to Exsting Instance Binding (Without changing any parameter)
            using (Transaction addCategory = new Transaction(doc,"Add Category"))
            {
                addCategory.Start();

                //Re-Insert Categories to Exsting Instance Binding
                instanceBinding.Categories = existingSet;

                doc.ParameterBindings.ReInsert(def, instanceBinding);

                addCategory.Commit();
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this Helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Aug 2023 16:47:30 GMT</pubDate>
    <dc:creator>Mohamed_Arshad</dc:creator>
    <dc:date>2023-08-16T16:47:30Z</dc:date>
    <item>
      <title>Update ProjectParameter CategorySet without loosing values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175275#M10160</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a way to update existing ProjectParameter (e.g add new category to categorySet) differently than using ReInsert method from BindingMap? The problem with this one is that it removes existing ProjectParam and later creates new with new CategorySet, therefore already-specified and stored in this Parameter values would be gone!&lt;/P&gt;&lt;P&gt;ReInsert method:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2023/7b613771-310d-6d89-4b69-475a68033f73.htm" target="_blank"&gt;https://www.revitapidocs.com/2023/7b613771-310d-6d89-4b69-475a68033f73.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any help much appreciated,&lt;/P&gt;&lt;P&gt;Lukasz&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 16:27:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175275#M10160</guid>
      <dc:creator>lwlXUTTT</dc:creator>
      <dc:date>2023-08-16T16:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Update ProjectParameter CategorySet without loosing values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175310#M10161</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;I think there is no straightforward solution to this problem. But this topic has already been discussed &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/parameterbindings-lose-value-after-reinsert/m-p/11948645#M71230" target="_blank" rel="noopener"&gt;here&lt;/A&gt; and &lt;A href="https://forums.autodesk.com/t5/revit-api-forum/adding-a-category-to-a-project-parameter/m-p/9112847" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 16:42:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175310#M10161</guid>
      <dc:creator>architect.bim</dc:creator>
      <dc:date>2023-08-16T16:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Update ProjectParameter CategorySet without loosing values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175322#M10162</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6435443"&gt;@lwlXUTTT&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I already answered for the issue. Kindly Check the Below Link and Reference Code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;URL :&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/adding-categories-to-existing-parameter-binding/m-p/12088231#M72638" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/revit-api-forum/adding-categories-to-existing-parameter-binding/m-p/12088231#M72638&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Script&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; //Global Variables
            InstanceBinding instanceBinding = null;
            Definition def = null;

            //Category Need to Add to the Existing Prameter Bindings
            Category cat = Category.GetCategory(doc, BuiltInCategory.OST_Assemblies);

            //Get Instance Binding From Document
            var map = doc.ParameterBindings.ForwardIterator();

            //Iterate using Iterator
            while (map.MoveNext())
            {
                //Get the Parameter need to add
                def = map.Key as Definition;

                if (def.Name == "Demo")
                {
                    instanceBinding = map.Current as InstanceBinding;
                }

            }

            //Get Existing Category Set From the Binding
            CategorySet existingSet = instanceBinding.Categories;

            if(!existingSet.Contains(cat))
            {
                existingSet.Insert(cat);
            }

            //Adding Category to Exsting Instance Binding (Without changing any parameter)
            using (Transaction addCategory = new Transaction(doc,"Add Category"))
            {
                addCategory.Start();

                //Re-Insert Categories to Exsting Instance Binding
                instanceBinding.Categories = existingSet;

                doc.ParameterBindings.ReInsert(def, instanceBinding);

                addCategory.Commit();
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this Helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 16:47:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175322#M10162</guid>
      <dc:creator>Mohamed_Arshad</dc:creator>
      <dc:date>2023-08-16T16:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update ProjectParameter CategorySet without loosing values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175332#M10163</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4552025"&gt;@architect.bim&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; I have solved this issue. Without losing value I can be able to re-insert new Category for Existing Parameters Bindings. Can you please suggest any idea on this &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;URL :&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/adding-categories-to-existing-parameter-binding/m-p/12088231#M72638" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/revit-api-forum/adding-categories-to-existing-parameter-binding/m-p/12088231#M72638&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&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;</description>
      <pubDate>Wed, 16 Aug 2023 16:51:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12175332#M10163</guid>
      <dc:creator>Mohamed_Arshad</dc:creator>
      <dc:date>2023-08-16T16:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Update ProjectParameter CategorySet without loosing values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12176108#M10164</link>
      <description>&lt;P&gt;workaround with saved values to Cache solved the issue partially, I will mark it as a solution -&amp;gt; problem exists for example, when project parameters are used in KeySchedules -&amp;gt; after reinserting, they are gone from key schedule&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 22:34:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/update-projectparameter-categoryset-without-loosing-values/m-p/12176108#M10164</guid>
      <dc:creator>lwlXUTTT</dc:creator>
      <dc:date>2023-08-16T22:34:00Z</dc:date>
    </item>
  </channel>
</rss>

