openstudiocore/sketchup_plugin/openstudio/sketchup_plugin/user_scripts/On Demand Template Generators/SpaceTypeAndConstructionSetWizard.rb
#define the arguments that the user will input
define the arguments that the user will input
define the arguments that the user will input
def arguments(model)
    args = OpenStudio::Ruleset::OSArgumentVector.new
    temp = File.read("#{File.dirname(__FILE__)}/resources/OpenStudio_Standards.json")
    standards = JSON.parse(temp)
    building_types = []
    templates = []
    climate_zones = []
    standards["space_types"].each_key do |template|
      templates << template
      standards["space_types"][template].each_key do |climate_zone_set|
        standards["space_types"][template][climate_zone_set].each_key do |building_type|
          building_types << building_type
        end
      end
    end
    standards["construction_sets"].each_key do |template|
      templates << template
      standards["space_types"][template].each_key do |climate_zone|
        standards["space_types"][template][climate_zone].each_key do |building_type|
          building_types << building_type
        end
      end
    end
    standards["climate_zones"].each_key do |climate_zone|
      next if climate_zone.include? "CEC"
      climate_zones << climate_zone
    end
    building_types.uniq!
    templates.uniq!
    climate_zones.uniq!
    buildingType = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("buildingType", building_types, true)
    buildingType.setDisplayName("Building Type")
    buildingType.setDefaultValue("Office")
    args << buildingType
    template = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("template", templates, true) 
    template.setDisplayName("Template")
    template.setDefaultValue("189.1-2009")
    args << template
    climateZone = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("climateZone", climate_zones, true)
    climateZone.setDisplayName("ASHRAE Climate Zone")
    climateZone.setDefaultValue("ASHRAE 169-2006-5B")
    args << climateZone
    createSpaceTypes = OpenStudio::Ruleset::OSArgument::makeBoolArgument("createSpaceTypes",true)
    createSpaceTypes.setDisplayName("Create Space Types?")
    createSpaceTypes.setDefaultValue(true)
    args << createSpaceTypes
    createConstructionSet = OpenStudio::Ruleset::OSArgument::makeBoolArgument("createConstructionSet",true)
    createConstructionSet.setDisplayName("Create Construction Set?")
    createConstructionSet.setDefaultValue(true)
    args << createConstructionSet
    setBuildingDefaults = OpenStudio::Ruleset::OSArgument::makeBoolArgument("setBuildingDefaults",true)
    setBuildingDefaults.setDisplayName("Set Building Defaults Using New Objects?")
    setBuildingDefaults.setDefaultValue(true)
    args << setBuildingDefaults
    return args
  end
def arguments ( model ) args = OpenStudio :: Ruleset :: OSArgumentVector . new temp = File . read ( "#{File.dirname(__FILE__)}/resources/OpenStudio_Standards.json" ) standards = JSON . parse ( temp ) building_types = [ ] templates = [ ] climate_zones = [ ] standards [ "space_types" ] . each_key do | template | templates << template standards [ "space_types" ] [ template ] . each_key do | climate_zone_set | standards [ "space_types" ] [ template ] [ climate_zone_set ] . each_key do | building_type | building_types << building_type end end end standards [ "construction_sets" ] . each_key do | template | templates << template standards [ "space_types" ] [ template ] . each_key do | climate_zone | standards [ "space_types" ] [ template ] [ climate_zone ] . each_key do | building_type | building_types << building_type end end end standards [ "climate_zones" ] . each_key do | climate_zone | next if climate_zone . include? "CEC" climate_zones << climate_zone end building_types . uniq! templates . uniq! climate_zones . uniq! buildingType = OpenStudio :: Ruleset :: OSArgument :: makeChoiceArgument ( "buildingType" , building_types , true ) buildingType . setDisplayName ( "Building Type" ) buildingType . setDefaultValue ( "Office" ) args << buildingType template = OpenStudio :: Ruleset :: OSArgument :: makeChoiceArgument ( "template" , templates , true ) template . setDisplayName ( "Template" ) template . setDefaultValue ( "189.1-2009" ) args << template climateZone = OpenStudio :: Ruleset :: OSArgument :: makeChoiceArgument ( "climateZone" , climate_zones , true ) climateZone . setDisplayName ( "ASHRAE Climate Zone" ) climateZone . setDefaultValue ( "ASHRAE 169-2006-5B" ) args << climateZone createSpaceTypes = OpenStudio :: Ruleset :: OSArgument :: makeBoolArgument ( "createSpaceTypes" , true ) createSpaceTypes . setDisplayName ( "Create Space Types?" ) createSpaceTypes . setDefaultValue ( true ) args << createSpaceTypes createConstructionSet = OpenStudio :: Ruleset :: OSArgument :: makeBoolArgument ( "createConstructionSet" , true ) createConstructionSet . setDisplayName ( "Create Construction Set?" ) createConstructionSet . setDefaultValue ( true ) args << createConstructionSet setBuildingDefaults = OpenStudio :: Ruleset :: OSArgument :: makeBoolArgument ( "setBuildingDefaults" , true ) setBuildingDefaults . setDisplayName ( "Set Building Defaults Using New Objects?" ) setBuildingDefaults . setDefaultValue ( true ) args << setBuildingDefaults return args end
define the arguments that the user will input
define the arguments that the user will input
# load the JSON standards file #make an argument for building type #make an argument for vintage # vintage or standard for building #make an argument for climate zone #make an argument to add new space types #make an argument to add new construction set #make an argument to determine if building defaults should be set #todo - let user choose specific construction type for exterior wall, roof, slab, and interior floors
model
<not_specific>