• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

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.
  • J Offline
    Jim
    last edited by 5 Jan 2013, 10:22

    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 5 Jan 2013, 11:40

      @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 5 Jan 2013, 12:09

        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 5 Jan 2013, 12:29

          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 5 Jan 2013, 13:39

            @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
            • C Offline
              Chris Fullmer
              last edited by 5 Jan 2013, 18:02

              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
              • T Offline
                thomthom
                last edited by 6 Jan 2013, 12:17

                @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 6 Jan 2013, 12:49

                  @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 30 Jan 2013, 22:29

                    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 7 Jul 2013, 09:47

                      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 7 Jul 2013, 16:40

                        @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 7 Jul 2013, 16:46

                          [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
                          • L Offline
                            LFloissac
                            last edited by 8 Jul 2013, 09:03

                            Thanks, it was a path "/Plugins/ProgressBar/html" problem.
                            It works now !

                            1 Reply Last reply Reply Quote 0
                            • H Offline
                              Hooch
                              last edited by 14 Aug 2013, 10:46

                              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?

                              1 Reply Last reply Reply Quote 0
                              • tt_suT Offline
                                tt_su
                                last edited by 14 Aug 2013, 23:26

                                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?

                                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