<?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: ILOGIC: Open selected parts from assembly and run some code inside it in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/8265992#M88818</link>
    <description>&lt;P&gt;You can do pretty much what ever you can imagine up.. just a case of finding what you need to make it happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's something I've knocked up. Run it as an external rule.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Version:1.0 StartHTML:00000145 EndHTML:00005278 StartFragment:00000294 EndFragment:00005246 StartSelection:00000294 EndSelection:00000294SyntaxEditor Code Snippet&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPart&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sRuleName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"My rule Name"&lt;/SPAN&gt;
&lt;SPAN&gt;Line1&lt;/SPAN&gt; :
&lt;SPAN&gt;'''&lt;/SPAN&gt;&lt;SPAN&gt;Pick part occurrence&lt;/SPAN&gt;
&lt;SPAN&gt;oPart&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(&lt;SPAN&gt;SelectionFilterEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kAssemblyLeafOccurrenceFilter&lt;/SPAN&gt;, &lt;SPAN&gt;"Select Part"&lt;/SPAN&gt;)
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPart&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
	&lt;SPAN&gt;Else&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;oFileName&lt;/SPAN&gt;)
		&lt;SPAN&gt;auto&lt;/SPAN&gt; = &lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;Automation&lt;/SPAN&gt;
			&lt;SPAN&gt;Try&lt;/SPAN&gt;
			&lt;SPAN&gt;auto&lt;/SPAN&gt;.&lt;SPAN&gt;RunRule&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;, &lt;SPAN&gt;sRuleName&lt;/SPAN&gt;)
			&lt;SPAN&gt;Catch&lt;/SPAN&gt;
				&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Cannot find a rule with the name "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sRuleName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"."&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbLf&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"Please try again."&lt;/SPAN&gt;, &lt;SPAN&gt;"Open and run"&lt;/SPAN&gt;)
			&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
		&lt;SPAN&gt;'''&lt;/SPAN&gt;&lt;SPAN&gt;Close the document with SAVE (as False), without SAVE (As True)&lt;/SPAN&gt;
		&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;)
	
		&lt;SPAN&gt;Question&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Repeat Command?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Open and run"&lt;/SPAN&gt;, &lt;SPAN&gt;MessageBoxButtons&lt;/SPAN&gt;.&lt;SPAN&gt;OKCancel&lt;/SPAN&gt;)
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Question&lt;/SPAN&gt; = &lt;SPAN&gt;vbOK&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;''Repeat command&lt;/SPAN&gt;
			&lt;SPAN&gt;GoTo&lt;/SPAN&gt; &lt;SPAN&gt;Line1&lt;/SPAN&gt;
		&lt;SPAN&gt;Else&lt;/SPAN&gt;
			&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Sep 2018 14:44:00 GMT</pubDate>
    <dc:creator>lmc.engineering</dc:creator>
    <dc:date>2018-09-13T14:44:00Z</dc:date>
    <item>
      <title>ILOGIC: Open selected parts from assembly and run some code inside it</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/8265319#M88803</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IS there any ilogic avaiable to&amp;nbsp;open selected parts from assembly and run some code inside it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 10:28:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/8265319#M88803</guid>
      <dc:creator>amarcoc</dc:creator>
      <dc:date>2018-09-13T10:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: ILOGIC: Open selected parts from assembly and run some code inside it</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/8265456#M88804</link>
      <description>&lt;P&gt;Almost certainly yes, but that depends on a few definitions. How&amp;nbsp;do you intend to select the components? What do you mean by "run some code inside" the components?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 11:49:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/8265456#M88804</guid>
      <dc:creator>tdant</dc:creator>
      <dc:date>2018-09-13T11:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: ILOGIC: Open selected parts from assembly and run some code inside it</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/8265992#M88818</link>
      <description>&lt;P&gt;You can do pretty much what ever you can imagine up.. just a case of finding what you need to make it happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's something I've knocked up. Run it as an external rule.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Version:1.0 StartHTML:00000145 EndHTML:00005278 StartFragment:00000294 EndFragment:00005246 StartSelection:00000294 EndSelection:00000294SyntaxEditor Code Snippet&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPart&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sRuleName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"My rule Name"&lt;/SPAN&gt;
