Inventor Vb.Net "AddIn" - Show iProperties Dialog Box & Tab Across To "Project"

Inventor Vb.Net "AddIn" - Show iProperties Dialog Box & Tab Across To "Project"

isocam
Collaborator Collaborator
198 Views
1 Reply
Message 1 of 2

Inventor Vb.Net "AddIn" - Show iProperties Dialog Box & Tab Across To "Project"

isocam
Collaborator
Collaborator

Can anybody help?

 

I have created a Vb.Net "AddIn" that automatically creates a button that calls a sub-routine..

 

At present, when I press this button, the "AddIn" displays a simple message box to test if the button works.

 

The button calls a sub routine and works as expected.

 

Now....

 

I want to change the sub-routine, for testing purposes, so that it shows the iProperties dialog box and then tabs across to the Project tab.

 

The following is the code I currently have but it is not working.

 

Imports Inventor

Module Module10
Sub DisplayProperties()
ThisApplication = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

ThisApplication.CommandManager.ControlDefinitions.Item("AppiPropertiesWrapperCmd").Execute2(False)


TabCount = "2" ' Properties Tab

My.Computer.Keyboard.SendKeys("{RIGHT " + TabCount + "}", True)


ThisApplication.UserInterfaceManager.DoEvents()
End Sub
End Module

 

Does anybody know what is wrong and rectify the error for me?

 

Many thanks in advance!

 

Darren

0 Likes
199 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

I usually use this line instead, within an iLogic rule:

 

System.Windows.Forms.SendKeys.SendWait("{RIGHT 2}")

 

I think someone from Autodesk mentioned that we must use the SendWait method from our rules.  Not sure if it is different for add-ins.

However, you may need to ensure that those keystrokes get sent to the correct place, by making sure the Inventor application currently has 'system focus', otherwise who knows where they may get sent, or what the result may be.  The simplest way I used in the past was the AppActivate(ThisApplication.Caption) method.  But there are more advanced, and perhaps more accurate ways of doing this also. such as the SetForegroundWindow function from the user32.dll reference, which requests the HWND (IntPtr) of the window, which can be obtained from Application.MainFrameHWND property.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes