topologicpy 0.7.44__py3-none-any.whl → 0.7.46__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 +127 -0
- topologicpy/Face.py +1 -1
- topologicpy/Graph.py +200 -43
- topologicpy/Plotly.py +4 -7
- topologicpy/Shell.py +55 -9
- topologicpy/Topology.py +18 -12
- topologicpy/version.py +1 -1
- {topologicpy-0.7.44.dist-info → topologicpy-0.7.46.dist-info}/METADATA +2 -2
- {topologicpy-0.7.44.dist-info → topologicpy-0.7.46.dist-info}/RECORD +12 -12
- {topologicpy-0.7.44.dist-info → topologicpy-0.7.46.dist-info}/WHEEL +1 -1
- {topologicpy-0.7.44.dist-info → topologicpy-0.7.46.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.44.dist-info → topologicpy-0.7.46.dist-info}/top_level.txt +0 -0
topologicpy/Cell.py
CHANGED
@@ -1519,6 +1519,7 @@ class Cell():
|
|
1519
1519
|
|
1520
1520
|
from topologicpy.Vertex import Vertex
|
1521
1521
|
from topologicpy.Face import Face
|
1522
|
+
from topologicpy.Shell import Shell
|
1522
1523
|
from topologicpy.Topology import Topology
|
1523
1524
|
|
1524
1525
|
if not Topology.IsInstance(origin, "Vertex"):
|
@@ -1552,6 +1553,132 @@ class Cell():
|
|
1552
1553
|
octahedron = Topology.Place(octahedron, originA=Vertex.Origin(), originB=origin)
|
1553
1554
|
return octahedron
|
1554
1555
|
|
1556
|
+
@staticmethod
|
1557
|
+
def Paraboloid(origin= None, focalLength=0.125, width: float = 1, length: float = 1, height: float = 0, uSides: int = 16, vSides: int = 16,
|
1558
|
+
direction: list = [0, 0, 1], placement: str ="center", mantissa: int = 6, tolerance: float = 0.0001, silent=False):
|
1559
|
+
"""
|
1560
|
+
Creates a paraboloid cell. See https://en.wikipedia.org/wiki/Paraboloid
|
1561
|
+
|
1562
|
+
Parameters
|
1563
|
+
----------
|
1564
|
+
origin : topologic_core.Vertex , optional
|
1565
|
+
The origin location of the parabolic surface. The default is None which results in the parabolic surface being placed at (0, 0, 0).
|
1566
|
+
focalLength : float , optional
|
1567
|
+
The focal length of the parabola. The default is 0.125.
|
1568
|
+
width : float , optional
|
1569
|
+
The width of the parabolic surface. The default is 1.
|
1570
|
+
length : float , optional
|
1571
|
+
The length of the parabolic surface. The default is 1.
|
1572
|
+
height : float , optional
|
1573
|
+
The additional height of the parabolic surface. Please note this is not the height from the spring point to the apex. It is in addition to that to form a base. The default is 0.
|
1574
|
+
uSides : int , optional
|
1575
|
+
The number of sides along the width. The default is 16.
|
1576
|
+
vSides : int , optional
|
1577
|
+
The number of sides along the length. The default is 16.
|
1578
|
+
direction : list , optional
|
1579
|
+
The vector representing the up direction of the parabolic surface. The default is [0, 0, 1].
|
1580
|
+
placement : str , optional
|
1581
|
+
The description of the placement of the origin of the parabolic surface. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
1582
|
+
mantissa : int , optional
|
1583
|
+
The desired length of the mantissa. The default is 6.
|
1584
|
+
tolerance : float , optional
|
1585
|
+
The desired tolerance. The default is 0.0001.
|
1586
|
+
silent : bool , optional
|
1587
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1588
|
+
|
1589
|
+
Returns
|
1590
|
+
-------
|
1591
|
+
topologic_core.Shell
|
1592
|
+
The created paraboloid.
|
1593
|
+
|
1594
|
+
"""
|
1595
|
+
from topologicpy.Vertex import Vertex
|
1596
|
+
from topologicpy.Topology import Topology
|
1597
|
+
from topologicpy.Face import Face
|
1598
|
+
from topologicpy.Wire import Wire
|
1599
|
+
from topologicpy.Shell import Shell
|
1600
|
+
|
1601
|
+
if origin == None:
|
1602
|
+
origin = Vertex.Origin()
|
1603
|
+
|
1604
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
1605
|
+
if not silent:
|
1606
|
+
print("Cell.Paraboloid - Error: The origin input parameter is not a valid vertex. Returning None.")
|
1607
|
+
return None
|
1608
|
+
if width <= 0:
|
1609
|
+
if not silent:
|
1610
|
+
print("Cell.Paraboloid - Error: The width input parameter cannot be less than or equal to zero. Returning None.")
|
1611
|
+
return None
|
1612
|
+
if length <= 0:
|
1613
|
+
if not silent:
|
1614
|
+
print("Cell.Paraboloid - Error: The length input parameter cannot be less than or equal to zero. Returning None.")
|
1615
|
+
return None
|
1616
|
+
if height < 0:
|
1617
|
+
if not silent:
|
1618
|
+
print("Cell.Paraboloid - Error: The height input parameter cannot be negative. Returning None.")
|
1619
|
+
return None
|
1620
|
+
|
1621
|
+
para = Shell.Paraboloid(focalLength=focalLength, width=width, length=length, uSides=uSides, vSides=vSides,
|
1622
|
+
direction=[0,0,1], placement="center", mantissa=mantissa, tolerance=tolerance)
|
1623
|
+
if not Topology.IsInstance(para, "Shell"):
|
1624
|
+
if not silent:
|
1625
|
+
print("Cell.Paraboloid - Error: Could not create paraboloid. Returning None.")
|
1626
|
+
return None
|
1627
|
+
eb = Shell.ExternalBoundary(para)
|
1628
|
+
vertices = Topology.Vertices(eb)
|
1629
|
+
z_list = [Vertex.Z(v) for v in vertices]
|
1630
|
+
if focalLength > 0:
|
1631
|
+
z = max(z_list) + height
|
1632
|
+
else:
|
1633
|
+
z = min(z_list) - height
|
1634
|
+
f = Face.Rectangle(origin=Vertex.ByCoordinates(0,0,z), width=width*1.1, length=length*1.1)
|
1635
|
+
proj_vertices = []
|
1636
|
+
for v in vertices:
|
1637
|
+
proj_vertices.append(Vertex.Project(v, f))
|
1638
|
+
w = Wire.ByVertices(proj_vertices, close=True)
|
1639
|
+
sleeve = Shell.ByWires([eb, w], triangulate=False, silent=True)
|
1640
|
+
if sleeve == None:
|
1641
|
+
if not silent:
|
1642
|
+
print("Cell.Paraboloid - Error: Could not create paraboloid. Returning None.")
|
1643
|
+
return None
|
1644
|
+
f = Face.ByWire(w, tolerance=tolerance)
|
1645
|
+
faces = Topology.Faces(sleeve) + [f] + Topology.Faces(para)
|
1646
|
+
cell = Cell.ByFaces(faces, tolerance=tolerance)
|
1647
|
+
if cell == None:
|
1648
|
+
if not silent:
|
1649
|
+
print("Cell.Paraboloid - Error: Could not create paraboloid. Returning None.")
|
1650
|
+
return None
|
1651
|
+
vertices = Topology.Vertices(cell)
|
1652
|
+
x_list = [Vertex.X(v, mantissa=mantissa) for v in vertices]
|
1653
|
+
y_list = [Vertex.Y(v, mantissa=mantissa) for v in vertices]
|
1654
|
+
z_list = [Vertex.Z(v, mantissa=mantissa) for v in vertices]
|
1655
|
+
min_x = min(x_list)
|
1656
|
+
max_x = max(x_list)
|
1657
|
+
mid_x = min_x + (max_x - min_x)/2
|
1658
|
+
min_y = min(y_list)
|
1659
|
+
max_y = max(y_list)
|
1660
|
+
mid_y = min_y + (max_y - min_y)/2
|
1661
|
+
min_z = min(z_list)
|
1662
|
+
max_z = max(z_list)
|
1663
|
+
mid_z = min_z + (max_z - min_z)/2
|
1664
|
+
if placement.lower() == "center":
|
1665
|
+
x_tran = -mid_x
|
1666
|
+
y_tran = -mid_y
|
1667
|
+
z_tran = -mid_z
|
1668
|
+
elif placement.lower() == "bottom":
|
1669
|
+
x_tran = -mid_x
|
1670
|
+
y_tran = -mid_y
|
1671
|
+
z_tran = -min_z
|
1672
|
+
elif placement.lower() == "lowerleft":
|
1673
|
+
x_tran = -min_x
|
1674
|
+
y_tran = -min_y
|
1675
|
+
z_tran = -min_z
|
1676
|
+
cell = Topology.Translate(cell, x_tran, y_tran, z_tran)
|
1677
|
+
cell = Topology.Place(cell, originA=Vertex.Origin(), originB=origin)
|
1678
|
+
if not direction == [0,0,1]:
|
1679
|
+
cell = Topology.Orient(cell, origin=origin, dirA=[0,0,1], dirB=direction)
|
1680
|
+
return cell
|
1681
|
+
|
1555
1682
|
@staticmethod
|
1556
1683
|
def Pipe(edge, profile = None, radius: float = 0.5, sides: int = 16, startOffset: float = 0, endOffset: float = 0, endcapA = None, endcapB = None, mantissa: int = 6) -> dict:
|
1557
1684
|
"""
|
topologicpy/Face.py
CHANGED
@@ -451,7 +451,7 @@ class Face():
|
|
451
451
|
planar_shell = Shell.Planarize(shell)
|
452
452
|
normal = Face.Normal(Topology.Faces(planar_shell)[0])
|
453
453
|
planar_shell = Topology.Flatten(planar_shell, origin=origin, direction=normal)
|
454
|
-
vertices =
|
454
|
+
vertices = Topology.Vertices(planar_shell)
|
455
455
|
new_vertices = []
|
456
456
|
for v in vertices:
|
457
457
|
x, y, z = Vertex.Coordinates(v)
|
topologicpy/Graph.py
CHANGED
@@ -712,7 +712,7 @@ class Graph:
|
|
712
712
|
return paths
|
713
713
|
|
714
714
|
@staticmethod
|
715
|
-
def AverageClusteringCoefficient(graph, mantissa=6):
|
715
|
+
def AverageClusteringCoefficient(graph, mantissa: int = 6):
|
716
716
|
"""
|
717
717
|
Returns the average clustering coefficient of the input graph. See https://en.wikipedia.org/wiki/Clustering_coefficient.
|
718
718
|
|
@@ -1199,7 +1199,7 @@ class Graph:
|
|
1199
1199
|
return bot_graph.serialize(format=format)
|
1200
1200
|
|
1201
1201
|
@staticmethod
|
1202
|
-
def BetweenessCentrality(graph, vertices=None, sources=None, destinations=None, tolerance=0.001):
|
1202
|
+
def BetweenessCentrality(graph, vertices=None, sources=None, destinations=None, key: str = "betweeness_centrality", mantissa: int = 6, tolerance: float = 0.001):
|
1203
1203
|
"""
|
1204
1204
|
Returns the betweeness centrality measure of the input list of vertices within the input graph. The order of the returned list is the same as the order of the input list of vertices. If no vertices are specified, the betweeness centrality of all the vertices in the input graph is computed. See https://en.wikipedia.org/wiki/Betweenness_centrality.
|
1205
1205
|
|
@@ -1213,6 +1213,10 @@ class Graph:
|
|
1213
1213
|
The input list of source vertices. The default is None which means all vertices in the input graph are considered.
|
1214
1214
|
destinations : list , optional
|
1215
1215
|
The input list of destination vertices. The default is None which means all vertices in the input graph are considered.
|
1216
|
+
key : str , optional
|
1217
|
+
The dictionary key under which to save the betweeness centrality score. The default is "betweneess_centrality".
|
1218
|
+
mantissa : int , optional
|
1219
|
+
The desired length of the mantissa. The default is 6.
|
1216
1220
|
tolerance : float , optional
|
1217
1221
|
The desired tolerance. The default is 0.0001.
|
1218
1222
|
|
@@ -1224,6 +1228,7 @@ class Graph:
|
|
1224
1228
|
"""
|
1225
1229
|
from topologicpy.Vertex import Vertex
|
1226
1230
|
from topologicpy.Topology import Topology
|
1231
|
+
from topologicpy.Dictionary import Dictionary
|
1227
1232
|
|
1228
1233
|
def betweeness(vertices, topologies, tolerance=0.001):
|
1229
1234
|
returnList = [0] * len(vertices)
|
@@ -1281,12 +1286,16 @@ class Graph:
|
|
1281
1286
|
if path:
|
1282
1287
|
paths.append(path)
|
1283
1288
|
|
1284
|
-
|
1285
|
-
minValue = min(
|
1286
|
-
maxValue = max(
|
1289
|
+
scores = betweeness(vertices, paths, tolerance=tolerance)
|
1290
|
+
minValue = min(scores)
|
1291
|
+
maxValue = max(scores)
|
1287
1292
|
size = maxValue - minValue
|
1288
|
-
|
1289
|
-
|
1293
|
+
scores = [round((v-minValue)/size, mantissa) for v in scores]
|
1294
|
+
for i, v in enumerate(vertices):
|
1295
|
+
d = Topology.Dictionary(v)
|
1296
|
+
d = Dictionary.SetValueAtKey(d, key, scores[i])
|
1297
|
+
v = Topology.SetDictionary(v, d)
|
1298
|
+
return scores
|
1290
1299
|
|
1291
1300
|
@staticmethod
|
1292
1301
|
def ByAdjacencyMatrixCSVPath(path: str, dictionaries: list = None, silent: bool = False):
|
@@ -1380,9 +1389,10 @@ class Graph:
|
|
1380
1389
|
# Add edges based on the adjacency matrix
|
1381
1390
|
edges = []
|
1382
1391
|
for i in range(len(adjacencyMatrix)):
|
1383
|
-
for j in range(
|
1384
|
-
if not
|
1385
|
-
|
1392
|
+
for j in range(len(adjacencyMatrix)):
|
1393
|
+
if not i == j:
|
1394
|
+
if not adjacencyMatrix[i][j] == 0:
|
1395
|
+
edges.append(Edge.ByVertices([vertices[i], vertices[j]]))
|
1386
1396
|
|
1387
1397
|
return Graph.ByVerticesEdges(vertices, edges)
|
1388
1398
|
|
@@ -4064,7 +4074,7 @@ class Graph:
|
|
4064
4074
|
return chromatic_number(adj_matrix)
|
4065
4075
|
|
4066
4076
|
@staticmethod
|
4067
|
-
def Color(graph, oldKey: str = "color",
|
4077
|
+
def Color(graph, oldKey: str = "color", key: str = "color", maxColors: int = None, tolerance: float = 0.0001):
|
4068
4078
|
"""
|
4069
4079
|
Colors the input vertices within the input graph. The saved value is an integer rather than an actual color. See Color.ByValueInRange to convert to an actual color.
|
4070
4080
|
Any vertices that have been pre-colored will not be affected. See https://en.wikipedia.org/wiki/Graph_coloring.
|
@@ -4075,7 +4085,7 @@ class Graph:
|
|
4075
4085
|
The input graph.
|
4076
4086
|
oldKey : str , optional
|
4077
4087
|
The existing dictionary key to use to read any pre-existing color information. The default is "color".
|
4078
|
-
|
4088
|
+
key : str , optional
|
4079
4089
|
The new dictionary key to use to write out new color information. The default is "color".
|
4080
4090
|
maxColors : int , optional
|
4081
4091
|
The desired maximum number of colors to use. If set to None, the chromatic number of the graph is used. The default is None.
|
@@ -4152,7 +4162,7 @@ class Graph:
|
|
4152
4162
|
colors = graph_coloring(adj_mat, maxColors, colors)
|
4153
4163
|
for i, v in enumerate(vertices):
|
4154
4164
|
d = Topology.Dictionary(v)
|
4155
|
-
d = Dictionary.SetValueAtKey(d,
|
4165
|
+
d = Dictionary.SetValueAtKey(d, key, colors[i])
|
4156
4166
|
v = Topology.SetDictionary(v, d)
|
4157
4167
|
return graph
|
4158
4168
|
|
@@ -4259,7 +4269,7 @@ class Graph:
|
|
4259
4269
|
return graph
|
4260
4270
|
|
4261
4271
|
@staticmethod
|
4262
|
-
def ClosenessCentrality(graph, vertices=None, tolerance = 0.0001):
|
4272
|
+
def ClosenessCentrality(graph, vertices=None, key: str = "closeness_centrality", mantissa: int = 6, tolerance = 0.0001):
|
4263
4273
|
"""
|
4264
4274
|
Return the closeness centrality measure of the input list of vertices within the input graph. The order of the returned list is the same as the order of the input list of vertices. If no vertices are specified, the closeness centrality of all the vertices in the input graph is computed. See https://en.wikipedia.org/wiki/Closeness_centrality.
|
4265
4275
|
|
@@ -4269,6 +4279,10 @@ class Graph:
|
|
4269
4279
|
The input graph.
|
4270
4280
|
vertices : list , optional
|
4271
4281
|
The input list of vertices. The default is None.
|
4282
|
+
key : str , optional
|
4283
|
+
The dictionary key under which to save the closeness centrality score. The default is "closeness_centrality".
|
4284
|
+
mantissa : int , optional
|
4285
|
+
The desired length of the mantissa. The default is 6.
|
4272
4286
|
tolerance : float , optional
|
4273
4287
|
The desired tolerance. The default is 0.0001.
|
4274
4288
|
|
@@ -4279,6 +4293,7 @@ class Graph:
|
|
4279
4293
|
|
4280
4294
|
"""
|
4281
4295
|
from topologicpy.Topology import Topology
|
4296
|
+
from topologicpy.Dictionary import Dictionary
|
4282
4297
|
|
4283
4298
|
if not Topology.IsInstance(graph, "Graph"):
|
4284
4299
|
print("Graph.ClosenessCentrality - Error: The input graph is not a valid graph. Returning None.")
|
@@ -4293,7 +4308,7 @@ class Graph:
|
|
4293
4308
|
return None
|
4294
4309
|
n = len(graphVertices)
|
4295
4310
|
|
4296
|
-
|
4311
|
+
scores = []
|
4297
4312
|
try:
|
4298
4313
|
for va in tqdm(vertices, desc="Computing Closeness Centrality", leave=False):
|
4299
4314
|
top_dist = 0
|
@@ -4304,9 +4319,10 @@ class Graph:
|
|
4304
4319
|
d = Graph.TopologicalDistance(graph, va, vb, tolerance)
|
4305
4320
|
top_dist += d
|
4306
4321
|
if top_dist == 0:
|
4307
|
-
|
4322
|
+
print("Topological Distance is Zero!!")
|
4323
|
+
scores.append(0)
|
4308
4324
|
else:
|
4309
|
-
|
4325
|
+
scores.append(round((n-1)/top_dist, mantissa))
|
4310
4326
|
except:
|
4311
4327
|
print("Graph.ClosenessCentrality - Warning: Could not use tqdm.")
|
4312
4328
|
for va in vertices:
|
@@ -4318,10 +4334,14 @@ class Graph:
|
|
4318
4334
|
d = Graph.TopologicalDistance(graph, va, vb, tolerance)
|
4319
4335
|
top_dist += d
|
4320
4336
|
if top_dist == 0:
|
4321
|
-
|
4337
|
+
scores.append(0)
|
4322
4338
|
else:
|
4323
|
-
|
4324
|
-
|
4339
|
+
scores.append(round((n-1)/top_dist, mantissa))
|
4340
|
+
for i, v in enumerate(vertices):
|
4341
|
+
d = Topology.Dictionary(v)
|
4342
|
+
d = Dictionary.SetValueAtKey(d, key, scores[i])
|
4343
|
+
v = Topology.SetDictionary(v, d)
|
4344
|
+
return scores
|
4325
4345
|
|
4326
4346
|
@staticmethod
|
4327
4347
|
def Connect(graph, verticesA, verticesB, tolerance=0.0001):
|
@@ -4430,6 +4450,61 @@ class Graph:
|
|
4430
4450
|
return None
|
4431
4451
|
return graph.ContainsVertex(vertex, tolerance)
|
4432
4452
|
|
4453
|
+
|
4454
|
+
@staticmethod
|
4455
|
+
def Degree(graph, vertices=None, key: str = "degree", edgeKey: str = None, mantissa: int = 6, tolerance = 0.0001):
|
4456
|
+
"""
|
4457
|
+
Return the degree measure of the input list of vertices within the input graph. The order of the returned list is the same as the order of the input list of vertices. If no vertices are specified, the closeness centrality of all the vertices in the input graph is computed. See https://en.wikipedia.org/wiki/Degree_(graph_theory).
|
4458
|
+
|
4459
|
+
Parameters
|
4460
|
+
----------
|
4461
|
+
graph : topologic_core.Graph
|
4462
|
+
The input graph.
|
4463
|
+
vertices : list , optional
|
4464
|
+
The input list of vertices. The default is None.
|
4465
|
+
key : str , optional
|
4466
|
+
The dictionary key under which to save the closeness centrality score. The default is "degree".
|
4467
|
+
edgeKey : str , optional
|
4468
|
+
If specified, the value in the connected edges' dictionary specified by the edgeKey string will be aggregated to calculate
|
4469
|
+
the vertex degree. If a numeric value cannot be retrieved from an edge, a value of 1 is used instead. This is used in weighted graphs.
|
4470
|
+
mantissa : int , optional
|
4471
|
+
The desired length of the mantissa. The default is 6.
|
4472
|
+
tolerance : float , optional
|
4473
|
+
The desired tolerance. The default is 0.0001.
|
4474
|
+
|
4475
|
+
Returns
|
4476
|
+
-------
|
4477
|
+
list
|
4478
|
+
The degree of the input list of vertices within the input graph.
|
4479
|
+
|
4480
|
+
"""
|
4481
|
+
from topologicpy.Topology import Topology
|
4482
|
+
from topologicpy.Dictionary import Dictionary
|
4483
|
+
|
4484
|
+
if not Topology.IsInstance(graph, "Graph"):
|
4485
|
+
print("Graph.ClosenessCentrality - Error: The input graph is not a valid graph. Returning None.")
|
4486
|
+
return None
|
4487
|
+
graphVertices = Graph.Vertices(graph)
|
4488
|
+
if not isinstance(vertices, list):
|
4489
|
+
vertices = graphVertices
|
4490
|
+
else:
|
4491
|
+
vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
|
4492
|
+
if len(vertices) < 1:
|
4493
|
+
print("Graph.Degree - Error: The input list of vertices does not contain any valid vertices. Returning None.")
|
4494
|
+
return None
|
4495
|
+
n = len(graphVertices)
|
4496
|
+
|
4497
|
+
scores = []
|
4498
|
+
for i, v in enumerate(vertices):
|
4499
|
+
degree = Graph.VertexDegree(graph, v, edgeKey= edgeKey, tolerance = tolerance)
|
4500
|
+
if isinstance(degree, float):
|
4501
|
+
degree = round(degree, mantissa)
|
4502
|
+
d = Topology.Dictionary(v)
|
4503
|
+
d = Dictionary.SetValueAtKey(d, key, degree)
|
4504
|
+
v = Topology.SetDictionary(v, d)
|
4505
|
+
scores.append(degree)
|
4506
|
+
return scores
|
4507
|
+
|
4433
4508
|
@staticmethod
|
4434
4509
|
def DegreeSequence(graph):
|
4435
4510
|
"""
|
@@ -4479,7 +4554,7 @@ class Graph:
|
|
4479
4554
|
return graph.Density()
|
4480
4555
|
|
4481
4556
|
@staticmethod
|
4482
|
-
def DepthMap(graph, vertices=None, tolerance=0.0001):
|
4557
|
+
def DepthMap(graph, vertices=None, key: str = "depth", type: str = "topological", mantissa: int = 6, tolerance: float = 0.0001):
|
4483
4558
|
"""
|
4484
4559
|
Return the depth map of the input list of vertices within the input graph. The returned list contains the total of the topological distances of each vertex to every other vertex in the input graph. The order of the depth map list is the same as the order of the input list of vertices. If no vertices are specified, the depth map of all the vertices in the input graph is computed.
|
4485
4560
|
|
@@ -4489,6 +4564,12 @@ class Graph:
|
|
4489
4564
|
The input graph.
|
4490
4565
|
vertices : list , optional
|
4491
4566
|
The input list of vertices. The default is None.
|
4567
|
+
key : str , optional
|
4568
|
+
The dictionary key under which to save the depth score. The default is "depth".
|
4569
|
+
type : str , optional
|
4570
|
+
The type of depth distance to calculate. The options are "topological" or "metric". The default is "topological". See https://www.spacesyntax.online/overview-2/analysis-of-spatial-relations/.
|
4571
|
+
mantissa : int , optional
|
4572
|
+
The desired length of the mantissa. The default is 6.
|
4492
4573
|
tolerance : float , optional
|
4493
4574
|
The desired tolerance. The default is 0.0001.
|
4494
4575
|
|
@@ -4499,6 +4580,7 @@ class Graph:
|
|
4499
4580
|
|
4500
4581
|
"""
|
4501
4582
|
from topologicpy.Topology import Topology
|
4583
|
+
from topologicpy.Dictionary import Dictionary
|
4502
4584
|
|
4503
4585
|
if not Topology.IsInstance(graph, "Graph"):
|
4504
4586
|
print("Graph.DepthMap - Error: The input graph is not a valid graph. Returning None.")
|
@@ -4511,17 +4593,21 @@ class Graph:
|
|
4511
4593
|
if len(vertices) < 1:
|
4512
4594
|
print("Graph.DepthMap - Error: The input list of vertices does not contain any valid vertices. Returning None.")
|
4513
4595
|
return None
|
4514
|
-
|
4596
|
+
scores = []
|
4515
4597
|
for va in vertices:
|
4516
4598
|
depth = 0
|
4517
4599
|
for vb in graphVertices:
|
4518
4600
|
if Topology.IsSame(va, vb):
|
4519
4601
|
dist = 0
|
4520
4602
|
else:
|
4521
|
-
dist = Graph.
|
4603
|
+
dist = Graph.Distance(graph, va, vb, type=type, mantissa=mantissa, tolerance=tolerance)
|
4522
4604
|
depth = depth + dist
|
4523
|
-
|
4524
|
-
|
4605
|
+
depth = round(depth, mantissa)
|
4606
|
+
d = Topology.Dictionary(va)
|
4607
|
+
d = Dictionary.SetValueAtKey(d, key, depth)
|
4608
|
+
va = Topology.SetDictionary(va, d)
|
4609
|
+
scores.append(depth)
|
4610
|
+
return scores
|
4525
4611
|
|
4526
4612
|
@staticmethod
|
4527
4613
|
def Diameter(graph):
|
@@ -4570,7 +4656,7 @@ class Graph:
|
|
4570
4656
|
return graph.GetDictionary()
|
4571
4657
|
|
4572
4658
|
@staticmethod
|
4573
|
-
def Distance(graph, vertexA, vertexB, tolerance=0.0001):
|
4659
|
+
def Distance(graph, vertexA, vertexB, type: str = "topological", mantissa: int = 6, tolerance: float = 0.0001):
|
4574
4660
|
"""
|
4575
4661
|
Returns the shortest-path distance between the input vertices. See https://en.wikipedia.org/wiki/Distance_(graph_theory).
|
4576
4662
|
|
@@ -4582,16 +4668,22 @@ class Graph:
|
|
4582
4668
|
The first input vertex.
|
4583
4669
|
vertexB : topologic_core.Vertex
|
4584
4670
|
The second input vertex.
|
4671
|
+
type : str , optional
|
4672
|
+
The type of depth distance to calculate. The options are "topological" or "metric". The default is "topological". See https://www.spacesyntax.online/overview-2/analysis-of-spatial-relations/.
|
4673
|
+
mantissa : int , optional
|
4674
|
+
The desired length of the mantissa. The default is 6.
|
4585
4675
|
tolerance : float , optional
|
4586
4676
|
The desired tolerance. The default is 0.0001.
|
4587
4677
|
|
4588
4678
|
Returns
|
4589
4679
|
-------
|
4590
|
-
|
4591
|
-
The shortest-path distance between the input vertices.
|
4680
|
+
float
|
4681
|
+
The shortest-path metric distance between the input vertices.
|
4592
4682
|
|
4593
4683
|
"""
|
4594
4684
|
from topologicpy.Topology import Topology
|
4685
|
+
from topologicpy.Wire import Wire
|
4686
|
+
from topologicpy.Edge import Edge
|
4595
4687
|
|
4596
4688
|
if not Topology.IsInstance(graph, "Graph"):
|
4597
4689
|
print("Graph.Distance - Error: The input graph is not a valid graph. Returning None.")
|
@@ -4602,8 +4694,11 @@ class Graph:
|
|
4602
4694
|
if not Topology.IsInstance(vertexB, "Vertex"):
|
4603
4695
|
print("Graph.Distance - Error: The input vertexB is not a valid vertex. Returning None.")
|
4604
4696
|
return None
|
4605
|
-
|
4606
|
-
|
4697
|
+
|
4698
|
+
if "topo" in type.lower():
|
4699
|
+
return Graph.TopologicalDistance(graph, vertexA, vertexB, tolerance=tolerance)
|
4700
|
+
return Graph.MetricDistance(graph, vertexA, vertexB, mantissa=mantissa, tolerance=tolerance)
|
4701
|
+
|
4607
4702
|
@staticmethod
|
4608
4703
|
def Edge(graph, vertexA, vertexB, tolerance=0.0001):
|
4609
4704
|
"""
|
@@ -6520,7 +6615,7 @@ class Graph:
|
|
6520
6615
|
return json_string
|
6521
6616
|
|
6522
6617
|
@staticmethod
|
6523
|
-
def LocalClusteringCoefficient(graph, vertices: list = None, mantissa: int = 6, tolerance: float = 0.0001):
|
6618
|
+
def LocalClusteringCoefficient(graph, vertices: list = None, key: str = "lcc", mantissa: int = 6, tolerance: float = 0.0001):
|
6524
6619
|
"""
|
6525
6620
|
Returns the local clustering coefficient of the input list of vertices within the input graph. See https://en.wikipedia.org/wiki/Clustering_coefficient.
|
6526
6621
|
|
@@ -6530,6 +6625,8 @@ class Graph:
|
|
6530
6625
|
The input graph.
|
6531
6626
|
vertices : list , optional
|
6532
6627
|
The input list of vertices. If set to None, the local clustering coefficient of all vertices will be computed. The default is None.
|
6628
|
+
key : str , optional
|
6629
|
+
The dictionary key under which to save the local clustering coefficient score. The default is "lcc".
|
6533
6630
|
mantissa : int , optional
|
6534
6631
|
The desired length of the mantissa. The default is 6.
|
6535
6632
|
tolerance : float , optional
|
@@ -6543,6 +6640,7 @@ class Graph:
|
|
6543
6640
|
"""
|
6544
6641
|
from topologicpy.Vertex import Vertex
|
6545
6642
|
from topologicpy.Topology import Topology
|
6643
|
+
from topologicpy.Dictionary import Dictionary
|
6546
6644
|
|
6547
6645
|
def local_clustering_coefficient(adjacency_matrix, node):
|
6548
6646
|
"""
|
@@ -6585,14 +6683,18 @@ class Graph:
|
|
6585
6683
|
return None
|
6586
6684
|
g_vertices = Graph.Vertices(graph)
|
6587
6685
|
adjacency_matrix = Graph.AdjacencyMatrix(graph)
|
6588
|
-
|
6686
|
+
scores = []
|
6589
6687
|
for v in vertices:
|
6590
6688
|
i = Vertex.Index(v, g_vertices, tolerance=tolerance)
|
6591
6689
|
if not i == None:
|
6592
|
-
|
6690
|
+
lcc_score = round(local_clustering_coefficient(adjacency_matrix, i), mantissa)
|
6691
|
+
d = Topology.Dictionary(v)
|
6692
|
+
d = Dictionary.SetValueAtKey(d, key, lcc_score)
|
6693
|
+
v = Topology.SetDictionary(v, d)
|
6694
|
+
scores.append(lcc_score)
|
6593
6695
|
else:
|
6594
|
-
|
6595
|
-
return
|
6696
|
+
scores.append(None)
|
6697
|
+
return scores
|
6596
6698
|
|
6597
6699
|
@staticmethod
|
6598
6700
|
def LongestPath(graph, vertexA, vertexB, vertexKey=None, edgeKey=None, costKey=None, timeLimit=10, tolerance=0.0001):
|
@@ -6889,6 +6991,52 @@ class Graph:
|
|
6889
6991
|
'edgeDictionaries': e_dicts
|
6890
6992
|
}
|
6891
6993
|
|
6994
|
+
@staticmethod
|
6995
|
+
def MetricDistance(graph, vertexA, vertexB, mantissa: int = 6, tolerance: float = 0.0001):
|
6996
|
+
"""
|
6997
|
+
Returns the shortest-path distance between the input vertices. See https://en.wikipedia.org/wiki/Distance_(graph_theory).
|
6998
|
+
|
6999
|
+
Parameters
|
7000
|
+
----------
|
7001
|
+
graph : topologic_core.Graph
|
7002
|
+
The input graph.
|
7003
|
+
vertexA : topologic_core.Vertex
|
7004
|
+
The first input vertex.
|
7005
|
+
vertexB : topologic_core.Vertex
|
7006
|
+
The second input vertex.
|
7007
|
+
mantissa : int , optional
|
7008
|
+
The desired length of the mantissa. The default is 6.
|
7009
|
+
tolerance : float , optional
|
7010
|
+
The desired tolerance. The default is 0.0001.
|
7011
|
+
|
7012
|
+
Returns
|
7013
|
+
-------
|
7014
|
+
float
|
7015
|
+
The shortest-path metric distance between the input vertices.
|
7016
|
+
|
7017
|
+
"""
|
7018
|
+
from topologicpy.Topology import Topology
|
7019
|
+
from topologicpy.Wire import Wire
|
7020
|
+
from topologicpy.Edge import Edge
|
7021
|
+
|
7022
|
+
if not Topology.IsInstance(graph, "Graph"):
|
7023
|
+
print("Graph.MetricDistance - Error: The input graph is not a valid graph. Returning None.")
|
7024
|
+
return None
|
7025
|
+
if not Topology.IsInstance(vertexA, "Vertex"):
|
7026
|
+
print("Graph.MetricDistance - Error: The input vertexA is not a valid vertex. Returning None.")
|
7027
|
+
return None
|
7028
|
+
if not Topology.IsInstance(vertexB, "Vertex"):
|
7029
|
+
print("Graph.MetricDistance - Error: The input vertexB is not a valid vertex. Returning None.")
|
7030
|
+
return None
|
7031
|
+
sp = Graph.ShortestPath(graph, vertexA, vertexB, vertexKey="", edgeKey="Length", tolerance=tolerance)
|
7032
|
+
if Topology.IsInstance(sp, "Wire"):
|
7033
|
+
dist = round(Wire.Length(sp), mantissa)
|
7034
|
+
elif Topology.IsInstance(sp, "Edge"):
|
7035
|
+
dist = round(Edge.Length(sp), mantissa)
|
7036
|
+
else:
|
7037
|
+
dist = float('inf')
|
7038
|
+
return dist
|
7039
|
+
|
6892
7040
|
@staticmethod
|
6893
7041
|
def MinimumDelta(graph):
|
6894
7042
|
"""
|
@@ -7312,7 +7460,7 @@ class Graph:
|
|
7312
7460
|
return outgoing_vertices
|
7313
7461
|
|
7314
7462
|
@staticmethod
|
7315
|
-
def PageRank(graph, alpha=0.85, maxIterations=100, normalize=True, directed=False, mantissa=6, tolerance=0.0001):
|
7463
|
+
def PageRank(graph, alpha: float = 0.85, maxIterations: int = 100, normalize: bool = True, directed: bool = False, key: str = "page_rank", mantissa: int = 6, tolerance: float = 0.0001):
|
7316
7464
|
"""
|
7317
7465
|
Calculates PageRank scores for nodes in a directed graph. see https://en.wikipedia.org/wiki/PageRank.
|
7318
7466
|
|
@@ -7328,6 +7476,8 @@ class Graph:
|
|
7328
7476
|
If set to True, the results will be normalized from 0 to 1. Otherwise, they won't be. The default is True.
|
7329
7477
|
directed : bool , optional
|
7330
7478
|
If set to True, the graph is considered as a directed graph. Otherwise, it will be considered as an undirected graph. The default is False.
|
7479
|
+
key : str , optional
|
7480
|
+
The dictionary key under which to save the page_rank score. The default is "page_rank"
|
7331
7481
|
mantissa : int , optional
|
7332
7482
|
The desired length of the mantissa.
|
7333
7483
|
tolerance : float , optional
|
@@ -7340,6 +7490,8 @@ class Graph:
|
|
7340
7490
|
"""
|
7341
7491
|
from topologicpy.Vertex import Vertex
|
7342
7492
|
from topologicpy.Helper import Helper
|
7493
|
+
from topologicpy.Dictionary import Dictionary
|
7494
|
+
from topologicpy.Topology import Topology
|
7343
7495
|
|
7344
7496
|
vertices = Graph.Vertices(graph)
|
7345
7497
|
num_vertices = len(vertices)
|
@@ -7368,6 +7520,10 @@ class Graph:
|
|
7368
7520
|
scores = Helper.Normalize(scores, mantissa=mantissa)
|
7369
7521
|
else:
|
7370
7522
|
scores = [round(x, mantissa) for x in scores]
|
7523
|
+
for i, v in enumerate(vertices):
|
7524
|
+
d = Topology.Dictionary(v)
|
7525
|
+
d = Dictionary.SetValueAtKey(d, key, scores[i])
|
7526
|
+
v = Topology.SetDictionary(v, d)
|
7371
7527
|
return scores
|
7372
7528
|
|
7373
7529
|
@staticmethod
|
@@ -7756,13 +7912,14 @@ class Graph:
|
|
7756
7912
|
gsv = Graph.NearestVertex(graph, vertexA)
|
7757
7913
|
gev = Graph.NearestVertex(graph, vertexB)
|
7758
7914
|
shortest_path = graph.ShortestPath(gsv, gev, vertexKey, edgeKey)
|
7759
|
-
if
|
7760
|
-
|
7761
|
-
|
7762
|
-
|
7763
|
-
if
|
7764
|
-
|
7765
|
-
|
7915
|
+
if not shortest_path == None:
|
7916
|
+
if Topology.IsInstance(shortest_path, "Edge"):
|
7917
|
+
shortest_path = Wire.ByEdges([shortest_path])
|
7918
|
+
sv = Topology.Vertices(shortest_path)[0]
|
7919
|
+
if Vertex.Distance(sv, gev) < tolerance: # Path is reversed. Correct it.
|
7920
|
+
if Topology.IsInstance(shortest_path, "Wire"):
|
7921
|
+
shortest_path = Wire.Reverse(shortest_path)
|
7922
|
+
shortest_path = Wire.OrientEdges(shortest_path, Wire.StartVertex(shortest_path), tolerance=tolerance)
|
7766
7923
|
return shortest_path
|
7767
7924
|
except:
|
7768
7925
|
return None
|
topologicpy/Plotly.py
CHANGED
@@ -366,15 +366,12 @@ class Plotly:
|
|
366
366
|
v_label = ""
|
367
367
|
v_group = ""
|
368
368
|
d = Topology.Dictionary(v)
|
369
|
+
v_group = Dictionary.ValueAtKey(d, key=vertexGroupKey)
|
369
370
|
if d:
|
370
|
-
|
371
|
+
if vertexLabelKey:
|
371
372
|
v_label = str(Dictionary.ValueAtKey(d, key=vertexLabelKey)) or ""
|
372
|
-
|
373
|
-
|
374
|
-
try:
|
375
|
-
v_group = Dictionary.ValueAtKey(d, key=vertexGroupKey)
|
376
|
-
except:
|
377
|
-
v_group = None
|
373
|
+
if vertexGroupKey:
|
374
|
+
v_group = Dictionary.ValueAtKey(d, key=vertexGroupKey) or None
|
378
375
|
try:
|
379
376
|
v_groupList.append(vertexGroups.index(v_group))
|
380
377
|
except:
|
topologicpy/Shell.py
CHANGED
@@ -269,7 +269,7 @@ class Shell():
|
|
269
269
|
return None
|
270
270
|
|
271
271
|
@staticmethod
|
272
|
-
def ByFaces(faces: list, tolerance: float = 0.0001):
|
272
|
+
def ByFaces(faces: list, tolerance: float = 0.0001, silent=False):
|
273
273
|
"""
|
274
274
|
Creates a shell from the input list of faces.
|
275
275
|
|
@@ -279,6 +279,8 @@ class Shell():
|
|
279
279
|
The input list of faces.
|
280
280
|
tolerance : float , optional
|
281
281
|
The desired tolerance. The default is 0.0001.
|
282
|
+
silent : bool , optional
|
283
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
282
284
|
|
283
285
|
Returns
|
284
286
|
-------
|
@@ -300,7 +302,8 @@ class Shell():
|
|
300
302
|
if Topology.IsInstance(shell, "Shell"):
|
301
303
|
return shell
|
302
304
|
else:
|
303
|
-
|
305
|
+
if not silent:
|
306
|
+
print("Shell.ByFaces - Error: Could not create shell. Returning None.")
|
304
307
|
return None
|
305
308
|
else:
|
306
309
|
return shell
|
@@ -396,9 +399,11 @@ class Shell():
|
|
396
399
|
topologic_core.Shell
|
397
400
|
The creates shell.
|
398
401
|
"""
|
402
|
+
from topologicpy.Vertex import Vertex
|
399
403
|
from topologicpy.Edge import Edge
|
400
404
|
from topologicpy.Wire import Wire
|
401
405
|
from topologicpy.Face import Face
|
406
|
+
from topologicpy.Cluster import Cluster
|
402
407
|
from topologicpy.Topology import Topology
|
403
408
|
|
404
409
|
if not isinstance(wires, list):
|
@@ -440,6 +445,24 @@ class Shell():
|
|
440
445
|
e5 = Edge.ByVertices([e1.StartVertex(), e2.EndVertex()], tolerance=tolerance, silent=silent)
|
441
446
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e5, e4], tolerance=tolerance), tolerance=tolerance))
|
442
447
|
faces.append(Face.ByWire(Wire.ByEdges([e2, e5, e3], tolerance=tolerance), tolerance=tolerance))
|
448
|
+
elif e3:
|
449
|
+
verts = [Edge.StartVertex(e1), Edge.EndVertex(e1), Edge.StartVertex(e3), Edge.EndVertex(e3), Edge.StartVertex(e2), Edge.EndVertex(e2)]
|
450
|
+
verts = Vertex.Fuse(verts, tolerance=tolerance)
|
451
|
+
w = Wire.ByVertices(verts, close=True)
|
452
|
+
if Topology.IsInstance(w, "Wire"):
|
453
|
+
faces.append(Face.ByWire(w, tolerance=tolerance))
|
454
|
+
else:
|
455
|
+
if not silent:
|
456
|
+
print("Shell.ByWires - Warning: Could not create face.")
|
457
|
+
elif e4:
|
458
|
+
verts = [Edge.StartVertex(e1), Edge.EndVertex(e1), Edge.StartVertex(e4), Edge.EndVertex(e4), Edge.StartVertex(e2), Edge.EndVertex(e2)]
|
459
|
+
verts = Vertex.Fuse(verts, tolerance=tolerance)
|
460
|
+
w = Wire.ByVertices(verts, close=True)
|
461
|
+
if Topology.IsInstance(w, "Wire"):
|
462
|
+
faces.append(Face.ByWire(w, tolerance=tolerance))
|
463
|
+
else:
|
464
|
+
if not silent:
|
465
|
+
print("Shell.ByWires - Warning: Could not create face.")
|
443
466
|
else:
|
444
467
|
for j in range (len(w1_edges)):
|
445
468
|
e1 = w1_edges[j]
|
@@ -466,10 +489,30 @@ class Shell():
|
|
466
489
|
except:
|
467
490
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e3, e2, e4], tolerance=tolerance), tolerance=tolerance))
|
468
491
|
elif e3:
|
469
|
-
|
492
|
+
verts = [Edge.StartVertex(e1), Edge.EndVertex(e1), Edge.StartVertex(e3), Edge.EndVertex(e3), Edge.StartVertex(e2), Edge.EndVertex(e2)]
|
493
|
+
verts = Vertex.Fuse(verts, tolerance=tolerance)
|
494
|
+
w = Wire.ByVertices(verts, close=True)
|
495
|
+
if Topology.IsInstance(w, "Wire"):
|
496
|
+
faces.append(Face.ByWire(w, tolerance=tolerance))
|
497
|
+
else:
|
498
|
+
if not silent:
|
499
|
+
print("Shell.ByWires - Warning: Could not create face.")
|
470
500
|
elif e4:
|
471
|
-
|
472
|
-
|
501
|
+
verts = [Edge.StartVertex(e1), Edge.EndVertex(e1), Edge.StartVertex(e4), Edge.EndVertex(e4), Edge.StartVertex(e2), Edge.EndVertex(e2)]
|
502
|
+
verts = Vertex.Fuse(verts, tolerance=tolerance)
|
503
|
+
w = Wire.ByVertices(verts, close=True)
|
504
|
+
if Topology.IsInstance(w, "Wire"):
|
505
|
+
faces.append(Face.ByWire(w, tolerance=tolerance))
|
506
|
+
else:
|
507
|
+
if not silent:
|
508
|
+
print("Shell.ByWires - Warning: Could not create face.")
|
509
|
+
|
510
|
+
shell = Shell.ByFaces(faces, tolerance=tolerance, silent=silent)
|
511
|
+
if shell == None:
|
512
|
+
if not silent:
|
513
|
+
print("Shell.ByWires - Warning: Could not create shell. Returning a cluster of faces instead.")
|
514
|
+
return Cluster.ByTopologies(faces)
|
515
|
+
return shell
|
473
516
|
|
474
517
|
@staticmethod
|
475
518
|
def ByWiresCluster(cluster, triangulate: bool = True, tolerance: float = 0.0001, silent: bool = False):
|
@@ -1058,10 +1101,10 @@ class Shell():
|
|
1058
1101
|
|
1059
1102
|
|
1060
1103
|
@staticmethod
|
1061
|
-
def
|
1062
|
-
direction: list = [0, 0, 1], placement: str ="center", mantissa: int = 6, tolerance: float = 0.0001):
|
1104
|
+
def Paraboloid(origin= None, focalLength=0.125, width: float = 1, length: float = 1, uSides: int = 16, vSides: int = 16,
|
1105
|
+
direction: list = [0, 0, 1], placement: str ="center", mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False):
|
1063
1106
|
"""
|
1064
|
-
Creates a
|
1107
|
+
Creates a paraboloid. See https://en.wikipedia.org/wiki/Paraboloid
|
1065
1108
|
|
1066
1109
|
Parameters
|
1067
1110
|
----------
|
@@ -1085,11 +1128,13 @@ class Shell():
|
|
1085
1128
|
The desired length of the mantissa. The default is 6.
|
1086
1129
|
tolerance : float , optional
|
1087
1130
|
The desired tolerance. The default is 0.0001.
|
1131
|
+
silent : bool , optional
|
1132
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1088
1133
|
|
1089
1134
|
Returns
|
1090
1135
|
-------
|
1091
1136
|
topologic_core.Shell
|
1092
|
-
The created
|
1137
|
+
The created paraboloid.
|
1093
1138
|
|
1094
1139
|
"""
|
1095
1140
|
from topologicpy.Vertex import Vertex
|
@@ -1197,6 +1242,7 @@ class Shell():
|
|
1197
1242
|
from topologicpy.Vertex import Vertex
|
1198
1243
|
from topologicpy.Face import Face
|
1199
1244
|
from topologicpy.Topology import Topology
|
1245
|
+
|
1200
1246
|
if not Topology.IsInstance(origin, "Vertex"):
|
1201
1247
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
1202
1248
|
if not Topology.IsInstance(origin, "Vertex"):
|
topologicpy/Topology.py
CHANGED
@@ -2829,7 +2829,7 @@ class Topology():
|
|
2829
2829
|
defaultColor: list = [255,255,255],
|
2830
2830
|
defaultOpacity: float = 1.0,
|
2831
2831
|
transposeAxes: bool = True,
|
2832
|
-
removeCoplanarFaces: bool =
|
2832
|
+
removeCoplanarFaces: bool = False,
|
2833
2833
|
selfMerge: bool = True,
|
2834
2834
|
mantissa : int = 6,
|
2835
2835
|
tolerance: float = 0.0001):
|
@@ -2888,7 +2888,7 @@ class Topology():
|
|
2888
2888
|
@staticmethod
|
2889
2889
|
def ByOBJPath(objPath,
|
2890
2890
|
defaultColor: list = [255,255,255], defaultOpacity: float = 1.0,
|
2891
|
-
transposeAxes: bool = True, removeCoplanarFaces: bool =
|
2891
|
+
transposeAxes: bool = True, removeCoplanarFaces: bool = False,
|
2892
2892
|
selfMerge: bool = False,
|
2893
2893
|
mantissa : int = 6, tolerance: float = 0.0001):
|
2894
2894
|
"""
|
@@ -3123,16 +3123,19 @@ class Topology():
|
|
3123
3123
|
selector = Topology.SetDictionary(selector, d)
|
3124
3124
|
face_selectors.append(selector)
|
3125
3125
|
|
3126
|
-
topology = Cluster.ByTopologies(object_faces
|
3127
|
-
if
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3126
|
+
topology = Cluster.ByTopologies(object_faces)
|
3127
|
+
if Topology.IsInstance(topology, "Topology"):
|
3128
|
+
if selfMerge:
|
3129
|
+
topology = Topology.SelfMerge(topology)
|
3130
|
+
if Topology.IsInstance(topology, "Topology"):
|
3131
|
+
if removeCoplanarFaces:
|
3132
|
+
topology = Topology.RemoveCoplanarFaces(topology, tolerance=tolerance)
|
3133
|
+
if Topology.IsInstance(topology, "Topology"):
|
3134
|
+
d = Dictionary.ByKeysValues(['name', 'color', 'opacity'], [object_name, object_color, object_opacity])
|
3135
|
+
topology = Topology.SetDictionary(topology, d)
|
3136
|
+
if len(face_selectors) > 0:
|
3137
|
+
topology = Topology.TransferDictionariesBySelectors(topology, selectors=face_selectors, tranFaces=True, tolerance=tolerance)
|
3138
|
+
return_topologies.append(topology)
|
3136
3139
|
return return_topologies
|
3137
3140
|
|
3138
3141
|
@staticmethod
|
@@ -7483,10 +7486,13 @@ class Topology():
|
|
7483
7486
|
"""
|
7484
7487
|
from topologicpy.Graph import Graph
|
7485
7488
|
|
7489
|
+
|
7486
7490
|
if Topology.IsInstance(topology, "Vertex"):
|
7487
7491
|
return []
|
7488
7492
|
if Topology.IsInstance(topology, "Graph"):
|
7489
7493
|
return Graph.Vertices(topology)
|
7494
|
+
if topology == None:
|
7495
|
+
return None
|
7490
7496
|
return Topology.SubTopologies(topology=topology, subTopologyType="vertex")
|
7491
7497
|
|
7492
7498
|
@staticmethod
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.46'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.46
|
4
4
|
Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
6
6
|
License: MIT License
|
@@ -49,7 +49,7 @@ Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'test'
|
|
49
49
|
|
50
50
|
<img src="https://topologic.app/wp-content/uploads/2023/02/topologicpy-logo-no-loop.gif" alt="topologicpy logo" width="250" loop="1">
|
51
51
|
|
52
|
-
# An
|
52
|
+
# An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction
|
53
53
|
|
54
54
|
## Introduction
|
55
55
|
Welcome to topologicpy (rhymes with apple pie). topologicpy is an open-source python 3 implementation of [Topologic](https://topologic.app) which is a powerful spatial modelling and analysis software library that revolutionizes the way you design architectural spaces, buildings, and artefacts. Topologic's advanced features enable you to create hierarchical and topological information-rich 3D representations that offer unprecedented flexibility and control in your design process. With the integration of geometry, topology, information, and artificial intelligence, Topologic enriches Building Information Models with Building *Intelligence* Models.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
topologicpy/ANN.py,sha256=XAuUjNvDRK1hhXfo82S-zXmnAPZGEdHJMRdfpu0aJ8I,47901
|
2
2
|
topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
|
3
|
-
topologicpy/Cell.py,sha256=
|
3
|
+
topologicpy/Cell.py,sha256=ITQ9EdWEGNKW57EJTewmIhlgk8hk8McM8ZA5oDmubMk,105866
|
4
4
|
topologicpy/CellComplex.py,sha256=x474N-lo1krpdIGrWRAFRdDup5a_1V-mLORTS6ZGZ7M,48227
|
5
5
|
topologicpy/Cluster.py,sha256=TZXuxzdaUr6OHSWnjWpjCOMlVj6YHBH8aUVbDVsncVA,54999
|
6
6
|
topologicpy/Color.py,sha256=UlmRcCSOhqcM_OyMWz4t3Kr75KcgXDhz3uctAJ2n7Ic,18031
|
@@ -9,27 +9,27 @@ topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
|
|
9
9
|
topologicpy/Dictionary.py,sha256=KqJ29YyE23Y3Xc6XmKLSCZXRfBvm-OEOxlMZ4dt-rfM,27094
|
10
10
|
topologicpy/Edge.py,sha256=vhYHkobSLGSWV-oe2oJFFDobqFToDyb7s71yQ840AAA,65166
|
11
11
|
topologicpy/EnergyModel.py,sha256=XcCP55VW5WHDIIKcURijmBOZEgNUDEn_V9h5EejkntA,53876
|
12
|
-
topologicpy/Face.py,sha256=
|
13
|
-
topologicpy/Graph.py,sha256=
|
12
|
+
topologicpy/Face.py,sha256=pn0LGusTPKLrHEMhY94_Bs3rc4wUpIyEqyW9q-ftdG0,115379
|
13
|
+
topologicpy/Graph.py,sha256=WSnzXQ2Zy7J6WrzhMAvqChCKUHccwsJ2S6fMPCE9d5k,401706
|
14
14
|
topologicpy/Grid.py,sha256=3-sn7CHWGcXk18XCnHjsUttNJTWwmN63g_Insj__p04,18218
|
15
15
|
topologicpy/Helper.py,sha256=i-AfI29NMsZXBaymjilfvxQbuS3wpYbpPw4RWu1YCHs,16358
|
16
16
|
topologicpy/Honeybee.py,sha256=vcBECJlgWVjNNdD9ZmjNik_pA1Y_ZNoOorsQb2CiyGA,21965
|
17
17
|
topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
|
18
18
|
topologicpy/Neo4j.py,sha256=YvtF7RYUMATEZ8iHwFwK_MOxEDyARby2DTI2CCK6-cI,19694
|
19
|
-
topologicpy/Plotly.py,sha256=
|
19
|
+
topologicpy/Plotly.py,sha256=Q1jrHXFFNwzA6lMa5V0sH7I5p5KRp5y_WohDnhIlB2E,105354
|
20
20
|
topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
|
21
21
|
topologicpy/PyG.py,sha256=0yeECsMz-dqhhZSv52s_xPCO_3BcEXUK7z1YFDN9qoo,106987
|
22
|
-
topologicpy/Shell.py,sha256=
|
22
|
+
topologicpy/Shell.py,sha256=aKdWIAqmLKPyi80f2PtH3_1iMfQRW0Eklbqol9cOPWM,87601
|
23
23
|
topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
|
24
24
|
topologicpy/Sun.py,sha256=InnKtX8eKwtAgcScuABH6yp0ljmWh5m_fDR4-n3jJMY,36869
|
25
|
-
topologicpy/Topology.py,sha256=
|
25
|
+
topologicpy/Topology.py,sha256=XyXMuw1jTFdHJbuYNub_ngr9mFHmKxejUR7fe6denlk,366314
|
26
26
|
topologicpy/Vector.py,sha256=WQQUbwrg7VKImtxuBUi2i-FRiPT77WlrzLP05gdXKM8,33079
|
27
27
|
topologicpy/Vertex.py,sha256=EQdVYHmW85_pZdHZB3N8pEi0GiadCCkF3z_oqohA7B0,71161
|
28
28
|
topologicpy/Wire.py,sha256=9EJE0Iq3nGz5X7Suy6xxjmuOpfV49By6WH98UAL_7m4,153532
|
29
29
|
topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
|
30
|
-
topologicpy/version.py,sha256=
|
31
|
-
topologicpy-0.7.
|
32
|
-
topologicpy-0.7.
|
33
|
-
topologicpy-0.7.
|
34
|
-
topologicpy-0.7.
|
35
|
-
topologicpy-0.7.
|
30
|
+
topologicpy/version.py,sha256=KS8XMe6gtPTpXK_NuIsgQNydQGzAwZnWmO4_bKiEme0,23
|
31
|
+
topologicpy-0.7.46.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
|
32
|
+
topologicpy-0.7.46.dist-info/METADATA,sha256=42EcbfaksmdqQVvLq3CqNLHTn-rvIV0e1jCBXyFQz4A,10918
|
33
|
+
topologicpy-0.7.46.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
34
|
+
topologicpy-0.7.46.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
35
|
+
topologicpy-0.7.46.dist-info/RECORD,,
|
File without changes
|
File without changes
|