From 36553e0d0d6f6227b3a175ca9bd52bcae36b6c4d Mon Sep 17 00:00:00 2001 From: guille Date: Wed, 11 Aug 2021 15:38:07 -0400 Subject: [PATCH] correct idf factory --- exports/exports_factory.py | 6 +++++- exports/formats/idf.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/exports/exports_factory.py b/exports/exports_factory.py index 77e2d8d7..02597ba8 100644 --- a/exports/exports_factory.py +++ b/exports/exports_factory.py @@ -9,6 +9,7 @@ from exports.formats.obj import Obj from exports.formats.energy_ade import EnergyAde from exports.formats.simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm from exports.formats.idf import Idf +from pathlib import Path class ExportsFactory: @@ -66,7 +67,10 @@ class ExportsFactory: Export the city to Energy+ idf format :return: """ - return Idf(self._city, (self._path / f'{self._city.name}.idf'), (self._path / f'{self._city.name}.idd'),(self._path / f'{self._city.name}.epw')) + # todo: this need to be generalized + data_path = Path('../test/test/data').resolve() + return Idf(self._city, self._path, (data_path / f'minimal.idf'), (data_path / f'energy+.idd'), + (self._path / f'montreal.epw')) @property def _sra(self): diff --git a/exports/formats/idf.py b/exports/formats/idf.py index 57707351..c1d337df 100644 --- a/exports/formats/idf.py +++ b/exports/formats/idf.py @@ -32,8 +32,9 @@ class Idf: 'residential': 'residential_building' } - def __init__(self, city, idf_file_path, idd_file_path, epw_file_path): + def __init__(self, city, output_path, idf_file_path, idd_file_path, epw_file_path): self._city = city + self._output_path = str(output_path) self._idd_file_path = str(idd_file_path) self._idf_file_path = str(idf_file_path) self._epw_file_path = str(epw_file_path) @@ -208,6 +209,7 @@ class Idf: self._add_surfaces(building) else: self._add_block(building) + self._idf.saveas(str(self._output_path)) def _add_block(self, building): _points = self._matrix_to_2d_list(building.foot_print.coordinates)