Closed anchapin closed 2 years ago
A few suggestions for the
measure.rb
.
- For flexibility, let's add a boolean user argument to override OpenStudio's default behavior to set the object name to the gbXML id with this block to set it to the Name. Then move inside a conditional.
- Let's add a
runner.registerWarning
when inside the block renaming.- Let's take a top down approach and set Building name first, then ThermalZones.
- Let's take an all or nothing approach for each class, meaning only use the gbXML Name element (displayName) if all are unique so that users don't end up seeing a mix of the two conventions.
(4) might be the most controversial. Let me know if you have any questions or think otherwise, thanks! FYI @axelstudios.
Other suggestions.
- Remove the
A00.xml
from theimport_gbxml/
dir.- We might want to also remove the other XML and OSW, but can do before merging.
Thank you for these suggestions.
For number 4, what about a compromise? We could name thermal zones with non-unique names with the following concatenation: [displayName] - [gbXMLId]. The formatting of it can be changed but someway of listing the name and then the id so that all of the thermal zones have a name component and you only include a number or id when the names are the same. I just think that having the fall back option be keeping the gbXMLIds without any names isn't a good solution.
For (3) we could also organize the renaming according to the tab order in the App.
For (4) I like your concatenation idea. What do you think about all or nothing with that approach? It would eliminate the need for checking for unique names and mean the boolean argument would determine renaming.
For (3), what do you mean by tab order in the App? Are you talking about the OpenStudio GUI and the tabs on the left side? That is the same as your original suggestion for (3) unless we add more objects beyond just building and thermal zone.
For (4), I think I like your suggestion, but I'd like @axelstudios to weigh in. Also, to clarify, are you saying that when a file has non-unique names, then all of the objects have the concatenation instead of just the objects with non-unique names or are you saying that when the user selects the boolean argument as true, the renaming would always concatenate without checking for unique names?
(3) yes, tab order in the GUI, which I think is the order you have them in.
(4) the latter. However, we could still do the former. Something like...
if bool_arg
# check gbxml zone names for uniqueness here, then issue warnings
if gbxml_zone_names_uniq
runner.registerWarning("gbXML Zone names are unique, renaming with Name.")
else
runner.registerWarning("gbXML Zone names are not unique, renaming with Name and ID.")
end
# rename thermal zones
thermal_zones.each do |thermal_zone|
case gbxml_zone_names_uniq
when true
name = gbxml_name
when false
name = gbxml_name + gbxml_id
end
thermal_zone.setName(name)
end
# rename building
end
@MatthewSteen Is there a use case for not checking name uniqueness? Trying to think of a situation where we would set that boolean arg to false.
Otherwise I'm good with the solution proposed above, I'd probably concatenate the names like #{display_name} (#{gbxml_id})
@MatthewSteen Is there a use case for not checking name uniqueness? Trying to think of a situation where we would set that boolean arg to false.
Otherwise I'm good with the solution proposed above, I'd probably concatenate the names like
#{display_name} (#{gbxml_id})
@axelstudios I was thinking about use cases outside of Revit, e.g. if we make this repo public.
@MatthewSteen I responded to your comments. Let me know if you see anything else that should change.
Fix #108 by revising the import_gbxml measure to set the name of thermal zones and the building equal to the displayName feature instead of the gbXMLId feature. It also checks for unique names in thermal zones and uses the ID # instead of name in those cases.
Test: Use the "A00_Ident_ImportG.osw" workflow in the workflows folder. This gbXML was copied from the A00.xml and two additional spaces and zones were added. Two of the zones and spaces have the same name and the third one has an unique name. Therefore, two of the zones should end up with ID numbers for their name and the other one should have the name "CAV-3".