Accoreconsole load lsp error

Accoreconsole load lsp error

townest
Advocate Advocate
1,470 Views
14 Replies
Message 1 of 15

Accoreconsole load lsp error

townest
Advocate
Advocate

Hello,

 

I have a script that calls a lisp.  In vanilla AutoCAD GUI, the lisp has been debugged and fires fine, and then up one level the scr is fine also (runs and calls lisp without error). 

 

However, when I run the script through the Accoreconsole I get the following error:

 

Command: (load "C:\\rootC\\ACADbat\\renlayer.lsp")
; error: File load canceled: C:/rootC/ACADbat/renlayer.lsp

 

Any ideas how to get the script to load the list without error through the Accoreconsole?

 

Thank you,

 

Tyler

AutoCAD 2022

0 Likes
1,471 Views
14 Replies
Replies (14)
Message 2 of 15

paullimapa
Mentor
Mentor

what if you change the script so that it loads the lisp using this format:

(load"C:/rootC/ACADbat/renlayer")


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

dmfrazier
Advisor
Advisor

There may be clues in the LSP routine. (For example, some commands cannot be run in accoreconsole.)

Can you post it?

0 Likes
Message 4 of 15

townest
Advocate
Advocate

I tried your suggestion with and without space after load, and with and without .lsp extension.  No luck.  Any other suggestions?

Thank you,

Tyler

0 Likes
Message 5 of 15

paullimapa
Mentor
Mentor

as @dmfrazier suggested, share your lisp routine


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

townest
Advocate
Advocate

Sure.  Here is the lisp.

 

renlayer.lsp

(defun renlayer (old new)
(if (tblsearch "LAYER" old)
(command "_rename" "LA" old new)
)
)

(mapcar 'renlayer
'("$AR1" "$SC1" "temp10" "temp11")
'("AR1" "SC1" "TEMP10" "temp11_new")
)

 and here is the scr:

(load "C:\\rootC\\ACADbat\\renlayer.lsp")
ZOOM E
_Quit
N


Thank you,

Tyler

0 Likes
Message 7 of 15

dmfrazier
Advisor
Advisor

Not sure of this, but try changing "_rename" to "-rename".

0 Likes
Message 8 of 15

paullimapa
Mentor
Mentor

share the batch file that you are using to launch Accoreconsole 


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

paullimapa
Mentor
Mentor

nevermind..my comment below..I see the tblsearch for old layer function now.

fyi: the rename layer function will fail and hang if the layer name does not exist.


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

paullimapa
Mentor
Mentor

I've tested using the following line in my batch file I created running in 2020 and the lisp routine loads from the script without any problems so I cannot replicate your issue:

FOR %%f in ("c:\autodesk\*.dwg") do "C:\Program Files\Autodesk\AutoCAD 2020\accoreconsole.exe" /i "%%f" /s "C:\rootC\ACADbat\renlayer.scr" /l en-US

I did have to add an extra return at the end of the script to complete the N command:

 

(load "C:\\rootC\\ACADbat\\renlayer.lsp")
ZOOM E
_Quit
N

; include empty line above to complete command

 


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

townest
Advocate
Advocate

Interesting that yours worked.

 

I have no bat file to share.  I am using a Python subprocess which normally works with other scripts.  Once my Python script failed I pulled it out of the lineup for troubleshooting.  I am opening a drawing with accoreconsole directly and running (load "C:\\rootC\\ACADbat\\renlayer.lsp") on the command line which gives me the error originally posted and the same when running Python.  So, I guess I'm stumped, accoreconsule is not ingesting the lisp.  I am stumped because it works for you and it works in vanilla AutoCAD GUI.

Thanks for helping troubleshoot.

Tyler

 

 

0 Likes
Message 12 of 15

townest
Advocate
Advocate

UPDATE:
I got it working.  This issue was the internal AutoCAD security (options>system>security).  Adding a trusted folder fixed the issue.

townest_0-1678501337701.png

HTH somebody else with the same issue.

 

Tyler

0 Likes
Message 13 of 15

paullimapa
Mentor
Mentor

Your OP stated: "I have a script that calls a lisp.  In vanilla AutoCAD GUI, the lisp has been debugged and fires fine, and then up one level the scr is fine also (runs and calls lisp without error)."

Odd that you didn't encounter a failure when you manually ran the script to load the lisp file in vanilla AutoCAD without that folder added under Trusted Location. AutoCAD command prompt would have responded with this message:

Command: Script
Command: (load "C:\\rootC\\ACADbat\\renlayer.lsp")
; error: File load canceled: C:/rootC/ACADbat/renlayer.lsp

 


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

townest
Advocate
Advocate

In the GUI, the warning dialogue did pop up to always load, but I didn't think much of it until later.  The GUI did not error, though.

0 Likes
Message 15 of 15

paullimapa
Mentor
Mentor

Yep, when the warning dialog appears & you select Always Load or Load Once then the lisp will load successfully.

Every little step makes a big difference in solving the puzzle.

 


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