def add_fenestration_surface_by_size(self, name, width, height, sill_height=1, radiance_material=None): """Add rectangular fenestration surface to surface. Args: width: Opening width. Opening will be centered in HBSurface. height: Opening height. sill_height: Sill height (default: 1). radiance_material: Optional radiance material for this fenestration. """ for pts in self.points: assert len(pts) == 4, 'Length of points should be 4.' pt0 = Point3(*pts[0]) pt1 = Point3(*pts[1]) pt3 = Point3(*pts[-1]) x_axis = Vector3(*(pt1 - pt0)).normalized() y_axis = Vector3(*(pt3 - pt0)).normalized() srf_width = pt0.distance(pt1) srf_height = pt0.distance(pt3) assert srf_width > width, \ 'Opening width [{}] should be smaller than ' \ 'HBSurface width [{}].'.format(srf_width, width) assert srf_height > height + sill_height, \ 'Opening height plus sill height [{}] should be smaller than ' \ 'HBSurface height [{}].'.format(srf_height + sill_height, height) # create fenestration surface x_gap = (srf_width - width) / 2.0 glz_pt0 = pt0 + (x_gap * x_axis) + (sill_height * y_axis) glz_pt1 = pt0 + ((x_gap + width) * x_axis) + (sill_height * y_axis) glz_pt2 = pt0 + ((x_gap + width) * x_axis) + \ ((sill_height + height) * y_axis) glz_pt3 = pt0 + (x_gap * x_axis) + ( (sill_height + height) * y_axis) glzsrf = HBFenSurface(name, [glz_pt0, glz_pt1, glz_pt2, glz_pt3]) if radiance_material: glzsrf.radiance_material = radiance_material self.add_fenestration_surface(glzsrf)
def origin(self, value): try: self._origin = Point3(*value) except Exception as e: raise ValueError("Failed to set zone origin: {}".format(e))