lib/to_openstudio/geometry/door.rb in honeybee-openstudio-2.28.0 vs lib/to_openstudio/geometry/door.rb in honeybee-openstudio-2.28.1
- old
+ new
@@ -152,6 +152,53 @@
end
return result
end
end # Door
+
+ def to_openstudio_shade(openstudio_model, shading_surface_group)
+ # get the vertices from the door
+ if @hash[:geometry][:vertices].nil?
+ hb_verts = @hash[:geometry][:boundary]
+ else
+ hb_verts = @hash[:geometry][:vertices]
+ end
+
+ # create the openstudio shading surface
+ os_vertices = OpenStudio::Point3dVector.new
+ hb_verts.each do |vertex|
+ os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
+ end
+ reordered_vertices = OpenStudio.reorderULC(os_vertices)
+
+ os_shading_surface = OpenStudio::Model::ShadingSurface.new(reordered_vertices, openstudio_model)
+ os_shading_surface.setName(@hash[:identifier])
+ unless @hash[:display_name].nil?
+ os_shading_surface.setDisplayName(@hash[:display_name])
+ end
+
+ # get the approriate construction id
+ construction_id = nil
+ if @hash[:properties][:energy][:construction]
+ construction_id = @hash[:properties][:energy][:construction]
+ elsif @hash[:is_glass] == true
+ construction_id = 'Generic Double Pane'
+ else
+ construction_id = 'Generic Exterior Door'
+ end
+
+ # assign the construction
+ unless construction_id.nil?
+ construction = openstudio_model.getConstructionByName(construction_id)
+ unless construction.empty?
+ os_construction = construction.get
+ os_shading_surface.setConstruction(os_construction)
+ end
+ end
+
+ # add the shade to the group
+ os_shading_surface.setShadingSurfaceGroup(shading_surface_group)
+
+ os_shading_surface
+ end
+
end # Honeybee