Skip to content

Commit

Permalink
fix(shade): Implement better translation for orphaned objects to Shade
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Apr 10, 2024
1 parent e2a9411 commit ba0be68
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 32 deletions.
5 changes: 1 addition & 4 deletions lib/to_openstudio/geometry/aperture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def to_openstudio(openstudio_model)
return result
end

def to_openstudio_shade(openstudio_model, shading_surface_group)
def to_openstudio_shade(openstudio_model)
# get the vertices from the aperture
if @hash[:geometry][:vertices].nil?
hb_verts = @hash[:geometry][:boundary]
Expand Down Expand Up @@ -217,9 +217,6 @@ def to_openstudio_shade(openstudio_model, shading_surface_group)
end
end

# add the shade to the group
os_shading_surface.setShadingSurfaceGroup(shading_surface_group)

os_shading_surface
end

Expand Down
5 changes: 1 addition & 4 deletions lib/to_openstudio/geometry/door.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def to_openstudio(openstudio_model)
return result
end

def to_openstudio_shade(openstudio_model, shading_surface_group)
def to_openstudio_shade(openstudio_model)
# get the vertices from the door
if @hash[:geometry][:vertices].nil?
hb_verts = @hash[:geometry][:boundary]
Expand Down Expand Up @@ -212,9 +212,6 @@ def to_openstudio_shade(openstudio_model, shading_surface_group)
end
end

# add the shade to the group
os_shading_surface.setShadingSurfaceGroup(shading_surface_group)

os_shading_surface
end

Expand Down
19 changes: 0 additions & 19 deletions lib/to_openstudio/geometry/face.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,25 +248,6 @@ def to_openstudio_shade(openstudio_model, shading_surface_group)
end
end

# add the shade to the group
os_shading_surface.setShadingSurfaceGroup(shading_surface_group)

# convert the apertures to shade objects
if @hash[:apertures]
@hash[:apertures].each do |aperture|
hb_aperture = Aperture.new(aperture)
os_subsurface_aperture = hb_aperture.to_openstudio_shade(openstudio_model, shading_surface_group)
end
end

# convert the apertures to shade objects
if @hash[:doors]
@hash[:doors].each do |door|
hb_door = Door.new(door)
os_subsurface_door = hb_door.to_openstudio_shade(openstudio_model, shading_surface_group)
end
end

os_shading_surface
end

Expand Down
10 changes: 5 additions & 5 deletions lib/to_openstudio/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def create_orphaned_faces
end
@hash[:orphaned_faces].each do |face|
face_object = Face.new(face)
openstudio_shade = face_object.to_openstudio_shade(@openstudio_model, shading_surface_group)
openstudio_shade = face_object.to_openstudio_shade(@openstudio_model)
if $orphan_groups
openstudio_shade.setShadingSurfaceGroup(shading_surface_group)
end
Expand All @@ -663,9 +663,9 @@ def create_orphaned_apertures
shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(@openstudio_model)
shading_surface_group.setShadingSurfaceType('Building')
end
@hash[:orphaned_apertures].each do |ap|
@hash[:orphaned_apertures].each do |ap|
ap_object = Aperture.new(ap)
openstudio_shade = ap_object.to_openstudio_shade(@openstudio_model, shading_surface_group)
openstudio_shade = ap_object.to_openstudio_shade(@openstudio_model)
if $orphan_groups
openstudio_shade.setShadingSurfaceGroup(shading_surface_group)
end
Expand All @@ -679,9 +679,9 @@ def create_orphaned_doors
shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(@openstudio_model)
shading_surface_group.setShadingSurfaceType('Building')
end
@hash[:orphaned_doors].each do |dr|
@hash[:orphaned_doors].each do |dr|
dr_object = Door.new(dr)
openstudio_shade = dr_object.to_openstudio_shade(@openstudio_model, shading_surface_group)
openstudio_shade = dr_object.to_openstudio_shade(@openstudio_model)
if $orphan_groups
openstudio_shade.setShadingSurfaceGroup(shading_surface_group)
end
Expand Down

0 comments on commit ba0be68

Please sign in to comment.