Lisp Routines Stopped Working After AutoCAD 2023.1 Update

Lisp Routines Stopped Working After AutoCAD 2023.1 Update

bob_forsberg
Explorer Explorer
3,512 Views
11 Replies
Message 1 of 12

Lisp Routines Stopped Working After AutoCAD 2023.1 Update

bob_forsberg
Explorer
Explorer

We have two Lisp Routines that stopped working after applying the 2023.1 update.  Autodesk Support suggested we ask for help here as they "do not support Lisp".  

 

Has anyone else run into issues with the 2023.1 update?

 

I have attached the Lisp and a couple of required files.  Below are the instructions for installing and running the Lisp:

 

PAT_POINTS lisp routine

 

If you have a need to create insert/sleeve .csv files for the Hilti POS 150/180 Total Station or our new Trimble RTS Stations, we have a simplified lisp routine in AutoCAD that will do the job.  HydraCad for Revit also provides an RTS routine.

 

The following files must be accessible to use the routine in AutoCAD (add P:\CAD\LISP to your working support file search path in Options, OP):

P:\CAD\Lisp\pat_points.LSP  (it also needs to be apploaded into the drawing) and/or added to the Startup suite.)

P:\CAD\Lisp\pat_points.dcl

P:\CAD\Lisp\ph_hang.dwg

 

Once loaded, to run the lisp routine, the command is, “pat_points”.

These files are on the server.  The .dcl file is the menu dialogue that pops up.  The .dwg file is the block that it inserts for each numbered point.

0 Likes
Accepted solutions (1)
3,513 Views
11 Replies
Replies (11)
Message 2 of 12

paullimapa
Mentor
Mentor

I'm running 2023.1 update and it works fine for me.  Did you check to make sure under Options>Files>Support File Search Path still has P:\CAD\Lisp folder added?

paulli_apa_0-1658424793330.png

 


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

bob_forsberg
Explorer
Explorer

Paulli,

 

Yes, we have verified the Lisp routine is pathed correctly.   This issue is happening to another user in our office too, that is after applying the 2023.1 update the Lisp stopped working.

 

We have another Lisp that also is failing after the AutoCAD MEP 2023.1 update but I didn't upload it due to the limit on attachable files.  

 

As we were working through testing the Lisp to see where it fails, we found it is happening after the line of code:

 (command "._-layer" "_M" "H_POINTS" "")

where the Lisp is clearing any running O-Snaps.   The one command common to both lisp is AECBOSMODE.

 

Here is the error message we receive:

 

Current layer: "F-Note-Hidden"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]: _M
Enter name for new layer (becomes the current layer) <F-Note-Hidden>: H_POINTS Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]:
Command: ; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)

0 Likes
Message 4 of 12

paullimapa
Mentor
Mentor

Difference may be I'm not running MEP but just plain AutoCAD


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

ronjonp
Mentor
Mentor

@bob_forsberg 

Works for me too ( Vanilla 2023.1 ).

0 Likes
Message 6 of 12

paullimapa
Mentor
Mentor

since it's MEP, post there:

AutoCAD MEP Forum - Autodesk Community


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

cadffm
Consultant
Consultant

Hi,

2023.1? In the next days/weeks we will often see threads like that! Autodesk broke some things and rules, there is a bug

and some programs won't run.

(at time I have no details about the reason)

 

 

But your Program: it works for me  on AutoCAD 2023.1 (I disabled the AEC part for a well test in ACAD, not MEP)

 

Sebastian

0 Likes
Message 8 of 12

Sea-Haven
Mentor
Mentor

Maybe try Osmode rather than AECBOSMODE quick to test.

0 Likes
Message 9 of 12

bob_forsberg
Explorer
Explorer
Accepted solution

Looking for answers on this, I found this posting:

 

Solved: Re: Move Command Lisp specifying OSNAPS - Autodesk Community - AutoCAD MEP

 

There is a sub routine that adjust the value of AECBOSMODE in our LISP and the LISP in the link.  Our LISP used the command GETCNAME when checking to see if AECBOSMODE is a valid command while the other routine used the GETVAR to accomplish the same task.

 

Replacing our sub routine with the one we found, the LISP now works.  

0 Likes
Message 10 of 12

andkal
Collaborator
Collaborator

Hello

