Inventor 2018 custom Add-In

Inventor 2018 custom Add-In

Anonymous
Not applicable
5,555 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,556 Views
26 Replies
Replies (26)
Message 2 of 27

Jef_E
Collaborator
Collaborator

Welcome to the Autodesk community,

 

What guide did you follow? And could you please post the code that you have now, otherwise it's hard to help you.



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
Message 3 of 27

Anonymous
Not applicable

Hey,

 

I followed the guide 'Creating an Add-In from the Inventor API Help and also tried some other stuff i found on the internet.

The code i have is hardly anything i created myself, itried to keep it as basic as possible to get the button to appear and work on from there.

I only added the StandardAddInServer.vb since that is the only file i made changes in.

 

I am working on a free trial version of inventor 2018 professional (not to screw around and mess up things in a live program) i don't know if this can cause the problem or not but i doubt that. if you need further information please ask.

 

0 Likes
Message 4 of 27

AlexFielder
Advisor
Advisor

Hey @Anonymous,

 

There's a couple of things that could be stopping this loading:

 

  1. where is the .addin file located that this add-in uses?
  2. have you told it to use any images for the button?
  3. are there any other references in use that might not be getting copied to the correct path?

The best thing you can do since the file you shared is "boiler-plate" anyway is to share the entire solution here as a .zip file.

 

Then we can download and build it and see what might be missing.

 

Thanks,

 

Alex.

 

FWIW: the trial copy of Inventor you're using should have no bearing on whether the add-in runs.

Message 5 of 27

Anonymous
Not applicable

Hey,

 

I'll ad the project i have now.

for your other questions:

1.D:\Program Files\Autodesk\Inventor 2018\Bin (inventor is installed on my D:\ disk)

2. i have assigned images to the button, i used icons and didn't scale them myself (i didn't know if it was necessary to assign them the right size)

3. I have no idea but i think not, i didn't add any references after creating the project from the template.

 

hope this helps.

 

Rob Rombouts

0 Likes
Message 6 of 27

AlexFielder
Advisor
Advisor

Honestly, I'm stumped.

 

I've seen this type of non-loading countless times before and in spite of my having fuslog turned on, cannot figure out what it is that is failing to resolve in this case.

 

I have removed all the image references; the singular reference you had to the stdole.dll file that coped with converting the images to Inventor-friendly format.

 

still nothing.

 

I think part of the (long-running) issue is that Inventor's mechanism for loading add-ins fails silently so as not to bin the whole application with one erroneous add-in.

 

The problem with doing that is that there is little-to-no logging available (that I am aware of).

 

I'll take another crack at this after lunch as I am sure it is something simple in this case; I just can't put my finger on exactly what right now.

 

Cheers,

 

Alex.

Message 7 of 27

Anonymous
Not applicable

Hey,

 

maybe i can give you some more information about the system i'm woring with. i'm working on a windows 10 laptop with 16 gigs of ram, an i7 processor and nvidea gtx860 graphics card. I have no trouble running Inventor 2018 pro (free trial, not to mess up the real system in trial fases as i'm still a student and still learning), i test on 'smaller' assemblies.

Maybe i have an issue with my system.

 

cheers,

 

Rob

0 Likes
Message 8 of 27

Anonymous
Not applicable

UPDATE:

 

I have tried several other solutions that are known to work (elder versions of the add-ins, Phillipe Leefsma projects,..) and they also give nothing so i don't think that there is a problem in the coding. My guess is that there is either me doing something wrong connecting the project to inventor or that my system and the programs are working with are not meant to be working together, since all the solutions i find are for windows 7 or earlier and visual studio 2010 or earlier. Can anyone confirm that my guess is in the right direction, if so i can start working on another system.

 

Rob Rombouts

0 Likes
Message 9 of 27

w.pepping
Advocate
Advocate

You have to do several steps to make an add-in working correct un Inventor. I think it has nothing to do with your computer.

To make life easier I use a correct add-in with only some buttons. 

The buttons are calling another DLL that need not all the restrictions for loading in Inventor.

So I don't need to add the manifest every time by hand because I have the express-version of Visual studio.

 

Get control of your sheet metal files.
Download the app from matprop.com
0 Likes
Message 10 of 27

AlexFielder
Advisor
Advisor
Accepted solution

Hi,

 

I *think* I've figured out why your addin refuses to load:

 

Basically, looking at an addin of mine, I can see that the GUID here:

 

2017-05-08 09_55_44-GraitecExtensions - Microsoft Visual Studio (Administrator).png

matches the GUID in the .Addin file:

2017-05-08 09_55_28-GraitecExtensions - Microsoft Visual Studio (Administrator).png

As soon as I updated your solution so that the GUIDs matched in those two places, the break point I had set in the Activate method gets hit.

 

I thought that wizard that you can install from:

 

C:\Users\Public\Documents\Autodesk\Inventor 2018\SDK

 

would have set these values for you, but perhaps you created the solution manually?

 

You also cannot get the partRibbon with this line (in the AddToUserInterface method):

 

Dim partRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Assembly|Part|ZeroDoc")

You have to do them one at a time:

 

Dim partRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Part")

Dim AssyRibbon as Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Assembly")

Once you make these changes, your add-in should load:

 

2017-05-08 10_12_28-Autodesk Inventor Professional 2017 - [Part1].png

 

Hope this helps.

Message 11 of 27

frederic.vandenplas
Collaborator
Collaborator
Accepted solution

First thing that i saw is that this is not correct

 

 

'' Create a new panel.
            Dim customPanel As RibbonPanel = toolsTab.RibbonPanels.Add("Sample", "MysSample", AddInClientID)

            '' Add a button.
            m_sampleButton.CommandControls.AddButton(m_sampleButton)Should be

 

 

'' Create a new panel.
            Dim customPanel As RibbonPanel = toolsTab.RibbonPanels.Add("Sample", "MysSample", AddInClientID)

            '' Add a button.
            customPanel.CommandControls.AddButton(m_sampleButton)

Other thing i see is this, you should declare your variables exactly for what it's meant.

'' Get the part ribbon.
            Dim partRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Assembly")

 What i never do while developing is this (so i comment these lines)

 If firstTime Then
                AddToUserInterface()
  End If
' If firstTime Then
                AddToUserInterface()
' End If

 

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

AlexFielder
Advisor
Advisor

Good spot @frederic.vandenplas, that was the other bit I had to change; I just forgot to mention it in my post just now. 😉

0 Likes
Message 13 of 27

frederic.vandenplas
Collaborator
Collaborator
we've posted it almost simultaneous...
I wasn't shooting under your pigeons (flemish saying) but after i posted, i saw what you posted, Why isn't there a popup to warn people for this 🙂
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 14 of 27

Anonymous
Not applicable

Hmm,

 

I added the right Guid as in my addin file and when i place a breakpoint it still say that it never will be reached. (this breakpoint will not currently be hit. No symbols have been loaded for this document.)  I also changed the ribbon acces. In your previous post You said you removed all the image references but when i do so i get build errors (regarding the stdole reference). Do you have a draft of your version of the StandardAddInServer file i can compare with?

 

Rob

0 Likes
Message 15 of 27

Anonymous
Not applicable

Also changed that part, still nothing.

Can it be that i copied a wrong file to the Add-In map, or that i copied the .addin file to the wrong directory?

If I look at the location of the dll in the add-in manager of inventor it reffers to a different location then the one i use as output path for my build.

0 Likes
Message 16 of 27

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

I don't know where you place your files, but did you read this? i use this method

How to Register/Unregister

=======================

1) Build Project;

