topologicpy 0.7.11__py3-none-any.whl → 0.7.14__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 +16 -14
- topologicpy/CellComplex.py +24 -1
- topologicpy/Edge.py +205 -95
- topologicpy/Face.py +43 -15
- topologicpy/Grid.py +1 -1
- topologicpy/Polyskel.py +157 -12
- topologicpy/Shell.py +3 -4
- topologicpy/Sun.py +6 -6
- topologicpy/Topology.py +632 -8
- topologicpy/Vector.py +109 -2
- topologicpy/Vertex.py +106 -3
- topologicpy/Wire.py +59 -35
- topologicpy/version.py +1 -1
- {topologicpy-0.7.11.dist-info → topologicpy-0.7.14.dist-info}/METADATA +6 -5
- topologicpy-0.7.14.dist-info/RECORD +33 -0
- topologicpy-0.7.11.dist-info/RECORD +0 -33
- {topologicpy-0.7.11.dist-info → topologicpy-0.7.14.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.11.dist-info → topologicpy-0.7.14.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.11.dist-info → topologicpy-0.7.14.dist-info}/top_level.txt +0 -0
topologicpy/Vector.py
CHANGED
@@ -37,6 +37,26 @@ except:
|
|
37
37
|
warnings.warn("Vector - Error: Could not import numpy.")
|
38
38
|
|
39
39
|
class Vector(list):
|
40
|
+
@staticmethod
|
41
|
+
def Add(vectorA, vectorB):
|
42
|
+
"""
|
43
|
+
Adds the two input vectors.
|
44
|
+
|
45
|
+
Parameters
|
46
|
+
----------
|
47
|
+
vectorA : list
|
48
|
+
The first vector.
|
49
|
+
vectorB : list
|
50
|
+
The second vector.
|
51
|
+
|
52
|
+
Returns
|
53
|
+
-------
|
54
|
+
list
|
55
|
+
The sum vector of the two input vectors.
|
56
|
+
|
57
|
+
"""
|
58
|
+
return [a + b for a, b in zip(vectorA, vectorB)]
|
59
|
+
|
40
60
|
@staticmethod
|
41
61
|
def Angle(vectorA, vectorB, mantissa: int = 6):
|
42
62
|
"""
|
@@ -191,7 +211,7 @@ class Vector(list):
|
|
191
211
|
return list(bisecting_vector)
|
192
212
|
|
193
213
|
@staticmethod
|
194
|
-
def ByAzimuthAltitude(azimuth, altitude, north=0, reverse=False, tolerance=0.0001):
|
214
|
+
def ByAzimuthAltitude(azimuth: float, altitude: float, north: float = 0, reverse: bool = False, mantissa: int = 6, tolerance: float = 0.0001):
|
195
215
|
"""
|
196
216
|
Returns the vector specified by the input azimuth and altitude angles.
|
197
217
|
|
@@ -206,6 +226,8 @@ class Vector(list):
|
|
206
226
|
90 is along the positive X-axis, 180 is along the negative Y-axis, and 270 along the negative Y-axis.
|
207
227
|
reverse : bool , optional
|
208
228
|
If set to True the direction of the vector is computed from the end point towards the origin. Otherwise, it is computed from the origin towards the end point.
|
229
|
+
mantissa : int , optional
|
230
|
+
The desired mantissa. The default is 6.
|
209
231
|
tolerance : float , optional
|
210
232
|
The desired tolerance. The default is 0.0001.
|
211
233
|
|
@@ -218,12 +240,13 @@ class Vector(list):
|
|
218
240
|
from topologicpy.Vertex import Vertex
|
219
241
|
from topologicpy.Edge import Edge
|
220
242
|
from topologicpy.Topology import Topology
|
243
|
+
|
221
244
|
e = Edge.ByVertices([Vertex.Origin(), Vertex.ByCoordinates(0, 1, 0)], tolerance=tolerance)
|
222
245
|
e = Topology.Rotate(e, origin=Vertex.Origin(), axis=[1, 0, 0], angle=altitude)
|
223
246
|
e = Topology.Rotate(e, origin=Vertex.Origin(), axis=[0, 0, 1], angle=-azimuth-north)
|
224
247
|
if reverse:
|
225
248
|
return Vector.Reverse(Edge.Direction(e))
|
226
|
-
return Edge.Direction(e)
|
249
|
+
return Edge.Direction(e, mantissa=mantissa)
|
227
250
|
|
228
251
|
@staticmethod
|
229
252
|
def ByCoordinates(x, y, z):
|
@@ -396,6 +419,28 @@ class Vector(list):
|
|
396
419
|
return [0, 0, 0]
|
397
420
|
return [round(vecC[0], mantissa), round(vecC[1], mantissa), round(vecC[2], mantissa)]
|
398
421
|
|
422
|
+
@staticmethod
|
423
|
+
def Dot(vectorA, vectorB, mantissa=6):
|
424
|
+
"""
|
425
|
+
Returns the dot product of the two input vectors which is a measure of how much they are aligned.
|
426
|
+
|
427
|
+
Parameters
|
428
|
+
----------
|
429
|
+
vectorA : list
|
430
|
+
The first vector.
|
431
|
+
vectorB : list
|
432
|
+
The second vector.
|
433
|
+
mantissa : int, optional
|
434
|
+
The length of the desired mantissa. The default is 6.
|
435
|
+
|
436
|
+
Returns
|
437
|
+
-------
|
438
|
+
list
|
439
|
+
The vector representing the cross product of the two input vectors.
|
440
|
+
|
441
|
+
"""
|
442
|
+
return round(sum(a*b for a, b in zip(vectorA, vectorB)), mantissa)
|
443
|
+
|
399
444
|
@staticmethod
|
400
445
|
def Down():
|
401
446
|
"""
|
@@ -567,6 +612,48 @@ class Vector(list):
|
|
567
612
|
# Compute bisecting vector
|
568
613
|
return False
|
569
614
|
|
615
|
+
@staticmethod
|
616
|
+
def IsSame(vectorA, vectorB, tolerance=0.0001):
|
617
|
+
"""
|
618
|
+
Returns True if the input vectors are the same. Returns False otherwise.
|
619
|
+
|
620
|
+
Parameters
|
621
|
+
----------
|
622
|
+
vectorA : list
|
623
|
+
The first input vector.
|
624
|
+
vectorB : list
|
625
|
+
The second input vector.
|
626
|
+
tolerance : float , optional
|
627
|
+
The desired tolerance. The default is 0.0001.
|
628
|
+
|
629
|
+
Returns
|
630
|
+
-------
|
631
|
+
bool
|
632
|
+
True if the input vectors are the same. False otherwise.
|
633
|
+
|
634
|
+
"""
|
635
|
+
return all(abs(a - b) < tolerance for a, b in zip(vectorA, vectorB))
|
636
|
+
|
637
|
+
@staticmethod
|
638
|
+
def Length(vector, mantissa: int = 6):
|
639
|
+
"""
|
640
|
+
Returns the length of the input vector.
|
641
|
+
|
642
|
+
Parameters
|
643
|
+
----------
|
644
|
+
vector : list
|
645
|
+
The input vector.
|
646
|
+
mantissa : int
|
647
|
+
The length of the desired mantissa. The default is 6.
|
648
|
+
|
649
|
+
Returns
|
650
|
+
-------
|
651
|
+
float
|
652
|
+
The length of the input vector.
|
653
|
+
"""
|
654
|
+
|
655
|
+
return Vector.Magnitude(vector, mantissa = mantissa)
|
656
|
+
|
570
657
|
@staticmethod
|
571
658
|
def Magnitude(vector, mantissa: int = 6):
|
572
659
|
"""
|
@@ -741,6 +828,26 @@ class Vector(list):
|
|
741
828
|
"""
|
742
829
|
return [-1, -1, 0]
|
743
830
|
|
831
|
+
@staticmethod
|
832
|
+
def Subtract(vectorA, vectorB):
|
833
|
+
"""
|
834
|
+
Subtracts the second input vector from the first input vector.
|
835
|
+
|
836
|
+
Parameters
|
837
|
+
----------
|
838
|
+
vectorA : list
|
839
|
+
The first vector.
|
840
|
+
vectorB : list
|
841
|
+
The second vector.
|
842
|
+
|
843
|
+
Returns
|
844
|
+
-------
|
845
|
+
list
|
846
|
+
The vector resulting from subtracting the second input vector from the first input vector.
|
847
|
+
|
848
|
+
"""
|
849
|
+
return [a - b for a, b in zip(vectorA, vectorB)]
|
850
|
+
|
744
851
|
@staticmethod
|
745
852
|
def Sum(vectors: list):
|
746
853
|
"""
|
topologicpy/Vertex.py
CHANGED
@@ -672,6 +672,29 @@ class Vertex():
|
|
672
672
|
enclosingCells.append(cells[i])
|
673
673
|
return enclosingCells
|
674
674
|
|
675
|
+
@staticmethod
|
676
|
+
def ExternalBoundary(vertex):
|
677
|
+
"""
|
678
|
+
Returns the external boundary (self) of the input vertex. This method is trivial, but included for completeness.
|
679
|
+
|
680
|
+
Parameters
|
681
|
+
----------
|
682
|
+
vertex : topologic_core.Vertex
|
683
|
+
The input vertex.
|
684
|
+
|
685
|
+
Returns
|
686
|
+
-------
|
687
|
+
topologic_core.Vertex
|
688
|
+
The external boundary of the input vertex. This is the input vertex itself.
|
689
|
+
|
690
|
+
"""
|
691
|
+
from topologicpy.Topology import Topology
|
692
|
+
|
693
|
+
if not Topology.IsInstance(vertex, "Vertex"):
|
694
|
+
print("Vertex.ExternalBoundary - Error: The input vertex parameter is not a valid vertex. Returning None.")
|
695
|
+
return None
|
696
|
+
return vertex
|
697
|
+
|
675
698
|
@staticmethod
|
676
699
|
def Fuse(vertices: list, mantissa: int = 6, tolerance: float = 0.0001):
|
677
700
|
"""
|
@@ -747,6 +770,45 @@ class Vertex():
|
|
747
770
|
return_vertices = [Vertex.ByCoordinates(list(coord)) for coord in fused_vertices]
|
748
771
|
return return_vertices
|
749
772
|
|
773
|
+
@staticmethod
|
774
|
+
def IncomingEdges(vertex, hostTopology, tolerance: float = 0.0001) -> list:
|
775
|
+
"""
|
776
|
+
Returns the incoming edges connected to a vertex. An edge is considered incoming if its end vertex is
|
777
|
+
coincident with the input vertex.
|
778
|
+
|
779
|
+
Parameters
|
780
|
+
----------
|
781
|
+
vertex : topologic_core.Vertex
|
782
|
+
The input vertex.
|
783
|
+
hostTopology : topologic_core.Topology
|
784
|
+
The input host topology to which the vertex belongs.
|
785
|
+
tolerance : float , optional
|
786
|
+
The desired tolerance. The default is 0.0001.
|
787
|
+
|
788
|
+
Returns
|
789
|
+
-------
|
790
|
+
list
|
791
|
+
The list of incoming edges
|
792
|
+
|
793
|
+
"""
|
794
|
+
from topologicpy.Edge import Edge
|
795
|
+
from topologicpy.Topology import Topology
|
796
|
+
|
797
|
+
if not Topology.IsInstance(vertex, "Vertex"):
|
798
|
+
print("Vertex.IncomingEdges - Error: The input vertex parameter is not a valid vertex. Returning None.")
|
799
|
+
return None
|
800
|
+
if not Topology.IsInstance(hostTopology, "Topology"):
|
801
|
+
print("Vertex.IncomingEdges - Error: The input graph parameter is not a valid graph. Returning None.")
|
802
|
+
return None
|
803
|
+
|
804
|
+
edges = Topology.SuperTopologies(vertex, hostTopology=hostTopology, topologyType="Edge")
|
805
|
+
incoming_edges = []
|
806
|
+
for edge in edges:
|
807
|
+
ev = Edge.EndVertex(edge)
|
808
|
+
if Vertex.Distance(vertex, ev) < tolerance:
|
809
|
+
incoming_edges.append(edge)
|
810
|
+
return incoming_edges
|
811
|
+
|
750
812
|
@staticmethod
|
751
813
|
def Index(vertex, vertices: list, strict: bool = False, tolerance: float = 0.0001) -> int:
|
752
814
|
"""
|
@@ -992,10 +1054,14 @@ class Vertex():
|
|
992
1054
|
from topologicpy.CellComplex import CellComplex
|
993
1055
|
from topologicpy.Cluster import Cluster
|
994
1056
|
from topologicpy.Topology import Topology
|
1057
|
+
import inspect
|
995
1058
|
|
996
1059
|
if not Topology.IsInstance(vertex, "Vertex"):
|
997
1060
|
if not silent:
|
998
|
-
|
1061
|
+
stack = inspect.stack()
|
1062
|
+
if len(stack) > 2:
|
1063
|
+
print(stack[2].function)
|
1064
|
+
print("Vertex.IsInternal - Error: The input vertex parameter is not a valid vertex. Returning None.", vertex, topology)
|
999
1065
|
return None
|
1000
1066
|
if not Topology.IsInstance(topology, "Topology"):
|
1001
1067
|
if not silent:
|
@@ -1335,6 +1401,45 @@ class Vertex():
|
|
1335
1401
|
"""
|
1336
1402
|
return Vertex.ByCoordinates(0, 0, 0)
|
1337
1403
|
|
1404
|
+
@staticmethod
|
1405
|
+
def OutgoingEdges(vertex, hostTopology, tolerance: float = 0.0001) -> list:
|
1406
|
+
"""
|
1407
|
+
Returns the outgoing edges connected to a vertex. An edge is considered incoming if its start vertex is
|
1408
|
+
coincident with the input vertex.
|
1409
|
+
|
1410
|
+
Parameters
|
1411
|
+
----------
|
1412
|
+
vertex : topologic_core.Vertex
|
1413
|
+
The input vertex.
|
1414
|
+
hostTopology : topologic_core.Topology
|
1415
|
+
The input host topology to which the vertex belongs.
|
1416
|
+
tolerance : float , optional
|
1417
|
+
The desired tolerance. The default is 0.0001.
|
1418
|
+
|
1419
|
+
Returns
|
1420
|
+
-------
|
1421
|
+
list
|
1422
|
+
The list of outgoing edges
|
1423
|
+
|
1424
|
+
"""
|
1425
|
+
from topologicpy.Edge import Edge
|
1426
|
+
from topologicpy.Topology import Topology
|
1427
|
+
|
1428
|
+
if not Topology.IsInstance(vertex, "Vertex"):
|
1429
|
+
print("Vertex.OutgoingEdges - Error: The input vertex parameter is not a valid vertex. Returning None.")
|
1430
|
+
return None
|
1431
|
+
if not Topology.IsInstance(hostTopology, "Topology"):
|
1432
|
+
print("Vertex.OutgoingEdges - Error: The input graph parameter is not a valid graph. Returning None.")
|
1433
|
+
return None
|
1434
|
+
|
1435
|
+
edges = Topology.SuperTopologies(vertex, hostTopology=hostTopology, topologyType="Edge")
|
1436
|
+
outgoing_edges = []
|
1437
|
+
for edge in edges:
|
1438
|
+
sv = Edge.StartVertex(edge)
|
1439
|
+
if Vertex.Distance(vertex, sv) < tolerance:
|
1440
|
+
outgoing_edges.append(edge)
|
1441
|
+
return outgoing_edges
|
1442
|
+
|
1338
1443
|
@staticmethod
|
1339
1444
|
def PerpendicularDistance(vertex, face, mantissa: int = 6):
|
1340
1445
|
"""
|
@@ -1501,8 +1606,6 @@ class Vertex():
|
|
1501
1606
|
The direction in which to project the input vertex unto the input face. If not specified, the direction of the projection is the normal of the input face. The default is None.
|
1502
1607
|
mantissa : int , optional
|
1503
1608
|
The length of the desired mantissa. The default is 6.
|
1504
|
-
tolerance : float , optional
|
1505
|
-
The desired tolerance. The default is 0.0001.
|
1506
1609
|
|
1507
1610
|
Returns
|
1508
1611
|
-------
|
topologicpy/Wire.py
CHANGED
@@ -416,7 +416,7 @@ class Wire(Topology):
|
|
416
416
|
if Wire.IsClosed(wire):
|
417
417
|
e1 = newEdges[-1]
|
418
418
|
e2 = newEdges[0]
|
419
|
-
intV =
|
419
|
+
intV = Topology.Intersect(e1,e2)
|
420
420
|
if intV:
|
421
421
|
newVertices.append(intV)
|
422
422
|
dupVertices.append(vertices[0])
|
@@ -433,7 +433,7 @@ class Wire(Topology):
|
|
433
433
|
normal = [normal[0]*finalOffset*10, normal[1]*finalOffset*10, normal[2]*finalOffset*10]
|
434
434
|
tempV = Vertex.ByCoordinates(vertices[0].X()+normal[0], vertices[0].Y()+normal[1], vertices[0].Z()+normal[2])
|
435
435
|
tempEdge2 = Edge.ByVertices([vertices[0], tempV], tolerance=tolerance, silent=True)
|
436
|
-
intV =
|
436
|
+
intV = Topology.Intersect(tempEdge1,tempEdge2)
|
437
437
|
newVertices.append(intV)
|
438
438
|
dupVertices.append(vertices[0])
|
439
439
|
else:
|
@@ -442,7 +442,7 @@ class Wire(Topology):
|
|
442
442
|
for i in range(len(newEdges)-1):
|
443
443
|
e1 = newEdges[i]
|
444
444
|
e2 = newEdges[i+1]
|
445
|
-
intV =
|
445
|
+
intV = Topology.Intersect(e1,e2)
|
446
446
|
if intV:
|
447
447
|
newVertices.append(intV)
|
448
448
|
dupVertices.append(vertices[i+1])
|
@@ -457,7 +457,7 @@ class Wire(Topology):
|
|
457
457
|
normal = [normal[0]*finalOffset*10, normal[1]*finalOffset*10, normal[2]*finalOffset*10]
|
458
458
|
tempV = Vertex.ByCoordinates(vertices[i+1].X()+normal[0], vertices[i+1].Y()+normal[1], vertices[i+1].Z()+normal[2])
|
459
459
|
tempEdge2 = Edge.ByVertices([vertices[i+1], tempV], tolerance=tolerance, silent=True)
|
460
|
-
intV =
|
460
|
+
intV = Topology.Intersect(tempEdge1,tempEdge2)
|
461
461
|
newVertices.append(intV)
|
462
462
|
dupVertices.append(vertices[i+1])
|
463
463
|
|
@@ -497,8 +497,11 @@ class Wire(Topology):
|
|
497
497
|
miterEdge = Edge.ByVertices([nv2,nv3], tolerance=tolerance)
|
498
498
|
if miterEdge:
|
499
499
|
miterEdge = Edge.SetLength(miterEdge, abs(offset)*10)
|
500
|
-
msv =
|
501
|
-
mev =
|
500
|
+
msv = Topology.Intersect(miterEdge, e1)
|
501
|
+
mev = Topology.Intersect(miterEdge, e2)
|
502
|
+
#if msv == None or mev == None:
|
503
|
+
#Topology.Show(miterEdge, wire, renderer="browser")
|
504
|
+
#Topology.Show(miterEdge, e2, wire, renderer="browser")
|
502
505
|
if (Vertex.IsInternal(msv, e1,tolerance=0.01) and (Vertex.IsInternal(mev, e2, tolerance=0.01))):
|
503
506
|
miterEdge = Edge.ByVertices([msv, mev], tolerance=tolerance)
|
504
507
|
if miterEdge:
|
@@ -640,7 +643,7 @@ class Wire(Topology):
|
|
640
643
|
from topologicpy.Vertex import Vertex
|
641
644
|
from topologicpy.Topology import Topology
|
642
645
|
|
643
|
-
if not origin:
|
646
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
644
647
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
645
648
|
if not Topology.IsInstance(origin, "Vertex"):
|
646
649
|
print("Wire.Circle - Error: The input origin parameter is not a valid Vertex. Retruning None.")
|
@@ -1065,7 +1068,7 @@ class Wire(Topology):
|
|
1065
1068
|
return math.cos(math.radians(angle))
|
1066
1069
|
def sin(angle):
|
1067
1070
|
return math.sin(math.radians(angle))
|
1068
|
-
if not origin:
|
1071
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
1069
1072
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
1070
1073
|
d = cos(30)*radius
|
1071
1074
|
v1 = Vertex.ByCoordinates(0, 0, 0)
|
@@ -1206,7 +1209,7 @@ class Wire(Topology):
|
|
1206
1209
|
from topologicpy.Cluster import Cluster
|
1207
1210
|
from topologicpy.Topology import Topology
|
1208
1211
|
|
1209
|
-
if not origin:
|
1212
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
1210
1213
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
1211
1214
|
if not Topology.IsInstance(origin, "Vertex"):
|
1212
1215
|
return None
|
@@ -1346,6 +1349,31 @@ class Wire(Topology):
|
|
1346
1349
|
exterior_angles = [round(360-a, mantissa) for a in interior_angles]
|
1347
1350
|
return exterior_angles
|
1348
1351
|
|
1352
|
+
@staticmethod
|
1353
|
+
def ExternalBoundary(wire):
|
1354
|
+
"""
|
1355
|
+
Returns the external boundary (cluster of vertices where degree == 1) of the input wire.
|
1356
|
+
|
1357
|
+
Parameters
|
1358
|
+
----------
|
1359
|
+
wire : topologic_core.Wire
|
1360
|
+
The input wire.
|
1361
|
+
|
1362
|
+
Returns
|
1363
|
+
-------
|
1364
|
+
topologic_core.Cluster
|
1365
|
+
The external boundary of the input wire. This is a cluster of vertices of degree == 1.
|
1366
|
+
|
1367
|
+
"""
|
1368
|
+
from topologicpy.Topology import Topology
|
1369
|
+
from topologicpy.Vertex import Vertex
|
1370
|
+
from topologicpy.Cluster import Cluster
|
1371
|
+
|
1372
|
+
if not Topology.IsInstance(wire, "Wire"):
|
1373
|
+
print("Wire.ExternalBoundary - Error: The input wire parameter is not a valid wire. Returning None.")
|
1374
|
+
return None
|
1375
|
+
return Cluster.ByTopologies([v for v in Topology.Vertices(wire) if (Vertex.Degree(v, wire, topologyType="edge") == 1)])
|
1376
|
+
|
1349
1377
|
@staticmethod
|
1350
1378
|
def Fillet(wire, radius: float = 0, radiusKey: str = None, tolerance: float = 0.0001, silent: bool = False):
|
1351
1379
|
"""
|
@@ -1478,11 +1506,12 @@ class Wire(Topology):
|
|
1478
1506
|
# Unflatten the wire
|
1479
1507
|
return_wire = Topology.Unflatten(flat_wire, origin=Vertex.Origin(), direction=normal)
|
1480
1508
|
return return_wire
|
1481
|
-
|
1509
|
+
|
1482
1510
|
@staticmethod
|
1483
1511
|
def InteriorAngles(wire, tolerance: float = 0.0001, mantissa: int = 6) -> list:
|
1484
1512
|
"""
|
1485
1513
|
Returns the interior angles of the input wire in degrees. The wire must be planar, manifold, and closed.
|
1514
|
+
This code has been contributed by Yidan Xue.
|
1486
1515
|
|
1487
1516
|
Parameters
|
1488
1517
|
----------
|
@@ -1519,27 +1548,22 @@ class Wire(Topology):
|
|
1519
1548
|
normal = Face.Normal(f)
|
1520
1549
|
origin = Topology.Centroid(f)
|
1521
1550
|
w = Topology.Flatten(wire, origin=origin, direction=normal)
|
1522
|
-
flat_f = Topology.Flatten(f, origin=origin, direction=normal)
|
1523
|
-
flat_normal = Face.Normal(flat_f)
|
1524
|
-
if flat_normal[2] < 0:
|
1525
|
-
w = Topology.Rotate(w, origin=origin, axis=[1,0,0], angle=180)
|
1526
1551
|
angles = []
|
1527
1552
|
edges = Topology.Edges(w)
|
1553
|
+
e1 = edges[len(edges)-1]
|
1554
|
+
e2 = edges[0]
|
1555
|
+
a = Vector.CompassAngle(Vector.Reverse(Edge.Direction(e1)), Edge.Direction(e2))
|
1556
|
+
angles.append(a)
|
1528
1557
|
for i in range(len(edges)-1):
|
1529
1558
|
e1 = edges[i]
|
1530
1559
|
e2 = edges[i+1]
|
1531
|
-
a =
|
1532
|
-
angles.append(a)
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
# return angles
|
1539
|
-
# else:
|
1540
|
-
# angles = [360-ang for ang in angles]
|
1541
|
-
# return angles
|
1542
|
-
return angles
|
1560
|
+
a = Vector.CompassAngle(Vector.Reverse(Edge.Direction(e1)), Edge.Direction(e2))
|
1561
|
+
angles.append(round(a, mantissa))
|
1562
|
+
if abs(sum(angles)-(len(angles)-2)*180)<tolerance:
|
1563
|
+
return angles
|
1564
|
+
else:
|
1565
|
+
angles = [360-ang for ang in angles]
|
1566
|
+
return angles
|
1543
1567
|
|
1544
1568
|
@staticmethod
|
1545
1569
|
def Interpolate(wires: list, n: int = 5, outputType: str = "default", mapping: str = "default", tolerance: float = 0.0001):
|
@@ -1902,7 +1926,7 @@ class Wire(Topology):
|
|
1902
1926
|
from topologicpy.Vector import Vector
|
1903
1927
|
from topologicpy.Topology import Topology
|
1904
1928
|
|
1905
|
-
if origin
|
1929
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
1906
1930
|
origin = Vertex.Origin()
|
1907
1931
|
if not Topology.IsInstance(origin, "Vertex"):
|
1908
1932
|
print("Wire.Line - Error: The input origin is not a valid vertex. Returning None.")
|
@@ -2016,7 +2040,7 @@ class Wire(Topology):
|
|
2016
2040
|
if not Topology.IsInstance(wire, "Wire"):
|
2017
2041
|
print("Wire.Planarize - Error: The input wire parameter is not a valid topologic wire. Returning None.")
|
2018
2042
|
return None
|
2019
|
-
if origin
|
2043
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
2020
2044
|
origin = Vertex.Origin()
|
2021
2045
|
if not Topology.IsInstance(origin, "Vertex"):
|
2022
2046
|
print("Wire.Planarize - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
@@ -2135,7 +2159,7 @@ class Wire(Topology):
|
|
2135
2159
|
"""
|
2136
2160
|
from topologicpy.Vertex import Vertex
|
2137
2161
|
from topologicpy.Topology import Topology
|
2138
|
-
if not origin:
|
2162
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
2139
2163
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
2140
2164
|
if not Topology.IsInstance(origin, "Vertex"):
|
2141
2165
|
print("Wire.Rectangle - Error: specified origin is not a topologic vertex. Retruning None.")
|
@@ -2570,7 +2594,7 @@ class Wire(Topology):
|
|
2570
2594
|
from topologicpy.Topology import Topology
|
2571
2595
|
import math
|
2572
2596
|
|
2573
|
-
if not origin:
|
2597
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
2574
2598
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
2575
2599
|
if not Topology.IsInstance(origin, "Vertex"):
|
2576
2600
|
print("Wire.Spiral - Error: the input origin is not a valid topologic Vertex. Returning None.")
|
@@ -2807,7 +2831,7 @@ class Wire(Topology):
|
|
2807
2831
|
from topologicpy.Wire import Wire
|
2808
2832
|
from topologicpy.Topology import Topology
|
2809
2833
|
|
2810
|
-
if not origin:
|
2834
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
2811
2835
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
2812
2836
|
if not Topology.IsInstance(origin, "Vertex"):
|
2813
2837
|
print("Wire.Squircle - Error: The input origin parameter is not a valid Vertex. Retruning None.")
|
@@ -2878,7 +2902,7 @@ class Wire(Topology):
|
|
2878
2902
|
from topologicpy.Vertex import Vertex
|
2879
2903
|
from topologicpy.Topology import Topology
|
2880
2904
|
|
2881
|
-
if not origin:
|
2905
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
2882
2906
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
2883
2907
|
if not Topology.IsInstance(origin, "Vertex"):
|
2884
2908
|
return None
|
@@ -3015,7 +3039,7 @@ class Wire(Topology):
|
|
3015
3039
|
from topologicpy.Vertex import Vertex
|
3016
3040
|
from topologicpy.Topology import Topology
|
3017
3041
|
|
3018
|
-
if not origin:
|
3042
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
3019
3043
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
3020
3044
|
if not Topology.IsInstance(origin, "Vertex"):
|
3021
3045
|
return None
|
@@ -3092,7 +3116,7 @@ class Wire(Topology):
|
|
3092
3116
|
if wire_length < tolerance:
|
3093
3117
|
print("Wire.VertexDistance: The input wire parameter is a degenerate topologic wire. Returning None.")
|
3094
3118
|
return None
|
3095
|
-
if origin
|
3119
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
3096
3120
|
origin = Wire.StartVertex(wire)
|
3097
3121
|
if not Topology.IsInstance(origin, "Vertex"):
|
3098
3122
|
print("Wire.VertexDistance - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
@@ -3178,7 +3202,7 @@ class Wire(Topology):
|
|
3178
3202
|
if not Wire.IsManifold(wire):
|
3179
3203
|
print("Wire.VertexAtParameter - Error: The input wire parameter is non-manifold. Returning None.")
|
3180
3204
|
return None
|
3181
|
-
if origin
|
3205
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
3182
3206
|
origin = Wire.StartVertex(wire)
|
3183
3207
|
if not Topology.IsInstance(origin, "Vertex"):
|
3184
3208
|
print("Wire.VertexByDistance - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.14'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.14
|
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
|
@@ -27,7 +27,7 @@ License: MIT License
|
|
27
27
|
|
28
28
|
Project-URL: Homepage, https://github.com/wassimj/TopologicPy
|
29
29
|
Project-URL: Bug Tracker, https://github.com/wassimj/TopologicPy/issues
|
30
|
-
Project-URL: Documentation, https://
|
30
|
+
Project-URL: Documentation, https://topologicpy.readthedocs.io
|
31
31
|
Classifier: Programming Language :: Python :: 3
|
32
32
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
33
33
|
Classifier: Operating System :: OS Independent
|
@@ -40,6 +40,7 @@ Requires-Dist: pandas
|
|
40
40
|
Requires-Dist: tqdm
|
41
41
|
Requires-Dist: plotly
|
42
42
|
Requires-Dist: lark
|
43
|
+
Requires-Dist: specklepy
|
43
44
|
Requires-Dist: topologic-core >=7.0.1
|
44
45
|
Provides-Extra: test
|
45
46
|
Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'test'
|
@@ -105,8 +106,8 @@ topologicpy depends on the following python libraries which will be installed au
|
|
105
106
|
1. Start using the API
|
106
107
|
|
107
108
|
## API Documentation
|
108
|
-
API documentation can be found at [https://
|
109
|
+
API documentation can be found at [https://topologicpy.readthedocs.io](https://topologicpy.readthedocs.io)
|
109
110
|
|
110
|
-
topologicpy:
|
111
|
+
topologicpy: © 2024 Wassim Jabi
|
111
112
|
|
112
|
-
Topologic:
|
113
|
+
Topologic: © 2024 Cardiff University and UCL
|
@@ -0,0 +1,33 @@
|
|
1
|
+
topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
|
2
|
+
topologicpy/Cell.py,sha256=JPRWuD0zxIzv5dIqiUo93HEkRLxTaqKM5_q-XKA1MHA,99356
|
3
|
+
topologicpy/CellComplex.py,sha256=VG2y7tRP6rMaBBDducoA5_djHoOSEbjT_TaAlcgTNT8,47432
|
4
|
+
topologicpy/Cluster.py,sha256=HvomWm_V4bx76YMxqOEhAUrsvcU6z5e_zry6WxMuV2M,54819
|
5
|
+
topologicpy/Color.py,sha256=UlmRcCSOhqcM_OyMWz4t3Kr75KcgXDhz3uctAJ2n7Ic,18031
|
6
|
+
topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
|
7
|
+
topologicpy/DGL.py,sha256=RpkLnAzjg6arY7cEMs2pDFYzRdkerVg1Wbm9hcE3QaM,138991
|
8
|
+
topologicpy/Dictionary.py,sha256=pMbfE2RYGCNpVr2x58qiHRc-aBWnp1jLlyzwS9nz6-w,25891
|
9
|
+
topologicpy/Edge.py,sha256=GBm9X-Nu_WBPSTreTKEFAd47X5gwX9svL85IA34cDCM,57211
|
10
|
+
topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
|
11
|
+
topologicpy/Face.py,sha256=Vq4dsQvuazk_y2FP01SXhXTeub6pJLtewxDSYGB_4Qg,102517
|
12
|
+
topologicpy/Graph.py,sha256=IFEGU0MCE4_fPe2j8sx1vuXPKMjGaov5wTlgRAwB7ns,384631
|
13
|
+
topologicpy/Grid.py,sha256=Cpzs9l5-SptMQbUR8AvbbIOHrGMGlK0Qx8FWmQBgvX0,18497
|
14
|
+
topologicpy/Helper.py,sha256=07V9IFu5ilMpvAdZVhIbdBOjBJSRTtJ0BfR1IoRaRXU,17743
|
15
|
+
topologicpy/Honeybee.py,sha256=dlr5OEH93q51ZmEgvi8PXGfCHBDAjIZ1cm38Rft1Bz4,20235
|
16
|
+
topologicpy/Matrix.py,sha256=VV-kbT0Qt5QO38HRFJmD4IMnQUzYbLjBF4xaFAqLh3Q,8352
|
17
|
+
topologicpy/Neo4j.py,sha256=hNtKWzjb8dQvV2MARDyqW7OInn2LWNiVaA5JmcJl9RM,19569
|
18
|
+
topologicpy/Plotly.py,sha256=IYyUIlLYn8YrjPnxXo4SkRzyrI3hVM9dtMZyA3KfWJ8,98845
|
19
|
+
topologicpy/Polyskel.py,sha256=pNawz5lnvy4oTzCL91fGY2PblW2hmcYBdT5268m2RZs,19743
|
20
|
+
topologicpy/Shell.py,sha256=AFGksfr3HMzr4hru4bGPThRBqmxwW5HXpbtOygv36nU,77020
|
21
|
+
topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
|
22
|
+
topologicpy/Sun.py,sha256=mN3RzlslcZT3APUtwmWIXVbPkJ6OcKTaTf6338gbMJE,37152
|
23
|
+
topologicpy/Topology.py,sha256=_7KiKoi1bUhlwjvRepLoRZ0b4J2AMBGQLff7E9cdu-c,339817
|
24
|
+
topologicpy/Vector.py,sha256=EHXf8Dmcuuf-B0611w8spmdcWeM_CibkShb5F1Wr5fo,32667
|
25
|
+
topologicpy/Vertex.py,sha256=Fim5tdLACI_PuAeOxnVpTojZuw42q29Sc4JCt3kzXi0,71261
|
26
|
+
topologicpy/Wire.py,sha256=HePo_uQyFYnGp34miiX3vlvwnTjJz25pKlasTrlltxM,140831
|
27
|
+
topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
|
28
|
+
topologicpy/version.py,sha256=T3YWq814HTx1777PMcBZwnLDFm9n_-DeF9W_56Tqee8,23
|
29
|
+
topologicpy-0.7.14.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
|
30
|
+
topologicpy-0.7.14.dist-info/METADATA,sha256=1-utDyFzW-bS51EN3TxVi4AzBS3JdzOkpv7LwlkYsMI,8410
|
31
|
+
topologicpy-0.7.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
32
|
+
topologicpy-0.7.14.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
33
|
+
topologicpy-0.7.14.dist-info/RECORD,,
|
@@ -1,33 +0,0 @@
|
|
1
|
-
topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
|
2
|
-
topologicpy/Cell.py,sha256=vaOq9wpkrsfOuLiGnrWFsJAmqNXkIsRnsEtvsDutZjQ,98858
|
3
|
-
topologicpy/CellComplex.py,sha256=TcvDtN_ma66lMTpTyM-mRxoEhX9dS71Vei9eVvaPrkk,46679
|
4
|
-
topologicpy/Cluster.py,sha256=HvomWm_V4bx76YMxqOEhAUrsvcU6z5e_zry6WxMuV2M,54819
|
5
|
-
topologicpy/Color.py,sha256=UlmRcCSOhqcM_OyMWz4t3Kr75KcgXDhz3uctAJ2n7Ic,18031
|
6
|
-
topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
|
7
|
-
topologicpy/DGL.py,sha256=RpkLnAzjg6arY7cEMs2pDFYzRdkerVg1Wbm9hcE3QaM,138991
|
8
|
-
topologicpy/Dictionary.py,sha256=pMbfE2RYGCNpVr2x58qiHRc-aBWnp1jLlyzwS9nz6-w,25891
|
9
|
-
topologicpy/Edge.py,sha256=EiOgg2HtuR-YtL5cpFcLcL1Y3A2Y-m4qPNtLjHGRZBQ,52407
|
10
|
-
topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
|
11
|
-
topologicpy/Face.py,sha256=IiejcLoTDhY0C97I-2IQuOniHf7vDirpzjhG_rj4X5s,101031
|
12
|
-
topologicpy/Graph.py,sha256=IFEGU0MCE4_fPe2j8sx1vuXPKMjGaov5wTlgRAwB7ns,384631
|
13
|
-
topologicpy/Grid.py,sha256=2uDFDxg4NqROC-7bNi1BjK5Uz__BPH13afJ-VDBRW0M,18466
|
14
|
-
topologicpy/Helper.py,sha256=07V9IFu5ilMpvAdZVhIbdBOjBJSRTtJ0BfR1IoRaRXU,17743
|
15
|
-
topologicpy/Honeybee.py,sha256=dlr5OEH93q51ZmEgvi8PXGfCHBDAjIZ1cm38Rft1Bz4,20235
|
16
|
-
topologicpy/Matrix.py,sha256=VV-kbT0Qt5QO38HRFJmD4IMnQUzYbLjBF4xaFAqLh3Q,8352
|
17
|
-
topologicpy/Neo4j.py,sha256=hNtKWzjb8dQvV2MARDyqW7OInn2LWNiVaA5JmcJl9RM,19569
|
18
|
-
topologicpy/Plotly.py,sha256=IYyUIlLYn8YrjPnxXo4SkRzyrI3hVM9dtMZyA3KfWJ8,98845
|
19
|
-
topologicpy/Polyskel.py,sha256=MYHKFOQBlUNqoUhAdOcKRIHpSk0dWWVrZgXK34NkvFM,15936
|
20
|
-
topologicpy/Shell.py,sha256=uPf5Ch8wQ-pbKvXMY_DV9tPXyz4BPmofFVYdIzbWFh4,76960
|
21
|
-
topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
|
22
|
-
topologicpy/Sun.py,sha256=3tYb8kssU882lE1gEWg2mxDvCCY_LAVElkyUT6wa-ZU,36935
|
23
|
-
topologicpy/Topology.py,sha256=sXvhiMShOjOp0aILjEU6uNDqKm3zEAEdrN_IJgDK47c,308819
|
24
|
-
topologicpy/Vector.py,sha256=2OXmty9CKZZzfsg5T4ckml-lPUUvgDvqokcKDsZVN9Y,29806
|
25
|
-
topologicpy/Vertex.py,sha256=WjQZf-r8h_Cjwkt_qNN483FCUql20fbv72Ymiq7ZYtw,67462
|
26
|
-
topologicpy/Wire.py,sha256=Mr9FhiFmcdASjg85ylGTwQmlrcPJuMJh2XybGlg2JH0,139515
|
27
|
-
topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
|
28
|
-
topologicpy/version.py,sha256=CRTpS8UXaJkuf-9u9BHiQMdmQOwD3_viBSxzJw8B4-8,23
|
29
|
-
topologicpy-0.7.11.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
|
30
|
-
topologicpy-0.7.11.dist-info/METADATA,sha256=ZUyfq-XqWnusntlHekNjU8MbsQNOLQEa-9zfwi4GdFw,8405
|
31
|
-
topologicpy-0.7.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
32
|
-
topologicpy-0.7.11.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
33
|
-
topologicpy-0.7.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|