sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Extension creation code

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 445 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

      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
      • TIGT Offline
        TIG Moderator
        last edited by

        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
        • First post
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement