My VB.NET Inventor AddIn is launched successfully, but not functionning...

My VB.NET Inventor AddIn is launched successfully, but not functionning...

brigitte.nader
Participant Participant
1,048 Views
6 Replies
Message 1 of 7

My VB.NET Inventor AddIn is launched successfully, but not functionning...

brigitte.nader
Participant
Participant

Hi. I just assembled a small test app to check Inventor's AddIn integration, but I'm strugling in having the app display anything in the interface.

 

Normally, it should add a button inside an "Update" panel located in the "Tools" tab (in the PART environment).

Nothing happens...

 

Should anyone have the courage to dive in my  VB.NET (VisualStudio 2017) project, it is attached herein.

Code is based on this Autodesk sample code.

 

Many thanks

0 Likes
Accepted solutions (1)
1,049 Views
6 Replies
Replies (6)
Message 2 of 7

AlexFielder
Advisor
Advisor

I would check these lines (highlighted below):

2019-02-01 13_27_35-C__Users_Alex.Fielder_AppData_Local_Temp_7zO8D16D5AB_StandardAddInServer.vb - No.png

The activate is what happens when the add-in loads. It looks like your add-in would load if you reset the ribbon without uncommenting these lines.

0 Likes
Message 3 of 7

brigitte.nader
Participant
Participant

Thanks Alex for giving it a try... i'm not an API newbie, but rather a dumbie !

 

Still, commenting out only the if statement, but leaving the AddToUserInterface() uncommented does not change anything (at least on my dev platform). The interface keeps exactly unchanged in the Tools tab.

 

0 Likes
Message 4 of 7

AlexFielder
Advisor
Advisor
Accepted solution

Hi @brigitte.nader 

 

I just built your addin and loaded it into Inventor 2019 for debugging and it errors at this line:

 

2019-02-04 09_04_41-InventorAddIn5 (Debugging) - Microsoft Visual Studio  (Administrator).png

 

Basically, what this error means is that the "ThisApplication" object needs assigning to before we reach this stage.

 

You were almost there and a couple of simple changes is all that was required. You can see the differences between mine & your files here:

 

https://www.diffchecker.com/RxEa7zRb

 

I renamed some things because I have a lot of add-ins loaded and the default "StandardAddinServer" plays havoc when debugging inside Visual Studio. The main changes were to rename this:

g_inventorApplication = addInSiteObject.Application

to this:

ThisApplication = addInSiteObject.Application

and this:

Public g_inventorApplication As Inventor.Application

to this:

Public ThisApplication As Inventor.Application

I also commented out this line:

 

Public Property ThisApplication As Object

as it wasn't doing anything.

 

And here is the finished article running in-place:

 

2019-02-04 09_20_11-Autodesk Inventor Professional 2019 - [Part1].png

 

🙂

0 Likes
Message 5 of 7

brigitte.nader
Participant
Participant

Thank you so much Alex. I corrected my errors and panel is now showing in the tools menu.

I post the full working solution, would anyone need a working demo when diving into Inventor SDK.

 

Just a small concern though, eachtime I generate the solution, the MY UPDATE panel moves one position to the right in the ribbon... strange.

0 Likes
Message 6 of 7

AlexFielder
Advisor
Advisor

That's an interesting "feature".

 

On closer inspection, it seems like it may be because your AddPanelToToolsTab() sub has the "RibbonPanels.add" method but without the optional "InsertBeforeTargetPanel" alluded to here:

 

http://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-50B0D94D-ADB4-442F-844F-6EA339F8237A

 

Assuming that the missing boolean is the issue, you'll obviously need to change the panelId of the panel that it's loaded before 

 

🙂

0 Likes
Message 7 of 7

liminma8458
Collaborator
Collaborator

Hi, Alex,

I put a "False" at the end of code as follows, intending to put the panel after the  "id_PanelP_ToolsMeasure".

oPanel = oTab.RibbonPanels.Add("MY UPDATE", "ToolsTabUpdatePanel", "SampleClientId", "id_PanelP_ToolsMeasure", False)

But it does not work. The same phenomenon as described by Brigitte happened. Actually, I have define some custom tab with panels under it. The way as above to control sequence of panels does not work either.

Do you have any clue?

Thanks

Thanks
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 Likes