2) Copy add-in dll file to one of following locations:

a) Anywhere, then *.addin file <Assembly> setting should be updated to the full path including the dll name

(i build my dll in the project, and fill that path in de addin file)

b) Inventor <InstallPath>\bin\ folder, then *.addin file <Assembly> setting should be the dll name only: <AddInName>.dll

c) Inventor <InstallPath>\bin\XX folder, then *.addin file <Assembly> setting shoule be a relative path: XX\<AddInName>.dll

3) Copy.addin manifest file to one of following locations:

a) Inventor Version Dependent

Windows XP:

C:\Documents and Settings\All Users\Application Data\Autodesk\Inventor [version]\Addins\

Windows7/Vista:

C:\ProgramData\Autodesk\Inventor [version]\Addins\

b) Inventor Version Independent

Windows XP:

C:\Documents and Settings\All Users\Application Data\Autodesk\Inventor Addins\

Windows7/Vista:

C:\ProgramData\Autodesk\Inventor Addins\

c) Per User Override

Windows XP:

C:\Documents and Settings\<user>\Application Data\Autodesk\Inventor [version]\Addins\

Windows7/Vista:

C:\Users\<user>\AppData\Roaming\Autodesk\Inventor [version]\Addins\

4) Startup Inventor, the AddIn should be loaded

To unregister the AddIn, remove the Autodesk.<AddInName>.Inventor.addin from above mentioned .addin manifest file locations directly.

 

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

Anonymous
Not applicable

Yes i've read that, and followed that. 

For step 2 i did 2 (the dll file is in that directory but i have no idea where to change the <assmbly> setting) => found it,

the other steps are not specified for windows 10 so i used the windows 7/vista guidelines.

 

I also saw that in the AssemblyInfo.vb there is also a GUID that differs from the on in the addin file

0 Likes
Message 18 of 27

AlexFielder
Advisor
Advisor

Don't worry about the assembly.vb GUID; it's irrelevant at this stage.

 

Where you copy your .dll and .addin file(s) to is only really important if the addin you are building is going to be used by others in your team, or if you plan on publishing it to the Autodesk Exchange Store.

 

(I digress, but if that is the case, at some stage you will need to build an installer for it.)

 

For a long time I was copying my addins to this path:

 

C:\ProgramData\Autodesk\ApplicationPlugins\{pluginname}\

 

but recently I switched to this path because it actually says Inventor in the name:

 

C:\ProgramData\Autodesk\Inventor Addins\{pluginname}\

 

Functionally, they're identical.

 

The Windows 7 paths are the same for Windows 10.

 

Message 19 of 27

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

Attached you can find your solution working.

 

It builds in the debug folder

the path in de addin file should be modified and placed wher you need it.

 

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

Anonymous
Not applicable

Ok, so far so good, only problem now i think is that the add-in doesn't load. I had to unblock it for it to be able to load but it doesn't load now. the checkbox load automatically is checked and when i check/uncheck the loaded/unloaded checkbox and press ok, it remains unloaded (when i open the addin manager again it says unloaded) I really do not understand why these things always need to get so difficult with me..

0 Likes