ACAD DLL Accessibility Error

ACAD DLL Accessibility Error

hanchris
Advocate Advocate
2,176 Views
13 Replies
Message 1 of 14

ACAD DLL Accessibility Error

hanchris
Advocate
Advocate
I am trying to learn VB.NET, for a program I need to create, which will send information to AutoCAD. I am using AutoCAD: Electrical 2009 (but just need to access the AutoCAD API) and Visual Studio 2003. I would consider myself very new to Visual Studio; but not to VB since I use VBA, either AutoCAD, Microsoft Office, or other programs.

Well, I thought I will sit down and do that famous Hello World program; but when trying to add the dll I get the following error:

"A Reference to 'C:\Program Files\Autodesk\Acade 2009\acdbmgd.dll' could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' or COM components can be referenced. Please make sure the file is accessible and that it is a valid assembly or COM component."

If I did not know better I would say I did not have permissions to edit these and unless our IT department has locked down all DLL files for some reason I do have write access to that directory. I am not sure what COM components is; but this file is obviously a dll, so should fall under the first classification.

I guess my question is two parts 1) what is accessibility, in relation to .NET since it is obviously not read/write access? 2) Has anyone come across a solution to this problem since VB.NET will be almost useless for me if I cannot get access to the AutoCAD libraries, both acmgd.dll and acdbmgd.dll?

Thanks.
0 Likes
2,177 Views
13 Replies
Replies (13)
Message 2 of 14

norman.yuan
Mentor
Mentor
Probably you need to clarify it a bit more.

"for a program I need to create"? Does that mean you are writing and stand-alone exe program and you want to send information from this application to a running AutoCAD session, so that AutoCAD can do something according to the data sent from your application?

If this is the case, you are automating AutoCAD via AutoCAD's COM API, just as you do using calssical VB (VB5/6). You DO NOT use acdbmgd.dll/acmgd.dll, which are AutoCAD ObjectARX .NET API and can only be used inside AutoCAD.

I do not believe it is accessibility issue.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 14

hanchris
Advocate
Advocate
Thanks for the response!

The program I am trying to write is an existing stand-alone program, of ours, written in VB that we were using with another drafting software. It is suppose to take a list of drawing files open up the drawing, insert a block, and print that drawing and then close without saving. I need to modify this program to work with AutoCAD or develop a similar way. I have already created a program in LISP and VBA (combination) that does this from the command line of the open drawing only.

Is this something I would use VB.NET or COM? I understand the concept behind.NET more then I do, then COM; but even .NET I do not know enough to explain to someone (meaning I do not know it very well).


Although, with my original question, I was doing a little more research and it looks like Visual Studio 2003, uses Framework 1.1 and it looks like AutoCAD converted their libraries to Framework 2.0 back in the 2007 version, which is why I am getting that error. Here is the link that supports this point: http://discussion.autodesk.com/forums/thread.jspa?threadID=476093#5195266 Does this sound correct?
0 Likes
Message 4 of 14

hanchris
Advocate
Advocate
It probably is a Framework version problem, what is the version that AutoCAD 2009 operates at? What about AutoCAD 2010 since we might be going to that soon?

Basically, I am asking what is the lowest version of Visual Studio I need since I am reading Visual Studio 2010 is using Framework4.0 and I am still on 1.0


Does anyone have a work around? How did you do this stuff before .NET? I can get the file names and I have a file that can do it; but I just need to open a file and run something on the command line.

Thanks in advance.
0 Likes
Message 5 of 14

norman.yuan
Mentor
Mentor
It has nothing to do with .NET framework version, nor Visual Studio version. You cannot use ObjectARX .NET API (wrapped in acdbmgd.dll and acmgd.dll) outside AutoCAD, i.e. your stand-alone application. Period.

You have to use AutoCAD's COM API to automate/communicate with AutoCAD. You can use classical VB (5/6), or ANY version of Visual Studio .NET (2002 to 2008, or even future VS2010, if you want to wait).

If you really want to use ObjectARX .NET API by using acdbmgd.dll/acmgd.dll in your code, (which is the main topics of this NG), forget your external app, start learning by going through AutoCAD .NET programming labs, provided by Autodesk.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 6 of 14

hanchris
Advocate
Advocate
Thanks again for the update and I will try and understand the AutoCAD COM API.

But as for your comment about going to learn from one of the many Autodesk .NET labs out there. It is what I was trying to do and why I started this post I started a new Visual Studio's project and was walking through the famous "Hello World" tutorial of Autodesk. (I say famous because I have seen it referenced tons during my Internet search for AutoCAD and VB.NET.) Well, one of the steps is referencing the acdbmgd.dll/acmgd.dll files and that is where I got the above error. I am in a new project, following the steps exactly according to the attached lesson and I cannot complete page 6 because I cannot load the .DLL.

Perhaps, I should have been more clearer. I was not looking for help with my program that I have to write; but with the Hello World tutorial, which is now attached. It is a bad habit of including too much information.

Truly I am thankful for your help and I will be looking into AutoCAD's COM API.
0 Likes
Message 7 of 14

Anonymous
Not applicable
Rather than expecting everyone here to guess what you may have done
incorrectly, why not just post the project so others can have a look?

Excuse the sarcasm, but this really isn't like a TV game show where there's
a prize for the first right guess.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");


