topologicpy 0.5.3__py3-none-any.whl → 0.5.4__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 +112 -112
- topologicpy/CellComplex.py +15 -15
- topologicpy/Cluster.py +3 -3
- topologicpy/Color.py +10 -10
- topologicpy/Edge.py +12 -9
- topologicpy/Face.py +32 -30
- topologicpy/Graph.py +29 -29
- topologicpy/Grid.py +9 -9
- topologicpy/Plotly.py +29 -29
- topologicpy/Shell.py +42 -43
- topologicpy/Speckle.py +1 -1
- topologicpy/Topology.py +58 -62
- topologicpy/Vector.py +36 -36
- topologicpy/Vertex.py +12 -12
- topologicpy/Wire.py +80 -76
- topologicpy/__init__.py +1 -1
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/METADATA +1 -1
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/RECORD +21 -21
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/LICENSE +0 -0
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/WHEEL +0 -0
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/top_level.txt +0 -0
topologicpy/Cell.py
CHANGED
@@ -66,15 +66,15 @@ class Cell(Topology):
|
|
66
66
|
@staticmethod
|
67
67
|
def Box(origin: topologic.Vertex = None,
|
68
68
|
width: float = 1, length: float = 1, height: float = 1,
|
69
|
-
uSides: int = 1, vSides:int = 1, wSides:int = 1,
|
70
|
-
direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
69
|
+
uSides: int = 1, vSides: int = 1, wSides: int = 1,
|
70
|
+
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
71
71
|
"""
|
72
72
|
Creates a box.
|
73
73
|
|
74
74
|
Parameters
|
75
75
|
----------
|
76
76
|
origin : topologic.Vertex , optional
|
77
|
-
The origin location of the box. The default is None which results in the box being placed at (0,0,0).
|
77
|
+
The origin location of the box. The default is None which results in the box being placed at (0, 0, 0).
|
78
78
|
width : float , optional
|
79
79
|
The width of the box. The default is 1.
|
80
80
|
length : float , optional
|
@@ -88,7 +88,7 @@ class Cell(Topology):
|
|
88
88
|
wSides : int , optional
|
89
89
|
The number of sides along the height. The default is 1.
|
90
90
|
direction : list , optional
|
91
|
-
The vector representing the up direction of the box. The default is [0,0,1].
|
91
|
+
The vector representing the up direction of the box. The default is [0, 0, 1].
|
92
92
|
placement : str , optional
|
93
93
|
The description of the placement of the origin of the box. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
94
94
|
tolerance : float , optional
|
@@ -179,7 +179,7 @@ class Cell(Topology):
|
|
179
179
|
for f in faceList:
|
180
180
|
centroid = Topology.Centroid(f)
|
181
181
|
n = Face.Normal(f)
|
182
|
-
v = Topology.Translate(centroid, n[0]*0.01,n[1]*0.01,n[2]*0.01)
|
182
|
+
v = Topology.Translate(centroid, n[0]*0.01, n[1]*0.01, n[2]*0.01)
|
183
183
|
if not Vertex.IsInternal(v, cell):
|
184
184
|
finalFaces.append(f)
|
185
185
|
finalFinalFaces = []
|
@@ -334,7 +334,7 @@ class Cell(Topology):
|
|
334
334
|
return Cell.ByFaces(cellFaces, planarize=planarize, tolerance=tolerance)
|
335
335
|
|
336
336
|
@staticmethod
|
337
|
-
def ByThickenedShell(shell: topologic.Shell, direction: list = [0,0,1], thickness: float = 1.0, bothSides: bool = True, reverse: bool = False,
|
337
|
+
def ByThickenedShell(shell: topologic.Shell, direction: list = [0, 0, 1], thickness: float = 1.0, bothSides: bool = True, reverse: bool = False,
|
338
338
|
planarize: bool = False, tolerance: float = 0.0001) -> topologic.Cell:
|
339
339
|
"""
|
340
340
|
Creates a cell by thickening the input shell. The shell must be open.
|
@@ -558,14 +558,14 @@ class Cell(Topology):
|
|
558
558
|
return Cell.ByWires(wires, close=close, triangulate=triangulate, planarize=planarize, tolerance=tolerance)
|
559
559
|
|
560
560
|
@staticmethod
|
561
|
-
def Capsule(origin: topologic.Vertex = None, radius: float = 0.25, height: float = 1, uSides: int = 16, vSidesEnds:int = 8, vSidesMiddle: int = 1, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
561
|
+
def Capsule(origin: topologic.Vertex = None, radius: float = 0.25, height: float = 1, uSides: int = 16, vSidesEnds:int = 8, vSidesMiddle: int = 1, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
562
562
|
"""
|
563
563
|
Creates a capsule shape. A capsule is a cylinder with hemispherical ends.
|
564
564
|
|
565
565
|
Parameters
|
566
566
|
----------
|
567
567
|
origin : topologic.Vertex , optional
|
568
|
-
The location of the origin of the cylinder. The default is None which results in the cylinder being placed at (0,0,0).
|
568
|
+
The location of the origin of the cylinder. The default is None which results in the cylinder being placed at (0, 0, 0).
|
569
569
|
radius : float , optional
|
570
570
|
The radius of the capsule. The default is 0.25.
|
571
571
|
height : float , optional
|
@@ -577,7 +577,7 @@ class Cell(Topology):
|
|
577
577
|
vSidesMiddle : int , optional
|
578
578
|
The number of vertical segments of the middle cylinder. The default is 1.
|
579
579
|
direction : list , optional
|
580
|
-
The vector representing the up direction of the capsule. The default is [0,0,1].
|
580
|
+
The vector representing the up direction of the capsule. The default is [0, 0, 1].
|
581
581
|
placement : str , optional
|
582
582
|
The description of the placement of the origin of the capsule. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "bottom".
|
583
583
|
tolerance : float , optional
|
@@ -593,7 +593,7 @@ class Cell(Topology):
|
|
593
593
|
from topologicpy.Cell import Cell
|
594
594
|
from topologicpy.Vertex import Vertex
|
595
595
|
if not origin:
|
596
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
596
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
597
597
|
if not isinstance(origin, topologic.Vertex):
|
598
598
|
print("Cell.Capsule - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
599
599
|
return None
|
@@ -604,9 +604,9 @@ class Cell(Topology):
|
|
604
604
|
cyl = Cell.Cylinder(origin=Vertex.Origin(),
|
605
605
|
radius=radius,
|
606
606
|
height=cyl_height,
|
607
|
-
uSides=uSides, vSides=vSidesMiddle, direction=[0,0,1], placement="center", tolerance=tolerance)
|
608
|
-
o1 = Vertex.ByCoordinates(0,0,cyl_height*0.5)
|
609
|
-
o2 = Vertex.ByCoordinates(0,0
|
607
|
+
uSides=uSides, vSides=vSidesMiddle, direction=[0, 0, 1], placement="center", tolerance=tolerance)
|
608
|
+
o1 = Vertex.ByCoordinates(0, 0, cyl_height*0.5)
|
609
|
+
o2 = Vertex.ByCoordinates(0, 0, -cyl_height*0.5)
|
610
610
|
s1 = Cell.Sphere(origin=o1, radius=radius, uSides=uSides, vSides=vSidesEnds*2, tolerance=tolerance)
|
611
611
|
s2 = Cell.Sphere(origin=o2, radius=radius, uSides=uSides, vSides=vSidesEnds*2, tolerance=tolerance)
|
612
612
|
capsule = Topology.Union(cyl, s1, tolerance=tolerance)
|
@@ -617,7 +617,7 @@ class Cell(Topology):
|
|
617
617
|
capsule = Topology.Translate(capsule, 0, 0, height/2)
|
618
618
|
capsule = Topology.Translate(capsule, radius, radius)
|
619
619
|
|
620
|
-
capsule = Topology.Orient(capsule, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction)
|
620
|
+
capsule = Topology.Orient(capsule, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction)
|
621
621
|
capsule = Topology.Place(capsule, originA=Vertex.Origin(), originB=origin)
|
622
622
|
return capsule
|
623
623
|
|
@@ -661,7 +661,7 @@ class Cell(Topology):
|
|
661
661
|
return round(compactness, mantissa)
|
662
662
|
|
663
663
|
@staticmethod
|
664
|
-
def Cone(origin: topologic.Vertex = None, baseRadius: float = 0.5, topRadius: float = 0, height: float = 1, uSides: int = 16, vSides: int = 1, direction: list = [0,0,1],
|
664
|
+
def Cone(origin: topologic.Vertex = None, baseRadius: float = 0.5, topRadius: float = 0, height: float = 1, uSides: int = 16, vSides: int = 1, direction: list = [0, 0, 1],
|
665
665
|
dirZ: float = 1, placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
666
666
|
"""
|
667
667
|
Creates a cone.
|
@@ -669,7 +669,7 @@ class Cell(Topology):
|
|
669
669
|
Parameters
|
670
670
|
----------
|
671
671
|
origin : topologic.Vertex , optional
|
672
|
-
The location of the origin of the cone. The default is None which results in the cone being placed at (0,0,0).
|
672
|
+
The location of the origin of the cone. The default is None which results in the cone being placed at (0, 0, 0).
|
673
673
|
baseRadius : float , optional
|
674
674
|
The radius of the base circle of the cone. The default is 0.5.
|
675
675
|
topRadius : float , optional
|
@@ -679,7 +679,7 @@ class Cell(Topology):
|
|
679
679
|
sides : int , optional
|
680
680
|
The number of sides of the cone. The default is 16.
|
681
681
|
direction : list , optional
|
682
|
-
The vector representing the up direction of the cone. The default is [0,0,1].
|
682
|
+
The vector representing the up direction of the cone. The default is [0, 0, 1].
|
683
683
|
placement : str , optional
|
684
684
|
The description of the placement of the origin of the cone. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
685
685
|
tolerance : float , optional
|
@@ -720,7 +720,7 @@ class Cell(Topology):
|
|
720
720
|
faces.append(f)
|
721
721
|
return Cell.ByFaces(faces, tolerance=tolerance)
|
722
722
|
if not origin:
|
723
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
723
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
724
724
|
if not isinstance(origin, topologic.Vertex):
|
725
725
|
print("Cell.Cone - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
726
726
|
return None
|
@@ -779,7 +779,7 @@ class Cell(Topology):
|
|
779
779
|
shell = Cell.Shells(cone)[0]
|
780
780
|
shell = shell.Slice(cutting_planes_cluster)
|
781
781
|
cone = Cell.ByShell(shell)
|
782
|
-
cone = Topology.Orient(cone, origin=origin, dirA=[0,0,1], dirB=direction)
|
782
|
+
cone = Topology.Orient(cone, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
783
783
|
return cone
|
784
784
|
|
785
785
|
@staticmethod
|
@@ -821,7 +821,7 @@ class Cell(Topology):
|
|
821
821
|
return None
|
822
822
|
|
823
823
|
@staticmethod
|
824
|
-
def Cylinder(origin: topologic.Vertex = None, radius: float = 0.5, height: float = 1, uSides: int = 16, vSides:int = 1, direction: list = [0,0,1],
|
824
|
+
def Cylinder(origin: topologic.Vertex = None, radius: float = 0.5, height: float = 1, uSides: int = 16, vSides: int = 1, direction: list = [0, 0, 1],
|
825
825
|
placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
826
826
|
"""
|
827
827
|
Creates a cylinder.
|
@@ -829,7 +829,7 @@ class Cell(Topology):
|
|
829
829
|
Parameters
|
830
830
|
----------
|
831
831
|
origin : topologic.Vertex , optional
|
832
|
-
The location of the origin of the cylinder. The default is None which results in the cylinder being placed at (0,0,0).
|
832
|
+
The location of the origin of the cylinder. The default is None which results in the cylinder being placed at (0, 0, 0).
|
833
833
|
radius : float , optional
|
834
834
|
The radius of the cylinder. The default is 0.5.
|
835
835
|
height : float , optional
|
@@ -839,7 +839,7 @@ class Cell(Topology):
|
|
839
839
|
vSides : int , optional
|
840
840
|
The number of vertical segments of the cylinder. The default is 1.
|
841
841
|
direction : list , optional
|
842
|
-
The vector representing the up direction of the cylinder. The default is [0,0,1].
|
842
|
+
The vector representing the up direction of the cylinder. The default is [0, 0, 1].
|
843
843
|
placement : str , optional
|
844
844
|
The description of the placement of the origin of the cylinder. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "bottom".
|
845
845
|
tolerance : float , optional
|
@@ -857,7 +857,7 @@ class Cell(Topology):
|
|
857
857
|
from topologicpy.Cluster import Cluster
|
858
858
|
from topologicpy.Topology import Topology
|
859
859
|
if not origin:
|
860
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
860
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
861
861
|
if not isinstance(origin, topologic.Vertex):
|
862
862
|
print("Cell.Cylinder - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
863
863
|
return None
|
@@ -871,7 +871,7 @@ class Cell(Topology):
|
|
871
871
|
yOffset = radius
|
872
872
|
circle_origin = Vertex.ByCoordinates(origin.X() + xOffset, origin.Y() + yOffset, origin.Z() + zOffset)
|
873
873
|
|
874
|
-
baseWire = Wire.Circle(origin=circle_origin, radius=radius, sides=uSides, fromAngle=0, toAngle=360, close=True, direction=[0,0,1], placement="center", tolerance=tolerance)
|
874
|
+
baseWire = Wire.Circle(origin=circle_origin, radius=radius, sides=uSides, fromAngle=0, toAngle=360, close=True, direction=[0, 0, 1], placement="center", tolerance=tolerance)
|
875
875
|
baseFace = Face.ByWire(baseWire, tolerance=tolerance)
|
876
876
|
cylinder = Cell.ByThickenedFace(face=baseFace, thickness=height, bothSides=False, reverse=True,
|
877
877
|
tolerance=tolerance)
|
@@ -887,7 +887,7 @@ class Cell(Topology):
|
|
887
887
|
cutting_planes_cluster = Cluster.ByTopologies(cutting_planes)
|
888
888
|
cylinder = CellComplex.ExternalBoundary(cylinder.Slice(cutting_planes_cluster))
|
889
889
|
|
890
|
-
cylinder = Topology.Orient(cylinder, origin=origin, dirA=[0,0,1], dirB=direction)
|
890
|
+
cylinder = Topology.Orient(cylinder, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
891
891
|
return cylinder
|
892
892
|
|
893
893
|
@staticmethod
|
@@ -963,7 +963,7 @@ class Cell(Topology):
|
|
963
963
|
zList.append(f.Centroid().Z())
|
964
964
|
zMin = min(zList)
|
965
965
|
zMax = max(zList)
|
966
|
-
up = [0,0,1]
|
966
|
+
up = [0, 0, 1]
|
967
967
|
for aFace in faces:
|
968
968
|
aCode = angleCode(aFace, up, tiltAngle)
|
969
969
|
|
@@ -1001,7 +1001,7 @@ class Cell(Topology):
|
|
1001
1001
|
|
1002
1002
|
@staticmethod
|
1003
1003
|
def Dodecahedron(origin: topologic.Vertex = None, radius: float = 0.5,
|
1004
|
-
direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
1004
|
+
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
1005
1005
|
"""
|
1006
1006
|
Description
|
1007
1007
|
----------
|
@@ -1010,11 +1010,11 @@ class Cell(Topology):
|
|
1010
1010
|
Parameters
|
1011
1011
|
----------
|
1012
1012
|
origin : topologic.Vertex , optional
|
1013
|
-
The origin location of the dodecahedron. The default is None which results in the dodecahedron being placed at (0,0,0).
|
1013
|
+
The origin location of the dodecahedron. The default is None which results in the dodecahedron being placed at (0, 0, 0).
|
1014
1014
|
radius : float , optional
|
1015
1015
|
The radius of the dodecahedron's circumscribed sphere. The default is 0.5.
|
1016
1016
|
direction : list , optional
|
1017
|
-
The vector representing the up direction of the dodecahedron. The default is [0,0,1].
|
1017
|
+
The vector representing the up direction of the dodecahedron. The default is [0, 0, 1].
|
1018
1018
|
placement : str , optional
|
1019
1019
|
The description of the placement of the origin of the dodecahedron. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
1020
1020
|
tolerance : float , optional
|
@@ -1033,7 +1033,7 @@ class Cell(Topology):
|
|
1033
1033
|
from topologicpy.Topology import Topology
|
1034
1034
|
|
1035
1035
|
if not origin:
|
1036
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1036
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1037
1037
|
if not isinstance(origin, topologic.Vertex):
|
1038
1038
|
print("Cell.Dodecahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
1039
1039
|
return None
|
@@ -1043,12 +1043,12 @@ class Cell(Topology):
|
|
1043
1043
|
for edge in edges:
|
1044
1044
|
o = Topology.Centroid(edge)
|
1045
1045
|
e_dir = Edge.Direction(edge)
|
1046
|
-
pentagons.append(Topology.Rotate(pen, origin=o,
|
1046
|
+
pentagons.append(Topology.Rotate(pen, origin=o, axis=e_dir, angle=116.565))
|
1047
1047
|
|
1048
1048
|
cluster = Cluster.ByTopologies(pentagons)
|
1049
1049
|
|
1050
|
-
cluster2 = Topology.Rotate(cluster, origin=Vertex.Origin(),
|
1051
|
-
cluster2 = Topology.Rotate(cluster2, origin=Vertex.Origin(),
|
1050
|
+
cluster2 = Topology.Rotate(cluster, origin=Vertex.Origin(), axis=[1, 0, 0], angle=180)
|
1051
|
+
cluster2 = Topology.Rotate(cluster2, origin=Vertex.Origin(), axis=[0, 0, 1], angle=36)
|
1052
1052
|
vertices = Topology.Vertices(cluster2)
|
1053
1053
|
zList = [Vertex.Z(v) for v in vertices]
|
1054
1054
|
zList = list(set(zList))
|
@@ -1068,7 +1068,7 @@ class Cell(Topology):
|
|
1068
1068
|
elif placement == "lowerleft":
|
1069
1069
|
dodecahedron = Topology.Translate(dodecahedron, radius, radius, radius)
|
1070
1070
|
|
1071
|
-
dodecahedron = Topology.Orient(dodecahedron, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction, tolerance=tolerance)
|
1071
|
+
dodecahedron = Topology.Orient(dodecahedron, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction, tolerance=tolerance)
|
1072
1072
|
dodecahedron = Topology.Place(dodecahedron, originA=Vertex.Origin(), originB=origin)
|
1073
1073
|
return dodecahedron
|
1074
1074
|
|
@@ -1096,7 +1096,7 @@ class Cell(Topology):
|
|
1096
1096
|
return edges
|
1097
1097
|
|
1098
1098
|
@staticmethod
|
1099
|
-
def Egg(origin: topologic.Vertex = None, height: float = 1.0, uSides: int = 16, vSides: int = 8, direction: list = [0,0,1],
|
1099
|
+
def Egg(origin: topologic.Vertex = None, height: float = 1.0, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1],
|
1100
1100
|
placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
1101
1101
|
"""
|
1102
1102
|
Creates a sphere.
|
@@ -1104,7 +1104,7 @@ class Cell(Topology):
|
|
1104
1104
|
Parameters
|
1105
1105
|
----------
|
1106
1106
|
origin : topologic.Vertex , optional
|
1107
|
-
The origin location of the sphere. The default is None which results in the sphere being placed at (0,0,0).
|
1107
|
+
The origin location of the sphere. The default is None which results in the sphere being placed at (0, 0, 0).
|
1108
1108
|
radius : float , optional
|
1109
1109
|
The radius of the sphere. The default is 0.5.
|
1110
1110
|
uSides : int , optional
|
@@ -1112,7 +1112,7 @@ class Cell(Topology):
|
|
1112
1112
|
vSides : int , optional
|
1113
1113
|
The number of sides along the latitude of the sphere. The default is 8.
|
1114
1114
|
direction : list , optional
|
1115
|
-
The vector representing the up direction of the sphere. The default is [0,0,1].
|
1115
|
+
The vector representing the up direction of the sphere. The default is [0, 0, 1].
|
1116
1116
|
placement : str , optional
|
1117
1117
|
The description of the placement of the origin of the sphere. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
1118
1118
|
tolerance : float , optional
|
@@ -1130,7 +1130,7 @@ class Cell(Topology):
|
|
1130
1130
|
from topologicpy.Dictionary import Dictionary
|
1131
1131
|
|
1132
1132
|
if not origin:
|
1133
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1133
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1134
1134
|
if not isinstance(origin, topologic.Vertex):
|
1135
1135
|
print("Cell.Sphere - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
1136
1136
|
return None
|
@@ -1161,7 +1161,7 @@ class Cell(Topology):
|
|
1161
1161
|
for i in range(vSides+1):
|
1162
1162
|
new_verts.append(Wire.VertexByParameter(c, i/vSides))
|
1163
1163
|
c = Wire.ByVertices(new_verts, close=False)
|
1164
|
-
egg = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0,0,1],
|
1164
|
+
egg = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0, 0, 1], angle=360, sides=uSides, tolerance=tolerance)
|
1165
1165
|
if egg.Type() == topologic.CellComplex.Type():
|
1166
1166
|
egg = egg.ExternalBoundary()
|
1167
1167
|
if egg.Type() == topologic.Shell.Type():
|
@@ -1175,7 +1175,7 @@ class Cell(Topology):
|
|
1175
1175
|
width = Dictionary.ValueAtKey(d, 'width')
|
1176
1176
|
length = Dictionary.ValueAtKey(d, 'length')
|
1177
1177
|
egg = Topology.Translate(egg, width*0.5, length*0.5, height*0.5)
|
1178
|
-
egg = Topology.Orient(egg, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction)
|
1178
|
+
egg = Topology.Orient(egg, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction)
|
1179
1179
|
egg = Topology.Place(egg, originA=Vertex.Origin(), originB=origin)
|
1180
1180
|
return egg
|
1181
1181
|
|
@@ -1229,7 +1229,7 @@ class Cell(Topology):
|
|
1229
1229
|
return faces
|
1230
1230
|
|
1231
1231
|
@staticmethod
|
1232
|
-
def Hyperboloid(origin: topologic.Cell = None, baseRadius: float = 0.5, topRadius: float = 0.5, height: float = 1, sides: int = 24, direction: list = [0,0,1],
|
1232
|
+
def Hyperboloid(origin: topologic.Cell = None, baseRadius: float = 0.5, topRadius: float = 0.5, height: float = 1, sides: int = 24, direction: list = [0, 0, 1],
|
1233
1233
|
twist: float = 60, placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
1234
1234
|
"""
|
1235
1235
|
Creates a hyperboloid.
|
@@ -1237,7 +1237,7 @@ class Cell(Topology):
|
|
1237
1237
|
Parameters
|
1238
1238
|
----------
|
1239
1239
|
origin : topologic.Vertex , optional
|
1240
|
-
The location of the origin of the hyperboloid. The default is None which results in the hyperboloid being placed at (0,0,0).
|
1240
|
+
The location of the origin of the hyperboloid. The default is None which results in the hyperboloid being placed at (0, 0, 0).
|
1241
1241
|
baseRadius : float , optional
|
1242
1242
|
The radius of the base circle of the hyperboloid. The default is 0.5.
|
1243
1243
|
topRadius : float , optional
|
@@ -1247,7 +1247,7 @@ class Cell(Topology):
|
|
1247
1247
|
sides : int , optional
|
1248
1248
|
The number of sides of the cone. The default is 24.
|
1249
1249
|
direction : list , optional
|
1250
|
-
The vector representing the up direction of the hyperboloid. The default is [0,0,1].
|
1250
|
+
The vector representing the up direction of the hyperboloid. The default is [0, 0, 1].
|
1251
1251
|
twist : float , optional
|
1252
1252
|
The angle to twist the base cylinder. The default is 60.
|
1253
1253
|
placement : str , optional
|
@@ -1291,7 +1291,7 @@ class Cell(Topology):
|
|
1291
1291
|
return returnTopology
|
1292
1292
|
|
1293
1293
|
if not origin:
|
1294
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1294
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1295
1295
|
if not isinstance(origin, topologic.Vertex):
|
1296
1296
|
print("Cell.Hyperboloid - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
1297
1297
|
return None
|
@@ -1325,13 +1325,13 @@ class Cell(Topology):
|
|
1325
1325
|
print("Cell.Hyperboloid - Error: Could not create a hyperboloid. Returning None.")
|
1326
1326
|
return None
|
1327
1327
|
|
1328
|
-
hyperboloid = Topology.Orient(hyperboloid, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction, tolerance=tolerance)
|
1328
|
+
hyperboloid = Topology.Orient(hyperboloid, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction, tolerance=tolerance)
|
1329
1329
|
hyperboloid = Topology.Place(hyperboloid, originA=Vertex.Origin(), originB=origin)
|
1330
1330
|
return hyperboloid
|
1331
1331
|
|
1332
1332
|
@staticmethod
|
1333
1333
|
def Icosahedron(origin: topologic.Vertex = None, radius: float = 0.5,
|
1334
|
-
direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
1334
|
+
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
1335
1335
|
"""
|
1336
1336
|
Description
|
1337
1337
|
----------
|
@@ -1340,11 +1340,11 @@ class Cell(Topology):
|
|
1340
1340
|
Parameters
|
1341
1341
|
----------
|
1342
1342
|
origin : topologic.Vertex , optional
|
1343
|
-
The origin location of the icosahedron. The default is None which results in the icosahedron being placed at (0,0,0).
|
1343
|
+
The origin location of the icosahedron. The default is None which results in the icosahedron being placed at (0, 0, 0).
|
1344
1344
|
radius : float , optional
|
1345
1345
|
The radius of the icosahedron's circumscribed sphere. The default is 0.5.
|
1346
1346
|
direction : list , optional
|
1347
|
-
The vector representing the up direction of the icosahedron. The default is [0,0,1].
|
1347
|
+
The vector representing the up direction of the icosahedron. The default is [0, 0, 1].
|
1348
1348
|
placement : str , optional
|
1349
1349
|
The description of the placement of the origin of the icosahedron. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
1350
1350
|
tolerance : float , optional
|
@@ -1363,15 +1363,15 @@ class Cell(Topology):
|
|
1363
1363
|
import math
|
1364
1364
|
|
1365
1365
|
if not origin:
|
1366
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1366
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1367
1367
|
if not isinstance(origin, topologic.Vertex):
|
1368
1368
|
print("Cell.Dodecahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
1369
1369
|
return None
|
1370
1370
|
rect1 = Wire.Rectangle(width=(1+math.sqrt(5))/2, length=1)
|
1371
1371
|
rect2 = Wire.Rectangle(width=1, length=(1+math.sqrt(5))/2)
|
1372
|
-
rect2 = Topology.Rotate(rect2,
|
1372
|
+
rect2 = Topology.Rotate(rect2, origin=Vertex.Origin(), axis=[1, 0, 0], angle=90)
|
1373
1373
|
rect3 = Wire.Rectangle(width=1, length=(1+math.sqrt(5))/2)
|
1374
|
-
rect3 = Topology.Rotate(rect3,
|
1374
|
+
rect3 = Topology.Rotate(rect3, origin=Vertex.Origin(), axis=[0, 1, 0], angle=90)
|
1375
1375
|
vertices = Topology.Vertices(rect1)
|
1376
1376
|
v1, v2, v3, v4 = vertices
|
1377
1377
|
vertices = Topology.Vertices(rect2)
|
@@ -1410,7 +1410,7 @@ class Cell(Topology):
|
|
1410
1410
|
elif placement == "lowerleft":
|
1411
1411
|
icosahedron = Topology.Translate(icosahedron, radius, radius, radius)
|
1412
1412
|
|
1413
|
-
icosahedron = Topology.Orient(icosahedron, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction, tolerance=tolerance)
|
1413
|
+
icosahedron = Topology.Orient(icosahedron, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction, tolerance=tolerance)
|
1414
1414
|
icosahedron = Topology.Place(icosahedron, originA=Vertex.Origin(), originB=origin)
|
1415
1415
|
return icosahedron
|
1416
1416
|
|
@@ -1498,7 +1498,7 @@ class Cell(Topology):
|
|
1498
1498
|
|
1499
1499
|
@staticmethod
|
1500
1500
|
def Octahedron(origin: topologic.Vertex = None, radius: float = 0.5,
|
1501
|
-
direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
1501
|
+
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
1502
1502
|
"""
|
1503
1503
|
Description
|
1504
1504
|
----------
|
@@ -1507,11 +1507,11 @@ class Cell(Topology):
|
|
1507
1507
|
Parameters
|
1508
1508
|
----------
|
1509
1509
|
origin : topologic.Vertex , optional
|
1510
|
-
The origin location of the octahedron. The default is None which results in the octahedron being placed at (0,0,0).
|
1510
|
+
The origin location of the octahedron. The default is None which results in the octahedron being placed at (0, 0, 0).
|
1511
1511
|
radius : float , optional
|
1512
1512
|
The radius of the octahedron's circumscribed sphere. The default is 0.5.
|
1513
1513
|
direction : list , optional
|
1514
|
-
The vector representing the up direction of the octahedron. The default is [0,0,1].
|
1514
|
+
The vector representing the up direction of the octahedron. The default is [0, 0, 1].
|
1515
1515
|
placement : str , optional
|
1516
1516
|
The description of the placement of the origin of the octahedron. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
1517
1517
|
tolerance : float , optional
|
@@ -1529,33 +1529,33 @@ class Cell(Topology):
|
|
1529
1529
|
from topologicpy.Topology import Topology
|
1530
1530
|
|
1531
1531
|
if not origin:
|
1532
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1532
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1533
1533
|
if not isinstance(origin, topologic.Vertex):
|
1534
1534
|
print("Cell.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
1535
1535
|
return None
|
1536
1536
|
|
1537
|
-
vb1 = Vertex.ByCoordinates(-0.5,0,0)
|
1538
|
-
vb2 = Vertex.ByCoordinates(0
|
1539
|
-
vb3 = Vertex.ByCoordinates(0.5,0,0)
|
1540
|
-
vb4 = Vertex.ByCoordinates(0,0.5,0)
|
1537
|
+
vb1 = Vertex.ByCoordinates(-0.5, 0, 0)
|
1538
|
+
vb2 = Vertex.ByCoordinates(0, -0.5, 0)
|
1539
|
+
vb3 = Vertex.ByCoordinates(0.5, 0, 0)
|
1540
|
+
vb4 = Vertex.ByCoordinates(0, 0.5, 0)
|
1541
1541
|
top = Vertex.ByCoordinates(0, 0, 0.5)
|
1542
1542
|
bottom = Vertex.ByCoordinates(0, 0, -0.5)
|
1543
|
-
f1 = Face.ByVertices([top,vb1,vb2])
|
1544
|
-
f2 = Face.ByVertices([top,vb2,vb3])
|
1545
|
-
f3 = Face.ByVertices([top,vb3,vb4])
|
1546
|
-
f4 = Face.ByVertices([top,vb4,vb1])
|
1547
|
-
f5 = Face.ByVertices([bottom,vb1,vb2])
|
1548
|
-
f6 = Face.ByVertices([bottom,vb2,vb3])
|
1549
|
-
f7 = Face.ByVertices([bottom,vb3,vb4])
|
1550
|
-
f8 = Face.ByVertices([bottom,vb4,vb1])
|
1551
|
-
|
1552
|
-
octahedron = Cell.ByFaces([f1,f2,f3,f4,f5,f6,f7,f8], tolerance=tolerance)
|
1543
|
+
f1 = Face.ByVertices([top, vb1, vb2])
|
1544
|
+
f2 = Face.ByVertices([top, vb2, vb3])
|
1545
|
+
f3 = Face.ByVertices([top, vb3, vb4])
|
1546
|
+
f4 = Face.ByVertices([top, vb4, vb1])
|
1547
|
+
f5 = Face.ByVertices([bottom, vb1, vb2])
|
1548
|
+
f6 = Face.ByVertices([bottom, vb2, vb3])
|
1549
|
+
f7 = Face.ByVertices([bottom, vb3, vb4])
|
1550
|
+
f8 = Face.ByVertices([bottom, vb4, vb1])
|
1551
|
+
|
1552
|
+
octahedron = Cell.ByFaces([f1, f2, f3, f4, f5, f6, f7, f8], tolerance=tolerance)
|
1553
1553
|
octahedron = Topology.Scale(octahedron, origin=Vertex.Origin(), x=radius/0.5, y=radius/0.5, z=radius/0.5)
|
1554
1554
|
if placement == "bottom":
|
1555
1555
|
octahedron = Topology.Translate(octahedron, 0, 0, radius)
|
1556
1556
|
elif placement == "lowerleft":
|
1557
1557
|
octahedron = Topology.Translate(octahedron, radius, radius, radius)
|
1558
|
-
octahedron = Topology.Orient(octahedron, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction)
|
1558
|
+
octahedron = Topology.Orient(octahedron, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction)
|
1559
1559
|
octahedron = Topology.Place(octahedron, originA=Vertex.Origin(), originB=origin)
|
1560
1560
|
return octahedron
|
1561
1561
|
|
@@ -1630,8 +1630,8 @@ class Cell(Topology):
|
|
1630
1630
|
x = math.sin(angle)*radius + sv.X()
|
1631
1631
|
y = math.cos(angle)*radius + sv.Y()
|
1632
1632
|
z = sv.Z()
|
1633
|
-
baseV.append(Vertex.ByCoordinates(x,y,z))
|
1634
|
-
topV.append(Vertex.ByCoordinates(x,y,z+dist))
|
1633
|
+
baseV.append(Vertex.ByCoordinates(x, y, z))
|
1634
|
+
topV.append(Vertex.ByCoordinates(x, y, z+dist))
|
1635
1635
|
|
1636
1636
|
baseWire = Wire.ByVertices(baseV)
|
1637
1637
|
topWire = Wire.ByVertices(topV)
|
@@ -1642,9 +1642,9 @@ class Cell(Topology):
|
|
1642
1642
|
theta = 0
|
1643
1643
|
else:
|
1644
1644
|
theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
|
1645
|
-
pipe = Topology.Rotate(pipe, sv, 0, 1, 0, theta)
|
1646
|
-
pipe = Topology.Rotate(pipe, sv, 0, 0, 1, phi)
|
1647
|
-
zzz = Vertex.ByCoordinates(0,0,0)
|
1645
|
+
pipe = Topology.Rotate(pipe, origin=sv, axis=[0, 1, 0], angle=theta)
|
1646
|
+
pipe = Topology.Rotate(pipe, origin=sv, axis=[0, 0, 1], angle=phi)
|
1647
|
+
zzz = Vertex.ByCoordinates(0, 0, 0)
|
1648
1648
|
if endcapA:
|
1649
1649
|
origin = edge.StartVertex()
|
1650
1650
|
x1 = origin.X()
|
@@ -1663,8 +1663,8 @@ class Cell(Topology):
|
|
1663
1663
|
else:
|
1664
1664
|
theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
|
1665
1665
|
endcapA = Topology.Copy(endcapA)
|
1666
|
-
endcapA = Topology.Rotate(endcapA, zzz, 0, 1, 0, theta)
|
1667
|
-
endcapA = Topology.Rotate(endcapA, zzz, 0, 0, 1, phi
|
1666
|
+
endcapA = Topology.Rotate(endcapA, origin=zzz, axis=[0, 1, 0], angle=theta)
|
1667
|
+
endcapA = Topology.Rotate(endcapA, origin=zzz, axis=[0, 0, 1], angle=phi+180)
|
1668
1668
|
endcapA = Topology.Translate(endcapA, origin.X(), origin.Y(), origin.Z())
|
1669
1669
|
if endcapB:
|
1670
1670
|
origin = edge.EndVertex()
|
@@ -1684,14 +1684,14 @@ class Cell(Topology):
|
|
1684
1684
|
else:
|
1685
1685
|
theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
|
1686
1686
|
endcapB = Topology.Copy(endcapB)
|
1687
|
-
endcapB = Topology.Rotate(endcapB, zzz, 0, 1, 0, theta)
|
1688
|
-
endcapB = Topology.Rotate(endcapB, zzz, 0, 0, 1, phi
|
1687
|
+
endcapB = Topology.Rotate(endcapB, origin=zzz, axis=[0, 1, 0], angle=theta)
|
1688
|
+
endcapB = Topology.Rotate(endcapB, origin=zzz, axis=[0, 0, 1], angle=phi+180)
|
1689
1689
|
endcapB = Topology.Translate(endcapB, origin.X(), origin.Y(), origin.Z())
|
1690
1690
|
return {'pipe': pipe, 'endcapA': endcapA, 'endcapB': endcapB}
|
1691
1691
|
|
1692
1692
|
@staticmethod
|
1693
1693
|
def Prism(origin: topologic.Vertex = None, width: float = 1, length: float = 1, height: float = 1, uSides: int = 1, vSides: int = 1, wSides: int = 1,
|
1694
|
-
direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
1694
|
+
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
1695
1695
|
"""
|
1696
1696
|
Description
|
1697
1697
|
----------
|
@@ -1700,7 +1700,7 @@ class Cell(Topology):
|
|
1700
1700
|
Parameters
|
1701
1701
|
----------
|
1702
1702
|
origin : topologic.Vertex , optional
|
1703
|
-
The origin location of the prism. The default is None which results in the prism being placed at (0,0,0).
|
1703
|
+
The origin location of the prism. The default is None which results in the prism being placed at (0, 0, 0).
|
1704
1704
|
width : float , optional
|
1705
1705
|
The width of the prism. The default is 1.
|
1706
1706
|
length : float , optional
|
@@ -1714,7 +1714,7 @@ class Cell(Topology):
|
|
1714
1714
|
wSides : int , optional
|
1715
1715
|
The number of sides along the height. The default is 1.
|
1716
1716
|
direction : list , optional
|
1717
|
-
The vector representing the up direction of the prism. The default is [0,0,1].
|
1717
|
+
The vector representing the up direction of the prism. The default is [0, 0, 1].
|
1718
1718
|
placement : str , optional
|
1719
1719
|
The description of the placement of the origin of the prism. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
1720
1720
|
tolerance : float , optional
|
@@ -1752,7 +1752,7 @@ class Cell(Topology):
|
|
1752
1752
|
from topologicpy.Topology import Topology
|
1753
1753
|
|
1754
1754
|
if not origin:
|
1755
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1755
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1756
1756
|
if not isinstance(origin, topologic.Vertex):
|
1757
1757
|
print("Cell.Prism - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
1758
1758
|
return None
|
@@ -1776,7 +1776,7 @@ class Cell(Topology):
|
|
1776
1776
|
|
1777
1777
|
if uSides > 1 or vSides > 1 or wSides > 1:
|
1778
1778
|
prism = sliceCell(prism, width, length, height, uSides, vSides, wSides)
|
1779
|
-
prism = Topology.Orient(prism, origin=origin, dirA=[0,0,1], dirB=direction, tolerance=tolerance)
|
1779
|
+
prism = Topology.Orient(prism, origin=origin, dirA=[0, 0, 1], dirB=direction, tolerance=tolerance)
|
1780
1780
|
return prism
|
1781
1781
|
|
1782
1782
|
@staticmethod
|
@@ -1811,7 +1811,7 @@ class Cell(Topology):
|
|
1811
1811
|
return Cell.ByFaces(clean_faces, tolerance=tolerance)
|
1812
1812
|
|
1813
1813
|
@staticmethod
|
1814
|
-
def Roof(face,
|
1814
|
+
def Roof(face, angle: float = 45, epsilon: float = 0.01 , tolerance: float = 0.001):
|
1815
1815
|
"""
|
1816
1816
|
Creates a hipped roof through a straight skeleton. This method is contributed by 高熙鹏 xipeng gao <gaoxipeng1998@gmail.com>
|
1817
1817
|
This algorithm depends on the polyskel code which is included in the library. Polyskel code is found at: https://github.com/Botffy/polyskel
|
@@ -1820,7 +1820,7 @@ class Cell(Topology):
|
|
1820
1820
|
----------
|
1821
1821
|
face : topologic.Face
|
1822
1822
|
The input face.
|
1823
|
-
|
1823
|
+
angle : float , optioal
|
1824
1824
|
The desired angle in degrees of the roof. The default is 45.
|
1825
1825
|
epsilon : float , optional
|
1826
1826
|
The desired epsilon (another form of tolerance for distance from plane). The default is 0.01. (This is set to a larger number as it was found to work better)
|
@@ -1837,7 +1837,7 @@ class Cell(Topology):
|
|
1837
1837
|
from topologicpy.Cell import Cell
|
1838
1838
|
from topologicpy.Topology import Topology
|
1839
1839
|
|
1840
|
-
shell = Shell.Roof(face=face,
|
1840
|
+
shell = Shell.Roof(face=face, angle=angle, epsilon=epsilon, tolerance=tolerance)
|
1841
1841
|
faces = Topology.Faces(shell) + [face]
|
1842
1842
|
cell = Cell.ByFaces(faces, tolerance=tolerance)
|
1843
1843
|
if not cell:
|
@@ -1930,7 +1930,7 @@ class Cell(Topology):
|
|
1930
1930
|
return shells
|
1931
1931
|
|
1932
1932
|
@staticmethod
|
1933
|
-
def Sphere(origin: topologic.Vertex = None, radius: float = 0.5, uSides: int = 16, vSides: int = 8, direction: list = [0,0,1],
|
1933
|
+
def Sphere(origin: topologic.Vertex = None, radius: float = 0.5, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1],
|
1934
1934
|
placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
1935
1935
|
"""
|
1936
1936
|
Creates a sphere.
|
@@ -1938,7 +1938,7 @@ class Cell(Topology):
|
|
1938
1938
|
Parameters
|
1939
1939
|
----------
|
1940
1940
|
origin : topologic.Vertex , optional
|
1941
|
-
The origin location of the sphere. The default is None which results in the sphere being placed at (0,0,0).
|
1941
|
+
The origin location of the sphere. The default is None which results in the sphere being placed at (0, 0, 0).
|
1942
1942
|
radius : float , optional
|
1943
1943
|
The radius of the sphere. The default is 0.5.
|
1944
1944
|
uSides : int , optional
|
@@ -1946,7 +1946,7 @@ class Cell(Topology):
|
|
1946
1946
|
vSides : int , optional
|
1947
1947
|
The number of sides along the latitude of the sphere. The default is 8.
|
1948
1948
|
direction : list , optional
|
1949
|
-
The vector representing the up direction of the sphere. The default is [0,0,1].
|
1949
|
+
The vector representing the up direction of the sphere. The default is [0, 0, 1].
|
1950
1950
|
placement : str , optional
|
1951
1951
|
The description of the placement of the origin of the sphere. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
1952
1952
|
tolerance : float , optional
|
@@ -1963,13 +1963,13 @@ class Cell(Topology):
|
|
1963
1963
|
from topologicpy.Topology import Topology
|
1964
1964
|
|
1965
1965
|
if not origin:
|
1966
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1966
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1967
1967
|
if not isinstance(origin, topologic.Vertex):
|
1968
1968
|
print("Cell.Sphere - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
1969
1969
|
return None
|
1970
1970
|
c = Wire.Circle(origin=Vertex.Origin(), radius=radius, sides=vSides, fromAngle=-90, toAngle=90, close=False, direction=[0, 0, 1], placement="center")
|
1971
|
-
c = Topology.Rotate(c, origin=Vertex.Origin(),
|
1972
|
-
sphere = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0,0,1],
|
1971
|
+
c = Topology.Rotate(c, origin=Vertex.Origin(), axis=[1, 0, 0], angle=90)
|
1972
|
+
sphere = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0, 0, 1], angle=360, sides=uSides, tolerance=tolerance)
|
1973
1973
|
if sphere.Type() == topologic.CellComplex.Type():
|
1974
1974
|
sphere = sphere.ExternalBoundary()
|
1975
1975
|
if sphere.Type() == topologic.Shell.Type():
|
@@ -1978,7 +1978,7 @@ class Cell(Topology):
|
|
1978
1978
|
sphere = Topology.Translate(sphere, 0, 0, radius)
|
1979
1979
|
elif placement.lower() == "lowerleft":
|
1980
1980
|
sphere = Topology.Translate(sphere, radius, radius, radius)
|
1981
|
-
sphere = Topology.Orient(sphere, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction)
|
1981
|
+
sphere = Topology.Orient(sphere, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction)
|
1982
1982
|
sphere = Topology.Place(sphere, originA=Vertex.Origin(), originB=origin)
|
1983
1983
|
return sphere
|
1984
1984
|
|
@@ -2004,7 +2004,7 @@ class Cell(Topology):
|
|
2004
2004
|
|
2005
2005
|
@staticmethod
|
2006
2006
|
def Tetrahedron(origin: topologic.Vertex = None, radius: float = 0.5,
|
2007
|
-
direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
2007
|
+
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
|
2008
2008
|
"""
|
2009
2009
|
Description
|
2010
2010
|
----------
|
@@ -2013,11 +2013,11 @@ class Cell(Topology):
|
|
2013
2013
|
Parameters
|
2014
2014
|
----------
|
2015
2015
|
origin : topologic.Vertex , optional
|
2016
|
-
The origin location of the tetrahedron. The default is None which results in the tetrahedron being placed at (0,0,0).
|
2016
|
+
The origin location of the tetrahedron. The default is None which results in the tetrahedron being placed at (0, 0, 0).
|
2017
2017
|
radius : float , optional
|
2018
2018
|
The radius of the tetrahedron's circumscribed sphere. The default is 0.5.
|
2019
2019
|
direction : list , optional
|
2020
|
-
The vector representing the up direction of the tetrahedron. The default is [0,0,1].
|
2020
|
+
The vector representing the up direction of the tetrahedron. The default is [0, 0, 1].
|
2021
2021
|
placement : str , optional
|
2022
2022
|
The description of the placement of the origin of the tetrahedron. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
2023
2023
|
tolerance : float , optional
|
@@ -2037,7 +2037,7 @@ class Cell(Topology):
|
|
2037
2037
|
import math
|
2038
2038
|
|
2039
2039
|
if not origin:
|
2040
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
2040
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
2041
2041
|
if not isinstance(origin, topologic.Vertex):
|
2042
2042
|
print("Cell.Tetrahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
2043
2043
|
return None
|
@@ -2045,12 +2045,12 @@ class Cell(Topology):
|
|
2045
2045
|
vb1 = Vertex.ByCoordinates(math.sqrt(8/9), 0, -1/3)
|
2046
2046
|
vb2 = Vertex.ByCoordinates(-math.sqrt(2/9), math.sqrt(2/3), -1/3)
|
2047
2047
|
vb3 = Vertex.ByCoordinates(-math.sqrt(2/9), -math.sqrt(2/3), -1/3)
|
2048
|
-
vb4 = Vertex.ByCoordinates(0,0,1)
|
2049
|
-
f1 = Face.ByVertices([vb1,vb2,vb3])
|
2050
|
-
f2 = Face.ByVertices([vb4,vb1,vb2])
|
2051
|
-
f3 = Face.ByVertices([vb4,vb2,vb3])
|
2052
|
-
f4 = Face.ByVertices([vb4,vb3,vb1])
|
2053
|
-
tetrahedron = Cell.ByFaces([f1,f2,f3,f4])
|
2048
|
+
vb4 = Vertex.ByCoordinates(0, 0, 1)
|
2049
|
+
f1 = Face.ByVertices([vb1, vb2, vb3])
|
2050
|
+
f2 = Face.ByVertices([vb4, vb1, vb2])
|
2051
|
+
f3 = Face.ByVertices([vb4, vb2, vb3])
|
2052
|
+
f4 = Face.ByVertices([vb4, vb3, vb1])
|
2053
|
+
tetrahedron = Cell.ByFaces([f1, f2, f3, f4])
|
2054
2054
|
tetrahedron = Topology.Scale(tetrahedron, origin=Vertex.Origin(), x=0.5, y=0.5, z=0.5)
|
2055
2055
|
tetrahedron = Topology.Scale(tetrahedron, origin=Vertex.Origin(), x=radius/0.5, y=radius/0.5, z=radius/0.5)
|
2056
2056
|
|
@@ -2059,18 +2059,18 @@ class Cell(Topology):
|
|
2059
2059
|
elif placement.lower() == "bottom":
|
2060
2060
|
tetrahedron = Topology.Translate(tetrahedron, 0, 0, radius)
|
2061
2061
|
tetrahedron = Topology.Place(tetrahedron, originA=Vertex.Origin(), originB=origin)
|
2062
|
-
tetrahedron = Topology.Orient(tetrahedron, origin=origin, dirA=[0,0,1], dirB=direction, tolerance=tolerance)
|
2062
|
+
tetrahedron = Topology.Orient(tetrahedron, origin=origin, dirA=[0, 0, 1], dirB=direction, tolerance=tolerance)
|
2063
2063
|
return tetrahedron
|
2064
2064
|
|
2065
2065
|
@staticmethod
|
2066
|
-
def Torus(origin: topologic.Vertex = None, majorRadius: float = 0.5, minorRadius: float = 0.125, uSides: int = 16, vSides: int = 8, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
2066
|
+
def Torus(origin: topologic.Vertex = None, majorRadius: float = 0.5, minorRadius: float = 0.125, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
|
2067
2067
|
"""
|
2068
2068
|
Creates a torus.
|
2069
2069
|
|
2070
2070
|
Parameters
|
2071
2071
|
----------
|
2072
2072
|
origin : topologic.Vertex , optional
|
2073
|
-
The origin location of the torus. The default is None which results in the torus being placed at (0,0,0).
|
2073
|
+
The origin location of the torus. The default is None which results in the torus being placed at (0, 0, 0).
|
2074
2074
|
majorRadius : float , optional
|
2075
2075
|
The major radius of the torus. The default is 0.5.
|
2076
2076
|
minorRadius : float , optional
|
@@ -2080,7 +2080,7 @@ class Cell(Topology):
|
|
2080
2080
|
vSides : int , optional
|
2081
2081
|
The number of sides along the latitude of the torus. The default is 8.
|
2082
2082
|
direction : list , optional
|
2083
|
-
The vector representing the up direction of the torus. The default is [0,0,1].
|
2083
|
+
The vector representing the up direction of the torus. The default is [0, 0, 1].
|
2084
2084
|
placement : str , optional
|
2085
2085
|
The description of the placement of the origin of the torus. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
|
2086
2086
|
tolerance : float , optional
|
@@ -2097,13 +2097,13 @@ class Cell(Topology):
|
|
2097
2097
|
from topologicpy.Topology import Topology
|
2098
2098
|
|
2099
2099
|
if not origin:
|
2100
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
2100
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
2101
2101
|
if not isinstance(origin, topologic.Vertex):
|
2102
2102
|
print("Cell.Torus - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
2103
2103
|
return None
|
2104
2104
|
c = Wire.Circle(origin=Vertex.Origin(), radius=minorRadius, sides=vSides, fromAngle=0, toAngle=360, close=False, direction=[0, 1, 0], placement="center")
|
2105
2105
|
c = Topology.Translate(c, abs(majorRadius-minorRadius), 0, 0)
|
2106
|
-
torus = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0,0,1],
|
2106
|
+
torus = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0, 0, 1], angle=360, sides=uSides, tolerance=tolerance)
|
2107
2107
|
if torus.Type() == topologic.Shell.Type():
|
2108
2108
|
torus = topologic.Cell.ByShell(torus)
|
2109
2109
|
if placement.lower() == "bottom":
|
@@ -2111,7 +2111,7 @@ class Cell(Topology):
|
|
2111
2111
|
elif placement.lower() == "lowerleft":
|
2112
2112
|
torus = Topology.Translate(torus, majorRadius, majorRadius, minorRadius)
|
2113
2113
|
|
2114
|
-
torus = Topology.Orient(torus, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction)
|
2114
|
+
torus = Topology.Orient(torus, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction)
|
2115
2115
|
torus = Topology.Place(torus, originA=Vertex.Origin(), originB=origin)
|
2116
2116
|
return torus
|
2117
2117
|
|