Author Topic: Autolisp to add blocks - continuous update  (Read 2527 times)

0 Members and 1 Guest are viewing this topic.

TimAshby

  • Guest
Autolisp to add blocks - continuous update
« on: February 26, 2015, 02:18:54 PM »
I've got a lovely LISP which adds a bunch of dynamic blocks to a drawing ~250 or so. After tiling in 50 or so blocks, the screen stops updating & the 'donut of doom' shows. A while later, all is well, all the blocks that should be there are there.

In the interests of alleviating boredom & curiosity: is there a way to see each block being inserted & avoid seeing the donut? I've tried sticking regen & regenall at the end of a line of blocks - no joy.

Cheers!

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Autolisp to add blocks - continuous update
« Reply #1 on: February 26, 2015, 02:32:37 PM »
Can you post the code?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Autolisp to add blocks - continuous update
« Reply #2 on: February 26, 2015, 04:44:33 PM »
Since AutoLISP runs on the AutoCAD UI processor thread, any operation which takes longer than five seconds will cause Windows to render the AutoCAD application as unresponsive, since the Desktop Window Manager in Windows has not received any response from the AutoCAD UI thread in a five second period.

More information can be found here.

ChrisCarlson

  • Guest
Re: Autolisp to add blocks - continuous update
« Reply #3 on: February 27, 2015, 08:11:42 AM »
Why not just make a template file and keep the blocks in there, eliminating the need for the routine?

TimAshby

  • Guest
Re: Autolisp to add blocks - continuous update
« Reply #4 on: February 27, 2015, 10:00:01 AM »
The idea is to insert blocks at a location specified from a CSV (Thanks Lee for your code & website). The routine enables me to change the CSV & spam multiple block layouts. The real question is:- is there a way of 'waking' the Acad thread up, simulating user input, without having a (command "pause") at the end of every line - if that would even work?

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Autolisp to add blocks - continuous update
« Reply #5 on: February 27, 2015, 12:21:51 PM »
I also faced same problem once. It can be solved using following two options :-

Option 1 :

Use following code at end of every block insert :-

Code: [Select]

(vla-eval (vlax-get-acad-object) "DoEvents")

However, for this command to function, you must have VBA for AUTOCAD enabled. It can be downloaded and installed at following link :-

http://knowledge.autodesk.com/support/autocad/downloads/caas/downloads/content/download-the-microsoft-visual-basic-for-applications-module.html

Option 2 :

Use following code at start of every block insert :-

Code: [Select]
(setq cnt 1)
(repeat TotalBlocks
(acet-ui-status (strcat "Drawing Block No " (itoa cnt) " of " (itoa TotalBlocks)) "Status")
(setq cnt (1+ cnt))
.....
.....
Your code here
.....
.....
) ; end repeat
(acet-ui-status) ; closing the ACET window after completion of loop
« Last Edit: February 27, 2015, 12:27:47 PM by mailmaverick »

TimAshby

  • Guest
Re: Autolisp to add blocks - continuous update
« Reply #6 on: February 27, 2015, 12:57:00 PM »
Splendid! Thanks mailmaverick & all for your suggestions. The acet-ui-status works wonders.

Cheers!