Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

you could always run your code bit by bit in interactive ruby. Or save parts of it to a ruby script and run that from terminal. For interactive ruby, irb in the command terminal will take you into ruby. Then:

require 'openstudio'

# Helper to load a model in one line
def osload(path)
  translator = OpenStudio::OSVersion::VersionTranslator.new
  ospath = OpenStudio::Path.new(path)
  model = translator.loadModel(ospath)
  if model.empty?
      raise "Path '#{path}' is not a valid path to an OpenStudio Model.  Did you remember to use backlashes / instead of forward slashes \ ?"
  else
      model = model.get
  end  
  return model
end

load_path = "C:/Users/me/path/to/your/model/with/backslashes.osm"
model = osload(load_path)

and then do whatever modeling you want