Select vs Pick - API

Select vs Pick - API

Anonymous
Not applicable
1,361 Views
2 Replies
Message 1 of 3

Select vs Pick - API

Anonymous
Not applicable

So, I'm writing a program (C#) that automates the notch tool within the frame generator add-in in Inventor. The idea is that I can select one part and then select multiple other parts that will notch to the first selected part automatically. This will save me a TON of time if I get it working correctly. With that being said, I have it to the the point where the user selects the first part and then window multiple parts (these are stored and then cycled through later), then I use SendKeys to open the "Notch Tool", and now this is where I encounter my problem. 

 

The Notch Tool is waiting for the user to Pick/Select one part. In my code I've tried to use the CommandManager.DoSelect method which does not register with the tool (I'll exit out of the tool and the part will be selected). My thinking is that this notch tool will only accept the CommandManager.Pick method which would defeat the purpose of the program as I do not want the user to have to go through the parts one by one notching them together.

 

Is there a way to simulate a mouse click on a selected occurrence within Inventor? Is there another approach I should be considering? And finally, could someone please rewrite the actual notch tool to allow multiple notches to be done at once?! I'll post a snippet of my code and I'll gladly post more if need be. Any help will be greatly appreciated as always. Thanks.

 

 

docName = instance.ActiveDocument.DisplayName;

int iHandle = NativeWin32.FindWindow(null, "Autodesk Inventor 2012 - [" + docName + "]");
this.Hide();
NativeWin32.SetForegroundWindow(iHandle);

keybd_event(0x23, 0x4F, 0, 0); // Press End
keybd_event(0x23, 0xCF, 0, 0); // Release End (Brings up notch tool)
Thread.Sleep(3000);
//keybd_event(0x28, 0x0F, 0, 0); // Press Tab
//keybd_event(0x09, 0x8F, 0, 0); // Release Tab
NativeWin32.SetForegroundWindow(iHandle);
Thread.Sleep(500);
instance.CommandManager.DoSelect(vert); 

0 Likes
1,362 Views
2 Replies
Replies (2)
Message 2 of 3

ekinsb
Alumni
Alumni

Unfortunately, most commands cannot be driven externally.  There are a few command that will support pre-selecting things and then when the command is executed they'll use whatever is selected, but the majority of commands are more complicated than that and do all of there selection within the command.  Sorry for the bad news.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks for the response Brian.

 

I am currently in the process of using a combination of screen resolution, DoSelect, Cursor.Position, and view combinations to achieve my solution. Though primitive, it seems to be getting the job done in an efficient enough manner. I'll post my solution upon completion.

 

0 Likes