Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

My First Plug-in ... How to register my dll so it works in Inventor

8 REPLIES 8
Reply
Message 1 of 9
karthur1
2163 Views, 8 Replies

My First Plug-in ... How to register my dll so it works in Inventor

I have went through the entire tutorial for the "My first plug-in Training". While in VB.NET, I could run the code from there and it would work in Inventor. Now I would like to run the code from inside Inventor (without VB.NET).  I tried to build the .dll and then register it (using C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe /codebase MyFirstInventorPlugin.dll) but that only gave me an error.

 

Could this be because in Lesson2, rather than starting with a "Autodesk Inventor Addin" template, we started with a "Windows Form Application"?

 

I found this blog "Migrate .Net Add-Ins to registry free" which describes how to do this... (i think).  Going through this blog, I get stuck on step 3.  I can't find where in VB.Net to add this "Post-build event command line" string. There is nothing like this on the Complie Tab of the Properties.

 

I am using Visual Basic Express 2010. Surely, there has got to be an easier way to do this than what I have hacked out here.

 

Any help or insight on getting my code into Inventor would be helpful.

 

Thanks,

Kirk

 

 

8 REPLIES 8
Message 2 of 9
alewer
in reply to: karthur1

I don't think that there is any way to do this automatically with express editions of Visual Studio. You can do this from the command line or with a .bat file after you've built your project.

 

I use a .bat file:

@echo off
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\mt.exe" -manifest "C:\Users\alewer\Documents\Visual Studio 2010\Projects\MyProject\MyProject\bin\Release\MyProject.dll";#2

xcopy "C:\Users\alewer\Documents\Visual Studio 2010\Projects\MyProject\MyProject\bin\Release\MyProject.dll" "C:\ProgramData\Autodesk\Inventor Addins\MyProject.dll" /i /y
xcopy "C:\Users\alewer\Documents\Visual Studio 2010\Projects\MyProject\MyProject\Autodesk.Cutfile.Inventor.addin" "C:\ProgramData\Autodesk\Inventor Addins\Autodesk.Cutfile.Inventor.addin" /i /y

PAUSE

 

You'll have to replace the path & file name for the .dll and .addin with the correct ones of course. Let me know if this works.

Message 3 of 9
karthur1
in reply to: alewer

When I Build my .dll in VB, I only get the .dll.

 

How do I get the "Autodesk.Cutfile.Inventor.addin" file that is in the last line of the .bat file?

 

Thanks

Message 4 of 9
alewer
in reply to: karthur1

To create the .addin file, see step 4 of the Mod the Machine post that you referenced.

 

You can create the file in the text editor of your choice (Notepad is fine). Copy/paste the text from the example from the blog post. Edit it as instructed, and save it somewhere in your project directory. 

Message 5 of 9
karthur1
in reply to: alewer

I created the .addin file like is in step 4 of the blog and edited the .bat file like you posted in message 2 above.  I closed Inventor and ran the .bat file. The bat file copied the files to the correct location in %programdata%. However, the addin is not loaded and does not even show up in the Inventor Tools>Add-ins list.

 

Can you post the Autodesk.Cutfile.Inventor.addin file?  I am not so sure I edited mine correctly. Also, why does your have "Cutfile" in the name of the .addin file?  I thought that yours should be named like "Autodesk.Myproject.Inventor.addin".

 

Kirk

 

 

 

 

Message 6 of 9
alewer
in reply to: karthur1

You might be missing a number of things. After rereading your first post, I realized that you probably don't have a StandardAddinServer class, which is created automatically when you make a new project from Inventor Addin template. Is this the case? This should be visible in solution explorer:

StandardAddInServer.png

 

I did indeed make a mistake on the .bat file. I copied it from a project of mine named Cutfile. I changed the .dll name in my example, but missed the .addin.

Message 7 of 9
xiaodong_liang
in reply to: karthur1

Hi Kirk,

 

Could you take a look at this thread below? It mentions the add-in template which can be used with Express. The template can help you with the correct structure of an add-in.

http://forums.autodesk.com/t5/Inventor-Customization/Autodesk-Inventor-Wizards-for-Microsoft-Visual-...

 

In addition, it is yes that Express does not support post-build event and clean up event.

Message 8 of 9
karthur1
in reply to: alewer

alewer,

In my Solution Explorer, I do see the "StandardAddInServer.vb".  Everything seems to be in place, I just cant get the add-in to load when I start Inventor.  It does not even show in the add-in manager.

 

2014-04-28_0848.png

Message 9 of 9
rjay75
in reply to: karthur1

Looking over this it looks like you're trying to take lesson 2 and convert to an Add in that will load automatically. If this is the case have you modified that StandardAddInServer.vb file (added your code to it or load the form from it)?

 

If not this is where your issue is. There are guid's in the Inventor.Addin file which must match those in StandardAddinServer.vb file. When inventor is loading the dll it will look for the the StandardAddinServer class to load the  addin and uses the ClassId's to identify the Addin. These must match in the dll class and in the .addin file.

 

Look at the Creating an Inventor Addin overview in the API help file.  

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report