SU development workflow / environment

You need to download the debugger DLL and place it in SketchUp’s binary folder.

I’ve already created lists of links here in this category. (You are reinventing the wheel.)

If you write your code as extensions, then you can switch them ON and OFF via the Extension Manager interface.


Each of your extensions will need to be separated from one another, so this is a closer example …

module NN_MyOwnUniqueNamespace
  module HelloWorld

    # Use instance variables inside modules instead of global variables.
    @my_variable = 'Hi there! :)'

    def self.hello_world
      puts @my_variable
    end

    unless defined?(@loaded)
      menu = UI.menu( 'Plugins' )
      menu.add_item( 'Hello World' ) { self.hello_world }
      @loaded = true
    end

  end # extension submodule
end # top level namespace

You do not need to require "sketchup.rb" unless your code uses what that file defines.
(Also, since SU2014 it is loaded by SketchUp before any of the extensions in the “Plugins” folder ever get evaluated.)

Many of us recommend using a local module @loaded var to determine whether to load UI elements, rather than the slow and clunky file_loaded() and file_loaded?() methods defined in "sketchup.rb".
(String comparison is slow in Ruby, and those methods use a global shared array in which simple file names might clash. Long absolute pathnames are going to slow the startup cycle.)

Anyway, there is nothing in that file, that you cannot code better and faster, private alternatives to.

1 Like