ID'ng bad faces via OS outputs: having a touch of a struggle

Hi, soo for instance; when there are bad apertures

from ladybug_rhino import fromgeometry as fg
    bad_aps = [ sub for sub in sub_faces if sub.display_name in unmatched_ids ]
    for bad in bad_aps:
        a = fg.from_face3d_to_solid(bad.geometry,1)

appending that to the end of the ‘HB Add Subface’ component: works swimmingly to find where the suspects are.


Now currently: with OS outputs: I’ve been copy/pasting the applicable ID's from the OS error outputs:
i.e:


   ** Severe  ** RoofCeiling:Detailed="FACE_845F9AB1-FE9E-48C3-880A-874E9E114FB8", Vertex size mismatch between base surface :FACE_845F9AB1-FE9E-48C3-880A-874E9E114FB8 and outside boundary surface: FACE_E398EC72-8663-4C19-B714-94592A33F4D2 5
   **   ~~~   ** The vertex sizes are 6 for base surface and 4 for outside boundary surface. Please check inputs.
   ** Severe  ** RoofCeiling:Detailed="FACE_E398EC72-8663-4C19-B714-94592A33F4D2", Vertex size mismatch between base surface :FACE_E398EC72-8663-4C19-B714-94592A33F4D2 and outside boundary surface: FACE_845F9AB1-FE9E-48C3-880A-874E9E114FB8 6
   **   ~~~   ** The vertex sizes are 4 for base surface and 6 for outside boundary surface. Please check inputs.
   ** Severe  ** RoofCeiling:Detailed="FACE_E398EC72-8663-4C19-B714-94592A33F4D2 5", Vertex size mismatch between base surface :FACE_E398EC72-8663-4C19-B714-94592A33F4D2 5 and outside boundary surface: FACE_845F9AB1-FE9E-48C3-880A-874E9E114FB8
   **   ~~~   ** The vertex sizes are 4 for base surface and 6 for outside boundary surface. Please check inputs.
   ** Severe  ** RoofCeiling:Detailed="FACE_845F9AB1-FE9E-48C3-880A-874E9E114FB8 6", Vertex size mismatch between base surface :FACE_845F9AB1-FE9E-48C3-880A-874E9E114FB8 6 and outside boundary surface: FACE_E398EC72-8663-4C19-B714-94592A33F4D2
   **   ~~~   ** The vertex sizes are 6 for base surface and 4 for outside boundary surface. Please check inputs.
   ** Severe  ** RoofCeiling:Detailed="FACE_C1BE45EF-BDB1-44B3-AC37-FCF6A0B257BA", Vertex size mismatch between base surface :FACE_C1BE45EF-BDB1-44B3-AC37-FCF6A0B257BA and outside boundary surface: FACE_FBE24CDD-3A71-4960-9F7E-1EF7E24AB46A 6
   **   ~~~   ** The vertex sizes are 4 for base surface and 5 for outside boundary surface. Please check inputs.
   ** Severe  ** RoofCeiling:Detailed="FACE_FBE24CDD-3A71-4960-9F7E-1EF7E24AB46A", Vertex size mismatch between base surface :FACE_FBE24CDD-3A71-4960-9F7E-1EF7E24AB46A and outside boundary surface: FACE_C1BE45EF-BDB1-44B3-AC37-FCF6A0B257BA 5
   **   ~~~   ** The vertex sizes are 5 for base surface and 4 for outside boundary surface. Please check inputs.
   ** Severe  ** RoofCeiling:Detailed="FACE_C1BE45EF-BDB1-44B3-AC37-FCF6A0B257BA 5", Vertex size mismatch between base surface :FACE_C1BE45EF-BDB1-44B3-AC37-FCF6A0B257BA 5 and outside boundary surface: FACE_FBE24CDD-3A71-4960-9F7E-1EF7E24AB46A
   **   ~~~   ** The vertex sizes are 4 for base surface and 5 for outside boundary surface. Please check inputs.
   ** 

just taking the actual Face_xxxxxxxxxxxx: even programatically making the capitalization correct.

Using:

from honeybee.search import get_attr_nested

like in ‘label faces by attr’

I’ve been trying to:

import math

try:  # import the ladybug_geometry dependencies
    from ladybug_geometry.geometry3d.plane import Plane
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_geometry:\n\t{}'.format(e))

try:  # import the core honeybee dependencies
    from honeybee.model import Model
    from honeybee.room import Room
    from honeybee.face import Face
    from honeybee.aperture import Aperture
    from honeybee.door import Door
    from honeybee.search import get_attr_nested
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the ladybug_rhino dependencies
    from ladybug_rhino.fromgeometry import from_face3d_to_wireframe, from_plane
    from ladybug_rhino.text import text_objects
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

from ladybug_rhino.fromgeometry import from_face3d_to_solid as ffts 


# hide the base_pts output from the scene
ghenv.Component.Params.Output[1].Hidden = True


def label_face(face, _attribute_, _font_, label_text, base_pts, labels, wire_frame):
    """Generate labels for a face or sub-face and add it to a list."""
    face_prop = get_attr_nested(face, _attribute_)

    # get a base plane and text height for the text label
    cent_pt = face.geometry.center  # base point for the text
    base_plane = Plane(face.normal, cent_pt)
    if base_plane.y.z < 0:  # base plane pointing downwards; rotate it
        base_plane = base_plane.rotate(base_plane.n, math.pi, base_plane.o)
    if _txt_height_ is None:  # auto-calculate default text height
        txt_len = len(face_prop) if len(face_prop) > 10 else 10
        largest_dim = max((face.geometry.max.x - face.geometry.min.x),
                           (face.geometry.max.y - face.geometry.min.y))
        txt_h = largest_dim / (txt_len * 2)
    else:
        txt_h = _txt_height_

    # move base plane origin a little to avoid overlaps of adjacent labels
    if base_plane.n.x != 0:
        m_vec = base_plane.y if base_plane.n.x < 0 else -base_plane.y
    else:
        m_vec = base_plane.y if base_plane.n.z < 0 else -base_plane.y
    base_plane = base_plane.move(m_vec * txt_h)

    # create the text label
    label = text_objects(face_prop, base_plane, txt_h, font=_font_,
                         horizontal_alignment=1, vertical_alignment=3)

    # append everything to the lists
    label_text.append(face_prop)
    base_pts.append(from_plane(base_plane))
    labels.append(label)
    wire_frame.extend(from_face3d_to_wireframe(face.geometry))
    
    
if _Model:
    label_text = []
    base_pts = []
    labels = []
    wire_frame = []
        
    
    
    for room in _Model.rooms:
        for face in room.faces:
            if get_attr_nested(face, 'Identifier') == str(_BadIDs):
                a = ffts(face, 1)
            else:
                a = 'no_dice'

or some itter of that general premise, but: ‘no_dice’

It feels like the error causing faces ect called out in OS out_ don’t exist in the HB model?
Or I’ve made a script error and should have had a v8 this morning lol.

thanks!

@TrevorFedyna

Should “Identifier” be “identifier”? In if get_attr_nested(face, 'Identifier') == str(_BadIDs)

2 Likes

image
Yep that did the trick :rofl: :sweat_smile:
Thank you!
If I had $1 for every time my code was not working due to a typo… I could probably quit one of my jobs :rofl:

1 Like