Class: Honeybee::ShadeMesh
- Inherits:
-
ModelObject
- Object
- ModelObject
- Honeybee::ShadeMesh
- Defined in:
- lib/honeybee/geometry/shademesh.rb,
lib/to_openstudio/geometry/shademesh.rb
Instance Attribute Summary
Attributes inherited from ModelObject
#errors, #openstudio_object, #warnings
Instance Method Summary collapse
Methods inherited from ModelObject
#allowable_types, clean_identifier, clean_name, #find_existing_openstudio_object, #initialize, #method_missing, read_from_disk, truncate
Constructor Details
This class inherits a constructor from Honeybee::ModelObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Honeybee::ModelObject
Instance Method Details
#defaults ⇒ Object
37 38 39 |
# File 'lib/honeybee/geometry/shademesh.rb', line 37 def defaults @@schema[:components][:schemas][:ShadeMeshEnergyPropertiesAbridged][:properties] end |
#to_openstudio(openstudio_model) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/to_openstudio/geometry/shademesh.rb', line 39 def to_openstudio(openstudio_model) # get the vertices from the face hb_verts = @hash[:geometry][:vertices] hb_faces = @hash[:geometry][:faces] # loop through each mesh face and make it a shading surface os_shading_surfaces = [] hb_faces.each_with_index do |face_indices, index| # ensure that vertices are correctly ordered with the upper-left corner os_vertices = OpenStudio::Point3dVector.new face_indices.each do |vertex_index| vertex = hb_verts[vertex_index] os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2]) end os_vertices = OpenStudio.reorderULC(os_vertices) # create the openstudio shading surface os_shading_surface = OpenStudio::Model::ShadingSurface.new(os_vertices, openstudio_model) os_shading_surface.setName(@hash[:identifier] + "..#{index}") unless @hash[:display_name].nil? os_shading_surface.setDisplayName(@hash[:display_name]) end if @hash[:properties].key?(:energy) # assign the construction if it exists if @hash[:properties][:energy][:construction] construction_identifier = @hash[:properties][:energy][:construction] construction = openstudio_model.getConstructionByName(construction_identifier) unless construction.empty? os_construction = construction.get os_shading_surface.setConstruction(os_construction) end end # assign the transmittance schedule if it exists if @hash[:properties][:energy][:transmittance_schedule] schedule_identifier = @hash[:properties][:energy][:transmittance_schedule] schedule = openstudio_model.getScheduleByName(schedule_identifier) unless schedule.empty? os_schedule = schedule.get os_shading_surface.setTransmittanceSchedule(os_schedule) end end end os_shading_surfaces << os_shading_surface end os_shading_surfaces end |