Getting wait cursor after a few seconds, then progress bar not updating

Started by jmaeding, November 03, 2011, 03:01:30 PM

Previous topic - Next topic

jmaeding

I am on Civil 3D2009 (runs as 32 bit prog) in windows 7
64bit. I have a modal form that counts app ids in files in a loop.
It has a progress bar that tracks the progress.
If the operation takes more than a few seconds, I get the little circle that spins, and acad essentially freezes until the looping is done.
Is there a way to get the form to refresh once per loop?  I tried several things as the first statement inside my loop.
set focus, redraw, and anything that made sense in the object broswer.
Is this something everyone sees, or just my 2009/win 7 64 combination.
Any suggestions?
thx

Fred Tomke

Hi, yes I do know this. If you have luck, then dcl_Control_Redraw causes repainting the control, but there's no guarantee.
In the end you won't have any chance to solve this because your loop and your form seem to run in the same thread (Owen may correct me). And since Lisp does not allow multithreading you can't avoid this.

You can try the following:
Build a modeless form. Create a progress bar and a button on it. Let the button call the event asynchronously (by setting EventInvoke to AllowCommand) and excecute your counting from this event. I just want to know if there's a difference, because a running modal form "stops" AutoCAD for the time (dcl_form_show ...) is running.

And another thing: if you have 100.000 loops then you shouldn't call (dcl_control_setvalue oProgress (setq intCnt (1+ intCnt))) each time because it takes a recognizable amount of time.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

marcoheuer

hello,
the fundamental problem i'm just trying to solve here http://www.theswamp.org/index.php?topic=39931.0 and here http://ww3.cad.de/foren/ubb/Forum145/HTML/003518.shtml.
i use among other things modeless dialogs with progressbar (EventInvoke: AllowCommand). that also occurs the problem. it does not seem to lie at opendcl.

the problem seems to be, that is until autocad no feedback to the system as long as the lisp routine runs. when I break the program in the debugger and let continue to run it behaves autocad for some time normal (also progressbars).

best regards
marco

(sorry for my english)
Marco Heuer
Dipl. Ing.
www.arc-aachen.de
Airport Office

Fred Tomke

Hi, Marco, thanks for sharing your experiences. I can reproduce this behavior in my C# projects outside AutoCAD when I'm too lazy to create another thread for the time-expensive methods. So at least we have to live with it.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

marcoheuer

Marco Heuer
Dipl. Ing.
www.arc-aachen.de
Airport Office

jmaeding

ah, so the only answer is to sub out the task to a .net command.
That actually fits fine with me, as I am just finishing my set of functions in lisp and .net that serialize and deserialize a list/arraylist so I can pass strings back and forth in the resultbuffer.
Turns out 2009, at least, handles certain things in funcky ways, such as a list of three numbers.
I posted in the adesk groups on this and they confirmed it, so I have to resort to passing strings which are not "reinterpreted" by the .net list to resultbuffer translation the lispfunction mechanism performs.

Maybe I just expose my loop task function from my vlx so .net can start the loop, and call the lisp function, then do the progress report.  I am starting to mix lisp and .net a lot now, its awesome as you can take advantage of both sets of tools.

marcoheuer

hello,
is there possibility to call from c# a lisp function?
in the way:
- start function in c# with parameters lispfunctionname
- in this function start the lispfunction

and would this solve the problem?

best regards
marco
Marco Heuer
Dipl. Ing.
www.arc-aachen.de
Airport Office

Kerry


Marco,
I've answered your post at theSwamp

Although I enjoy .NET you don't need it in this case ... depending on your actual problem :)
Perfection is not optional.
My other home is TheSwamp

Fred Tomke

Hello,

interacting AutoLISP and C# works fine as long you don't send many data between C# and Lisp. In my experiences it takes a recognizable time for AutoCAD to send a large ResultBuffer (for instance of a list with dotted pairs) from .NET to Lisp.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]