<?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 Verify if a parameter is a shared parameter in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5385771#M75046</link>
    <description>&lt;P&gt;In here, a piece of a code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach (Parameter param in elementType.Parameters) //Pega Type&lt;BR /&gt;{&lt;BR /&gt;if (param.Definition.Name == "CotaA")&lt;BR /&gt;{&lt;BR /&gt;trans.Start();&lt;BR /&gt;if ((CotaA != 0) &amp;amp;&amp;amp; (param.IsShared))&lt;BR /&gt;{&lt;BR /&gt;param.Set(CotaA);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;return Result.Failed;&lt;BR /&gt;trans.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and always fail in revit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to check if the parameter in revit "CotaA" is a Shared Parameter.&lt;/P&gt;&lt;P&gt;Tks.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Nov 2014 14:01:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-11-06T14:01:47Z</dc:date>
    <item>
      <title>Verify if a parameter is a shared parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5385771#M75046</link>
      <description>&lt;P&gt;In here, a piece of a code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach (Parameter param in elementType.Parameters) //Pega Type&lt;BR /&gt;{&lt;BR /&gt;if (param.Definition.Name == "CotaA")&lt;BR /&gt;{&lt;BR /&gt;trans.Start();&lt;BR /&gt;if ((CotaA != 0) &amp;amp;&amp;amp; (param.IsShared))&lt;BR /&gt;{&lt;BR /&gt;param.Set(CotaA);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;return Result.Failed;&lt;BR /&gt;trans.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and always fail in revit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to check if the parameter in revit "CotaA" is a Shared Parameter.&lt;/P&gt;&lt;P&gt;Tks.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 14:01:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5385771#M75046</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-06T14:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Verify if a parameter is a shared parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5387465#M75047</link>
      <description>&lt;P&gt;What type is the variable&amp;nbsp;&lt;SPAN&gt;CotaA, and is it the same as the storage type for the parameter labelled "CotaA"?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The statement &lt;EM&gt;CotaA != 0&lt;/EM&gt;&amp;nbsp;suggests&amp;nbsp;that it's an integer, if the "CotaA" parameter is not compatible with integer values then the param.Set(CotaA) will fail. Variable CotaA might also have a value of zero, failing your test, it might not even be an issue with the parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step through with debugger and see what's going on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 00:47:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5387465#M75047</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-07T00:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Verify if a parameter is a shared parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5388005#M75048</link>
      <description>&lt;P&gt;Dear h.paulo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can adress your parameter directly without stepping through the whole Parameters map.&lt;/P&gt;&lt;P&gt;Just use elementType.LookupParameter(string yourParamName).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally, what happens if you try to set the parameter &lt;EM&gt;manually&lt;/EM&gt; ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May it be that your "elementType" is a FamilySymbol, and that your Family has geometric constraints that prevent it from accepting your input values for the "CotaA" parameter?&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;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 08:31:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5388005#M75048</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2014-11-07T08:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Verify if a parameter is a shared parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5388231#M75049</link>
      <description>&lt;P&gt;The variable "CotaA" is defined as double, and it's the same storage, the parameter is compatible and the bool param.IsShared return TRUE, but the program fails because something in that piece of code cancel the debugging.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tks.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 10:53:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5388231#M75049</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-07T10:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Verify if a parameter is a shared parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5388243#M75050</link>
      <description>&lt;P&gt;The parameter must set with a form that appears in Revit when I run the add-in, till there it works, and the test param.IsShared is TRUE but always fail and the parameters is not setted. There isn't errors in the code, but always return as canceled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 10:58:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5388243#M75050</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-07T10:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Verify if a parameter is a shared parameter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5388247#M75051</link>
      <description>&lt;P&gt;Hi h.paulo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;you don't commit your Transaction since Commit() is in the "else" branch; also, you leave your function with return before executing the Commit().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sorry, didn't read it carefully enough.&lt;/P&gt;&lt;P&gt;Nonetheless, you start a transaction without ending it properly if using the "else"-branch.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You always do that if both CotaA is not zero AND CotaA is shared.&lt;/P&gt;&lt;P&gt;What if CotaA's current value is zero ?&lt;/P&gt;&lt;P&gt;In this case, you will not be able to change it to another value, using your current code.&lt;/P&gt;&lt;P&gt;Maybe zero is the default value for a double parameter.&lt;/P&gt;&lt;P&gt;Thus, once a ElementType is created with default zero value, it won't be updated when executing your code.&lt;/P&gt;&lt;P&gt;It will always stay at zero.&lt;/P&gt;&lt;P&gt;So change "(CotaA != 0) &amp;amp;&amp;amp; (param.IsShared))" to "(param.IsShared)".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 11:20:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/verify-if-a-parameter-is-a-shared-parameter/m-p/5388247#M75051</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2014-11-07T11:20:20Z</dc:date>
    </item>
  </channel>
</rss>

