topologicpy 0.7.66__py3-none-any.whl → 0.7.68__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 +6 -4
- topologicpy/CellComplex.py +2 -20
- topologicpy/Cluster.py +41 -66
- topologicpy/Edge.py +1 -1
- topologicpy/EnergyModel.py +4 -4
- topologicpy/Face.py +28 -36
- topologicpy/Graph.py +111 -169
- topologicpy/Grid.py +2 -3
- topologicpy/Honeybee.py +6 -9
- topologicpy/Plotly.py +29 -6
- topologicpy/Shell.py +10 -13
- topologicpy/Topology.py +137 -123
- topologicpy/Vertex.py +3 -6
- topologicpy/Wire.py +16 -15
- topologicpy/version.py +1 -1
- {topologicpy-0.7.66.dist-info → topologicpy-0.7.68.dist-info}/METADATA +1 -1
- topologicpy-0.7.68.dist-info/RECORD +36 -0
- topologicpy-0.7.66.dist-info/RECORD +0 -36
- {topologicpy-0.7.66.dist-info → topologicpy-0.7.68.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.66.dist-info → topologicpy-0.7.68.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.66.dist-info → topologicpy-0.7.68.dist-info}/top_level.txt +0 -0
topologicpy/Plotly.py
CHANGED
@@ -370,6 +370,7 @@ class Plotly:
|
|
370
370
|
from topologicpy.Dictionary import Dictionary
|
371
371
|
from topologicpy.Topology import Topology
|
372
372
|
from topologicpy.Graph import Graph
|
373
|
+
from topologicpy.Color import Color
|
373
374
|
import plotly.graph_objs as go
|
374
375
|
|
375
376
|
if not Topology.IsInstance(graph, "Graph"):
|
@@ -377,6 +378,7 @@ class Plotly:
|
|
377
378
|
v_labels = []
|
378
379
|
v_groupList = []
|
379
380
|
data = []
|
381
|
+
|
380
382
|
if showVertices:
|
381
383
|
vertices = Graph.Vertices(graph)
|
382
384
|
if vertexLabelKey or vertexGroupKey:
|
@@ -454,7 +456,7 @@ class Plotly:
|
|
454
456
|
if Topology.IsInstance(arc, "Wire"):
|
455
457
|
arc_edges = Topology.Edges(arc)
|
456
458
|
for arc_edge in arc_edges:
|
457
|
-
arc_edge = Topology.SetDictionary(arc_edge, d, silent=
|
459
|
+
arc_edge = Topology.SetDictionary(arc_edge, d, silent=True)
|
458
460
|
new_edges.append(arc_edge)
|
459
461
|
else:
|
460
462
|
new_edges.append(edge)
|
@@ -473,9 +475,14 @@ class Plotly:
|
|
473
475
|
d = Topology.Dictionary(e)
|
474
476
|
if d:
|
475
477
|
if not edgeLabelKey == None:
|
476
|
-
e_label = str(Dictionary.ValueAtKey(d, key=edgeLabelKey))
|
478
|
+
e_label = str(Dictionary.ValueAtKey(d, key=edgeLabelKey))
|
479
|
+
if e_label == None:
|
480
|
+
e_label = ""
|
477
481
|
if not edgeGroupKey == None:
|
478
|
-
|
482
|
+
if edgeGroupKey:
|
483
|
+
e_group = Dictionary.ValueAtKey(d, key=edgeGroupKey)
|
484
|
+
if e_group == None:
|
485
|
+
e_group = ""
|
479
486
|
try:
|
480
487
|
e_groupList.append(edgeGroups.index(e_group))
|
481
488
|
except:
|
@@ -491,6 +498,7 @@ class Plotly:
|
|
491
498
|
Ye+=[Vertex.Y(sv, mantissa=mantissa), Vertex.Y(ev, mantissa=mantissa), None] # y-coordinates of edge ends
|
492
499
|
Ze+=[Vertex.Z(sv, mantissa=mantissa), Vertex.Z(ev, mantissa=mantissa), None] # z-coordinates of edge ends
|
493
500
|
|
501
|
+
|
494
502
|
if len(list(set(e_groupList))) < 2:
|
495
503
|
e_groupList = edgeColor
|
496
504
|
if len(e_labels) < 1:
|
@@ -500,6 +508,19 @@ class Plotly:
|
|
500
508
|
mode = "lines+text"
|
501
509
|
else:
|
502
510
|
mode = "lines"
|
511
|
+
|
512
|
+
final_categories = edgeColor # Start with the default edgeColor
|
513
|
+
if len(edgeGroups) > 0:
|
514
|
+
# Normalize categories to a range between 0 and 1 for the color scale
|
515
|
+
min_category = 0
|
516
|
+
max_category = max(len(edgeGroups), 1)
|
517
|
+
normalized_categories = [(cat - min_category) / (max_category - min_category) for cat in e_groupList]
|
518
|
+
|
519
|
+
final_categories = []
|
520
|
+
for c in normalized_categories:
|
521
|
+
color = Color.ByValueInRange(c, minValue=0, maxValue=1, colorScale=colorScale)
|
522
|
+
color = "rgb("+str(color[0])+","+str(color[1])+","+str(color[2])+")"
|
523
|
+
final_categories.append(color)
|
503
524
|
e_trace=go.Scatter3d(x=Xe,
|
504
525
|
y=Ye,
|
505
526
|
z=Ze,
|
@@ -508,12 +529,12 @@ class Plotly:
|
|
508
529
|
legendgroup=5,
|
509
530
|
legendrank=5,
|
510
531
|
showlegend=showEdgeLegend,
|
511
|
-
line=dict(color=
|
532
|
+
line=dict(color=final_categories, colorscale=Plotly.ColorScale(colorScale), cmin=0, cmax=1, width=edgeWidth),
|
512
533
|
text=e_labels,
|
513
534
|
hoverinfo='text'
|
514
535
|
)
|
515
536
|
data.append(e_trace)
|
516
|
-
|
537
|
+
|
517
538
|
return data
|
518
539
|
|
519
540
|
@staticmethod
|
@@ -932,6 +953,8 @@ class Plotly:
|
|
932
953
|
data = []
|
933
954
|
v_list = []
|
934
955
|
|
956
|
+
if not isinstance(colorScale, str):
|
957
|
+
colorScale = "viridis"
|
935
958
|
if Topology.Type(topology) == Topology.TypeID("Vertex"):
|
936
959
|
tp_vertices = [topology]
|
937
960
|
else:
|
@@ -1020,7 +1043,7 @@ class Plotly:
|
|
1020
1043
|
d = Topology.Dictionary(tp_face)
|
1021
1044
|
f_dictionaries.append(d)
|
1022
1045
|
if d:
|
1023
|
-
|
1046
|
+
tri = Topology.SetDictionary(tri, d)
|
1024
1047
|
all_triangles.append(tri)
|
1025
1048
|
if len(all_triangles) > 0:
|
1026
1049
|
f_cluster = Cluster.ByTopologies(all_triangles)
|
topologicpy/Shell.py
CHANGED
@@ -182,7 +182,7 @@ class Shell():
|
|
182
182
|
|
183
183
|
shell = Topology.Slice(internalBoundary, skeleton_cluster, tolerance=tolerance)
|
184
184
|
if mergeJunctions == True:
|
185
|
-
vertices =
|
185
|
+
vertices = Topology.Vertices(shell)
|
186
186
|
centers = []
|
187
187
|
used = []
|
188
188
|
for v in vertices:
|
@@ -264,7 +264,7 @@ class Shell():
|
|
264
264
|
s = Topology.InternalVertex(f, tolerance=tolerance)
|
265
265
|
s = Topology.SetDictionary(s, d)
|
266
266
|
selectors.append(s)
|
267
|
-
|
267
|
+
shell = Topology.TransferDictionariesBySelectors(topology=shell, selectors=selectors, tranFaces=True, tolerance=tolerance)
|
268
268
|
return shell
|
269
269
|
return None
|
270
270
|
|
@@ -330,8 +330,7 @@ class Shell():
|
|
330
330
|
|
331
331
|
if not Topology.IsInstance(cluster, "Cluster"):
|
332
332
|
return None
|
333
|
-
faces =
|
334
|
-
_ = cluster.Faces(None, faces)
|
333
|
+
faces = Topology.Faces(cluster)
|
335
334
|
return Shell.ByFaces(faces, tolerance=tolerance)
|
336
335
|
|
337
336
|
@staticmethod
|
@@ -619,7 +618,7 @@ class Shell():
|
|
619
618
|
origin = Topology.Centroid(face)
|
620
619
|
normal = Face.Normal(face, mantissa=mantissa)
|
621
620
|
flatFace = Topology.Flatten(face, origin=origin, direction=normal)
|
622
|
-
faceVertices =
|
621
|
+
faceVertices = Topology.Vertices(face)
|
623
622
|
vertices += faceVertices
|
624
623
|
|
625
624
|
# Create a cluster of the input vertices
|
@@ -628,7 +627,7 @@ class Shell():
|
|
628
627
|
# Flatten the cluster using the same transformations
|
629
628
|
verticesCluster = Topology.Flatten(verticesCluster, origin=origin, direction=normal)
|
630
629
|
|
631
|
-
vertices =
|
630
|
+
vertices = Topology.Vertices(verticesCluster)
|
632
631
|
points = []
|
633
632
|
for v in vertices:
|
634
633
|
points.append([Vertex.X(v, mantissa=mantissa), Vertex.Y(v, mantissa=mantissa)])
|
@@ -682,7 +681,7 @@ class Shell():
|
|
682
681
|
if not Topology.IsInstance(shell, "Shell"):
|
683
682
|
return None
|
684
683
|
edges = []
|
685
|
-
_ = shell.Edges(None, edges)
|
684
|
+
_ = shell.Edges(None, edges) # Hook to Core
|
686
685
|
return edges
|
687
686
|
|
688
687
|
@staticmethod
|
@@ -708,12 +707,10 @@ class Shell():
|
|
708
707
|
|
709
708
|
if not Topology.IsInstance(shell, "Shell"):
|
710
709
|
return None
|
711
|
-
edges =
|
712
|
-
_ = shell.Edges(None, edges)
|
710
|
+
edges = Topology.Edges(shell)
|
713
711
|
obEdges = []
|
714
712
|
for anEdge in edges:
|
715
|
-
faces =
|
716
|
-
_ = anEdge.Faces(shell, faces)
|
713
|
+
faces = Topology.SuperTopologies(anEdge, shell, topologyType="face")
|
717
714
|
if len(faces) == 1:
|
718
715
|
obEdges.append(anEdge)
|
719
716
|
return Topology.SelfMerge(Cluster.ByTopologies(obEdges), tolerance=tolerance)
|
@@ -1748,7 +1745,7 @@ class Shell():
|
|
1748
1745
|
if isinstance(wire, list):
|
1749
1746
|
points = wire
|
1750
1747
|
else:
|
1751
|
-
points =
|
1748
|
+
points = Topology.Vertices(wire)
|
1752
1749
|
# points.insert(0, points.pop())
|
1753
1750
|
if len(points) <= 2:
|
1754
1751
|
return points
|
@@ -1937,7 +1934,7 @@ class Shell():
|
|
1937
1934
|
points.append([Vertex.X(flatVertex, mantissa=mantissa), Vertex.Y(flatVertex, mantissa=mantissa)])
|
1938
1935
|
|
1939
1936
|
br = Wire.BoundingRectangle(flatFace)
|
1940
|
-
br_vertices =
|
1937
|
+
br_vertices = Topology.Vertices(br)
|
1941
1938
|
br_x = []
|
1942
1939
|
br_y = []
|
1943
1940
|
for br_v in br_vertices:
|