<?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: Revit 2021 DisplayUnitType in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9796191#M31226</link>
    <description>&lt;P&gt;Thanks Jeremy&lt;/P&gt;&lt;P&gt;Ill keep working on this but look forward to your solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;</description>
    <pubDate>Sun, 11 Oct 2020 11:44:55 GMT</pubDate>
    <dc:creator>stephen_harrison</dc:creator>
    <dc:date>2020-10-11T11:44:55Z</dc:date>
    <item>
      <title>Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9793861#M31221</link>
      <description>&lt;P&gt;I hope someone can help but I am struggling to update a section of my code I have been utilising for a few years now but due to it being deprecated in Revit 2021 I need to update it.&lt;/P&gt;&lt;P&gt;I have read the few posts I have found on the subject as well as the Revit SDK&amp;nbsp;Revit Platform API Changes and Additions but I feel as though I am having a senior moment and missing the obvious:&lt;/P&gt;&lt;P&gt;My code snippet is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case StorageType.Double:&lt;/P&gt;&lt;P&gt;double? nullable = t.AsDouble(fp);&lt;/P&gt;&lt;P&gt;if (nullable.HasValue)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;DisplayUnitType displayUnitType = fp.DisplayUnitType;&lt;/P&gt;&lt;P&gt;value = UnitUtils.ConvertFromInternalUnits(nullable.Value, displayUnitType).ToString();&lt;/P&gt;&lt;P&gt;break;&lt;/P&gt;&lt;P&gt;}&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note&amp;nbsp;&lt;/P&gt;&lt;P&gt;t = FamilyType and fp = FamilyParameter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any assistance would be appreciated in order to hopefully put an end to my senior moment!!&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 13:01:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9793861#M31221</guid>
      <dc:creator>stephen_harrison</dc:creator>
      <dc:date>2020-10-09T13:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9794035#M31222</link>
      <description>&lt;P&gt;I have heard that expression several times recently... 'senior moment'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just looked it up, and apparently the first know usage is from 1996:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.merriam-webster.com/dictionary/senior%20moment" target="_blank"&gt;https://www.merriam-webster.com/dictionary/senior%20moment&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was not aware of it until just recently...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, maybe this post will help:&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/forgetypeid-how-to-use/m-p/9455305" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9455305&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let us know, and also how you end up migrating your code to eliminate the deprecated API use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 14:26:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9794035#M31222</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-10-09T14:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9795389#M31223</link>
      <description>&lt;P&gt;Thank you Jeremy for your prompt response.&lt;/P&gt;&lt;P&gt;You obviously haven't got to that stage in life were senior moments become such a regular occurrence that you start to question how you manage to do anything in the first place!&lt;/P&gt;&lt;P&gt;I regret I have read that post and a few others several times and still cannot see what should be a very obvious solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2020 13:19:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9795389#M31223</guid>
      <dc:creator>stephen_harrison</dc:creator>
      <dc:date>2020-10-10T13:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9795427#M31224</link>
      <description>&lt;P&gt;Not quite, but I'm getting there and working on it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll take a look at The Building Coder samples... there may be a similar migration required there...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2020 14:08:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9795427#M31224</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-10-10T14:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9795432#M31225</link>
      <description>&lt;P&gt;Yes indeed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2020/04/2021-migration-add-in-language-and-bim360-login.html#4" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2020/04/2021-migration-add-in-language-and-bim360-login.html#4&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/files/tbc_samples_2021_migr_01.txt" target="_blank"&gt;https://thebuildingcoder.typepad.com/files/tbc_samples_2021_migr_01.txt&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CmdDutAbbreviation.cs(37,33,37,48): warning CS0618: 'DisplayUnitType' is obsolete: 'This enumeration is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `ForgeTypeId` class instead. Use constant members of the `UnitTypeId` class to replace uses of specific values of this enumeration.'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll take a look anon...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Oct 2020 14:12:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9795432#M31225</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-10-10T14:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9796191#M31226</link>
      <description>&lt;P&gt;Thanks Jeremy&lt;/P&gt;&lt;P&gt;Ill keep working on this but look forward to your solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 11:44:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9796191#M31226</guid>
      <dc:creator>stephen_harrison</dc:creator>
      <dc:date>2020-10-11T11:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9810626#M31227</link>
      <description>&lt;P&gt;Senior Moment over, thankfully.&lt;/P&gt;&lt;P&gt;Very embarrassing however how simple the solution was!!&lt;/P&gt;&lt;LI-CODE lang="general"&gt;//Pre 2021
                        DisplayUnitType displayUnitType = fp.DisplayUnitType;
                        value = UnitUtils.ConvertFromInternalUnits(nullable.Value, displayUnitType).ToString();
                        //2021
                        ForgeTypeId forgeTypeId = fp.GetUnitTypeId();
                        value = UnitUtils.ConvertFromInternalUnits(nullable.Value, forgeTypeId).ToString();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 13:03:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9810626#M31227</guid>
      <dc:creator>stephen_harrison</dc:creator>
      <dc:date>2020-10-19T13:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9812420#M31228</link>
      <description>&lt;P&gt;Congratulations on resolving this and thank you for sharing the simple solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That motivates me to take a look at the deprecated unit API usage warnings generated by The Building Coder samples...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 08:50:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9812420#M31228</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-10-20T08:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Revit 2021 DisplayUnitType</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9812452#M31229</link>
      <description>&lt;P&gt;I did it the easy way, commenting out everything that looked complicated, and just handling the trivial cases:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eliminated deprecated API usage warnings by removing calls to pre-ForgeTypeId unit functionality:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/compare/2021.0.150.5...2021.0.150.6" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/compare/2021.0.150.5...2021.0.150.6&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 09:05:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/revit-2021-displayunittype/m-p/9812452#M31229</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-10-20T09:05:48Z</dc:date>
    </item>
  </channel>
</rss>