(getcname) and (getvar) are not exactly for the same task. Both definitions of this function use (getvar "Lastprompt") becouse it is the only way.
The difference is that the newer version uses also (getcname "Aecbosmode") -a cleaner way to check if the command exists. I add it to most of my programs so that the main program (where GET_AECBOSMODE is a subrutine) will work properly regardles of if the user is using Autocad MEP (where this variable is native) or other autocad version.

It is a pity that for some users after an update to 2023.1 some problems occured. Hope Autodesk does something. I ckecked it in A2023.1 + WIN 10 and it works for me.

So:
-If you use Autocad MEP then you can actually ommit checking of existance of this command and get the aecbosmode value directly.
-If you use f.e normal Autocad, then you can totally delete GET_AECBOSMODE function from your rutines becouse it will return nil.
-if you write an universal program for any autolisp supporting software, then I recommend implementing GET_AECBOSMODE routine. The new improved version below:

Hope it helps. Regards

 

 

 

;;; =================================================
;;;        GET_AECBOSMODE_v3_00.LSP      
;;;        Function gets AECBOSMODE value
;;; =================================================
(vl-load-com)
(defun GET_AECBOSMODE ( / AecbOM old_cmdecho998)
    (if (getcname "AECBOSMODE")
        (progn
            (setq old_cmdecho998 (getvar "CMDECHO"))
            (setvar "CMDECHO" 1);necessary to read last prompt with the current AECBOSMODE
            (command "AECBOSMODE" )
            (command);breaks command
            (setq AecbOM (getvar "lastprompt") ) ; returns fe. "Enter new value for AECBOSMODE <1023>:"
            (setvar "CMDECHO" old_cmdecho998);restoring cmdecho
            (atoi (substr AecbOM (+ (vl-string-search "<" AecbOM) 2) (- (vl-string-search ">" AecbOM) (vl-string-search "<" AecbOM) 1) ) )
        );progn
    );if
);defun
;;; =================================================
;|
;;;this line you put in your program to save AECBOSMODE before changing it 
    (setq old_aecbosmode (GET_AECBOSMODE) )

;;;this line you put in your program to change AECBOSMODE to f.e. 0
    (if old_aecbosmode    (command "AECBOSMODE" 0)  )

;;;this line you put in your program to restore the previous aecbosmode
    (if old_aecbosmode    (command "AECBOSMODE" old_aecbosmode)  )

;;;optionally - this line you put in your program in the error trapper to restore the previous aecbosmode
;;;checks if command-s is recognised to work with older autocad versions. Prevents error:  Cannot invoke (command) from *error*
    (if old_aecbosmode (if (not command-s)    (command "aecbosmode" old_aecbosmode)    (command-s "aecbosmode" old_aecbosmode) ) )
|;

 

 

 


• www.autolisps.blogspot.com - Productivity plugins for Autocad and Autocad MEP
• Autodesk AppStore
Message 11 of 12

cadffm
Consultant
Consultant

in 2023.1 the lisp function GETCNAME is broken

thy to @bergerF5EFQ 

Sebastian

0 Likes
Message 12 of 12

andkal
Collaborator
Collaborator

Thank you for letting me know. In such case the following version will do

 

;;; =================================================
;;;        GET_AECBOSMODE_v4_00.LSP      
;;; =================================================
(defun GET_AECBOSMODE ( / AecbOM old_cmdecho998)
    (setq old_cmdecho998 (getvar "CMDECHO"))
    (setvar "CMDECHO" 1);necessary to read last prompt with the urrent AECBOSMODE
    (command "AECBOSMODE" )
    (command);breaks command
    (setq AecbOM (getvar "lastprompt") ) ; returs fe. "Enter new value for AECBOSMODE <1023>:" or "Unknown command "AECBOSMODE""
    (setvar "CMDECHO" old_cmdecho998);restoring cmdecho
    (if (vl-string-search "<" AecbOM)
        (atoi (substr AecbOM (+ (vl-string-search "<" AecbOM) 2) (- (vl-string-search ">" AecbOM) (vl-string-search "<" AecbOM) 1) ) )
        nil
    );if
);defun

 


• www.autolisps.blogspot.com - Productivity plugins for Autocad and Autocad MEP
• Autodesk AppStore
0 Likes