topologicpy 0.7.67__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 +78 -17
- topologicpy/Grid.py +2 -3
- topologicpy/Honeybee.py +6 -9
- topologicpy/Plotly.py +27 -6
- topologicpy/Shell.py +10 -13
- topologicpy/Topology.py +103 -107
- topologicpy/Vertex.py +3 -6
- topologicpy/Wire.py +16 -15
- topologicpy/version.py +1 -1
- {topologicpy-0.7.67.dist-info → topologicpy-0.7.68.dist-info}/METADATA +1 -1
- topologicpy-0.7.68.dist-info/RECORD +36 -0
- topologicpy-0.7.67.dist-info/RECORD +0 -36
- {topologicpy-0.7.67.dist-info → topologicpy-0.7.68.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.67.dist-info → topologicpy-0.7.68.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.67.dist-info → topologicpy-0.7.68.dist-info}/top_level.txt +0 -0
topologicpy/Graph.py
CHANGED
@@ -575,7 +575,7 @@ class Graph:
|
|
575
575
|
return graph
|
576
576
|
graph_vertices = Graph.Vertices(graph)
|
577
577
|
graph_edges = Graph.Edges(graph, graph_vertices, tolerance)
|
578
|
-
vertices =
|
578
|
+
vertices = Topology.Vertices(edge)
|
579
579
|
new_vertices = []
|
580
580
|
for vertex in vertices:
|
581
581
|
graph_vertices, nv = addIfUnique(graph_vertices, vertex, tolerance)
|
@@ -623,7 +623,7 @@ class Graph:
|
|
623
623
|
if not silent:
|
624
624
|
print("Graph.AddVertex - Error: The input vertex is not a valid vertex. Returning the input graph.")
|
625
625
|
return graph
|
626
|
-
_ = graph.AddVertices([vertex], tolerance) # Hook to
|
626
|
+
_ = graph.AddVertices([vertex], tolerance) # Hook to Core
|
627
627
|
return graph
|
628
628
|
|
629
629
|
@staticmethod
|
@@ -663,7 +663,7 @@ class Graph:
|
|
663
663
|
if not silent:
|
664
664
|
print("Graph.AddVertices - Error: Could not find any valid vertices in the input list of vertices. Returning None.")
|
665
665
|
return None
|
666
|
-
_ = graph.AddVertices(vertices, tolerance) # Hook to
|
666
|
+
_ = graph.AddVertices(vertices, tolerance) # Hook to Core
|
667
667
|
return graph
|
668
668
|
|
669
669
|
@staticmethod
|
@@ -697,7 +697,7 @@ class Graph:
|
|
697
697
|
print("Graph.AdjacentVertices - Error: The input vertex is not a valid vertex. Returning None.")
|
698
698
|
return None
|
699
699
|
vertices = []
|
700
|
-
_ = graph.AdjacentVertices(vertex, vertices) # Hook to
|
700
|
+
_ = graph.AdjacentVertices(vertex, vertices) # Hook to Core
|
701
701
|
return list(vertices)
|
702
702
|
|
703
703
|
@staticmethod
|
@@ -739,7 +739,7 @@ class Graph:
|
|
739
739
|
print("Graph.AllPaths - Error: The input vertexB is not a valid vertex. Returning None.")
|
740
740
|
return None
|
741
741
|
paths = []
|
742
|
-
_ = graph.AllPaths(vertexA, vertexB, True, timeLimit, paths) # Hook to
|
742
|
+
_ = graph.AllPaths(vertexA, vertexB, True, timeLimit, paths) # Hook to Core
|
743
743
|
return paths
|
744
744
|
|
745
745
|
@staticmethod
|
@@ -4039,7 +4039,7 @@ class Graph:
|
|
4039
4039
|
if not len(verticesA) == len(verticesB):
|
4040
4040
|
print("Graph.Connect - Error: The input lists verticesA and verticesB have different lengths. Returning None.")
|
4041
4041
|
return None
|
4042
|
-
_ = graph.Connect(verticesA, verticesB, tolerance) # Hook to
|
4042
|
+
_ = graph.Connect(verticesA, verticesB, tolerance) # Hook to Core
|
4043
4043
|
return graph
|
4044
4044
|
|
4045
4045
|
@staticmethod
|
@@ -4179,7 +4179,7 @@ class Graph:
|
|
4179
4179
|
print("Graph.DegreeSequence - Error: The input graph is not a valid graph. Returning None.")
|
4180
4180
|
return None
|
4181
4181
|
sequence = []
|
4182
|
-
_ = graph.DegreeSequence(sequence) # Hook to
|
4182
|
+
_ = graph.DegreeSequence(sequence) # Hook to Core
|
4183
4183
|
return sequence
|
4184
4184
|
|
4185
4185
|
@staticmethod
|
@@ -4493,7 +4493,7 @@ class Graph:
|
|
4493
4493
|
return None
|
4494
4494
|
if not vertices:
|
4495
4495
|
edges = []
|
4496
|
-
_ = graph.Edges(edges, tolerance) # Hook to
|
4496
|
+
_ = graph.Edges(edges, tolerance) # Hook to Core
|
4497
4497
|
return edges
|
4498
4498
|
else:
|
4499
4499
|
vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
|
@@ -4501,7 +4501,7 @@ class Graph:
|
|
4501
4501
|
print("Graph.Edges - Error: The input list of vertices does not contain any valid vertices. Returning None.")
|
4502
4502
|
return None
|
4503
4503
|
edges = []
|
4504
|
-
_ = graph.Edges(vertices, tolerance, edges) # Hook to
|
4504
|
+
_ = graph.Edges(vertices, tolerance, edges) # Hook to Core
|
4505
4505
|
return list(dict.fromkeys(edges)) # remove duplicates
|
4506
4506
|
|
4507
4507
|
@staticmethod
|
@@ -5526,7 +5526,7 @@ class Graph:
|
|
5526
5526
|
return False
|
5527
5527
|
|
5528
5528
|
@staticmethod
|
5529
|
-
def Flatten(graph, layout="spring", k=0.8, seed=None, iterations=50, rootVertex=None, tolerance=0.0001):
|
5529
|
+
def Flatten(graph, layout="spring", k=0.8, seed=None, iterations=50, rootVertex=None, radius=0.5, tolerance=0.0001):
|
5530
5530
|
"""
|
5531
5531
|
Flattens the input graph.
|
5532
5532
|
|
@@ -5536,8 +5536,9 @@ class Graph:
|
|
5536
5536
|
The input graph.
|
5537
5537
|
layout : str , optional
|
5538
5538
|
The desired mode for flattening. If set to 'spring', the algorithm uses a simplified version of the Fruchterman-Reingold force-directed algorithm to flatten and distribute the vertices.
|
5539
|
-
If set to 'radial', the nodes will be distributed along
|
5540
|
-
If set to 'tree', the nodes will be distributed using the Reingold-Tillford layout.
|
5539
|
+
If set to 'radial', the nodes will be distributed along concentric circles.
|
5540
|
+
If set to 'tree', the nodes will be distributed using the Reingold-Tillford layout.
|
5541
|
+
If set to 'circle', the nodes will be distributed on the cirumference of a circle. The default is 'spring'.
|
5541
5542
|
k : float, optional
|
5542
5543
|
The desired spring constant to use for the attractive and repulsive forces. The default is 0.8.
|
5543
5544
|
seed : int , optional
|
@@ -5546,6 +5547,8 @@ class Graph:
|
|
5546
5547
|
The desired maximum number of iterations to solve the forces in the 'spring' mode. The default is 50.
|
5547
5548
|
rootVertex : topologic_core.Vertex , optional
|
5548
5549
|
The desired vertex to use as the root of the tree and radial layouts.
|
5550
|
+
radius : float, optional
|
5551
|
+
The desired radius for the circle layout option. The default is 0.5.
|
5549
5552
|
tolerance : float , optional
|
5550
5553
|
The desired tolerance. The default is 0.0001.
|
5551
5554
|
|
@@ -5712,6 +5715,60 @@ class Graph:
|
|
5712
5715
|
old_roots = new_roots
|
5713
5716
|
return root, num_nodes
|
5714
5717
|
|
5718
|
+
|
5719
|
+
def circle_layout(graph, radius=0.5):
|
5720
|
+
from topologicpy.Vertex import Vertex
|
5721
|
+
from topologicpy.Vector import Vector
|
5722
|
+
from topologicpy.Wire import Wire
|
5723
|
+
from topologicpy.Graph import Graph
|
5724
|
+
from topologicpy.Edge import Edge
|
5725
|
+
|
5726
|
+
vertices = Graph.Vertices(graph)
|
5727
|
+
edges = Graph.Edges(graph)
|
5728
|
+
edge_dict = {}
|
5729
|
+
|
5730
|
+
for i, edge in enumerate(edges):
|
5731
|
+
sv = Edge.StartVertex(edge)
|
5732
|
+
ev = Edge.EndVertex(edge)
|
5733
|
+
si = Vertex.Index(sv, vertices)
|
5734
|
+
ei = Vertex.Index(ev, vertices)
|
5735
|
+
edge_dict[str(si)+"_"+str(ei)] = i
|
5736
|
+
edge_dict[str(ei)+"_"+str(si)] = i
|
5737
|
+
|
5738
|
+
n = len(vertices)
|
5739
|
+
c = Wire.Circle(radius=radius, sides=n)
|
5740
|
+
c_vertices = Topology.Vertices(c)
|
5741
|
+
|
5742
|
+
for i, c_v in enumerate(c_vertices):
|
5743
|
+
d = Topology.Dictionary(vertices[i])
|
5744
|
+
c_v = Topology.SetDictionary(c_v, d)
|
5745
|
+
adj_dict = Graph.AdjacencyDictionary(graph)
|
5746
|
+
keys = adj_dict.keys()
|
5747
|
+
c_edges = []
|
5748
|
+
used = [[0] * n for _ in range(n)]
|
5749
|
+
for key in keys:
|
5750
|
+
x = int(key)
|
5751
|
+
adj_vertices = [int(v) for v in adj_dict[key]]
|
5752
|
+
for y in adj_vertices:
|
5753
|
+
if used[x][y] == 0:
|
5754
|
+
v1 = Vector.ByCoordinates(Vertex.X(c_vertices[x]), Vertex.Y(c_vertices[x]), Vertex.Z(c_vertices[x]))
|
5755
|
+
v2 = Vector.ByCoordinates(Vertex.X(c_vertices[y]), Vertex.Y(c_vertices[y]), Vertex.Z(c_vertices[y]))
|
5756
|
+
ang1 = Vector.CompassAngle(v1, [0,1,0])
|
5757
|
+
ang2 = Vector.CompassAngle(v2, [0,1,0])
|
5758
|
+
if ang2-ang1 < 180:
|
5759
|
+
e = Edge.ByVertices(c_vertices[x], c_vertices[y])
|
5760
|
+
else:
|
5761
|
+
e = Edge.ByVertices(c_vertices[y], c_vertices[x])
|
5762
|
+
|
5763
|
+
orig_edge_index = edge_dict[str(x)+"_"+str(y)]
|
5764
|
+
d = Topology.Dictionary(edges[orig_edge_index])
|
5765
|
+
e = Topology.SetDictionary(e, d)
|
5766
|
+
c_edges.append(e)
|
5767
|
+
used[x][y] = 1
|
5768
|
+
used[y][x] = 1
|
5769
|
+
new_g = Graph.ByVerticesEdges(c_vertices, c_edges)
|
5770
|
+
return new_g
|
5771
|
+
|
5715
5772
|
def spring_layout(edge_list, iterations=500, k=None, seed=None):
|
5716
5773
|
# Compute the layout of a graph using the Fruchterman-Reingold algorithm
|
5717
5774
|
# with a force-directed layout approach.
|
@@ -5850,6 +5907,10 @@ class Graph:
|
|
5850
5907
|
if not Topology.IsInstance(graph, "Graph"):
|
5851
5908
|
print("Graph.Flatten - Error: The input graph is not a valid topologic graph. Returning None.")
|
5852
5909
|
return None
|
5910
|
+
|
5911
|
+
if 'circ' in layout.lower():
|
5912
|
+
new_graph = circle_layout(graph, radius=radius)
|
5913
|
+
return new_graph
|
5853
5914
|
d = Graph.MeshData(graph)
|
5854
5915
|
vertices = d['vertices']
|
5855
5916
|
edges = d['edges']
|
@@ -6180,7 +6241,7 @@ class Graph:
|
|
6180
6241
|
print("Graph.IsolatedVertices - Error: The input graph is not a valid graph. Returning None.")
|
6181
6242
|
return None
|
6182
6243
|
vertices = []
|
6183
|
-
_ = graph.IsolatedVertices(vertices) # Hook to
|
6244
|
+
_ = graph.IsolatedVertices(vertices) # Hook to Core
|
6184
6245
|
return vertices
|
6185
6246
|
|
6186
6247
|
@staticmethod
|
@@ -7581,7 +7642,7 @@ class Graph:
|
|
7581
7642
|
if not Topology.IsInstance(edge, "Edge"):
|
7582
7643
|
print("Graph.RemoveEdge - Error: The input edge is not a valid edge. Returning None.")
|
7583
7644
|
return None
|
7584
|
-
_ = graph.RemoveEdges([edge], tolerance) # Hook to
|
7645
|
+
_ = graph.RemoveEdges([edge], tolerance) # Hook to Core
|
7585
7646
|
return graph
|
7586
7647
|
|
7587
7648
|
@staticmethod
|
@@ -7613,7 +7674,7 @@ class Graph:
|
|
7613
7674
|
print("Graph.RemoveVertex - Error: The input vertex is not a valid vertex. Returning None.")
|
7614
7675
|
return None
|
7615
7676
|
graphVertex = Graph.NearestVertex(graph, vertex)
|
7616
|
-
_ = graph.RemoveVertices([graphVertex]) # Hook to
|
7677
|
+
_ = graph.RemoveVertices([graphVertex]) # Hook to Core
|
7617
7678
|
return graph
|
7618
7679
|
|
7619
7680
|
@staticmethod
|
@@ -7648,7 +7709,7 @@ class Graph:
|
|
7648
7709
|
if len(dictionary.Keys()) < 1:
|
7649
7710
|
print("Graph.SetDictionary - Warning: the input dictionary parameter is empty. Returning original input.")
|
7650
7711
|
return graph
|
7651
|
-
_ = graph.SetDictionary(dictionary) # Hook to
|
7712
|
+
_ = graph.SetDictionary(dictionary) # Hook to Core
|
7652
7713
|
return graph
|
7653
7714
|
|
7654
7715
|
@staticmethod
|
@@ -8173,7 +8234,7 @@ class Graph:
|
|
8173
8234
|
vertices = []
|
8174
8235
|
if graph:
|
8175
8236
|
try:
|
8176
|
-
_ = graph.Vertices(vertices) # Hook to
|
8237
|
+
_ = graph.Vertices(vertices) # Hook to Core
|
8177
8238
|
except:
|
8178
8239
|
vertices = []
|
8179
8240
|
if not vertexKey == None:
|
topologicpy/Grid.py
CHANGED
@@ -202,11 +202,10 @@ class Grid():
|
|
202
202
|
e.SetDictionary(d)
|
203
203
|
gridEdges.append(e)
|
204
204
|
elif Topology.Type(e) > Topology.TypeID("Edge"):
|
205
|
-
tempEdges =
|
206
|
-
_ = e.Edges(None, tempEdges)
|
205
|
+
tempEdges = Topology.Edges(e)
|
207
206
|
for tempEdge in tempEdges:
|
208
207
|
d = Dictionary.ByKeysValues(["dir", "offset"],["v",v])
|
209
|
-
tempEdge.SetDictionary(d)
|
208
|
+
tempEdge = Topology.SetDictionary(tempEdge, d)
|
210
209
|
gridEdges.append(tempEdge)
|
211
210
|
grid = None
|
212
211
|
if len(gridEdges) > 0:
|
topologicpy/Honeybee.py
CHANGED
@@ -254,8 +254,7 @@ class Honeybee:
|
|
254
254
|
from topologicpy.Dictionary import Dictionary
|
255
255
|
|
256
256
|
def cellFloor(cell):
|
257
|
-
faces =
|
258
|
-
_ = cell.Faces(None, faces)
|
257
|
+
faces = Topology.Faces(cell)
|
259
258
|
c = [x.CenterOfMass().Z() for x in faces]
|
260
259
|
return round(min(c),2)
|
261
260
|
|
@@ -293,8 +292,7 @@ class Honeybee:
|
|
293
292
|
if not Topology.IsInstance(tpBuilding, "Topology"):
|
294
293
|
return None
|
295
294
|
rooms = []
|
296
|
-
tpCells =
|
297
|
-
_ = tpBuilding.Cells(None, tpCells)
|
295
|
+
tpCells = Topology.Cells(tpBuilding)
|
298
296
|
# Sort cells by Z Levels
|
299
297
|
tpCells.sort(key=lambda c: cellFloor(c), reverse=False)
|
300
298
|
fl = floorLevels(tpCells, 2)
|
@@ -351,14 +349,13 @@ class Honeybee:
|
|
351
349
|
constr_set = constr_set_lib.construction_set_by_identifier("Default Generic Construction Set")
|
352
350
|
spaceNames.append(tpCellName)
|
353
351
|
|
354
|
-
tpCellFaces =
|
355
|
-
_ = tpCell.Faces(None, tpCellFaces)
|
352
|
+
tpCellFaces = Topology.Faces(tpCell)
|
356
353
|
if tpCellFaces:
|
357
354
|
hbRoomFaces = []
|
358
355
|
for tpFaceNumber, tpCellFace in enumerate(tpCellFaces):
|
359
356
|
tpCellFaceNormal = Face.Normal(tpCellFace, mantissa=mantissa)
|
360
357
|
hbRoomFacePoints = []
|
361
|
-
tpFaceVertices =
|
358
|
+
tpFaceVertices = Topology.Vertices(Face.ExternalBoundary(tpCellFace))
|
362
359
|
for tpVertex in tpFaceVertices:
|
363
360
|
hbRoomFacePoints.append(Point3D(Vertex.X(tpVertex, mantissa=mantissa), Vertex.Y(tpVertex, mantissa=mantissa), Vertex.Z(tpVertex, mantissa=mantissa)))
|
364
361
|
hbRoomFace = HBFace(tpCellName+'_Face_'+str(tpFaceNumber+1), Face3D(hbRoomFacePoints))
|
@@ -372,7 +369,7 @@ class Honeybee:
|
|
372
369
|
tpFaceApertureType = Dictionary.ValueAtKey(tpFaceApertureDictionary,apertureKeyName)
|
373
370
|
hbFaceAperturePoints = []
|
374
371
|
tpFaceApertureVertices = []
|
375
|
-
tpFaceApertureVertices =
|
372
|
+
tpFaceApertureVertices = Topology.Vertices(Face.ExternalBoundary(apertureTopology))
|
376
373
|
for tpFaceApertureVertex in tpFaceApertureVertices:
|
377
374
|
hbFaceAperturePoints.append(Point3D(Vertex.X(tpFaceApertureVertex, mantissa=mantissa), Vertex.Y(tpFaceApertureVertex, mantissa=mantissa), Vertex.Z(tpFaceApertureVertex, mantissa=mantissa)))
|
378
375
|
if(tpFaceApertureType):
|
@@ -420,7 +417,7 @@ class Honeybee:
|
|
420
417
|
tpShadingFaces = Topology.SubTopologies(tpShadingFacesCluster, subTopologyType="face")
|
421
418
|
for faceIndex, tpShadingFace in enumerate(tpShadingFaces):
|
422
419
|
faceVertices = []
|
423
|
-
faceVertices =
|
420
|
+
faceVertices = Topology.Vertices(Face.ExternalBoundary(tpShadingFace))
|
424
421
|
facePoints = []
|
425
422
|
for aVertex in faceVertices:
|
426
423
|
facePoints.append(Point3D(Vertex.X(aVertex, mantissa=mantissa), Vertex.Y(aVertex, mantissa=mantissa), Vertex.Z(aVertex, mantissa=mantissa)))
|
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
|
@@ -1022,7 +1043,7 @@ class Plotly:
|
|
1022
1043
|
d = Topology.Dictionary(tp_face)
|
1023
1044
|
f_dictionaries.append(d)
|
1024
1045
|
if d:
|
1025
|
-
|
1046
|
+
tri = Topology.SetDictionary(tri, d)
|
1026
1047
|
all_triangles.append(tri)
|
1027
1048
|
if len(all_triangles) > 0:
|
1028
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:
|