I tried the My first plug in program of Inventor. That contains VB .NET program which creates a standalone EXE. This program worked very fine.
Where can I find similar program on how to develop VB .NET Add-in DLL and also explain how to launch it inside Inventor (similar to NETLOAD and <CommandName> in AutoCAD 2012)?
I am using Autodesk Inventor 2014 Professional and Visual Studio 2012
Thanks
PV Subramanian
Solved! Go to Solution.
Solved by Owner2229. Go to Solution.
Hi, I'm not realy sure if there is an official "walk-throught" for whole creation of an Add-In.
But over time I have created my own template for it, including Ribbon buttons and some basic events.
You can find it in attachment. Extract it, run the _New Inventor Addin.bat, write in NewProjectName and it'll rename all needed parts of the code.
I've made this template for my use, as the program I'm ussing (SharpDevelop) doesn't have clasic templates and I find this easier.
I found this pdf which seems to be from Autodesk University some years ago. I haven't gotten too far into it yet but it helped me sucessfully get addin templates working in VS 2012.
Even I read that PDF and tried the solution provided in that. I got compilation errors. I have attached the VS 2012 error as a snapshot.
In VS 2012 I got the following 2 errors
Error 1 End of statement expected.
D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorFirstSampleProgram\InventorFirstSampleProgram\InventorFirstSampleProgram.vb 10 38 InventorFirstSampleProgram
in Line
Public Class StandardAddInServer Implements Inventor.ApplicationAddInServer
Another compilation error
Error 2 Interface 'Inventor.ApplicationAddInServer' is not implemented by this class.
D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorFirstSampleProgram\InventorFirstSampleProgram\InventorFirstSampleProgram.vb 37 124 InventorFirstSampleProgram
in Line
Public Sub Activate(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean) Implements Inventor.ApplicationAddInServer.Activate
Thanks for your templates. Your batch file worked like a charm.
When I built the project using VS Professional 2012 got few errors
All the errors are related to m_AppEvents is not declared. I have attached the project that was created my running your batch file, as a zip file. The zip file includes a snapshot (jpeg image) of the error message from Visual Studio 2012.
Can you please let me know how to fix these errors?
Error 10 'm_AppEvents' is not declared. It may be inaccessible due to its protection level. D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\ClassModules\StandardAddInServer.vb 38 15 InventorSampleProg
Error 11 'm_AppEvents' is not declared. It may be inaccessible due to its protection level. D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\ClassModules\StandardAddInServer.vb 39 15 InventorSampleProg
Error 12 'm_AppEvents' is not declared. It may be inaccessible due to its protection level. D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\ClassModules\StandardAddInServer.vb 40 15 InventorSampleProg
Error 13 'AddresOf' is not declared. It may be inaccessible due to its protection level. D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\ClassModules\StandardAddInServer.vb 40 42 InventorSampleProg
Error 14 End of statement expected. D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\ClassModules\StandardAddInServer.vb 40 51 InventorSampleProg
Hi, try it now. There've been some lines missing or broken n the template (probably hapened when I was cleaning it ).
I'm sending you also the corrected template.
Thanks a lot for the updated template. One last compilation error. I have attached the JPEG.
I am using Visual Studio 2012; I also have Visual Studio 2010. Looks like the VS 2012 is compiling using VS 2010 compiler. Unfortunately there is some issue in accessing the MSDN forum. In case you know a quick fix for this please let me know.
Error 1 The command "call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" mt.exe -manifest "D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\InventorSampleProg.X.manifest" -outputresource:"D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\bin\InventorSampleProg.dll";#2
copy D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\bin\InventorSampleProg.dll "C:\Program Files\Autodesk\ApplicationPlugins\"
copy D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\bin\SVOS.InventorSampleProg.Inventor.addin "C:\ProgramData\Autodesk\Inventor Addins\"" exited with code 1. InventorSampleProg
I tried using Visual Studio 2010 Express and the same compilation error. Please find attached the image of the error
The error message is
Error 1 The command "call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" mt.exe -manifest "D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\InventorSampleProg.X.manifest" -outputresource:"D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\bin\InventorSampleProg.dll";#2
copy D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\bin\InventorSampleProg.dll "C:\Program Files\Autodesk\ApplicationPlugins\"
copy D:\DesignAutomation\AutodeskInventor_CodeDevelopment\InventorSampleProg\bin\SVOS.InventorSampleProg.Inventor.addin "C:\ProgramData\Autodesk\Inventor Addins\"" exited with code 1. InventorSampleProg
The error is generated because the file probably doesnt exist at this location? Please check.
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" mt.exe -manifest "$(ProjectDir)$(AssemblyName).X.manifest" -outputresource:"$(TargetPath)";#2
The Sample Invetor Add in program worked.
The attached zip file contains a working Inventor Add-in sample program. I have also attached a image showing that the InventorSampleProg worked successfully. I changed the Message from
Some cool stuff happenin' here...
to
Some cool stuff happenin' here... Successfully Launched Inventor Sample Prog
This is what I did
4) Opened the solution InventorSampleProg.sln. There were few Visual Studio pop-up messages (like One Way Upgrade), which I accepted
5) Ensured that the reference Autodesk.Inventor.Interop.dll added correctly (the path)
6) Then opened the Compile tab of the Project Properties by right clicking on the project. Scrolled to the bottom and clicked on the "Build Events" button on the right side
7) Deleted all the lines in "Post-build event command line" and clicked on "OK". This post-build event was causing the error of "Error 1 The command "call "C:\Program File.........."
8) Successfully ran the "Build Solution" which compiled and created the InventorSampleProg.dll
9) Read the "Getting Started with Inventor's API" by clicking on the Help-->Community Resources--> Programming Help . Created a folder named InventorSampleProg in C:\Users\<UserID>\AppData\Roaming\Autodesk\ApplicationPlugins . In the InventorSampleProg folder I copied the InventorSampleProg.dll and the SVOS.InventorSampleProg.Inventor.addin.
10) Renamed SVOS.InventorSampleProg.Inventor.addin to Autodesk.InventorSampleProg.Inventor.addin
11) Edited the Autodesk.InventorSampleProg.Inventor.addin file. In the <Assembly> tag removed the Folder Location (Path) to InventorSampleProg.dll.
The line should look like this <Assembly>InventorSampleProg.dll</Assembly>
12) Launched Inventor 2014 Pro
13) Opened an assembly and in the Assemble Tab, saw the InventorSampleProg button with "I" ICON.
14) Clicked on the InventorSampleProg button and got the message " Some cool stuff happenin' here... ". Then modified the message, and repeated the process and successfully saw the updated message.
Thanks a lot for Owner2229 for providing the updated / fixed AddIn Templates and for Jef_E pointing out to the possible issue.
PV Subramanian
Can't find what you're looking for? Ask the community or share your knowledge.