Author Topic: creating a dll  (Read 2305 times)

0 Members and 1 Guest are viewing this topic.

tdaniel14

  • Guest
creating a dll
« on: March 28, 2007, 10:34:44 PM »
Does anyone have any links to tutorials for creating dll's for autocad with vb?  Any input will be helpful.  Thanks

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: creating a dll
« Reply #1 on: March 28, 2007, 10:36:21 PM »
I don't have a link for a tutorial, but I might be able to give advice if I know what it is you are trying to do.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

tdaniel14

  • Guest
Re: creating a dll
« Reply #2 on: March 28, 2007, 10:48:47 PM »
I've been programming with vba for quite some time and I'm trying to convert to vb.  I have no idea where to start.  I have sharpdevelop instead of vb it's a bit cheaper for now(free).  It appears to be somewhat the same.  Anyway, most of my programs are have dialogs and send info back and forth from dialog to cad and excel.  If you could help me just bring up a dialog in autocad that wrapped in a dll, I would greatly appreciate it.  Thanks

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: creating a dll
« Reply #3 on: March 29, 2007, 12:12:48 AM »
I have never used sharpdevelop before, but I have used VB6 and VB2005 ...

In VB2005, you will be required to do lots of changing to your code for it to be 100% compatable, but VB2005 does have an import/convert tool ... it still needs lots of work though ...

To create a dll that can be loaded directly into AutoCAD you will need to use one of several different methods.

To create a dll with exposed methods and properties in VB, use the "ActiveX" project type and define your loaders as classes that you can reference and call via lisp and/or vba. I believe this is by far the easiest way for a VBA coder to start making distributable dlls.

Another way is to use VB.Net and create a .net dll that you would load in AutoCAD using netload. This however will require you learn .net as opposed to VB (of which VBA is a subset). This is probably the preferred method for most development done for AutoCAD 2006+, but since earlier versions didn't have the ability to load dlls directly, it limits the versions of AutoCAD you can deploy it on.

Yet another method is using C++ and ObjectARX to create dll files (named xxxxx.arx where xxxxx is a varying file name). This will require learning C++ and ObjectARX and probably has the steepest learning curve. I would recommend this only if you cannot do the things you need to do, with either .net or VB, simply because Autodesk changes the ARX libraries every couple of releases, meaning you would have to compile versions for each different version of AutoCAD where the Arx libraries changed.

If you are familiar with building classes in VB, then I would simply take the existing VBA projects, export them to frm/bas/cls files, then import them into a new VB project .. there will likely only be a few things you will need to change. Finally, create an "Application" class for your dll and in the initialize event, call your main form. To load this project in AutoCAD, make sure it is registered with Regsvr32, then you would simply need to use lisp to create the object or VBA to reference it and create it there.

Liek I said, there is no single way of managing the task, but it can be done with just a little effort.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

DaveW

  • Guest
Re: creating a dll
« Reply #4 on: March 29, 2007, 10:12:27 PM »
This is not a tutorial, but two different example projects.

One for early binding and one for late binding.

http://MillLister.com/LateBinding.zip
http://MillLister.com/EarlyBinding.zip

Visit http://MillLister.com/Contact.html and get my phone number and call me.

I will walk you though setting the projects up for your version of ACAD, running the code in design time, and compiling the dll and running that.

All you have to do then is move your code over.


tdaniel14

  • Guest
Re: creating a dll
« Reply #5 on: March 30, 2007, 12:13:42 AM »
Thanks tremendously for the help guys!  What/when would be a good time to call?

DaveW

  • Guest
Re: creating a dll
« Reply #6 on: March 30, 2007, 10:23:23 AM »
I am in the PST time zone. Call during normal business hours.