openstudiocore/ruby/openstudio/sketchup_plugin/user_scripts/Alter or Add Model Elements/Add_Shading_Controls.rb
def arguments(model)
    result = OpenStudio::Ruleset::OSArgumentVector.new

    choices = OpenStudio::StringVector.new
    
    model.getConstructions.each do |c|
      c.layers.each do |layer|
        if not layer.to_ShadingMaterial.empty?
          choices << ("Construction " + c.name.get)
          break
        end
      end
    end
    model.getShadingMaterials.each do |sm|
      choices << ("Material " + sm.name.get)
    end
    operation = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("operation", choices, false)
    operation.setDisplayName("Add Shading Control For")
    if not choices.empty?
      operation.setDefaultValue(choices[0])
    end
    result << operation
    
    return result
  end
# returns a vector of arguments, the runner will present these arguments to the user
# then pass in the results on run
returns a vector of arguments, the runner will present these arguments to the user
then pass in the results on run
returns a vector of arguments the runner will present these arguments to the user then pass in the results on run
def arguments(model)
    result = OpenStudio::Ruleset::OSArgumentVector.new
    choices = OpenStudio::StringVector.new
    model.getConstructions.each do |c|
      c.layers.each do |layer|
        if not layer.to_ShadingMaterial.empty?
          choices << ("Construction " + c.name.get)
          break
        end
      end
    end
    model.getShadingMaterials.each do |sm|
      choices << ("Material " + sm.name.get)
    end
    operation = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("operation", choices, false)
    operation.setDisplayName("Add Shading Control For")
    if not choices.empty?
      operation.setDefaultValue(choices[0])
    end
    result << operation
    return result
  end
def arguments ( model ) result = OpenStudio :: Ruleset :: OSArgumentVector . new choices = OpenStudio :: StringVector . new model . getConstructions . each do | c | c . layers . each do | layer | if not layer . to_ShadingMaterial . empty? choices << ( "Construction " + c . name . get ) break end end end model . getShadingMaterials . each do | sm | choices << ( "Material " + sm . name . get ) end operation = OpenStudio :: Ruleset :: OSArgument :: makeChoiceArgument ( "operation" , choices , false ) operation . setDisplayName ( "Add Shading Control For" ) if not choices . empty? operation . setDefaultValue ( choices [ 0 ] ) end result << operation return result end
returns a vector of arguments, the runner will present these arguments to the user
then pass in the results on run
returns a vector of arguments the runner will present these arguments to the user then pass in the results on run
model