Inventor 2018 custom Add-In

Inventor 2018 custom Add-In

Anonymous
Not applicable
5,569 Views
26 Replies
Message 1 of 27

Inventor 2018 custom Add-In

Anonymous
Not applicable

Hey,

 

I am new to programming to iventor (and vba) and i need to make an Add-In, I've followed almost all of the tutorials to create a Add-In button but it won't show. The Add-In is loaded but doesn't show. I tried debugging but my breakpoint is never reached (even when i put it on the Activate() method).

 

I am using Visual Studio 2015 and Inventor 2018.

I started the project by creating a new VB Inventor 2018 Add-In project in VS.

 

Any help or sujestions are greatly appreciated.

Rob Rombouts

0 Likes
Accepted solutions (3)
5,570 Views
26 Replies
Replies (26)
Message 21 of 27

Anonymous
Not applicable

Ok, when i load another test add-in i made it works "fine", i can get the button to show (without image even though i specify one) and add an event when clicked. i wil analyze both files and see what it is that makes it that one works for me and the other one doesn't.

 

cheers,

Rob Rombouts

0 Likes
Message 22 of 27

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

You create the defition, but you don't tell where the icon should be used

 m_sampleButton = controlDefs.AddButtonDefinition("Command Name", "iTestName", CommandTypesEnum.kNonShapeEditCmdType, AddInClientID, largeIcon ,smallIcon )
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
Message 23 of 27

Anonymous
Not applicable

Ok, i think the error is with the images. when i add them to the button my add-in remains unloaded. do i need to resize them myself or is that what the stdole is for?

 

UPDATE:

I added a description and tooltip string and added the images after and the error was gone but still my images arent shown:

 m_sampleButton = controlDefs.AddButtonDefinition("Command Name", "iTestName", CommandTypesEnum.kNonShapeEditCmdType, AddInClientID, "test", "test", largeIcon, smallIcon)
0 Likes
Message 24 of 27

frederic.vandenplas
Collaborator
Collaborator

I use this class PictureDispConvert.vb attached Change .txt to .vb.

stdole is one of the few methods that can convert these icons, to what inventor needs, why they made it so difficult, i don't know.

 

The button sizes should be 16x16 and 32x32 for proper displaying.

 

To create a button with image, the only thing i do is this

 

m_DIN9635Calculation = InvApp.CommandManager.ControlDefinitions.AddButtonDefinition("DIN 6935", "Din6935CalculationiName", CommandTypesEnum.kEditMaskCmdType, addInCLSIDString, "Excel calculation for sheetmetal flatpattern calculation", "Excel calculation for sheetmetal flatpattern calculation", PictureDispConverter.ToIPictureDisp(My.Resources.din6935calculation16), PictureDispConverter.ToIPictureDisp(My.Resources.din6935calculation32), ButtonDisplayEnum.kAlwaysDisplayText)

 

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
Message 25 of 27

Anonymous
Not applicable
Accepted solution

SOLUTION: I had to scale the images myself so that they are the right size to be placed as an icon, this solved the issue for me.

 

Kuddos to you all who helped me.

 

Many thanks,

Rob Rombouts

0 Likes
Message 26 of 27

Anonymous
Not applicable

So i completed the addin and it works perfect on my system, now i need to transfer the add-in to other devices but when i do this i get the issue that started this all in the first place. The add-inn is found bij the add-in manager but can not be loaded (does not stay loaded) the devices work with inventor 2017 and i work on inventor 2018. but in my project i specified that it should work from version 21 and on. Thr version of the devices is 21.1. What am i ding wrong now?

0 Likes
Message 27 of 27

jeanB99VC
Enthusiast
Enthusiast

Hi There,

 

Is it possible for you to post the final working procedure and needed files this would be great.

Thanks in advance !

0 Likes