Setting up visual studio with inventor libraries

Setting up visual studio with inventor libraries

Thomas.Long
Advocate Advocate
6,376 Views
12 Replies
Message 1 of 13

Setting up visual studio with inventor libraries

Thomas.Long
Advocate
Advocate

I've previously been running a large number of codes in everything from iLogic, to Inventor VBA, to Excel VBA, to AutoCAD VBA. Suffice it to say passing the information around is difficult and requires a large number of work arounds and the like, and it doesn't even look like VBA can do all the things I want it to. Therefore I have decided to make the conversion to C# and control everything via visual studio, which should give me new abilities that I previously did not have.

 

I have already set up visual studios to access the autocad libraries successfully, but I do not know what dll's to import in order to reference the inventor libraries correctly. Could someone let me know what references to add because I've been perusing the net for a while searching for them.

 

Thank you

6,377 Views
12 Replies
Replies (12)
Message 2 of 13

Anonymous
Not applicable

VS Reference.jpg

 

Reference for IV2018 and .Net 4.7

Message 3 of 13

Thomas.Long
Advocate
Advocate

Will that work with .Net 4.6.1 and Inventor 2015?

0 Likes
Message 4 of 13

Anonymous
Not applicable

The first one is the path to Inventor API.  You'll need to browse and pick the dll.  Pick the one with highest number like 20.x.x.x.

If you had older Inventor installed before, you'll have multiple v4.0_xx.x.x.x folders.

If you want backward compatibility, you pick older version: 22 - 2018, 21 - 2017, 20 - 2016, 19 - 2015 etc.

 

The other will change when you pick .Net 4.6.

0 Likes
Message 5 of 13

Anonymous
Not applicable

Did you install the SDK?  I believe it'll setup template and wirzard in VS.

It doesn't work for me since I'm using free version of VS.

0 Likes
Message 6 of 13

Thomas.Long
Advocate
Advocate

To be honest I'm using the free version too and I have no idea what an sdk is. Its showing the inventor stuff now, though it's giving me three warnings similar to 

Severity Code Description Project File Line Suppression State
Warning There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "accoremgd", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. Base Functions

0 Likes
Message 7 of 13

ekinsb
Alumni
Alumni

Here's a link to a video that demonstrates creating a new project in Visual Studio, referencing the Inventor library, and connecting to the API.  The main thing to know is that you need to reference the "Autodesk.Inventor.Interop.dll" file in "C:\Program Files\Autodesk\Inventor XXXX\Bin\Public Assemblies".  Hopefully you'll see that it's quite easy.

 

http://autode.sk/2k77h4D

 

I'm using Visual Studio Express 2015, which is a completely free version of Visual Studio.  But the same principles apply with any version of Visual Studio.  You can get Express here: https://www.visualstudio.com/vs/visual-studio-express/.

 

I'm also curious why you would choose to switch to C#.  Visual Basic will be a much easier transition from VBA.

 

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 8 of 13

Martin-Winkler-Consulting
Advisor
Advisor

Hi @Thomas.Long

may be this Thread is useful for you.

 

 

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

Message 9 of 13

Thomas.Long
Advocate
Advocate

I might have to watch the video at home and take notes as it won't seem to load on my work computer, but thank you. I'll take a look at that tonight.

0 Likes
Message 10 of 13

Thomas.Long
Advocate
Advocate

I can probably try that at home but I don't think I should be installing 3rd party components on my work computer. It should make getting my home computer up to speed a lot easier though, thank you 

0 Likes
Message 11 of 13

Anonymous
Not applicable

SDK (Software Development Kit) is available with Inventor:

C:\Users\Public\Documents\Autodesk\Inventor <version>\SDK

 

http://usa.autodesk.com/adsk/servlet/index?id=1079044&siteID=123112

 

You should have Programming/API Help in Inventor Help also.

0 Likes
Message 12 of 13

Anonymous
Not applicable
0 Likes
Message 13 of 13

Anonymous
Not applicable

Hi Brian,

 

I am using Inventor 2020, Visual Studio Community 2017 and I have used the Inventor dll as specified.

 

I have created a VB .NET Windows Form App.

With this app I am able to open the required file and update it's parameters as required. Only thing is when a part which is already checked-in inside Vault, I cannot make any changes as file is read-only.

So, I want to check-out the part, update parameters and then check-in back into Vault.

 

Is it possible to do it using Inventor reference only? Or Do I need to add Vault also as a reference and interact with it?

 

I have tried the below method already without any success.

Dim dInv As Inventor.Application

Dim oCtrlDef As ControlDefinitions
oCtrlDef = dInv.CommandManager.ControlDefinitions["VaultCheckinTop"]
oCtrlDef.Execute2(True)

 

Thanks in advance and sorry for not following the correct thread for this query.

0 Likes