def test_scale_idf(self, base_idf): # type: () -> None idf1 = base_idf idf2 = IDF() idf2.initreadtxt(idf1.idfstr()) idf1.scale(10) idf1.scale(0.1) floor1 = Polygon3D( idf1.getsurfaces('floor')[0].coords).normalize_coords(None) floor2 = Polygon3D( idf2.getsurfaces('floor')[0].coords).normalize_coords(None) assert almostequal(floor1, floor2)
def test_rotate_idf_360(self, base_idf): # type: () -> None idf1 = base_idf idf2 = IDF() idf2.initreadtxt(idf1.idfstr()) idf1.rotate(360) floor1 = Polygon3D( idf1.getsurfaces('floor')[0].coords).normalize_coords(None) floor2 = Polygon3D( idf2.getsurfaces('floor')[0].coords).normalize_coords(None) assert almostequal(floor1, floor2) shade1 = Polygon3D( idf1.getshadingsurfaces()[0].coords).normalize_coords(None) shade2 = Polygon3D( idf1.getshadingsurfaces()[0].coords).normalize_coords(None) assert almostequal(shade1, shade2)
def test_real_scale(): # type: () -> None """Test building, intersecting and matching from a real building footprint. """ iddfhandle = StringIO(iddcurrent.iddtxt) if IDF.getiddname() == None: IDF.setiddname(iddfhandle) idf = IDF(StringIO('Version, 8.5;')) poly1 = [(526492.65, 185910.65), (526489.05, 185916.45), (526479.15, 185910.3), (526482.65, 185904.6), (526492.65, 185910.65)] poly2 = [ (526483.3, 185903.15), (526483.5, 185903.25), (526482.65, 185904.6), (526479.15, 185910.3), (526489.05, 185916.45), (526492.65, 185910.65), (526493.4, 185909.4), (526500, 185913.95), (526500.45, 185914.3), (526500, 185914.85), (526497.4, 185918.95), (526499.45, 185920.2), (526494.4, 185928.35), (526466.05, 185910.95), (526471.1, 185902.75), (526473.05, 185903.9), (526476.2, 185898.8), (526479.95, 185901.1), (526483.3, 185903.15) ] idf.add_block('small', poly1, 6.0, 2) idf.add_block('large', poly2, 5.0, 2) idf.translate_to_origin() idf.intersect_match() idf.set_wwr(0.25) walls = idf.getsurfaces('wall') # look for a wall which should have been split assert 'Block large Storey 1 Wall 0003' not in [w.Name for w in walls] # look for another wall which should have been split assert 'Block large Storey 1 Wall 0005' not in [w.Name for w in walls] # look for a wall which should be an internal wall wall = idf.getobject('BUILDINGSURFACE:DETAILED', 'Block small Storey 1 Wall 0002_1') assert wall.Outside_Boundary_Condition != 'outdoors' # look for another wall which should be an internal wall wall = idf.getobject('BUILDINGSURFACE:DETAILED', 'Block large Storey 1 Wall 0003_2') assert wall.Outside_Boundary_Condition != 'outdoors' # look for two walls which are being incorrectly duplicated wall_1 = idf.getobject('BUILDINGSURFACE:DETAILED', 'Block small Storey 0 Wall 0001_1') wall_2 = idf.getobject('BUILDINGSURFACE:DETAILED', 'Block small Storey 0 Wall 0001_4') if wall_1 and wall_2: assert not almostequal(wall_1.coords, wall_2.coords) # look for two walls which are being incorrectly duplicated wall_1 = idf.getobject('BUILDINGSURFACE:DETAILED', 'Block large Storey 1 Wall 0005_3') wall_2 = idf.getobject('BUILDINGSURFACE:DETAILED', 'Block large Storey 1 Wall 0005_2') if wall_1 and wall_2: assert not almostequal(wall_1.coords, wall_2.coords) # look for two walls which are being incorrectly duplicated wall_1 = idf.getobject('BUILDINGSURFACE:DETAILED', 'Block large Storey 1 Wall 0004_3') wall_2 = idf.getobject('BUILDINGSURFACE:DETAILED', 'Block large Storey 1 Wall 0004_1') if wall_1 and wall_2: assert not almostequal(wall_1.coords, wall_2.coords)