Lisp file does not work on 2022 Autocad

Lisp file does not work on 2022 Autocad

dentnd81
Explorer Explorer
3,367 Views
10 Replies
Message 1 of 11

Lisp file does not work on 2022 Autocad

dentnd81
Explorer
Explorer

Hello, I was hoping someone could help me out. I just upgraded to 2022 Autocad from 2015. On the 2015 version I used a Lisp routine regularly. I tried to load it into 2022 and it gives an error: quit/abort message. I have loaded it into apploader and put it in the trusted folder locations. I have been researching for days on a possible solution and cant seem to figure it out. The command is: DVADDR and its supposed to open a dialog box to be able click on blocks to update the number sequence. I have attached the Lisp. Can someone please help?? Thanks

0 Likes
Accepted solutions (1)
3,368 Views
10 Replies
Replies (10)
Message 2 of 11

CodeDing
Advisor
Advisor

@dentnd81 ,

 

It looks like your lisp is looking for a DCL file called "Increment". If that file cannot be found when the lisp is executed, then it will error out like you're describing. Do you have that file? Is it located in the same place as your lisp file?

 

.....
(defun c:devaddr (/ :dlgid :done :sel)

  (setq :dlgId (load_dialog "Increment.DCL"))
  (setq :done 3)

  (while (/= :done 0)
    
  	(if (not (new_dialog "increment" :dlgId))   
    		(exit)                                 
  	)
.....

Best,

~DD

0 Likes
Message 3 of 11

dentnd81
Explorer
Explorer
Thanks for the response! I did find the file named "Increment and it is a DCL file. Where do I need to put this file? Please forgive me as I am slowly learning about LISP routines.
0 Likes
Message 4 of 11

CodeDing
Advisor
Advisor

@dentnd81 wrote:
Please forgive me as I am slowly learning about LISP routines.

No worries! Welcome to the forums btw.

 


@dentnd81 wrote:
I did find the file named "Increment and it is a DCL file. Where do I need to put this file?

We can see that the (load_dialog ...) function in the AutoLISP Reference documentation does the following:

Remarks
The load_dialog function searches for files according to the AutoCAD library search path.

 

...This means that it will search your Support File Search Paths listed here:

image.png

 

So as long as the file resides in one of those locations, you should be good to go. If it causes you any heartaches, you may want to add the path to your "Trusted Locations" also. Be sure to restart AutoCAD if you update your paths, just for good measure.

 

Best,

~DD

 

0 Likes
Message 5 of 11

dentnd81
Explorer
Explorer
I have the file in the loaded lisp file in the apploader and all those
files are in the trusted files. I restarted Autocad and it still does not
work. I have a few other lisp files that work on both the 2015 and 2022
version, it's just this one particular lisp that does not work, and of
course it's the one I need the most. Any other possible ideas? I really do
appreciate the help. Thanks
0 Likes
Message 6 of 11

Sea-Haven
Mentor
Mentor

One way around the find dcl is to add the dcl code to your lisp, so it gets created as a temporary file. 

 

Have a look at this link ❚❚ Convert dcl file to lisp file - AutoLISP, Visual LISP & DCL - AutoCAD Forums (cadtutor.net)

 

I have used it and found it very helpful.

0 Likes
Message 7 of 11

CodeDing
Advisor
Advisor
Accepted solution

@dentnd81 ,

 

To be clear..

1) Are your "DevAddr.lsp" and "Increment.dcl" files located in the same folder?

2) That folder path is showing inside of your "Support File Search Path" list?

3) You only need to APPLOAD the "DevAddr.lsp" file into the drawing you are currently working in, and in that same drawing you call the DEVADDR command.

 

If you are performing all of those steps correctly, and it's still not working.. Run this code and lets confirm which files its finding:

(defun c:TEST ( / dPath iPath)
  (setq dPath (findfile "devaddr.lsp"))
  (setq iPath (findfile "Increment.dcl"))
  (alert
    (print
      (cond
        ((and dPath iPath) (strcat "\nBoth files found:\nLisp path >>> " dPath "\n\nDCL path >>> " iPath))
        (dPath (strcat "\nOnly Lisp file found:\nLisp path >>> " dPath))
        (iPath (strcat "\nOnly DCL file found:\nDCL path >>> " iPath))
        (t "\nNeither file was found...")
      );cond
    );print
  );alert
  (princ)
);defun

 

Best,

~DD

0 Likes
Message 8 of 11

dentnd81
Explorer
Explorer
That is what was missing, placing the folder in the support file list. It
works now!!! Thanks a ton I appreciate it!!
Message 9 of 11

Sea-Haven
Mentor
Mentor

It can be handy to have a folder like C:/mylispfiles, and save everything into it that you download from here, then you have a simple support path to add rather than the complicated default ones.

0 Likes
Message 10 of 11

kbucknam
Explorer
Explorer

FYI - I had a similar issue and this was the only fix I found accept that my lisp file and my dcl file were in the same folder that was within the folder that I selected as my trusted folder.  The routine would not work until I took the dcl file up one folder level so that it was in the exact location as the "trusted folder".  I have no clue why that made the difference, but it works now! Thanks!

0 Likes
Message 11 of 11

cadffm
Consultant
Consultant

Hi,

 

your  .dcl have to be in one of your support pathes, otherwise ACAD will not find them.

 

For trusted pathes: The same,

but you can add a folder INCL. ALL SUBfolders as trusted path, by adding three dots at the end of the main path.

For example the whole D:\ drive:

D:\...

 

 

Sebastian