Add the occupancy to the data model

This commit is contained in:
Guille 2020-11-18 08:58:37 -05:00
parent 6a5e39fba6
commit cb24c7119b
3 changed files with 23 additions and 5 deletions

View File

@ -5,7 +5,6 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
"""
import numpy as np
from trimesh import Trimesh
from helpers.geometry_helper import GeometryHelper
@ -107,13 +106,21 @@ class Polyhedron:
"""
return self._polyhedron_mesh.centroid
def export(self, full_path):
def stl_export(self, full_path):
"""
Export the polyhedron to stl given file
:param full_path: str
:return: None
"""
self._polyhedron_mesh.export(full_path)
self._polyhedron_mesh.export(full_path, 'stl_ascii')
def obj_export(self, full_path):
"""
Export the polyhedron to obj given file
:param full_path: str
:return: None
"""
self._polyhedron_mesh.export(full_path, 'obj')
def show(self):
self._polyhedron_mesh.show()
self._polyhedron_mesh.show()

View File

@ -78,13 +78,21 @@ class CityObject:
if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces)
full_path = (Path(path) / (self._name + '.stl')).resolve()
self._polyhedron.export(full_path)
self._polyhedron.stl_export(full_path)
def obj_export(self, path):
if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces)
full_path = (Path(path) / (self._name + '.obj')).resolve()
self._polyhedron.obj_export(full_path)
def show(self):
if self._polyhedron is None:
self._polyhedron = Polyhedron(self.surfaces)
self._polyhedron.show()
@property
def max_height(self):
"""

View File

@ -8,6 +8,7 @@ from unittest import TestCase
from factories.geometry_factory import GeometryFactory
from factories.physics_factory import PhysicsFactory
from factories.usage_factory import UsageFactory
from factories.occupancy_factory import OccupancyFactory
from helpers.idf_helper import IdfHelper
import os
import glob
@ -33,6 +34,8 @@ class TestIdf(TestCase):
self._city_gml = GeometryFactory('citygml', file_path).city
PhysicsFactory('us_new_york', self._city_gml)
UsageFactory('us_new_york', self._city_gml)
UsageFactory('us_new_york', self._city_gml)
OccupancyFactory('demo', self._city_gml)
return self._city_gml
def test_idf_blocks(self):