&lt;SPAN&gt;Line1&lt;/SPAN&gt; :
&lt;SPAN&gt;'''&lt;/SPAN&gt;&lt;SPAN&gt;Pick part occurrence&lt;/SPAN&gt;
&lt;SPAN&gt;oPart&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(&lt;SPAN&gt;SelectionFilterEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kAssemblyLeafOccurrenceFilter&lt;/SPAN&gt;, &lt;SPAN&gt;"Select Part"&lt;/SPAN&gt;)
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPart&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
	&lt;SPAN&gt;Else&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;oFileName&lt;/SPAN&gt;)
		&lt;SPAN&gt;auto&lt;/SPAN&gt; = &lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;Automation&lt;/SPAN&gt;
			&lt;SPAN&gt;Try&lt;/SPAN&gt;
			&lt;SPAN&gt;auto&lt;/SPAN&gt;.&lt;SPAN&gt;RunRule&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;, &lt;SPAN&gt;sRuleName&lt;/SPAN&gt;)
			&lt;SPAN&gt;Catch&lt;/SPAN&gt;
				&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Cannot find a rule with the name "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sRuleName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"."&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbLf&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"Please try again."&lt;/SPAN&gt;, &lt;SPAN&gt;"Open and run"&lt;/SPAN&gt;)
			&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
		&lt;SPAN&gt;'''&lt;/SPAN&gt;&lt;SPAN&gt;Close the document with SAVE (as False), without SAVE (As True)&lt;/SPAN&gt;
		&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;)
	
		&lt;SPAN&gt;Question&lt;/SPAN&gt; = &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Repeat Command?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Open and run"&lt;/SPAN&gt;, &lt;SPAN&gt;MessageBoxButtons&lt;/SPAN&gt;.&lt;SPAN&gt;OKCancel&lt;/SPAN&gt;)
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Question&lt;/SPAN&gt; = &lt;SPAN&gt;vbOK&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;''Repeat command&lt;/SPAN&gt;
			&lt;SPAN&gt;GoTo&lt;/SPAN&gt; &lt;SPAN&gt;Line1&lt;/SPAN&gt;
		&lt;SPAN&gt;Else&lt;/SPAN&gt;
			&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 14:44:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/8265992#M88818</guid>
      <dc:creator>lmc.engineering</dc:creator>
      <dc:date>2018-09-13T14:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: ILOGIC: Open selected parts from assembly and run some code inside it</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/9380884#M107002</link>
      <description>&lt;P&gt;Hello, i'm trying to run an external rule to act on the opened part and i'm getting the following error.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error in rule: no_sculpt, in document: FRONT DESK STRUCTURE.iam

Unable to cast COM object of type 'Inventor._DocumentClass' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;/LI-CODE&gt;&lt;P&gt;it seems this is an issue with running the rule at the context of the assembly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any thoughts on making this work?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 17:48:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/9380884#M107002</guid>
      <dc:creator>Chris.Brough</dc:creator>
      <dc:date>2020-03-16T17:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: ILOGIC: Open selected parts from assembly and run some code inside it</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/9380959#M107007</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4597951"&gt;@Chris.Brough&lt;/a&gt; .&lt;/P&gt;&lt;P&gt;If you have an assembly open and active when the code starts, no matter if you're in-place-editing a part within the main assembly, the assembly is still the active document environment to the code.&amp;nbsp; And Sculpt is only available at the Part modeling level.&lt;/P&gt;&lt;P&gt;So, to access that feature tool from an open assembly, you would have to first dig down through the object structure to the Part Document.&amp;nbsp; There's a few ways of doing that.&amp;nbsp; You could have the program pause to let you manually select the part within the assembly, or you could select it by name from the group of already open documents within Inventor, or you could select it by name through the ComponentOccurrences.&lt;/P&gt;&lt;P&gt;If you go the Occurrences route, you then get the Component's Definition.&amp;nbsp; Then define it as a PartComponentDefinition.&amp;nbsp; Then down to it's Features (or PartFeatures).&amp;nbsp; Then down to SculptFeatures.&amp;nbsp; Then SculptFeatures.Add(fill in the options).&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 18:25:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/9380959#M107007</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-03-16T18:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: ILOGIC: Open selected parts from assembly and run some code inside it</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/10381553#M125383</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There's a few ways of doing that.&amp;nbsp; You could have the program pause to let you manually select the part within the assembly, ---&amp;gt;&amp;nbsp; Can you please show this in code pls?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 05:44:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/10381553#M125383</guid>
      <dc:creator>ramji.m</dc:creator>
      <dc:date>2021-06-11T05:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: ILOGIC: Open selected parts from assembly and run some code inside it</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/10389022#M125446</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7382498"&gt;@ramji.m&lt;/a&gt;.&amp;nbsp; There is an example of this in the earlier post.&amp;nbsp; It is a method defined under the &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-897C9BBD-258E-4471-9AFA-09D54D8E3074" target="_blank" rel="noopener"&gt;CommandManager&lt;/A&gt; called '&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-60D6E12D-1471-4AD9-9748-67D7EE63333D" target="_blank" rel="noopener"&gt;Pick&lt;/A&gt;'.&amp;nbsp; It is a very popular tool that a lot of folks use that will pause your iLogic rule and wait for you to either manually select something in your model window, or cancel (Esc) out of the command.&amp;nbsp; Then the iLogic rule will continue with any code below that point in the rule.&amp;nbsp; It uses the &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-A5140ECD-F330-4324-AF22-9791403DA05D" target="_blank" rel="noopener"&gt;SelectionFilterEnum&lt;/A&gt;, to allow you to specify/set which types of objects you want to select, and you can also specify a prompt message that will appear either next to your pointer or in the status bar, while you are in that manual selection mode.&amp;nbsp; You can use it to return your selected item to a variable within your rule, to you can work with that object through that variable.&amp;nbsp; It is common practice to use some code following this line in your rule, that makes sure you have selected something (in case you canceled the selection without selecting anything).&amp;nbsp; It may also be necessary to define that variable ahead of time as the type of object you are expecting, or check what type of object it is afterwards then create that type of variable then set the object as its value.&amp;nbsp; Once that variable's type is set right, you can access that variable's available properties, methods, events, etc.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oOcc As ComponentOccurrence
oOcc = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "'Select an assembly occurrence.")
If oOcc Is Nothing Then
	MsgBox("You did not select anything. Exiting.", , "")
	Exit Sub
Else
	MsgBox("You selected an assembly occurrrence named '" &amp;amp; oOcc.Name &amp;amp; "'.",,"")
End If&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 15:19:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-open-selected-parts-from-assembly-and-run-some-code/m-p/10389022#M125446</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-06-14T15:19:46Z</dc:date>
    </item>
  </channel>
</rss>

