diff --git a/hub/exports/formats/glb.py b/hub/exports/formats/glb.py index d8c0a942..dbb961c0 100644 --- a/hub/exports/formats/glb.py +++ b/hub/exports/formats/glb.py @@ -31,8 +31,11 @@ class Glb: self._export() @property - def _obj2gtl(self): - return shutil.which('obj2gltf') + def _obj2gltf(self): + obj2gltf = shutil.which('obj2gltf') + if obj2gltf is None: + obj2gltf = 'obj2gltf' + return obj2gltf def _export(self): try: @@ -43,7 +46,7 @@ class Glb: Obj(city, self._path) glb = f'{self._path}/{building.name}.glb' subprocess.run([ - self._obj2gtl, + self._obj2gltf, '-i', f'{self._path}/{building.name}.obj', '-b', '-o', f'{glb}' diff --git a/tests/test_exports.py b/tests/test_exports.py index b0ad94ef..e7197901 100644 --- a/tests/test_exports.py +++ b/tests/test_exports.py @@ -6,19 +6,19 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ import json -import logging.handlers import os from pathlib import Path from unittest import TestCase -from hub.imports.geometry_factory import GeometryFactory -from hub.helpers.dictionaries import Dictionaries -from hub.imports.construction_factory import ConstructionFactory -from hub.imports.usage_factory import UsageFactory -from hub.imports.weather_factory import WeatherFactory -from hub.exports.exports_factory import ExportsFactory -from hub.exports.energy_building_exports_factory import EnergyBuildingsExportsFactory + import hub.helpers.constants as cte from hub.city_model_structure.city import City +from hub.exports.energy_building_exports_factory import EnergyBuildingsExportsFactory +from hub.exports.exports_factory import ExportsFactory +from hub.helpers.dictionaries import Dictionaries +from hub.imports.construction_factory import ConstructionFactory +from hub.imports.geometry_factory import GeometryFactory +from hub.imports.usage_factory import UsageFactory +from hub.imports.weather_factory import WeatherFactory class TestExports(TestCase): @@ -95,7 +95,7 @@ class TestExports(TestCase): export to glb format """ self._export('glb', False) - for building in self._city.buildings: + for building in self._city.buildings: glb_file = Path(self._output_path / f'{building.name}.glb') self.assertTrue(glb_file.exists(), f'{building.name} Building glb wasn\'t correctly generated') @@ -148,4 +148,3 @@ class TestExports(TestCase): EnergyBuildingsExportsFactory('idf', city, self._output_path).export() except Exception: self.fail("Idf ExportsFactory raised ExceptionType unexpectedly!") -