Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to invoke a method in a dll with Invenotr API?

bim01
Contributor

How to invoke a method in a dll with Invenotr API?

bim01
Contributor
Contributor

I have encountered a problem during coding with my colleagues, is anyone can help, Here is the problem:

  • in “project2”, I defined a class named “CsA”and a method called “FuncA()”, compiled the “project2”to “project2.dll”.
  • in “project1”,I add the reference of “project2.dll”, then in the Activate(……) function, I tried to instantiate an object of “CsA, but faild here (see the picture).
  • And I tried another way: I put “CsA”in “project1”then compiled it, the program runs well.
  • So how to invoke a method in a dll coded by someone else under the circumstances of collaborating with colleagues? Or it is impossible to do so in Inventor?

Circumstances: Inventor professional 2018, windows 7

problem.jpg

0 Likes
Reply
621 Views
5 Replies
Replies (5)

ckeveryga
Advocate
Advocate

This seems like more of a C# question than an Inventor API question. Try looking in stack overflow, you might have better luck. This may be what you need:

https://stackoverflow.com/questions/28449564/how-to-use-class-from-other-files-in-c-sharp-with-visua...

0 Likes

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Is the dll file copied with the build of the project to the directories needed?

 

Regards

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

bim01
Contributor
Contributor
Yes, local copy set true
0 Likes

bim01
Contributor
Contributor
I can run the program sucessfully in pure C# or in Revit environment, but faild in Inventor environment, so I think maybe Inventor has something sepcial... Thanks!

bradeneuropeArthur
Mentor
Mentor

You could take a look at the referenced inventor version in either the dll and in the project, are they the same?

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes