Closed macumber closed 1 week ago
This needs to be elevated above an "Enhancement Request". The fix for OpenStudio Issue 4457 has broken our ability to use OpenStudio Application to modify OSM files generated by Revit Systems Analysis. OpenStudio Application now only displays the gbXMLId values, which is not useful for navigating the model. While we are waiting for this fix, can someone write an OpenStudio measure to replace the space gbXMLId values with the space displayName values? Revit already verifies the displayName value is unique so it should be a simply measure to write.
I understand your concern if this is breaking your workflow. That being said, I'd like to clarify something:
From the point of view of the OpenStudioApplication: a model object has a name, we display it, that's about it. It works as expected and designed. We control neither how Revit produces gbxml nor the OpenStudio SDK's handling of gbxml.
So yes, this is an enhancement request. And it is similar to
the OSM has the gbxml's id as the name.
Here is some python code to replace it.
import openstudio
model = openstudio.model.Model.load('model.osm').get()
for obj in model.modelObjects():
if not obj.hasAdditionalProperties():
continue
displayName_ = obj.displayName()
if not displayName_.is_initialized():
continue
name = obj.nameString()
displayName = displayName_.get()
gbXMLId_ = obj.gbXMLId()
print(f"For {obj.briefDescription()}, setting name to '{displayName}'")
if gbXMLId_.is_initialized():
gbXMLId = gbXMLId_.get()
if gbXMLId != name:
print(f"and replacing gbXMLId '{gbXMLId}' with '{name}'")
obj.setName(displayName)
obj.setGBXMLId(name)
model.save('replaced.osm', True)
same in ruby
require 'openstudio'
model = OpenStudio::Model::Model.load('gbxml.osm').get
model.modelObjects.each do |obj|
next unless obj.hasAdditionalProperties
displayName_ = obj.displayName
next if displayName_.empty?
name = obj.nameString()
displayName = displayName_.get
gbXMLId_ = obj.gbXMLId()
puts("For #{obj.briefDescription()}, setting name to '#{displayName}'")
if gbXMLId_.is_initialized
gbXMLId = gbXMLId_.get
if gbXMLId != name
puts("and replacing gbXMLId '#{gbXMLId}' with '#{name}'")
end
end
obj.setName(displayName)
obj.setGBXMLId(name)
end
model.save('replaced.osm', true)
@christophertindall or @chrisbalbach would either of you be able to make a small example model in Revit and export to OSM? I'd like to see which objects have these fields. Julien has covered many object types in https://github.com/openstudiocoalition/OpenStudioApplication/pull/715
@macumber included is an OSM file generated by Revit 2024 that include the additional properties. in.zip
Fixed via #715
Enhancement Request
For applications where displayname is different than the object name, it would be useful to see it in the OS app. Not sure if it should be a separate column or something else.
https://unmethours.com/question/93379/display-names-of-items-imported-from-gbxml/