wrote in message news:6201097@discussion.autodesk.com...
Thanks again for the update and I will try and understand the AutoCAD COM
API. But as for your comment about going to learn from one of the many
Autodesk .NET labs out there. It is what I was trying to do and why I
started this post I started a new Visual Studio's project and was walking
through the famous "Hello World" tutorial of Autodesk. (I say famous because
I have seen it referenced tons during my Internet search for AutoCAD and
VB.NET.) Well, one of the steps is referencing the acdbmgd.dll/acmgd.dll
files and that is where I got the above error. I am in a new project,
following the steps exactly according to the attached lesson and I cannot
complete page 6 because I cannot load the .DLL. Perhaps, I should have been
more clearer. I was not looking for help with my program that I have to
write; but with the Hello World tutorial, which is now attached. It is a bad
habit of including too much information. Truly I am thankful for your help
and I will be looking into AutoCAD's COM API.
0 Likes
Message 8 of 14

hanchris
Advocate
Advocate
What project am I suppose to post, when I have not typed in anything? I have just created a new project that is it. I created a new project and then when I go and try and reference the AutoCAD DLL I get an error message, which I was hoping someone here could try and interpret.

However, if it makes you feel better attached is my empty project that I cannot do anything, with that involves the AutoCAD API because I cannot reference the DLL files. When I try, in Visual Studio 2003, by right clicking on the reference folder in the Solution Explorer and click "Browse" I then get the following message:

"A Reference to 'C:\Program Files\Autodesk\Acade 2009\acdbmgd.dll' could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' or COM components can be referenced. Please make sure the file is accessible and that it is a valid assembly or COM component"

This message will then not let me leave the "Add Reference" window, until I remove the DLLs, in question. I have tried to add these files, under the .NET tab, COM tab, and Project Tab, not really knowing what the difference is; but trying to learn. I may not know much about .NET; but I know enough that I cannot access the AutoCAD API without referencing either acdbmgd.dll or the acmgd.dll, which I know do different things. I know the acmgd.dll allows access to the AutoCAD Editor, which is used to access the commands and dialogues. I know the acdbmgd allows access to the DWG database, which is where each line, circle, block, and other entity that can be in a DWG is stored. Although, I cannot reference either of them in .NET, so this "powerful" language of .NET in relation to AutoCAD is useless to me.

So, I am asking you again, my existing program aside, is this referencing problem (above error message) in a new project something you can help me with? I am using AutoCAD 2009 and Visual Studio 2003.
0 Likes
Message 9 of 14

Anonymous
Not applicable
To be perfectly honest, I have never tried using Visual Studio 2003 with
AutoCAD 2009's .NET API.

The one simple question I have for you, is why on Earth are you using a
7-year old version of Visual Studio????????


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");


wrote in message news:6201677@discussion.autodesk.com...
What project am I suppose to post, when I have not typed in anything? I have
just created a new project that is it. I created a new project and then when
I go and try and reference the AutoCAD DLL I get an error message, which I
was hoping someone here could try and interpret. However, if it makes you
feel better attached is my empty project that I cannot do anything, with
that involves the AutoCAD API because I cannot reference the DLL files. When
I try, in Visual Studio 2003, by right clicking on the reference folder in
the Solution Explorer and click "Browse" I then get the following message:
"A Reference to 'C:\Program Files\Autodesk\Acade 2009\acdbmgd.dll' could
not be added. This is not a valid assembly or COM component. Only assemblies
with extension 'dll' or COM components can be referenced. Please make sure
the file is accessible and that it is a valid assembly or COM component"

This message will then not let me leave the "Add Reference" window, until I
remove the DLLs, in question. I have tried to add these files, under the
.NET tab, COM tab, and Project Tab, not really knowing what the difference
is; but trying to learn. I may not know much about .NET; but I know enough
that I cannot access the AutoCAD API without referencing either acdbmgd.dll
or the acmgd.dll, which I know do different things. I know the acmgd.dll
allows access to the AutoCAD Editor, which is used to access the commands
and dialogues. I know the acdbmgd allows access to the DWG database, which
is where each line, circle, block, and other entity that can be in a DWG is
stored. Although, I cannot reference either of them in .NET, so this
"powerful" language of .NET in relation to AutoCAD is useless to me. So, I
am asking you again, my existing program aside, is this referencing problem
(above error message) in a new project something you can help me
with? I am using AutoCAD 2009 and Visual Studio 2003.
0 Likes
Message 10 of 14

hanchris
Advocate
Advocate
I work with the tools I am given, not with the tools that I would like.
0 Likes
Message 11 of 14

Anonymous
Not applicable
This is taken directly from the ObjectARX 2009 SDK documentation:

Developing applications with ObjectARX requires the following software and hardware:

Microsoft® Windows® 2000, Service Pack 4; Microsoft Windows XP Professional, Service Pack 2; Windows Vista Enterprise; Windows Vista Business; and Windows Vista Ultimate
Microsoft Visual Studio 2005®, Service Pack 1
Pentium® IV or later
512 MB RAM
1024 x 768 VGA with True Color (minimum)


You can use the free Express Edition of VS 2005, however i believe it requires a bit of a work around for debugging, which should be detailed somewhere on this forum.

Good Luck,
-Mark P.
0 Likes
Message 12 of 14

Anonymous
Not applicable
Then you need to tell whomever gave you the tool that
they gave you the wrong tool.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");


wrote in message news:6201777@discussion.autodesk.com...
I work with the tools I am given, not with the tools that I would like.
0 Likes
Message 13 of 14

Anonymous
Not applicable
Can confirm there is nothing wrong with how the project was created as I can open the project in 2008 and after it is converted can add the references. As Mark pointed out you can use the free express editions http://www.microsoft.com/express/product/.
0 Likes
Message 14 of 14

hanchris
Advocate
Advocate
Thank you all. I feel so much better, just knowing what the problem is. I can now feel comfortable with a work around, even if it will result in a more cumbersome program.


I really appreciated all the help.
0 Likes