Import Inventor library


#1

I tried importing Autodesk.Inventor.Interop.dll from C:\Program Files\Autodesk\Inventor 2015\Bin\Public Assemblies

and got an error.

I’m not actually sure that this is the correct DLL to import, although that is the API dll I reference for Inventor add-in development, so I naively assumed I could just import it into Dynamo.

Could someone help me import the Inventor library into Dynamo? I need to access Inventor’s geometric 2D constraints solver, it’s fairly urgent (project deadline).

Cheers!


#2

Hello

I have not Inventor but maybe this helps?! - http://dynamobim.com/forums/topic/using-desingscript-commands-in-python-script/


#3

This is an excerpt from Mantis Shrimp component. It has a few import options for external libraries:

import clr import sys clr.AddReference('ProtoGeometry')

pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)

import os
appDataPath = os.getenv(‘APPDATA’)
msPath = appDataPath + r"\Dynamo.7\packages\Mantis Shrimp\extra"
rhPath = appDataPath + r"\Dynamo.7\packages\Mantis Shrimp\bin"
rhDllPath = appDataPath + r"\Dynamo.7\packages\Mantis Shrimp\bin\RhinoCommon.dll"
if msPath not in sys.path:
sys.path.Add(msPath)
if rhPath not in sys.path:
sys.path.Add(rhPath)
clr.AddReferenceToFileAndPath(rhDllPath)

from Autodesk.DesignScript.Geometry import *
import Rhino as rc
from System import Array
from System.Collections.Generic import *


Notice that when dealing with DLL files you have to add a path to the file and then the file itself. PY libraries you just need a path and then you can use the import statement or if you want a specific method from that library just do from x import y

#4

Hello, when you say you imported the library, do you mean you tried importing the library into visual studio or python? Or you tried importing it using dynamo library import?

 

If the latter, it’s possible that the inventor library uses some .net code that is not currently supported by the importer. If you know what parts of the library you need, you can just write a wrapper library that calls the correct parts, then export that as a .dll and import that new .dll.

 

if you have not already, checkout this sample for writing a zero touch library, https://github.com/DynamoDS/Dynamo/wiki/Zero-Touch-Plugin-Development


#5

In Dynamo 0.7.5, I tried: File > Import Library…

and I got this message: Exception of type ‘ProtoCore.Exceptions.CompilerInternalException’ was thrown.

Dynamo - Exception was thrown

 

 

I thought that it was going to be that simple.

Looks like Frank Fralick has already gotten this to work: https://github.com/frankfralick

I’ll try to get in touch with him. Hopefully it can be made easily accessible for Dynamo users.