Plugin to create a progress bar
-
Hi,
I apologize for my English .
I am french and my English is not very good.
Actually, i develop a plugin to make GCode for milling machine.It's not ready for the moment but despite searches I did not find progress bar for sketchup.
Suddenly I develop this and i think that be util for another .You can find this plugin on this link:
https://docs.google.com/folder/d/0B9Gb-sUls44ANW1JRkM5U2lveEU/editWith this plugin a new class andis available.
This class is "Squall::ProgressBar", she have 4 instance methods:-
initialize(max, title = "In progress", waitingMessages = [])
"max" is the maximum value of the progress bar
"title" is the title of the popup
"timeLeft" is the text display after the estimate seconds
"waitingMessages" is a array with an messages array, messages are displayed during the process -
process() {statement}
This method display the progress bar and execute the statement -
progress(i = 1)
This method update the advancement of the progress bar -
onCancel() {statement}
This method launch the statement if the progress bar is closed
This class have a static variable.
This variable is initialized to true if a progress bar is active.
The name of this is "Squall::ProgressBar.processing"If several progress bar are open in same time.
They will be executed one by one.And for finish, this is a little example:
pb = Squall;;ProgressBar.new(200); pb.onCancel() {puts "cancel"}; pb.process() { i = 0; loop{ pb.progress(); i += 1; break if(i == 200); sleep(0.5) }; };
If you have any problem with that, can you send me a message with the problem?
Thank in advance.
A little link on a video:
-
-
I don't know but it sounds like you've reinvented the wheel. Congratulations!
-
Hi
There are at least 2 other ProgressBar.rb's around and if both are installed they mess up loads of other scripts.
one's at smartmustard and the other came with 'VirtualWind' ruby package...
might be wise to triple check for name and method clashes before people download it???
even wdProgressBar would be better as it.s in a webdialog... I assume, as I haven't downloaded all the files, I'm not sure which I need.
welcome and goodluck with the gcode...
john
-
@driven said:
john
do you think it would possible to use osx's progress bar in sketchup? i see it everywhere else..
(borderline off topic, i know.. just something i've wandered about in the past)
-
@unknownuser said:
do you think it would possible to use osx's progress bar in sketchup? i see it everywhere else..
happy new year Jeff,
visually, you could use it with this, drop the system image path into the html, functionally, Sketchup dosen't even know how long it will take, so theres lots of extra checking back and forth to modify the prediction, a webDialog will add less overhead then a system audit would.Basicly, while they keep you entertained, progress bars 'in general', if asked "How Long Will This Take" should reply "longer, now that I'm involved"
john
-
hny to you too!
dunno, i'd rather stare at a cute little animation for 32 seconds than stare at a drawing for 30 seconds wondering if anything is happening.
or if someone was nerdy enough, they could probably come up with an algorithm which grabs your cpu stats then checks how many calculations the ruby is about to make then somewhat estimate the time it's going to take.
that should be able to happen fairly quickly?
[eDit]. well, wait... that's probably what a normal progress bar is doing anyway...
-
@dave r said:
I don't know but it sounds like you've reinvented the wheel. Congratulations!
Hi,
I test this class,
It's not a real progress bar it's just a update of sketchup status.
It open not a modal dialog -
@driven said:
Hi
There are at least 2 other ProgressBar.rb's around and if both are installed they mess up loads of other scripts.
one's at smartmustard and the other came with 'VirtualWind' ruby package...
might be wise to triple check for name and method clashes before people download it???
even wdProgressBar would be better as it.s in a webdialog... I assume, as I haven't downloaded all the files, I'm not sure which I need.
welcome and goodluck with the gcode...
john
Hi,
despite several search, i don't found the progress bar of virtual wind.
Now my progress bar is finish and functional -
Hello Voignier. Welcome to the forum and thank you for contributing to our community.
Every SketchUp plugin must share the same work space, which means plugins must not change the environment for other plugins. This means not using global variables, enclosing your code in a namespace, and not changing SketchUp's classes or modules.
Doing any of these will get the plugin banned from this forum. Thanks.
require 'sketchup.rb' module Sketchup def Sketchup.application_dir() Dir.chdir(Sketchup.template_dir) Dir.chdir("../../..") return Dir.getwd end end
-
@jim said:
Hello Voignier. Welcome to the forum and thank you for contributing to our community.
Every SketchUp plugin must share the same work space, which means plugins must not change the environment for other plugins. This means not using global variables, enclosing your code in a namespace, and not changing SketchUp's classes or modules.
Doing any of these will get the plugin banned from this forum. Thanks.
> require 'sketchup.rb' > > module Sketchup > def Sketchup.application_dir() > Dir.chdir(Sketchup.template_dir) > Dir.chdir("../../..") > return Dir.getwd > end > end >
Hi,
I change the module sketchup with a new method it's not an existant method.
It's very important?If yes, i will changed my plugin immediatelly.
-
I change the plugin, i create a new module with a new method.
The link is be updated (version 1.02) -
Hi,
we usually use an author module and then a module name of our choice (Utils
is a very generic word). Likemodule Squall module Utils end end
-
@aerilius said:
Hi,
we usually use an author module and then a module name of our choice (Utils
is a very generic word). Likemodule Squall > module Utils > end > end
Indeed, i change all my class and i prefixe all that by the module Squall.
-
One reason to not add methods to existing SketchUp space is because in the future, SketchUp itself might decide to add that same method. Then you'll be conflicting.
-
@squall290586 said:
I change the module sketchup with a new method it's not an existant method.
It's very important?I recommend you read this: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/
-
@thomthom said:
@squall290586 said:
I change the module sketchup with a new method it's not an existant method.
It's very important?I recommend you read this: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/
Thanks for this link, I will to read that carefully .
-
Hi,
A new version of my progress bar is available (Version 1.1).
After severals tests, I modify the generation of the web page using jQuery JS framework.And now, a processing management is available to execute the processes one by one.
-
Hi Gregory,
"Félicitations" (I'm French too) for your plugin.
I'm using SU Pro - 8.0.14346 and your plugin ProgressBar v1.29
I've tried to use your plugin and obtain the following message: "Run aborted. Error: progress_bar.rb:48:in `set_file': can't convert nil into String"
the code used to call the plugin is from your example (see above). Do you have a suggestion ?require 'progress_bar.rb'
pb = Squall::ProgressBar.new(200);
pb.onCancel() {puts "cancel"};
pb.process() {
i = 0;
loop{
pb.progress();
i += 1;
break if(i == 200);
sleep(0.5)
};
}; -
@lfloissac said:
Hi Gregory,
"Félicitations" (I'm French too) for your plugin.
I'm using SU Pro - 8.0.14346 and your plugin ProgressBar v1.29
I've tried to use your plugin and obtain the following message: "Run aborted. Error: progress_bar.rb:48:in `set_file': can't convert nil into String"
the code used to call the plugin is from your example (see above). Do you have a suggestion ?require 'progress_bar.rb'
pb = Squall::ProgressBar.new(200);
pb.onCancel() {puts "cancel"};
pb.process() {
i = 0;
loop{
pb.progress();
i += 1;
break if(i == 200);
sleep(0.5)
};
};line 48 of progress_bar.rb is
"@dialog.set_file(Sketchup.find_support_file("progressBar.html", "/Plugins/ProgressBar/html"))"maybe it is related to the "progressBar.html" file
I downloaded version 1.29 too, and the code works perfectly on my computer: a progress bar does appear on my screen
-
[quote="Squall290586"]
And for finish, this is a little example:
pb = Squall;;ProgressBar.new(200); pb.onCancel() {puts "cancel"}; pb.process() { i = 0; loop{ pb.progress(); i += 1; break if(i == 200); sleep(0.5) }; };
i just downloaded v 1.29, installed it, and typed the code above in a ruby editor; it works fine
I am not sure about how to use this plugin in a plugin of mine, though...
I guess that i have to type this code in mine, and adjust the increase of "i" parameter according to my process; it is correct?
or could you give a few words of explanation?
thank you
Advertisement