topologicpy 0.8.31__py3-none-any.whl → 0.8.35__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 +1098 -10
- topologicpy/CellComplex.py +28 -1
- topologicpy/Dictionary.py +119 -0
- topologicpy/Edge.py +16 -0
- topologicpy/Face.py +319 -54
- topologicpy/Graph.py +2 -7
- topologicpy/Helper.py +52 -0
- topologicpy/Shell.py +119 -92
- topologicpy/Topology.py +189 -11
- topologicpy/Vertex.py +1 -1
- topologicpy/Wire.py +66 -31
- topologicpy/version.py +1 -1
- {topologicpy-0.8.31.dist-info → topologicpy-0.8.35.dist-info}/METADATA +1 -1
- {topologicpy-0.8.31.dist-info → topologicpy-0.8.35.dist-info}/RECORD +17 -17
- {topologicpy-0.8.31.dist-info → topologicpy-0.8.35.dist-info}/WHEEL +0 -0
- {topologicpy-0.8.31.dist-info → topologicpy-0.8.35.dist-info}/licenses/LICENSE +0 -0
- {topologicpy-0.8.31.dist-info → topologicpy-0.8.35.dist-info}/top_level.txt +0 -0
topologicpy/Cell.py
CHANGED
@@ -648,6 +648,80 @@ class Cell():
|
|
648
648
|
capsule = Topology.Place(capsule, originA=Vertex.Origin(), originB=origin)
|
649
649
|
return capsule
|
650
650
|
|
651
|
+
@staticmethod
|
652
|
+
def CHS(origin= None, radius: float = 1.0, height: float = 1.0, thickness: float = 0.25, sides: int = 16, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001, silent: bool = False):
|
653
|
+
"""
|
654
|
+
Creates a circular hollow section (CHS).
|
655
|
+
|
656
|
+
Parameters
|
657
|
+
----------
|
658
|
+
origin : topologic_core.Vertex, optional
|
659
|
+
The location of the origin of the CHS. The default is None which results in the CHS being placed at (0, 0, 0).
|
660
|
+
radius : float , optional
|
661
|
+
The outer radius of the CHS. The default is 1.0.
|
662
|
+
thickness : float , optional
|
663
|
+
The thickness of the CHS. The default is 0.25.
|
664
|
+
height : float , optional
|
665
|
+
The height of the CHS. The default is 1.0.
|
666
|
+
sides : int , optional
|
667
|
+
The desired number of sides of the CSH. The default is 16.
|
668
|
+
direction : list , optional
|
669
|
+
The vector representing the up direction of the RHS. The default is [0, 0, 1].
|
670
|
+
placement : str , optional
|
671
|
+
The description of the placement of the origin of the RHS. This can be "center", "bottom", "top", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
672
|
+
tolerance : float , optional
|
673
|
+
The desired tolerance. The default is 0.0001.
|
674
|
+
silent : bool , optional
|
675
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
676
|
+
|
677
|
+
Returns
|
678
|
+
-------
|
679
|
+
topologic_core.Cell
|
680
|
+
The created cell.
|
681
|
+
|
682
|
+
"""
|
683
|
+
from topologicpy.Vertex import Vertex
|
684
|
+
from topologicpy.Face import Face
|
685
|
+
from topologicpy.Topology import Topology
|
686
|
+
|
687
|
+
if 2*thickness >= radius:
|
688
|
+
if not silent:
|
689
|
+
print("Cell.CHS - Error: Twice the thickness value is larger than or equal to the width value. Returning None.")
|
690
|
+
return None
|
691
|
+
if origin == None:
|
692
|
+
origin = Vertex.Origin()
|
693
|
+
bottom_face = Face.CHS(origin = Vertex.Origin(),radius=radius, thickness=thickness, sides=sides, direction=[0,0,1], placement="center", tolerance=tolerance, silent=silent)
|
694
|
+
return_cell = Cell.ByThickenedFace(bottom_face, thickness=height, bothSides=True, reverse=False,
|
695
|
+
planarize = False, tolerance=tolerance, silent=silent)
|
696
|
+
xOffset = 0
|
697
|
+
yOffset = 0
|
698
|
+
zOffset = 0
|
699
|
+
if placement.lower() == "bottom":
|
700
|
+
zOffset = height*0.5
|
701
|
+
elif placement.lower() == "top":
|
702
|
+
zOffset = -height*0.5
|
703
|
+
elif placement.lower() == "lowerleft":
|
704
|
+
xOffset = radius
|
705
|
+
yOffset = radius
|
706
|
+
zOffset = height*0.5
|
707
|
+
elif placement.lower() == "upperleft":
|
708
|
+
xOffset = radius
|
709
|
+
yOffset = -radius
|
710
|
+
zOffset = -height*0.5
|
711
|
+
elif placement.lower() == "lowerright":
|
712
|
+
xOffset = -radius
|
713
|
+
yOffset = radius
|
714
|
+
zOffset = height*0.5
|
715
|
+
elif placement.lower() == "upperright":
|
716
|
+
xOffset = -radius
|
717
|
+
yOffset = -radius
|
718
|
+
zOffset = -height*0.5
|
719
|
+
return_cell = Topology.Translate(return_cell, x=xOffset, y=yOffset, z=zOffset)
|
720
|
+
return_cell = Topology.Place(return_cell, originA=Vertex.Origin(), originB=origin)
|
721
|
+
if direction != [0, 0, 1]:
|
722
|
+
return_cell = Topology.Orient(return_cell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
723
|
+
return return_cell
|
724
|
+
|
651
725
|
@staticmethod
|
652
726
|
def Compactness(cell, reference = "sphere", mantissa: int = 6) -> float:
|
653
727
|
"""
|
@@ -854,7 +928,357 @@ class Cell():
|
|
854
928
|
except:
|
855
929
|
print("Cell.ContainmentStatus - Error: Could not determine containment status. Returning None.")
|
856
930
|
return None
|
857
|
-
|
931
|
+
|
932
|
+
@staticmethod
|
933
|
+
def CrossShape(origin=None,
|
934
|
+
width=1,
|
935
|
+
length=1,
|
936
|
+
height=1,
|
937
|
+
a=0.25,
|
938
|
+
b=0.25,
|
939
|
+
c=None,
|
940
|
+
d=None,
|
941
|
+
flipHorizontal = False,
|
942
|
+
flipVertical = False,
|
943
|
+
direction=[0,0,1],
|
944
|
+
placement="center",
|
945
|
+
tolerance=0.0001,
|
946
|
+
silent=False):
|
947
|
+
"""
|
948
|
+
Creates a Cross-shape.
|
949
|
+
|
950
|
+
Parameters
|
951
|
+
----------
|
952
|
+
origin : topologic_core.Vertex , optional
|
953
|
+
The location of the origin of the T-shape. The default is None which results in the Cross-shape being placed at (0, 0, 0).
|
954
|
+
width : float , optional
|
955
|
+
The overall width of the Cross-shape. The default is 1.0.
|
956
|
+
length : float , optional
|
957
|
+
The overall length of the Cross-shape. The default is 1.0.
|
958
|
+
height : float , optional
|
959
|
+
The overall height of the C-shape. The default is 1.0.
|
960
|
+
a : float , optional
|
961
|
+
The hortizontal thickness of the vertical arm of the Cross-shape. The default is 0.25.
|
962
|
+
b : float , optional
|
963
|
+
The vertical thickness of the horizontal arm of the Cross-shape. The default is 0.25.
|
964
|
+
c : float , optional
|
965
|
+
The distance of the vertical symmetry axis measured from the left side of the Cross-shape. The default is None which results in the Cross-shape being symmetrical on the Y-axis.
|
966
|
+
d : float , optional
|
967
|
+
The distance of the horizontal symmetry axis measured from the bottom side of the Cross-shape. The default is None which results in the Cross-shape being symmetrical on the X-axis.
|
968
|
+
direction : list , optional
|
969
|
+
The vector representing the up direction of the Cross-shape. The default is [0, 0, 1].
|
970
|
+
placement : str , optional
|
971
|
+
The description of the placement of the origin of the Cross-shape. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
972
|
+
tolerance : float , optional
|
973
|
+
The desired tolerance. The default is 0.0001.
|
974
|
+
silent : bool , optional
|
975
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
976
|
+
|
977
|
+
Returns
|
978
|
+
-------
|
979
|
+
topologic_core.Cell
|
980
|
+
The created Cross-shape cell.
|
981
|
+
|
982
|
+
"""
|
983
|
+
from topologicpy.Vertex import Vertex
|
984
|
+
from topologicpy.Face import Face
|
985
|
+
from topologicpy.Topology import Topology
|
986
|
+
|
987
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
988
|
+
if not silent:
|
989
|
+
print("Cell.CrossShape - Error: The width input parameter is not a valid number. Returning None.")
|
990
|
+
return None
|
991
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
992
|
+
if not silent:
|
993
|
+
print("Cell.CrossShape - Error: The length input parameter is not a valid number. Returning None.")
|
994
|
+
return None
|
995
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
996
|
+
if not silent:
|
997
|
+
print("Cell.CrossShape - Error: The a input parameter is not a valid number. Returning None.")
|
998
|
+
return None
|
999
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
1000
|
+
if not silent:
|
1001
|
+
print("Cell.CrossShape - Error: The b input parameter is not a valid number. Returning None.")
|
1002
|
+
return None
|
1003
|
+
if c == None:
|
1004
|
+
c = width/2
|
1005
|
+
if d == None:
|
1006
|
+
d = length/2
|
1007
|
+
if not isinstance(c, int) and not isinstance(c, float):
|
1008
|
+
if not silent:
|
1009
|
+
print("Cell.CrossShape - Error: The c input parameter is not a valid number. Returning None.")
|
1010
|
+
return None
|
1011
|
+
if not isinstance(d, int) and not isinstance(d, float):
|
1012
|
+
if not silent:
|
1013
|
+
print("Cell.CrossShape - Error: The d input parameter is not a valid number. Returning None.")
|
1014
|
+
if width <= tolerance:
|
1015
|
+
if not silent:
|
1016
|
+
print("Cell.CrossShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1017
|
+
return None
|
1018
|
+
if length <= tolerance:
|
1019
|
+
if not silent:
|
1020
|
+
print("Cell.CrossShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1021
|
+
return None
|
1022
|
+
if a <= tolerance:
|
1023
|
+
if not silent:
|
1024
|
+
print("Cell.CrossShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1025
|
+
return None
|
1026
|
+
if b <= tolerance:
|
1027
|
+
if not silent:
|
1028
|
+
print("Cell.CrossShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1029
|
+
return None
|
1030
|
+
if c <= tolerance:
|
1031
|
+
if not silent:
|
1032
|
+
print("Cell.CrossShape - Error: The c input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1033
|
+
return None
|
1034
|
+
if d <= tolerance:
|
1035
|
+
if not silent:
|
1036
|
+
print("Cell.CrossShape - Error: The d input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1037
|
+
return None
|
1038
|
+
if a >= (width - tolerance*2):
|
1039
|
+
if not silent:
|
1040
|
+
print("Cell.CrossShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
1041
|
+
return None
|
1042
|
+
if b >= (length - tolerance*2):
|
1043
|
+
if not silent:
|
1044
|
+
print("Cell.CrossShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
|
1045
|
+
return None
|
1046
|
+
if c <= (tolerance + a/2):
|
1047
|
+
if not silent:
|
1048
|
+
print("Cell.CrossShape - Error: The c input parameter must be more than half the a input parameter. Returning None.")
|
1049
|
+
return None
|
1050
|
+
if d <= (tolerance + b/2):
|
1051
|
+
if not silent:
|
1052
|
+
print("Cell.CrossShape - Error: The c input parameter must be more than half the b input parameter. Returning None.")
|
1053
|
+
return None
|
1054
|
+
if c >= (width - tolerance - a/2):
|
1055
|
+
if not silent:
|
1056
|
+
print("Cell.CrossShape - Error: The c input parameter must be less than the width minus half the a input parameter. Returning None.")
|
1057
|
+
return None
|
1058
|
+
if d >= (length - tolerance - b/2):
|
1059
|
+
if not silent:
|
1060
|
+
print("Cell.CrossShape - Error: The c input parameter must be less than the width minus half the b input parameter. Returning None.")
|
1061
|
+
return None
|
1062
|
+
if origin == None:
|
1063
|
+
origin = Vertex.Origin()
|
1064
|
+
if not Topology.IsInstance(origin, "vertex"):
|
1065
|
+
if not silent:
|
1066
|
+
print("Cell.CrossShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
1067
|
+
return None
|
1068
|
+
if not isinstance(direction, list):
|
1069
|
+
if not silent:
|
1070
|
+
print("Cell.CrossShape - Error: The direction input parameter is not a valid list. Returning None.")
|
1071
|
+
return None
|
1072
|
+
if not len(direction) == 3:
|
1073
|
+
if not silent:
|
1074
|
+
print("Cell.CrossShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
1075
|
+
return None
|
1076
|
+
cross_shape_face = Face.CrossShape(origin=origin,
|
1077
|
+
width=width,
|
1078
|
+
length=length,
|
1079
|
+
a=a,
|
1080
|
+
b=b,
|
1081
|
+
c=c,
|
1082
|
+
d=d,
|
1083
|
+
flipHorizontal=flipHorizontal,
|
1084
|
+
flipVertical=flipVertical,
|
1085
|
+
direction=direction,
|
1086
|
+
placement=placement,
|
1087
|
+
tolerance=tolerance,
|
1088
|
+
silent=silent)
|
1089
|
+
return_cell = Cell.ByThickenedFace(cross_shape_face, thickness=height, bothSides=True, reverse=False,
|
1090
|
+
planarize = False, tolerance=tolerance, silent=silent)
|
1091
|
+
xOffset = 0
|
1092
|
+
yOffset = 0
|
1093
|
+
zOffset = 0
|
1094
|
+
if placement.lower() == "bottom":
|
1095
|
+
zOffset = height*0.5
|
1096
|
+
elif placement.lower() == "top":
|
1097
|
+
zOffset = -height*0.5
|
1098
|
+
elif placement.lower() == "lowerleft":
|
1099
|
+
xOffset = width*0.5
|
1100
|
+
yOffset = length*0.5
|
1101
|
+
zOffset = height*0.5
|
1102
|
+
elif placement.lower() == "upperleft":
|
1103
|
+
xOffset = width*0.5
|
1104
|
+
yOffset = -length*0.5
|
1105
|
+
zOffset = -height*0.5
|
1106
|
+
elif placement.lower() == "lowerright":
|
1107
|
+
xOffset = -width*0.5
|
1108
|
+
yOffset = length*0.5
|
1109
|
+
zOffset = height*0.5
|
1110
|
+
elif placement.lower() == "upperright":
|
1111
|
+
xOffset = -width*0.5
|
1112
|
+
yOffset = -length*0.5
|
1113
|
+
zOffset = -height*0.5
|
1114
|
+
return_cell = Topology.Translate(return_cell, x=xOffset, y=yOffset, z=zOffset)
|
1115
|
+
return_cell = Topology.Place(return_cell, originA=Vertex.Origin(), originB=origin)
|
1116
|
+
if direction != [0, 0, 1]:
|
1117
|
+
return_cell = Topology.Orient(return_cell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
1118
|
+
return return_cell
|
1119
|
+
|
1120
|
+
@staticmethod
|
1121
|
+
def CShape(origin=None,
|
1122
|
+
width=1,
|
1123
|
+
length=1,
|
1124
|
+
height=1,
|
1125
|
+
a=0.25,
|
1126
|
+
b=0.25,
|
1127
|
+
c=0.25,
|
1128
|
+
flipHorizontal = False,
|
1129
|
+
flipVertical = False,
|
1130
|
+
direction=[0,0,1],
|
1131
|
+
placement="center",
|
1132
|
+
tolerance=0.0001,
|
1133
|
+
silent=False):
|
1134
|
+
"""
|
1135
|
+
Creates a C-shape.
|
1136
|
+
|
1137
|
+
Parameters
|
1138
|
+
----------
|
1139
|
+
origin : topologic_core.Vertex , optional
|
1140
|
+
The location of the origin of the C-shape. The default is None which results in the C-shape being placed at (0, 0, 0).
|
1141
|
+
width : float , optional
|
1142
|
+
The overall width of the C-shape. The default is 1.0.
|
1143
|
+
length : float , optional
|
1144
|
+
The overall length of the C-shape. The default is 1.0.
|
1145
|
+
height : float , optional
|
1146
|
+
The overall height of the C-shape. The default is 1.0.
|
1147
|
+
a : float , optional
|
1148
|
+
The hortizontal thickness of the vertical arm of the C-shape. The default is 0.25.
|
1149
|
+
b : float , optional
|
1150
|
+
The vertical thickness of the bottom horizontal arm of the C-shape. The default is 0.25.
|
1151
|
+
c : float , optional
|
1152
|
+
The vertical thickness of the top horizontal arm of the C-shape. The default is 0.25.
|
1153
|
+
direction : list , optional
|
1154
|
+
The vector representing the up direction of the C-shape. The default is [0, 0, 1].
|
1155
|
+
placement : str , optional
|
1156
|
+
The description of the placement of the origin of the C-shape. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
1157
|
+
tolerance : float , optional
|
1158
|
+
The desired tolerance. The default is 0.0001.
|
1159
|
+
silent : bool , optional
|
1160
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1161
|
+
|
1162
|
+
Returns
|
1163
|
+
-------
|
1164
|
+
topologic_core.Cell
|
1165
|
+
The created C-shape cell.
|
1166
|
+
|
1167
|
+
"""
|
1168
|
+
from topologicpy.Vertex import Vertex
|
1169
|
+
from topologicpy.Face import Face
|
1170
|
+
from topologicpy.Topology import Topology
|
1171
|
+
|
1172
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
1173
|
+
if not silent:
|
1174
|
+
print("Cell.CShape - Error: The width input parameter is not a valid number. Returning None.")
|
1175
|
+
return None
|
1176
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
1177
|
+
if not silent:
|
1178
|
+
print("Cell.CShape - Error: The length input parameter is not a valid number. Returning None.")
|
1179
|
+
return None
|
1180
|
+
if not isinstance(height, int) and not isinstance(height, float):
|
1181
|
+
if not silent:
|
1182
|
+
print("Cell.CShape - Error: The height input parameter is not a valid number. Returning None.")
|
1183
|
+
return None
|
1184
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
1185
|
+
if not silent:
|
1186
|
+
print("Cell.CShape - Error: The a input parameter is not a valid number. Returning None.")
|
1187
|
+
return None
|
1188
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
1189
|
+
if not silent:
|
1190
|
+
print("Cell.CShape - Error: The b input parameter is not a valid number. Returning None.")
|
1191
|
+
return None
|
1192
|
+
if width <= tolerance:
|
1193
|
+
if not silent:
|
1194
|
+
print("Cell.CShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1195
|
+
return None
|
1196
|
+
if length <= tolerance:
|
1197
|
+
if not silent:
|
1198
|
+
print("Cell.CShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1199
|
+
return None
|
1200
|
+
if height <= tolerance:
|
1201
|
+
if not silent:
|
1202
|
+
print("Cell.CShape - Error: The height input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1203
|
+
return None
|
1204
|
+
if a <= tolerance:
|
1205
|
+
if not silent:
|
1206
|
+
print("Cell.CShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1207
|
+
return None
|
1208
|
+
if b <= tolerance:
|
1209
|
+
if not silent:
|
1210
|
+
print("Cell.CShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1211
|
+
return None
|
1212
|
+
if c <= tolerance:
|
1213
|
+
if not silent:
|
1214
|
+
print("Cell.CShape - Error: The c input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1215
|
+
return None
|
1216
|
+
if a >= (width - tolerance):
|
1217
|
+
if not silent:
|
1218
|
+
print("Cell.CShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
1219
|
+
return None
|
1220
|
+
if b+c >= (length - tolerance):
|
1221
|
+
if not silent:
|
1222
|
+
print("Cell.CShape - Error: The b and c input parameters must add to less than the length input parameter. Returning None.")
|
1223
|
+
return None
|
1224
|
+
if origin == None:
|
1225
|
+
origin = Vertex.Origin()
|
1226
|
+
if not Topology.IsInstance(origin, "vertex"):
|
1227
|
+
if not silent:
|
1228
|
+
print("Cell.CShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
1229
|
+
return None
|
1230
|
+
if not isinstance(direction, list):
|
1231
|
+
if not silent:
|
1232
|
+
print("Cell.CShape - Error: The direction input parameter is not a valid list. Returning None.")
|
1233
|
+
return None
|
1234
|
+
if not len(direction) == 3:
|
1235
|
+
if not silent:
|
1236
|
+
print("Cell.CShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
1237
|
+
return None
|
1238
|
+
c_shape_face = Face.CShape(origin=origin,
|
1239
|
+
width=width,
|
1240
|
+
length=length,
|
1241
|
+
a=a,
|
1242
|
+
b=b,
|
1243
|
+
c=c,
|
1244
|
+
flipHorizontal=flipHorizontal,
|
1245
|
+
flipVertical=flipVertical,
|
1246
|
+
direction=[0,0,1],
|
1247
|
+
placement="center",
|
1248
|
+
tolerance=tolerance,
|
1249
|
+
silent=silent)
|
1250
|
+
|
1251
|
+
return_cell = Cell.ByThickenedFace(c_shape_face, thickness=height, bothSides=True, reverse=False,
|
1252
|
+
planarize = False, tolerance=tolerance, silent=silent)
|
1253
|
+
xOffset = 0
|
1254
|
+
yOffset = 0
|
1255
|
+
zOffset = 0
|
1256
|
+
if placement.lower() == "bottom":
|
1257
|
+
zOffset = height*0.5
|
1258
|
+
elif placement.lower() == "top":
|
1259
|
+
zOffset = -height*0.5
|
1260
|
+
elif placement.lower() == "lowerleft":
|
1261
|
+
xOffset = width*0.5
|
1262
|
+
yOffset = length*0.5
|
1263
|
+
zOffset = height*0.5
|
1264
|
+
elif placement.lower() == "upperleft":
|
1265
|
+
xOffset = width*0.5
|
1266
|
+
yOffset = -length*0.5
|
1267
|
+
zOffset = -height*0.5
|
1268
|
+
elif placement.lower() == "lowerright":
|
1269
|
+
xOffset = -width*0.5
|
1270
|
+
yOffset = length*0.5
|
1271
|
+
zOffset = height*0.5
|
1272
|
+
elif placement.lower() == "upperright":
|
1273
|
+
xOffset = -width*0.5
|
1274
|
+
yOffset = -length*0.5
|
1275
|
+
zOffset = -height*0.5
|
1276
|
+
return_cell = Topology.Translate(return_cell, x=xOffset, y=yOffset, z=zOffset)
|
1277
|
+
return_cell = Topology.Place(return_cell, originA=Vertex.Origin(), originB=origin)
|
1278
|
+
if direction != [0, 0, 1]:
|
1279
|
+
return_cell = Topology.Orient(return_cell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
1280
|
+
return return_cell
|
1281
|
+
|
858
1282
|
@staticmethod
|
859
1283
|
def Cube(origin = None,
|
860
1284
|
size: float = 1,
|
@@ -1547,15 +1971,162 @@ class Cell():
|
|
1547
1971
|
return None
|
1548
1972
|
|
1549
1973
|
@staticmethod
|
1550
|
-
def
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1974
|
+
def IShape(origin=None,
|
1975
|
+
width=1,
|
1976
|
+
length=1,
|
1977
|
+
height=1,
|
1978
|
+
a=0.25,
|
1979
|
+
b=0.25,
|
1980
|
+
c=0.25,
|
1981
|
+
flipHorizontal = False,
|
1982
|
+
flipVertical = False,
|
1983
|
+
direction=[0,0,1],
|
1984
|
+
placement="center",
|
1985
|
+
tolerance=0.0001,
|
1986
|
+
silent=False):
|
1987
|
+
"""
|
1988
|
+
Creates an I-shape cell.
|
1989
|
+
|
1990
|
+
Parameters
|
1991
|
+
----------
|
1992
|
+
origin : topologic_core.Vertex , optional
|
1993
|
+
The location of the origin of the I-shape. The default is None which results in the I-shape being placed at (0, 0, 0).
|
1994
|
+
width : float , optional
|
1995
|
+
The overall width of the I-shape. The default is 1.0.
|
1996
|
+
length : float , optional
|
1997
|
+
The overall length of the I-shape. The default is 1.0.
|
1998
|
+
a : float , optional
|
1999
|
+
The hortizontal thickness of the central vertical arm of the I-shape. The default is 0.25.
|
2000
|
+
b : float , optional
|
2001
|
+
The vertical thickness of the bottom horizontal arm of the I-shape. The default is 0.25.
|
2002
|
+
c : float , optional
|
2003
|
+
The vertical thickness of the top horizontal arm of the I-shape. The default is 0.25.
|
2004
|
+
direction : list , optional
|
2005
|
+
The vector representing the up direction of the I-shape. The default is [0, 0, 1].
|
2006
|
+
placement : str , optional
|
2007
|
+
The description of the placement of the origin of the I-shape. This can be "center", "bottom", "top", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
2008
|
+
tolerance : float , optional
|
2009
|
+
The desired tolerance. The default is 0.0001.
|
2010
|
+
silent : bool , optional
|
2011
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
2012
|
+
|
2013
|
+
Returns
|
2014
|
+
-------
|
2015
|
+
topologic_core.Cell
|
2016
|
+
The created I-shape cell.
|
2017
|
+
|
2018
|
+
"""
|
2019
|
+
from topologicpy.Vertex import Vertex
|
2020
|
+
from topologicpy.Face import Face
|
2021
|
+
from topologicpy.Topology import Topology
|
2022
|
+
|
2023
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
2024
|
+
if not silent:
|
2025
|
+
print("Cell.IShape - Error: The width input parameter is not a valid number. Returning None.")
|
2026
|
+
return None
|
2027
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
2028
|
+
if not silent:
|
2029
|
+
print("Cell.IShape - Error: The length input parameter is not a valid number. Returning None.")
|
2030
|
+
return None
|
2031
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
2032
|
+
if not silent:
|
2033
|
+
print("Cell.IShape - Error: The a input parameter is not a valid number. Returning None.")
|
2034
|
+
return None
|
2035
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
2036
|
+
if not silent:
|
2037
|
+
print("Cell.IShape - Error: The b input parameter is not a valid number. Returning None.")
|
2038
|
+
return None
|
2039
|
+
if width <= tolerance:
|
2040
|
+
if not silent:
|
2041
|
+
print("Cell.IShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2042
|
+
return None
|
2043
|
+
if length <= tolerance:
|
2044
|
+
if not silent:
|
2045
|
+
print("Cell.IShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2046
|
+
return None
|
2047
|
+
if a <= tolerance:
|
2048
|
+
if not silent:
|
2049
|
+
print("Cell.IShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2050
|
+
return None
|
2051
|
+
if b <= tolerance:
|
2052
|
+
if not silent:
|
2053
|
+
print("Cell.IShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2054
|
+
return None
|
2055
|
+
if a >= (width - tolerance):
|
2056
|
+
if not silent:
|
2057
|
+
print("Cell.IShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
2058
|
+
return None
|
2059
|
+
if b+c >= (length - tolerance):
|
2060
|
+
if not silent:
|
2061
|
+
print("Cell.IShape - Error: The b and c input parameters must add to less than the length input parameter. Returning None.")
|
2062
|
+
return None
|
2063
|
+
if origin == None:
|
2064
|
+
origin = Vertex.Origin()
|
2065
|
+
if not Topology.IsInstance(origin, "vertex"):
|
2066
|
+
if not silent:
|
2067
|
+
print("Cell.IShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
2068
|
+
return None
|
2069
|
+
if not isinstance(direction, list):
|
2070
|
+
if not silent:
|
2071
|
+
print("Cell.IShape - Error: The direction input parameter is not a valid list. Returning None.")
|
2072
|
+
return None
|
2073
|
+
if not len(direction) == 3:
|
2074
|
+
if not silent:
|
2075
|
+
print("Cell.IShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
2076
|
+
return None
|
2077
|
+
i_shape_face = Face.IShape(origin=origin,
|
2078
|
+
width=width,
|
2079
|
+
length=length,
|
2080
|
+
a=a,
|
2081
|
+
b=b,
|
2082
|
+
c=c,
|
2083
|
+
flipHorizontal=flipHorizontal,
|
2084
|
+
flipVertical=flipVertical,
|
2085
|
+
direction=direction,
|
2086
|
+
placement=placement,
|
2087
|
+
tolerance=tolerance,
|
2088
|
+
silent=silent)
|
2089
|
+
return_cell = Cell.ByThickenedFace(i_shape_face, thickness=height, bothSides=True, reverse=False,
|
2090
|
+
planarize = False, tolerance=tolerance, silent=silent)
|
2091
|
+
xOffset = 0
|
2092
|
+
yOffset = 0
|
2093
|
+
zOffset = 0
|
2094
|
+
if placement.lower() == "bottom":
|
2095
|
+
zOffset = height*0.5
|
2096
|
+
elif placement.lower() == "top":
|
2097
|
+
zOffset = -height*0.5
|
2098
|
+
elif placement.lower() == "lowerleft":
|
2099
|
+
xOffset = width*0.5
|
2100
|
+
yOffset = length*0.5
|
2101
|
+
zOffset = height*0.5
|
2102
|
+
elif placement.lower() == "upperleft":
|
2103
|
+
xOffset = width*0.5
|
2104
|
+
yOffset = -length*0.5
|
2105
|
+
zOffset = -height*0.5
|
2106
|
+
elif placement.lower() == "lowerright":
|
2107
|
+
xOffset = -width*0.5
|
2108
|
+
yOffset = length*0.5
|
2109
|
+
zOffset = height*0.5
|
2110
|
+
elif placement.lower() == "upperright":
|
2111
|
+
xOffset = -width*0.5
|
2112
|
+
yOffset = -length*0.5
|
2113
|
+
zOffset = -height*0.5
|
2114
|
+
return_cell = Topology.Translate(return_cell, x=xOffset, y=yOffset, z=zOffset)
|
2115
|
+
return_cell = Topology.Place(return_cell, originA=Vertex.Origin(), originB=origin)
|
2116
|
+
if direction != [0, 0, 1]:
|
2117
|
+
return_cell = Topology.Orient(return_cell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
2118
|
+
return return_cell
|
2119
|
+
|
2120
|
+
@staticmethod
|
2121
|
+
def IsOnBoundary(cell, vertex, tolerance: float = 0.0001) -> bool:
|
2122
|
+
"""
|
2123
|
+
Returns True if the input vertex is on the boundary of the input cell. Returns False otherwise.
|
2124
|
+
|
2125
|
+
Parameters
|
2126
|
+
----------
|
2127
|
+
cell : topologic_core.Cell
|
2128
|
+
The input cell.
|
2129
|
+
vertex : topologic_core.Vertex
|
1559
2130
|
The input vertex.
|
1560
2131
|
tolerance : float , optional
|
1561
2132
|
The desired tolerance. The default is 0.0001.
|
@@ -1580,6 +2151,160 @@ class Cell():
|
|
1580
2151
|
print("Cell.IsOnBoundary - Error: Could not determine if the input vertex is on the boundary of the input cell. Returning None.")
|
1581
2152
|
return None
|
1582
2153
|
|
2154
|
+
@staticmethod
|
2155
|
+
def LShape(origin=None,
|
2156
|
+
width=1,
|
2157
|
+
length=1,
|
2158
|
+
height=1,
|
2159
|
+
a=0.25,
|
2160
|
+
b=0.25,
|
2161
|
+
flipHorizontal = False,
|
2162
|
+
flipVertical = False,
|
2163
|
+
direction=[0,0,1],
|
2164
|
+
placement="center",
|
2165
|
+
tolerance=0.0001,
|
2166
|
+
silent=False):
|
2167
|
+
"""
|
2168
|
+
Creates an L-shape.
|
2169
|
+
|
2170
|
+
Parameters
|
2171
|
+
----------
|
2172
|
+
origin : topologic_core.Vertex , optional
|
2173
|
+
The location of the origin of the L-shape. The default is None which results in the L-shape being placed at (0, 0, 0).
|
2174
|
+
width : float , optional
|
2175
|
+
The overall width of the L-shape. The default is 1.0.
|
2176
|
+
length : float , optional
|
2177
|
+
The overall length of the L-shape. The default is 1.0.
|
2178
|
+
height : float , optional
|
2179
|
+
The overall height of the L-shape. The default is 1.0.
|
2180
|
+
a : float , optional
|
2181
|
+
The hortizontal thickness of the vertical arm of the L-shape. The default is 0.25.
|
2182
|
+
b : float , optional
|
2183
|
+
The vertical thickness of the horizontal arm of the L-shape. The default is 0.25.
|
2184
|
+
direction : list , optional
|
2185
|
+
The vector representing the up direction of the L-shape. The default is [0, 0, 1].
|
2186
|
+
placement : str , optional
|
2187
|
+
The description of the placement of the origin of the L-shape. This can be "center", "bottom", "top", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
2188
|
+
tolerance : float , optional
|
2189
|
+
The desired tolerance. The default is 0.0001.
|
2190
|
+
silent : bool , optional
|
2191
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
2192
|
+
|
2193
|
+
Returns
|
2194
|
+
-------
|
2195
|
+
topologic_core.Cell
|
2196
|
+
The created L-shape cell.
|
2197
|
+
|
2198
|
+
"""
|
2199
|
+
from topologicpy.Vertex import Vertex
|
2200
|
+
from topologicpy.Face import Face
|
2201
|
+
from topologicpy.Topology import Topology
|
2202
|
+
|
2203
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
2204
|
+
if not silent:
|
2205
|
+
print("Cell.LShape - Error: The width input parameter is not a valid number. Returning None.")
|
2206
|
+
return None
|
2207
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
2208
|
+
if not silent:
|
2209
|
+
print("Cell.LShape - Error: The length input parameter is not a valid number. Returning None.")
|
2210
|
+
return None
|
2211
|
+
if not isinstance(height, int) and not isinstance(height, float):
|
2212
|
+
if not silent:
|
2213
|
+
print("Cell.LShape - Error: The height input parameter is not a valid number. Returning None.")
|
2214
|
+
return None
|
2215
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
2216
|
+
if not silent:
|
2217
|
+
print("Cell.LShape - Error: The a input parameter is not a valid number. Returning None.")
|
2218
|
+
return None
|
2219
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
2220
|
+
if not silent:
|
2221
|
+
print("Cell.LShape - Error: The b input parameter is not a valid number. Returning None.")
|
2222
|
+
return None
|
2223
|
+
if width <= tolerance:
|
2224
|
+
if not silent:
|
2225
|
+
print("Cell.LShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2226
|
+
return None
|
2227
|
+
if length <= tolerance:
|
2228
|
+
if not silent:
|
2229
|
+
print("Cell.LShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2230
|
+
return None
|
2231
|
+
if height <= tolerance:
|
2232
|
+
if not silent:
|
2233
|
+
print("Cell.LShape - Error: The height input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2234
|
+
return None
|
2235
|
+
if a <= tolerance:
|
2236
|
+
if not silent:
|
2237
|
+
print("Cell.LShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2238
|
+
return None
|
2239
|
+
if b <= tolerance:
|
2240
|
+
if not silent:
|
2241
|
+
print("Cell.LShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2242
|
+
return None
|
2243
|
+
if a >= (width - tolerance):
|
2244
|
+
if not silent:
|
2245
|
+
print("Cell.LShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
2246
|
+
return None
|
2247
|
+
if b >= (length - tolerance):
|
2248
|
+
if not silent:
|
2249
|
+
print("Cell.LShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
|
2250
|
+
return None
|
2251
|
+
if origin == None:
|
2252
|
+
origin = Vertex.Origin()
|
2253
|
+
if not Topology.IsInstance(origin, "vertex"):
|
2254
|
+
if not silent:
|
2255
|
+
print("Cell.LShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
2256
|
+
return None
|
2257
|
+
if not isinstance(direction, list):
|
2258
|
+
if not silent:
|
2259
|
+
print("Cell.LShape - Error: The direction input parameter is not a valid list. Returning None.")
|
2260
|
+
return None
|
2261
|
+
if not len(direction) == 3:
|
2262
|
+
if not silent:
|
2263
|
+
print("Cell.LShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
2264
|
+
return None
|
2265
|
+
l_shape_face = Face.LShape(origin=origin,
|
2266
|
+
width=width,
|
2267
|
+
length=length,
|
2268
|
+
a=a,
|
2269
|
+
b=b,
|
2270
|
+
flipHorizontal=flipHorizontal,
|
2271
|
+
flipVertical=flipVertical,
|
2272
|
+
direction=[0,0,1],
|
2273
|
+
placement="center",
|
2274
|
+
tolerance=tolerance,
|
2275
|
+
silent=silent)
|
2276
|
+
|
2277
|
+
return_cell = Cell.ByThickenedFace(l_shape_face, thickness=height, bothSides=True, reverse=False,
|
2278
|
+
planarize = False, tolerance=tolerance, silent=silent)
|
2279
|
+
xOffset = 0
|
2280
|
+
yOffset = 0
|
2281
|
+
zOffset = 0
|
2282
|
+
if placement.lower() == "bottom":
|
2283
|
+
zOffset = height*0.5
|
2284
|
+
elif placement.lower() == "top":
|
2285
|
+
zOffset = -height*0.5
|
2286
|
+
elif placement.lower() == "lowerleft":
|
2287
|
+
xOffset = width*0.5
|
2288
|
+
yOffset = length*0.5
|
2289
|
+
zOffset = height*0.5
|
2290
|
+
elif placement.lower() == "upperleft":
|
2291
|
+
xOffset = width*0.5
|
2292
|
+
yOffset = -length*0.5
|
2293
|
+
zOffset = -height*0.5
|
2294
|
+
elif placement.lower() == "lowerright":
|
2295
|
+
xOffset = -width*0.5
|
2296
|
+
yOffset = length*0.5
|
2297
|
+
zOffset = height*0.5
|
2298
|
+
elif placement.lower() == "upperright":
|
2299
|
+
xOffset = -width*0.5
|
2300
|
+
yOffset = -length*0.5
|
2301
|
+
zOffset = -height*0.5
|
2302
|
+
return_cell = Topology.Translate(return_cell, x=xOffset, y=yOffset, z=zOffset)
|
2303
|
+
return_cell = Topology.Place(return_cell, originA=Vertex.Origin(), originB=origin)
|
2304
|
+
if direction != [0, 0, 1]:
|
2305
|
+
return_cell = Topology.Orient(return_cell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
2306
|
+
return return_cell
|
2307
|
+
|
1583
2308
|
@staticmethod
|
1584
2309
|
def Octahedron(origin= None, radius: float = 0.5,
|
1585
2310
|
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
|
@@ -2028,6 +2753,102 @@ class Cell():
|
|
2028
2753
|
clean_faces.append(Face.RemoveCollinearEdges(face, angTolerance=angTolerance, tolerance=tolerance))
|
2029
2754
|
return Cell.ByFaces(clean_faces, tolerance=tolerance)
|
2030
2755
|
|
2756
|
+
@staticmethod
|
2757
|
+
def RHS(origin= None, width: float = 1.0, length: float = 1.0, height: float = 1.0, thickness: float = 0.25, outerFillet: float = 0.0, innerFillet: float = 0.0, sides: int = 16, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001, silent: bool = False):
|
2758
|
+
"""
|
2759
|
+
Creates a rectangluar hollow section (RHS).
|
2760
|
+
|
2761
|
+
Parameters
|
2762
|
+
----------
|
2763
|
+
origin : topologic_core.Vertex, optional
|
2764
|
+
The location of the origin of the RHS. The default is None which results in the RHS being placed at (0, 0, 0).
|
2765
|
+
width : float , optional
|
2766
|
+
The width of the RHS. The default is 1.0.
|
2767
|
+
length : float , optional
|
2768
|
+
The length of the RHS. The default is 1.0.
|
2769
|
+
thickness : float , optional
|
2770
|
+
The thickness of the RHS. The default is 0.25.
|
2771
|
+
height : float , optional
|
2772
|
+
The height of the RHS. The default is 1.0.
|
2773
|
+
outerFillet : float , optional
|
2774
|
+
The outer fillet multiplication factor based on the thickness (e.g. 1t). The default is 0.
|
2775
|
+
innerFillet : float , optional
|
2776
|
+
The inner fillet multiplication factor based on the thickness (e.g. 1.5t). The default is 0.
|
2777
|
+
sides : int , optional
|
2778
|
+
The desired number of sides of the fillets. The default is 16.
|
2779
|
+
direction : list , optional
|
2780
|
+
The vector representing the up direction of the RHS. The default is [0, 0, 1].
|
2781
|
+
placement : str , optional
|
2782
|
+
The description of the placement of the origin of the RHS. This can be "center", "bottom", "top", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
2783
|
+
tolerance : float , optional
|
2784
|
+
The desired tolerance. The default is 0.0001.
|
2785
|
+
silent : bool , optional
|
2786
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
2787
|
+
|
2788
|
+
Returns
|
2789
|
+
-------
|
2790
|
+
topologic_core.Cell
|
2791
|
+
The created cell.
|
2792
|
+
|
2793
|
+
"""
|
2794
|
+
from topologicpy.Vertex import Vertex
|
2795
|
+
from topologicpy.Face import Face
|
2796
|
+
from topologicpy.Topology import Topology
|
2797
|
+
|
2798
|
+
if 2*thickness >= width:
|
2799
|
+
if not silent:
|
2800
|
+
print("Cell.RHS - Error: Twice the thickness value is larger than or equal to the width value. Returning None.")
|
2801
|
+
return None
|
2802
|
+
if 2*thickness >= width:
|
2803
|
+
if not silent:
|
2804
|
+
print("Cell.RHS - Error: Twice the thickness value is larger than or equal to the length value. Returning None.")
|
2805
|
+
return None
|
2806
|
+
outer_dimension = min(width, length)
|
2807
|
+
fillet_dimension = 2*outerFillet*thickness
|
2808
|
+
if fillet_dimension > outer_dimension:
|
2809
|
+
if not silent:
|
2810
|
+
print("Cell.RHS = Error: The outer fillet radius input value is too large given the desired dimensions of the RHS. Returning None.")
|
2811
|
+
return None
|
2812
|
+
inner_dimension = min(width, length) - 2*thickness
|
2813
|
+
fillet_dimension = 2*innerFillet*thickness
|
2814
|
+
if fillet_dimension > inner_dimension:
|
2815
|
+
if not silent:
|
2816
|
+
print("Cell.RHS = Error: The inner fillet radius input value is too large given the desired dimensions of the RHS. Returning None.")
|
2817
|
+
return None
|
2818
|
+
if origin == None:
|
2819
|
+
origin = Vertex.Origin()
|
2820
|
+
bottom_face = Face.RHS(origin = Vertex.Origin(), width=width, length=length, thickness=thickness, outerFillet=outerFillet, innerFillet=innerFillet, sides=sides, direction=[0,0,1], placement="center", tolerance=tolerance, silent=silent)
|
2821
|
+
return_cell = Cell.ByThickenedFace(bottom_face, thickness=height, bothSides=True, reverse=False,
|
2822
|
+
planarize = False, tolerance=tolerance, silent=silent)
|
2823
|
+
xOffset = 0
|
2824
|
+
yOffset = 0
|
2825
|
+
zOffset = 0
|
2826
|
+
if placement.lower() == "bottom":
|
2827
|
+
zOffset = height*0.5
|
2828
|
+
elif placement.lower() == "top":
|
2829
|
+
zOffset = -height*0.5
|
2830
|
+
elif placement.lower() == "lowerleft":
|
2831
|
+
xOffset = width*0.5
|
2832
|
+
yOffset = length*0.5
|
2833
|
+
zOffset = height*0.5
|
2834
|
+
elif placement.lower() == "upperleft":
|
2835
|
+
xOffset = width*0.5
|
2836
|
+
yOffset = -length*0.5
|
2837
|
+
zOffset = -height*0.5
|
2838
|
+
elif placement.lower() == "lowerright":
|
2839
|
+
xOffset = -width*0.5
|
2840
|
+
yOffset = length*0.5
|
2841
|
+
zOffset = height*0.5
|
2842
|
+
elif placement.lower() == "upperright":
|
2843
|
+
xOffset = -width*0.5
|
2844
|
+
yOffset = -length*0.5
|
2845
|
+
zOffset = -height*0.5
|
2846
|
+
return_cell = Topology.Translate(return_cell, x=xOffset, y=yOffset, z=zOffset)
|
2847
|
+
return_cell = Topology.Place(return_cell, originA=Vertex.Origin(), originB=origin)
|
2848
|
+
if direction != [0, 0, 1]:
|
2849
|
+
return_cell = Topology.Orient(return_cell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
2850
|
+
return return_cell
|
2851
|
+
|
2031
2852
|
@staticmethod
|
2032
2853
|
def Roof(face, angle: float = 45, epsilon: float = 0.01 , tolerance: float = 0.001):
|
2033
2854
|
"""
|
@@ -2151,6 +2972,76 @@ class Cell():
|
|
2151
2972
|
_ = cell.Shells(None, shells) # Hook to Core
|
2152
2973
|
return shells
|
2153
2974
|
|
2975
|
+
@staticmethod
|
2976
|
+
def SHS(origin= None, size: float = 1.0, height: float = 1.0, thickness: float = 0.25, outerFillet: float = 0.0, innerFillet: float = 0.0, sides: int = 16, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001, silent: bool = False):
|
2977
|
+
"""
|
2978
|
+
Creates a square hollow section (SHS).
|
2979
|
+
|
2980
|
+
Parameters
|
2981
|
+
----------
|
2982
|
+
origin : topologic_core.Vertex, optional
|
2983
|
+
The location of the origin of the SHS. The default is None which results in the SHS being placed at (0, 0, 0).
|
2984
|
+
size : float , optional
|
2985
|
+
The size of the SHS. The default is 1.0.
|
2986
|
+
length : float , optional
|
2987
|
+
The length of the SHS. The default is 1.0.
|
2988
|
+
thickness : float , optional
|
2989
|
+
The thickness of the SHS. The default is 0.25.
|
2990
|
+
height : float , optional
|
2991
|
+
The height of the SHS. The default is 1.0.
|
2992
|
+
outerFillet : float , optional
|
2993
|
+
The outer fillet multiplication factor based on the thickness (e.g. 1t). The default is 0.
|
2994
|
+
innerFillet : float , optional
|
2995
|
+
The inner fillet multiplication factor based on the thickness (e.g. 1.5t). The default is 0.
|
2996
|
+
sides : int , optional
|
2997
|
+
The desired number of sides of the fillets. The default is 16.
|
2998
|
+
direction : list , optional
|
2999
|
+
The vector representing the up direction of the SHS. The default is [0, 0, 1].
|
3000
|
+
placement : str , optional
|
3001
|
+
The description of the placement of the origin of the RHS. This can be "center", "bottom", "top", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
3002
|
+
tolerance : float , optional
|
3003
|
+
The desired tolerance. The default is 0.0001.
|
3004
|
+
silent : bool , optional
|
3005
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
3006
|
+
|
3007
|
+
Returns
|
3008
|
+
-------
|
3009
|
+
topologic_core.Cell
|
3010
|
+
The created cell.
|
3011
|
+
|
3012
|
+
"""
|
3013
|
+
from topologicpy.Vertex import Vertex
|
3014
|
+
from topologicpy.Face import Face
|
3015
|
+
from topologicpy.Topology import Topology
|
3016
|
+
|
3017
|
+
if 2*thickness >= size:
|
3018
|
+
if not silent:
|
3019
|
+
print("Cell.SHS - Error: Twice the thickness value is larger than or equal to the size value. Returning None.")
|
3020
|
+
return None
|
3021
|
+
fillet_dimension = 2*outerFillet*thickness
|
3022
|
+
if fillet_dimension > size:
|
3023
|
+
if not silent:
|
3024
|
+
print("Cell.SHS = Error: The outer fillet radius input value is too large given the desired dimensions of the RHS. Returning None.")
|
3025
|
+
return None
|
3026
|
+
inner_dimension = size - 2*thickness
|
3027
|
+
fillet_dimension = 2*innerFillet*thickness
|
3028
|
+
if fillet_dimension > inner_dimension:
|
3029
|
+
if not silent:
|
3030
|
+
print("Cell.SHS = Error: The inner fillet radius input value is too large given the desired dimensions of the RHS. Returning None.")
|
3031
|
+
return None
|
3032
|
+
return Cell.RHS(origin= origin,
|
3033
|
+
width = size,
|
3034
|
+
length = size,
|
3035
|
+
height = height,
|
3036
|
+
thickness = thickness,
|
3037
|
+
outerFillet = outerFillet,
|
3038
|
+
innerFillet = innerFillet,
|
3039
|
+
sides = sides,
|
3040
|
+
direction = direction,
|
3041
|
+
placement = placement,
|
3042
|
+
tolerance = tolerance,
|
3043
|
+
silent = silent)
|
3044
|
+
|
2154
3045
|
@staticmethod
|
2155
3046
|
def Sphere(origin= None, radius: float = 0.5, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1],
|
2156
3047
|
placement: str = "center", tolerance: float = 0.0001):
|
@@ -2430,6 +3321,203 @@ class Cell():
|
|
2430
3321
|
torus = Topology.Place(torus, originA=Vertex.Origin(), originB=origin)
|
2431
3322
|
return torus
|
2432
3323
|
|
3324
|
+
@staticmethod
|
3325
|
+
def TShape(origin=None,
|
3326
|
+
width=1,
|
3327
|
+
length=1,
|
3328
|
+
height=1,
|
3329
|
+
a=0.25,
|
3330
|
+
b=0.25,
|
3331
|
+
flipHorizontal = False,
|
3332
|
+
flipVertical = False,
|
3333
|
+
direction=[0,0,1],
|
3334
|
+
placement="center",
|
3335
|
+
tolerance=0.0001,
|
3336
|
+
silent=False):
|
3337
|
+
"""
|
3338
|
+
Creates a T-shape cell.
|
3339
|
+
|
3340
|
+
Parameters
|
3341
|
+
----------
|
3342
|
+
origin : topologic_core.Vertex , optional
|
3343
|
+
The location of the origin of the T-shape. The default is None which results in the T-shape being placed at (0, 0, 0).
|
3344
|
+
width : float , optional
|
3345
|
+
The overall width of the T-shape. The default is 1.0.
|
3346
|
+
length : float , optional
|
3347
|
+
The overall length of the T-shape. The default is 1.0.
|
3348
|
+
height : float , optional
|
3349
|
+
the overall height of the T-shape. The default is 1.0.
|
3350
|
+
a : float , optional
|
3351
|
+
The hortizontal thickness of the vertical arm of the T-shape. The default is 0.25.
|
3352
|
+
b : float , optional
|
3353
|
+
The vertical thickness of the horizontal arm of the T-shape. The default is 0.25.
|
3354
|
+
direction : list , optional
|
3355
|
+
The vector representing the up direction of the T-shape. The default is [0, 0, 1].
|
3356
|
+
placement : str , optional
|
3357
|
+
The description of the placement of the origin of the T-shape. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
3358
|
+
tolerance : float , optional
|
3359
|
+
The desired tolerance. The default is 0.0001.
|
3360
|
+
silent : bool , optional
|
3361
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
3362
|
+
|
3363
|
+
Returns
|
3364
|
+
-------
|
3365
|
+
topologic_core.Face
|
3366
|
+
The created T-shape.
|
3367
|
+
|
3368
|
+
"""
|
3369
|
+
from topologicpy.Vertex import Vertex
|
3370
|
+
from topologicpy.Face import Face
|
3371
|
+
from topologicpy.Topology import Topology
|
3372
|
+
|
3373
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
3374
|
+
if not silent:
|
3375
|
+
print("Cell.TShape - Error: The width input parameter is not a valid number. Returning None.")
|
3376
|
+
return None
|
3377
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
3378
|
+
if not silent:
|
3379
|
+
print("Cell.TShape - Error: The length input parameter is not a valid number. Returning None.")
|
3380
|
+
return None
|
3381
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
3382
|
+
if not silent:
|
3383
|
+
print("Cell.TShape - Error: The a input parameter is not a valid number. Returning None.")
|
3384
|
+
return None
|
3385
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
3386
|
+
if not silent:
|
3387
|
+
print("Cell.LShape - Error: The b input parameter is not a valid number. Returning None.")
|
3388
|
+
return None
|
3389
|
+
if width <= tolerance:
|
3390
|
+
if not silent:
|
3391
|
+
print("Cell.TShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
3392
|
+
return None
|
3393
|
+
if length <= tolerance:
|
3394
|
+
if not silent:
|
3395
|
+
print("Cell.TShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
3396
|
+
return None
|
3397
|
+
if a <= tolerance:
|
3398
|
+
if not silent:
|
3399
|
+
print("Cell.TShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
3400
|
+
return None
|
3401
|
+
if b <= tolerance:
|
3402
|
+
if not silent:
|
3403
|
+
print("Cell.TShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
3404
|
+
return None
|
3405
|
+
if a >= (width - tolerance):
|
3406
|
+
if not silent:
|
3407
|
+
print("Cell.TShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
3408
|
+
return None
|
3409
|
+
if b >= (length - tolerance):
|
3410
|
+
if not silent:
|
3411
|
+
print("Cell.TShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
|
3412
|
+
return None
|
3413
|
+
if origin == None:
|
3414
|
+
origin = Vertex.Origin()
|
3415
|
+
if not Topology.IsInstance(origin, "vertex"):
|
3416
|
+
if not silent:
|
3417
|
+
print("Cell.TShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
3418
|
+
return None
|
3419
|
+
if not isinstance(direction, list):
|
3420
|
+
if not silent:
|
3421
|
+
print("Cell.TShape - Error: The direction input parameter is not a valid list. Returning None.")
|
3422
|
+
return None
|
3423
|
+
if not len(direction) == 3:
|
3424
|
+
if not silent:
|
3425
|
+
print("Cell.TShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
3426
|
+
return None
|
3427
|
+
t_shape_face = Face.TShape(origin=origin,
|
3428
|
+
width=width,
|
3429
|
+
length=length,
|
3430
|
+
a=a,
|
3431
|
+
b=b,
|
3432
|
+
flipHorizontal=flipHorizontal,
|
3433
|
+
flipVertical=flipVertical,
|
3434
|
+
direction=direction,
|
3435
|
+
placement=placement,
|
3436
|
+
tolerance=tolerance,
|
3437
|
+
silent=silent)
|
3438
|
+
return_cell = Cell.ByThickenedFace(t_shape_face, thickness=height, bothSides=True, reverse=False,
|
3439
|
+
planarize = False, tolerance=tolerance, silent=silent)
|
3440
|
+
xOffset = 0
|
3441
|
+
yOffset = 0
|
3442
|
+
zOffset = 0
|
3443
|
+
if placement.lower() == "bottom":
|
3444
|
+
zOffset = height*0.5
|
3445
|
+
elif placement.lower() == "top":
|
3446
|
+
zOffset = -height*0.5
|
3447
|
+
elif placement.lower() == "lowerleft":
|
3448
|
+
xOffset = width*0.5
|
3449
|
+
yOffset = length*0.5
|
3450
|
+
zOffset = height*0.5
|
3451
|
+
elif placement.lower() == "upperleft":
|
3452
|
+
xOffset = width*0.5
|
3453
|
+
yOffset = -length*0.5
|
3454
|
+
zOffset = -height*0.5
|
3455
|
+
elif placement.lower() == "lowerright":
|
3456
|
+
xOffset = -width*0.5
|
3457
|
+
yOffset = length*0.5
|
3458
|
+
zOffset = height*0.5
|
3459
|
+
elif placement.lower() == "upperright":
|
3460
|
+
xOffset = -width*0.5
|
3461
|
+
yOffset = -length*0.5
|
3462
|
+
zOffset = -height*0.5
|
3463
|
+
return_cell = Topology.Translate(return_cell, x=xOffset, y=yOffset, z=zOffset)
|
3464
|
+
return_cell = Topology.Place(return_cell, originA=Vertex.Origin(), originB=origin)
|
3465
|
+
if direction != [0, 0, 1]:
|
3466
|
+
return_cell = Topology.Orient(return_cell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
3467
|
+
return return_cell
|
3468
|
+
|
3469
|
+
@staticmethod
|
3470
|
+
def Tube(origin= None, radius: float = 1.0, height: float = 1.0, thickness: float = 0.25, sides: int = 16, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001, silent: bool = False):
|
3471
|
+
"""
|
3472
|
+
Creates a Tube. This method is an alias for the circular hollow section (CHS).
|
3473
|
+
|
3474
|
+
Parameters
|
3475
|
+
----------
|
3476
|
+
origin : topologic_core.Vertex, optional
|
3477
|
+
The location of the origin of the CHS. The default is None which results in the CHS being placed at (0, 0, 0).
|
3478
|
+
radius : float , optional
|
3479
|
+
The outer radius of the CHS. The default is 1.0.
|
3480
|
+
thickness : float , optional
|
3481
|
+
The thickness of the CHS. The default is 0.25.
|
3482
|
+
height : float , optional
|
3483
|
+
The height of the CHS. The default is 1.0.
|
3484
|
+
sides : int , optional
|
3485
|
+
The desired number of sides of the CSH. The default is 16.
|
3486
|
+
direction : list , optional
|
3487
|
+
The vector representing the up direction of the RHS. The default is [0, 0, 1].
|
3488
|
+
placement : str , optional
|
3489
|
+
The description of the placement of the origin of the RHS. This can be "center", "bottom", "top", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
3490
|
+
tolerance : float , optional
|
3491
|
+
The desired tolerance. The default is 0.0001.
|
3492
|
+
silent : bool , optional
|
3493
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
3494
|
+
|
3495
|
+
Returns
|
3496
|
+
-------
|
3497
|
+
topologic_core.Cell
|
3498
|
+
The created cell.
|
3499
|
+
|
3500
|
+
"""
|
3501
|
+
from topologicpy.Vertex import Vertex
|
3502
|
+
from topologicpy.Face import Face
|
3503
|
+
from topologicpy.Topology import Topology
|
3504
|
+
|
3505
|
+
if thickness >= radius:
|
3506
|
+
if not silent:
|
3507
|
+
print("Cell.Tube - Error: The thickness value is larger than or equal to the outer radius value. Returning None.")
|
3508
|
+
return None
|
3509
|
+
if origin == None:
|
3510
|
+
origin = Vertex.Origin()
|
3511
|
+
return Cell.CHS(origin=origin,
|
3512
|
+
radius=radius,
|
3513
|
+
height=height,
|
3514
|
+
thickness=thickness,
|
3515
|
+
sides=sides,
|
3516
|
+
direction=direction,
|
3517
|
+
placement=placement,
|
3518
|
+
tolerance=tolerance,
|
3519
|
+
silent=silent)
|
3520
|
+
|
2433
3521
|
@staticmethod
|
2434
3522
|
def Vertices(cell) -> list:
|
2435
3523
|
"""
|