<?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: Use pick-method to acces sub-occurrence in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11795891#M149727</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2465441"&gt;@mcloughlin_b&lt;/a&gt;.&amp;nbsp; What you described does sound possible, but it would be pretty complicated to create a code to do that.&amp;nbsp; You would have to design your own Windows Form within the code, not just use an InputListBox, and not just a simple iLogic Form.&amp;nbsp; When you create the form yourself, within the rule, you will be able to control it, and get feedback from it, when specific events happen.&amp;nbsp; You would need for this form to be 'Modal' (stays open while other stuff happens), and would needs this ability to get 'live' feedback from the form when the selection changes, without needing to click an Apply button or something like that.&amp;nbsp; But I really do not see the point in going through that much complexity and work to create something like that when the model browser pane is pretty much already a list of the components in your assembly, which you can choose one and it will be highlighted.&amp;nbsp; Why not just use the model browser pane instead.&amp;nbsp; With that you can select any level sub-component you want, in a very similar way.&lt;/P&gt;
&lt;P&gt;But just in case you still want to pursue that direction anyways, below is a link to an article I write a few years ago which shows you an example of creating your own Windows Form within an iLogic rule.&amp;nbsp; That link will only be good for a few more days though, since Autodesk will be destroying all user submitted articles like this on March 8th.&amp;nbsp; I will also attach a PDF of that same content here, so it can live on after that point.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/community/article/328361" target="_blank" rel="noopener"&gt;https://knowledge.autodesk.com/community/article/328361&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2023 12:28:38 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2023-03-03T12:28:38Z</dc:date>
    <item>
      <title>Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8686987#M96045</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm wondering if anybody knows of a way to use the pick-method (CommandManager.Pick) to access a sub assembly two levels deep.&lt;/P&gt;
&lt;P&gt;With kAssemblyOccurrenceFilter i can only get the first level sub assemblies. I would like to pick an assembly within a subassembly. With this selectionfilter i can't even "rightclick &amp;gt; select other" to accomplish this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My hopes are that there should be a way to make the function ignore phantom occurrences or something like that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;/Jhoel&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 12:40:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8686987#M96045</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2019-03-27T12:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8687348#M96052</link>
      <description>&lt;P&gt;One simple way to address your problem is to double click into the assembly above your target assembly before running the macro.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 15:11:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8687348#M96052</guid>
      <dc:creator>tdant</dc:creator>
      <dc:date>2019-03-27T15:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8687431#M96054</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4749770"&gt;@tdant&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for taking the time to answear. This is actually the way I do it right now and it works ok. The only thing is that it highlights parts when hovering over them and it could be a bit confusing for the end user...&lt;/P&gt;
&lt;P&gt;I havn't been able to find a better soulution though, and I doubt that there even is one so I'll accept your answear as a solution &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 15:17:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8687431#M96054</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2019-03-27T15:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8688111#M96061</link>
      <description>&lt;P&gt;You seem to have edited your answear to something completley different now...&lt;/P&gt;
&lt;P&gt;That won't work for me as I want to be able to pick sub assemblies from different higher level sub assemblies...&lt;/P&gt;
&lt;P&gt;I ended up doing a workaround where i build a Listbox containing the names of all selectable sub assemblies. Once an item in this listbox is selected i add the occurrenceproxy of that sub assembly to a highlightset to show the user which component will be selected. Then the selection is confirmed by klicking an OK-button.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 18:43:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8688111#M96061</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2019-03-27T18:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8689791#M96079</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also filter the occurrences in the OnSelect event.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 10:19:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8689791#M96079</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-03-28T10:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8700678#M96208</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt; , Do you mean there are other filter options there? Can you provide an example of using the OnSelect event? &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;
&lt;P&gt;/Jhoel&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 09:42:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8700678#M96208</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2019-04-02T09:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8703302#M96243</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try below iLogic code to access sub occurrence from selected object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main()
 Dim oInteraction  As InteractionEvents 
 oInteraction = ThisApplication.CommandManager.CreateInteractionEvents

 Dim oSelect As SelectEvents
 oSelect = oInteraction.SelectEvents 
  
 AddHandler oSelect.OnSelect, AddressOf oSelectEvents_OnSelect

 oInteraction.Start

 
End Sub

Private Sub oSelectEvents_OnSelect(ByVal JustSelectedEntities As ObjectsEnumerator, ByVal SelectionDevice As SelectionDeviceEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As Inventor.View)
     Dim obj As Object 
	 For Each obj In JustSelectedEntities 
	 	MessageBox.Show(obj.Type)
	 Next
