<?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: Help: Get iProperties selection Item by API in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633464#M146885</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim AssemblyDOC As AssemblyDocument = ThisApplication.ActiveDocument
Dim ITEM As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select an Item")

If (Not ITEM Is Nothing) Then
	Dim ITEMPropertySets As PropertySets = ITEM.Definition.Document.PropertySets
	Dim ITEMPropertySet As PropertySet = ITEMPropertySets.Item("Design Tracking Properties")
	Dim ITEMMaterial As Inventor.Property = ITEMPropertySet.Item("Material")
	MsgBox("THE PART NUMBER: " &amp;amp; ITEMMaterial.Value)
End If&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Arthur Knoors&lt;/P&gt;</description>
    <pubDate>Wed, 21 Dec 2022 08:09:16 GMT</pubDate>
    <dc:creator>bradeneuropeArthur</dc:creator>
    <dc:date>2022-12-21T08:09:16Z</dc:date>
    <item>
      <title>Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11629598#M146739</link>
      <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;Could you please help me check what's wrong in my Code that I'm using to read selection item's iProperties:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim AssemblyDOC As AssemblyDocument = _InventorApp.ActiveDocument
Dim ITEM = _InventorApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select an Item")
If (Not ITEM Is Nothing) Then
	Dim ITEMPropertySets As PropertySets = ITEM.PropertySets
	Dim ITEMPropertySet As PropertySet = nITEMPropertySets.Item("Design Tracking Properties")
	Dim ITEMPartNumber As Property = nITEMPropertySet.Item("Part Number")
	MsgBox("THE PART NUMBER: " &amp;amp; ITEMPartNumber)
End If&lt;/LI-CODE&gt;&lt;P&gt;I'm using VS2022 + Inventor 2018&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 13:40:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11629598#M146739</guid>
      <dc:creator>ngnam1988</dc:creator>
      <dc:date>2022-12-19T13:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11629637#M146740</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1252980"&gt;@ngnam1988&lt;/a&gt;.&amp;nbsp; The object you are most likely returning from your Pick method is a &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=ComponentOccurrence" target="_blank" rel="noopener"&gt;ComponentOccurrence&lt;/A&gt;, not a &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Document" target="_blank" rel="noopener"&gt;Document&lt;/A&gt; object.&amp;nbsp; The&amp;nbsp;ComponentOccurrence object does not directly have a '&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Document_PropertySets" target="_blank" rel="noopener"&gt;PropertySets&lt;/A&gt;' property, that is only accessible from a Document type object.&amp;nbsp; There are a few ways to access the iProperties that are associated with an assembly component, but none of them are direct, the way you have it there.&amp;nbsp; If going the API way, similar to what you have above, then you will need to get the Document that the assembly component represents first, then you can use that Document to access the iProperties from.&amp;nbsp; There are two ways to get the Document from a component:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- ComponentOccurrence.ReferencedDocumentDescriptor.ReferencedDocument&lt;/P&gt;
&lt;P&gt;&amp;nbsp;-&amp;nbsp;ComponentOccurrence.Definition.Document&lt;/P&gt;
&lt;P&gt;Or, if the component is a 'top level' one (not within a sub assembly), you may be able to use the iLogic shortcut snippet iProperties.Value(ComponentOccurrence.Name, "PropertySetName", "Property.Name") to access it.&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; Below is an example of one way to alter your code.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim AssemblyDOC As AssemblyDocument = _InventorApp.ActiveDocument
Dim ITEM = _InventorApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select an Item")
If (Not ITEM Is Nothing) Then
	Dim oComp As ComponentOccurrence = ITEM 'or try to Cast it to correct Type
	Dim oCompDoc As Document = oComp.ReferencedDocumentDescriptor.ReferencedDocument
	Dim ITEMPropertySets As PropertySets = oCompDoc.PropertySets
	Dim ITEMPropertySet As PropertySet = ITEMPropertySets.Item("Design Tracking Properties")
	Dim ITEMPartNumber As Inventor.Property = ITEMPropertySet.Item("Part Number")
	MsgBox("THE PART NUMBER: " &amp;amp; ITEMPartNumber)
End If&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Dec 2022 13:58:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11629637#M146740</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-12-19T13:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11629648#M146742</link>
      <description>&lt;LI-CODE lang="general"&gt;Dim AssemblyDOC As AssemblyDocument = ThisApplication.ActiveDocument
