Jump to content

AutoCAD 2019 Keeps Locking Up When Using LISP


Bill Tillman

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)
)
;*====================================================================;

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...