topologicpy 0.7.94__py3-none-any.whl → 0.7.96__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 +30 -29
- topologicpy/CellComplex.py +9 -8
- topologicpy/DGL.py +3 -2
- topologicpy/Edge.py +14 -14
- topologicpy/EnergyModel.py +7 -7
- topologicpy/Graph.py +29 -26
- topologicpy/Honeybee.py +1 -1
- topologicpy/Neo4j.py +3 -2
- topologicpy/Shell.py +9 -9
- topologicpy/Topology.py +6 -5
- topologicpy/Vertex.py +21 -15
- topologicpy/Wire.py +133 -52
- topologicpy/version.py +1 -1
- {topologicpy-0.7.94.dist-info → topologicpy-0.7.96.dist-info}/METADATA +1 -1
- {topologicpy-0.7.94.dist-info → topologicpy-0.7.96.dist-info}/RECORD +18 -18
- {topologicpy-0.7.94.dist-info → topologicpy-0.7.96.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.94.dist-info → topologicpy-0.7.96.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.94.dist-info → topologicpy-0.7.96.dist-info}/top_level.txt +0 -0
topologicpy/Cell.py
CHANGED
@@ -348,8 +348,8 @@ class Cell():
|
|
348
348
|
bottomEdges = Topology.Edges(bottomFace)
|
349
349
|
for bottomEdge in bottomEdges:
|
350
350
|
topEdge = Topology.Translate(bottomEdge, faceNormal[0]*thickness, faceNormal[1]*thickness, faceNormal[2]*thickness)
|
351
|
-
sideEdge1 = Edge.ByVertices([
|
352
|
-
sideEdge2 = Edge.ByVertices([
|
351
|
+
sideEdge1 = Edge.ByVertices([Edge.StartVertex(bottomEdge), Edge.StartVertex(topEdge)], tolerance=tolerance, silent=True)
|
352
|
+
sideEdge2 = Edge.ByVertices([Edge.EndVertex(bottomEdge), Edge.EndVertex(topEdge)], tolerance=tolerance, silent=True)
|
353
353
|
cellWire = Topology.SelfMerge(Cluster.ByTopologies([bottomEdge, sideEdge1, topEdge, sideEdge2]), tolerance=tolerance)
|
354
354
|
cellFaces.append(Face.ByWire(cellWire, tolerance=tolerance))
|
355
355
|
return Cell.ByFaces(cellFaces, planarize=planarize, tolerance=tolerance)
|
@@ -485,23 +485,23 @@ class Cell():
|
|
485
485
|
e3 = None
|
486
486
|
e4 = None
|
487
487
|
try:
|
488
|
-
e3 = Edge.ByVertices([
|
488
|
+
e3 = Edge.ByVertices([Edge.StartVertex(e1), Edge.StartVertex(e2)], tolerance=tolerance, silent=True)
|
489
489
|
except:
|
490
490
|
try:
|
491
|
-
e4 = Edge.ByVertices([
|
491
|
+
e4 = Edge.ByVertices([Edge.EndVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=True)
|
492
492
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e2, e4], tolerance=tolerance), tolerance=tolerance))
|
493
493
|
except:
|
494
494
|
pass
|
495
495
|
try:
|
496
|
-
e4 = Edge.ByVertices([
|
496
|
+
e4 = Edge.ByVertices([Edge.EndVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=True)
|
497
497
|
except:
|
498
498
|
try:
|
499
|
-
e3 = Edge.ByVertices([
|
499
|
+
e3 = Edge.ByVertices([Edge.StartVertex(e1), Edge.StartVertex(e2)], tolerance=tolerance, silent=True)
|
500
500
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e2, e3], tolerance=tolerance), tolerance=tolerance))
|
501
501
|
except:
|
502
502
|
pass
|
503
503
|
if e3 and e4:
|
504
|
-
e5 = Edge.ByVertices([
|
504
|
+
e5 = Edge.ByVertices([Edge.StartVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=True)
|
505
505
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e5, e4], tolerance=tolerance), tolerance=tolerance))
|
506
506
|
faces.append(Face.ByWire(Wire.ByEdges([e2, e5, e3], tolerance=tolerance), tolerance=tolerance))
|
507
507
|
else:
|
@@ -511,17 +511,17 @@ class Cell():
|
|
511
511
|
e3 = None
|
512
512
|
e4 = None
|
513
513
|
try:
|
514
|
-
e3 = Edge.ByVertices([
|
514
|
+
e3 = Edge.ByVertices([Edge.StartVertex(e1), Edge.StartVertex(e2)], tolerance=tolerance, silent=True)
|
515
515
|
except:
|
516
516
|
try:
|
517
|
-
e4 = Edge.ByVertices([
|
517
|
+
e4 = Edge.ByVertices([Edge.EndVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=True)
|
518
518
|
except:
|
519
519
|
pass
|
520
520
|
try:
|
521
|
-
e4 = Edge.ByVertices([
|
521
|
+
e4 = Edge.ByVertices([Edge.EndVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=True)
|
522
522
|
except:
|
523
523
|
try:
|
524
|
-
e3 = Edge.ByVertices([
|
524
|
+
e3 = Edge.ByVertices([Edge.StartVertex(e1), Edge.StartVertex(e2)], tolerance=tolerance, silent=True)
|
525
525
|
except:
|
526
526
|
pass
|
527
527
|
if e3 and e4:
|
@@ -764,8 +764,8 @@ class Cell():
|
|
764
764
|
yOffset = max(baseRadius, topRadius)
|
765
765
|
zOffset = 0
|
766
766
|
|
767
|
-
baseZ =
|
768
|
-
topZ =
|
767
|
+
baseZ = Vertex.Z(origin) + zOffset
|
768
|
+
topZ = Vertex.Z(origin) + zOffset + height
|
769
769
|
baseV = []
|
770
770
|
topV = []
|
771
771
|
for i in range(uSides):
|
@@ -913,7 +913,7 @@ class Cell():
|
|
913
913
|
baseY = Vertex.Y(origin, mantissa=mantissa) + yOffset
|
914
914
|
size = radius*3
|
915
915
|
for i in range(1, vSides):
|
916
|
-
baseZ =
|
916
|
+
baseZ = Vertex.Z(origin) + zOffset + float(height)/float(vSides)*i
|
917
917
|
tool_origin = Vertex.ByCoordinates(baseX, baseY, baseZ)
|
918
918
|
cutting_planes.append(Face.ByWire(Wire.Rectangle(origin=tool_origin, width=size, length=size), tolerance=tolerance))
|
919
919
|
cutting_planes_cluster = Cluster.ByTopologies(cutting_planes)
|
@@ -950,6 +950,7 @@ class Cell():
|
|
950
950
|
8. "inclinedApertures": list of inclined apertures
|
951
951
|
|
952
952
|
"""
|
953
|
+
from topologicpy.Vertex import Vertex
|
953
954
|
from topologicpy.Face import Face
|
954
955
|
from topologicpy.Vector import Vector
|
955
956
|
from topologicpy.Aperture import Aperture
|
@@ -986,7 +987,7 @@ class Cell():
|
|
986
987
|
faces = Cell.Faces(cell)
|
987
988
|
zList = []
|
988
989
|
for f in faces:
|
989
|
-
zList.append(
|
990
|
+
zList.append(Vertex.Z(Topology.Centroid(f)))
|
990
991
|
zMin = min(zList)
|
991
992
|
zMax = max(zList)
|
992
993
|
up = [0, 0, 1]
|
@@ -997,14 +998,14 @@ class Cell():
|
|
997
998
|
verticalFaces.append(aFace)
|
998
999
|
verticalApertures += getApertures(aFace)
|
999
1000
|
elif aCode == 1:
|
1000
|
-
if abs(
|
1001
|
+
if abs(Vertex.Z(Topology.Centroid(aFace)) - zMin) < tolerance:
|
1001
1002
|
bottomHorizontalFaces.append(aFace)
|
1002
1003
|
bottomHorizontalApertures += getApertures(aFace)
|
1003
1004
|
else:
|
1004
1005
|
topHorizontalFaces.append(aFace)
|
1005
1006
|
topHorizontalApertures += getApertures(aFace)
|
1006
1007
|
elif aCode == 2:
|
1007
|
-
if abs(
|
1008
|
+
if abs(Vertex.Z(Topology.Centroid(aFace)) - zMax) < tolerance:
|
1008
1009
|
topHorizontalFaces.append(aFace)
|
1009
1010
|
topHorizontalApertures += getApertures(aFace)
|
1010
1011
|
else:
|
@@ -1344,8 +1345,8 @@ class Cell():
|
|
1344
1345
|
elif placement.lower() == "lowerleft":
|
1345
1346
|
xOffset = max(baseRadius, topRadius)
|
1346
1347
|
yOffset = max(baseRadius, topRadius)
|
1347
|
-
baseZ =
|
1348
|
-
topZ =
|
1348
|
+
baseZ = Vertex.Z(w_origin) + zOffset
|
1349
|
+
topZ = Vertex.Z(w_origin) + zOffset + height
|
1349
1350
|
for i in range(sides):
|
1350
1351
|
angle = math.radians(360/sides)*i
|
1351
1352
|
if baseRadius > 0:
|
@@ -1789,8 +1790,8 @@ class Cell():
|
|
1789
1790
|
topV = []
|
1790
1791
|
|
1791
1792
|
if Topology.IsInstance(profile, "Wire"):
|
1792
|
-
baseWire = Topology.Translate(profile, 0 , 0,
|
1793
|
-
topWire = Topology.Translate(profile, 0 , 0,
|
1793
|
+
baseWire = Topology.Translate(profile, 0 , 0, Vertex.Z(sv))
|
1794
|
+
topWire = Topology.Translate(profile, 0 , 0, Vertex.Z(sv)+dist)
|
1794
1795
|
else:
|
1795
1796
|
for i in range(sides):
|
1796
1797
|
angle = math.radians(360/sides)*i
|
@@ -1813,13 +1814,13 @@ class Cell():
|
|
1813
1814
|
pipe = Topology.Rotate(pipe, origin=sv, axis=[0, 0, 1], angle=phi)
|
1814
1815
|
zzz = Vertex.ByCoordinates(0, 0, 0)
|
1815
1816
|
if endcapA:
|
1816
|
-
origin =
|
1817
|
+
origin = Edge.StartVertex(edge)
|
1817
1818
|
x1 = Vertex.X(origin, mantissa=mantissa)
|
1818
1819
|
y1 = Vertex.Y(origin, mantissa=mantissa)
|
1819
1820
|
z1 = Vertex.Z(origin, mantissa=mantissa)
|
1820
|
-
x2 = Vertex.X(
|
1821
|
-
y2 = Vertex.Y(
|
1822
|
-
z2 = Vertex.Z(
|
1821
|
+
x2 = Vertex.X(Edge.EndVertex(edge), mantissa=mantissa)
|
1822
|
+
y2 = Vertex.Y(Edge.EndVertex(edge), mantissa=mantissa)
|
1823
|
+
z2 = Vertex.Z(Edge.EndVertex(edge), mantissa=mantissa)
|
1823
1824
|
dx = x2 - x1
|
1824
1825
|
dy = y2 - y1
|
1825
1826
|
dz = z2 - z1
|
@@ -1834,13 +1835,13 @@ class Cell():
|
|
1834
1835
|
endcapA = Topology.Rotate(endcapA, origin=zzz, axis=[0, 0, 1], angle=phi+180)
|
1835
1836
|
endcapA = Topology.Translate(endcapA, Vertex.X(origin, mantissa=mantissa), Vertex.Y(origin, mantissa=mantissa), Vertex.Z(origin, mantissa=mantissa))
|
1836
1837
|
if endcapB:
|
1837
|
-
origin =
|
1838
|
+
origin = Edge.EndVertex(edge)
|
1838
1839
|
x1 = Vertex.X(origin, mantissa=mantissa)
|
1839
1840
|
y1 = Vertex.Y(origin, mantissa=mantissa)
|
1840
1841
|
z1 = Vertex.Z(origin, mantissa=mantissa)
|
1841
|
-
x2 = Vertex.X(
|
1842
|
-
y2 = Vertex.Y(
|
1843
|
-
z2 = Vertex.Z(
|
1842
|
+
x2 = Vertex.X(Edge.StartVertex(edge), mantissa=mantissa)
|
1843
|
+
y2 = Vertex.Y(Edge.StartVertex(edge), mantissa=mantissa)
|
1844
|
+
z2 = Vertex.Z(Edge.StartVertex(edge), mantissa=mantissa)
|
1844
1845
|
dx = x2 - x1
|
1845
1846
|
dy = y2 - y1
|
1846
1847
|
dz = z2 - z1
|
topologicpy/CellComplex.py
CHANGED
@@ -350,10 +350,10 @@ class CellComplex():
|
|
350
350
|
e3 = None
|
351
351
|
e4 = None
|
352
352
|
try:
|
353
|
-
e3 = Edge.ByStartVertexEndVertex(
|
353
|
+
e3 = Edge.ByStartVertexEndVertex(Edge.StartVertex(e1), Edge.StartVertex(e2), tolerance=tolerance, silent=True)
|
354
354
|
except:
|
355
355
|
try:
|
356
|
-
e4 = Edge.ByStartVertexEndVertex(
|
356
|
+
e4 = Edge.ByStartVertexEndVertex(Edge.EndVertex(e1), Edge.EndVertex(e2), tolerance=tolerance, silent=True)
|
357
357
|
f = Face.ByExternalBoundary(Wire.ByEdges([e1, e2, e4], tolerance=tolerance))
|
358
358
|
if triangulate == True:
|
359
359
|
if len(Topology.Vertices(face)) > 3:
|
@@ -366,10 +366,10 @@ class CellComplex():
|
|
366
366
|
except:
|
367
367
|
pass
|
368
368
|
try:
|
369
|
-
e4 = Edge.ByStartVertexEndVertex(
|
369
|
+
e4 = Edge.ByStartVertexEndVertex(Edge.EndVertex(e1), Edge.EndVertex(e2), tolerance=tolerance, silent=True)
|
370
370
|
except:
|
371
371
|
try:
|
372
|
-
e3 = Edge.ByStartVertexEndVertex(
|
372
|
+
e3 = Edge.ByStartVertexEndVertex(Edge.StartVertex(e1), Edge.StartVertex(e2), tolerance=tolerance, silent=True)
|
373
373
|
f = Face.ByWire(Wire.ByEdges([e1, e2, e3], tolerance=tolerance), tolerance=tolerance)
|
374
374
|
if triangulate == True:
|
375
375
|
if len(Topology.Vertices(face)) > 3:
|
@@ -383,7 +383,7 @@ class CellComplex():
|
|
383
383
|
pass
|
384
384
|
if e3 and e4:
|
385
385
|
if triangulate == True:
|
386
|
-
e5 = Edge.ByStartVertexEndVertex(
|
386
|
+
e5 = Edge.ByStartVertexEndVertex(Edge.StartVertex(e1), Edge.EndVertex(e2), tolerance=tolerance, silent=True)
|
387
387
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e5, e4], tolerance=tolerance), tolerance=tolerance))
|
388
388
|
faces.append(Face.ByWire(Wire.ByEdges([e2, e5, e3], tolerance=tolerance), tolerance=tolerance))
|
389
389
|
else:
|
@@ -485,6 +485,7 @@ class CellComplex():
|
|
485
485
|
15. "internalInclinedApertures": list of internal inclined apertures
|
486
486
|
|
487
487
|
"""
|
488
|
+
from topologicpy.Vertex import Vertex
|
488
489
|
from topologicpy.Face import Face
|
489
490
|
from topologicpy.Vector import Vector
|
490
491
|
from topologicpy.Aperture import Aperture
|
@@ -527,7 +528,7 @@ class CellComplex():
|
|
527
528
|
faces = CellComplex.Faces(cellComplex)
|
528
529
|
zList = []
|
529
530
|
for f in faces:
|
530
|
-
zList.append(
|
531
|
+
zList.append(Vertex.Z(Topology.Centroid(f)))
|
531
532
|
zMin = min(zList)
|
532
533
|
zMax = max(zList)
|
533
534
|
up = [0, 0, 1]
|
@@ -545,7 +546,7 @@ class CellComplex():
|
|
545
546
|
internalVerticalApertures += getApertures(aFace)
|
546
547
|
elif aCode == 1:
|
547
548
|
if n == 1:
|
548
|
-
if abs(
|
549
|
+
if abs(Vertex.Z(Topology.Centroid(aFace)) - zMin) < tolerance:
|
549
550
|
bottomHorizontalFaces.append(aFace)
|
550
551
|
bottomHorizontalApertures += getApertures(aFace)
|
551
552
|
else:
|
@@ -556,7 +557,7 @@ class CellComplex():
|
|
556
557
|
internalHorizontalApertures += getApertures(aFace)
|
557
558
|
elif aCode == 2:
|
558
559
|
if n == 1:
|
559
|
-
if abs(
|
560
|
+
if abs(Vertex.Z(Topology.Centroid(aFace)) - zMax) < tolerance:
|
560
561
|
topHorizontalFaces.append(aFace)
|
561
562
|
topHorizontalApertures += getApertures(aFace)
|
562
563
|
else:
|
topologicpy/DGL.py
CHANGED
@@ -1633,6 +1633,7 @@ class DGL:
|
|
1633
1633
|
|
1634
1634
|
"""
|
1635
1635
|
from topologicpy.Vertex import Vertex
|
1636
|
+
from topologicpy.Edge import Edge
|
1636
1637
|
from topologicpy.Graph import Graph
|
1637
1638
|
from topologicpy.Dictionary import Dictionary
|
1638
1639
|
from topologicpy.Topology import Topology
|
@@ -1661,8 +1662,8 @@ class DGL:
|
|
1661
1662
|
|
1662
1663
|
for i in range(len(edges)):
|
1663
1664
|
e = edges[i]
|
1664
|
-
sv =
|
1665
|
-
ev =
|
1665
|
+
sv = Edge.StartVertex(e)
|
1666
|
+
ev = Edge.EndVertex(e)
|
1666
1667
|
sn = nodes[Vertex.Index(vertex=sv, vertices=vertices, strict=False, tolerance=tolerance)]
|
1667
1668
|
en = nodes[Vertex.Index(vertex=ev, vertices=vertices, strict=False, tolerance=tolerance)]
|
1668
1669
|
if (([sn,en] in graph_edges) == False) and (([en,sn] in graph_edges) == False):
|
topologicpy/Edge.py
CHANGED
@@ -427,8 +427,8 @@ class Edge():
|
|
427
427
|
if not Topology.IsInstance(edge, "Edge"):
|
428
428
|
print("Edge.Direction - Error: The input edge parameter is not a valid topologic edge. Returning None.")
|
429
429
|
return None
|
430
|
-
|
431
|
-
|
430
|
+
sv = Edge.StartVertex(edge)
|
431
|
+
ev = Edge.EndVertex(edge)
|
432
432
|
x = Vertex.X(ev, mantissa=mantissa) - Vertex.X(sv, mantissa=mantissa)
|
433
433
|
y = Vertex.Y(ev, mantissa=mantissa) - Vertex.Y(sv, mantissa=mantissa)
|
434
434
|
z = Vertex.Z(ev, mantissa=mantissa) - Vertex.Z(sv, mantissa=mantissa)
|
@@ -461,7 +461,7 @@ class Edge():
|
|
461
461
|
return None
|
462
462
|
vert = None
|
463
463
|
try:
|
464
|
-
vert = edge.EndVertex()
|
464
|
+
vert = edge.EndVertex() # Hook to core
|
465
465
|
except:
|
466
466
|
vert = None
|
467
467
|
return vert
|
@@ -1247,11 +1247,11 @@ class Edge():
|
|
1247
1247
|
print("Edge.Normalize - Error: The input edge parameter is not a valid topologic edge. Returning None.")
|
1248
1248
|
return None
|
1249
1249
|
if not useEndVertex:
|
1250
|
-
sv =
|
1251
|
-
ev = Edge.VertexByDistance(edge, 1.0,
|
1250
|
+
sv = Edge.StartVertex(edge)
|
1251
|
+
ev = Edge.VertexByDistance(edge, 1.0, Edge.StartVertex(edge))
|
1252
1252
|
else:
|
1253
|
-
sv = Edge.VertexByDistance(edge, 1.0,
|
1254
|
-
ev =
|
1253
|
+
sv = Edge.VertexByDistance(edge, 1.0, Edge.StartVertex(edge))
|
1254
|
+
ev = Edge.EndVertex(edge)
|
1255
1255
|
return Edge.ByVertices([sv, ev], tolerance=tolerance)
|
1256
1256
|
|
1257
1257
|
@staticmethod
|
@@ -1316,7 +1316,7 @@ class Edge():
|
|
1316
1316
|
if not Topology.IsInstance(edge, "Edge"):
|
1317
1317
|
print("Edge.Reverse - Error: The input edge parameter is not a valid topologic edge. Returning None.")
|
1318
1318
|
return None
|
1319
|
-
return Edge.ByVertices([
|
1319
|
+
return Edge.ByVertices([Edge.EndVertex(edge), Edge.StartVertex(edge)], tolerance=tolerance)
|
1320
1320
|
|
1321
1321
|
@staticmethod
|
1322
1322
|
def SetLength(edge , length: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001):
|
@@ -1375,7 +1375,7 @@ class Edge():
|
|
1375
1375
|
return None
|
1376
1376
|
vert = None
|
1377
1377
|
try:
|
1378
|
-
vert = edge.StartVertex()
|
1378
|
+
vert = edge.StartVertex() # Hook to core
|
1379
1379
|
except:
|
1380
1380
|
vert = None
|
1381
1381
|
return vert
|
@@ -1534,12 +1534,12 @@ class Edge():
|
|
1534
1534
|
print("Edge.TrimByEdge2D - Error: The input edge parameter is not a valid topologic edge. Returning None.")
|
1535
1535
|
return None
|
1536
1536
|
if not Topology.IsInstance(origin, "Vertex"):
|
1537
|
-
origin =
|
1537
|
+
origin = Edge.StartVertex(edge)
|
1538
1538
|
if not Topology.IsInstance(origin, "Vertex"):
|
1539
1539
|
print("Edge.TrimByEdge2D - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
1540
1540
|
return None
|
1541
|
-
sv =
|
1542
|
-
ev =
|
1541
|
+
sv = Edge.StartVertex(edge)
|
1542
|
+
ev = Edge.EndVertex(edge)
|
1543
1543
|
vx = Vertex.X(ev, mantissa=mantissa) - Vertex.X(sv, mantissa=mantissa)
|
1544
1544
|
vy = Vertex.Y(ev, mantissa=mantissa) - Vertex.Y(sv, mantissa=mantissa)
|
1545
1545
|
vz = Vertex.Z(ev, mantissa=mantissa) - Vertex.Z(sv, mantissa=mantissa)
|
@@ -1572,9 +1572,9 @@ class Edge():
|
|
1572
1572
|
return None
|
1573
1573
|
vertex = None
|
1574
1574
|
if u == 0:
|
1575
|
-
vertex =
|
1575
|
+
vertex = Edge.StartVertex(edge)
|
1576
1576
|
elif u == 1:
|
1577
|
-
vertex =
|
1577
|
+
vertex = Edge.EndVertex(edge)
|
1578
1578
|
else:
|
1579
1579
|
dir = Edge.Direction(edge)
|
1580
1580
|
edge_length = Edge.Length(edge)
|
topologicpy/EnergyModel.py
CHANGED
@@ -307,7 +307,7 @@ class EnergyModel:
|
|
307
307
|
building_cells = [building]
|
308
308
|
for spaceNumber, buildingCell in enumerate(building_cells):
|
309
309
|
osSpace = openstudio.model.Space(osModel)
|
310
|
-
osSpaceZ = Vertex.Z(
|
310
|
+
osSpaceZ = Vertex.Z(Topology.CenterOfMass(buildingCell), mantissa=mantissa)
|
311
311
|
osBuildingStory = osBuildingStorys[0]
|
312
312
|
for x in osBuildingStorys:
|
313
313
|
osBuildingStoryZ = x.nominalZCoordinate().get()
|
@@ -372,7 +372,7 @@ class EnergyModel:
|
|
372
372
|
osSurface.setSurfaceType("RoofCeiling")
|
373
373
|
osSurface.setOutsideBoundaryCondition("Outdoors")
|
374
374
|
osSurface.setName(osSpace.name().get() + "_TopHorizontalSlab_" + str(faceNumber))
|
375
|
-
if max(list(map(lambda vertex:
|
375
|
+
if max(list(map(lambda vertex: Vertex.Z(vertex), Topology.SubTopologies(buildingFace, "Vertex")))) < 1e-6:
|
376
376
|
osSurface.setSurfaceType("Floor")
|
377
377
|
osSurface.setOutsideBoundaryCondition("Ground")
|
378
378
|
osSurface.setName(osSpace.name().get() + "_BottomHorizontalSlab_" + str(faceNumber))
|
@@ -1039,14 +1039,14 @@ class EnergyModel:
|
|
1039
1039
|
surfaceEdges = []
|
1040
1040
|
surfaceVertices = surface.vertices()
|
1041
1041
|
for i in range(len(surfaceVertices)-1):
|
1042
|
-
sv = Vertex.ByCoordinates(surfaceVertices[i]
|
1043
|
-
ev = Vertex.ByCoordinates(surfaceVertices[i+1]
|
1042
|
+
sv = Vertex.ByCoordinates(Vertex.X(surfaceVertices[i]), Vertex.Y(surfaceVertices[i]), Vertex.Z(surfaceVertices[i]))
|
1043
|
+
ev = Vertex.ByCoordinates(Vertex.X(surfaceVertices[i+1]), Vertex.Y(surfaceVertices[i+1]), Vertex.Z(surfaceVertices[i+1]))
|
1044
1044
|
edge = Edge.ByStartVertexEndVertex(sv, ev, tolerance=tolerance, silent=False)
|
1045
1045
|
if not edge:
|
1046
1046
|
continue
|
1047
1047
|
surfaceEdges.append(edge)
|
1048
|
-
sv = Vertex.ByCoordinates(surfaceVertices[len(surfaceVertices)-1]
|
1049
|
-
ev = Vertex.ByCoordinates(surfaceVertices[0]
|
1048
|
+
sv = Vertex.ByCoordinates(Vertex.X(surfaceVertices[len(surfaceVertices)-1]), Vertex.Y(surfaceVertices[len(surfaceVertices)-1]), Vertex.Z(surfaceVertices[len(surfaceVertices)-1]))
|
1049
|
+
ev = Vertex.ByCoordinates(Vertex.X(surfaceVertices[0]), Vertex.Y(surfaceVertices[0]), Vertex.Z(surfaceVertices[0]))
|
1050
1050
|
edge = Edge.ByStartVertexEndVertex(sv, ev, tolerance=tolerance, silent=False)
|
1051
1051
|
surfaceEdges.append(edge)
|
1052
1052
|
surfaceWire = Wire.ByEdges(surfaceEdges, tolerance=tolerance)
|
@@ -1057,7 +1057,7 @@ class EnergyModel:
|
|
1057
1057
|
def addApertures(face, apertures):
|
1058
1058
|
usedFaces = []
|
1059
1059
|
for aperture in apertures:
|
1060
|
-
cen =
|
1060
|
+
cen = Topology.CenterOfMass(aperture)
|
1061
1061
|
try:
|
1062
1062
|
params = face.ParametersAtVertex(cen)
|
1063
1063
|
u = params[0]
|
topologicpy/Graph.py
CHANGED
@@ -751,7 +751,7 @@ class Graph:
|
|
751
751
|
return paths
|
752
752
|
|
753
753
|
@staticmethod
|
754
|
-
def
|
754
|
+
def IsIsomorphic(graphA, graphB, maxIterations=10, silent=False):
|
755
755
|
"""
|
756
756
|
Tests if the two input graphs are isomorphic according to the Weisfeiler Lehman graph isomorphism test. See https://en.wikipedia.org/wiki/Weisfeiler_Leman_graph_isomorphism_test
|
757
757
|
|
@@ -827,19 +827,19 @@ class Graph:
|
|
827
827
|
|
828
828
|
if not Topology.IsInstance(graphA, "Graph") and not Topology.IsInstance(graphB, "Graph"):
|
829
829
|
if not silent:
|
830
|
-
print("Graph.
|
830
|
+
print("Graph.IsIsomorphic - Error: The input graph parameters are not valid graphs. Returning None.")
|
831
831
|
return None
|
832
832
|
if not Topology.IsInstance(graphA, "Graph"):
|
833
833
|
if not silent:
|
834
|
-
print("Graph.
|
834
|
+
print("Graph.IsIsomorphic - Error: The input graphA parameter is not a valid graph. Returning None.")
|
835
835
|
return None
|
836
836
|
if not Topology.IsInstance(graphB, "Graph"):
|
837
837
|
if not silent:
|
838
|
-
print("Graph.
|
838
|
+
print("Graph.IsIsomorphic - Error: The input graphB parameter is not a valid graph. Returning None.")
|
839
839
|
return None
|
840
840
|
if maxIterations <= 0:
|
841
841
|
if not silent:
|
842
|
-
print("Graph.
|
842
|
+
print("Graph.IsIsomorphic - Error: The input maxIterations parameter is not within a valid range. Returning None.")
|
843
843
|
return None
|
844
844
|
|
845
845
|
g1 = Graph.AdjacencyDictionary(graphA)
|
@@ -4517,37 +4517,39 @@ class Graph:
|
|
4517
4517
|
import warnings
|
4518
4518
|
|
4519
4519
|
try:
|
4520
|
-
import
|
4520
|
+
import igraph as ig
|
4521
4521
|
except:
|
4522
|
-
print("Graph.Community - Installing required pyhon-
|
4522
|
+
print("Graph.Community - Installing required pyhon-igraph library.")
|
4523
4523
|
try:
|
4524
|
-
os.system("pip install python-
|
4524
|
+
os.system("pip install python-igraph")
|
4525
4525
|
except:
|
4526
|
-
os.system("pip install python-
|
4526
|
+
os.system("pip install python-igraph --user")
|
4527
4527
|
try:
|
4528
|
-
import
|
4529
|
-
print("Graph.Community - python-
|
4528
|
+
import igraph as ig
|
4529
|
+
print("Graph.Community - python-igraph library installed correctly.")
|
4530
4530
|
except:
|
4531
|
-
warnings.warn("Graph.Community - Error: Could not import python-
|
4531
|
+
warnings.warn("Graph.Community - Error: Could not import python-igraph. Please install manually.")
|
4532
4532
|
|
4533
4533
|
if not Topology.IsInstance(graph, "graph"):
|
4534
4534
|
if not silent:
|
4535
4535
|
print("Graph.Community - Error: The input graph parameter is not a valid topologic graph. Returning None")
|
4536
4536
|
return None
|
4537
4537
|
|
4538
|
+
mesh_data = Graph.MeshData(graph)
|
4539
|
+
# Create an igraph graph from the edge list
|
4540
|
+
ig_graph = ig.Graph(edges=mesh_data['edges'])
|
4541
|
+
|
4542
|
+
# Detect communities using Louvain method
|
4543
|
+
communities = ig_graph.community_multilevel()
|
4544
|
+
|
4545
|
+
# Get the list of communities sorted same as vertices
|
4546
|
+
community_list = communities.membership
|
4538
4547
|
vertices = Graph.Vertices(graph)
|
4539
|
-
|
4540
|
-
|
4541
|
-
|
4542
|
-
|
4543
|
-
|
4544
|
-
for node, community_id in partition.items():
|
4545
|
-
nx_graph.nodes[node][key] = community_id
|
4546
|
-
d = Topology.Dictionary(vertices[node])
|
4547
|
-
d = Dictionary.SetValueAtKey(d, key, community_id)
|
4548
|
-
vertices[node] = Topology.SetDictionary(vertices[node], d)
|
4549
|
-
communities.append(community_id)
|
4550
|
-
return communities
|
4548
|
+
for i, v in enumerate(vertices):
|
4549
|
+
d = Topology.Dictionary(v)
|
4550
|
+
d = Dictionary.SetValueAtKey(d, key, community_list[i])
|
4551
|
+
v = Topology.SetDictionary(v, d)
|
4552
|
+
return community_list
|
4551
4553
|
|
4552
4554
|
@staticmethod
|
4553
4555
|
def Connect(graph, verticesA, verticesB, tolerance=0.0001):
|
@@ -8102,6 +8104,7 @@ class Graph:
|
|
8102
8104
|
|
8103
8105
|
"""
|
8104
8106
|
from topologicpy.Vertex import Vertex
|
8107
|
+
from topologicpy.Edge import Edge
|
8105
8108
|
from topologicpy.Dictionary import Dictionary
|
8106
8109
|
from topologicpy.Topology import Topology
|
8107
8110
|
|
@@ -8116,8 +8119,8 @@ class Graph:
|
|
8116
8119
|
m_edges = []
|
8117
8120
|
e_dicts = []
|
8118
8121
|
for g_edge in g_edges:
|
8119
|
-
sv =
|
8120
|
-
ev =
|
8122
|
+
sv = Edge.StartVertex(g_edge)
|
8123
|
+
ev = Edge.EndVertex(g_edge)
|
8121
8124
|
si = Vertex.Index(sv, g_vertices, tolerance=tolerance)
|
8122
8125
|
ei = Vertex.Index(ev, g_vertices, tolerance=tolerance)
|
8123
8126
|
if (not si == None) and (not ei == None):
|
topologicpy/Honeybee.py
CHANGED
@@ -255,7 +255,7 @@ class Honeybee:
|
|
255
255
|
|
256
256
|
def cellFloor(cell):
|
257
257
|
faces = Topology.Faces(cell)
|
258
|
-
c = [
|
258
|
+
c = [Vertex.Z(Topology.CenterOfMass(x)) for x in faces]
|
259
259
|
return round(min(c),2)
|
260
260
|
|
261
261
|
def floorLevels(cells, min_difference):
|
topologicpy/Neo4j.py
CHANGED
@@ -413,6 +413,7 @@ class Neo4j:
|
|
413
413
|
|
414
414
|
"""
|
415
415
|
from topologicpy.Vertex import Vertex
|
416
|
+
from topologicpy.Edge import Edge
|
416
417
|
from topologicpy.Graph import Graph
|
417
418
|
from topologicpy.Topology import Topology
|
418
419
|
from topologicpy.Dictionary import Dictionary
|
@@ -458,8 +459,8 @@ class Neo4j:
|
|
458
459
|
nodes.append(n)
|
459
460
|
for i in range(len(edges)):
|
460
461
|
e = edges[i]
|
461
|
-
sv =
|
462
|
-
ev =
|
462
|
+
sv = Edge.StartVertex(e)
|
463
|
+
ev = Edge.EndVertex(e)
|
463
464
|
sn = nodes[Vertex.Index(vertex=sv, vertices=vertices, strict=False, tolerance=tolerance)]
|
464
465
|
en = nodes[Vertex.Index(vertex=ev, vertices=vertices, strict=False, tolerance=tolerance)]
|
465
466
|
ed = Topology.Dictionary(e)
|
topologicpy/Shell.py
CHANGED
@@ -432,17 +432,17 @@ class Shell():
|
|
432
432
|
e3 = None
|
433
433
|
e4 = None
|
434
434
|
try:
|
435
|
-
e3 = Edge.ByVertices([
|
435
|
+
e3 = Edge.ByVertices([Edge.StartVertex(e1), Edge.StartVertex(e2)], tolerance=tolerance, silent=silent)
|
436
436
|
except:
|
437
|
-
e4 = Edge.ByVertices([
|
437
|
+
e4 = Edge.ByVertices([Edge.EndVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=silent)
|
438
438
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e2, e4], tolerance=tolerance), tolerance=tolerance))
|
439
439
|
try:
|
440
|
-
e4 = Edge.ByVertices([
|
440
|
+
e4 = Edge.ByVertices([Edge.EndVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=silent)
|
441
441
|
except:
|
442
|
-
e3 = Edge.ByVertices([
|
442
|
+
e3 = Edge.ByVertices([Edge.StartVertex(e1), Edge.StartVertex(e2)], tolerance=tolerance, silent=silent)
|
443
443
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e2, e3],tolerance=tolerance), tolerance=tolerance))
|
444
444
|
if e3 and e4:
|
445
|
-
e5 = Edge.ByVertices([
|
445
|
+
e5 = Edge.ByVertices([Edge.StartVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=silent)
|
446
446
|
faces.append(Face.ByWire(Wire.ByEdges([e1, e5, e4], tolerance=tolerance), tolerance=tolerance))
|
447
447
|
faces.append(Face.ByWire(Wire.ByEdges([e2, e5, e3], tolerance=tolerance), tolerance=tolerance))
|
448
448
|
elif e3:
|
@@ -470,17 +470,17 @@ class Shell():
|
|
470
470
|
e3 = None
|
471
471
|
e4 = None
|
472
472
|
try:
|
473
|
-
e3 = Edge.ByVertices([
|
473
|
+
e3 = Edge.ByVertices([Edge.StartVertex(e1), Edge.StartVertex(e2)], tolerance=tolerance, silent=silent)
|
474
474
|
except:
|
475
475
|
try:
|
476
|
-
e4 = Edge.ByVertices([
|
476
|
+
e4 = Edge.ByVertices([Edge.EndVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=silent)
|
477
477
|
except:
|
478
478
|
pass
|
479
479
|
try:
|
480
|
-
e4 = Edge.ByVertices([
|
480
|
+
e4 = Edge.ByVertices([Edge.EndVertex(e1), Edge.EndVertex(e2)], tolerance=tolerance, silent=silent)
|
481
481
|
except:
|
482
482
|
try:
|
483
|
-
e3 = Edge.ByVertices([
|
483
|
+
e3 = Edge.ByVertices([Edge.StartVertex(e1), Edge.StartVertex(e2)], tolerance=tolerance, silent=silent)
|
484
484
|
except:
|
485
485
|
pass
|
486
486
|
if e3 and e4:
|
topologicpy/Topology.py
CHANGED
@@ -4145,7 +4145,7 @@ class Topology():
|
|
4145
4145
|
if not Topology.IsInstance(topology, "Topology"):
|
4146
4146
|
print("Topology.CenterofMass - Error: the input topology parameter is not a valid topology. Returning None.")
|
4147
4147
|
return None
|
4148
|
-
return topology.CenterOfMass()
|
4148
|
+
return topology.CenterOfMass() # Hook to Core
|
4149
4149
|
|
4150
4150
|
@staticmethod
|
4151
4151
|
def Centroid(topology):
|
@@ -4169,8 +4169,8 @@ class Topology():
|
|
4169
4169
|
print("Topology.Centroid - Error: the input topology parameter is not a valid topology. Returning None.")
|
4170
4170
|
return None
|
4171
4171
|
if Topology.IsInstance(topology, "Aperture"):
|
4172
|
-
return Aperture.Topology(topology).Centroid()
|
4173
|
-
return topology.Centroid()
|
4172
|
+
return Aperture.Topology(topology).Centroid() # Hook to Core
|
4173
|
+
return topology.Centroid() # Hook to Core
|
4174
4174
|
|
4175
4175
|
@staticmethod
|
4176
4176
|
def ClusterByKeys(topologies, *keys, silent=False):
|
@@ -6140,6 +6140,7 @@ class Topology():
|
|
6140
6140
|
|
6141
6141
|
"""
|
6142
6142
|
from topologicpy.Vertex import Vertex
|
6143
|
+
from topologicpy.Edge import Edge
|
6143
6144
|
from topologicpy.Face import Face
|
6144
6145
|
|
6145
6146
|
vertices = []
|
@@ -6164,8 +6165,8 @@ class Topology():
|
|
6164
6165
|
topEdges = Topology.Edges(topology)
|
6165
6166
|
for anEdge in topEdges:
|
6166
6167
|
e = []
|
6167
|
-
sv =
|
6168
|
-
ev =
|
6168
|
+
sv = Edge.StartVertex(anEdge)
|
6169
|
+
ev = Edge.EndVertex(anEdge)
|
6169
6170
|
try:
|
6170
6171
|
svIndex = vertices.index(Vertex.Coordinates(sv, mantissa=mantissa))
|
6171
6172
|
except:
|
topologicpy/Vertex.py
CHANGED
@@ -1728,11 +1728,13 @@ class Vertex():
|
|
1728
1728
|
The X coordinate of the input vertex.
|
1729
1729
|
|
1730
1730
|
"""
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1731
|
+
try:
|
1732
|
+
return round(vertex.X(), mantissa) # Hook to Core
|
1733
|
+
except:
|
1734
|
+
try:
|
1735
|
+
return round(vertex.x(), mantissa) # Hook to Core
|
1736
|
+
except:
|
1737
|
+
return None
|
1736
1738
|
|
1737
1739
|
@staticmethod
|
1738
1740
|
def Y(vertex, mantissa: int = 6) -> float:
|
@@ -1752,11 +1754,13 @@ class Vertex():
|
|
1752
1754
|
The Y coordinate of the input vertex.
|
1753
1755
|
|
1754
1756
|
"""
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1757
|
+
try:
|
1758
|
+
return round(vertex.Y(), mantissa) # Hook to Core
|
1759
|
+
except:
|
1760
|
+
try:
|
1761
|
+
return round(vertex.y(), mantissa) # Hook to Core
|
1762
|
+
except:
|
1763
|
+
return None
|
1760
1764
|
|
1761
1765
|
@staticmethod
|
1762
1766
|
def Z(vertex, mantissa: int = 6) -> float:
|
@@ -1776,9 +1780,11 @@ class Vertex():
|
|
1776
1780
|
The Z coordinate of the input vertex.
|
1777
1781
|
|
1778
1782
|
"""
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1783
|
+
try:
|
1784
|
+
return round(vertex.Z(), mantissa) # Hook to Core
|
1785
|
+
except:
|
1786
|
+
try:
|
1787
|
+
return round(vertex.z(), mantissa) # Hook to Core
|
1788
|
+
except:
|
1789
|
+
return None
|
1784
1790
|
|
topologicpy/Wire.py
CHANGED
@@ -982,9 +982,9 @@ class Wire():
|
|
982
982
|
sides = int(math.floor(sides))
|
983
983
|
for i in range(sides+1):
|
984
984
|
angle = fromAngle + math.radians(angleRange/sides)*i
|
985
|
-
x = math.sin(angle)*radius +
|
986
|
-
y = math.cos(angle)*radius +
|
987
|
-
z =
|
985
|
+
x = math.sin(angle)*radius + Vertex.X(origin)
|
986
|
+
y = math.cos(angle)*radius + Vertex.Y(origin)
|
987
|
+
z = Vertex.Z(origin)
|
988
988
|
xList.append(x)
|
989
989
|
yList.append(y)
|
990
990
|
baseV.append(Vertex.ByCoordinates(x, y, z))
|
@@ -1663,7 +1663,7 @@ class Wire():
|
|
1663
1663
|
|
1664
1664
|
graph = []
|
1665
1665
|
for anEdge in tEdges:
|
1666
|
-
graph.append([vIndex(
|
1666
|
+
graph.append([vIndex(Edge.StartVertex(anEdge), tVertices, tolerance), vIndex(Edge.EndVertex(anEdge), tVertices, tolerance)]) # Hook to Core
|
1667
1667
|
|
1668
1668
|
cycles = []
|
1669
1669
|
resultingCycles = main(graph, cycles, maxVertices)
|
@@ -1952,9 +1952,9 @@ class Wire():
|
|
1952
1952
|
sides = int(math.floor(sides))
|
1953
1953
|
for i in range(sides+1):
|
1954
1954
|
angle = fromAngle + math.radians(angleRange/sides)*i
|
1955
|
-
x = math.sin(angle)*a +
|
1956
|
-
y = math.cos(angle)*b +
|
1957
|
-
z =
|
1955
|
+
x = math.sin(angle)*a + Vertex.X(origin)
|
1956
|
+
y = math.cos(angle)*b + Vertex.Y(origin)
|
1957
|
+
z = Vertex.Z(origin)
|
1958
1958
|
xList.append(x)
|
1959
1959
|
yList.append(y)
|
1960
1960
|
baseV.append(Vertex.ByCoordinates(x, y, z))
|
@@ -1968,8 +1968,8 @@ class Wire():
|
|
1968
1968
|
baseWire = Topology.Translate(baseWire, a, b, 0)
|
1969
1969
|
baseWire = Topology.Orient(baseWire, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
1970
1970
|
# Create a Cluster of the two foci
|
1971
|
-
v1 = Vertex.ByCoordinates(c+
|
1972
|
-
v2 = Vertex.ByCoordinates(-c+
|
1971
|
+
v1 = Vertex.ByCoordinates(c+Vertex.X(origin), 0+Vertex.Y(origin), 0)
|
1972
|
+
v2 = Vertex.ByCoordinates(-c+Vertex.X(origin), 0+Vertex.Y(origin), 0)
|
1973
1973
|
foci = Cluster.ByTopologies([v1, v2])
|
1974
1974
|
if placement.lower() == "lowerleft":
|
1975
1975
|
foci = Topology.Translate(foci, a, b, 0)
|
@@ -2483,18 +2483,18 @@ class Wire():
|
|
2483
2483
|
return False
|
2484
2484
|
|
2485
2485
|
def angleBetweenEdges(e1, e2, tolerance=0.0001):
|
2486
|
-
a =
|
2487
|
-
b =
|
2488
|
-
c =
|
2489
|
-
d = Vertex.Distance(
|
2486
|
+
a = Vertex.X(Edge.EndVertex(e1)) - Vertex.X(Edge.StartVertex(e1))
|
2487
|
+
b = Vertex.Y(Edge.EndVertex(e1)) - Vertex.Y(Edge.StartVertex(e1))
|
2488
|
+
c = Vertex.Z(Edge.EndVertex(e1)) - Vertex.Z(Edge.StartVertex(e1))
|
2489
|
+
d = Vertex.Distance(Edge.EndVertex(e1), Edge.StartVertex(e2))
|
2490
2490
|
if d <= tolerance:
|
2491
|
-
d =
|
2492
|
-
e =
|
2493
|
-
f =
|
2491
|
+
d = Vertex.X(Edge.StartVertex(e2)) - Vertex.X(Edge.EndVertex(e2))
|
2492
|
+
e = Vertex.Y(Edge.StartVertex(e2)) - Vertex.Y(Edge.EndVertex(e2))
|
2493
|
+
f = Vertex.Z(Edge.StartVertex(e2)) - Vertex.Z(Edge.EndVertex(e2))
|
2494
2494
|
else:
|
2495
|
-
d =
|
2496
|
-
e =
|
2497
|
-
f =
|
2495
|
+
d = Vertex.X(Edge.EndVertex(e2)) - Vertex.X(Edge.StartVertex(e2))
|
2496
|
+
e = Vertex.Y(Edge.EndVertex(e2)) - Vertex.Y(Edge.StartVertex(e2))
|
2497
|
+
f = Vertex.Z(Edge.EndVertex(e2)) - Vertex.Z(Edge.StartVertex(e2))
|
2498
2498
|
dotProduct = a*d + b*e + c*f
|
2499
2499
|
modOfVector1 = math.sqrt( a*a + b*b + c*c)*math.sqrt(d*d + e*e + f*f)
|
2500
2500
|
angle = dotProduct/modOfVector1
|
@@ -2538,7 +2538,6 @@ class Wire():
|
|
2538
2538
|
return True
|
2539
2539
|
return False
|
2540
2540
|
|
2541
|
-
|
2542
2541
|
@staticmethod
|
2543
2542
|
def IShape(origin=None,
|
2544
2543
|
width=1,
|
@@ -3318,7 +3317,7 @@ class Wire():
|
|
3318
3317
|
return None
|
3319
3318
|
if not direction:
|
3320
3319
|
direction = -1*Face.Normal(face, outputType="xyz", mantissa=mantissa)
|
3321
|
-
large_face = Topology.Scale(face,
|
3320
|
+
large_face = Topology.Scale(face, Topology.CenterOfMass(face), 500, 500, 500)
|
3322
3321
|
edges = []
|
3323
3322
|
_ = wire.Edges(None, edges)
|
3324
3323
|
projected_edges = []
|
@@ -3328,8 +3327,8 @@ class Wire():
|
|
3328
3327
|
for edge in edges:
|
3329
3328
|
if edge:
|
3330
3329
|
if (Topology.Type(edge) == Topology.TypeID("Edge")):
|
3331
|
-
sv =
|
3332
|
-
ev =
|
3330
|
+
sv = Edge.StartVertex(edge)
|
3331
|
+
ev = Edge.EndVertex(edge)
|
3333
3332
|
|
3334
3333
|
psv = Vertex.Project(vertex=sv, face=large_face, direction=direction)
|
3335
3334
|
pev = Vertex.Project(vertex=ev, face=large_face, direction=direction)
|
@@ -3404,10 +3403,10 @@ class Wire():
|
|
3404
3403
|
xOffset = -width*0.5
|
3405
3404
|
yOffset = -length*0.5
|
3406
3405
|
|
3407
|
-
vb1 = Vertex.ByCoordinates(
|
3408
|
-
vb2 = Vertex.ByCoordinates(
|
3409
|
-
vb3 = Vertex.ByCoordinates(
|
3410
|
-
vb4 = Vertex.ByCoordinates(
|
3406
|
+
vb1 = Vertex.ByCoordinates(Vertex.X(origin)-width*0.5+xOffset,Vertex.Y(origin)-length*0.5+yOffset,Vertex.Z(origin))
|
3407
|
+
vb2 = Vertex.ByCoordinates(Vertex.X(origin)+width*0.5+xOffset,Vertex.Y(origin)-length*0.5+yOffset,Vertex.Z(origin))
|
3408
|
+
vb3 = Vertex.ByCoordinates(Vertex.X(origin)+width*0.5+xOffset,Vertex.Y(origin)+length*0.5+yOffset,Vertex.Z(origin))
|
3409
|
+
vb4 = Vertex.ByCoordinates(Vertex.X(origin)-width*0.5+xOffset,Vertex.Y(origin)+length*0.5+yOffset,Vertex.Z(origin))
|
3411
3410
|
|
3412
3411
|
baseWire = Wire.ByVertices([vb1, vb2, vb3, vb4], True)
|
3413
3412
|
if direction != [0, 0, 1]:
|
@@ -3628,6 +3627,88 @@ class Wire():
|
|
3628
3627
|
else:
|
3629
3628
|
return wire
|
3630
3629
|
|
3630
|
+
@staticmethod
|
3631
|
+
def Representation(wire, normalize: bool = True, rotate: bool = True, mantissa: int = 6, tolerance: float = 0.0001):
|
3632
|
+
"""
|
3633
|
+
Returns a normalized representation of a closed wire with alternating edge lengths and interior angles.
|
3634
|
+
|
3635
|
+
Parameters
|
3636
|
+
----------
|
3637
|
+
wire : topologic_core.Wire
|
3638
|
+
The input wire.
|
3639
|
+
normalize : bool , optional
|
3640
|
+
If set to True, the lengths in the list are normalized so that the shortest edge has a length of 1. the default is True.
|
3641
|
+
rotate : bool , optional
|
3642
|
+
If set to True, the list is rotated such that the shortest edge appears first.
|
3643
|
+
mantissa : int , optional
|
3644
|
+
The desired length of the mantissa. The default is 6.
|
3645
|
+
tolerance : float , optional
|
3646
|
+
The desired tolerance. The default is 0.0001.
|
3647
|
+
|
3648
|
+
Returns
|
3649
|
+
-------
|
3650
|
+
list
|
3651
|
+
The representation list.
|
3652
|
+
|
3653
|
+
"""
|
3654
|
+
from topologicpy.Vertex import Vertex
|
3655
|
+
from topologicpy.Edge import Edge
|
3656
|
+
import math
|
3657
|
+
|
3658
|
+
def angleBetweenEdges(e1, e2, tolerance=0.0001):
|
3659
|
+
a = Vertex.X(Edge.EndVertex(e1)) - Vertex.X(Edge.StartVertex(e1))
|
3660
|
+
b = Vertex.Y(Edge.EndVertex(e1)) - Vertex.Y(Edge.StartVertex(e1))
|
3661
|
+
c = Vertex.Z(Edge.EndVertex(e1)) - Vertex.Z(Edge.StartVertex(e1))
|
3662
|
+
d = Vertex.Distance(Edge.EndVertex(e1), Edge.StartVertex(e2))
|
3663
|
+
if d <= tolerance:
|
3664
|
+
d = Vertex.X(Edge.StartVertex(e2)) - Vertex.X(Edge.EndVertex(e2))
|
3665
|
+
e = Vertex.Y(Edge.StartVertex(e2)) - Vertex.Y(Edge.EndVertex(e2))
|
3666
|
+
f = Vertex.Z(Edge.StartVertex(e2)) - Vertex.Z(Edge.EndVertex(e2))
|
3667
|
+
else:
|
3668
|
+
d = Vertex.X(Edge.EndVertex(e2)) - Vertex.X(Edge.StartVertex(e2))
|
3669
|
+
e = Vertex.Y(Edge.EndVertex(e2)) - Vertex.Y(Edge.StartVertex(e2))
|
3670
|
+
f = Vertex.Z(Edge.EndVertex(e2)) - Vertex.Z(Edge.StartVertex(e2))
|
3671
|
+
dotProduct = a*d + b*e + c*f
|
3672
|
+
modOfVector1 = math.sqrt( a*a + b*b + c*c)*math.sqrt(d*d + e*e + f*f)
|
3673
|
+
angle = dotProduct/modOfVector1
|
3674
|
+
angleInDegrees = math.degrees(math.acos(angle))
|
3675
|
+
return angleInDegrees
|
3676
|
+
|
3677
|
+
def getInteriorAngles(edges, tolerance=0.0001):
|
3678
|
+
angles = []
|
3679
|
+
for i in range(len(edges)-1):
|
3680
|
+
e1 = edges[i]
|
3681
|
+
e2 = edges[i+1]
|
3682
|
+
angles.append(angleBetweenEdges(e1, e2, tolerance=tolerance))
|
3683
|
+
return angles
|
3684
|
+
|
3685
|
+
def rotate_list_to_minimum(nums):
|
3686
|
+
if not nums:
|
3687
|
+
return nums # Return the empty list as-is
|
3688
|
+
|
3689
|
+
min_index = nums.index(min(nums))
|
3690
|
+
return nums[min_index:] + nums[:min_index]
|
3691
|
+
|
3692
|
+
def getRep(edges, normalize=True, rotate=True, tolerance=0.0001):
|
3693
|
+
angles = getInteriorAngles(edges, tolerance=tolerance)
|
3694
|
+
lengths = []
|
3695
|
+
normalizedLengths = []
|
3696
|
+
for anEdge in edges:
|
3697
|
+
lengths.append(Edge.Length(anEdge))
|
3698
|
+
if normalize == True:
|
3699
|
+
minLength = min(lengths)
|
3700
|
+
else:
|
3701
|
+
minLength = 1
|
3702
|
+
for aLength in lengths:
|
3703
|
+
normalizedLengths.append(aLength/minLength)
|
3704
|
+
if rotate == True:
|
3705
|
+
return rotate_list_to_minimum([x for x in itertools.chain(*itertools.zip_longest(normalizedLengths, angles)) if x is not None])
|
3706
|
+
return [x for x in itertools.chain(*itertools.zip_longest(normalizedLengths, angles)) if x is not None]
|
3707
|
+
|
3708
|
+
edges = Topology.Edges(wire)
|
3709
|
+
return_list = [round(x, mantissa) for x in getRep(edges, normalize=normalize, rotate=rotate, tolerance=tolerance)]
|
3710
|
+
return return_list
|
3711
|
+
|
3631
3712
|
@staticmethod
|
3632
3713
|
def Reverse(wire, transferDictionaries = False, tolerance: float = 0.0001):
|
3633
3714
|
"""
|
@@ -3752,7 +3833,7 @@ class Wire():
|
|
3752
3833
|
eb_vertices = Topology.Vertices(eb_wire)
|
3753
3834
|
if normal[2] > 0:
|
3754
3835
|
eb_vertices = list(reversed(eb_vertices))
|
3755
|
-
eb_polygon_coordinates = [(
|
3836
|
+
eb_polygon_coordinates = [(Vertex.X(v), Vertex.Y(v), Vertex.Z(v)) for v in eb_vertices]
|
3756
3837
|
eb_polygonxy = [(x[0], x[1]) for x in eb_polygon_coordinates]
|
3757
3838
|
|
3758
3839
|
ib_polygonsxy = []
|
@@ -3761,7 +3842,7 @@ class Wire():
|
|
3761
3842
|
ib_vertices = Topology.Vertices(ib_wire)
|
3762
3843
|
if normal[2] > 0:
|
3763
3844
|
ib_vertices = list(reversed(ib_vertices))
|
3764
|
-
ib_polygon_coordinates = [(
|
3845
|
+
ib_polygon_coordinates = [(Vertex.X(v), Vertex.Y(v), Vertex.Z(v)) for v in ib_vertices]
|
3765
3846
|
ib_polygonxy = [(x[0], x[1]) for x in ib_polygon_coordinates]
|
3766
3847
|
ib_polygonsxy.append(ib_polygonxy)
|
3767
3848
|
zero_coordinates += ib_polygon_coordinates
|
@@ -3828,12 +3909,12 @@ class Wire():
|
|
3828
3909
|
|
3829
3910
|
def perpendicular_distance(point, line_start, line_end):
|
3830
3911
|
# Calculate the perpendicular distance from a point to a line segment
|
3831
|
-
x0 =
|
3832
|
-
y0 =
|
3833
|
-
x1 =
|
3834
|
-
y1 =
|
3835
|
-
x2 =
|
3836
|
-
y2 =
|
3912
|
+
x0 = Vertex.X(point)
|
3913
|
+
y0 = Vertex.Y(point)
|
3914
|
+
x1 = Vertex.X(line_start)
|
3915
|
+
y1 = Vertex.Y(line_start)
|
3916
|
+
x2 = Vertex.X(line_end)
|
3917
|
+
y2 = Vertex.Y(line_end)
|
3837
3918
|
|
3838
3919
|
numerator = abs((y2 - y1) * x0 - (x2 - x1) * y0 + x2 * y1 - y2 * x1)
|
3839
3920
|
denominator = Vertex.Distance(line_start, line_end)
|
@@ -3880,7 +3961,7 @@ class Wire():
|
|
3880
3961
|
# Calculate the effective area for each point except the first and last
|
3881
3962
|
def effective_area(p1, p2, p3):
|
3882
3963
|
# Triangle area formed by p1, p2, and p3
|
3883
|
-
return 0.5 * abs(
|
3964
|
+
return 0.5 * abs(Vertex.X(p1) * (Vertex.Y(p2) - Vertex.Y(p3)) + Vertex.X(p2) * (Vertex.Y(p3) - Vertex.Y(p1)) + Vertex.X(p3) * (Vertex.Y(p1) - Vertex.Y(p2)))
|
3884
3965
|
|
3885
3966
|
# Keep track of effective areas
|
3886
3967
|
areas = [None] # First point has no area
|
@@ -4358,9 +4439,9 @@ class Wire():
|
|
4358
4439
|
else:
|
4359
4440
|
radius = radiusB
|
4360
4441
|
angle = math.radians(360/sides)*i
|
4361
|
-
x = math.sin(angle)*radius +
|
4362
|
-
y = math.cos(angle)*radius +
|
4363
|
-
z =
|
4442
|
+
x = math.sin(angle)*radius + Vertex.X(origin)
|
4443
|
+
y = math.cos(angle)*radius + Vertex.Y(origin)
|
4444
|
+
z = Vertex.Z(origin)
|
4364
4445
|
xList.append(x)
|
4365
4446
|
yList.append(y)
|
4366
4447
|
baseV.append([x, y])
|
@@ -4368,29 +4449,29 @@ class Wire():
|
|
4368
4449
|
if placement.lower() == "lowerleft":
|
4369
4450
|
xmin = min(xList)
|
4370
4451
|
ymin = min(yList)
|
4371
|
-
xOffset =
|
4372
|
-
yOffset =
|
4452
|
+
xOffset = Vertex.X(origin) - xmin
|
4453
|
+
yOffset = Vertex.Y(origin) - ymin
|
4373
4454
|
elif placement.lower() == "upperleft":
|
4374
4455
|
xmin = min(xList)
|
4375
4456
|
ymax = max(yList)
|
4376
|
-
xOffset =
|
4377
|
-
yOffset =
|
4457
|
+
xOffset = Vertex.X(origin) - xmin
|
4458
|
+
yOffset = Vertex.Y(origin) - ymax
|
4378
4459
|
elif placement.lower() == "lowerright":
|
4379
4460
|
xmax = max(xList)
|
4380
4461
|
ymin = min(yList)
|
4381
|
-
xOffset =
|
4382
|
-
yOffset =
|
4462
|
+
xOffset = Vertex.X(origin) - xmax
|
4463
|
+
yOffset = Vertex.Y(origin) - ymin
|
4383
4464
|
elif placement.lower() == "upperright":
|
4384
4465
|
xmax = max(xList)
|
4385
4466
|
ymax = max(yList)
|
4386
|
-
xOffset =
|
4387
|
-
yOffset =
|
4467
|
+
xOffset = Vertex.X(origin) - xmax
|
4468
|
+
yOffset = Vertex.Y(origin) - ymax
|
4388
4469
|
else:
|
4389
4470
|
xOffset = 0
|
4390
4471
|
yOffset = 0
|
4391
4472
|
tranBase = []
|
4392
4473
|
for coord in baseV:
|
4393
|
-
tranBase.append(Vertex.ByCoordinates(coord[0]+xOffset, coord[1]+yOffset,
|
4474
|
+
tranBase.append(Vertex.ByCoordinates(coord[0]+xOffset, coord[1]+yOffset, Vertex.Z(origin)))
|
4394
4475
|
|
4395
4476
|
baseWire = Wire.ByVertices(tranBase, True)
|
4396
4477
|
baseWire = Wire.Reverse(baseWire)
|
@@ -4501,10 +4582,10 @@ class Wire():
|
|
4501
4582
|
xOffset = -(max((widthA*0.5 + offsetA), (widthB*0.5 + offsetB)))
|
4502
4583
|
yOffset = -length*0.5
|
4503
4584
|
|
4504
|
-
vb1 = Vertex.ByCoordinates(
|
4505
|
-
vb2 = Vertex.ByCoordinates(
|
4506
|
-
vb3 = Vertex.ByCoordinates(
|
4507
|
-
vb4 = Vertex.ByCoordinates(
|
4585
|
+
vb1 = Vertex.ByCoordinates(Vertex.X(origin)-widthA*0.5+offsetA+xOffset,Vertex.Y(origin)-length*0.5+yOffset,Vertex.Z(origin))
|
4586
|
+
vb2 = Vertex.ByCoordinates(Vertex.X(origin)+widthA*0.5+offsetA+xOffset,Vertex.Y(origin)-length*0.5+yOffset,Vertex.Z(origin))
|
4587
|
+
vb3 = Vertex.ByCoordinates(Vertex.X(origin)+widthB*0.5+offsetB+xOffset,Vertex.Y(origin)+length*0.5+yOffset,Vertex.Z(origin))
|
4588
|
+
vb4 = Vertex.ByCoordinates(Vertex.X(origin)-widthB*0.5++offsetB+xOffset,Vertex.Y(origin)+length*0.5+yOffset,Vertex.Z(origin))
|
4508
4589
|
|
4509
4590
|
baseWire = Wire.ByVertices([vb1, vb2, vb3, vb4], True)
|
4510
4591
|
if direction != [0, 0, 1]:
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.96'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.96
|
4
4
|
Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
6
6
|
License: AGPL v3 License
|
@@ -1,36 +1,36 @@
|
|
1
1
|
topologicpy/ANN.py,sha256=m_WxD1lgQqDhUpaM20Lia6TmJACDYaAE96wigsi-99U,47932
|
2
2
|
topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
|
3
3
|
topologicpy/BVH.py,sha256=mKVCAu9K8qzcWXtPDVH5usXZV1DNNNJl4n3rU5Lh1ZM,12931
|
4
|
-
topologicpy/Cell.py,sha256=
|
5
|
-
topologicpy/CellComplex.py,sha256
|
4
|
+
topologicpy/Cell.py,sha256=o5CxsBXxtnV439I4f8VMUoDMVwO5o3q0lHinHHMSmFg,108571
|
5
|
+
topologicpy/CellComplex.py,sha256=-s8RKGa2H1eqLO7g6qyQvvuFMFJ0aIgXvIr9kOVgpjA,51608
|
6
6
|
topologicpy/Cluster.py,sha256=__PvNVjRnFfy12aawd7HSrb3UBX3Rtd1iWSSQnPGpfk,55768
|
7
7
|
topologicpy/Color.py,sha256=q9xsGmxFMz7sQKmygwSVS12GaTRB-OT0-_i6t3-cthE,20307
|
8
8
|
topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
|
9
|
-
topologicpy/DGL.py,sha256=
|
9
|
+
topologicpy/DGL.py,sha256=M_znFtyPBJJz-iXLYZs2wwBj24fhevIo739dGha0chM,139041
|
10
10
|
topologicpy/Dictionary.py,sha256=t0O7Du-iPq46FyKqZfcjHfsUK1E8GS_e67R2V5cpkbw,33186
|
11
|
-
topologicpy/Edge.py,sha256=
|
12
|
-
topologicpy/EnergyModel.py,sha256=
|
11
|
+
topologicpy/Edge.py,sha256=gaLqyjFOqFHpw69Ftr4rc-kvakYpauQwhOK4ZO-V35g,67287
|
12
|
+
topologicpy/EnergyModel.py,sha256=UoQ9Jm-hYsN383CbcLKw-y6BKitRHj0uyh84yQ-8ACg,53856
|
13
13
|
topologicpy/Face.py,sha256=wczXpMcfub8Eb10lA4rrXksvi5YYCbRjBdp3lOTUwK0,172618
|
14
|
-
topologicpy/Graph.py,sha256=
|
14
|
+
topologicpy/Graph.py,sha256=Zx4dzSTynaJP1dEZ1j5WuneaTv2N2fbeNTyMwaI947c,455395
|
15
15
|
topologicpy/Grid.py,sha256=2s9cSlWldivn1i9EUz4OOokJyANveqmRe_vR93CAndI,18245
|
16
16
|
topologicpy/Helper.py,sha256=F3h4_qcOD_PHAoVe0tEbEE7_jYyVcaHjtwVs4QHOZuI,23978
|
17
|
-
topologicpy/Honeybee.py,sha256=
|
17
|
+
topologicpy/Honeybee.py,sha256=Y_El6M8x3ixvvIe_VcRiwj_4C89ZZg5_WlT7adbCkpw,21849
|
18
18
|
topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
|
19
|
-
topologicpy/Neo4j.py,sha256=
|
19
|
+
topologicpy/Neo4j.py,sha256=BKOF29fRgXmdpMGkrNzuYbyqgCJ6ElPPMYlfTxXiVbc,22392
|
20
20
|
topologicpy/Plotly.py,sha256=Tvo0_zKVEHtPhsMNNvLy5G0HIys5FPAOyp_o4QN_I_A,115760
|
21
21
|
topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
|
22
22
|
topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
|
23
|
-
topologicpy/Shell.py,sha256=
|
23
|
+
topologicpy/Shell.py,sha256=fLRnQ79vtdBDRW1Xn8Gaap34XheGbw7UBFd-ALJ2Y1g,87978
|
24
24
|
topologicpy/Speckle.py,sha256=AlsGlSDuKRtX5jhVsPNSSjjbZis079HbUchDH_5RJmE,18187
|
25
25
|
topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
|
26
|
-
topologicpy/Topology.py,sha256=
|
26
|
+
topologicpy/Topology.py,sha256=kAnJrVyrwJX8c-C4q1cewJ80byG8uaoBWUuk0T6U4SY,441788
|
27
27
|
topologicpy/Vector.py,sha256=Cl7besf20cAGmyNPh-9gbFAHnRU5ZWSMChJ3VyFIDs4,35416
|
28
|
-
topologicpy/Vertex.py,sha256=
|
29
|
-
topologicpy/Wire.py,sha256=
|
28
|
+
topologicpy/Vertex.py,sha256=QkeNPFTX-adKhEHMole0et9FCy0xXmTHVcmsYqqotSw,73904
|
29
|
+
topologicpy/Wire.py,sha256=bX8wO96gFa7HZPY0CFlmYQBOUP_1e0jCb02BPxaY-ao,222981
|
30
30
|
topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
|
31
|
-
topologicpy/version.py,sha256=
|
32
|
-
topologicpy-0.7.
|
33
|
-
topologicpy-0.7.
|
34
|
-
topologicpy-0.7.
|
35
|
-
topologicpy-0.7.
|
36
|
-
topologicpy-0.7.
|
31
|
+
topologicpy/version.py,sha256=a9u4mrbOh52xm2kgTG2gE8Y-NjoOtc82edCsxZY1Zs0,23
|
32
|
+
topologicpy-0.7.96.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
|
33
|
+
topologicpy-0.7.96.dist-info/METADATA,sha256=nVJinnZ504srDkDfjHbmyKZWpWEy6TchQp9nfijkKUY,10513
|
34
|
+
topologicpy-0.7.96.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
35
|
+
topologicpy-0.7.96.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
36
|
+
topologicpy-0.7.96.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|