Assign a Construction to an specific surface after Construction Set is applied

Hi @Anmol23, I have yet to check the Grasshopper definition and the gbXML file, but I guess that you see this behavior because the constructions are hard assigned to faces in the gbXML file.

The construction set will only be used if the face doesn’t have a hard assigned construction. In that case, the construction from the construction-set will be assigned based on the face type. You can think about it as a backup for faces with no construction.

@Anmol23 following what @mostapha said:
I removed all constructions from the GBXML in openstudio application and then loaded the exported edit into your grasshopper script and it seems to be working as desired:


edited_try2.xml (902.3 KB)

I’ve tried writing some code to replace this workaround but I’ve not had a bunch of time, should have something soon hopefully though.

Best
-trevor

@Anmol23 So I made some time and wrote a component that guts faces by type and applies the construction set to each list.
find the modified script attached:


GBXML_Constructionset_EDITED_ADDED_COMPO.gh (91.1 KB)


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.shade import Shade
    from honeybee.shademesh import ShadeMesh
    from honeybee.boundarycondition import Surface
    from honeybee.facetype import Wall, RoofCeiling, Floor, AirBoundary
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

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

try:  # import the honeybee-energy extension
    from honeybee.boundarycondition import Adiabatic
except ImportError:  # honeybee-energy not installed
    Adiabatic = None  # don't worry about Aidabatic; Surface is the only interior bc


def add_shade(hb_obj):
    """Add an object's shades to the relevant lists."""
    outdoor_shades.extend([shd for shd in hb_obj.outdoor_shades])
    indoor_shades.extend([shd for shd in hb_obj.indoor_shades])

def add_door(dr):
    """Add a door to the relevant lists."""
    bc = dr.boundary_condition
    add_shade(dr)
    if isinstance(bc, Surface):
        interior_doors.append(dr)
    else:
        doors.append(dr)

def add_aperture(ap):
    """Add an aperture to the relevant lists."""
    bc = ap.boundary_condition
    add_shade(ap)
    if isinstance(bc, Surface):
        interior_apertures.append(ap)
    else:
        apertures.append(ap)

def add_face(face):
    """Add a face to the relevant lists."""
    add_shade(face)
    bc = face.boundary_condition
    type = face.type
    if isinstance(type, Wall):
        if isinstance(bc, (Surface, Adiabatic)):
            interior_walls.append(face)
        else:
            walls.append(face)
    elif isinstance(type, RoofCeiling):
        if isinstance(bc, (Surface, Adiabatic)):
            ceilings.append(face)
        else:
            roofs.append(face)
    elif isinstance(type, Floor):
        if isinstance(bc, (Surface, Adiabatic)):
            interior_floors.append(face)
        else:
            exterior_floors.append(face)
    elif isinstance(type, AirBoundary):
        air_walls.append(face)

    # add the apertures, doors, and shades
    for ap in face.apertures:
        add_aperture(ap)
    for dr in face.doors:
        add_door(dr)
        

walls = []
interior_walls = []
roofs = []
ceilings = []
exterior_floors = []
interior_floors = []
air_walls = []
apertures = []
interior_apertures = []
doors = []
interior_doors = []
outdoor_shades = []
indoor_shades = []
shade_meshes = []

for obj in _hb_objs:
        if isinstance(obj, Model):
            for room in obj.rooms:
                for face in room.faces:
                    add_face(face)
            for face in obj.orphaned_faces:
                add_face(face)
            for ap in obj.orphaned_apertures:
                add_aperture(ap)
            for dr in obj.orphaned_doors:
                add_door(dr)
            outdoor_shades.extend(obj.orphaned_shades)
            outdoor_shades.extend(obj.shade_meshes)
        elif isinstance(obj, Room):
            add_shade(obj)
            for face in obj:
                add_face(face)
        elif isinstance(obj, Face):
            add_face(obj)
        elif isinstance(obj, Aperture):
            add_aperture(obj)
        elif isinstance(obj, Door):
            add_door(obj)
        elif isinstance(obj, Shade):
            outdoor_shades.append(obj)
        elif isinstance(obj, ShadeMesh):
            outdoor_shades.append(obj)
            
for wall in walls:
    wall.properties.energy.construction = _constr_set.wall_set.exterior_construction

for wall in interior_walls:
    wall.properties.energy.construction = _constr_set.wall_set.interior_construction

for roof in roofs:
    roof.properties.energy.construction = _constr_set.roof_ceiling_set.exterior_construction
    
for ceiling in ceilings:
    ceiling.properties.energy.construction = _constr_set.roof_ceiling_set.interior_construction
    
for ext_flr in exterior_floors:
    ext_flr.properties.energy.construction = _constr_set.floor_set.exterior_construction
    
for int_flr in interior_floors:
    int_flr.properties.energy.construction = _constr_set.floor_set.interior_construction

for aw in air_walls:
    aw.properties.energy.construction = _constr_set.air_boundary_construction
    
for ap in apertures:
    ap.properties.energy.construction = _constr_set.aperture_set.window_construction

for ap in interior_apertures:
    ap.properties.energy.construction = _constr_set.aperture_set.interior_construction

for door in doors:
    door.properties.energy.construction = _constr_set.door_set.exterior_construction

for door in interior_doors:
    door.properties.energy.construction = _constr_set.door_set.interior_construction

for shade in outdoor_shades:
    shade.properties.energy.construction = _constr_set.shade_construction

for shade in indoor_shades:
    shade.properties.energy.construction = _constr_set.shade_construction
    
for mesh in shade_meshes:
    mesh.properties.energy.construction = _constr_set.shade_construction
    

model_ = _hb_objs

@TrevorFedyna thanks a ton! This script is super useful. I had also tried to remove the hard set construction as pointed out by @mostapha using Openstudio, however that removes Air partitions as that is also a Construction.
This method, I believe will be retaining the Air Partitions. Will give it a try and get back.

1 Like

@Anmol23 No problem! Happy to help, let me know if you have any issues with that component, I can always make edits and modifications.
Best
-trevor