changed stl to trimesh
This commit is contained in:
parent
5720eca3c3
commit
7329e36bc8
|
@ -4,8 +4,8 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||||
"""
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import stl
|
|
||||||
from helpers.geometry_helper import GeometryHelper
|
from helpers.geometry_helper import GeometryHelper
|
||||||
|
from trimesh import Trimesh
|
||||||
|
|
||||||
|
|
||||||
class Polyhedron:
|
class Polyhedron:
|
||||||
|
@ -24,7 +24,7 @@ class Polyhedron:
|
||||||
|
|
||||||
def _position_of(self, point):
|
def _position_of(self, point):
|
||||||
vertices = self.vertices
|
vertices = self.vertices
|
||||||
for i in enumerate(vertices):
|
for i in range(len(vertices)):
|
||||||
if self._geometry.almost_equal(vertices[i], point):
|
if self._geometry.almost_equal(vertices[i], point):
|
||||||
return i
|
return i
|
||||||
return -1
|
return -1
|
||||||
|
@ -70,10 +70,10 @@ class Polyhedron:
|
||||||
@property
|
@property
|
||||||
def _polyhedron_mesh(self):
|
def _polyhedron_mesh(self):
|
||||||
if self._mesh is None:
|
if self._mesh is None:
|
||||||
self._mesh = stl.mesh.Mesh(np.zeros(self.faces.shape[0], dtype=stl.mesh.Mesh.dtype))
|
self._mesh = Trimesh(vertices=np.asarray(self.vertices), faces=np.asarray(self.faces))
|
||||||
for i, faces in enumerate(self.faces):
|
if not self._mesh.is_volume:
|
||||||
for j in range(3):
|
print('error')
|
||||||
self._mesh.vectors[i][j] = self.vertices[faces[j], :]
|
return None
|
||||||
return self._mesh
|
return self._mesh
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -83,7 +83,7 @@ class Polyhedron:
|
||||||
:return: float
|
:return: float
|
||||||
"""
|
"""
|
||||||
if self._volume is None:
|
if self._volume is None:
|
||||||
self._volume, _, _ = self._polyhedron_mesh.get_mass_properties()
|
self._volume = self._polyhedron_mesh.volume
|
||||||
return self._volume
|
return self._volume
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -92,7 +92,10 @@ class Polyhedron:
|
||||||
Polyhedron maximal z value
|
Polyhedron maximal z value
|
||||||
:return: float
|
:return: float
|
||||||
"""
|
"""
|
||||||
return self._polyhedron_mesh.z.max()
|
bounds = self._polyhedron_mesh.bounds
|
||||||
|
z_max = max(bounds[:, 2])
|
||||||
|
print(z_max)
|
||||||
|
return z_max
|
||||||
|
|
||||||
def save(self, full_path):
|
def save(self, full_path):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# These values are intended as configurable assumptions
|
# These values are intended as configurable assumptions
|
||||||
[convective_fluxes]
|
[convective_fluxes]
|
||||||
h_i = 10 # W/m2K
|
# interior convective coefficient in W/m2K
|
||||||
h_e = 25 # W/m2K
|
h_i = 10
|
||||||
|
# exterior convective coefficient in W/m2K
|
||||||
|
h_e = 25
|
||||||
|
|
||||||
[windows]
|
[windows]
|
||||||
frame_ratio = 0
|
frame_ratio = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user