Inventor 2016 Add In

Inventor 2016 Add In

Stryder33345
Enthusiast Enthusiast
1,424 Views
7 Replies
Message 1 of 8

Inventor 2016 Add In

Stryder33345
Enthusiast
Enthusiast
Hello all, I'am currently trying to make the jump from iLogic and VBA to creating an add in with visual studio express 2015. I have managed to get the template into VS and my add in comes up in the 'Add ins' menu in Inventor. But when I run the program in VS I get an error saying 'A project with an Output Type of Class Library cannot be started directly. Am I doing something wrong here and if so does anyone possibly have a template for Inventor 2016 that has a button in it ready to go that I can have ? This would be a big help as I keep running into dead ends every time I venture down this path. Also most of the examples in the developer folder dont run with VS 2010 or 2015 of qwhich is even more frustrating. Thanks In Advance Ben Inventor 2016 Windows 7
0 Likes
Accepted solutions (1)
1,425 Views
7 Replies
Replies (7)
Message 2 of 8

Owner2229
Advisor
Advisor

Hi, you can try this template. There's one button and some event handlers.

The button should be visible in open assembly.

 

The event handlers are:

OnSaveDocument

OnOpenDocument

OnNewDocument

 

They're not set up to do anything, so they won't mess your files.

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 3 of 8

Stryder33345
Enthusiast
Enthusiast
Hi , Thanks for the help so far. I have loaded the addin and the dll and the addin shows it has loaded in inventor. But I don't have a button as yet and I am still receiving the attached error in visual studio. I am sure it is just something I am doing wrong, maybe in the settings of visual studio when it comes to Inventor (the example you sent it was created with VS2015 as well )?
0 Likes
Message 4 of 8

Owner2229
Advisor
Advisor

Hi, it was created in SharpDevelop and migrated to Visual Studio 2012 by USTG_ENGGSERV_ACAD

Here you can see what he had to do to make it work:

 

http://forums.autodesk.com/t5/inventor-customization/sample-code-for-inventor-add-in-dll-for-vb-net/...

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Message 5 of 8

greg_fletcher
Participant
Participant

<ignore me, can't delete>

0 Likes
Message 6 of 8

pball
Mentor
Mentor
You cannot run an addin from Visual Studio because it is only a dll file. To debug an addon you must install the addin, start Inventor, then in Visual Studio (2012) go to Tools and select Attach to Process and choose the Inventor.exe. Then you use the addin in Inventor and if anything happens it will be debugged in Visual Studio.

There might be other ways to debug an addin but that works for me.
Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
Message 7 of 8

Stryder33345
Enthusiast
Enthusiast
I have ran add ins in 2014 without attaching a process. I have added the .addin file and the dll files to appropriate locations and the add in does show up in the inventor addin list when ran. You shouldn't have to attach the process at all as you don't when you complete the "my first plug in" tutorial and you can still drive inventor. The dll and .addin files are only to register the addin with inventor when it starts so your addin buttons appear and you have access to run your code from VS.
0 Likes
Message 8 of 8

Stryder33345
Enthusiast
Enthusiast
Accepted solution
No, I was wrong. Sorry Pball, you got me on the right track to what I had done previously, which was to get visual studio to start inventor for me when it debugs my program of which is then automatically attached . Cheers for all the help fella's
0 Likes