Add the occupancy to the data model
This commit is contained in:
parent
6a5e39fba6
commit
cb24c7119b
|
@ -5,7 +5,6 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
|
||||||
"""
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from trimesh import Trimesh
|
from trimesh import Trimesh
|
||||||
|
|
||||||
from helpers.geometry_helper import GeometryHelper
|
from helpers.geometry_helper import GeometryHelper
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,13 +106,21 @@ class Polyhedron:
|
||||||
"""
|
"""
|
||||||
return self._polyhedron_mesh.centroid
|
return self._polyhedron_mesh.centroid
|
||||||
|
|
||||||
def export(self, full_path):
|
def stl_export(self, full_path):
|
||||||
"""
|
"""
|
||||||
Export the polyhedron to stl given file
|
Export the polyhedron to stl given file
|
||||||
:param full_path: str
|
:param full_path: str
|
||||||
:return: None
|
: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):
|
def show(self):
|
||||||
self._polyhedron_mesh.show()
|
self._polyhedron_mesh.show()
|
||||||
|
|
|
@ -78,13 +78,21 @@ class CityObject:
|
||||||
if self._polyhedron is None:
|
if self._polyhedron is None:
|
||||||
self._polyhedron = Polyhedron(self.surfaces)
|
self._polyhedron = Polyhedron(self.surfaces)
|
||||||
full_path = (Path(path) / (self._name + '.stl')).resolve()
|
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):
|
def show(self):
|
||||||
if self._polyhedron is None:
|
if self._polyhedron is None:
|
||||||
self._polyhedron = Polyhedron(self.surfaces)
|
self._polyhedron = Polyhedron(self.surfaces)
|
||||||
self._polyhedron.show()
|
self._polyhedron.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_height(self):
|
def max_height(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -8,6 +8,7 @@ from unittest import TestCase
|
||||||
from factories.geometry_factory import GeometryFactory
|
from factories.geometry_factory import GeometryFactory
|
||||||
from factories.physics_factory import PhysicsFactory
|
from factories.physics_factory import PhysicsFactory
|
||||||
from factories.usage_factory import UsageFactory
|
from factories.usage_factory import UsageFactory
|
||||||
|
from factories.occupancy_factory import OccupancyFactory
|
||||||
from helpers.idf_helper import IdfHelper
|
from helpers.idf_helper import IdfHelper
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
|
@ -33,6 +34,8 @@ class TestIdf(TestCase):
|
||||||
self._city_gml = GeometryFactory('citygml', file_path).city
|
self._city_gml = GeometryFactory('citygml', file_path).city
|
||||||
PhysicsFactory('us_new_york', self._city_gml)
|
PhysicsFactory('us_new_york', self._city_gml)
|
||||||
UsageFactory('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
|
return self._city_gml
|
||||||
|
|
||||||
def test_idf_blocks(self):
|
def test_idf_blocks(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user