DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Progress Bar

Started by Garry K, January 09, 2013, 06:33:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prl

#30
Quote from: JJG on February 02, 2013, 07:45:36 AM
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,



JJG, use the below.  I released the form constraints.  You can resize as you wish dynamically.  Also, look at the *.ini file.  Controls last position and last size.

And as a bonus . . .  added a parameter to control the text on the form.  Everything before the ~ will go to the title.

As for stopping the program, you can kill it by clicking on the top right 'x', or selecting it from the windows status bar and right clicking and "close".   If DesignCAD crashes before you send the sys$(40) message to kill it, the DcBusyBar will stay up until you kill it manually.

Oh yes, it isn't an OLE, just a dumb executable I'm throwing up on the screen.   Also not a very sexy busy indicator. The Pbar and this one are just quickies of how one can do this.




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

sys$(40)="Don't rush me~"
for j = 1 to 1000000
    print i
next j

sys$(40)="I'm still going . . . .~"
for j = 1 to 1000000
    print i
next j

sys$(40)="Kill DcBusyBar"


.
.
.


JJG

Many thanks, Prl.

It's now perfect !
;)

JJG

Just one question :
Quote from: prl on February 02, 2013, 08:35:23 AM
...  You can resize as you wish dynamically.  Also, look at the *.ini file.  Controls last position and last size.
of which .ini-files are you talking about? DesignCAD those?

Because, effectively, if you resize the window in question "by hand", the new size is saved for next time you'll have to use it.

prl

Quote from: JJG on February 02, 2013, 11:45:18 AM
of which .ini-files are you talking about? DesignCAD those?

Look in the folder where you placed the DcBusyBar.exe.  The program saves and reads from the DcBusyBar.ini. 

JJG

Right! sorry, I had not seen!

great thanks again!
;)

JJG

Prl,

Again thank you very and so much for your DcBusyBar.exe, which is now so flexible to use.

Without wanting to abuse your kindness, can we still ask you to put the same functionality for the "PBar for dc.exe" (ie possibility to re-size as wish dynamically, also, a .ini_file for control of last position and last size, and parameter to control the text on the form with everything before the ~ to go to the title)

This would be so the ultimate !

prl

Quote from: JJG on February 03, 2013, 03:59:10 AM
same functionality for the "PBar for dc.exe"

JJG,  no problem.   Pbar2.zip is attached.

Be careful about how many messages you rapidly shoot at the clipboard.  It is possible to overload it.

I used it (the clipboard) as a quick and dirty windows system messaging service rather than coding a proper sendmessage routine.


JJG

Prl,

Again thank you very and so much !
;)

GooPie

I just downloaded DcBusyBar2.zip.
This is a great application !!!

prl you say :
And as a bonus . . .  added a parameter to control the text on the form.  Everything before the ~ will go to the title.

If I understand correctly, this is just be valid for macros including loops and has no effect with only native commands of Designcad ?

prl

#39
Quote from: GooPie on February 27, 2015, 01:39:55 AM
If I understand correctly, this is just be valid for macros including loops and has no effect with only native commands of Designcad ?

Yes just for macros and the application isn't perfect.  It is possible to have such a fast computer that the DcBusyBar.exe doesn't intercept the clipboard messages sys$(40) properly in which case you will have to close "kill" the status bar.

The general rule, in your macro, give it (the DcBusyBar.exe) some time to load into memory (maybe pop up a BasicCAD dialog where the user needs to click OK), then have your macro do something, then send the "kill" message.   If the routine isn't long enough and you have a fast computer, Windows (the operating system) may not fully load the executable before you send the "kill" message to the clipboard.  All about proper sequencing and timing.  It can get down to milliseconds.  Trying to intercept messages on a multithreading OS can get tricky.  Windows manages the "messages" queue.

GooPie

For now, I just need to know if the macro is running.
I don't need to displayed messages in DcBusyBar window.

So I guess he just launch the DcBusyBar executable at startup of macro
and kill it with sys$(40)="Kill DcBusyBar" at the end of macro.

And if I take the example code above, safely remove strikethrough lines :


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

sys$(40)="Don't rush me~"
for j = 1 to 1000000
    print i
next j

sys$(40)="I'm still going . . . .~"
for j = 1 to 1000000
    print i
next j

sys$(40)="Kill DcBusyBar"
---------------------------------------------------------------

Thank you I will probably have other questions, but for that I will open a new post.

prl

#41
Nobody has mentioned to me if the DcBusyBar is causing problems with the macro overrunning the loading of the executable, but technically I could recode it to make it an OLE which would give us the following option, specifically the halt/resume macro flag ,2:

.
.
.
Run "DcBusyBar.exe", 2

That would ensure the DcBusyBar is fully loaded before it issues a command back to DesignCAD telling it to resume the basiccad program that launched the DcBusyBar.exe.

Anyway, let me know if you encounter problems.

GooPie

Hello prl

I adapt the macro "l2h.d3m (line to hatches)" using your progress bar DcBusyBar2
However, there was something weird, the following microtext "Kill DcBusyBar" comes in coordinates 0.0
This is not a problem but I would understand why.  :o

'Program:  l2h.d3m (line to hatches)

SYS$(41) ="Layer Selection"
INPUT "Layer = ?",laynumber
IF SYS(999) = 1 THEN END

'load the DcBusyBar executable
run "DcBusyBar.exe"


>selectlayer
{
<Layer [laynumber]
}

'copy the selection set to the clipboard for paste routine
>sethandle
{
<type 0
<pointxyz [0,0,0]
}
>copy
{
}

sys(80)=0
tot = sys(9)
for i = 1 to tot
    getattr i, type, select, laynum, groupid, red, green, blue, solidid
    if laynum = laynumber then
       putattr i, 17, 1,laynumber
    endif
   
next i

'regen   

if sys(80) > 0 then
   precision 0
   count = sys(80)

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

   
Message count, "lines converted to hatching"
endif

>paste
{
<pointxyz [0,0,0]
}

>FitToWindow
{
  }


End

prl

Quote from: GooPie on February 27, 2015, 08:11:52 AM
However, there was something weird, the following microtext "Kill DcBusyBar" comes in coordinates 0.0
This is not a problem but I would understand why.  :o

Remember you saved all the lines to the clipboard (clipboard can only hold one thing at a time) and before you are pasting them back, you are overwriting the clipboard with the text "Kill DcBusyBar".  Move the kill DcBusyBar code, sys$(40), after the >paste.

GooPie

This seems now so obvious

:-[ :-[ :-[