<?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: Add Parameters To Element in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8624670#M53164</link>
    <description>&lt;P&gt;Yes, you can easily add parameters from the user interface, but please notice that this is the Revit API (i.e. coding) forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Feb 2019 13:41:47 GMT</pubDate>
    <dc:creator>stever66</dc:creator>
    <dc:date>2019-02-27T13:41:47Z</dc:date>
    <item>
      <title>Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7703776#M53155</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not a very experienced Revit developer (nor an experienced Revit user), so I'm sorry if I got something wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to add new parameters to Revit objects via the API. I'm developing an AddIn to do so, but the parameters should be visible in this window:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Parameters.PNG" style="width: 641px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/452094i1D450EEEA5C1EC1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Parameters.PNG" alt="Parameters.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I'm sorry, I'm using the German version of Revit, but I think this is called the Properties Palette in English).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I add a new set of values there?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to add a new instance parameter to an existing Revit element, but I couldn't find any information on how to do so.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like I can access all parameters of an object via&lt;/P&gt;&lt;PRE&gt;element.Parameters&lt;/PRE&gt;&lt;P&gt;Which returns a ParameterSet. ParameterSet contains the method Insert, but I don't know how to use it. Moreover, in the API documentation, it says that "New parameters can be added to Elements by adding a ParameterBinding object to the Document object." What does this mean?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or did I get this completely&amp;nbsp;wrong and Instance Parameters are not what I'm&amp;nbsp;looking for?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 13:34:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7703776#M53155</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-19T13:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7705937#M53156</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Did you find this link?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2018.1/7978cb57-0a48-489e-2c8f-116fa2561437.htm?section=exampleToggle" target="_blank"&gt;http://www.revitapidocs.com/2018.1/7978cb57-0a48-489e-2c8f-116fa2561437.htm?section=exampleToggle&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code example also shows how to bind an instance parameter to the document.&lt;BR /&gt;I hope this is what you are looking for.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2018 11:32:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7705937#M53156</guid>
      <dc:creator>so-chong</dc:creator>
      <dc:date>2018-01-20T11:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7709609#M53157</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Revit SDK samples have one sample named RoomSchedule which has some code snippet on shared parameter creation, you may refer to this sample for more details.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also copy/paste the code snippet below for your convenience:&lt;/P&gt;
&lt;PRE&gt;        /// &amp;lt;summary&amp;gt;
        /// Create shared parameter for Rooms category
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;returns&amp;gt;True, shared parameter exists; false, doesn't exist&amp;lt;/returns&amp;gt;
        private bool CreateMyRoomSharedParameter()
        {
            // Create Room Shared Parameter Routine: --&amp;gt;
            // 1: Check whether the Room shared parameter("External Room ID") has been defined.
            // 2: Share parameter file locates under sample directory of this .dll module.
            // 3: Add a group named "SDKSampleRoomScheduleGroup".
            // 4: Add a shared parameter named "External Room ID" to "Rooms" category, which is visible.
            //    The "External Room ID" parameter will be used to map to spreadsheet based room ID(which is unique)

            try
            {
                // check whether shared parameter exists
                if (ShareParameterExists(RoomsData.SharedParam))
                {
                    return true;
                }

                // create shared parameter file
                String modulePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                String paramFile = modulePath + "\\RoomScheduleSharedParameters.txt";
                if (File.Exists(paramFile))
                {
                    File.Delete(paramFile);
                }
                FileStream fs = File.Create(paramFile);
                fs.Close();

                // cache application handle
                Autodesk.Revit.ApplicationServices.Application revitApp = m_commandData.Application.Application;

                // prepare shared parameter file
                m_commandData.Application.Application.SharedParametersFilename = paramFile;

                // open shared parameter file
                DefinitionFile parafile = revitApp.OpenSharedParameterFile();

                // create a group
                DefinitionGroup apiGroup = parafile.Groups.Create("SDKSampleRoomScheduleGroup");

                // create a visible "External Room ID" of text type.
                ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions = new ExternalDefinitionCreationOptions(RoomsData.SharedParam, ParameterType.Text);
                Definition roomSharedParamDef = apiGroup.Definitions.Create(ExternalDefinitionCreationOptions);

                // get Rooms category
                Category roomCat = m_commandData.Application.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Rooms);
                CategorySet categories = revitApp.Create.NewCategorySet();
                categories.Insert(roomCat);

                // insert the new parameter
                InstanceBinding binding = revitApp.Create.NewInstanceBinding(categories);
                m_commandData.Application.ActiveUIDocument.Document.ParameterBindings.Insert(roomSharedParamDef, binding);
                return false;
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to create shared parameter: " + ex.Message);
            }
        }
&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Jan 2018 15:46:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7709609#M53157</guid>
      <dc:creator>JimJia</dc:creator>
      <dc:date>2018-01-22T15:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7720794#M53158</link>
      <description>&lt;P&gt;Thank's a lot, that helped me quite a bit!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 20:43:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7720794#M53158</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-24T20:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7721080#M53159</link>
      <description>&lt;P&gt;I'm glad you got a solution.&amp;nbsp; You might also find this post of mine helpful:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/sorting-parameters-in-the-family-editor/td-p/7676931" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/sorting-parameters-in-the-family-editor/td-p/7676931&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is basically &amp;nbsp;"A sharp macro that runs from within the family manager, and adds and sorts&amp;nbsp;parameters from the shared parameters file."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even though I made a sharp macro, the main block of code&amp;nbsp;will run in Visual Studio.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 21:44:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/7721080#M53159</guid>
      <dc:creator>stever66</dc:creator>
      <dc:date>2018-01-24T21:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8264939#M53160</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have started to develop something similar. Is it possible to share your code here ?.&lt;/P&gt;&lt;P&gt;This will save me some amount of time. We can always exchange knowledge. I have started recently to do development for Revit. My target is to increas the interoperability in my workflows through managing my families using Excel sheets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;CadRobots&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 07:35:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8264939#M53160</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-13T07:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8455185#M53161</link>
      <description>&lt;P&gt;I've been struggling with a problem related to this for quite a while now. I manage to add a shared parameter to instances of elements I desire but I cannot utilise the .Set( command on it since I get an exception saying that the same parameter that I've just created is read-only. This comes down to a situation where I'm able to add a parameter and make it user modifiable but I can't modify it through the API which is absurd. Anyone's got an idea where might my mistake be?&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2018 09:52:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8455185#M53161</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-09T09:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8455203#M53162</link>
      <description>&lt;P&gt;I've just managed to avoid the read-only exception. Earlier I was trying to assign the value of the parameter to all wall objects in the project file. When I select some walls by hand and then run the command everything works. I wonder why some of the walls won't allow me to change the value from API. Does anyone know a workaround for that? There is always a risk that I might stumble upon one of those "evil walls" while selecting and then the code will fail.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2018 10:27:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8455203#M53162</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-09T10:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8624230#M53163</link>
      <description>&lt;P&gt;Is there no other way to create an element parameter other than coding? there should be?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 10:28:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8624230#M53163</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-27T10:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add Parameters To Element</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8624670#M53164</link>
      <description>&lt;P&gt;Yes, you can easily add parameters from the user interface, but please notice that this is the Revit API (i.e. coding) forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 13:41:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/add-parameters-to-element/m-p/8624670#M53164</guid>
      <dc:creator>stever66</dc:creator>
      <dc:date>2019-02-27T13:41:47Z</dc:date>
    </item>
  </channel>
</rss>

