<?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 How to change sub-discipline value by code in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-change-sub-discipline-value-by-code/m-p/8204825#M48214</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I change the value of the "Sub-discipline" property &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="subdiscipline.png" style="width: 432px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/535530iA26787D8B53DDD61/image-size/large?v=v2&amp;amp;px=999" role="button" title="subdiscipline.png" alt="subdiscipline.png" /&gt;&lt;/span&gt;, I found how can I validate it like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string strDiscipline = doc.ActiveView.LookupParameter("Sub-Discipline").AsString();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;and a routine:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;BindingMap map = doc.ParameterBindings;
DefinitionBindingMapIterator it = map.ForwardIterator();

it.Reset();
StringBuilder st = new StringBuilder();
Element projectInfoElement = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_ProjectInformation).FirstElement();

while (it.MoveNext())
{
    if (it.Key.Name == "Sub-Discipline") {
          ElementBinding element = it.Current as ElementBinding;
          Parameter foundParameter= projectInfoElement.get_Parameter(it.Key);
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but return null when fund the propierty,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How can I get the current array of sub-disciplines, and pick one to change it?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Aug 2018 17:36:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-08-16T17:36:37Z</dc:date>
    <item>
      <title>How to change sub-discipline value by code</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-change-sub-discipline-value-by-code/m-p/8204825#M48214</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I change the value of the "Sub-discipline" property &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="subdiscipline.png" style="width: 432px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/535530iA26787D8B53DDD61/image-size/large?v=v2&amp;amp;px=999" role="button" title="subdiscipline.png" alt="subdiscipline.png" /&gt;&lt;/span&gt;, I found how can I validate it like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string strDiscipline = doc.ActiveView.LookupParameter("Sub-Discipline").AsString();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;and a routine:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;BindingMap map = doc.ParameterBindings;
DefinitionBindingMapIterator it = map.ForwardIterator();

it.Reset();
StringBuilder st = new StringBuilder();
Element projectInfoElement = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_ProjectInformation).FirstElement();

while (it.MoveNext())
{
    if (it.Key.Name == "Sub-Discipline") {
          ElementBinding element = it.Current as ElementBinding;
          Parameter foundParameter= projectInfoElement.get_Parameter(it.Key);
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but return null when fund the propierty,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How can I get the current array of sub-disciplines, and pick one to change it?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 17:36:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-change-sub-discipline-value-by-code/m-p/8204825#M48214</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-16T17:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to change sub-discipline value by code</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-change-sub-discipline-value-by-code/m-p/8214715#M48215</link>
      <description>&lt;P&gt;Hi, I found this way to change the sub-discipline in the activeview after a couple of weeks trying, hope this can help to other novate programmers in Revit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. I don't know if this is the good practice to do it, but It's the way that works for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; if (!string.IsNullOrEmpty(doc.ActiveView.LookupParameter("Sub-Discipline").AsString()))
     doc.ActiveView.LookupParameter("Sub-Discipline").Set("MY_EXISTING_SUB-DISCIPLINE");&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 17:55:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-change-sub-discipline-value-by-code/m-p/8214715#M48215</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-21T17:55:17Z</dc:date>
    </item>
  </channel>
</rss>

