redefined tutorial 1

This commit is contained in:
Pilar Monsalvete 2023-06-09 11:38:46 -04:00
parent 37ad7fae0d
commit 685be037b7

View File

@ -1,33 +1,40 @@
from hub.imports.geometry_factory import GeometryFactory
from hub.imports.construction_factory import ConstructionFactory
from hub.helpers.dictionaries import Dictionaries
from hub.exports.exports_factory import ExportsFactory
import hub.helpers.constants as cte
MY_CUSTOM_DICTIONARY = {
'1000': cte.RESIDENTIAL
}
# tutorial_0:
gml_file = 'FZK-Haus-LoD2-KIT-IAI-KHH-B36-V1.gml'
# case 3: Use a Hub dictionary when importing the geometry
city = GeometryFactory('citygml', gml_file, function_to_hub=Dictionaries().montreal_function_to_hub_function).city
for building in city.buildings:
print(building.name)
print(building.volume)
print(building.floor_area)
print(f"Year of construction of building {building.name} is: {building.year_of_construction}")
print(f"Function of building {building.name} is: {building.function}")
# case 1: Use a Hub dictionary after importing the geometry
for building in city.buildings:
building.function = Dictionaries().montreal_function_to_hub_function[building.function]
for building in city.buildings:
print(f"Hub-format function of building {building.name} is: {building.function}")
# case 2: Create a new dictionary and use it after importing the geometry
for building in city.buildings:
building.function = MY_CUSTOM_DICTIONARY[building.function]
for building in city.buildings:
print(f"Hub-format function of building {building.name} is: {building.function}")
# Level1:
city1 = city.copy
ConstructionFactory('nrcan', city).enrich()
for building in city1.buildings:
print ("Construction year of building in city1 is: ", building.year_of_construction)
print ("Building's function in city1 is: " , building.function)
ConstructionFactory('nrcan',city1).enrich()
for building in city1.buildings:
for internal_zone in building.internal_zones:
for thermal_zone in internal_zone.thermal_zones:
for building in city.buildings:
for thermal_zone in building.thermal_zones:
for thermal_boundary in thermal_zone.thermal_boundaries:
for layer in thermal_boundary.layers:
print(thermal_boundary.internal_surface.type)
print(layer.material.name)