<?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: API Return Enumerator Name instead of numeric value? in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378463#M101182</link>
    <description>&lt;P&gt;in iLogic i use 2 functions to find the name of an object or an Enum. check this rule. (i didnt find a vba version of this rules.)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Public Sub Main()
	' for inventor objects you can use this to find the object type.
    showtInventorObjectType(ThisDoc.Document)
	
	' for enum objects you can use this for the name
    showEnumName(Of HorizontalTextAlignmentEnum)(ThisApplication.ActiveDocument.ActiveSheet.DrawingNotes.GeneralNotes.Item(1).HorizontalJustification)

End Sub

Public Sub showtInventorObjectType(obj As Object)
    showEnumName(Of ObjectTypeEnum)(obj.type)
End Sub

Public Sub showEnumName(Of T)(obj As Object)
    MsgBox(CType(obj, T).ToString())
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Mar 2020 22:51:40 GMT</pubDate>
    <dc:creator>JelteDeJong</dc:creator>
    <dc:date>2020-03-14T22:51:40Z</dc:date>
    <item>
      <title>API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7059126#M101175</link>
      <description>&lt;P&gt;Is it possible to have the API return the name of an enumerator like kAlighTextLeft instead of 19970? Having the name be returned could save a trip to the API help to find out what it is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Debug.Print ThisApplication.ActiveDocument.ActiveSheet.DrawingNotes.GeneralNotes.Item(1).HorizontalJustification&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 17:28:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7059126#M101175</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2017-05-03T17:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7060816#M101176</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when I use VB.net (visual studio) and I Add&amp;nbsp; ".tostring" I get the text value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oDrawDoc As Inventor.DrawingDocument = _inventorApp.ActiveDocument&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox(oDrawDoc.ActiveSheet.DrawingNotes.GeneralNotes.Item(1).HorizontalJustification.ToString)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;without the tostring, I get the number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in iLogic I always get the number....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what are you using?&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 09:16:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7060816#M101176</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2017-05-04T09:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7093461#M101177</link>
      <description>&lt;P&gt;I tried the .ToString method but couldn't get it to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also tried the .GetName method, but it says cannot use on Type integer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stuck using a select case structure...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wondering if there is any way around this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'oRow.BOMStructure.GetName("BOMStructureEnum", oRow.BOMStructure),

vs 

		Select Case oRow.BOMStructure
			Case 51970
				oRowBOMStructure = "Normal"
			Case 51973
				oRowBOMStructure = "Purchased"
			Case 51971
				oRowBOMStructure = "Phantom"
			Case 51972
				oRowBOMStructure = "Reference"
			Case 51974
				oRowBOMStructure = "Inseparable"
			Case Else
				oRowBOMStructure = "??????????"	
		End Select&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 May 2017 16:51:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7093461#M101177</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-05-18T16:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7093695#M101178</link>
      <description>&lt;P&gt;I use VBA, iLogic, and VB.net for different things. Though I frequently use VBA for testing and playing around with code, which then gets moved to my VB.net addin. So a solution that works in VBA and/or iLogic would be best.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for posting your VB.net solution. I'm sure I'll end up using it at some point.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 18:28:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7093695#M101178</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2017-05-18T18:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7107067#M101179</link>
      <description>&lt;P&gt;VBA doesn't support anything to get the name of an enum value, like .NET does.&amp;nbsp; It would be possible, with some work, to write your own function similar to what Justin suggests above&amp;nbsp;but it's not built into VBA.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 20:27:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/7107067#M101179</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2017-05-24T20:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9377850#M101180</link>
      <description>&lt;P&gt;Sorry for updating this but there is still something to discuss -&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/fail-to-get-textual-names-of-browser-node-types-with-tostring-in/td-p/9377817" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/inventor-customization/fail-to-get-textual-names-of-browser-node-types-with-tostring-in/td-p/9377817&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 10:18:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9377850#M101180</guid>
      <dc:creator>Maxim-CADman77</dc:creator>
      <dc:date>2020-03-14T10:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378337#M101181</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;See my response here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/fail-to-get-textual-names-of-browser-node-types-with-tostring-in/td-p/9377817" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/fail-to-get-textual-names-of-browser-node-types-with-tostring-in/td-p/9377817&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Using ThisApplication.TestManager you can find the Enumerator valuename &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 19:58:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378337#M101181</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-03-14T19:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378463#M101182</link>
      <description>&lt;P&gt;in iLogic i use 2 functions to find the name of an object or an Enum. check this rule. (i didnt find a vba version of this rules.)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Public Sub Main()
	' for inventor objects you can use this to find the object type.
    showtInventorObjectType(ThisDoc.Document)
	
	' for enum objects you can use this for the name
    showEnumName(Of HorizontalTextAlignmentEnum)(ThisApplication.ActiveDocument.ActiveSheet.DrawingNotes.GeneralNotes.Item(1).HorizontalJustification)

End Sub

Public Sub showtInventorObjectType(obj As Object)
    showEnumName(Of ObjectTypeEnum)(obj.type)
End Sub

Public Sub showEnumName(Of T)(obj As Object)
    MsgBox(CType(obj, T).ToString())
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 22:51:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378463#M101182</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2020-03-14T22:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378571#M101183</link>
      <description>&lt;P&gt;As I said before, this isn't supported in VBA but with .NET it's built-in and can easily be done.&amp;nbsp; Here's an example that will work in a Visual Basic program or an iLogic rule (since they both use .NET) that will display the name of an enum value for the current document type.&amp;nbsp; The first argument identifies which enum and the second is the enum value and it returns the name of the enum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MsgBox([Enum].GetName(GetType(Inventor.DocumentTypeEnum), doc.DocumentType))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Mar 2020 03:01:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378571#M101183</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2020-03-15T03:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: API Return Enumerator Name instead of numeric value?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378702#M101184</link>
      <description>&lt;P&gt;This helped me.&lt;BR /&gt;Good trick. Thanks!!&lt;/P&gt;</description>
      <pubDate>Sun, 15 Mar 2020 08:17:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/api-return-enumerator-name-instead-of-numeric-value/m-p/9378702#M101184</guid>
      <dc:creator>Maxim-CADman77</dc:creator>
      <dc:date>2020-03-15T08:17:04Z</dc:date>
    </item>
  </channel>
</rss>

