Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DCL error: definition could not be found

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
Anonymous
2601 Views, 11 Replies

DCL error: definition could not be found

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

 

11 REPLIES 11
Message 2 of 12
_Tharwat
in reply to: Anonymous

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 .

Message 3 of 12
_Tharwat
in reply to: _Tharwat

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

 

Message 4 of 12
Anonymous
in reply to: _Tharwat

All the contents are located in "lots of stuff".

Also, I did try to put them in support folder as well.

Message 5 of 12
_Tharwat
in reply to: Anonymous

Copy and paste this (load_dialog "Menu.dcl") into your command line and let me know the what is the outcome of it .

Message 6 of 12
Anonymous
in reply to: _Tharwat

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

Message 7 of 12
_Tharwat
in reply to: Anonymous

You are right , that means it did not find the dcl file.

 

Move it to Support Folder and try again .

Message 8 of 12
Anonymous
in reply to: _Tharwat

Isn't the address I provided the correct one? The DCL files are in BOTH location currently.

Message 9 of 12
hmsilva
in reply to: Anonymous

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

EESignature

Message 10 of 12
Anonymous
in reply to: hmsilva

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?

Message 11 of 12
hmsilva
in reply to: Anonymous


@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

EESignature

Message 12 of 12
hmsilva
in reply to: Anonymous


@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

 

 

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost