Plugin to create a progress bar
-
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
-
Thanks, it was a path "/Plugins/ProgressBar/html" problem.
It works now ! -
Hey, i actually writing a plugin for SketchUp and implemented the progressbar. On windows this works fine and as expected, but now i tried to port this plugin for mac and the progressbar causes bugsplats. In my opinion the using of a second thread causes (the single threaded?) SketchUp to crash. Did anyone mentioned this before or has someone a workaround for this problem?
-
Are you using Ruby threads? Threads in Ruby 1.8 are green threads, meaning not native threads.
Can you elaborate on how you implemented a progressbar?
Advertisement