<?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: ForgeTypeId how to use? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9708594#M35222</link>
    <description>&lt;P&gt;A sample code is always welcome:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#if REVIT2019 || REVIT2020
double valueInInternalUnits = UnitUtils.ConvertToInternalUnits(valueInMeters,
  DisplayUnitType.DUT_METERS);
#else
// Revit 2021+
double valueInInternalUnits = UnitUtils.ConvertToInternalUnits(valueInMeters, UnitTypeId.Meters);
#endif&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 24 Aug 2020 15:52:27 GMT</pubDate>
    <dc:creator>FRFR1426</dc:creator>
    <dc:date>2020-08-24T15:52:27Z</dc:date>
    <item>
      <title>ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9439210#M35212</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Have been using 'ConvertFromInternalUnits' for many years using&amp;nbsp;DisplayUnitType, but in Revit 2021 is says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Warning BC40000 &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;'Public Shared Overloads Function ConvertFromInternalUnits(value As Double, displayUnit As DisplayUnitType) As Double' is obsolete: &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;'This method is deprecated in Revit 2021 and may be removed in a future version of Revit. &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Please use the `ConvertFromInternalUnits(double, ForgeTypeId)` overload instead.'.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone tell me how to use&amp;nbsp;ForgeTypeId for Converting using&amp;nbsp;ConvertFromInternalUnits?&lt;/P&gt;&lt;P&gt;Where do I find the Enumerations? or is it not working like that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also seems to need the same ForgeTypeId to get the UnitType of a parameter in Revit 2021 using p.definition.GetSpecTypeId&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any documentation about this (for me new)&amp;nbsp;ForgeTypeId ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chris Hanschen&lt;/P&gt;&lt;P&gt;LKSVDD architecten&lt;/P&gt;&lt;P&gt;The Netherlands&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 13:27:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9439210#M35212</guid>
      <dc:creator>c_hanschen</dc:creator>
      <dc:date>2020-04-13T13:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9439607#M35213</link>
      <description>&lt;P&gt;I'm also very interested in this new type. And while I haven't used it yet, I see in the API that there are 3 classes, &lt;FONT&gt;SpecTypeId&lt;/FONT&gt;, &lt;FONT&gt;SymbolTypeId&lt;/FONT&gt;, and &lt;FONT&gt;UnitTypeId&lt;/FONT&gt;, that contain many ForgeTypeIds in static properties. This is probably where you'll find what you're looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also done a bit of browsing in Revit 2021's data and found some .json files defining Forge schemas for what I guess are the specs, symbols, and units in those classes. What really intrigues me is the possibility of defining custom units (and symbols and specs).&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 16:20:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9439607#M35213</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2020-04-13T16:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9439644#M35214</link>
      <description>&lt;P&gt;I tried redefining leg hands as having 13 inches and Revit reported every file as corrupt. Restoring the ratio alone did not suffice; I had to restore the name to foot/feet for Revit to open any file (including metric files).&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 16:39:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9439644#M35214</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2020-04-13T16:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9440976#M35215</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8377999"&gt;@mhannonQ65N2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where did you find these 'static properties'?&lt;/P&gt;&lt;P&gt;By Example,&amp;nbsp;ForgeTypeId() needs an TypeId definded by a string, I can't find any static values to put into this&amp;nbsp;TypeId as a string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chris Hanschen&lt;/P&gt;&lt;P&gt;The Netherlands&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 06:18:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9440976#M35215</guid>
      <dc:creator>c_hanschen</dc:creator>
      <dc:date>2020-04-14T06:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9441374#M35216</link>
      <description>&lt;P&gt;Please read the What's New section in the Revit API help file RevitAPI.chm provided with the Revit SDK from the Revit developer centre:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.autodesk.com/developer-network/platform-technologies/revit" target="_blank"&gt;https://www.autodesk.com/developer-network/platform-technologies/revit&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 09:55:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9441374#M35216</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-04-14T09:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9442780#M35217</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found it, copy - paste for the people who found this topic before reading the CHM:&lt;/P&gt;&lt;P&gt;All i needed was 'Imports Autodesk.Revit.DB.ForgeTypeId' before it al made sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----- start copy-paste revit api 2021 chm ------&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;Units API changes&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;Revit has converted to use an external reference to unit definitions defined in Forge schemas.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;In the Autodesk.Revit.DB namespace, the enumerations DisplayUnitType, UnitSymbolType, and UnitType have been deprecated in favor of a potentially extensible set of units, symbols, and unit types. The new class:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="2" color="#0000FF"&gt;Autodesk.Revit.DB.ForgeTypeId&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;represents an identifier for a unit, symbol, or other object, and is now used throughout the Revit API to identify units of measurement, symbols, and unit types. Unit types are now referred to as "specs" to avoid confusion with units themselves.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;A ForgeTypeId instance holds a string, called a "typeid", that uniquely identifies a Forge schema. A Forge schema is a JSON document describing a data structure, supporting data interchange between applications. A typeid string includes a namespace and version number and may look something like "autodesk.spec.aec:length-1.0.0" or "autodesk.unit.unit:meters-1.0.0". By default, comparison of ForgeTypeId values in the Revit API ignores the version number.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;The new classes:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="2" color="#0000FF"&gt;Autodesk.Revit.DB.UnitTypeId&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2" color="#0000FF"&gt;Autodesk.Revit.DB.SymbolTypeId&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2" color="#0000FF"&gt;Autodesk.Revit.DB.SpecTypeId&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;contain a default set of named public constant properties of type ForgeTypeId. These values can be used in code replacing values of the deprecated DisplayUnitType, UnitSymbolType, and UnitType enumerations.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;For example, where you previously used DisplayUnitType.DUT_WATTS_PER_SQUARE_METER_KELVIN, you would now use UnitTypeId.WattsPerSquareMeterKelvin. Where you previously used UnitType.UT_HVAC_Density, you would now use SpecTypeId.HvacDensity.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;The UnitUtils class now offers a set of new methods for mapping between enumeration values and ForgeTypeId values to assist clients in migrating code to ForgeTypeId:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;UnitUtils.IsSymbol()&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;UnitUtils.GetSpecTypeId()&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;UnitUtils.GetUnitType()&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;UnitUtils.GetUnitTypeId()&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;UnitUtils.GetDisplayUnitType()&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;UnitUtils.GetSymbolTypeId()&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;UnitUtils.GetUnitSymbolType()&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;Some of the preceding methods are new but are already deprecated. They have been added to the API only to assist clients in migrating code from the old enumerations to the ForgeTypeId class.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;----- end copy-paste revit api 2021 chm ------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chris Hanschen&lt;/P&gt;&lt;P&gt;LKSVDD Architecten&lt;/P&gt;&lt;P&gt;The Netherlands&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 18:25:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9442780#M35217</guid>
      <dc:creator>c_hanschen</dc:creator>
      <dc:date>2020-04-14T18:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9452391#M35218</link>
      <description>&lt;P&gt;string StaticaPressure = UnitFormatUtils.Format(doc.GetUnits(), SpecTypeId.PipingPressure, pipingSystem.GetStaticPressure(), false);&lt;/P&gt;</description>
      <pubDate>Sat, 18 Apr 2020 08:16:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9452391#M35218</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2020-04-18T08:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9455305#M35219</link>
      <description>&lt;P&gt;I would like to start a discussion among those who cannot afford to ignore deploying for "old" Revit versions. Given that there is a lot of add-in developers out there, supporting more than Revit 2021, is there any migration strategy that Autodesk likes to communicate?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short: How do I ensure that I can still compile Revit 2020 builds when the deprecated DisplayUnitType is removed, possibly next year? It would be nice if Autodesk could delay the actual removal to 2022, so that 2021, 2022 and 2023 can be compiled without introducing hundreds of compile-time switches.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Otherwise: I did not inspect the new API in detail yet, but I hope it is written in such a way that it is possible to create an adapter for ForgeTypeId and port old versions to the new style as long as they are supported. In this way we can do an early migration of code that is supposed to compile with backward-compatibility in mind.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 08:25:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9455305#M35219</guid>
      <dc:creator>cwaluga</dc:creator>
      <dc:date>2020-04-20T08:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9455406#M35220</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3142688"&gt;@cwaluga&lt;/a&gt;&amp;nbsp;Please be aware that the Revit development team do not systematically read all the discussion forum threads.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To seriously bring your wish to their attention, I suggest you submit it to the&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;the Revit Idea Station and add your comments there&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-ideas/idb-p/302" target="_blank"&gt;https://forums.autodesk.com/t5/revit-ideas/idb-p/302&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tag it as an API wish:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-ideas/idb-p/302/tab/most-recent/label-name/api" target="_blank"&gt;https://forums.autodesk.com/t5/revit-ideas/idb-p/302/tab/most-recent/label-name/api&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ensure it gets as many votes as possible to underline its importance to you and the rest of the developer community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Revit Idea Station is currently one of the main driving input forces for Revit API enhancements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Revit development team look there. Your comment here in the discussion forum might be overlooked.&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;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 08:59:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9455406#M35220</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-04-20T08:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9555214#M35221</link>
      <description>&lt;P&gt;My plan was hundreds of compile time switches.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 16:02:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9555214#M35221</guid>
      <dc:creator>David_Robison</dc:creator>
      <dc:date>2020-06-02T16:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9708594#M35222</link>
      <description>&lt;P&gt;A sample code is always welcome:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#if REVIT2019 || REVIT2020
