sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Plugin to create a progress bar

    Scheduled Pinned Locked Moved Plugins
    23 Posts 12 Posters 4.4k Views 12 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      Squall290586
      last edited by Squall290586

      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/edit

      With 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:

      1 Reply Last reply Reply Quote 0
      • Dave RD Offline
        Dave R
        last edited by

        I don't know but it sounds like you've reinvented the wheel. Congratulations!

        Etaoin Shrdlu

        %

        (THERE'S NO PLACE LIKE)

        G28 X0.0 Y0.0 Z0.0

        M30

        %

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by

          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

          learn from the mistakes of others, you may not live long enough to make them all yourself...

          1 Reply Last reply Reply Quote 0
          • jeff hammondJ Offline
            jeff hammond
            last edited by

            @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)

            dotdotdot

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by

              @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

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 Reply Last reply Reply Quote 0
              • jeff hammondJ Offline
                jeff hammond
                last edited by

                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... 😳 😒

                dotdotdot

                1 Reply Last reply Reply Quote 0
                • S Offline
                  Squall290586
                  last edited by

                  @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

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    Squall290586
                    last edited by

                    @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 😄

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jim
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        Squall290586
                        last edited by

                        @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.

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          Squall290586
                          last edited by

                          I change the plugin, i create a new module with a new method.
                          The link is be updated (version 1.02)

                          1 Reply Last reply Reply Quote 0
                          • A Offline
                            Aerilius
                            last edited by

                            Hi,
                            we usually use an author module and then a module name of our choice ( Utils is a very generic word). Like

                            module Squall
                              module Utils
                              end
                            end
                            
                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              Squall290586
                              last edited by

                              @aerilius said:

                              Hi,
                              we usually use an author module and then a module name of our choice ( Utils is a very generic word). Like

                              module Squall
                              >   module Utils
                              >   end
                              > end
                              

                              Indeed, i change all my class and i prefixe all that by the module Squall.

                              1 Reply Last reply Reply Quote 0
                              • Chris FullmerC Offline
                                Chris Fullmer
                                last edited by

                                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.

                                Lately you've been tan, suspicious for the winter.
                                All my Plugins I've written

                                1 Reply Last reply Reply Quote 0
                                • thomthomT Offline
                                  thomthom
                                  last edited by

                                  @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/

                                  Thomas Thomassen — SketchUp Monkey & Coding addict
                                  List of my plugins and link to the CookieWare fund

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    Squall290586
                                    last edited by

                                    @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 😄.

                                    1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      Squall290586
                                      last edited by

                                      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.

                                      1 Reply Last reply Reply Quote 0
                                      • L Offline
                                        LFloissac
                                        last edited by

                                        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)
                                        };
                                        };

                                        1 Reply Last reply Reply Quote 0
                                        • G Offline
                                          glro
                                          last edited by

                                          @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

                                          1 Reply Last reply Reply Quote 0
                                          • G Offline
                                            glro
                                            last edited by

                                            [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

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement