Question

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.

Was it helpful?

Solution

  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......

OTHER TIPS

For what its worth, you can also create a dialog on the fly in a "known directory" (like the directory AutoCAD resides in for example). The following will demonstrate that.

(defun _make-getstring-dialog-on-the-fly ( / fn f dcl dcl_id userclick str) 
  (setq fn (strcat
             (vl-filename-directory
               (findfile "acad.exe")) "\\$vld$.dcl")
        f (open fn "w")
        dcl
        '(
          "stringdlg : dialog {"
          "label = \"Charater Array\";"
          ": edit_box {"
          "label = \">>:\";"
          "edit_width = 20;"
          "key = \"stringdlg\";"
          "is_default = true;"
          "}"
          ": row {"
          "alignment   = centered;"
          "fixed_width = true;"
          " : button {"
          " label      = \"OK\";"
          " key        = \"dcl_accept\";"
          " width      = 10;"
          " allow_accept = true;"
          " }"
          "}"
          "}"
          )
        )
  (mapcar 
    (function
      (lambda ( x )
        (write-line x f)
        (write-line "\n" f)))
    dcl)
  (close f)
  (setq dcl_id (load_dialog fn))
  (new_dialog "stringdlg" dcl_id)
  (action_tile "stringdlg" "(setq str $value)(done_dialog)")
  (setq userclick (start_dialog))
  (unload_dialog dcl_id)
  str
  )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top