<?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: ExternalDefinition.HideWhenNoValue and Parameter.ClearValue() never work in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9301675#M36797</link>
    <description>&lt;P&gt;I suppose shared parameters are an end user feature, but in the end, both edits through Revit and using the API operate on the same underlying data (though the sets of possible operations available to each option are not equal).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can check what the value of&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;HideWhenNoValue was on a shared parameter when&lt;/SPAN&gt; Revit imported/bound it by calling the&amp;nbsp;&lt;EM&gt;&lt;SPAN style="text-align: left; color: #666666; text-transform: none; line-height: 1.7142; text-indent: 0px; letter-spacing: normal; font-family: inherit; font-size: 16px; font-variant: normal; font-weight: normal; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; cursor: text; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;SharedParameterElement.ShouldHideWhenNoValue()&lt;/SPAN&gt;&lt;/EM&gt; method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently testing if I can &lt;EM&gt;ReInsert&lt;/EM&gt; an &lt;EM&gt;ExternalDefinition&lt;/EM&gt; with the same (or equivalent) bindings when its value for &lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;HideWhenNoValue is different from when it was previously imported to achieve the desired result. If not, I strongly suspect that I can use a more complicated and (likely) slow process to do so.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2020 19:03:30 GMT</pubDate>
    <dc:creator>mhannonQ65N2</dc:creator>
    <dc:date>2020-02-06T19:03:30Z</dc:date>
    <item>
      <title>ExternalDefinition.HideWhenNoValue and Parameter.ClearValue() never work</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9299778#M36793</link>
      <description>&lt;P&gt;Calling Parameter.ClearValue() doesn't work when&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;HideWhenNoValue&lt;/SPAN&gt; is set to true. I have tried setting &lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;HideWhenNoValue to true from within code, but it would later revert to false and&amp;nbsp;Parameter.ClearValue() would fail.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;I tried setting it to true immediately before calling Parameter.ClearValue() but it still failed. Finally, I edited the actual shared parameter file and it still fails.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if (defs.TryGetValue(shared.GUID, out var def) &amp;amp;&amp;amp; def.HideWhenNoValue)
{
    shared.ClearValue();
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When it fails, it does so with the message&amp;nbsp;&lt;FONT&gt;'Cannot call ClearValue when HideWhenNoValue is false.' (I have also double checked and the parameter is not ReadOnly and is shared). How are the HideWhenNoValue property and ClearValue() method supposed to be used?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally, even when HideWhenNoValue is set to true, the parameter still shows up in the properties panel.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 23:39:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9299778#M36793</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2020-02-05T23:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: ExternalDefinition.HideWhenNoValue and Parameter.ClearValue() never work</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9300320#M36794</link>
      <description>&lt;P&gt;Interesting. I never noticed these properties before. Hence, no idea how they are supposed to be used. It sounds as if they may be broken.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Whenever you have a question about how to use some Revit API call, please check the SDK first of all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found an occurrence of&amp;nbsp;&lt;SPAN&gt;HideWhenNoValue&amp;nbsp;&lt;/SPAN&gt;here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;.../SDK/Samples/RebarFreeForm/CS/AddSharedParams.cs, line 90&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't see any calls to&amp;nbsp;ClearValue, though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are sure they are broken, please submit separate minimal reproducible cases for each of the issues you describe and I can ask the development team to take a look at them:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please keep every issue clear, minimal, unequivocal and separate. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 09:03:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9300320#M36794</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-02-06T09:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: ExternalDefinition.HideWhenNoValue and Parameter.ClearValue() never work</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9301577#M36795</link>
      <description>&lt;P&gt;I started on a minimal reproducible case and it seems like ClearValue() works when HideWhenNoValue is&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;(manually)&lt;/SPAN&gt; set to true in the parameter file&lt;EM&gt; before&lt;/EM&gt; (manually) importing shared parameters as project parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that when a shared parameter is loaded into a project (by making a project parameter or using the documents ParameterBindings), Revit stores that parameter's information somewhen and doesn't change it even when the shared parameter is modified (at least for&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;HideWhenNoValue&lt;/SPAN&gt;, I am haven't tried this with any other data of the parameter). When accessing Parameter or ParameterElement objects in a document I am only able to see the InternalDefinition, not any ExternalDefinition it may be based on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to set HideWhenNoValue to true for a shared parameter that is already used in the project without losing data? Also, If I modify HideWhenNoValue on an ExternalDefinition from a DefinitionFile, how can I make Revit save that change to the shared parameters file (In my testing that change was never saved, I had to do it manually)?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 18:07:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9301577#M36795</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2020-02-06T18:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: ExternalDefinition.HideWhenNoValue and Parameter.ClearValue() never work</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9301632#M36796</link>
      <description>&lt;P&gt;Interesting observations. Shared parameters are first and foremost an end user feature. Hence, I would ask these questions in the end user Revit architecture forum first. Once that side is clarified, we can return to look at the programming aspects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 18:38:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9301632#M36796</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-02-06T18:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: ExternalDefinition.HideWhenNoValue and Parameter.ClearValue() never work</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9301675#M36797</link>
      <description>&lt;P&gt;I suppose shared parameters are an end user feature, but in the end, both edits through Revit and using the API operate on the same underlying data (though the sets of possible operations available to each option are not equal).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can check what the value of&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;HideWhenNoValue was on a shared parameter when&lt;/SPAN&gt; Revit imported/bound it by calling the&amp;nbsp;&lt;EM&gt;&lt;SPAN style="text-align: left; color: #666666; text-transform: none; line-height: 1.7142; text-indent: 0px; letter-spacing: normal; font-family: inherit; font-size: 16px; font-variant: normal; font-weight: normal; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; cursor: text; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;SharedParameterElement.ShouldHideWhenNoValue()&lt;/SPAN&gt;&lt;/EM&gt; method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently testing if I can &lt;EM&gt;ReInsert&lt;/EM&gt; an &lt;EM&gt;ExternalDefinition&lt;/EM&gt; with the same (or equivalent) bindings when its value for &lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;HideWhenNoValue is different from when it was previously imported to achieve the desired result. If not, I strongly suspect that I can use a more complicated and (likely) slow process to do so.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 19:03:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/9301675#M36797</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2020-02-06T19:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: ExternalDefinition.HideWhenNoValue and Parameter.ClearValue() never work</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/10039263#M36798</link>
      <description>&lt;P&gt;I have been struggling with the same problem. The solution was the following:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I looked for the internal definition of the project parameter (created based on the shared parameter) - got the &lt;EM&gt;Definition&lt;/EM&gt; instance&lt;/LI&gt;&lt;LI&gt;I used a FilteredElementCollector to search for the corresponding &lt;A href="https://www.revitapidocs.com/2016/d8a0f2ae-7e10-39bd-e362-3756cbae661b.htm" target="_self"&gt;SharedParameterElement&lt;/A&gt; in the Revit database with the same Definition&lt;/LI&gt;&lt;LI&gt;After using&amp;nbsp;&lt;EM&gt;ParameterBindings.Remove&lt;/EM&gt; method on the shared parameter external defintition, I also deleted the correspondig SharedParameterElement instance from the document. (Document.Delete method) - this does cause data loss unfortunately&lt;/LI&gt;&lt;LI&gt;At this point I changed the HideWhenNoValue property of the external definition to True, than created a new parameter binding with it.&lt;/LI&gt;&lt;LI&gt;From this point the &lt;EM&gt;ClearValue&lt;/EM&gt; method works fine.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This is my experience on this issue. I hope I could help with it.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 17:14:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/externaldefinition-hidewhennovalue-and-parameter-clearvalue/m-p/10039263#M36798</guid>
      <dc:creator>tamas.somsakBX</dc:creator>
      <dc:date>2021-01-28T17:14:01Z</dc:date>
    </item>
  </channel>
</rss>

