topologicpy 0.4.62__py3-none-any.whl → 0.4.64__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- topologicpy/Cell.py +16 -1
- topologicpy/CellComplex.py +15 -1
- topologicpy/Cluster.py +30 -3
- topologicpy/DGL.py +54 -32
- topologicpy/EnergyModel.py +16 -13
- topologicpy/Face.py +15 -1
- topologicpy/Graph.py +64 -66
- topologicpy/Helper.py +17 -2
- topologicpy/Honeybee.py +31 -19
- topologicpy/Neo4j.py +7 -4
- topologicpy/Plotly.py +72 -23
- topologicpy/Polyskel.py +7 -7
- topologicpy/Shell.py +24 -31
- topologicpy/Topology.py +59 -51
- topologicpy/Vector.py +19 -3
- topologicpy/Vertex.py +16 -3
- topologicpy/Wire.py +0 -1
- topologicpy/__init__.py +1 -1
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/METADATA +11 -1
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/RECORD +23 -23
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/LICENSE +0 -0
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/WHEEL +0 -0
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/top_level.txt +0 -0
topologicpy/Honeybee.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import subprocess
|
|
1
|
+
import os
|
|
3
2
|
|
|
4
3
|
try:
|
|
5
4
|
import honeybee.facetype
|
|
@@ -10,8 +9,11 @@ try:
|
|
|
10
9
|
from honeybee.aperture import Aperture as HBAperture
|
|
11
10
|
from honeybee.door import Door as HBDoor
|
|
12
11
|
except:
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
print("Honeybee - Installing required honeybee library.")
|
|
13
|
+
try:
|
|
14
|
+
os.system("pip install honeybee")
|
|
15
|
+
except:
|
|
16
|
+
os.system("pip install honeybee --user")
|
|
15
17
|
try:
|
|
16
18
|
import honeybee.facetype
|
|
17
19
|
from honeybee.face import Face as HBFace
|
|
@@ -21,8 +23,7 @@ except:
|
|
|
21
23
|
from honeybee.aperture import Aperture as HBAperture
|
|
22
24
|
from honeybee.door import Door as HBDoor
|
|
23
25
|
except:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
raise Exception("Honeybee - ERROR: Could not import honeybee")
|
|
26
27
|
|
|
27
28
|
try:
|
|
28
29
|
import honeybee_energy.lib.constructionsets as constr_set_lib
|
|
@@ -33,8 +34,11 @@ try:
|
|
|
33
34
|
from honeybee_energy.load.setpoint import Setpoint
|
|
34
35
|
from honeybee_energy.load.hotwater import ServiceHotWater
|
|
35
36
|
except:
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
print("Honeybee - Installing required honeybee-energy library.")
|
|
38
|
+
try:
|
|
39
|
+
os.system("pip install -U honeybee-energy[standards]")
|
|
40
|
+
except:
|
|
41
|
+
os.system("pip install -U honeybee-energy[standards] --user")
|
|
38
42
|
try:
|
|
39
43
|
import honeybee_energy.lib.constructionsets as constr_set_lib
|
|
40
44
|
import honeybee_energy.lib.programtypes as prog_type_lib
|
|
@@ -44,42 +48,50 @@ except:
|
|
|
44
48
|
from honeybee_energy.load.setpoint import Setpoint
|
|
45
49
|
from honeybee_energy.load.hotwater import ServiceHotWater
|
|
46
50
|
except:
|
|
47
|
-
|
|
51
|
+
raise Exception("Honeybee - Error: Could not import honeybee-energy")
|
|
48
52
|
|
|
49
53
|
try:
|
|
50
54
|
from honeybee_radiance.sensorgrid import SensorGrid
|
|
51
55
|
except:
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
print("Honeybee - Installing required honeybee-radiance library.")
|
|
57
|
+
try:
|
|
58
|
+
os.system("pip install -U honeybee-radiance")
|
|
59
|
+
except:
|
|
60
|
+
os.system("pip install -U honeybee-radiance --user")
|
|
54
61
|
try:
|
|
55
62
|
from honeybee_radiance.sensorgrid import SensorGrid
|
|
56
63
|
except:
|
|
57
|
-
|
|
64
|
+
raise Exception("Honeybee - Error: Could not import honeybee-radiance")
|
|
58
65
|
|
|
59
66
|
try:
|
|
60
67
|
from ladybug.dt import Time
|
|
61
68
|
except:
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
print("Honeybee - Installing required ladybug library.")
|
|
70
|
+
try:
|
|
71
|
+
os.system("pip install -U ladybug")
|
|
72
|
+
except:
|
|
73
|
+
os.system("pip install -U ladybug --user")
|
|
64
74
|
try:
|
|
65
75
|
from ladybug.dt import Time
|
|
66
76
|
except:
|
|
67
|
-
|
|
77
|
+
raise Exception("Honeybee - Error: Could not import ladybug")
|
|
68
78
|
|
|
69
79
|
try:
|
|
70
80
|
from ladybug_geometry.geometry3d.face import Face3D
|
|
71
81
|
from ladybug_geometry.geometry3d.pointvector import Point3D, Vector3D
|
|
72
82
|
except:
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
print("Honeybee - Installing required ladybug-geometry library.")
|
|
84
|
+
try:
|
|
85
|
+
os.system("pip install -U ladybug-geometry")
|
|
86
|
+
except:
|
|
87
|
+
os.system("pip install -U ladybug-geometry --user")
|
|
75
88
|
try:
|
|
76
89
|
from ladybug_geometry.geometry3d.face import Face3D
|
|
77
90
|
from ladybug_geometry.geometry3d.pointvector import Point3D, Vector3D
|
|
78
91
|
except:
|
|
79
|
-
|
|
92
|
+
raise Exception("Honeybee - Error: Could not import ladybug-geometry")
|
|
80
93
|
|
|
81
94
|
import json
|
|
82
|
-
from topologicpy.Dictionary import Dictionary
|
|
83
95
|
import topologic
|
|
84
96
|
|
|
85
97
|
class Honeybee:
|
topologicpy/Neo4j.py
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import topologic
|
|
2
2
|
import time
|
|
3
3
|
import random
|
|
4
|
-
import
|
|
4
|
+
import os
|
|
5
5
|
|
|
6
6
|
try:
|
|
7
7
|
import py2neo
|
|
8
8
|
from py2neo import NodeMatcher,RelationshipMatcher
|
|
9
9
|
from py2neo.data import spatial as sp
|
|
10
10
|
except:
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
print("Neo4j - Installing required py2neo library.")
|
|
12
|
+
try:
|
|
13
|
+
os.system("pip install py2neo")
|
|
14
|
+
except:
|
|
15
|
+
os.system("pip install py2neo --user")
|
|
13
16
|
try:
|
|
14
17
|
import py2neo
|
|
15
18
|
from py2neo import NodeMatcher,RelationshipMatcher
|
|
16
19
|
from py2neo.data import spatial as sp
|
|
17
20
|
except:
|
|
18
|
-
|
|
21
|
+
raise Exception("Neo4j - Error: Could not import py2neo")
|
|
19
22
|
|
|
20
23
|
class Neo4j:
|
|
21
24
|
|
topologicpy/Plotly.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import topologicpy
|
|
2
2
|
import topologic
|
|
3
|
-
|
|
4
|
-
import plotly.graph_objects as go
|
|
3
|
+
|
|
5
4
|
from topologicpy.Vertex import Vertex
|
|
6
5
|
from topologicpy.Edge import Edge
|
|
7
6
|
from topologicpy.Wire import Wire
|
|
@@ -10,7 +9,50 @@ from topologicpy.Cell import Cell
|
|
|
10
9
|
from topologicpy.CellComplex import CellComplex
|
|
11
10
|
from topologicpy.Cluster import Cluster
|
|
12
11
|
from topologicpy.Topology import Topology
|
|
13
|
-
import
|
|
12
|
+
import os
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
import numpy
|
|
16
|
+
except:
|
|
17
|
+
print("Plotly - Installing required numpy library.")
|
|
18
|
+
try:
|
|
19
|
+
os.system("pip install numpy")
|
|
20
|
+
except:
|
|
21
|
+
os.system("pip install numpy --user")
|
|
22
|
+
try:
|
|
23
|
+
import numpy
|
|
24
|
+
except:
|
|
25
|
+
raise Exception("Plotly - Error: Could not import numpy.")
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
import pandas as pd
|
|
29
|
+
except:
|
|
30
|
+
print("Plotly - Installing required pandas library.")
|
|
31
|
+
try:
|
|
32
|
+
os.system("pip install pandas")
|
|
33
|
+
except:
|
|
34
|
+
os.system("pip install pandas --user")
|
|
35
|
+
try:
|
|
36
|
+
import pandas as pd
|
|
37
|
+
except:
|
|
38
|
+
raise Exception("Plotly - Error: Could not import pandas.")
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
import plotly
|
|
42
|
+
import plotly.graph_objects as go
|
|
43
|
+
import plotly.offline as ofl
|
|
44
|
+
except:
|
|
45
|
+
print("Plotly - Installing required plotly library.")
|
|
46
|
+
try:
|
|
47
|
+
os.system("pip install plotly")
|
|
48
|
+
except:
|
|
49
|
+
os.system("pip install plotly --user")
|
|
50
|
+
try:
|
|
51
|
+
import plotly
|
|
52
|
+
import plotly.graph_objects as go
|
|
53
|
+
import plotly.offline as ofl
|
|
54
|
+
except:
|
|
55
|
+
raise Exception("Plotly - Error: Could not import plotly.")
|
|
14
56
|
|
|
15
57
|
class Plotly:
|
|
16
58
|
@staticmethod
|
|
@@ -168,7 +210,6 @@ class Plotly:
|
|
|
168
210
|
A pandas dataFrame
|
|
169
211
|
|
|
170
212
|
"""
|
|
171
|
-
import pandas as pd
|
|
172
213
|
|
|
173
214
|
if isinstance(data[labels[0]][0], int):
|
|
174
215
|
xAxis_list = list(range(1,data[labels[0]][0]+1))
|
|
@@ -837,7 +878,6 @@ class Plotly:
|
|
|
837
878
|
tp_faces = Topology.Faces(topology)
|
|
838
879
|
if not(tp_faces == None or tp_faces == []):
|
|
839
880
|
# rebuild faces to remove any degenerate faces
|
|
840
|
-
p = Topology.ByBREPPath("C:/Users/sarwj/Downloads/0119/aCellComplex.brep")
|
|
841
881
|
new_faces = []
|
|
842
882
|
for i, f in enumerate(tp_faces):
|
|
843
883
|
eb = Face.ExternalBoundary(f)
|
|
@@ -1382,7 +1422,7 @@ class Plotly:
|
|
|
1382
1422
|
names : list
|
|
1383
1423
|
The input list of names.
|
|
1384
1424
|
"""
|
|
1385
|
-
|
|
1425
|
+
|
|
1386
1426
|
import plotly.express as px
|
|
1387
1427
|
dlist = list(map(list, zip(*data)))
|
|
1388
1428
|
df = pd.DataFrame(dlist, columns=data['names'])
|
|
@@ -1412,8 +1452,7 @@ class Plotly:
|
|
|
1412
1452
|
|
|
1413
1453
|
width=950, height=500,
|
|
1414
1454
|
xAxis=False, yAxis=False, zAxis=False, axisSize=1, backgroundColor='rgba(0,0,0,0)',
|
|
1415
|
-
marginLeft=0, marginRight=0, marginTop=20, marginBottom=0,
|
|
1416
|
-
target=[0, 0, 0], up=[0, 0, 1], renderer="notebook", showScale=False,
|
|
1455
|
+
marginLeft=0, marginRight=0, marginTop=20, marginBottom=0, showScale=False,
|
|
1417
1456
|
|
|
1418
1457
|
cbValues=[], cbTicks=5, cbX=-0.15, cbWidth=15, cbOutlineWidth=0, cbTitle="",
|
|
1419
1458
|
cbSubTitle="", cbUnits="", colorScale="Viridis", mantissa=6, tolerance=0.0001):
|
|
@@ -1544,7 +1583,7 @@ class Plotly:
|
|
|
1544
1583
|
marginBottom : int , optional
|
|
1545
1584
|
The size in pixels of the bottom margin. The default value is 0.
|
|
1546
1585
|
camera : list , optional
|
|
1547
|
-
The desired location of the camera). The default is [
|
|
1586
|
+
The desired location of the camera). The default is [-1.25,-1.25,1.25].
|
|
1548
1587
|
center : list , optional
|
|
1549
1588
|
The desired center (camera target). The default is [0,0,0].
|
|
1550
1589
|
up : list , optional
|
|
@@ -1793,7 +1832,7 @@ class Plotly:
|
|
|
1793
1832
|
return True
|
|
1794
1833
|
|
|
1795
1834
|
@staticmethod
|
|
1796
|
-
def SetCamera(figure, camera=[1.25, 1.25, 1.25],
|
|
1835
|
+
def SetCamera(figure, camera=[-1.25, -1.25, 1.25], center=[0, 0, 0], up=[0, 0, 1], projection="perspective"):
|
|
1797
1836
|
"""
|
|
1798
1837
|
Sets the camera for the input figure.
|
|
1799
1838
|
|
|
@@ -1802,11 +1841,13 @@ class Plotly:
|
|
|
1802
1841
|
figure : plotly.graph_objs._figure.Figure
|
|
1803
1842
|
The input plotly figure.
|
|
1804
1843
|
camera : list , optional
|
|
1805
|
-
The desired location of the camera. The default is [
|
|
1806
|
-
|
|
1807
|
-
The desired camera target. The default is [0,0,0].
|
|
1844
|
+
The desired location of the camera. The default is [-1.25,-1.25,1.25].
|
|
1845
|
+
center : list , optional
|
|
1846
|
+
The desired center (camera target). The default is [0,0,0].
|
|
1808
1847
|
up : list , optional
|
|
1809
1848
|
The desired up vector. The default is [0,0,1].
|
|
1849
|
+
projection : str , optional
|
|
1850
|
+
The desired type of projection. The options are "orthographic" or "perspective". It is case insensitive. The default is "perspective"
|
|
1810
1851
|
|
|
1811
1852
|
Returns
|
|
1812
1853
|
-------
|
|
@@ -1815,21 +1856,27 @@ class Plotly:
|
|
|
1815
1856
|
|
|
1816
1857
|
"""
|
|
1817
1858
|
if not isinstance(camera, list):
|
|
1818
|
-
camera = [1.25, 1.25, 1.25]
|
|
1819
|
-
if not isinstance(
|
|
1820
|
-
|
|
1859
|
+
camera = [-1.25, -1.25, 1.25]
|
|
1860
|
+
if not isinstance(center, list):
|
|
1861
|
+
center = [0,0,0]
|
|
1821
1862
|
if not isinstance(up, list):
|
|
1822
1863
|
up = [0,0,1]
|
|
1864
|
+
projection = projection.lower()
|
|
1865
|
+
if projection in "orthographic":
|
|
1866
|
+
projection = "orthographic"
|
|
1867
|
+
else:
|
|
1868
|
+
projection = "perspective"
|
|
1823
1869
|
scene_camera = dict(
|
|
1824
1870
|
up=dict(x=up[0], y=up[1], z=up[2]),
|
|
1825
1871
|
eye=dict(x=camera[0], y=camera[1], z=camera[2]),
|
|
1826
|
-
center=dict(x=
|
|
1872
|
+
center=dict(x=center[0], y=center[1], z=center[2]),
|
|
1873
|
+
projection=dict(type=projection)
|
|
1827
1874
|
)
|
|
1828
1875
|
figure.update_layout(scene_camera=scene_camera)
|
|
1829
1876
|
return figure
|
|
1830
1877
|
|
|
1831
1878
|
@staticmethod
|
|
1832
|
-
def Show(figure, camera=[-1.25, -1.25, 1.25],
|
|
1879
|
+
def Show(figure, camera=[-1.25, -1.25, 1.25], center=[0, 0, 0], up=[0, 0, 1], renderer="notebook", projection="perspective"):
|
|
1833
1880
|
"""
|
|
1834
1881
|
Shows the input figure.
|
|
1835
1882
|
|
|
@@ -1839,12 +1886,15 @@ class Plotly:
|
|
|
1839
1886
|
The input plotly figure.
|
|
1840
1887
|
camera : list , optional
|
|
1841
1888
|
The desired location of the camera. The default is [0,0,0].
|
|
1842
|
-
|
|
1843
|
-
The desired camera target. The default is [0,0,0].
|
|
1889
|
+
center : list , optional
|
|
1890
|
+
The desired center (camera target). The default is [0,0,0].
|
|
1844
1891
|
up : list , optional
|
|
1845
1892
|
The desired up vector. The default is [0,0,1].
|
|
1846
1893
|
renderer : str , optional
|
|
1847
1894
|
The desired rendered. See Plotly.Renderers(). The default is "notebook".
|
|
1895
|
+
projection : str, optional
|
|
1896
|
+
The desired type of projection. The options are "orthographic" or "perspective". It is case insensitive. The default is "perspective"
|
|
1897
|
+
|
|
1848
1898
|
|
|
1849
1899
|
Returns
|
|
1850
1900
|
-------
|
|
@@ -1860,10 +1910,9 @@ class Plotly:
|
|
|
1860
1910
|
if not renderer.lower() in Plotly.Renderers():
|
|
1861
1911
|
print("Plotly.Show - Error: The input renderer is not in the approved list of renderers. Returning None.")
|
|
1862
1912
|
return None
|
|
1863
|
-
if not camera == None and not
|
|
1864
|
-
figure = Plotly.SetCamera(figure, camera=camera,
|
|
1913
|
+
if not camera == None and not center == None and not up == None:
|
|
1914
|
+
figure = Plotly.SetCamera(figure, camera=camera, center=center, up=up, projection=projection)
|
|
1865
1915
|
if renderer.lower() == "offline":
|
|
1866
|
-
import plotly.offline as ofl
|
|
1867
1916
|
ofl.plot(figure)
|
|
1868
1917
|
else:
|
|
1869
1918
|
figure.show(renderer=renderer)
|
topologicpy/Polyskel.py
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
|
|
4
2
|
import logging
|
|
5
3
|
import heapq
|
|
6
4
|
from itertools import *
|
|
7
5
|
from collections import namedtuple
|
|
8
|
-
import
|
|
9
|
-
import subprocess
|
|
6
|
+
import os
|
|
10
7
|
|
|
11
8
|
try:
|
|
12
9
|
from euclid3 import *
|
|
13
10
|
except:
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
print("Polyskel - Installing required euclid3 library.")
|
|
12
|
+
try:
|
|
13
|
+
os.system("pip install euclid3")
|
|
14
|
+
except:
|
|
15
|
+
os.system("pip install euclid3 --user")
|
|
16
16
|
try:
|
|
17
17
|
from euclid3 import *
|
|
18
18
|
except:
|
|
19
|
-
|
|
19
|
+
raise Exception("Polyskel - ERROR: Could not import euclid3.")
|
|
20
20
|
|
|
21
21
|
log = logging.getLogger("__name__")
|
|
22
22
|
|
topologicpy/Shell.py
CHANGED
|
@@ -3,17 +3,35 @@ import topologicpy
|
|
|
3
3
|
import topologic
|
|
4
4
|
from topologicpy.Topology import Topology
|
|
5
5
|
import math
|
|
6
|
-
import
|
|
7
|
-
import subprocess
|
|
6
|
+
import os
|
|
8
7
|
try:
|
|
9
8
|
from tqdm.auto import tqdm
|
|
10
9
|
except:
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
print("Shell - Installing required tqdm library.")
|
|
11
|
+
try:
|
|
12
|
+
os.system("pip install tqdm")
|
|
13
|
+
except:
|
|
14
|
+
os.system("pip install tqdm --user")
|
|
13
15
|
try:
|
|
14
16
|
from tqdm.auto import tqdm
|
|
17
|
+
print("Shell - tqdm library installed correctly.")
|
|
15
18
|
except:
|
|
16
|
-
|
|
19
|
+
raise Exception("Shell - Error: Could not import tqdm.")
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
from scipy.spatial import Delaunay
|
|
23
|
+
from scipy.spatial import Voronoi
|
|
24
|
+
except:
|
|
25
|
+
print("Shell - Install required scipy library.")
|
|
26
|
+
try:
|
|
27
|
+
os.system("pip install scipy")
|
|
28
|
+
except:
|
|
29
|
+
os.system("pip install scipy --user")
|
|
30
|
+
try:
|
|
31
|
+
from scipy.spatial import Delaunay
|
|
32
|
+
from scipy.spatial import Voronoi
|
|
33
|
+
except:
|
|
34
|
+
raise Exception("Shell - Error: Could not import scipy.")
|
|
17
35
|
|
|
18
36
|
class Shell(Topology):
|
|
19
37
|
@staticmethod
|
|
@@ -462,19 +480,7 @@ class Shell(Topology):
|
|
|
462
480
|
from topologicpy.Topology import Topology
|
|
463
481
|
from topologicpy.Dictionary import Dictionary
|
|
464
482
|
from random import sample
|
|
465
|
-
|
|
466
|
-
import subprocess
|
|
467
|
-
|
|
468
|
-
try:
|
|
469
|
-
from scipy.spatial import Delaunay
|
|
470
|
-
except:
|
|
471
|
-
call = [sys.executable, '-m', 'pip', 'install', 'scipy', '-t', sys.path[0]]
|
|
472
|
-
subprocess.run(call)
|
|
473
|
-
try:
|
|
474
|
-
from scipy.spatial import Delaunay
|
|
475
|
-
except:
|
|
476
|
-
print("Shell.Delaunay - ERROR: Could not import scipy. Returning None.")
|
|
477
|
-
return None
|
|
483
|
+
|
|
478
484
|
|
|
479
485
|
if not isinstance(vertices, list):
|
|
480
486
|
return None
|
|
@@ -1774,19 +1780,6 @@ class Shell(Topology):
|
|
|
1774
1780
|
from topologicpy.Cluster import Cluster
|
|
1775
1781
|
from topologicpy.Topology import Topology
|
|
1776
1782
|
from topologicpy.Dictionary import Dictionary
|
|
1777
|
-
import sys
|
|
1778
|
-
import subprocess
|
|
1779
|
-
|
|
1780
|
-
try:
|
|
1781
|
-
from scipy.spatial import Voronoi
|
|
1782
|
-
except:
|
|
1783
|
-
call = [sys.executable, '-m', 'pip', 'install', 'scipy', '-t', sys.path[0]]
|
|
1784
|
-
subprocess.run(call)
|
|
1785
|
-
try:
|
|
1786
|
-
from scipy.spatial import Voronoi
|
|
1787
|
-
except:
|
|
1788
|
-
print("Shell.Voronoi - ERROR: Could not import scipy. Returning None.")
|
|
1789
|
-
return None
|
|
1790
1783
|
|
|
1791
1784
|
if not isinstance(face, topologic.Face):
|
|
1792
1785
|
cluster = Cluster.ByTopologies(vertices)
|
topologicpy/Topology.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
#from base64 import b16encode
|
|
2
|
-
#from tkinter import N
|
|
3
1
|
import topologicpy
|
|
4
2
|
import topologic
|
|
5
3
|
from topologicpy.Aperture import Aperture
|
|
@@ -8,14 +6,59 @@ from topologicpy.Dictionary import Dictionary
|
|
|
8
6
|
import uuid
|
|
9
7
|
import json
|
|
10
8
|
import os
|
|
11
|
-
import numpy as np
|
|
12
|
-
from numpy import arctan, pi, signbit
|
|
13
|
-
from numpy.linalg import norm
|
|
14
|
-
import math
|
|
15
9
|
|
|
10
|
+
import math
|
|
16
11
|
from collections import namedtuple
|
|
17
12
|
from multiprocessing import Process, Queue
|
|
18
13
|
|
|
14
|
+
try:
|
|
15
|
+
import numpy as np
|
|
16
|
+
from numpy import arctan, pi, signbit
|
|
17
|
+
from numpy.linalg import norm
|
|
18
|
+
except:
|
|
19
|
+
print("Topology - Installing required numpy library.")
|
|
20
|
+
try:
|
|
21
|
+
os.system("pip install numpy")
|
|
22
|
+
except:
|
|
23
|
+
os.system("pip install numpy --user")
|
|
24
|
+
try:
|
|
25
|
+
import numpy as np
|
|
26
|
+
from numpy import arctan, pi, signbit
|
|
27
|
+
from numpy.linalg import norm
|
|
28
|
+
print("Topology - numpy library installed successfully.")
|
|
29
|
+
except:
|
|
30
|
+
raise Exception("Topology - Error: Could not import numpy.")
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
import ifcopenshell
|
|
34
|
+
import ifcopenshell.geom
|
|
35
|
+
except:
|
|
36
|
+
print("Topology - Installing required ifcopenshell library.")
|
|
37
|
+
try:
|
|
38
|
+
os.system("pip install ifcopenshell")
|
|
39
|
+
except:
|
|
40
|
+
os.system("pip install ifcopenshell --user")
|
|
41
|
+
try:
|
|
42
|
+
import ifcopenshell
|
|
43
|
+
import ifcopenshell.geom
|
|
44
|
+
print("Topology - ifcopenshell library installed successfully.")
|
|
45
|
+
except:
|
|
46
|
+
raise Exception("Topology - Error: Could not import ifcopenshell.")
|
|
47
|
+
|
|
48
|
+
try:
|
|
49
|
+
from scipy.spatial import ConvexHull
|
|
50
|
+
except:
|
|
51
|
+
print("Topology - Installing required scipy library.")
|
|
52
|
+
try:
|
|
53
|
+
os.system("pip install scipy")
|
|
54
|
+
except:
|
|
55
|
+
os.system("pip install scipy --user")
|
|
56
|
+
try:
|
|
57
|
+
from scipy.spatial import ConvexHull
|
|
58
|
+
print("Topology - scipy library installed successfully.")
|
|
59
|
+
except:
|
|
60
|
+
raise Exception ("Topology - Error: Could not import scipy.")
|
|
61
|
+
|
|
19
62
|
QueueItem = namedtuple('QueueItem', ['ID', 'sinkKeys', 'sinkValues'])
|
|
20
63
|
SinkItem = namedtuple('SinkItem', ['ID', 'sink_str'])
|
|
21
64
|
|
|
@@ -1463,20 +1506,7 @@ class Topology():
|
|
|
1463
1506
|
from topologicpy.Cluster import Cluster
|
|
1464
1507
|
from topologicpy.Dictionary import Dictionary
|
|
1465
1508
|
import uuid
|
|
1466
|
-
|
|
1467
|
-
import subprocess
|
|
1468
|
-
|
|
1469
|
-
try:
|
|
1470
|
-
import ifcopenshell
|
|
1471
|
-
import ifcopenshell.geom
|
|
1472
|
-
except:
|
|
1473
|
-
call = [sys.executable, '-m', 'pip', 'install', 'ifcopenshell', '-t', sys.path[0]]
|
|
1474
|
-
subprocess.run(call)
|
|
1475
|
-
try:
|
|
1476
|
-
import ifcopenshell
|
|
1477
|
-
import ifcopenshell.geom
|
|
1478
|
-
except:
|
|
1479
|
-
print("Topology.ByIFCFile - ERROR: Could not import ifcopenshell")
|
|
1509
|
+
|
|
1480
1510
|
if not file:
|
|
1481
1511
|
print("Topology.ByIFCFile - Error: the input file parameter is not a valid file. Returning None.")
|
|
1482
1512
|
return None
|
|
@@ -1538,18 +1568,6 @@ class Topology():
|
|
|
1538
1568
|
The created list of topologies.
|
|
1539
1569
|
|
|
1540
1570
|
"""
|
|
1541
|
-
import sys, subprocess
|
|
1542
|
-
try:
|
|
1543
|
-
import ifcopenshell
|
|
1544
|
-
import ifcopenshell.geom
|
|
1545
|
-
except:
|
|
1546
|
-
call = [sys.executable, '-m', 'pip', 'install', 'ifcopenshell', '-t', sys.path[0]]
|
|
1547
|
-
subprocess.run(call)
|
|
1548
|
-
try:
|
|
1549
|
-
import ifcopenshell
|
|
1550
|
-
import ifcopenshell.geom
|
|
1551
|
-
except:
|
|
1552
|
-
print("Topology.ByIFCPath - ERROR: Could not import ifcopenshell")
|
|
1553
1571
|
|
|
1554
1572
|
if not path:
|
|
1555
1573
|
print("Topology.ByIFCPath - Error: the input path parameter is not a valid path. Returning None.")
|
|
@@ -2719,20 +2737,7 @@ class Topology():
|
|
|
2719
2737
|
from topologicpy.Face import Face
|
|
2720
2738
|
from topologicpy.Shell import Shell
|
|
2721
2739
|
from topologicpy.Cell import Cell
|
|
2722
|
-
from topologicpy.Cluster import Cluster
|
|
2723
|
-
import sys
|
|
2724
|
-
import subprocess
|
|
2725
|
-
|
|
2726
|
-
try:
|
|
2727
|
-
from scipy.spatial import ConvexHull
|
|
2728
|
-
except:
|
|
2729
|
-
call = [sys.executable, '-m', 'pip', 'install', 'scipy', '-t', sys.path[0]]
|
|
2730
|
-
subprocess.run(call)
|
|
2731
|
-
try:
|
|
2732
|
-
from scipy.spatial import ConvexHull
|
|
2733
|
-
except:
|
|
2734
|
-
print("Topology.ConvexHull - Error: Could not import scipy. Returning None.")
|
|
2735
|
-
return None
|
|
2740
|
+
from topologicpy.Cluster import Cluster
|
|
2736
2741
|
|
|
2737
2742
|
def convexHull3D(item, tolerance, option):
|
|
2738
2743
|
if item:
|
|
@@ -4617,7 +4622,6 @@ class Topology():
|
|
|
4617
4622
|
from topologicpy.Cell import Cell
|
|
4618
4623
|
from topologicpy.CellComplex import CellComplex
|
|
4619
4624
|
from topologicpy.Cluster import Cluster
|
|
4620
|
-
import numpy as np
|
|
4621
4625
|
|
|
4622
4626
|
if not isinstance(topology, topologic.Topology):
|
|
4623
4627
|
print("Topology.RemoveCoplanarFace - Error: The input topology parameter is not a valid topologic topology. Returning None.")
|
|
@@ -5006,7 +5010,6 @@ class Topology():
|
|
|
5006
5010
|
|
|
5007
5011
|
"""
|
|
5008
5012
|
from topologicpy.Vertex import Vertex
|
|
5009
|
-
import numpy as np
|
|
5010
5013
|
|
|
5011
5014
|
def rotate_vertex_3d(vertex, axis, angle_degrees, origin):
|
|
5012
5015
|
vertex = np.array(vertex) # Vertex to be rotated
|
|
@@ -5436,7 +5439,7 @@ class Topology():
|
|
|
5436
5439
|
width=950, height=500,
|
|
5437
5440
|
xAxis=False, yAxis=False, zAxis=False, axisSize=1, backgroundColor='rgba(0,0,0,0)',
|
|
5438
5441
|
marginLeft=0, marginRight=0, marginTop=20, marginBottom=0, camera=[-1.25, -1.25, 1.25],
|
|
5439
|
-
|
|
5442
|
+
center=[0, 0, 0], up=[0, 0, 1], projection="perspective", renderer="notebook", showScale=False,
|
|
5440
5443
|
|
|
5441
5444
|
cbValues=[], cbTicks=5, cbX=-0.15, cbWidth=15, cbOutlineWidth=0, cbTitle="",
|
|
5442
5445
|
cbSubTitle="", cbUnits="", colorScale="Viridis", mantissa=6, tolerance=0.0001):
|
|
@@ -5567,11 +5570,13 @@ class Topology():
|
|
|
5567
5570
|
marginBottom : int , optional
|
|
5568
5571
|
The size in pixels of the bottom margin. The default value is 0.
|
|
5569
5572
|
camera : list , optional
|
|
5570
|
-
The desired location of the camera). The default is [
|
|
5573
|
+
The desired location of the camera). The default is [-1.25,-1.25,1.25].
|
|
5571
5574
|
center : list , optional
|
|
5572
5575
|
The desired center (camera target). The default is [0,0,0].
|
|
5573
5576
|
up : list , optional
|
|
5574
5577
|
The desired up vector. The default is [0,0,1].
|
|
5578
|
+
projection : str , optional
|
|
5579
|
+
The desired type of projection. The options are "orthographic" or "perspective". It is case insensitive. The default is "perspective"
|
|
5575
5580
|
renderer : str , optional
|
|
5576
5581
|
The desired renderer. See Plotly.Renderers(). The default is "notebook".
|
|
5577
5582
|
intensityKey : str , optional
|
|
@@ -5610,11 +5615,14 @@ class Topology():
|
|
|
5610
5615
|
from topologicpy.Cluster import Cluster
|
|
5611
5616
|
from topologicpy.Plotly import Plotly
|
|
5612
5617
|
from topologicpy.Helper import Helper
|
|
5618
|
+
from topologicpy.Graph import Graph
|
|
5613
5619
|
|
|
5614
5620
|
if isinstance(topologies, tuple):
|
|
5615
5621
|
topologies = Helper.Flatten(list(topologies))
|
|
5616
5622
|
if isinstance(topologies, list):
|
|
5617
5623
|
new_topologies = [t for t in topologies if isinstance(t, topologic.Topology)]
|
|
5624
|
+
graphs = [Graph.Topology(g) for g in topologies if isinstance(g, topologic.Graph)]
|
|
5625
|
+
new_topologies += graphs
|
|
5618
5626
|
if len(new_topologies) == 0:
|
|
5619
5627
|
print("Topology.Show - Error: the input topologies parameter does not contain any valid topology. Returning None.")
|
|
5620
5628
|
return None
|
|
@@ -5650,7 +5658,7 @@ class Topology():
|
|
|
5650
5658
|
tolerance=tolerance)
|
|
5651
5659
|
if showScale:
|
|
5652
5660
|
figure = Plotly.AddColorBar(figure, values=cbValues, nTicks=cbTicks, xPosition=cbX, width=cbWidth, outlineWidth=cbOutlineWidth, title=cbTitle, subTitle=cbSubTitle, units=cbUnits, colorScale=colorScale, mantissa=mantissa)
|
|
5653
|
-
Plotly.Show(figure=figure, renderer=renderer, camera=camera,
|
|
5661
|
+
Plotly.Show(figure=figure, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
|
|
5654
5662
|
|
|
5655
5663
|
@staticmethod
|
|
5656
5664
|
def SortBySelectors(topologies, selectors, exclusive=False, tolerance=0.0001):
|
topologicpy/Vector.py
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
import numpy.linalg as la
|
|
3
|
-
from numpy import pi, arctan2, rad2deg
|
|
4
1
|
import math
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
import numpy as np
|
|
6
|
+
import numpy.linalg as la
|
|
7
|
+
from numpy import pi, arctan2, rad2deg
|
|
8
|
+
except:
|
|
9
|
+
print("Vector - Installing required numpy library.")
|
|
10
|
+
try:
|
|
11
|
+
os.system("pip install numpy")
|
|
12
|
+
except:
|
|
13
|
+
os.system("pip install numpy --user")
|
|
14
|
+
try:
|
|
15
|
+
import numpy as np
|
|
16
|
+
import numpy.linalg as la
|
|
17
|
+
from numpy import pi, arctan2, rad2deg
|
|
18
|
+
print("Vector - numpy library installed successfully.")
|
|
19
|
+
except:
|
|
20
|
+
raise Exception("Vector - Error: Could not import numpy.")
|
|
5
21
|
|
|
6
22
|
class Vector(list):
|
|
7
23
|
@staticmethod
|