OpenStudioApplication icon indicating copy to clipboard operation
OpenStudioApplication copied to clipboard

Show displayname in grid view

Open macumber opened this issue 2 years ago • 4 comments

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/

macumber avatar Jul 09 '23 17:07 macumber

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.

christophertindall avatar May 22 '24 19:05 christophertindall

I understand your concern if this is breaking your workflow. That being said, I'd like to clarify something:

  • Revit produces gbxml in a certain way.
  • OpenStudio SDK can handle the conversion between to/from gbxml/OSM.
  • OpenStudioApplication uses openstudio SDK and works on an OSM.

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

  • https://github.com/openstudiocoalition/OpenStudioApplication/issues/417

jmarrec avatar May 23 '24 10:05 jmarrec

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)

jmarrec avatar May 23 '24 12:05 jmarrec

@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 avatar Jun 30 '24 14:06 macumber

@macumber https://github.com/NREL/OpenStudio/pull/4995#discussion_r1357099567

eg: https://github.com/NREL/OpenStudio/blob/develop/resources/gbxml/11_Jay_St.xml

jmarrec avatar Jul 15 '24 13:07 jmarrec

@macumber included is an OSM file generated by Revit 2024 that include the additional properties. in.zip

christophertindall avatar Jul 15 '24 17:07 christophertindall

Fixed via #715

jmarrec avatar Aug 29 '24 08:08 jmarrec