First time here? Check our help page!
3

load custom scripts in Sketchup

OpenStudio v2.4.0 > Sketchup PlugIn

Appear to be having difficulty getting User Scripts to load in the Sketchup Plugin. The 'Load User Scripts' also doesn't appear to help in the matter. I have located the right directory, as my 'new folder' shows up in the drop down menus: Extensions > OpenStudio User Scripts > zCustom Scripts> ....then this is empty. Even If I copy/paste one of the preloaded user scripts into the folder. So, what am I missing here?

Second / follow on. It appears that the OS plug-in doesn't appear in my Roaming profile where all my other SU Extensions live. How does OS plug in know its to be loaded then? Is it possible to switch between versions of the OS SU plugin if this can be load/unloaded?

dradair's avatar
2.5k
dradair
asked 2018-09-13 15:33:50 -0500, updated 2018-09-13 15:34:58 -0500
edit flag offensive 0 remove flag close merge delete

Comments

@dradair I assume quitting and re-starting SketchUp didn't help either. I can't remember if "Load User Scripts" just re-load existing scripts or also loads new scripts.Also can you specify what version of SketchUp you are using and what operating system. Then I can try to duplicate what you are seeing.

David Goldwasser's avatar David Goldwasser (2018-09-13 20:19:08 -0500) edit

Sketchup 2017 Pro. restarting Sketchup allowed the new directory I created to show up, but the menu was empty. I have 2 scripts saved into that folder; one a copy of a script that comes with OS, another is a renamed copy of the script (just to test this). Is there some need/means to 'register' a measure within OpenStudio PlugIn/Sketchup? Or where should these scripts be saved/loaded for use in the plug in?

dradair's avatar dradair (2018-09-14 07:41:31 -0500) edit
add a comment see more comments

1 Answer

4

When you renamed the copied script, did you change the actual class name in the script? Try creating a new script with:

class Testscript < OpenStudio::Ruleset::ModelUserScript
  def name
    return "Test"
  end
end

Testscript.new.registerWithApplication

After a restart you should see it. I suspect you didn't before because the application had already loaded a script with the name in your copied files.

ericringold's avatar
10.6k
ericringold
answered 2018-09-14 10:22:24 -0500, updated 2018-09-14 10:22:57 -0500
edit flag offensive 0 remove flag delete link

Comments

@Eric Ringold gets a gold star. I had forgotten the: Testscript.new.registerWithApplication part.

follow on - I had found where my scripts were for my install ( C:\openstudio-2.4.0\SketchUpPlugin\openstudio\sketchup_plugin\user_scripts). Is this 'default'? is there a means to change where OS/SU looks for these scripts?

dradair's avatar dradair (2018-09-14 11:07:38 -0500) edit

You could try messing around hereabouts

ericringold's avatar ericringold (2018-09-14 11:22:58 -0500) edit
add a comment see more comments