Lisp showing "error; syntax error" even though coworker using it just fine

Lisp showing "error; syntax error" even though coworker using it just fine

Egbay
Contributor Contributor
2,738 Views
17 Replies
Message 1 of 18

Lisp showing "error; syntax error" even though coworker using it just fine

Egbay
Contributor
Contributor

Coworker and I are trying to use lisp for work. When coworker is able to get it to run just fine. When I use appload it says it was successfully loaded but then I try and run the command for it to work and it does not pop up on list of commands when I type in command.

 

I have looked at other posts and saw that I should drag and drop the lisp file into an open session of autocad and I get "error; syntax error".

 

Another suggestion I found was to check if lisp encoding. I used notepad++ and saw it was ANSI and under language it was LISP.

 

Since my coworker got it to work I believe there is some setting that is not right.

 

Any ideas?

0 Likes
Accepted solutions (1)
2,739 Views
17 Replies
Replies (17)
Message 2 of 18

john.uhden
Mentor
Mentor

@Egbay 

You should probably post the code either by attaching the file or by using the "Insert/Edit" button </> at the top of your reply to copy and paste the code as text.  Do NOT just paste it into your reply because the indentation will get lost and then so will I.

Also, what version of AutoCAD are you and your coworker using?

John F. Uhden

0 Likes
Message 3 of 18

Egbay
Contributor
Contributor

I attached the file. It is a Lisp created by @roland.r71. DOSLib is needed for this to run as well.

 

We are both on Civil 3d 2021

0 Likes
Message 4 of 18

paullimapa
Mentor
Mentor

Might be a corrupted file. The version I downloaded in the past works fine for me. But you need to manually created C:\Lisp\MFT folder and save the lisp file in there.

I also provided inside MFT a DATA folder containing file MFT.ini which is the initialization text file the app reads to load properly.  Make sure you first appload the version of DOSLIB that works on Civil 2021


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 18

Egbay
Contributor
Contributor

I did create that path when I tried running it. My understanding was that it would create the DATA folder with the .ini file if it was not present when first run.

 

I'll give it a shot with adding the DATA folder provided within the MFT folder and report back.

 

Thank you

0 Likes
Message 6 of 18

Egbay
Contributor
Contributor

I added the DATA folder to the C:\Lisp\MFT folder and it still did not work. I attached what the command prompt says. You can see that MFT does not show up as a command.Snip.png

 

0 Likes
Message 7 of 18

paullimapa
Mentor
Mentor
Accepted solution

Instead of the one you have, did you appload the multifiletool.lsp function I included in the zip?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 8 of 18

Egbay
Contributor
Contributor

That worked! Can you let me know what the differences were between the two files?

0 Likes
Message 9 of 18

paullimapa
Mentor
Mentor

I have no idea what the differences are. Opening both files & looking at the version # seems to be the same.  Perhaps somehow your version may be missing something?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 10 of 18

Egbay
Contributor
Contributor

No idea. I believe I downloaded the lisp again thinking there was something with the file, but when that wasnt working I thought it had to do with some setting in autocad itself. I appreciate the help! Thank you!

0 Likes
Message 11 of 18

paullimapa
Mentor
Mentor

you're welcome...cheers!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 12 of 18

paullimapa
Mentor
Mentor

I found the bug that caused the error in v3.2 and I fixed it (attached).

He added a few lines of code in this location but forgot to place them after the closing If parenthesis

			(setq cSDI (getvar "SDI"))
            (setvar "SDI" 1)
            (if (= (fileattrib (strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))) "R")
               (command "_.new" "y")
               (command "_.new")
            )
            (setvar "SDI" cSDI)

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 13 of 18

roland.r71
Collaborator
Collaborator

Thanks for fixing.

 

Been a long time since I looked at the code.

 

The part in question was a last minute addition for ending the process, if started from a blank/new drawing.

Never noticed the error there.

 

Anyway, the fix is wrong. The lines should be part of the if, not come after.

What it needs is a (progn ...) to combine the added lines as the 'fail' part of the if.

 

IF the dwg from which the process was started exists, open it. (so we end where we started)

ELSE -> set SDI & create a new/blank drawing (re-set SDI)

0 Likes
Message 14 of 18

roland.r71
Collaborator
Collaborator

I uploaded a 3.2.1 version which should, at least, fix the bug mentioned by @paullimapa in my MFT topic: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/running-a-lisp-on-multiple-drawings/...

 

...but as I only have access to LT for the moment, it remains untested.

0 Likes
Message 15 of 18

paullimapa
Mentor
Mentor

thanks for the upload of the revised MFT file.

it loads & runs successfully.

the only issue I run in to is the same error I've encountered before under MFT File Selector window "Auto order" toggle will bomb out with "Error: no function definition: DCL-LIST

paulli_apa_0-1670525954999.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 16 of 18

roland.r71
Collaborator
Collaborator

👍Thanks for the info.

 

Found the bugger. A quick look tells me "dcl-list" is used on lines

1478 (toggle duplicates)

1506 (toggle _recover)

1524 (toggle autosort)

 

on 1643 however the function is declared as "dcllist", which I think is best.

"All" it does (/ should do) is update the list in the dialog viewport to reflect the change.

 

So I'll adjust the code to use the correct function name & upload an update. (but it's an easy edit to do for anybody)

0 Likes
Message 17 of 18

paullimapa
Mentor
Mentor

After I swapped out dcl-list with dcllist, now the toggle crashes with this error msg:

Error: bad argument type: stringp nil

paulli_apa_0-1670535835792.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 18 of 18

roland.r71
Collaborator
Collaborator

Hmm... I've been messy apparently.

I'll have a look.

 

edit:

Ok, I think I got it.

It doesn't check if the list is empty before processing it.

 

So the function should be:

 

 

   (defun dclList ( lst / )
      (setq MFT_lst lst)
	  (if MFT_lst (showList))
   )

 

 

edit:

Looking at the code, I honestly don't even know why the dcllist function is (still) there.

 

All 3 instances where the function is called, could just as well be directly replaced with (if MFT_lst (showList))

and the dcllist function can be deleted.

 

edit2:

Done that & replaced the lisp file (again) for download.

 

& thanks for helping me out with testing & reporting. Much appreciated! 👍

0 Likes