Wierd bug of extension version

    VER = '1.0'
    e = SketchupExtension.new( 'ABC', './core.rb')
    e.version = VER 

set extension.version with a variable like this cause sketchup 23-24 drop loading the code without warning, anyone knows why ?

I cant test your case right now, but I noticed something else:

When you create a new SketchupExtension object, the path should be pointing to a file in a support folder (with the same name as root RB file, excluding the .rb extension).

In your example the core.rb suposed to be a same folder as the root rb.

I guess it should be something like:

e = SketchupExtension.new( 'ABC', 'abc/core.rb')

It is also recommended to omit the file extension provided in the path argument. (SketchUp will resolve the file extension to .rbe, .rbs or .rb), so it is better like this:

e = SketchupExtension.new( 'ABC', 'abc/core')
1 Like

Do not define constants in the top-level ObjectSpace. Define them within the extension submodule that must be wrapped inside your own namespace module.

Ie …

# Registrar File: "Plugins/ZhouSiFu_abc.rb"

module ZhouSiFu
  module ABC

    VERSION = '1.0.0'

    EXTENSION = SketchupExtension.new('ZhouSiFu: ABC', 'ZhouSiFu_abc/core')
    EXTENSION.version = VERSION
    # ... set other porperties ...

    Sketchup.register_extension(EXTENSION, true)

  end
end
# Loader File: "Plugins/ZhouSiFu_abc/core.rb"

module ZhouSiFu
  module ABC

   # ... core code, etc ...

  end
end

2 Likes