End Sub&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 05:32:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8703302#M96243</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-04-03T05:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8703355#M96244</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;
&lt;P&gt;When running this code however i only get like a couple of seconds to do my selection, and even then it behaves just like if i would have used the pick method with kAllEntitiesFilter...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 06:12:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8703355#M96244</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2019-04-03T06:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8703548#M96248</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, both pick and Onselect event are serving same purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 07:51:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/8703548#M96248</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-04-03T07:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11789279#M149608</link>
      <description>Hi Joel&lt;BR /&gt;This is exactly what I am looking for and have been battling for a while with the selection filters.. Are you able to share your code? Much appreciated&lt;BR /&gt;&lt;BR /&gt;Bryan</description>
      <pubDate>Wed, 01 Mar 2023 03:55:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11789279#M149608</guid>
      <dc:creator>mcloughlin_b</dc:creator>
      <dc:date>2023-03-01T03:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11790677#M149637</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2465441"&gt;@mcloughlin_b&lt;/a&gt;.&amp;nbsp; This sounds like you should be able to use SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, instead of&amp;nbsp;SelectionFilterEnum.kAssemblyOccurrenceFilter.&amp;nbsp; However, that one usually just wants to focus on part type components, so it is challenging, if not impossible in certain situations to use on the regular model screen for selecting a sub-sub assembly.&amp;nbsp; In some quick testing, I was able to select a sub-sub assembly using either of those two selection filters, when I selected the browser node for it, from the model browser tree, instead of selecting it on the model screen.&amp;nbsp; That is one fairly painless workaround.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 15:38:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11790677#M149637</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-03-01T15:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11794549#M149708</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2465441"&gt;@mcloughlin_b&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another option is to "dig" into sub assemblies until you get to the occurrence you are actually looking for, then return once it is selected.&amp;nbsp; Here is a simple example:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	Dim aDoc As AssemblyDocument = TryCast(ThisApplication.ActiveDocument, AssemblyDocument)
	If IsNothing(aDoc) Then Logger.Debug("ActiveDocument type is not: " &amp;amp; CType(aDoc.Type, ObjectTypeEnum).ToString)
	
	Dim targetOccurrence As ComponentOccurrence = DigTillPickCorrectly()
	If Not ThisApplication.ActiveEditDocument Is aDoc Then aDoc.ComponentDefinition.ActiveOccurrence.ExitEdit(ExitTypeEnum.kExitToTop)
	If IsNothing(targetOccurrence) Then Logger.Debug("Nothing Selected") : Exit Sub
		
	MessageBox.Show("Selected Occurrence: " &amp;amp; targetOccurrence.Name, "Result")

End Sub

Function DigTillPickCorrectly() As ComponentOccurrence
	Pick :
	Dim PickOccurrence As ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select An Occurrence")
	If IsNothing(PickOccurrence) Then Return Nothing ' If nothing gets selected then we're done
	If PickOccurrence.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject
		Answer = MessageBox.Show("Selected Occurrence: " &amp;amp; PickOccurrence.Name &amp;amp; " is an Assembly, would you like to pick an occurrence within this Assembly? ", "Dig Deeper?",MessageBoxButtons.YesNo)
		If Answer = vbYes Then PickOccurrence.Edit() : GoTo Pick
	End If
	Return PickOccurrence
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you have any questions.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 21:22:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11794549#M149708</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2023-03-02T21:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11794994#M149712</link>
      <description>&lt;P&gt;hi JCamper&lt;/P&gt;&lt;P&gt;That's some nifty code and works really well.&lt;/P&gt;&lt;P&gt;I was more looking for presenting the user with a dialogue (Input list box)populated with all assemblies in the model and then highlighting on screen the model file currently selected in the dialogue. truth be told I am not even sure this is possible to change the highlighted selection in real time as the user scrolls through the list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scratching my head over this one for sure.&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;Bryan&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 02:14:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11794994#M149712</guid>
      <dc:creator>mcloughlin_b</dc:creator>
      <dc:date>2023-03-03T02:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Use pick-method to acces sub-occurrence</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11795891#M149727</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2465441"&gt;@mcloughlin_b&lt;/a&gt;.&amp;nbsp; What you described does sound possible, but it would be pretty complicated to create a code to do that.&amp;nbsp; You would have to design your own Windows Form within the code, not just use an InputListBox, and not just a simple iLogic Form.&amp;nbsp; When you create the form yourself, within the rule, you will be able to control it, and get feedback from it, when specific events happen.&amp;nbsp; You would need for this form to be 'Modal' (stays open while other stuff happens), and would needs this ability to get 'live' feedback from the form when the selection changes, without needing to click an Apply button or something like that.&amp;nbsp; But I really do not see the point in going through that much complexity and work to create something like that when the model browser pane is pretty much already a list of the components in your assembly, which you can choose one and it will be highlighted.&amp;nbsp; Why not just use the model browser pane instead.&amp;nbsp; With that you can select any level sub-component you want, in a very similar way.&lt;/P&gt;
&lt;P&gt;But just in case you still want to pursue that direction anyways, below is a link to an article I write a few years ago which shows you an example of creating your own Windows Form within an iLogic rule.&amp;nbsp; That link will only be good for a few more days though, since Autodesk will be destroying all user submitted articles like this on March 8th.&amp;nbsp; I will also attach a PDF of that same content here, so it can live on after that point.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/community/article/328361" target="_blank" rel="noopener"&gt;https://knowledge.autodesk.com/community/article/328361&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 12:28:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/use-pick-method-to-acces-sub-occurrence/m-p/11795891#M149727</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-03-03T12:28:38Z</dc:date>
    </item>
  </channel>
</rss>

