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

Extension creation code

Scheduled Pinned Locked Moved Developers' Forum
2 Posts 2 Posters 433 Views 2 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
    sonjachr
    last edited by 31 Mar 2016, 07:51

    I have the following problem with the extension installation in Sketchup 2016:

    I use the following code to load my plugin:
    ` # Load the normal support files.
    require 'sketchup.rb'
    require 'extensions.rb'

    Create the extension.

    ext = SketchupExtension.new('pluginName', File.join('pluginFolder', 'pluginLoader.rb'))

    Attach some nice info.

    ext.creator = 'xxxxx'
    ext.version = '1.0.0'
    ext.copyright = '2016, xxxxxxxx'
    ext.description = 'xxxxxxxxxxxxxxxxxxx'

    ext.extension_path=File.join(File.dirname(FILE), "pluginFolder" )

    Register and load the extension on startup.

    Sketchup.register_extension(ext, true)`

    The Preferences/Extension Window then shows 2 entries for my plugin, one with the name of the pluginFolder and one with the pluginName. Only the entry with the pluginName shows also the plugin details.
    When I delete the ext.extension_path entry in the above code, everything seems to be OK.
    As I use the ext.extension_path in my loader file I need to fix this problem, which did not occur in previous Sketchup Versions.

    Help is very much appreciated

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 31 Mar 2016, 08:29

      You have omitted some code and added in other unneeded code.
      Try:
      ` # Load the normal support files.
      require 'sketchup.rb'
      require 'extensions.rb'

      Create the extension.

      ext = SketchupExtension.new('pluginName', File.join('pluginFolder', 'pluginLoader.rb'))

      # Optionally 'name' the Extension - it can differ from the registered name.
      ext.name = 'pluginName'

      Attach some nice info.

      ext.creator = 'xxxxx'
      ext.version = '1.0.0'
      ext.copyright = '2016, xxxxxxxx'
      ext.description = 'xxxxxxxxxxxxxxxxxxx'

      # This 'path' is NOT needed.
      ext.extension_path=File.join(File.dirname(FILE), "pluginFolder" )

      Register and load the extension on startup.

      Sketchup.register_extension(ext, true)`

      Add in the bold code and remove the struck-through code...

      TIG

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

      Advertisement