From 462b3ae4da202186e0d89745c13a4f47bdd819c7 Mon Sep 17 00:00:00 2001 From: Chris Mackey Date: Wed, 12 Jul 2023 09:32:14 -0700 Subject: [PATCH] fix(windowshade): Use better handling of WindowConstructionShade ID --- lib/to_openstudio/construction/windowshade.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/to_openstudio/construction/windowshade.rb b/lib/to_openstudio/construction/windowshade.rb index dd1b235..fb7f7c9 100644 --- a/lib/to_openstudio/construction/windowshade.rb +++ b/lib/to_openstudio/construction/windowshade.rb @@ -45,19 +45,20 @@ def find_existing_openstudio_object(openstudio_model) end def to_openstudio(openstudio_model) - # write the shaded and unsaded versions of the construction into the model - # reverse the shaded and unshaded identifiers so unshaded one is assigned to apertures + # set the unshaded ID to be the whole construction ID so unshaded one is assigned to apertures unshd_id = @hash[:identifier] - shd_id = @hash[:window_construction][:identifier] @hash[:window_construction][:identifier] = unshd_id + # derive a new ID for the shaded construction that will not conflict with any bare versions of the construction + shd_id = @hash[:identifier] + '_Shaded' @hash[:identifier] = shd_id + # create the unshaded construction unshd_constr_obj = WindowConstructionAbridged.new(@hash[:window_construction]) @construction = unshd_constr_obj.to_openstudio(openstudio_model) # create the shaded construction @shade_construction = OpenStudio::Model::Construction.new(openstudio_model) - @shade_construction.setName(shd_id) + @shade_construction.setName(@hash[:identifier]) unless @hash[:display_name].nil? @shade_construction.setDisplayName(@hash[:display_name]) end