Register
 
DesignCAD 2019 and DesignCAD 3D Max 2019 now available for sale!
https://www.turbocad.com/designcad/ OR
https://www.imsidesign.com/products/designcad

Progress Bar
Read 11923 times
* January 13, 2013, 01:44:55 AM
#15
Looks like the Window doesn't stay displayed while macro runs.
The status bar works well enough

Logged


* January 13, 2013, 02:36:48 AM
#16
You can use the "silent mode" (ie sys(36)=1 or sys(36)=2 ) during some phases of calculations or drawing, and stop it (ie sys(36)=0 ) just before updating the progress statut in the dedicaced window (as dcadRob shows it), then turn sys(36) to 1 or 2 again, etc ... ,  in the macro code.
Normally, then, the progress-window remains visible and updates.

Logged


January 13, 2013, 06:08:08 AM
#17
The advantages of using a window rather than the status bar:
-bigger font
-stays on screen during entire macro whereas status bar text is replaced by other messages (like tool descriptions)

Logged


* January 13, 2013, 08:02:53 AM
#18
...
-stays on screen during entire macro whereas status bar text is replaced by other messages (like tool descriptions)

Not sure ...  and even certain that no.

If you are in super silent mode (ie sys(36)=2 ), or even "classical" silent mode only (ie sys(36)=1 ), the status bar don't show the messages like tool descriptions ; it just and only show the message corresponding to the Print statement, until this one will change.

Logged


January 13, 2013, 08:32:44 AM
#19
I don't know what kind of settings you have but it doesn't behave that way for me when I just set sys(36).

I just tried it on v22. Set sys(36)=2 at the beginning of a test macro. When I hover the mouse cursor over that left-hand tool buttons, the printed text is replaced by the tool description

Logged


January 13, 2013, 08:55:17 AM
#20
Garry,

Attached is a zip folder with a movie of how I would do it.  The modifications I made to your cabinets.d3m and source file (added total line count as first item) and progress bar executable are all in the file).  You can easily roll your own version of this approach.

Logged


* January 13, 2013, 09:10:38 AM
#21
dcadRob,

I have XP pro sp3.

OK, I understand what you mean and say : you are true : when moving the mouse cursor (during the execution of the macro) over that left-hand tool buttons, the printed text is replaced by the tool description, that's right ! I had thought you was speaking from the printed text of the commands (inside the macro) them-selves.

This is something to which I have not thought of, because while the macro runs, and also I see the progress bar in action, it would not come to me about going to move the cursor the mouse over that left-hand tool buttons of drawing commands ...
But this case can indeed be.

But with today's fast processors, loops in macros are executed very quickly, and this effect is imperceptible during the execution of the macro, because the Print_statement is updated often enough to keep the progress status "constantly" visible.

with the example I give here  http://forum.designcadcommunity.com/index.php?topic=4757.msg29952#msg29952   , you can test it and be convinced.

Logged


* January 13, 2013, 09:24:43 AM
#22
Prl,

Very interesting !
(although it is no longer only some macro language)

What software do you use for create the movie ?

Logged


January 13, 2013, 10:39:43 AM
#23
Very interesting !
(although it is no longer only some macro language)

What software do you use for create the movie ?

An old version of screen2exe v1.2 (circa 2007).  It makes very small files, good for folks that don't have high speed internet (like me).

Logged


* January 13, 2013, 10:44:03 AM
#24
prl

I like what you did - seems like a reasonable way to go.

BTW - you may have noticed that I did all the cabinet manipulation first - then created the first level blocks from the appropriate layer. Unfortunately try as I may - I could not get the the second level blocks to work - so I've stripped out the code for now.

Right now I am back into Ruby scripts - I am going to try to use the exact same data file with Ruby.  :-\

Logged


* February 02, 2013, 03:02:09 AM
#25
Another question :

It's no problem for me to run an .exe from a macro (eg. with the Run statement).

OK, but is there something to be able to stop it (the exe) running or to close it ?

Indeed, it could be usefull in such situation : the macro run an exe who will display a busy indicator-window at in the early stages of the macro (ie. such as this one that DcadRob proposes above, but which need inevitably a loop-type macro) during the macro process, and the macro itself stop or close this indicator before ending.

Does it already exists ?

Logged


February 02, 2013, 03:57:01 AM
#26
JJG,

For the sample pbar.exe, it intercepts clipboard text.  To close the pbar, see the statement in blue.


'Program: PbarDemo.d3m (demonstrate how to use progress bar)

'2/2/2013

'valid commands intercepted by the Pbar.exe via the clipboard

'  1 - 1% increment
'  5 - 5% increment
'  10 - 10% increment
'  25 - 25% increment
'  Kill PB - closes progress bar


count = 0
pinc = sys(9)/100 'you wish the progress bar to update every 1%

'load the progress bar executable
run "Pbar.exe"

for i = 1 to sys(9)
    count = count + 1
    if count >= pinc then 'update the progress bar
       sys$(40)="1" 'send a message to the progress bar with 1% update
       count = 0 'zero for next progress update
    end if
   
    'do something in your routine goes here, I added this to slow things down
    for j = 1 to 1000
        print i
    next j
   
next i

'you are finished with the loop, close the progress bar
sys$(40)="Kill PB"

End



The pbar.exe and demo macro are in the attached zip file.

Logged


* February 02, 2013, 04:42:52 AM
#27
Prl,

Thanks a lot, and I take my hat off to you !!!

But just one wish more :

In the above sample code, there is (of course) a loop, which allows you to increase the progress Bar. OK.

But in case you have some macro where there is no loop, ie executing only native commands of Designcad, but commands that could take a lot of time to be finished, could you provide us a "busy indicator"_exe (ie. a windows that shows that work is in progress, without counting the progress ratio), in order to be sure Designcad is working, and not as "not responding", during the macro execution ?
Of course with the same technique, consisting in intercepting the sys$(40)="Kill PB"

Thanks in advance !  (I'm not experimented enough for OLE)

 ;)

Logged


February 02, 2013, 06:14:59 AM
#28
But just one wish more :

JJG,

Here is a different version, called DcBusyBar.exe.

'Program: DcBusyDemo.d3m

'2/2/2013

'valid commands intercepted by the DcBusyBar.exe via the clipboard
'Kill DcBusyBar - closes the busy bar



'load the busy bar executable
run "DcBusyBar.exe"
 
'do something in your routine goes here, I added this to slow things down
for j = 1 to 10000
     print i
next j

'close the DcBusyBar
sys$(40)="Kill DcBusyBar"

End



Edit: removed the attached file.  A later version is attached  two posts down.


« Last Edit: February 02, 2013, 03:23:27 PM by prl »

Logged


* February 02, 2013, 07:45:36 AM
#29
Prl,

It work just Fine ! Many thanks !!!

Just if you could give the window the same dimensions as for the PbarDemo.d3m, so that the "DesignCADd at work"  could be full read,
or just write "Working ... "

And, so, in response to my question above, am I correct if I understand that there is no way to "kill" or stop a working executable other than via the clipboard ?

Logged