TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: snownut2 on June 30, 2013, 12:58:24 PM

Title: Forcing ACAD to finish operation prior to commencing new operation
Post by: snownut2 on June 30, 2013, 12:58:24 PM
I need to force ACAD to finish a Restore Layer state operation prior to commencing with the next operation.  Any simple way to accomplish this. I have tried to create a pausing affect by running a counter (no luck).

Thanks,
Title: Re: Forcing ACAD to finish operation prior to commencing new operation
Post by: irneb on July 01, 2013, 01:10:52 AM
 :-o ... you're running this in Lisp through the layerstate-restore function? Or are you using something else?

AFAIK all Lisp calls are synchronous, thus the next item will only happen once the 1st has completed. In VBA you sometimes find asynchronous behaviour.

If you mean you ran a loop checking the CDate at each interval, then exiting the loop once reaching a specified period - that's probably not going to work. The issue is the loop itself is using up all the CPU time slicing allowed for the thread, so nothing else can actually do any work. If you mean you used the WAIT command, I'm not too sure why you'd even need to accomplish this - shouldn't the restore have completed before a command is allowed to be started? Sorry, I don't know of another way to pause Lisp - not without some external help (like a DotNet / ARX).

Anyhow, if your layer list is so long that the restore takes a meaningful time, you might want to use some object modified reactors on the layer names. This is probably total overkill, and is probably going to slow down the process even more, so I'd not recommend it.

Could you possibly post some code, so we can more easily find out what the issue might be?

Edit: Ohhhhh! Just realized you're on BricsCAD! It probably does an asynchronous version of Lisp! Ouch!

If this is the case, then it might be a good idea for the BC guys to add a call-back function to use when such async operation has completed.
Title: Re: Forcing ACAD to finish operation prior to commencing new operation
Post by: Kerry on July 01, 2013, 01:29:00 AM
< ..> Just realized you're on BricsCAD! It probably does an asynchronous version of Lisp!

Do you have anything to back that up ??
Title: Re: Forcing ACAD to finish operation prior to commencing new operation
Post by: irneb on July 01, 2013, 01:32:06 AM
Do you have anything to back that up ??
No, only the OP's post.

Anyhow, async is a much more efficient thing than ACad's sync version of Lisp. It means any lisp function won't hog the UI-thread as it does in ACad. So my guess is that BC is using the more complex separate threadded model, though I have no proof of this - I'm grabbing at straws  :roll:
Title: Re: Forcing ACAD to finish operation prior to commencing new operation
Post by: Kerry on July 01, 2013, 01:40:43 AM
You're one of a few people I know who takes 20 lines and 3 paragraphs to say  " haven't got a clue " My grandfather called it 'verbal diarrhea' and that was before the internet. :-)

Title: Re: Forcing ACAD to finish operation prior to commencing new operation
Post by: irneb on July 01, 2013, 07:08:51 AM
You're one of a few people I know who takes 20 lines and 3 paragraphs to say  " haven't got a clue " My grandfather called it 'verbal diarrhea' and that was before the internet. :-)
:-P My motto ... always use 20 words or more ... no matter what!  :evil: So here goes the rest of my post for no other reason that to fill up those words.  :laugh:
Title: Re: Forcing ACAD to finish operation prior to commencing new operation
Post by: irneb on July 01, 2013, 07:10:19 AM
Jokes aside though, you do understand why the 2nd paragraph in that previous post?
Title: Re: Forcing ACAD to finish operation prior to commencing new operation
Post by: Kerry on July 01, 2013, 08:22:23 AM

I'd have just asked the OP how he was running the command and what he was running it on. :)

.. then gone for a beer and waited to see if the OP came back.