diff --git a/Lattesh/__init__.py b/Lattesh/__init__.py index e1a07176039a1f96ca215419177b8d79e62f07a6..63eef4a2671ca9f2c488b9367f3bd41a3c847d84 100644 --- a/Lattesh/__init__.py +++ b/Lattesh/__init__.py @@ -19,6 +19,7 @@ # Lattice Tools. If not, see <https://www.gnu.org/licenses/>. + bl_info = { "name": "Lattice Tools", "author": "Ubiratan S. Freitas", @@ -47,6 +48,11 @@ else: PointerProperty, ) + import os + if hasattr(os, 'add_dll_directory'): + import sys + dll_path = os.path.join(sys.prefix, 'Library/bin') + dpath = os.add_dll_directory(dll_path) from . import ( operators, ui, diff --git a/Lattesh/operators.py b/Lattesh/operators.py index 8b6db3ec59714c0b7dfe3188e470fdf4ad11eea4..3b0e8fbe63e59506c9bc70413a1d8883dd93dd0b 100644 --- a/Lattesh/operators.py +++ b/Lattesh/operators.py @@ -25,6 +25,7 @@ from mathutils.bvhtree import BVHTree import numpy as np import math import os +from glob import glob try: from scipy.spatial import Voronoi, Delaunay @@ -120,25 +121,16 @@ class Cell: self.name = name -cell_files = ['hex.cell', - 'type_2.cell', - 'type_3.cell', - 'type_4.cell', - 'type_5.cell', - 'type_6.cell', - 'type_8.cell', - 'type_9.cell', - 'type_91.cell', - ] fpath = os.path.dirname(os.path.abspath(__file__)) -filepath = os.path.join(fpath, 'cells') Cells = {} cell_items = [] +cell_files = glob(os.path.join(fpath, 'cells/*.cell')) +cell_files.sort() for k, cf in enumerate(cell_files): c = Cell() - c.from_file(os.path.join(filepath, cf)) + c.from_file(cf) Cells[c.name] = c cell_items.append((c.name, c.name, c.name, k)) @@ -695,11 +687,9 @@ def occ_compute_node(ev, r=0.5, mesh_pars=(0.1, False, math.radians(60), False), location = TopLoc_Location() facing = (bt.Triangulation(face, location)) if facing is not None: - tab = facing.Nodes() - tri = facing.Triangles() local_index = [] - for k in range(1, tab.Length() + 1): - pnt = tab.Value(k) + for k in range(1, facing.NbNodes() + 1): + pnt = facing.Node(k) point = list(pnt.Coord()) dpoint = tuple((np.array(point) * 100).round().astype(np.int32)) verts.append(point) @@ -724,7 +714,7 @@ def occ_compute_node(ev, r=0.5, mesh_pars=(0.1, False, math.radians(60), False), plane_verts.append(local_index) else: for i in range(1, facing.NbTriangles()+1): - trian = tri.Value(i) + trian = facing.Triangle(i) np_tri = np.array(list(trian.Get()), dtype=np.int32) np_tri = np.array(local_index[np_tri - 1]) if (np_tri - np_tri[ind_tri]).prod() != 0 :