How to properly link DCL to AutoLisp?

Eugen picture Eugen · May 27, 2012 · Viewed 11.5k times · Source

I'm trying to build a very basic AutoLisp interface. I'm a total beginner at this, so after failing to code this from scratch, I turned to studying DCL properly. I followed this tutorial:

http://www.afralisp.net/dialog-control-language/tutorials/dialog-boxes-and-autolisp-part-1.php

And I got the same error. AutoCAD basically exits from executing the function, as if the dcl file wasn't even there.

I tried typing the address completely into it, but I think it should be able to work simply like linking HTML to images found in the same folder.

Below you have my code:

DCL:

samp1 : dialog {
    label = "Structural Holes";

    ok_cancel;
}

Lisp:

(defun C:samp1()
  (setq dcl_id (load_dialog "samp1.dcl"))
  (if (not (new_dialog "samp1" dcl_id))
    (exit)
    )

  (action_tile
       "cancel"
       "(done_dialog)(setq userclick nil)"
       )
  (action_tile
    "accept"
    "(done_dialog)(setq userclick T))"
    )

  (start_dialog)

  (unload_dialog dcl_id)

  (princ)

 )

(princ)

Thanks to anyone who will take the time to help me out with this. I'm starting to be quite desperate and it's my first and only autolisp project, so I have no experience whatsoever...

LE: Please note that the dcl file and the lisp file are both found in the same folder, no other subfolders or anything else.

Answer

Eugen picture Eugen · May 27, 2012
  1. Could not find **.DCL file
  2. error: quit / exit abort
  3. error: LOAD failed

    This usually means the autolisp file or DCL file could not be found. To solve this problem, make sure you put your autolisp and DCL files inside the AutoCAD search path. To be more specific, put them in a directory that is part of your "Support File and Search Path". To find the AutoCAD support file and search path list, do the following:

  4. In AutoCAD, click on the TOOLS drop down menu.

  5. Go to the OPTIONS menu item.
  6. Click on the FILES tab.
  7. Click on the plus sign + in front of SUPPORT FILE AND SEARCH PATH.

    This is your search path location. The directories listed there are searched in order, from top to bottom for any autolisp program you try to load. It is also used to find blocks and DCL files.

    Either add the directory you store your autolisp and DCL files, or move your autolisp and DCL files into one of the directories listed here. This should end the errors listed above.

I came across this piece of information by accident here:

http://www.jefferypsanders.com/autolisp_nodcl.html

HUGE THANKS to JefferyPSanders for that......