.NET

Reply
*Rob Outman
Message 11 of 16 (148 Views)

Re: Getting Started with VB .NET with AutoCAD

12-01-2005 02:00 PM in reply to: cctbailey
Hi Christy,

I am just learning VB.NET too and I figured there HAS to be a way to bring a
form into the AutoCAD application so I started investigating it. I looked
through the DotNet samples directory installed with the ObjectARX SDK and
found exactly what I was looking for. If you create a new project using the
Class Library template, you can insert a "Windows Form" by clicking on the
"Add Class" button.

Use this code (from the sample "HelloWorld") to load the form into the
AutoCAD instance

' Defines a command which displays a Windows form
Public Function
HelloFormCmd()
Dim dlg As New frmHello()
dlg.ShowDialog()
End Function

Up to this point, I have found VBA to be much easier... I sure hope I get
better at this!

HIH

Rob


wrote in message news:5027063@discussion.autodesk.com...
Thanks for the additional information. It turns out that I don't think I
can do what I need to do because my application is a WIndows application
(.exe file) rather than a class library (.dll file). Apparently the
ObjectARX managed wrappers only work in a dll. I am probably going to
switch to VBA, unless I can maybe make a dll to do the AutoCAD stuff that i
can then insert into the WIndows Application and use. I'm not sure how
viable that option is, though.

Thanks,
Christy
*Tony Tanzillo
Message 12 of 16 (148 Views)

Re: Getting Started with VB .NET with AutoCAD

12-02-2005 10:23 AM in reply to: cctbailey
I don't believe you can load acmdg.dll/acdbmgd.dll
into any other process (e.g., 'standalone EXE').

Also, many of the objects exposed by the managed
API are not remotable.

While one can write the AutoCAD-specific parts of
an application as a DLL that loads into AutoCAD,
and use remoting to access it, it would be a mistake
to assume that you can pass most objects exposed
by the wrappers across the wire (e.g., remote them
to another process). Even if you could, I would doubt
that you would want to, given the performance hit
that remoting imposes.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

wrote in message news:5027202@discussion.autodesk.com...
It's perfectly viable. You need to write your AutoCAD specific code in a dll that gets loaded into AutoCAD which you then expose to out of process communication via .NET remoting (or some similar cross process communication tool). You can load acdbmgd.dll and acmgd.dll in your stand alone exe so that you can access all of the AutoCAD object types, enums, etc. then just pass them into the remotely enabled dll when you need access to a running AutoCAD instances internals. If you are new to .NET, however, you might just want to switch to VBA. I can post some code if there is interest.
Active Member
mike.king
Posts: 7
Registered: ‎12-01-2005
Message 13 of 16 (148 Views)

Re: Getting Started with VB .NET with AutoCAD

12-02-2005 12:54 PM in reply to: cctbailey
Thanks for catching that, I had only used this technique for plotting remotely in the past so I didn't notice that limitation. You can load acdbmgd.dll and acmgd.dll in a stand alone program, what you cannot do is instantiate objects. You would need to keep all of your AutoCAD specific code in the dll loaded in AutoCAD and just pass in parameters to create objects (end points of a line, center / radius of a circle, etc) then create the objects in AutoCAD.

You can still use this technique to automate AutoCAD from out of process, you just cannot pass AutoCAD specific objects across the process boundary.

As for whether or not you would want to, in my case I do but that's up to the individual application I suppose.
*Tony Tanzillo
Message 14 of 16 (148 Views)

Re: Getting Started with VB .NET with AutoCAD

12-02-2005 02:13 PM in reply to: cctbailey
>> You can load acdbmgd.dll and acmgd.dll in a stand
>> alone program, what you cannot do is instantiate objects

No, you really can't load them into a stand-alone process.

The runtime does not actually load an assembly until the
first time you attempt to instantiate an object or reference
static data from the assembly, so if never do either of those
things, the assembly is never loaded.

Those assemblies can only be referenced from another
process, but not actually loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
Active Member
mike.king
Posts: 7
Registered: ‎12-01-2005
Message 15 of 16 (148 Views)

Re: Getting Started with VB .NET with AutoCAD

12-05-2005 03:36 AM in reply to: cctbailey
Got it. Thanks.
Contributor
cctbailey
Posts: 17
Registered: ‎11-29-2005
Message 16 of 16 (148 Views)

Re: Getting Started with VB .NET with AutoCAD

12-05-2005 08:14 AM in reply to: cctbailey
Guys,

Thanks so much for the responses. I understand basically what you guys are talking about, but I'm still very unclear on how to make it happen. I actually have posted my problem more specifically on another post (http://discussion.autodesk.com/thread.jspa?threadID=442254). Basically, I need to create an exe that will allow the user to select drawings that need to be plotted. The AutoCAD part is that the program needs to open AutoCAD, open the drawings, create plt files of each one, and then (if the user selects it), plot the drawing to either half or full size. I'm not actually trying to draw in AutoCAD, but I need to be able to access AutoCAD's plot functionality.

I have been asked to do this in VB .NET if at all possible, because "it is the wave of the fuutre".

I have found virtually no examples on how to do this, however there is one gentleman that posted to my other post who is writing a blog example at http:\\snippetsandmusings.blogspot.com, but any other code that would help would be greatly appreciated.

Thanks,
Christy
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.