10.13.2009

Network-based OpenDCL deployment

Almost anyone who's programmed in AutoCAD is familiar with dialog control language, or simply DCL. It's an old crappy and complicated language for making dialog boxes accessible with AutoLISP. DCL is the way of the past...OpenDCL is the future. It was derived from a now GPL'ed third-party extension called ObjectDCL. It is now maintained by some of AutoCAD's finest; Owen Wengerd (of ManuSoft fame), for one.

OpenDCL is vastly superior to DCL in every way. With OpenDCL, you can make your own custom tool palettes with just about anything on them. OpenDCL has event handlers, drawing preview boxes, drag and drop support, block view boxes, hatch view boxes, just about everything you'd ever need. On top of that, it has a user interface designer (OpenDCL Studio) that makes all of this a breeze. Most of the work is done in OpenDCL Studio designing the UI and specifying what AutoLISP functions to call on a certain event, i.e. a mouse click, a drag and drop, a list selection change, etc. In essence, OpenDCL gives you the power of ObjectARX and MFC in AutoLISP.

Anyway, this is all off-topic. Those who don't know of OpenDCL's power should check out it's website, using anything else is a waste of time.

The only issue with OpenDCL is that it's not already integrated into AutoCAD (unlike DCL). You have to install the runtime which copies all of the ARX files and tells AutoCAD to load them upon typing "opendcl" at the command prompt in AutoCAD. Well, all of this is changed, because you can simply place the OpenDCL files in a network location and use a few lines of LISP to tell AutoCAD to load the correct file, thus eliminating the need to install the runtime on every computer. Alternatively, a .msm Windows installer merge module is also provided so that you can merge that with an existing .msi installer package, but .msi's don't always play nice. Plus, what if AutoCAD is already installed on all of your computers? That'd still be one installation too many.

Procedure:
  1. Install OpenDCL Runtime or OpenDCL Studio onto any computer. These can be obtained from the OpenDCL website.

  2. Copy all files in the C:\Program Files\Common Files\OpenDCL directory to a network directory of your choice.

  3. Use the code below to load the proper ARX, when needed.

Code:

;; slashes must be doubled, i.e. "C:\\Somewhere\\Somewhere else"
;; path must not end with slashes
(setq OpenDCLLocation "wherever you put the OpenDCL files")

;; detect if computer is 64-bit
(if (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE"))
(setq OpenDCLFilename (strcat "OpenDCL.x64."
(substr (vlax-product-key) (1+ (vl-string-search "1" (vlax-product-key))) 2)
".arx"))
(setq OpenDCLFilename (strcat "OpenDCL."
(substr (vlax-product-key) (1+ (vl-string-search "1" (vlax-product-key))) 2)
".arx"))
)

;; detect if ARX is already loaded
(if (not (member OpenDCLFilename (arx)))
(arxload (strcat OpenDCLLocation "\\" OpenDCLFilename))
)

That's it. If you ever need help with OpenDCL, just go to the forums. There are lots of helpful people like Owen himself and Fred Tomke. I also frequent these forums, but am not as experienced as they are.

1 comments:

  1. I'd just like to add that the proprietor of DuctiSoft (which owns ObjectDCL) has been trying to convince AutoCAD developers that the licensing of OpenDCL (GNU GPL) means that you would also have to release your (commercial) product under the GPL. This is entirely untrue.

    Post on OpenDCL forums confirming that you do not need to release your commercial program under the GNU GPL: http://www.opendcl.com/forum/index.php?topic=530.0

    Original post on Autodesk Discussion Groups that started it all: http://discussion.autodesk.com/forums/thread.jspa?threadID=753733&tstart=0

    More thorough explanation: http://discussion.autodesk.com/forums/thread.jspa?messageID=6296124#6296124

    ReplyDelete