topologicpy 0.7.83__py3-none-any.whl → 0.7.85__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 +10 -6
- topologicpy/CellComplex.py +10 -5
- topologicpy/Cluster.py +8 -8
- topologicpy/Dictionary.py +34 -1
- topologicpy/Edge.py +3 -3
- topologicpy/Face.py +11 -3
- topologicpy/Graph.py +91 -49
- topologicpy/Grid.py +4 -4
- topologicpy/Helper.py +42 -1
- topologicpy/Plotly.py +21 -22
- topologicpy/Shell.py +10 -6
- topologicpy/Topology.py +160 -54
- topologicpy/Vertex.py +8 -3
- topologicpy/Wire.py +111 -18
- topologicpy/version.py +1 -1
- {topologicpy-0.7.83.dist-info → topologicpy-0.7.85.dist-info}/METADATA +1 -1
- topologicpy-0.7.85.dist-info/RECORD +36 -0
- topologicpy-0.7.83.dist-info/RECORD +0 -36
- {topologicpy-0.7.83.dist-info → topologicpy-0.7.85.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.83.dist-info → topologicpy-0.7.85.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.83.dist-info → topologicpy-0.7.85.dist-info}/top_level.txt +0 -0
topologicpy/Graph.py
CHANGED
@@ -539,7 +539,7 @@ class Graph:
|
|
539
539
|
from topologicpy.Dictionary import Dictionary
|
540
540
|
from topologicpy.Topology import Topology
|
541
541
|
|
542
|
-
def addIfUnique(graph_vertices, vertex, tolerance):
|
542
|
+
def addIfUnique(graph_vertices, vertex, tolerance=0.0001):
|
543
543
|
unique = True
|
544
544
|
returnVertex = vertex
|
545
545
|
for gv in graph_vertices:
|
@@ -574,11 +574,11 @@ class Graph:
|
|
574
574
|
print("Graph.AddEdge - Error: The input edge is not a valid edge. Returning the input graph.")
|
575
575
|
return graph
|
576
576
|
graph_vertices = Graph.Vertices(graph)
|
577
|
-
graph_edges = Graph.Edges(graph, graph_vertices, tolerance)
|
577
|
+
graph_edges = Graph.Edges(graph, graph_vertices, tolerance=tolerance)
|
578
578
|
vertices = Topology.Vertices(edge)
|
579
579
|
new_vertices = []
|
580
580
|
for vertex in vertices:
|
581
|
-
graph_vertices, nv = addIfUnique(graph_vertices, vertex, tolerance)
|
581
|
+
graph_vertices, nv = addIfUnique(graph_vertices, vertex, tolerance=tolerance)
|
582
582
|
new_vertices.append(nv)
|
583
583
|
new_edge = Edge.ByVertices([new_vertices[0], new_vertices[1]], tolerance=tolerance)
|
584
584
|
if transferEdgeDictionaries == True:
|
@@ -2537,7 +2537,7 @@ class Graph:
|
|
2537
2537
|
outpostsKey: str = "outposts",
|
2538
2538
|
vertexCategoryKey: str = "category",
|
2539
2539
|
edgeCategoryKey : str = "category",
|
2540
|
-
useInternalVertex: bool =
|
2540
|
+
useInternalVertex: bool = False,
|
2541
2541
|
storeBREP: bool =False,
|
2542
2542
|
mantissa: int = 6,
|
2543
2543
|
tolerance: float = 0.0001):
|
@@ -2613,7 +2613,7 @@ class Graph:
|
|
2613
2613
|
eds = []
|
2614
2614
|
for sharedTopology in sharedTops:
|
2615
2615
|
if useInternalVertex == True:
|
2616
|
-
vst = Topology.InternalVertex(sharedTopology, tolerance)
|
2616
|
+
vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
|
2617
2617
|
else:
|
2618
2618
|
vst = Topology.CenterOfMass(sharedTopology)
|
2619
2619
|
d1 = Topology.Dictionary(sharedTopology)
|
@@ -2636,7 +2636,7 @@ class Graph:
|
|
2636
2636
|
eds = []
|
2637
2637
|
for sharedAp in sharedAps:
|
2638
2638
|
if useInternalVertex == True:
|
2639
|
-
vsa = Topology.InternalVertex(sharedAp, tolerance)
|
2639
|
+
vsa = Topology.InternalVertex(sharedAp, tolerance=tolerance)
|
2640
2640
|
else:
|
2641
2641
|
vsa = Topology.CenterOfMass(sharedAp)
|
2642
2642
|
d1 = Topology.Dictionary(sharedAp)
|
@@ -2658,20 +2658,16 @@ class Graph:
|
|
2658
2658
|
def _toExteriorTopologies(vt, exteriorTops):
|
2659
2659
|
verts = []
|
2660
2660
|
eds = []
|
2661
|
-
for exteriorTop in exteriorTops:
|
2661
|
+
for i, exteriorTop in enumerate(exteriorTops):
|
2662
2662
|
if useInternalVertex == True:
|
2663
|
-
vet = Topology.InternalVertex(exteriorTop, tolerance)
|
2663
|
+
vet = Topology.InternalVertex(exteriorTop, tolerance=tolerance)
|
2664
2664
|
else:
|
2665
2665
|
vet = Topology.CenterOfMass(exteriorTop)
|
2666
|
-
vet = Topology.SetDictionary(vet, Topology.Dictionary(exteriorTop), silent=True)
|
2667
2666
|
d1 = Topology.Dictionary(exteriorTop)
|
2668
2667
|
d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 3) # exterior topology
|
2669
2668
|
if storeBREP:
|
2670
|
-
|
2671
|
-
|
2672
|
-
vet = Topology.SetDictionary(vet, d3, silent=True)
|
2673
|
-
else:
|
2674
|
-
vet = Topology.SetDictionary(vet, d1, silent=True)
|
2669
|
+
d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(exteriorTop), Topology.Type(exteriorTop), Topology.TypeAsString(exteriorTop)])
|
2670
|
+
vet = Topology.SetDictionary(vet, d1, silent=True)
|
2675
2671
|
verts.append(vet)
|
2676
2672
|
tempe = Edge.ByStartVertexEndVertex(vt, vet, tolerance=tolerance)
|
2677
2673
|
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Topologies", 3])
|
@@ -2684,18 +2680,15 @@ class Graph:
|
|
2684
2680
|
eds = []
|
2685
2681
|
for exAp in exteriorAps:
|
2686
2682
|
if useInternalVertex == True:
|
2687
|
-
vea = Topology.InternalVertex(exAp, tolerance)
|
2683
|
+
vea = Topology.InternalVertex(exAp, tolerance=tolerance)
|
2688
2684
|
else:
|
2689
2685
|
vea = Topology.CenterOfMass(exAp)
|
2690
2686
|
d1 = Topology.Dictionary(exAp)
|
2691
2687
|
d1 = Dictionary.SetValueAtKey(d1, vertexCategoryKey, 4) # exterior aperture
|
2692
2688
|
vea = Vertex.ByCoordinates(Vertex.X(vea, mantissa=mantissa)+(tolerance*100), Vertex.Y(vea, mantissa=mantissa)+(tolerance*100), Vertex.Z(vea, mantissa=mantissa)+(tolerance*100))
|
2693
2689
|
if storeBREP:
|
2694
|
-
|
2695
|
-
|
2696
|
-
vea = Topology.SetDictionary(vea, d3, silent=True)
|
2697
|
-
else:
|
2698
|
-
vea = Topology.SetDictionary(vea, d1, silent=True)
|
2690
|
+
d1 = Dictionary.SetValuesAtKeys(d1, ["brep", "brepType", "brepTypeString"], [Topology.BREPString(exAp), Topology.Type(exAp), Topology.TypeAsString(exAp)])
|
2691
|
+
vea = Topology.SetDictionary(vea, d1, silent=True)
|
2699
2692
|
verts.append(vea)
|
2700
2693
|
tempe = Edge.ByStartVertexEndVertex(vt, vea, tolerance=tolerance)
|
2701
2694
|
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
|
@@ -2710,7 +2703,7 @@ class Graph:
|
|
2710
2703
|
if Topology.IsInstance(content, "Aperture"):
|
2711
2704
|
content = Aperture.Topology(content)
|
2712
2705
|
if useInternalVertex == True:
|
2713
|
-
vct = Topology.InternalVertex(content, tolerance)
|
2706
|
+
vct = Topology.InternalVertex(content, tolerance=tolerance)
|
2714
2707
|
else:
|
2715
2708
|
vct = Topology.CenterOfMass(content)
|
2716
2709
|
vct = Vertex.ByCoordinates(Vertex.X(vct, mantissa=mantissa)+(tolerance*100), Vertex.Y(vct, mantissa=mantissa)+(tolerance*100), Vertex.Z(vct, mantissa=mantissa)+(tolerance*100))
|
@@ -2999,7 +2992,7 @@ class Graph:
|
|
2999
2992
|
graph_edges += eds
|
3000
2993
|
for sharedTopology in sharedTopologies:
|
3001
2994
|
if useInternalVertex == True:
|
3002
|
-
vst = Topology.InternalVertex(sharedTopology, tolerance)
|
2995
|
+
vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
|
3003
2996
|
else:
|
3004
2997
|
vst = Topology.CenterOfMass(sharedTopology)
|
3005
2998
|
d = Topology.Dictionary(sharedTopology)
|
@@ -3023,7 +3016,7 @@ class Graph:
|
|
3023
3016
|
graph_edges += eds
|
3024
3017
|
for exteriorTopology in exteriorTopologies:
|
3025
3018
|
if useInternalVertex == True:
|
3026
|
-
vet = Topology.InternalVertex(exteriorTopology, tolerance)
|
3019
|
+
vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
|
3027
3020
|
else:
|
3028
3021
|
vet = Topology.CenterOfMass(exteriorTopology)
|
3029
3022
|
d = Topology.Dictionary(exteriorTopology)
|
@@ -3084,7 +3077,7 @@ class Graph:
|
|
3084
3077
|
graph_edges += eds
|
3085
3078
|
for exteriorTopology in exteriorTopologies:
|
3086
3079
|
if useInternalVertex == True:
|
3087
|
-
vet = Topology.InternalVertex(exteriorTopology, tolerance)
|
3080
|
+
vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
|
3088
3081
|
else:
|
3089
3082
|
vet = Topology.CenterOfMass(exteriorTopology)
|
3090
3083
|
d = Topology.Dictionary(exteriorTopology)
|
@@ -3243,7 +3236,7 @@ class Graph:
|
|
3243
3236
|
graph_edges += eds
|
3244
3237
|
for sharedTopology in sharedTopologies:
|
3245
3238
|
if useInternalVertex == True:
|
3246
|
-
vst = Topology.InternalVertex(sharedTopology, tolerance)
|
3239
|
+
vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
|
3247
3240
|
else:
|
3248
3241
|
vst = Topology.CenterOfMass(sharedTopology)
|
3249
3242
|
d = Topology.Dictionary(sharedTopology)
|
@@ -3267,7 +3260,7 @@ class Graph:
|
|
3267
3260
|
graph_edges += eds
|
3268
3261
|
for exteriorTopology in exteriorTopologies:
|
3269
3262
|
if useInternalVertex == True:
|
3270
|
-
vet = Topology.InternalVertex(exteriorTopology, tolerance)
|
3263
|
+
vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
|
3271
3264
|
else:
|
3272
3265
|
vet = Topology.CenterOfMass(exteriorTopology)
|
3273
3266
|
d = Topology.Dictionary(exteriorTopology)
|
@@ -3328,7 +3321,7 @@ class Graph:
|
|
3328
3321
|
graph_edges += eds
|
3329
3322
|
for exteriorTopology in exteriorTopologies:
|
3330
3323
|
if useInternalVertex == True:
|
3331
|
-
vet = Topology.InternalVertex(exteriorTopology, tolerance)
|
3324
|
+
vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
|
3332
3325
|
else:
|
3333
3326
|
vet = Topology.CenterOfMass(exteriorTopology)
|
3334
3327
|
d = Topology.Dictionary(exteriorTopology)
|
@@ -3489,7 +3482,7 @@ class Graph:
|
|
3489
3482
|
graph_edges += eds
|
3490
3483
|
for sharedTopology in sharedTopologies:
|
3491
3484
|
if useInternalVertex == True:
|
3492
|
-
vst = Topology.InternalVertex(sharedTopology, tolerance)
|
3485
|
+
vst = Topology.InternalVertex(sharedTopology, tolerance=tolerance)
|
3493
3486
|
else:
|
3494
3487
|
vst = Topology.CenterOfMass(sharedTopology)
|
3495
3488
|
d = Topology.Dictionary(sharedTopology)
|
@@ -3513,7 +3506,7 @@ class Graph:
|
|
3513
3506
|
graph_edges += eds
|
3514
3507
|
for exteriorTopology in exteriorTopologies:
|
3515
3508
|
if useInternalVertex == True:
|
3516
|
-
vet = Topology.InternalVertex(exteriorTopology, tolerance)
|
3509
|
+
vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
|
3517
3510
|
else:
|
3518
3511
|
vet = Topology.CenterOfMass(exteriorTopology)
|
3519
3512
|
d = Topology.Dictionary(exteriorTopology)
|
@@ -3576,7 +3569,7 @@ class Graph:
|
|
3576
3569
|
graph_edges += eds
|
3577
3570
|
for exteriorTopology in exteriorTopologies:
|
3578
3571
|
if useInternalVertex == True:
|
3579
|
-
vet = Topology.InternalVertex(exteriorTopology, tolerance)
|
3572
|
+
vet = Topology.InternalVertex(exteriorTopology, tolerance=tolerance)
|
3580
3573
|
else:
|
3581
3574
|
vet = Topology.CenterOfMass(exteriorTopology)
|
3582
3575
|
d = Topology.Dictionary(exteriorTopology)
|
@@ -3616,7 +3609,7 @@ class Graph:
|
|
3616
3609
|
if Topology.IsInstance(content, "Aperture"):
|
3617
3610
|
content = Aperture.Topology(content)
|
3618
3611
|
if useInternalVertex == True:
|
3619
|
-
vst = Topology.InternalVertex(content, tolerance)
|
3612
|
+
vst = Topology.InternalVertex(content, tolerance=tolerance)
|
3620
3613
|
else:
|
3621
3614
|
vst = Topology.CenterOfMass(content)
|
3622
3615
|
d1 = Topology.Dictionary(content)
|
@@ -3651,7 +3644,7 @@ class Graph:
|
|
3651
3644
|
outposts = []
|
3652
3645
|
for outpost in outposts:
|
3653
3646
|
if useInternalVertex == True:
|
3654
|
-
vop = Topology.InternalVertex(outpost, tolerance)
|
3647
|
+
vop = Topology.InternalVertex(outpost, tolerance=tolerance)
|
3655
3648
|
else:
|
3656
3649
|
vop = Topology.CenterOfMass(outpost)
|
3657
3650
|
tempe = Edge.ByStartVertexEndVertex(topology, vop, tolerance=tolerance)
|
@@ -4071,7 +4064,7 @@ class Graph:
|
|
4071
4064
|
if Topology.IsSame(va, vb):
|
4072
4065
|
d = 0
|
4073
4066
|
else:
|
4074
|
-
d = Graph.TopologicalDistance(graph, va, vb, tolerance)
|
4067
|
+
d = Graph.TopologicalDistance(graph, va, vb, tolerance=tolerance)
|
4075
4068
|
top_dist += d
|
4076
4069
|
if top_dist == 0:
|
4077
4070
|
print("Graph.ClosenessCentrality - Warning: Topological Distance is Zero.")
|
@@ -4086,7 +4079,7 @@ class Graph:
|
|
4086
4079
|
if Topology.IsSame(va, vb):
|
4087
4080
|
d = 0
|
4088
4081
|
else:
|
4089
|
-
d = Graph.TopologicalDistance(graph, va, vb, tolerance)
|
4082
|
+
d = Graph.TopologicalDistance(graph, va, vb, tolerance=tolerance)
|
4090
4083
|
top_dist += d
|
4091
4084
|
if top_dist == 0:
|
4092
4085
|
scores.append(0)
|
@@ -4173,7 +4166,7 @@ class Graph:
|
|
4173
4166
|
if not Topology.IsInstance(edge, "Edge"):
|
4174
4167
|
print("Graph.ContainsEdge - Error: The input edge is not a valid edge. Returning None.")
|
4175
4168
|
return None
|
4176
|
-
return graph.ContainsEdge(edge, tolerance)
|
4169
|
+
return graph.ContainsEdge(edge, tolerance) # Hook to Core
|
4177
4170
|
|
4178
4171
|
@staticmethod
|
4179
4172
|
def ContainsVertex(graph, vertex, tolerance=0.0001):
|
@@ -4203,7 +4196,7 @@ class Graph:
|
|
4203
4196
|
if not Topology.IsInstance(vertex, "Vertex"):
|
4204
4197
|
print("Graph.ContainsVertex - Error: The input vertex is not a valid vertex. Returning None.")
|
4205
4198
|
return None
|
4206
|
-
return graph.ContainsVertex(vertex, tolerance)
|
4199
|
+
return graph.ContainsVertex(vertex, tolerance) # Hook to Core
|
4207
4200
|
|
4208
4201
|
|
4209
4202
|
@staticmethod
|
@@ -4567,7 +4560,7 @@ class Graph:
|
|
4567
4560
|
if not Topology.IsInstance(vertexB, "Vertex"):
|
4568
4561
|
print("Graph.Edge - Error: The input vertexB is not a valid vertex. Returning None.")
|
4569
4562
|
return None
|
4570
|
-
return graph.Edge(vertexA, vertexB, tolerance)
|
4563
|
+
return graph.Edge(vertexA, vertexB, tolerance) # Hook to Core
|
4571
4564
|
|
4572
4565
|
@staticmethod
|
4573
4566
|
def Edges(graph, vertices=None, tolerance=0.0001):
|
@@ -8474,7 +8467,7 @@ class Graph:
|
|
8474
8467
|
return shortestPaths
|
8475
8468
|
|
8476
8469
|
@staticmethod
|
8477
|
-
def Show(
|
8470
|
+
def Show(*graphs,
|
8478
8471
|
sagitta = 0,
|
8479
8472
|
absolute = False,
|
8480
8473
|
sides = 8,
|
@@ -8486,6 +8479,8 @@ class Graph:
|
|
8486
8479
|
vertexLabelKey=None,
|
8487
8480
|
vertexGroupKey=None,
|
8488
8481
|
vertexGroups=[],
|
8482
|
+
vertexMinGroup=None,
|
8483
|
+
vertexMaxGroup=None,
|
8489
8484
|
showVertices=True,
|
8490
8485
|
showVertexLabel=False,
|
8491
8486
|
showVertexLegend=False,
|
@@ -8496,6 +8491,8 @@ class Graph:
|
|
8496
8491
|
edgeLabelKey=None,
|
8497
8492
|
edgeGroupKey=None,
|
8498
8493
|
edgeGroups=[],
|
8494
|
+
edgeMinGroup=None,
|
8495
|
+
edgeMaxGroup=None,
|
8499
8496
|
showEdges=True,
|
8500
8497
|
showEdgeLabel=False,
|
8501
8498
|
showEdgeLegend=False,
|
@@ -8522,8 +8519,8 @@ class Graph:
|
|
8522
8519
|
|
8523
8520
|
Parameters
|
8524
8521
|
----------
|
8525
|
-
|
8526
|
-
|
8522
|
+
*graphs : topologic_core.Graph
|
8523
|
+
One or more toplogic_core.graph objects.
|
8527
8524
|
sagitta : float , optional
|
8528
8525
|
The length of the sagitta. In mathematics, the sagitta is the line connecting the center of a chord to the apex (or highest point) of the arc subtended by that chord. The default is 0 which means a straight edge is drawn instead of an arc. The default is 0.
|
8529
8526
|
absolute : bool , optional
|
@@ -8553,6 +8550,10 @@ class Graph:
|
|
8553
8550
|
The dictionary key to use to display the vertex group. The default is None.
|
8554
8551
|
vertexGroups : list , optional
|
8555
8552
|
The list of vertex groups against which to index the color of the vertex. The default is [].
|
8553
|
+
vertexMinGroup : int or float , optional
|
8554
|
+
For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups. The default is None.
|
8555
|
+
vertexMaxGroup : int or float , optional
|
8556
|
+
For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups. The default is None.
|
8556
8557
|
showVertices : bool , optional
|
8557
8558
|
If set to True the vertices will be drawn. Otherwise, they will not be drawn. The default is True.
|
8558
8559
|
showVertexLabel : bool , optional
|
@@ -8579,6 +8580,10 @@ class Graph:
|
|
8579
8580
|
The dictionary key to use to display the edge group. The default is None.
|
8580
8581
|
edgeGroups : list , optional
|
8581
8582
|
The list of edge groups against which to index the color of the edge. The default is [].
|
8583
|
+
edgeMinGroup : int or float , optional
|
8584
|
+
For numeric edgeGroups, edgeMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the minimum value in edgeGroups. The default is None.
|
8585
|
+
edgeMaxGroup : int or float , optional
|
8586
|
+
For numeric edgeGroups, edgeMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the maximum value in edgeGroups. The default is None.
|
8582
8587
|
showEdges : bool , optional
|
8583
8588
|
If set to True the edges will be drawn. Otherwise, they will not be drawn. The default is True.
|
8584
8589
|
showEdgeLabel : bool , optional
|
@@ -8637,12 +8642,49 @@ class Graph:
|
|
8637
8642
|
"""
|
8638
8643
|
from topologicpy.Plotly import Plotly
|
8639
8644
|
from topologicpy.Topology import Topology
|
8645
|
+
from topologicpy.Helper import Helper
|
8640
8646
|
|
8641
|
-
if
|
8642
|
-
|
8643
|
-
|
8644
|
-
|
8645
|
-
|
8647
|
+
if isinstance(graphs, tuple):
|
8648
|
+
graphs = Helper.Flatten(list(graphs))
|
8649
|
+
if isinstance(graphs, list):
|
8650
|
+
new_graphs = [t for t in graphs if Topology.IsInstance(t, "Graph")]
|
8651
|
+
if len(new_graphs) == 0:
|
8652
|
+
if not silent:
|
8653
|
+
print("Topology.Show - Error: the input topologies parameter does not contain any valid topology. Returning None.")
|
8654
|
+
return None
|
8655
|
+
data = []
|
8656
|
+
for graph in new_graphs:
|
8657
|
+
data += Plotly.DataByGraph(graph,
|
8658
|
+
sagitta=sagitta,
|
8659
|
+
absolute=absolute,
|
8660
|
+
sides=sides,
|
8661
|
+
angle=angle,
|
8662
|
+
vertexColor=vertexColor,
|
8663
|
+
vertexColorKey=vertexColorKey,
|
8664
|
+
vertexSize=vertexSize,
|
8665
|
+
vertexSizeKey=vertexSizeKey,
|
8666
|
+
vertexLabelKey=vertexLabelKey,
|
8667
|
+
vertexGroupKey=vertexGroupKey,
|
8668
|
+
vertexGroups=vertexGroups,
|
8669
|
+
vertexMinGroup=vertexMinGroup,
|
8670
|
+
vertexMaxGroup=vertexMaxGroup,
|
8671
|
+
showVertices=showVertices,
|
8672
|
+
showVertexLabel=showVertexLabel,
|
8673
|
+
showVertexLegend=showVertexLegend,
|
8674
|
+
edgeColor=edgeColor,
|
8675
|
+
edgeColorKey=edgeColorKey,
|
8676
|
+
edgeWidth=edgeWidth,
|
8677
|
+
edgeWidthKey=edgeWidthKey,
|
8678
|
+
edgeLabelKey=edgeLabelKey,
|
8679
|
+
edgeGroupKey=edgeGroupKey,
|
8680
|
+
edgeGroups=edgeGroups,
|
8681
|
+
edgeMinGroup=edgeMinGroup,
|
8682
|
+
edgeMaxGroup=edgeMaxGroup,
|
8683
|
+
showEdges=showEdges,
|
8684
|
+
showEdgeLabel=showEdgeLabel,
|
8685
|
+
showEdgeLegend=showEdgeLegend,
|
8686
|
+
colorScale=colorScale,
|
8687
|
+
silent=silent)
|
8646
8688
|
fig = Plotly.FigureByData(data, width=width, height=height, xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize, backgroundColor=backgroundColor,
|
8647
8689
|
marginLeft=marginLeft, marginRight=marginRight, marginTop=marginTop, marginBottom=marginBottom, tolerance=tolerance)
|
8648
8690
|
Plotly.Show(fig, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
|
@@ -8703,7 +8745,7 @@ class Graph:
|
|
8703
8745
|
if not Topology.IsInstance(vertexB, "Vertex"):
|
8704
8746
|
print("Graph.TopologicalDistance - Error: The input vertexB is not a valid vertex. Returning None.")
|
8705
8747
|
return None
|
8706
|
-
return graph.TopologicalDistance(vertexA, vertexB, tolerance)
|
8748
|
+
return graph.TopologicalDistance(vertexA, vertexB, tolerance) # Hook to Core
|
8707
8749
|
|
8708
8750
|
@staticmethod
|
8709
8751
|
def Topology(graph):
|
@@ -8781,7 +8823,7 @@ class Graph:
|
|
8781
8823
|
if not vertexInList(vertex, vertices):
|
8782
8824
|
vertices.append(vertex)
|
8783
8825
|
if parent:
|
8784
|
-
edge = Graph.Edge(graph, parent, vertex, tolerance)
|
8826
|
+
edge = Graph.Edge(graph, parent, vertex, tolerance=tolerance)
|
8785
8827
|
ev = Edge.EndVertex(edge)
|
8786
8828
|
if Vertex.Distance(parent, ev) < tolerance:
|
8787
8829
|
edge = Edge.Reverse(edge)
|
@@ -8792,7 +8834,7 @@ class Graph:
|
|
8792
8834
|
dictionary['vertices'] = vertices
|
8793
8835
|
dictionary['edges'] = edges
|
8794
8836
|
for child in children:
|
8795
|
-
dictionary = buildTree(graph, dictionary, child, vertex, tolerance)
|
8837
|
+
dictionary = buildTree(graph, dictionary, child, vertex, tolerance=tolerance)
|
8796
8838
|
return dictionary
|
8797
8839
|
|
8798
8840
|
if not Topology.IsInstance(graph, "Graph"):
|
@@ -8803,7 +8845,7 @@ class Graph:
|
|
8803
8845
|
else:
|
8804
8846
|
vertex = Graph.NearestVertex(graph, vertex)
|
8805
8847
|
dictionary = {'vertices':[], 'edges':[]}
|
8806
|
-
dictionary = buildTree(graph, dictionary, vertex, None, tolerance)
|
8848
|
+
dictionary = buildTree(graph, dictionary, vertex, None, tolerance=tolerance)
|
8807
8849
|
return Graph.ByVerticesEdges(dictionary['vertices'], dictionary['edges'])
|
8808
8850
|
|
8809
8851
|
@staticmethod
|
topologicpy/Grid.py
CHANGED
@@ -86,7 +86,7 @@ class Grid():
|
|
86
86
|
uRange.sort()
|
87
87
|
uuVector = Vector.Normalize(uVector)
|
88
88
|
for u in uRange:
|
89
|
-
tempVec = Vector.Multiply(uuVector, u, tolerance)
|
89
|
+
tempVec = Vector.Multiply(uuVector, u, tolerance=tolerance)
|
90
90
|
v1 = Vertex.ByCoordinates(Vertex.X(uOrigin, mantissa=mantissa)+tempVec[0], Vertex.Y(uOrigin, mantissa=mantissa)+tempVec[1], Vertex.Z(uOrigin, mantissa=mantissa)+tempVec[2])
|
91
91
|
v2 = Vertex.ByCoordinates(Vertex.X(v1, mantissa=mantissa)+vVector[0], Vertex.Y(v1, mantissa=mantissa)+vVector[1], Vertex.Z(v1, mantissa=mantissa)+vVector[2])
|
92
92
|
e = Edge.ByVertices([v1, v2], tolerance=tolerance)
|
@@ -107,7 +107,7 @@ class Grid():
|
|
107
107
|
vRange.sort()
|
108
108
|
uvVector = Vector.Normalize(vVector)
|
109
109
|
for v in vRange:
|
110
|
-
tempVec = Vector.Multiply(uvVector, v, tolerance)
|
110
|
+
tempVec = Vector.Multiply(uvVector, v, tolerance=tolerance)
|
111
111
|
v1 = Vertex.ByCoordinates(Vertex.X(vOrigin, mantissa=mantissa)+tempVec[0], Vertex.Y(vOrigin, mantissa=mantissa)+tempVec[1], Vertex.Z(vOrigin, mantissa=mantissa)+tempVec[2])
|
112
112
|
v2 = Vertex.ByCoordinates(Vertex.X(v1, mantissa=mantissa)+uVector[0], Vertex.Y(v1, mantissa=mantissa)+uVector[1], Vertex.Z(v1, mantissa=mantissa)+uVector[2])
|
113
113
|
e = Edge.ByVertices([v1, v2], tolerance=tolerance)
|
@@ -282,8 +282,8 @@ class Grid():
|
|
282
282
|
uvVector = Vector.Normalize(vVector)
|
283
283
|
for u in uRange:
|
284
284
|
for v in vRange:
|
285
|
-
uTempVec = Vector.Multiply(uuVector, u, tolerance)
|
286
|
-
vTempVec = Vector.Multiply(uvVector, v, tolerance)
|
285
|
+
uTempVec = Vector.Multiply(uuVector, u, tolerance=tolerance)
|
286
|
+
vTempVec = Vector.Multiply(uvVector, v, tolerance=tolerance)
|
287
287
|
gridVertex = Vertex.ByCoordinates(Vertex.X(origin, mantissa=mantissa)+uTempVec[0], Vertex.Y(origin, mantissa=mantissa)+vTempVec[1], Vertex.Z(origin, mantissa=mantissa)+uTempVec[2])
|
288
288
|
if clip and Topology.IsInstance(face, "Face"):
|
289
289
|
gridVertex = gridVertex.Intersect(face, False)
|
topologicpy/Helper.py
CHANGED
@@ -580,4 +580,45 @@ class Helper:
|
|
580
580
|
The current version of the software.
|
581
581
|
|
582
582
|
"""
|
583
|
-
|
583
|
+
|
584
|
+
import requests
|
585
|
+
from packaging import version
|
586
|
+
|
587
|
+
def compare_version_with_pypi(library_name, input_version):
|
588
|
+
"""
|
589
|
+
Compare an input version with the latest version of a Python library on PyPI.
|
590
|
+
|
591
|
+
Args:
|
592
|
+
library_name (str): The name of the Python library on PyPI.
|
593
|
+
input_version (str): The version number to compare (e.g., "0.7.58").
|
594
|
+
|
595
|
+
Returns:
|
596
|
+
str: A message indicating whether the input version is less than,
|
597
|
+
equal to, or greater than the latest version on PyPI.
|
598
|
+
"""
|
599
|
+
try:
|
600
|
+
# Fetch library data from PyPI
|
601
|
+
url = f"https://pypi.org/pypi/{library_name}/json"
|
602
|
+
response = requests.get(url)
|
603
|
+
response.raise_for_status()
|
604
|
+
|
605
|
+
# Extract the latest version from the JSON response
|
606
|
+
data = response.json()
|
607
|
+
latest_version = data['info']['version']
|
608
|
+
|
609
|
+
# Compare versions using the packaging library
|
610
|
+
if version.parse(input_version) < version.parse(latest_version):
|
611
|
+
return (f"The version that you are using ({input_version}) is OLDER than the latest version {latest_version} from PyPI. Please consider upgrading to the latest version.")
|
612
|
+
elif version.parse(input_version) == version.parse(latest_version):
|
613
|
+
return (f"The version that you are using ({input_version}) is the latest version available on PyPI.")
|
614
|
+
else:
|
615
|
+
return (f"The version that you are using ({input_version}) is NEWER than the latest version ({latest_version}) available from PyPI.")
|
616
|
+
|
617
|
+
except requests.exceptions.RequestException as e:
|
618
|
+
return f"Error fetching data from PyPI: {e}"
|
619
|
+
except KeyError:
|
620
|
+
return "Error: Unable to find the latest version in the PyPI response."
|
621
|
+
|
622
|
+
current_version = topologicpy.__version__
|
623
|
+
result = compare_version_with_pypi("topologicpy", current_version)
|
624
|
+
return result
|
topologicpy/Plotly.py
CHANGED
@@ -498,8 +498,6 @@ class Plotly:
|
|
498
498
|
x.append(v[0])
|
499
499
|
y.append(v[1])
|
500
500
|
z.append(v[2])
|
501
|
-
label = " "
|
502
|
-
group = None
|
503
501
|
colors.append(Color.AnyToHex(color))
|
504
502
|
labels.append("Vertex_"+str(m+1).zfill(n))
|
505
503
|
sizes.append(size)
|
@@ -507,36 +505,37 @@ class Plotly:
|
|
507
505
|
d = dictionaries[m]
|
508
506
|
if d:
|
509
507
|
if not colorKey == None:
|
510
|
-
|
508
|
+
temp_color = Dictionary.ValueAtKey(d, key=colorKey)
|
509
|
+
if not temp_color == None:
|
510
|
+
colors[m] = Color.AnyToHex(temp_color)
|
511
511
|
if not labelKey == None:
|
512
512
|
labels[m] = str(Dictionary.ValueAtKey(d, key=labelKey)) or labels[m]
|
513
513
|
if not sizeKey == None:
|
514
514
|
sizes[m] = Dictionary.ValueAtKey(d, key=sizeKey) or sizes[m]
|
515
515
|
if not groupKey == None:
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
pass
|
516
|
+
c_value = Dictionary.ValueAtKey(d, key=groupKey)
|
517
|
+
if not c_value == None:
|
518
|
+
if type(c_value) == int or type(c_value) == float:
|
519
|
+
if c_value < minGroup:
|
520
|
+
c_value = minGroup
|
521
|
+
if c_value > maxGroup:
|
522
|
+
c_value = maxGroup
|
523
|
+
temp_color = Color.ByValueInRange(c_value,
|
524
|
+
minValue=minGroup,
|
525
|
+
maxValue=maxGroup,
|
526
|
+
colorScale=colorScale)
|
527
|
+
colors[m] = Color.AnyToHex(temp_color)
|
528
|
+
elif isinstance(c_value, str):
|
529
|
+
temp_color = Color.ByValueInRange(groups.index(c_value), minValue=minGroup, maxValue=maxGroup, colorScale=colorScale)
|
530
|
+
colors[m] = Color.AnyToHex(temp_color)
|
532
531
|
else:
|
533
532
|
for v in vertices:
|
534
533
|
x.append(v[0])
|
535
534
|
y.append(v[1])
|
536
535
|
z.append(v[2])
|
537
536
|
|
538
|
-
if len(list(set(colors))) < 2:
|
539
|
-
|
537
|
+
# if len(list(set(colors))) < 2:
|
538
|
+
# colors = Color.AnyToHex(color)
|
540
539
|
if len(labels) < 1:
|
541
540
|
labels = "Vertex_1"
|
542
541
|
if len(sizes) < 1:
|
@@ -903,7 +902,7 @@ class Plotly:
|
|
903
902
|
label = ""
|
904
903
|
group = None
|
905
904
|
groupList.append(Color.AnyToHex(color)) # Store a default color for that face
|
906
|
-
labels.append("
|
905
|
+
labels.append("Face_"+str(m+1).zfill(n))
|
907
906
|
if len(dictionaries) > 0:
|
908
907
|
d = dictionaries[m]
|
909
908
|
if d:
|
topologicpy/Shell.py
CHANGED
@@ -1008,7 +1008,7 @@ class Shell():
|
|
1008
1008
|
v3 = Vertex.ByCoordinates(x3,y3,z3)
|
1009
1009
|
f1 = Face.ByVertices([v2,v1,v3])
|
1010
1010
|
faces.append(f1)
|
1011
|
-
returnTopology = Shell.ByFaces(faces, tolerance)
|
1011
|
+
returnTopology = Shell.ByFaces(faces, tolerance=tolerance)
|
1012
1012
|
if not returnTopology:
|
1013
1013
|
returnTopology = Cluster.ByTopologies(faces)
|
1014
1014
|
vertices = []
|
@@ -1456,9 +1456,13 @@ class Shell():
|
|
1456
1456
|
"""
|
1457
1457
|
from topologicpy.Face import Face
|
1458
1458
|
from topologicpy.Topology import Topology
|
1459
|
-
|
1459
|
+
import inspect
|
1460
|
+
|
1460
1461
|
if not Topology.IsInstance(shell, "Shell"):
|
1461
1462
|
print("Shell.RemoveCollinearEdges - Error: The input shell parameter is not a valid shell. Returning None.")
|
1463
|
+
curframe = inspect.currentframe()
|
1464
|
+
calframe = inspect.getouterframes(curframe, 2)
|
1465
|
+
print('caller name:', calframe[1][3])
|
1462
1466
|
return None
|
1463
1467
|
faces = Shell.Faces(shell)
|
1464
1468
|
clean_faces = []
|
@@ -1741,7 +1745,7 @@ class Shell():
|
|
1741
1745
|
|
1742
1746
|
return numerator / denominator
|
1743
1747
|
|
1744
|
-
def douglas_peucker(wire, tolerance):
|
1748
|
+
def douglas_peucker(wire, tolerance=0.0001):
|
1745
1749
|
if isinstance(wire, list):
|
1746
1750
|
points = wire
|
1747
1751
|
else:
|
@@ -1769,8 +1773,8 @@ class Shell():
|
|
1769
1773
|
return [start_point, end_point]
|
1770
1774
|
|
1771
1775
|
# Recursively simplify
|
1772
|
-
first_segment = douglas_peucker(points[:max_index + 1], tolerance)
|
1773
|
-
second_segment = douglas_peucker(points[max_index:], tolerance)
|
1776
|
+
first_segment = douglas_peucker(points[:max_index + 1], tolerance=tolerance)
|
1777
|
+
second_segment = douglas_peucker(points[max_index:], tolerance=tolerance)
|
1774
1778
|
|
1775
1779
|
# Merge the two simplified segments
|
1776
1780
|
return first_segment[:-1] + second_segment
|
@@ -1815,7 +1819,7 @@ class Shell():
|
|
1815
1819
|
separators = Helper.Flatten(separators)
|
1816
1820
|
results = []
|
1817
1821
|
for w in wires:
|
1818
|
-
temp_wire = Wire.ByVertices(douglas_peucker(w, tolerance), close=False)
|
1822
|
+
temp_wire = Wire.ByVertices(douglas_peucker(w, tolerance=tolerance), close=False)
|
1819
1823
|
results.append(temp_wire)
|
1820
1824
|
# Make a Cluster out of the results
|
1821
1825
|
cluster = Cluster.ByTopologies(results)
|