<?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: Conversion from Deprecated ParameterType to ForgeTypeId in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10751232#M22479</link>
    <description>&lt;P&gt;Simple error on my part&lt;/P&gt;&lt;LI-CODE lang="general"&gt;if (Category.IsBuiltInCategory(def.GetDataType()))&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 11 Nov 2021 15:45:41 GMT</pubDate>
    <dc:creator>stephen_harrison</dc:creator>
    <dc:date>2021-11-11T15:45:41Z</dc:date>
    <item>
      <title>Conversion from Deprecated ParameterType to ForgeTypeId</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10748964#M22473</link>
      <description>&lt;P&gt;Could somebody please help me out with this conversion from Deprecated ParameterType to ForgeTypeId for Revit 2022 Api? I have read the documentation with the SDK but I am no doubt missing something very obvious&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The 'old' code snippets I am having difficulty converting are:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;ParameterType spParmType = spFamilyListItem.DataType;

ParameterType spFamilyParmType = spFamilyListItem.DataType;

ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions(spNameAmend, spFamilyParmType);

ParameterType spParamTypeNoFamily = definition.ParameterType;

DataType = familyParameter.Definition.ParameterType,

if (ParameterType.YesNo == fp.Definition.ParameterType)&lt;/LI-CODE&gt;&lt;P&gt;What would be the 2022 equivalent for it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like I need to substitute &lt;STRONG&gt;ParameterType&lt;/STRONG&gt; for &lt;STRONG&gt;ForgeTypeId&lt;/STRONG&gt; and &lt;STRONG&gt;GetDataType()&lt;/STRONG&gt; for &lt;STRONG&gt;DataType&lt;/STRONG&gt; but this doesn’t work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There must be something very obvious I am overlooking.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 19:50:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10748964#M22473</guid>
      <dc:creator>stephen_harrison</dc:creator>
      <dc:date>2021-11-10T19:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion from Deprecated ParameterType to ForgeTypeId</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10749166#M22474</link>
      <description>&lt;P&gt;Within the constructor&lt;BR /&gt;ExternalDefinitionCreationOptions(String, ForgeTypeId)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ForgeTypeId refers to either:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;A spec type i.e. Length/Number/YesNo etc.:&lt;/U&gt;&lt;BR /&gt;e.g. SpecTypeId.Boolean.YesNo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;or a Category of a Family type parameter:&lt;/U&gt;&lt;BR /&gt;e.g. Category.GetBuiltInCategoryTypeId&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To convert from the old ParameterType to ForgeTypeId use:&lt;BR /&gt;SpecUtils.GetSpecTypeId(ParameterType)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Definition.GetSpecTypeId is obsolete use Definition.GetDataType i.e. I assume the term 'DataType' was introduced as it is more broad covering both spec and family type category.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 21:36:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10749166#M22474</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-11-10T21:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion from Deprecated ParameterType to ForgeTypeId</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10750109#M22475</link>
      <description>&lt;P&gt;I dealt with all those issues migrating The Building Coder samples and other projects. You should be able to find examples of all required conversions in these posts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2021/04/pdf-export-forgetypeid-and-multi-target-add-in.html" target="_blank"&gt;PDF Export, ForgeTypeId and Multi-Target Add-In&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2021/04/revit-2022-migrates-bim360-team-to-docs.html" target="_blank"&gt;Revit 2022 Migrates BIM360 Team to Docs&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2021/04/revit-2022-sdk-and-the-building-coder-samples.html" target="_blank"&gt;Revit 2022 SDK and The Building Coder Samples&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2021/04/whats-new-in-the-revit-2022-api.html" target="_blank"&gt;What's New in the Revit 2022 API&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2021/05/revitlookup-update-fuslogvw-and-override-joins.html" target="_blank"&gt;RevitLookup Update, Fuslogvw and Override Joins&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2021/06/forgetypeid-and-units-revisited.html" target="_blank"&gt;ForgeTypeId and Units Revisited&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 09:10:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10750109#M22475</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-11-11T09:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion from Deprecated ParameterType to ForgeTypeId</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10750851#M22476</link>
      <description>&lt;P&gt;Thank you for the prompt response and explanations.&lt;/P&gt;&lt;P&gt;If I have understood correctly the amendments to my code would look like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Pre 2022: ParameterType spParmType = spFamilyListItem.DataType;
2022 Code: ForgeTypeId spParmType = spFamilyListItem.DataType;


Pre 2022: ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions(string, ParameterType);
2022 Code: ExternalDefinitionCreationOptions option = new ExternalDefinitionCreationOptions(string, ForgeTypeId)


Pre 2022: ParameterType spParamTypeNoFamily = definition.ParameterType;
2022 Code: ForgeTypeId spParamTypeNoFamily = Definition.GetDataType();


Pre 2022: DataType = familyParameter.Definition.ParameterType,
2022 Code: DataType = familyParameter.Definition. GetDataType();


Pre 2022: if (ParameterType.YesNo == fp.Definition.ParameterType)
2022 Code: if (SpecTypeId.Boolean.YesNo == fp.Definition.GetDataType())


Pre 2022:  if (def.ParameterType == ParameterType.FamilyType)
2022 Code:  if (!Category.IsBuiltInCategory(def.GetDataType()))&lt;/LI-CODE&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;Again thanks for the assistance.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 14:46:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10750851#M22476</guid>
      <dc:creator>stephen_harrison</dc:creator>
      <dc:date>2021-11-11T14:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion from Deprecated ParameterType to ForgeTypeId</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10750947#M22477</link>
      <description>&lt;P&gt;I have just had an opportunity to try out my solutions and I have clearly missed something as I am getting an error when I run the app in the form off a shared parameter is reporting as a family parameter which leads me to think my error is in the following amended code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;if (!Category.IsBuiltInCategory(def.GetDataType()))&lt;/LI-CODE&gt;&lt;P&gt;I clearly haven't understood as well as id hoped!!!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 15:17:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10750947#M22477</guid>
      <dc:creator>stephen_harrison</dc:creator>
      <dc:date>2021-11-11T15:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion from Deprecated ParameterType to ForgeTypeId</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10751199#M22478</link>
      <description>&lt;P&gt;Don't have enough context to make a judgement e.g. what is:&amp;nbsp;spFamilyListItem etc?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wouldn't assume it is to do with the line you highlighted since a ForgeTypeId either is or isn't representing a built-in category (so logically you would expect that to work either way). Like all things however it may not be anticipating the form of ForgeTypeId you are feeding into it (null etc.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to be more descriptive about the line causing the error and what the exact exception message states. There is a process isn't there, you step through and the line that causes the error stands out (throws the exception). Set up a simple example that goes through the process of what you are aiming for and indicates the full context of it. From that I and others will be able to understand what is and isn't being done correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;None of the above looks that wrong but perhaps you can't use the same approach for all parameter types.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 15:44:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10751199#M22478</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-11-11T15:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion from Deprecated ParameterType to ForgeTypeId</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10751232#M22479</link>
      <description>&lt;P&gt;Simple error on my part&lt;/P&gt;&lt;LI-CODE lang="general"&gt;if (Category.IsBuiltInCategory(def.GetDataType()))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 Nov 2021 15:45:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/conversion-from-deprecated-parametertype-to-forgetypeid/m-p/10751232#M22479</guid>
      <dc:creator>stephen_harrison</dc:creator>
      <dc:date>2021-11-11T15:45:41Z</dc:date>
    </item>
  </channel>
</rss>

