Author Topic: Do anyone have this Grread problem when running it in a big loop while  (Read 244 times)

0 Members and 1 Guest are viewing this topic.

CatDance

  • Newt
  • Posts: 34
I have no problem when running Grread in a big loop-while on Autocad 2002 (yes I know it is 2002 almost 20 years old version).

But now when I run the same code on Acad ver 2007, after a while the Autocad game hangs (showing the mouse cursor of a wheel loading icon) ?

Do anyone have this problem before ?
you can't find great actors like these anymore these days cos these are legends. Very few of them.
https://www.youtube.com/watch?v=Jd10x8LiuBc

Lee Mac

  • Seagull
  • Posts: 12514
  • London, England
Re: Do anyone have this Grread problem when running it in a big loop while
« Reply #1 on: September 10, 2021, 01:55:47 PM »
Since AutoLISP evaluation is executed using the AutoCAD GUI processor thread, whilst the AutoLISP code is being evaluated, the AutoCAD application cannot communicate with the OS; and if the Windows OS does not receive any response from this thread within 5 seconds, the application is automatically marked as unresponsive and the cursor will display the processing donut icon.

The grread function (and, curiously, execution of the DELAY command) will temporarily return focus to the application thereby allowing communication with the host OS, and so I can only assume that more than 5 seconds elapse between successive calls to the grread function in your code when run within the 2007 environment.

CatDance

  • Newt
  • Posts: 34
Re: Do anyone have this Grread problem when running it in a big loop while
« Reply #2 on: September 11, 2021, 01:27:41 AM »
Since AutoLISP evaluation is executed using the AutoCAD GUI processor thread, whilst the AutoLISP code is being evaluated, the AutoCAD application cannot communicate with the OS; and if the Windows OS does not receive any response from this thread within 5 seconds, the application is automatically marked as unresponsive and the cursor will display the processing donut icon.

The grread function (and, curiously, execution of the DELAY command) will temporarily return focus to the application thereby allowing communication with the host OS, and so I can only assume that more than 5 seconds elapse between successive calls to the grread function in your code when run within the 2007 environment.

Hi Lee Mac,

wow ... this is deep. I have to read few times to understand it. I am not so good at this. Is there any way I can fix this ?
you can't find great actors like these anymore these days cos these are legends. Very few of them.
https://www.youtube.com/watch?v=Jd10x8LiuBc

CatDance

  • Newt
  • Posts: 34
Re: Do anyone have this Grread problem when running it in a big loop while
« Reply #3 on: September 11, 2021, 01:33:49 AM »
One question - you said

whilst the AutoLISP code is being evaluated, the AutoCAD application cannot communicate with the OS ...

Why can't my Acad application cannot communicate with the OS ??
you can't find great actors like these anymore these days cos these are legends. Very few of them.
https://www.youtube.com/watch?v=Jd10x8LiuBc

Crank

  • Swamp Rat
  • Posts: 1481
Re: Do anyone have this Grread problem when running it in a big loop while
« Reply #4 on: September 11, 2021, 08:38:18 AM »
[...]
The grread function (and, curiously, execution of the DELAY command) will temporarily return focus to the application thereby allowing communication with the host OS
[...]
This is interesting!

I also have several lisps with a spinning donut. So what's the fastest function that can be used to keep Acad active during a loop?
Vault Professional 2018     +     AEC Collection

Lee Mac

  • Seagull
  • Posts: 12514
  • London, England
Re: Do anyone have this Grread problem when running it in a big loop while
« Reply #5 on: September 11, 2021, 07:06:11 PM »
[...]
The grread function (and, curiously, execution of the DELAY command) will temporarily return focus to the application thereby allowing communication with the host OS
[...]
This is interesting!

I also have several lisps with a spinning donut. So what's the fastest function that can be used to keep Acad active during a loop?

The use of grread is the cleanest in my opinion, however this requires the user to move the mouse in order for evaluation to continue; otherwise, simply issue a call to the DELAY command - this has the same effect as a DoEvents call in VBA. Here's a related thread which might be of interest.

Crank

  • Swamp Rat
  • Posts: 1481
Re: Do anyone have this Grread problem when running it in a big loop while
« Reply #6 on: September 12, 2021, 05:02:14 AM »
Thx
After reading that topic, I think I'll try the DELAY command.
Vault Professional 2018     +     AEC Collection

CatDance

  • Newt
  • Posts: 34
Re: Do anyone have this Grread problem when running it in a big loop while
« Reply #7 on: September 12, 2021, 10:08:20 AM »


The grread function (and, curiously, execution of the DELAY command) will temporarily return focus to the application thereby allowing communication with the host OS ....

Can you give an example of the Delay command use ?

Oh sorry ... didn't see that . Now got it
it is ....
Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun foo ( n / x )
  3.     (setq x (getvar 'millisecs))
  4.     (while (< (- (getvar 'millisecs) x) n))
  5. )
  6. Code - Auto/Visual Lisp: [Select]
  7. (foo 2000) ;; no problem
  8. (foo 6000) ;; non-responsive for 1s
  9.  
  10.  
  11.  
« Last Edit: September 12, 2021, 10:27:59 AM by CatDance »
you can't find great actors like these anymore these days cos these are legends. Very few of them.
https://www.youtube.com/watch?v=Jd10x8LiuBc