<?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 User interaction in VBA in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3762351#M132648</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an assembly file with parts assembled, and I want the user to move and position the assembled part into a position as they desire, and then run VBA to extract coordinates information to do further calculation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, what I want to do is creat a VBA code that does the following in sequence&lt;/P&gt;&lt;P&gt;1. VBA runs code to assemble the parts (I can do this)&lt;/P&gt;&lt;P&gt;2. go to the autodesk interface and allow user to manipulate the part&lt;/P&gt;&lt;P&gt;3. when user presses a key (e.g. "enter", "space"), the control returns to VBA&lt;/P&gt;&lt;P&gt;4. VBA run some code to extract the coordinates and do some calculations (I can do this too)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with step 2 and 3? I'm hoping there is something like an input box that waits for the user to click ok, before continuing to run the rest of the coding. But I realise that the input boxes and message boxes do not allow users to work on the model in the background. Since I need users to move/rotate the part to the desired position, I can't simply use input and message boxes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ying Ying&lt;/P&gt;</description>
    <pubDate>Sat, 26 Jan 2013 18:03:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-01-26T18:03:24Z</dc:date>
    <item>
      <title>User interaction in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3762351#M132648</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an assembly file with parts assembled, and I want the user to move and position the assembled part into a position as they desire, and then run VBA to extract coordinates information to do further calculation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, what I want to do is creat a VBA code that does the following in sequence&lt;/P&gt;&lt;P&gt;1. VBA runs code to assemble the parts (I can do this)&lt;/P&gt;&lt;P&gt;2. go to the autodesk interface and allow user to manipulate the part&lt;/P&gt;&lt;P&gt;3. when user presses a key (e.g. "enter", "space"), the control returns to VBA&lt;/P&gt;&lt;P&gt;4. VBA run some code to extract the coordinates and do some calculations (I can do this too)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with step 2 and 3? I'm hoping there is something like an input box that waits for the user to click ok, before continuing to run the rest of the coding. But I realise that the input boxes and message boxes do not allow users to work on the model in the background. Since I need users to move/rotate the part to the desired position, I can't simply use input and message boxes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ying Ying&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2013 18:03:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3762351#M132648</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-01-26T18:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: User interaction in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3762761#M132649</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create a User form and display it modeless. So user can interact in Inventor and if he presses the OK-Button (or whatever) in your form, your sceond code part is executed.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2013 21:08:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3762761#M132649</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2013-01-27T21:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: User interaction in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3773582#M132650</link>
      <description>&lt;P&gt;Hi Ying,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could do something like this.&lt;/P&gt;
&lt;P&gt;- Create the part you need&lt;/P&gt;
&lt;P&gt;- Invoke the placement command&lt;/P&gt;
&lt;P&gt;- Watch for the termination of that command and continue with your code&lt;/P&gt;
&lt;P&gt;You could just create an instance of this class and call its CreateAndPlacePart function.&lt;/P&gt;
&lt;PRE&gt;Public WithEvents uiEvents As UserInputEvents

' Main function

Public Sub CreateAndPlacePart()

    ' Create the part ....
    
    ' Start watching for the terminate command event

    Set uiEvents = ThisApplication.CommandManager.UserInputEvents
    
    ' Now place the part
    
    Dim cm As CommandManager
    Set cm = ThisApplication.CommandManager
    
    Call cm.PostPrivateEvent(kFileNameEvent, "C:\NewlyCreatedPart.ipt")

    Dim cd As ControlDefinition
    Set cd = cm.ControlDefinitions("AssemblyPlaceComponentCmd")
    
    ' Start the placement
    
    Call cd.Execute
    
End Sub

Private Sub uiEvents_OnTerminateCommand(ByVal CommandName As String, ByVal Context As NameValueMap)
    
    Set uiEvents = Nothing
    
    MsgBox "Placement finished. We can continue with our code"
    
End Sub
&lt;/PRE&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2013 18:39:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3773582#M132650</guid>
      <dc:creator>adam.nagy</dc:creator>
      <dc:date>2013-02-08T18:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: User interaction in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3773634#M132651</link>
      <description>&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;Thanks for helping! I'm currently using Krieg's suggestion to just create a user form to run the parts before and after the user manipulation. I guess it makes sense and it's really easy to do.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;With regards to Adam's suggestion, I'm not quite sure if you are suggesting to invoke part placement command as in the same command as when we add components to an assembly? Doesn't that only allow you to move the parts around only once? For my case, I want the user to place a part relative to another part, by rotating and moving in 3D space, so it's going to take more than a move-and-drop action. Could you clarify please? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;Thanks,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;Ying Ying&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2013 19:32:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3773634#M132651</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-08T19:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: User interaction in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3773646#M132652</link>
      <description>&lt;P&gt;Hi Ying,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, I thought you just wanted to place the component and then continue.&lt;/P&gt;
&lt;P&gt;Just ignore my comment then. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2013 19:44:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/user-interaction-in-vba/m-p/3773646#M132652</guid>
      <dc:creator>adam.nagy</dc:creator>
      <dc:date>2013-02-08T19:44:18Z</dc:date>
    </item>
  </channel>
</rss>

