(defun Label(/ ddiag dcl_id ret lay intStr intOpt) (setq ret nil) ;; Create a list of layer's name (setq *layList nil) (while (setq lay (cdadr (tblnext "layer" (not lay)))) (setq *layList (cons lay *layList)) ) (setq *layList (acad_strlsort *layList)) ;; Try to load the DCL file from disk into memory (if(not(setq dcl_id (load_dialog "Menu.dcl") ) ) (progn (alert "The DCL file could not be loaded.") (exit) ) (progn ;; Try to load the definition inside the DCL file (if (not (new_dialog "Menu" dcl_id) ) (progn (alert "The definition could not be found inside the DCL file") (exit) ) ;; If the definition was loaded
;; does stuffs here - deleted for this post
) ) ) )
Menu : dialog { label = "Menu"; // Puts a label on the dialog box initial_focus = "pnlCur"; // Sets the initial focus : row { // Lots of stuff } }
The top and bottom part of the attached codes are portion of my AutoLisp and DCL (respectively) for a macro that I have created.
It has been working very well for the previous few months, but now that I changed into a new laptop, it is keep generating the following message:
"The definition could not be found inside the DCL file"
One strange thing to note is that it will generate this message EVEN IF I DELETE DCL FILE FROM THE DIRECTORY (it should've said "The DCL file could not be loaded.").
If you know any possible cause of this, please let me know.
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Hi ,
with a quick glance to the codes .
Did you add your dcl file into the search folder ? eg. into the Support folder ?
Your dcl file does not have neither ok or Cancel button .
Consider this way of loading the dcl file , though it is not the only way but it is much clearer than yours which looping into loops and goes too far .
(if (and (< 0 (setq dcl_id (load_dialog "Menu.dcl"))) (new_dialog "Menu" dcl_id) ) (progn ;;; ................ ;;; ) (progn (alert "The DCL file could not be loaded.") (exit) ) )
Copy and paste this (load_dialog "Menu.dcl") into your command line and let me know the what is the outcome of it .
It returns -1, which I assume that AutoCAD couldn't find find the DCL file.
I've currently placed on two location:
- Same folder as .lsp file
- ... Autodesk\AutoCAD 2013\UserDataCache\en-us\Support
You are right , that means it did not find the dcl file.
Move it to Support Folder and try again .
Hi Caladbolgll,
have you changed your 'load' test, from
(not(setq dcl_id (load_dialog "Menu.dcl") ) )
to
(and (< 0 (setq dcl_id (load_dialog "Menu.dcl"))))
as Tharwat has suggested?
If not, your test will return always'nil', because 'load_dialog' function, returns a positive integer value if successful, or a negative integer if can't open the file.
That's why you get the message "The definition could not be found inside the DCL file", even if the file is not found.
Try
(findfile "Menu.dcl")
what is the return?
I hope this helps
Henrique
I've resolved the problem.
I have put my Menu.dcl file where Acad.dcl file was located, instead of where Acad.lsp is located.
Here is the current address which I have put it:
C:\Program Files\Autodesk\AutoCAD 2013\Support
One question remaining is, I used to put my dcl file in the same location with my lsp file, and had no problem at all. Can someone explain why this is now causing a problem? Am I supposed to store all dcl files into the support directory?
@Anonymous wrote:
Menu.dcl file is located in both folder:
C:\Program Files\Autodesk\AutoCAD 2013\UserDataCache\en-us\Support
Command: Options
Files tab, expands the 'Support File Search Path', is 'C:\Program Files\Autodesk\AutoCAD 2013\UserDataCache\en-us\Support' listed on the 'SFSPath'?
If not, Add button, and add the 'C:\Program Files\Autodesk\AutoCAD 2013\UserDataCache\en-us\Support' to the 'SFSP' and try again...
EDIT: Using brute force, you could also try:
(setq dcl_file "C:\\Program Files\\Autodesk\\AutoCAD 2013\\UserDataCache\\en-us\\Support\\Menu.dcl") (and (< 0 (setq dcl_id (load_dialog dcl_file))))
Henrique
@Anonymous wrote:
I've resolved the problem.
I have put my Menu.dcl file where Acad.dcl file was located, instead of where Acad.lsp is located.
Here is the current address which I have put it:
C:\Program Files\Autodesk\AutoCAD 2013\Support
One question remaining is, I used to put my dcl file in the same location with my lsp file, and had no problem at all. Can someone explain why this is now causing a problem? Am I supposed to store all dcl files into the support directory?
'C:\Program Files\Autodesk\AutoCAD 2013\Support' is by default one of the 'SFSP'.
AutoCAD will search for .lsp, .dcl,... only at the 'SFSP' and current directory.
'One question remaining is, I used to put my dcl file in the same location with my lsp file, and had no problem at all. Can someone explain why this is now causing a problem?'
Is your lsp file location one of the 'SFSP'?
If so, did you made some AutoCAD update?
Try to add the 'file location' to the 'Trusted Paths'.
'Am I supposed to store all dcl files into the support directory?'
One way:
create one directory for your customization files and add the directory to the 'SFSP' (Using the method I explained in my previous post).
Henrique