Jump to content
Bill Tillman

AutoCAD 2019 Keeps Locking Up When Using LISP

Recommended Posts

Bill Tillman

I have two almost identical Windows 10 Pro machines running ACAD 2019 Professional. I'm testing a LISP program about 250 lines long which works great. The trouble is about every 15 minutes of so, AutoCAD stops working. I can move the mouse. The computer and all other apps are still viable. But When I move the cursor back over to the AutoCAD model space and type something, nothing happens. If I press <Enter> the key stroke gets entered into the LISP IDE and I can see a new blank line in it. If I use the back space it will erase code, even though I placed the mouse in the command line of AutoCAD, not in the LISP IDE. The only way out of AutoCAD is to kill it with the Task Manager.

 

So I moved over to another computer and ran the code. It worked great. Upon the 2nd run, this machine's AutoCAD did the same thing. I can't post any of the code as it falls under an NDA I signed. So I'm probably just going to hack through this. But if this behavior sounds similar to anyone else's experience I'd be glad to hear about it.

 

BTW, the lisp code just does some simple commands to draw things. It changes layers often but runs fine otherwise.

Edited by Bill Tillman

Share this post


Link to post
Share on other sites
BIGAL

Do you havE 2 dwgs open have seen a situation where autocad thinks it’s in the other dwg click back to other dwg and control returns. Not sure how to fix just know it happens

Share this post


Link to post
Share on other sites
Bill Tillman

BIGAL, howdy down under...

 

Yes, I did have several drawings opened at the same time, in the same instance of AutoCAD. I did trace it down to the ErrorTrap.lsp program which I have been running since 2012. Never seen it act up like this. This computer is the one at my office and it locks up frequently so it was replaced today with an i7-8700 CPU and 32 GB RAM...woo hoo!  It smokes. I haven't been able to test the suspicious code yet. That's on the back burner now.

Share this post


Link to post
Share on other sites
Bill Tillman

I deployed the ErrorTrap code again and it took a while this time but it eventually went into that stunned delay pattern. ACAD just sits there for about 1-2 minutes. Sometimes it don't come back at all and I resort to Task Manager. And that's with this brand new system with Windows 10. Okay, so here's the code. I can only say this ran what I thought was great since 2012. There is a difference  between then and now. This code is loaded into another LISP program and it only gets called if there is an error. And in testing this program I confess I run it 20-30 times in a 10 minute period. So could loading it over and over again be the cause.


;-------------------------------------------------------------------------------------;
; ERROR TRAPPING ROUTINES                                                 10-12-2012  ;
;-------------------------------------------------------------------------------------;
(defun error()
(prompt "\nGlobal Error Trap Loaded")
(princ)
)
;*====================================================================;
(defun initerr ()
 (setq oldlayer (getvar "clayer"))
 (setq oldsnap (getvar "osmode"))
 (setq oldpick (getvar "pickbox"))
 (setq oldblip (getvar "blipmode"))
 (setq temperr *error*)
 (setq *error* trap)
 (princ)
)
;*====================================================================;
(defun trap (errmsg)
 (command nil nil nil)
 (if (not (member errmsg '("console break" "Function Cancelled")))
   (princ (strcat "\nError: " errmsg))
 )                 
 (setvar "clayer" oldlayer)
 (setvar "blipmode" oldblip)
 (setvar "menuecho" 0)
 (setvar "highlight" 1)
 (setvar "osmode" oldsnap)
 (setvar "pickbox" oldpick)
 (princ "\nError Resetting Enviroment ")
 (terpri)
 (setq *error* temperr)
 (princ)
)
;*====================================================================;
(defun reset ()
 (setq *error* temperr)
 (setvar "clayer" oldlayer)
 (setvar "blipmode" oldblip)
 (setvar "menuecho" 0)
 (setvar "highlight" 1)
 (setvar "osmode" oldsnap)
 (setvar "pickbox" oldpick)
 (setvar "CELTYPE" "ByLayer")
 (command "CELTSCALE" 1.00)
 (princ)
)
;*====================================================================;

 

Share this post


Link to post
Share on other sites
dlanorh

You are using (command ...) calls. Try changing command to (command-s ...)

Share this post


Link to post
Share on other sites
StevJ

In my 2014 Autocad, blipmode is no longer a valid variable.

Could it also be that Autocad 2019 doesn't know blipmode?

 

Steve

Share this post


Link to post
Share on other sites
Bill Tillman

Thanks everyone. I know that BLIPMODE variable still works in 2019. I don't have a use for it that I know of, but there are some older LISP codes I run which use it. And if those codes crash I'm sometimes stuck with little blips all over the place until I run (setvar 'BLIPMODE 0). As for the command vs command-s, again this is another change AutoDesk made which I don't fully understand. Most older lisp programs I run are fine with it. There is only the one line in this program with command in it. All my new code uses command-s. I'll make the change to my old ErrorTrap program and see if that fixes things.

Edited by Bill Tillman

Share this post


Link to post
Share on other sites
Steven P

Might be a simple thing but I have one that appears to get locked up and I suspect it is my bad coding leaving variables as global varables.. so when I use the same name again it all gets confused

Share this post


Link to post
Share on other sites
BIGAL

Bill to not load every time just do  (if (not AH:getval2)(load "getval2")) this will mean though the lisp is more a library call. AH:getval2 is defun name.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×