How to avoid duplicate faces names when using the PO_ResetIdentifier command?

@mostapha

I want to use Room/Face/Aperture Names shown in Rhino as IDs rather than to use IDs automatically generated with randam number and alphabet.
As a test, I modelled two rooms by “Draw a Room”, ran PO_ResetIdentifier with ID=ByDisplayName Face=Yes Room=Yes Validate=Yes, and ran PO_ResetBoundaryCondition and PO_ResolveAdjacency.

IDs were successfully overriden to Room/Face Names (Space " " was omitted, make sense).

When I validated this two rooms model, I got the following errors, which makes sense because Room 1 and Room 2 have the same Face IDs.

This model has only two Rooms and 13 Faces, so I can mannualy change the Face Names one by one, but this process would take so much time for larger models with hundreds and thousands Rooms.

In order to avoid duplicate Face IDs, is there any way to automatically assign Room IDs in front of Face IDs i.e., Room1_Face1, Room1_Face2, Room1_Face3… rather than Face1, Face2, Face3…?

Hi @keigonomura, another good question.

In theory you should be able to use the PO_ResetDisplayName command, similar to what I suggested here but I just tested it and it looks like we don’t support nested attributes in the command. @mingbo, is this something that we can support? I used {Parent.DisplayName}_{DisplayName} and it didn’t work as expected.

image

That said, this is very easy to do using a Python script. If you save the model as an HBJSON, you can use the code below to name the faces based on the parent name.

from honeybee.model import Model

fp = r'sample_model.hbjson'
model: Model = Model.from_hbjson(fp)

for room in model.rooms:
    for face in room.faces:
        face.display_name = f'{face.parent.display_name}_{face.display_name}'

model.to_hbjson(r'sample_model_renamed.hbjson')

sample_model.hbjson (78.6 KB)
sample_model_renamed.hbjson (53.9 KB)

We can also include this in an app to make it easier to do but I feel this is something that we should support directly inside Rhino. Let’s see what @mingbo thinks about this.

1 Like