Author Topic: LISP sometimes not possible to kill with ESC...  (Read 7698 times)

0 Members and 1 Guest are viewing this topic.

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
LISP sometimes not possible to kill with ESC...
« on: May 04, 2020, 10:43:57 AM »
I have this question from title...
Very often in order to perform fast execution I don't open VLIDE and therefore, sometimes with ESC CAD can't be interuppted to break routine - my screen goes white - pale and I must terminate CAD... I want to set routine in the way it never comes to this... For example I have very extensive calculations to perform that will take very long time... So patial calculations can be stored in some global variable cumulative while routine works, but then I want to break it with ESC... If screen goes white, I have 2 options either to wait to finish and other one to close CAD... Both of these options are bad for me... I want ESC - BREAK, QUIT, EXIT routine and CAD remains active with my global variable with data stored all the way until ESC...
Is this possible with some kind of special error handler or something I don't know yet...
Thanks for reading, M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LISP sometimes not possible to kill with ESC...
« Reply #1 on: May 04, 2020, 11:03:22 AM »
Visual BASIC sports the DoEvents method which gives other processes an opportunity to execute. LISP doesn't. However, Lee tried using (command ".delay" 0) and found it kind of fakes same - at minimum it prevents or minimizes the ghosting; seemingly stalled appearance. I wrapped it in a defun and place it in any process intensive loops I execute, typically on a "perform every nth loop" basis. For what it's worth:

Code: [Select]
(defun _do-events ( / cmdecho )
    (setq cmdecho (getvar 'cmdecho))
    (setvar 'cmdecho 0)
    (gc) ;; hello jtoverka
    (repeat 2 (command ".delay" 0) (princ ""))
    (setvar 'cmdecho cmdecho)
    (princ)
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: LISP sometimes not possible to kill with ESC...
« Reply #2 on: May 04, 2020, 11:50:04 AM »
Thanks MP...
That's exactly what I was looking for...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LISP sometimes not possible to kill with ESC...
« Reply #3 on: May 04, 2020, 11:53:09 AM »
Thanks Lee / MP...
That's exactly what I was looking for...

YW!
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: LISP sometimes not possible to kill with ESC...
« Reply #4 on: May 04, 2020, 02:43:36 PM »
'Original' topic: https://www.theswamp.org/index.php?topic=50848.0

What is the reason for repeat?

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: LISP sometimes not possible to kill with ESC...
« Reply #5 on: May 04, 2020, 03:09:17 PM »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LISP sometimes not possible to kill with ESC...
« Reply #6 on: May 04, 2020, 03:36:28 PM »
What is the reason for repeat?

It’s a Jacqueline Susann thing.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: LISP sometimes not possible to kill with ESC...
« Reply #7 on: May 05, 2020, 12:48:26 AM »
To my newest testings, simple error handler is enough to force BREAK with ESC - i.e. "Function canceled" error...

I had to revise my code posted at cadtutor as this suggestion by MP dramatically slows loop calculations...

I only hope that I am right with error handler... Haven't still tested long enough, but it seems that ESC works as desired...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LISP sometimes not possible to kill with ESC...
« Reply #8 on: May 05, 2020, 01:07:11 AM »
... this suggestion by MP dramatically slows loop calculations ...

... typically on a "perform every nth loop" basis ...

e.g. (if (zerop (rem (setq i (1+ i)) 5000)) (_do-events))
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: LISP sometimes not possible to kill with ESC...
« Reply #9 on: May 05, 2020, 01:19:54 AM »
You are right MP... I've retested and white screen again appeared... But then again, I have to do testings for BricsCAD... For now it looks that white screen won't appear if there is error handler... Still I have to do intensive checking...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: LISP sometimes not possible to kill with ESC...
« Reply #10 on: May 05, 2020, 01:24:37 AM »
You are right MP... I've retested and white screen again appeared... But then again, I have to do testings for BricsCAD... For now it looks that white screen won't appear if there is error handler... Still I have to do intensive checking...

Sh** it appeared and in BricsCAD... I think I'll go now your way, just don't know if 5000 is correct number...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LISP sometimes not possible to kill with ESC...
« Reply #11 on: May 05, 2020, 01:59:29 AM »
... don't know if 5000 is correct number ...

There is no “one size fits all” number as it’s context and hardware dependent. Non exhaustive testing will reveal a practical value to use.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: LISP sometimes not possible to kill with ESC...
« Reply #12 on: May 05, 2020, 02:02:15 AM »
... don't know if 5000 is correct number ...

There is no “one size fits all” number as it’s context and hardware dependent. Non exhaustive testing will reveal a practical value to use.

I've finally revised my code at cadtutor and I hardcoded 5000, so what the hell (we don't know users PC specs...)...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LISP sometimes not possible to kill with ESC...
« Reply #13 on: May 05, 2020, 02:19:02 AM »
I've finally revised my code at cadtutor and I hardcoded 5000, so what the hell (we don't know users PC specs...)...

Find what works well on your machine (e.g. 5000) and then halve it (e.g. 2500), assuming the worst pc it will run on sports half the performance of yours ...
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: LISP sometimes not possible to kill with ESC...
« Reply #14 on: May 06, 2020, 10:05:18 AM »
When I run my LISP from BricsCAD, I get this error :

Code: [Select]
...Unknown Error in Lisp or CAD system or 'Stack Overflow'

What can I do?
In AutoCAD it works well, but I wanted faster computing and to compare results, i.e. *.pat files...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube