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

    Extension rbz maker

    Scheduled Pinned Locked Moved Developers' Forum
    38 Posts 7 Posters 4.1k Views 7 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.
    • D Offline
      driven
      last edited by

      1: open "Ruby Console"
      2: paste in this

      Gem.install "rubyzip"
      

      and enter...
      3: if no errors paste in this

      require("zip")
      #EDIT; had rubyzip
      

      and enter...
      4: if no errors, try this plugin...

      or report back...

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

      1 Reply Last reply Reply Quote 0
      • TNTDAVIDT Offline
        TNTDAVID
        last edited by

        thank you

        require ('zip') worked well

        I can now run Extension RBZ maker !

        My plugin does not contain files Skb but SKP.

        I noticed that the ruby script codes are protected but not the components used by my Plugin.

        Is there a way to protect the SKP files ?

        [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

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

          @tntdavid said:

          My plugin does not contain files Skb but SKP.

          your image above shows both in the folder

          @tntdavid said:

          Is there a way to protect the SKP files ?
          No, even if there was, once it's in the model people can do anything they want...

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

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @tntdavid said:

            I downloaded the file rubyzip2-2.0.2.gem

            Do not use that. It is actually an older code fork than just plain rubyzip v1.1.6.

            (Not sure why the author left it up on rubygems.org. It is a kind of beta version for Ruby higher than 1.8, but was abandoned. The original v1 code trunk was fixed to run in 1.9+ Ruby.)

            I'm not here much anymore.

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

              @dan what's happening with require 'rubyzip' v require 'zip' ?

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

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                @driven said:

                @dan what's happening with require 'rubyzip' v require 'zip' ?

                The RubyGems extension modifies the global require() method so that it can load gems (and push their paths into $LOAD_PATH,) and if need be, install them first from whatever gem servers are registered. (By default only rubygems.org is registered.)
                So [important], this: require 'rubyzip', is actually saying "require the gem named 'rubyzip'", not "require the file named 'rubyzip.rb'".

                Once the gem library is installed and loaded, it can be used as it normally would, had it been a standard extension, in Ruby's library.
                Hence, the require("zip") which actually makes sure that the
                "#{ENV['GEM_PATH']}/gems/rubyzip-v1.1.6/lib/zip.rb" file is loaded.
                This works because the override of the global require(), by the RubyGems extension, has push the rubyzip lib into the $LOAD_PATH array. Ie:
                "#{ENV['GEM_PATH']}/gems/rubyzip-v1.1.6/lib/"

                But I like to wrap in begin. .. rescue, just in case.

                I'm not here much anymore.

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

                  cheers dan,
                  another ?
                  in your example code wont require 'rubyzip' always fail, even when require 'zip' returns true?

                  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
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    @driven said:

                    in your example code wont require 'rubyzip' always fail, even when require 'zip' returns true?

                    Hmmm.. OH I see.. even though, given the following:
                    Ref:

                    @unknownuser said:

                    When RubyGems is required, Kernel#require is replaced with our own which

                    is capable of loading gems on demand.

                    When you call require 'x', this is what happens:

                    * If the file can be loaded from the existing Ruby loadpath, it is.

                    * Otherwise, installed gems are searched for a file that matches.

                    If it's found in gem 'y', that gem is activated (added to the

                    loadpath).

                    The normal require functionality of returning false if

                    that file has already been loaded is preserved.

                    Something I overlooked was, that in most gems, the gem "name" is the same as the gem loader script name.

                    But in this gem, the name is "rubyzip", but the loader script name is "zip.rb".

                    So what the overridden require does is, look for a loader script named "rubyzip.rb" and it will NEVER find it, so a LoadError exception will be raised, always, even if the gem is already installed, and even if it is already loaded.

                    And then my rescue LoadError clause will be fired.

                    This doesn't hurt the first time, as if SketchUp is started normally and Rubygems is loaded and working.. the "rubyzip" gem will get installed and/or initialized by my LoadError clause.

                    OK I need to change things a bit. I used to have a bail out " return true if defined?(Zip)" as the first line, removed it when I tried to load the "zip/filesystem" extension in the same methoid. I moved that to it's own method, so I'll put the short-circuit return line back in.

                    Then I may need a different basic test other than require("rubyzip").
                    I am not actually using the return value of require("rubyzip") to make any boolean decisions.
                    Perhaps just require("zip") ?

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • P Offline
                      pgarmyn
                      last edited by

                      @tntdavid said:

                      I want to blur my fichiers.rb to protect my work, so I downloaded the Plugin BGSketchup_RBZ_maker v1.0.1.rbz

                      RBZ-files are not intended to protect code. Any unzip program can be used the convert them back to the original files.
                      Only the scrambler will give limited protection.

                      1 Reply Last reply Reply Quote 0
                      • TNTDAVIDT Offline
                        TNTDAVID
                        last edited by

                        pgarmyn

                        I can assure you that RBZ maker convert my file "rb" in "rbs" !

                        Although the RBZ file can be decompressed the code is protected 👍

                        driven

                        You're right for the skb! This is fixed now 😉

                        [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

                        1 Reply Last reply Reply Quote 0
                        • TNTDAVIDT Offline
                          TNTDAVID
                          last edited by

                          I just noticed a very annoying problem !

                          RBZ maker produces non-compatible files rbs with Sketchup 8 😞
                          I think many users are still under licenses "Sketchup 8" and wishes propose a PLUGIN which works for a maximum of users.

                          Is there an alternative to produce rbs files ?

                          [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

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

                            what's the error message on v8 say?

                            I'd be surprised if the .rbs is unusable, does it run as a .rb on the same machine?

                            have DC's been enabled on that machine?

                            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
                            • Dan RathbunD Offline
                              Dan Rathbun
                              last edited by

                              Make sure your files are UTF-8 Encoded Without BOM.

                              I'm not here much anymore.

                              1 Reply Last reply Reply Quote 0
                              • TNTDAVIDT Offline
                                TNTDAVID
                                last edited by

                                There is no error message the launch of Sketchup !

                                Error 01: The toolbar will no longer display the images on the icons.

                                Error 02: The relationship between icons and components is lost.

                                [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

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

                                  are you still using

                                   path_to_components = File.join(File.dirname(__FILE__), 'Components')
                                  

                                  I'm unsure if that works from inside a rbs, I remember there was some problem with it...

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

                                  1 Reply Last reply Reply Quote 0
                                  • TNTDAVIDT Offline
                                    TNTDAVID
                                    last edited by

                                    Yes ! So how can I do otherwise ? 😲

                                    [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

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

                                      @tntdavid said:

                                      Yes ! So how can I do otherwise ? :shock:

                                      It's hard without knowing your folder structure...
                                      once installed from rbz
                                      you should have a plain 'extension' .rb file and a same name folder...
                                      inside the folder you should have a plain .rb 'loader' file
                                      that loads the .rbs file
                                      plus any other folders...

                                      is that how it is set up?
                                      post a screen shot of the folder structure...

                                      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
                                      • TNTDAVIDT Offline
                                        TNTDAVID
                                        last edited by

                                        ClickChange

                                        --------ClickChange_logic.rb
                                        --------Components
                                        ----------------01-DOOR.skp
                                        ----------------02-WINDOWS.skp
                                        ----------------03-GRIPS.skp
                                        ----------------04-TAPS.skp
                                        ----------------05-ELECTRICAL HOBS.skp
                                        ----------------06-GAS HOBS.skp
                                        ----------------07-EXTRACTOR.skp
                                        ----------------08-WALL PANEL.skp
                                        ----------------09-FRUITS.skp
                                        ----------------10-FLOWERS.skp
                                        --------Resources
                                        ----------------add_01.png
                                        ----------------add_02.png
                                        ----------------add_03.png
                                        ----------------add_04.png
                                        ----------------add_05.png
                                        ----------------add_06.png
                                        ----------------add_07.png
                                        ----------------add_08.png
                                        ----------------add_09.png
                                        ----------------add_10.png
                                        ----------------add_11.png

                                        ClickChange.rb

                                        [b:8wt9py2i]* Nouveau !!![/b:8wt9py2i] Découvrez notre nouveau Plugin [url=http://www.composant-dynamique.com/:8wt9py2i][color=#40FF00:8wt9py2i]C[/color:8wt9py2i][color=#77FF00:8wt9py2i]l[/color:8wt9py2i][color=#ADFF00:8wt9py2i]i[/color:8wt9py2i][color=#E4FF00:8wt9py2i]c[/color:8wt9py2i][color=#FFDB09:8wt9py2i]k[/color:8wt9py2i][color=#FF921B:8wt9py2i]-[/color:8wt9py2i][color=#FF492E:8wt9py2i]C[/color:8wt9py2i][color=#FF0040:8wt9py2i]u[/color:8wt9py2i][color=#ED2577:8wt9py2i]i[/color:8wt9py2i][color=#DA49AD:8wt9py2i]s[/color:8wt9py2i][color=#C86EE4:8wt9py2i]i[/color:8wt9py2i][color=#AD77FF:8wt9py2i]n[/color:8wt9py2i][color=#8965FF:8wt9py2i]e[/color:8wt9py2i] [color=#4040FF:8wt9py2i]2[/color:8wt9py2i][/url:8wt9py2i], pour créer vos cuisines 3D !

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

                                          @tntdavid said:

                                          ClickChange
                                          > --------ClickChange_logic.rb
                                          > ....etc
                                          

                                          is this now the rbs that's failing?
                                          if so you need another .rb

                                          ClickChange
                                          --------ClickChange_loader.rb
                                          --------ClickChange_logic.rbs
                                          ....etc
                                          
                                          

                                          the minimum ClickChange_loader.rb needs to do is require('ClickChange_logic'), but it may be a little more involved than that...

                                          I never encrypt any files, so this is from remembering other threads...

                                          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
                                          • Dan RathbunD Offline
                                            Dan Rathbun
                                            last edited by

                                            (1) You need to use author namespace and file/folder prefix.
                                            [Assuming the Ruby namespace TNT has not been used by anyone else...]
                                            ie (in "Plugins" folder): [pre:2sn8ckc3]TNT_ClickChange.rb
                                            TNT_ClickChange/ClickChange_loader.rb
                                            TNT_ClickChange/ClickChange_logic.rbs
                                            TNT_ClickChange/Components
                                            TNT_ClickChange/Resources
                                            [/pre:2sn8ckc3]

                                            (2) Then the %(#400080)[Plugins/TNT_ClickChange.rb] file:

                                            <span class="syntaxdefault"></span><span class="syntaxcomment"># encoding; UTF-8<br /></span><span class="syntaxkeyword">require(</span><span class="syntaxstring">"extensions"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">module TNT<br />  module ClickChange<br /><br />    VERSION </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">"1.0.0"<br /><br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">extension </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> SketchupExtension</span><span class="syntaxkeyword">;;new(<br /></span><span class="syntaxdefault">      </span><span class="syntaxstring">"ClickChange"</span><span class="syntaxkeyword">,<br /></span><span class="syntaxdefault">      </span><span class="syntaxstring">"TNT_ClickChange/ClickChange_loader.rb"<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">)<br /><br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">extension</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">description </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">"ClickChange is a great plugin for ..."<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">extension</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">version </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> VERSION<br />    </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">extension</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">creator </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">"TNT David"<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">extension</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">copyright </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">"©2014 by www.composant-dynamique.com"<br /><br /></span><span class="syntaxdefault">    def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">extension</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault">      </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">extension<br />    end<br /><br />    Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">register_extension</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">extension</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> true </span><span class="syntaxkeyword">)<br /><br /></span><span class="syntaxdefault">  end<br />end<br /></span>
                                            

                                            (3) Then the %(#400080)[TNT_ClickChange/ClickChange_loader.rb] file:

                                            <span class="syntaxdefault"></span><span class="syntaxcomment"># encoding; UTF-8<br /></span><span class="syntaxdefault">module TNT<br />  module ClickChange<br /><br />    DIR_ABS </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">dirname</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">__File__</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    DIR_REL </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> DIR_ABS</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">split</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'/'</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">last<br /><br />    Sketchup</span><span class="syntaxkeyword">;;require(</span><span class="syntaxstring">"ClickChange_logic.rbs"</span><span class="syntaxkeyword">)<br /><br /></span><span class="syntaxdefault">  end<br />end<br /></span>
                                            

                                            (4) Your %(#400080)[TNT_ClickChange/ClickChange_logic.rbs] file needs to be defined inside the nested TNT::ClickChange namespace, and use the local constants DIR_ABS and DIR_REL.

                                            🤓

                                            I'm not here much anymore.

                                            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