double valueInInternalUnits = UnitUtils.ConvertToInternalUnits(valueInMeters,
  DisplayUnitType.DUT_METERS);
#else
// Revit 2021+
double valueInInternalUnits = UnitUtils.ConvertToInternalUnits(valueInMeters, UnitTypeId.Meters);
#endif&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 24 Aug 2020 15:52:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9708594#M35222</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2020-08-24T15:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9708841#M35223</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I would like, how to show the DisplayUnitType in Revit 2021.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;InternalDefinition inter = param.Definition&amp;nbsp;as&amp;nbsp;InternalDefinition;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;displayparam = param.DisplayUnitType;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;unitparam = inter.UnitType;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is obsolete for Revit 2021,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;now is&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//Veamos el BuiltinParameter,DisplayUnitType,UnitType&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;InternalDefinition inter = param.Definition&amp;nbsp;as&amp;nbsp;InternalDefinition;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;displayparam = param.GetUnitTypeId();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;unitparam = inter.GetSpecTypeId();&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;How do I show it?&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-08-24.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/810740i9476A78297A7E13C/image-size/large?v=v2&amp;amp;px=999" role="button" title="2020-08-24.png" alt="2020-08-24.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;How do I show it?&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 17:44:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/9708841#M35223</guid>
      <dc:creator>reylorente1</dc:creator>
      <dc:date>2020-08-24T17:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10150931#M35224</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/81704"&gt;@David_Robison&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;My plan was hundreds of compile time switches.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Me too!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I figured I could move most of my conversions to an extension class which I use to convert my values. In my case most of the conversions in my add-ins are from internal unit to metric and back so I'm getting rid of most compiler flags by concentrating them to a couple of extension classes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static class DoubleExtensions
{
    /// &amp;lt;summary&amp;gt;
    /// Translate double from mm to internal Ft
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;
    /// &amp;lt;returns&amp;gt;New value in Ft&amp;lt;/returns&amp;gt;
    public static double MmToInternal(this double value)
    {
#if RVT2021
        return UnitUtils.ConvertToInternalUnits(value, UnitTypeId.Millimeters);
#else
        return UnitUtils.ConvertToInternalUnits(value, DisplayUnitType.DUT_MILLIMETERS);
#endif
    }

    /// &amp;lt;summary&amp;gt;
    /// Translate double from internal Ft to mm
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;
    /// &amp;lt;returns&amp;gt;New value in mm&amp;lt;/returns&amp;gt;
    public static double InternalToMm(this double value)
    {
#if RVT2021
        return UnitUtils.ConvertFromInternalUnits(value, UnitTypeId.Millimeters);
#else
        return UnitUtils.ConvertFromInternalUnits(value, DisplayUnitType.DUT_MILLIMETERS);
#endif
    }

    /// &amp;lt;summary&amp;gt;
    /// Translate double from degrees to internal radians
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;
    /// &amp;lt;returns&amp;gt;New value in radians&amp;lt;/returns&amp;gt;
    public static double DegToInternal(this double value)
    {
#if RVT2021
        return UnitUtils.ConvertToInternalUnits(value, UnitTypeId.Degrees);
#else
        return UnitUtils.ConvertToInternalUnits(value, DisplayUnitType.DUT_DECIMAL_DEGREES);
#endif
    }

    /// &amp;lt;summary&amp;gt;
    /// Translate double from internal radians to degrees
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;
    /// &amp;lt;returns&amp;gt;New value in degrees&amp;lt;/returns&amp;gt;
    public static double InternalToDeg(this double value)
    {
#if RVT2021
        return UnitUtils.ConvertFromInternalUnits(value, UnitTypeId.Degrees);
#else
        return UnitUtils.ConvertFromInternalUnits(value, DisplayUnitType.DUT_DECIMAL_DEGREES);
#endif
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And with the added bonus that my code gets quite a bit cleaner without all UnitUtils conversions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;double distMm = distance.InternalToMm();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 08:57:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10150931#M35224</guid>
      <dc:creator>ottosson_mathias</dc:creator>
      <dc:date>2021-03-12T08:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10356851#M35225</link>
      <description>&lt;P&gt;so, the way I understand this thread is that:&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a plugin that spans Revit 2021 and 2022 and you need to get units of the project,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In revit 2021, you can use&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;string&lt;/SPAN&gt; getUnits = doc.GetUnits().GetFormatOptions(UnitType.UT_Length).DisplayUnits.ToString();&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;But for the Revit 2022 version, there's no way to get the units unless it's a Forge project and you're running the Revit 2022 API?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 00:01:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10356851#M35225</guid>
      <dc:creator>Maltezc</dc:creator>
      <dc:date>2021-06-02T00:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10356994#M35226</link>
      <description>&lt;P&gt;For Revit 2022, it doesn't need to be any sort of special Forge project. Link it to the Revit 2022 DLL and the function will exist. The signature changes to use ForgeTypeId, but that's just part of the Revit API now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't actually test this code at all, but you would need a change something like this and it will work fine in Revit 2022:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#if !REVIT2022
doc.GetUnits().GetFormatOptions(UnitType.UT_Length)
#else
doc.GetUnits().GetFormatOptions(SpecTypeId.Length)
#endif&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 02 Jun 2021 01:49:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10356994#M35226</guid>
      <dc:creator>David_Robison</dc:creator>
      <dc:date>2021-06-02T01:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357028#M35227</link>
      <description>&lt;P&gt;Thank you for the clarification. That helps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I gotta figure out how to use preprocessor directives as you have used in your example so I can handle different Revit versions in cases such as this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 02:19:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357028#M35227</guid>
      <dc:creator>Maltezc</dc:creator>
      <dc:date>2021-06-02T02:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357374#M35228</link>
      <description>&lt;P&gt;I'm using Visual studio 2019 with compile configurations, named R2019, R2020, R2021 and R022&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code to convert units from internal to millimeter, this is an example of redirecting to code for the used API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Public Function IU2mm(MyValueInternalUnits As Double, Optional AfrondenHeleMm As Boolean = False) As Double '&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Dim mm As Double&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;#If CONFIG = "R2019" Or CONFIG = "R2020" Then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;mm = UnitUtils.ConvertFromInternalUnits(MyValueInternalUnits, DisplayUnitType.DUT_MILLIMETERS)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;#Else&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;mm = UnitUtils.ConvertFromInternalUnits(MyValueInternalUnits, unitTypeId:=UnitTypeId.Millimeters)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;#End If&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;If AfrondenHeleMm = True Then mm = Math.Round(mm, 0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Return mm&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;End Function&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chris Hanschen&lt;/P&gt;&lt;P&gt;LKSVDD architecten&lt;/P&gt;&lt;P&gt;The Netherlands&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 06:18:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357374#M35228</guid>
      <dc:creator>c_hanschen</dc:creator>
      <dc:date>2021-06-02T06:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357472#M35229</link>
      <description>&lt;P&gt;Dear Chris,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the VB example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apparently, the conditional compilation syntax in C# differs slightly from VB:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives" target="_blank"&gt;https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;The #if statement in C# is Boolean and only tests whether the symbol has been defined or not. You can use the operators == (equality) and != (inequality) to test for the bool values `true` or `false`. `true` means the symbol is defined.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a nice discussion on concrete usage:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/2923210/conditional-compilation-and-framework-targets" target="_blank"&gt;https://stackoverflow.com/questions/2923210/conditional-compilation-and-framework-targets&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 07:17:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357472#M35229</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-06-02T07:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357492#M35230</link>
      <description>&lt;P&gt;So, your method could look like this in C#:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    public static double InternalUnitToMillimetres( 
      double a, 
      bool roundup = false )
    {
      double mm;

#if (CONFIG_R2019 || CONFIG_R2020)
      mm = UnitUtils.ConvertFromInternalUnits(
        a, DisplayUnitType.DUT_MILLIMETERS );
#else
      mm = UnitUtils.ConvertFromInternalUnits( 
        a, UnitTypeId.Millimeters );
#endif
      
      return roundup ? Math.Round( mm, 0 ) : mm;
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many, many, more nice examples above...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 07:31:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357492#M35230</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-06-02T07:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: ForgeTypeId how to use?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10359942#M35231</link>
      <description>&lt;P&gt;Hi all, I'm having trouble setting up for multiple versions.&amp;nbsp;&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/trouble-setting-up-multi-versioning/td-p/10359795" target="_self"&gt;I created a separate post here.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is primarily focused on the .csproj part of the setup.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First time using preprocessor directives.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feel free to give it a look over.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd appreciate it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 04:04:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10359942#M35231</guid>
      <dc:creator>Maltezc</dc:creator>
      <dc:date>2021-06-03T04:04:16Z</dc:date>
    </item>
  </channel>
</rss>