Dim ITEM As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select an Item")

If (Not ITEM Is Nothing) Then
	Dim ITEMPropertySets As PropertySets = ITEM.Definition.Document.PropertySets
	Dim ITEMPropertySet As PropertySet = ITEMPropertySets.Item("Design Tracking Properties")
	Dim ITEMPartNumber As Inventor.Property = ITEMPropertySet.Item("Part Number")
	MsgBox("THE PART NUMBER: " &amp;amp; ITEMPartNumber.Value)
End If&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Dec 2022 13:57:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11629648#M146742</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2022-12-19T13:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11630764#M146786</link>
      <description>Thanks for your explain &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;,&lt;BR /&gt;It's very useful for me who starting to learn with code.</description>
      <pubDate>Tue, 20 Dec 2022 00:54:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11630764#M146786</guid>
      <dc:creator>ngnam1988</dc:creator>
      <dc:date>2022-12-20T00:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11631396#M146802</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By this way can we get the physical properties (Mass, Volume, ...) selected item? Could you help me how to do it?&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 09:59:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11631396#M146802</guid>
      <dc:creator>ngnam1988</dc:creator>
      <dc:date>2022-12-20T09:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11631603#M146814</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim AssemblyDOC As AssemblyDocument = ThisApplication.ActiveDocument
Dim ITEM As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select an Item")

If (Not ITEM Is Nothing) Then
	Dim a As Inventor.Document = ITEM.Definition.Document

	
	MsgBox("THE MASS IS: " &amp;amp; a.ComponentDefinition.MassProperties.Mass)
End If&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 12:08:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11631603#M146814</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2022-12-20T12:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11631610#M146815</link>
      <description>&lt;P&gt;Or more options like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim AssemblyDOC As AssemblyDocument = ThisApplication.ActiveDocument
Dim ITEM As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select an Item")

If (Not ITEM Is Nothing) Then
	Dim a As Inventor.Document = ITEM.Definition.Document
	
	Dim MyMass As String= a.ComponentDefinition.MassProperties.Mass
	Dim MyVolume As String = a.ComponentDefinition.MassProperties.Volume
	Dim MyArea As String = a.ComponentDefinition.MassProperties.Area
	
	MsgBox("THE MASS: " &amp;amp; MyMass)
	MsgBox("THE VOLUME: " &amp;amp; MyVolume)
	MsgBox("THE AREA: " &amp;amp; MyArea)
End If&lt;/LI-CODE&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Arthur Knoors&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 12:13:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11631610#M146815</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2022-12-20T12:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633196#M146875</link>
      <description>&lt;P&gt;Thank you very much!&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I learnt to much from your codes. I'm trying get &lt;STRONG&gt;Material&lt;/STRONG&gt;&amp;nbsp;of selected item. Could you please help me?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 03:22:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633196#M146875</guid>
      <dc:creator>ngnam1988</dc:creator>
      <dc:date>2022-12-21T03:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633464#M146885</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim AssemblyDOC As AssemblyDocument = ThisApplication.ActiveDocument
Dim ITEM As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select an Item")

If (Not ITEM Is Nothing) Then
	Dim ITEMPropertySets As PropertySets = ITEM.Definition.Document.PropertySets
	Dim ITEMPropertySet As PropertySet = ITEMPropertySets.Item("Design Tracking Properties")
	Dim ITEMMaterial As Inventor.Property = ITEMPropertySet.Item("Material")
	MsgBox("THE PART NUMBER: " &amp;amp; ITEMMaterial.Value)
End If&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Arthur Knoors&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 08:09:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633464#M146885</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2022-12-21T08:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633884#M146896</link>
      <description>&lt;P&gt;Thanks for your help&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I got it, and I can understand the key for my question is:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim ITEM As Inventor.Document = ITEM.Definition.Document&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ngnam1988_0-1671624654924.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1154893iA2263D30F365216D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ngnam1988_0-1671624654924.png" alt="ngnam1988_0-1671624654924.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 12:07:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633884#M146896</guid>
      <dc:creator>ngnam1988</dc:creator>
      <dc:date>2022-12-21T12:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Get iProperties selection Item by API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633918#M146898</link>
      <description>&lt;P&gt;Please read this overview of properties:&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 12:18:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-get-iproperties-selection-item-by-api/m-p/11633918#M146898</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2022-12-21T12:18:50Z</dc:date>
    </item>
  </channel>
</rss>

