Installing and Signing developed RBZ

Hi Im trying to install my plugin via the extension manager. I’ve tested my application by copy pasting the code on the plugins folder and it is working there and I could see it on the extension manager as unsigned since I didn’t signed it yet (also failing). What I did was I selected my main rb file and the whole folder then zipped it then renamed it as rbz. I’ve also tried downloading some sample apis from then zipped it but it still failing is there any reason why I can’t install or signed my plugin? Here’s my main rb file

require ‘sketchup.rb’
require ‘extensions.rb’

module Myapi
unless file_loaded?(FILE)
ex ='My API, ‘my_api/main’)
ex.description = ‘My API by me.’
ex.version = ‘0.0.0’
ex.copyright = ‘My API @ 2020’
ex.creator = ‘Me’
Sketchup.register_extension(ex, true)

Please learn to format code so it’s readable [use ` or ``` around it] and indent to make it readable…

You can miss out the first two ‘require’ lines as these now load before anything else anyway… but they so no harm !
You can miss out the unless file_loaded?(_FILE_) and file_loaded(_FILE_); end
You normally use those in the main code RB, when setting up any menu/toolbar entries - which does it just once - it prevents multiple entries when testing and reloading…

Your extension will always show as ‘unsigned’ in the Extension Manager, unless you actually get it signed by adding it to the EWH or use the portal to sign it yourself - you need to be a registered developer at the portal. Your RBZ should contain just the loader RB [which creates the extension as your example code] and a subfolder with the same name containing everything else - the main.RB, images html, css, js etc etc… I your example both would use the name ‘my_api’…
When signed the ‘signature’ file is added to that subfolder.
Start off here… Sign Extension | SketchUp Extension Warehouse - but you don’t need to worry about this yet ! You do not need to worry about getting the extension signed until you’ve finished its development.
Unsigned ones [or those with out of date signatures] will still load and work, provided that you set the Extension Manager > Loading Policy to ‘Unrestricted’…

Your extension isn’t failing because of it being ‘unsigned’.
We don’t know what your main.rb file does…

As a simple test just have it contain something simple, e.g.

module Myapi
  unless file_loaded?(_FILE_)"Plugins").add_item("Myapi"){self.do_something()}
  def self.do_something()
    UI.messagebox("Myapi does something - hooray !")

If it works then you know your extension is made properly and loading, and it’s calling the method[s] in the main.rb file to add the menu and ‘do_something’…

1 Like

Thanks for the reply. Will try it out currently my my_api/main.rb that kinda looks like this

require 'my_api/actions/process_square'
require 'sketchup.rb'

class Main
  attr_accessor :toolbar, :dialog

wherein process_square is tool class and @toolbar and @dialog is used for the global dialog_box and tool_box

You should keep your class etc within your own

module Myapi

Again, there’s no need for the require 'sketchup.rb'

You are jumping in at the deep-end of the pool, but are still learning to swim !

Get it working in small steps and add on as you prove each one is OK…

No matter how simple or convoluted your set up is, remember that to actually ‘do’ something you need to make a menu/toolbar item to at least set the process[es] running…
Your extension might well get set up but if its main.rb is not doing anything, then neither will your extension !

@marcosyu, please read …

Correction. This is the registrar file. (The file that registers the extension with SketchUp’s ExtensionManager.)

The loader is the file specified by the 2nd argument to the SketchupExtension class constructor.
(Ie, it is the file that gets loaded by the SketchupExtension#load private method, and in turn has the job of loading the rest of the extension’s files.)

Marco stressing that you need set Loading Policy as TIG describes to test unsigned extensions.

Marco, I know this is a test, but you should start off using good habits.

Each extension developer needs to “invent” a toplevel namespace module that is unique, Ie the company or author name.

Then within this namespace the developer will define numerous submodules, one for each extension that they create and perhaps some common library submodules and classes.

Absolutely no custom classes defined in Ruby’s toplevel ObjectSpace.
The one and only toplevel module you create should be a unique namespace module.

Both your registrar file and your extension subfolder must be uniquely prefixed

# encoding: UTF-8
# File: "MarcoSyu_MyApi.rb"

module MarcoSyu
  module MyApi

    ex ='MarcoSyu: My API', 'MarcoSyu_MyApi/main')
    ex.description = 'My API is a nifty extension that does nifty things.'
    ex.version   = '0.0.0'
    ex.copyright = '©2020, Marco Syu'
    ex.creator   = 'Marco Syu'

    Sketchup.register_extension(ex, true)


So you see (above) that the registrar file has the same name as it’s extension subfolder, … which is "MarcoSyu_MyApi" in the example.

You can choose some other unique namespace name, … a company, a tradename, etc., … whatever you desire as long as it does not infringe some other entity’s trademarks.

Then all your other extension files will look similar to the above. They each must be totally wrapped within the namespace module and extension submodule …

# encoding: UTF-8
# File: "MarcoSyu_MyApi/main"

module MarcoSyu
  module MyApi

    # Load other extension files ...
    Sketchup.require( File.join(__dir__,'actions/process_square') )
      # ... etc, etc ...
    Sketchup.require( File.join(__dir__,'ui') )


… and the (usually last to load) "ui.rb" file …

# encoding: UTF-8
# File: "MarcoSyu_MyApi/ui"

module MarcoSyu
  module MyApi

    # Load only once ...
    if !@loaded
      @loaded = true

      @options = { # hash of options }
      @dialog =
      @toolbar ="SomeName")
      # Define UI::Commands here ...
      # Define a submenu here ...
      # Add commands to menu items here ...
      # Add commands to toolbars here ...

    end # load once


There is no good reason for an extension to ever have any code evaluating outside it’s namespace module or extension submodule.

You have …

    attr_accessor :toolbar, :dialog

… which likely is unneeded. Your extension doesn’t need accessor methods to access these references. Accessors are for accessing from outside the module or class. Since your extension can directly access the @toolbar and @dialog references, there really is no cause for creating accessor methods.

1 Like

Thank you for the reply. It has been very helpful for me as it is my first time doing a plugin. I’ve tried updating my codes to follow your format but I still get a failure message when i try to install it as rbzas a last resort I’ve tried creating a simple plugin just showing some message box on load but I still failed. I’ve tried also signing my plugin just to see if there is some issue with my Sketchup Application but It also fails. I think I could solve my issue if I know what part of the code is returning an error but the error messages doesn’t show anything specific. Do you have some ideas on what are the things that the extension manager is checking when its uploading?

Upload your simple message box app here as an .rbz so we can see exactly what you’ve done.

Hi Thanks for the reply. Here’s my .rbz

MarcoSyu_MyApi.rbz (1.2 KB)

I had a bit of trouble opening the archive to look at it before installing it. When I renamed it to .zip, the Mac’s built in Archive Utility couldn’t open it, it kept converting to then to zip, then to .cpgz etc. The did open it though. If the Archive Utility had trouble with it, SketchUp might too. I don’t use Windows so can’t advise which zip tool to use.
When I tried via the Extension Manager, it failed:
em error

I re-zipped it for you, try this:

MarcoSyu_MyApi.rbz (4.1 KB)

That one worked for me, it installed via the Extensions Manager.


Thank you for the reply I downloaded 7zip and tried to zip it and it works! I’ve been using winrar for the zip file