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

Revision history [back]

Use model.getShadingControls which will return an array of your shading controls.

Example: set all Shading Control's setpoint to 250:

model.getShadingControls.each do |sc|
   sc.setSetpoint(250)
end

Use model.getShadingControls which will return an array of your shading controls.

Example: set all Shading Control's setpoint to 250:

model.getShadingControls.each do |sc|
   sc.setSetpoint(250)
end

Note that this is true of all objects in the OS API. If you want to get all Constructions in the model: model.getConstructions, etc.

Use model.getShadingControls which will return an array of your shading controls.

Example: set all Shading Control's setpoint to 250:

model.getShadingControls.each do |sc|
   sc.setSetpoint(250)
end

Note that this is true of all objects in the OS API. If you want to get all Constructions in the model: model.getConstructions, etc.


Side note:

FYI, if you decompose your command call (always a good idea), you'll see that your problem is with ("ShadingControl".to_IddObjectType). This does work: model.getObjectsByType("OS_ShadingControl".to_IddObjectType) but it'll return an array of WorkspaceObject, that you'll have to cast to their actual object type (x.to_ShadingControl.get). Bottom line: use model.getShadingControls!

Use model.getShadingControls which will return an array of your shading controls.

Example: set all Shading Control's setpoint to 250:

model.getShadingControls.each do |sc|
   sc.setSetpoint(250)
end

Note that this is true of all objects in the OS API. If you want to get all Constructions in the model: model.getConstructions, etc.


Side note:

FYI, if you decompose your command call (always a good idea), you'll see that your problem is with ("ShadingControl".to_IddObjectType). This does work:

model.getObjectsByType("OS_ShadingControl".to_IddObjectType)model.getObjectsByType("OS_ShadingControl".to_IddObjectType)
 

but it'll return an array of WorkspaceObject, that you'll have to cast to their actual object type (x.to_ShadingControl.get). ).

Bottom line: use model.getShadingControls!