.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.Net DLL Help

10 REPLIES 10
Reply
Message 1 of 11
neilfl
964 Views, 10 Replies

.Net DLL Help

I'm trying to build an application that will write to the properties of Autodesk files. I have the iProperties for inventor files working and now I'm trying to do AutoCAD. I've found many examples of code but can't test anything because of my problems. I've seen two places to find the dll's, one is from the application directory c:\ProgFiles\AutoDesk\AutoCAD xxxx. Others are saying to download and pull from ObjectARX 2013. I get strange errors when I try and use these dll's.

 

If I use ObjectARX I get this... "Common Language Runtime detected an invalid program."

 

If I use the application directory I get this... "Could not load file or assembly 'accoremgd,..."

 

I'll be trying to do something like the following and it fails every time

 

Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

 

Here are the assemblies that I'm working with...

AcCoreMgd.dll

AcDbMgd.dll

AcMgd.dll

 

I'm clearly missing something here. Please help.

 

Thank you in advance.

 

10 REPLIES 10
Message 2 of 11
Alfred.NESWADBA
in reply to: neilfl

Hi,

 

what version of AutoCAD do you use?

what version of Visual Studio do you use?

what Framework have you set to your project-Framework?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 11
DiningPhilosopher
in reply to: neilfl

Per chance, are you writing a extension dll for AutoCAD, or a standalone application?

 

AutoCAD's managed dlls are only usable from a .NET extension DLL that gets loaded into AutoCAD.

Message 4 of 11
neilfl
in reply to: Alfred.NESWADBA

Re: Alfred

 

AutoCAD 2013 

VS 2010 

.Net 4.0

 

Thanks,

 

Neil

Message 5 of 11
neilfl
in reply to: DiningPhilosopher

No I'm writing a standalone application.

 

I'm not sure I understand what you mean regarding the use of the DLL's, can you explain?

 

Are you saying that the DLL's cannot be consumed by a standalone application? 

 

Thanks for the help.

 

Neil

Message 6 of 11
Alfred.NESWADBA
in reply to: neilfl

Hi,

 

>> If I use ObjectARX [...]

Do you mean by this where your referenced DLL's are from? I always use the DLL's from the AutoCAD installation directory (but I know that Stephen Preston always says that the DLL's from the ObjectARX-kit should be referenced).

And just to make sure: you have downloaded the ObjectARX for AutoCAD 2013?

 


>> Could not load file or assembly 'accoremgd,...

Is it possible that you have:

  • your application on a network-drive
  • you have set "yes" to the "local copy" property of the refernces?

 

Sometimes during development I saw that cleaning the output-directory, restarting VS and fully recompile the solution was necessary to get it running again (especially if you have multiple projects open using same source(parts), ==> try that also!

 

Good luck, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 7 of 11
Alfred.NESWADBA
in reply to: neilfl

Hi,

 

ok, our posts crossed 😉

 

>> No I'm writing a standalone application.

you can use DLL's, of course, but only the ones that are loaded into AutoCAD can use the mananged API.

 

If you have an EXE that starts AutoCAD and than uses _NETLOAD (or something like demand-loading) to load a special DLL into AutoCAD, then it's ok for using the managed API (and referencing the *mdg.dll).

 

If you have an DLL from outside AutoCAD then you can just use the COM-objects API, not the managed one.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 8 of 11
DiningPhilosopher
in reply to: neilfl


@neilfl wrote:

No I'm writing a standalone application.

 

Are you saying that the DLL's cannot be consumed by a standalone application? 

 


Right.

 

AutoCAD's managed DLLs are provided as managed wrappers for accessing functionality in AutoCAD. They can't be used remotely, only from extension DLLs that are loaded into AutoCAD's process.

 

The only way to interact with AutoCAD from another process is via it's ActiveX API.

 

 

Message 9 of 11
neilfl
in reply to: DiningPhilosopher

DP, where can I find documentation on using ActiveX API for AutoCAD and extension dll's from AutoCAD process?

 

 

Message 10 of 11
mzakiralam
in reply to: neilfl

@neilfl: You mentioned that: I've found many examples of code but can't test anything because of my problems.

 

Where did you find examples of code? Can you give me the link? I also need to practice.

 

Thanks in advance.

Message 11 of 11
Balaji_Ram
in reply to: mzakiralam

Hello Zakir,

 

If you are looking for help / samples on iProperties, then you can try posting a question in the Inventor Customization discussion group.

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I am sure you will get links from there.



Balaji
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost