topologicpy 0.7.93__py3-none-any.whl → 0.7.94__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/Face.py +461 -0
- topologicpy/Wire.py +592 -1
- topologicpy/version.py +1 -1
- {topologicpy-0.7.93.dist-info → topologicpy-0.7.94.dist-info}/METADATA +1 -1
- {topologicpy-0.7.93.dist-info → topologicpy-0.7.94.dist-info}/RECORD +8 -8
- {topologicpy-0.7.93.dist-info → topologicpy-0.7.94.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.93.dist-info → topologicpy-0.7.94.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.93.dist-info → topologicpy-0.7.94.dist-info}/top_level.txt +0 -0
topologicpy/Face.py
CHANGED
@@ -1124,6 +1124,123 @@ class Face():
|
|
1124
1124
|
dirA = Face.Normal(face, outputType="xyz", mantissa=mantissa)
|
1125
1125
|
return Vector.CompassAngle(vectorA=dirA, vectorB=north, mantissa=mantissa, tolerance=tolerance)
|
1126
1126
|
|
1127
|
+
@staticmethod
|
1128
|
+
def CShape(origin=None,
|
1129
|
+
width=1,
|
1130
|
+
length=1,
|
1131
|
+
a=0.25,
|
1132
|
+
b=0.25,
|
1133
|
+
c=0.25,
|
1134
|
+
flipHorizontal = False,
|
1135
|
+
flipVertical = False,
|
1136
|
+
direction=[0,0,1],
|
1137
|
+
placement="center",
|
1138
|
+
tolerance=0.0001,
|
1139
|
+
silent=False):
|
1140
|
+
"""
|
1141
|
+
Creates a C-shape.
|
1142
|
+
|
1143
|
+
Parameters
|
1144
|
+
----------
|
1145
|
+
origin : topologic_core.Vertex , optional
|
1146
|
+
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).
|
1147
|
+
width : float , optional
|
1148
|
+
The overall width of the C-shape. The default is 1.0.
|
1149
|
+
length : float , optional
|
1150
|
+
The overall length of the C-shape. The default is 1.0.
|
1151
|
+
a : float , optional
|
1152
|
+
The hortizontal thickness of the vertical arm of the C-shape. The default is 0.25.
|
1153
|
+
b : float , optional
|
1154
|
+
The vertical thickness of the bottom horizontal arm of the C-shape. The default is 0.25.
|
1155
|
+
c : float , optional
|
1156
|
+
The vertical thickness of the top horizontal arm of the C-shape. The default is 0.25.
|
1157
|
+
direction : list , optional
|
1158
|
+
The vector representing the up direction of the C-shape. The default is [0, 0, 1].
|
1159
|
+
placement : str , optional
|
1160
|
+
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".
|
1161
|
+
tolerance : float , optional
|
1162
|
+
The desired tolerance. The default is 0.0001.
|
1163
|
+
silent : bool , optional
|
1164
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1165
|
+
|
1166
|
+
Returns
|
1167
|
+
-------
|
1168
|
+
topologic_core.Face
|
1169
|
+
The created C-shape.
|
1170
|
+
|
1171
|
+
"""
|
1172
|
+
from topologicpy.Vertex import Vertex
|
1173
|
+
from topologicpy.Wire import Wire
|
1174
|
+
from topologicpy.Topology import Topology
|
1175
|
+
|
1176
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
1177
|
+
if not silent:
|
1178
|
+
print("Face.CShape - Error: The width input parameter is not a valid number. Returning None.")
|
1179
|
+
return None
|
1180
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
1181
|
+
if not silent:
|
1182
|
+
print("Face.CShape - Error: The length 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("Face.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("Face.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("Face.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("Face.CShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1199
|
+
return None
|
1200
|
+
if a <= tolerance:
|
1201
|
+
if not silent:
|
1202
|
+
print("Face.CShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1203
|
+
return None
|
1204
|
+
if b <= tolerance:
|
1205
|
+
if not silent:
|
1206
|
+
print("Face.CShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1207
|
+
return None
|
1208
|
+
if a >= (width - tolerance):
|
1209
|
+
if not silent:
|
1210
|
+
print("Face.CShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
1211
|
+
return None
|
1212
|
+
if b+c >= (length - tolerance):
|
1213
|
+
if not silent:
|
1214
|
+
print("Face.CShape - Error: The b and c input parameters must add to less than the length input parameter. Returning None.")
|
1215
|
+
return None
|
1216
|
+
if origin == None:
|
1217
|
+
origin = Vertex.Origin()
|
1218
|
+
if not Topology.IsInstance(origin, "vertex"):
|
1219
|
+
if not silent:
|
1220
|
+
print("Face.CShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
1221
|
+
return None
|
1222
|
+
if not isinstance(direction, list):
|
1223
|
+
if not silent:
|
1224
|
+
print("Face.CShape - Error: The direction input parameter is not a valid list. Returning None.")
|
1225
|
+
return None
|
1226
|
+
if not len(direction) == 3:
|
1227
|
+
if not silent:
|
1228
|
+
print("Face.CShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
1229
|
+
return None
|
1230
|
+
c_shape_wire = Wire.CShape(origin=origin,
|
1231
|
+
width=width,
|
1232
|
+
length=length,
|
1233
|
+
a=a,
|
1234
|
+
b=b,
|
1235
|
+
c=c,
|
1236
|
+
flipHorizontal=flipHorizontal,
|
1237
|
+
flipVertical=flipVertical,
|
1238
|
+
direction=direction,
|
1239
|
+
placement=placement,
|
1240
|
+
tolerance=tolerance,
|
1241
|
+
silent=silent)
|
1242
|
+
return Face.ByWire(c_shape_wire, tolerance=tolerance, silent=silent)
|
1243
|
+
|
1127
1244
|
@staticmethod
|
1128
1245
|
def Edges(face) -> list:
|
1129
1246
|
"""
|
@@ -1685,6 +1802,123 @@ class Face():
|
|
1685
1802
|
plane_b = normalize_plane_coefficients(plane_b)
|
1686
1803
|
return are_planes_coplanar(plane_a, plane_b, tolerance=tolerance)
|
1687
1804
|
|
1805
|
+
@staticmethod
|
1806
|
+
def IShape(origin=None,
|
1807
|
+
width=1,
|
1808
|
+
length=1,
|
1809
|
+
a=0.25,
|
1810
|
+
b=0.25,
|
1811
|
+
c=0.25,
|
1812
|
+
flipHorizontal = False,
|
1813
|
+
flipVertical = False,
|
1814
|
+
direction=[0,0,1],
|
1815
|
+
placement="center",
|
1816
|
+
tolerance=0.0001,
|
1817
|
+
silent=False):
|
1818
|
+
"""
|
1819
|
+
Creates an I-shape.
|
1820
|
+
|
1821
|
+
Parameters
|
1822
|
+
----------
|
1823
|
+
origin : topologic_core.Vertex , optional
|
1824
|
+
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).
|
1825
|
+
width : float , optional
|
1826
|
+
The overall width of the I-shape. The default is 1.0.
|
1827
|
+
length : float , optional
|
1828
|
+
The overall length of the I-shape. The default is 1.0.
|
1829
|
+
a : float , optional
|
1830
|
+
The hortizontal thickness of the central vertical arm of the I-shape. The default is 0.25.
|
1831
|
+
b : float , optional
|
1832
|
+
The vertical thickness of the bottom horizontal arm of the I-shape. The default is 0.25.
|
1833
|
+
c : float , optional
|
1834
|
+
The vertical thickness of the top horizontal arm of the I-shape. The default is 0.25.
|
1835
|
+
direction : list , optional
|
1836
|
+
The vector representing the up direction of the I-shape. The default is [0, 0, 1].
|
1837
|
+
placement : str , optional
|
1838
|
+
The description of the placement of the origin of the I-shape. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
1839
|
+
tolerance : float , optional
|
1840
|
+
The desired tolerance. The default is 0.0001.
|
1841
|
+
silent : bool , optional
|
1842
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1843
|
+
|
1844
|
+
Returns
|
1845
|
+
-------
|
1846
|
+
topologic_core.Face
|
1847
|
+
The created I-shape.
|
1848
|
+
|
1849
|
+
"""
|
1850
|
+
from topologicpy.Vertex import Vertex
|
1851
|
+
from topologicpy.Wire import Wire
|
1852
|
+
from topologicpy.Topology import Topology
|
1853
|
+
|
1854
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
1855
|
+
if not silent:
|
1856
|
+
print("Face.IShape - Error: The width input parameter is not a valid number. Returning None.")
|
1857
|
+
return None
|
1858
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
1859
|
+
if not silent:
|
1860
|
+
print("Face.IShape - Error: The length input parameter is not a valid number. Returning None.")
|
1861
|
+
return None
|
1862
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
1863
|
+
if not silent:
|
1864
|
+
print("Face.IShape - Error: The a input parameter is not a valid number. Returning None.")
|
1865
|
+
return None
|
1866
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
1867
|
+
if not silent:
|
1868
|
+
print("Face.IShape - Error: The b input parameter is not a valid number. Returning None.")
|
1869
|
+
return None
|
1870
|
+
if width <= tolerance:
|
1871
|
+
if not silent:
|
1872
|
+
print("Face.IShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1873
|
+
return None
|
1874
|
+
if length <= tolerance:
|
1875
|
+
if not silent:
|
1876
|
+
print("Face.IShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1877
|
+
return None
|
1878
|
+
if a <= tolerance:
|
1879
|
+
if not silent:
|
1880
|
+
print("Face.IShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1881
|
+
return None
|
1882
|
+
if b <= tolerance:
|
1883
|
+
if not silent:
|
1884
|
+
print("Face.IShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1885
|
+
return None
|
1886
|
+
if a >= (width - tolerance):
|
1887
|
+
if not silent:
|
1888
|
+
print("Face.IShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
1889
|
+
return None
|
1890
|
+
if b+c >= (length - tolerance):
|
1891
|
+
if not silent:
|
1892
|
+
print("Face.IShape - Error: The b and c input parameters must add to less than the length input parameter. Returning None.")
|
1893
|
+
return None
|
1894
|
+
if origin == None:
|
1895
|
+
origin = Vertex.Origin()
|
1896
|
+
if not Topology.IsInstance(origin, "vertex"):
|
1897
|
+
if not silent:
|
1898
|
+
print("Face.IShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
1899
|
+
return None
|
1900
|
+
if not isinstance(direction, list):
|
1901
|
+
if not silent:
|
1902
|
+
print("Face.IShape - Error: The direction input parameter is not a valid list. Returning None.")
|
1903
|
+
return None
|
1904
|
+
if not len(direction) == 3:
|
1905
|
+
if not silent:
|
1906
|
+
print("Face.IShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
1907
|
+
return None
|
1908
|
+
i_shape_wire = Wire.IShape(origin=origin,
|
1909
|
+
width=width,
|
1910
|
+
length=length,
|
1911
|
+
a=a,
|
1912
|
+
b=b,
|
1913
|
+
c=c,
|
1914
|
+
flipHorizontal=flipHorizontal,
|
1915
|
+
flipVertical=flipVertical,
|
1916
|
+
direction=direction,
|
1917
|
+
placement=placement,
|
1918
|
+
tolerance=tolerance,
|
1919
|
+
silent=silent)
|
1920
|
+
return Face.ByWire(i_shape_wire, tolerance=tolerance, silent=silent)
|
1921
|
+
|
1688
1922
|
@staticmethod
|
1689
1923
|
def Isovist(face, vertex, obstacles: list = [], direction: list = [0,1,0], fov: float = 360, transferDictionaries: bool = False, metrics: bool = False, triangles: bool = False, mantissa: int = 6, tolerance: float = 0.0001):
|
1690
1924
|
"""
|
@@ -2294,6 +2528,120 @@ class Face():
|
|
2294
2528
|
return_face = Topology.AddContent(return_face, triangle_list)
|
2295
2529
|
return return_face
|
2296
2530
|
|
2531
|
+
|
2532
|
+
@staticmethod
|
2533
|
+
def LShape(origin=None,
|
2534
|
+
width=1,
|
2535
|
+
length=1,
|
2536
|
+
a=0.25,
|
2537
|
+
b=0.25,
|
2538
|
+
flipHorizontal = False,
|
2539
|
+
flipVertical = False,
|
2540
|
+
direction=[0,0,1],
|
2541
|
+
placement="center",
|
2542
|
+
tolerance=0.0001,
|
2543
|
+
silent=False):
|
2544
|
+
"""
|
2545
|
+
Creates an L-shape.
|
2546
|
+
|
2547
|
+
Parameters
|
2548
|
+
----------
|
2549
|
+
origin : topologic_core.Vertex , optional
|
2550
|
+
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).
|
2551
|
+
width : float , optional
|
2552
|
+
The overall width of the L-shape. The default is 1.0.
|
2553
|
+
length : float , optional
|
2554
|
+
The overall length of the L-shape. The default is 1.0.
|
2555
|
+
a : float , optional
|
2556
|
+
The hortizontal thickness of the vertical arm of the L-shape. The default is 0.25.
|
2557
|
+
b : float , optional
|
2558
|
+
The vertical thickness of the horizontal arm of the L-shape. The default is 0.25.
|
2559
|
+
direction : list , optional
|
2560
|
+
The vector representing the up direction of the L-shape. The default is [0, 0, 1].
|
2561
|
+
placement : str , optional
|
2562
|
+
The description of the placement of the origin of the L-shape. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
2563
|
+
tolerance : float , optional
|
2564
|
+
The desired tolerance. The default is 0.0001.
|
2565
|
+
silent : bool , optional
|
2566
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
2567
|
+
|
2568
|
+
Returns
|
2569
|
+
-------
|
2570
|
+
topologic_core.Face
|
2571
|
+
The created L-shape.
|
2572
|
+
|
2573
|
+
"""
|
2574
|
+
from topologicpy.Vertex import Vertex
|
2575
|
+
from topologicpy.Wire import Wire
|
2576
|
+
from topologicpy.Topology import Topology
|
2577
|
+
|
2578
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
2579
|
+
if not silent:
|
2580
|
+
print("Face.LShape - Error: The width input parameter is not a valid number. Returning None.")
|
2581
|
+
return None
|
2582
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
2583
|
+
if not silent:
|
2584
|
+
print("Face.LShape - Error: The length input parameter is not a valid number. Returning None.")
|
2585
|
+
return None
|
2586
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
2587
|
+
if not silent:
|
2588
|
+
print("Face.LShape - Error: The a input parameter is not a valid number. Returning None.")
|
2589
|
+
return None
|
2590
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
2591
|
+
if not silent:
|
2592
|
+
print("Face.LShape - Error: The b input parameter is not a valid number. Returning None.")
|
2593
|
+
return None
|
2594
|
+
if width <= tolerance:
|
2595
|
+
if not silent:
|
2596
|
+
print("Face.LShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2597
|
+
return None
|
2598
|
+
if length <= tolerance:
|
2599
|
+
if not silent:
|
2600
|
+
print("Face.LShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2601
|
+
return None
|
2602
|
+
if a <= tolerance:
|
2603
|
+
if not silent:
|
2604
|
+
print("Face.LShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2605
|
+
return None
|
2606
|
+
if b <= tolerance:
|
2607
|
+
if not silent:
|
2608
|
+
print("Face.LShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2609
|
+
return None
|
2610
|
+
if a >= (width - tolerance):
|
2611
|
+
if not silent:
|
2612
|
+
print("Face.LShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
2613
|
+
return None
|
2614
|
+
if b >= (length - tolerance):
|
2615
|
+
if not silent:
|
2616
|
+
print("Face.LShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
|
2617
|
+
return None
|
2618
|
+
if origin == None:
|
2619
|
+
origin = Vertex.Origin()
|
2620
|
+
if not Topology.IsInstance(origin, "vertex"):
|
2621
|
+
if not silent:
|
2622
|
+
print("Face.LShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
2623
|
+
return None
|
2624
|
+
if not isinstance(direction, list):
|
2625
|
+
if not silent:
|
2626
|
+
print("Face.LShape - Error: The direction input parameter is not a valid list. Returning None.")
|
2627
|
+
return None
|
2628
|
+
if not len(direction) == 3:
|
2629
|
+
if not silent:
|
2630
|
+
print("Face.LShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
2631
|
+
return None
|
2632
|
+
l_shape_wire = Wire.LShape(origin=origin,
|
2633
|
+
width=width,
|
2634
|
+
length=length,
|
2635
|
+
a=a,
|
2636
|
+
b=b,
|
2637
|
+
flipHorizontal=flipHorizontal,
|
2638
|
+
flipVertical=flipVertical,
|
2639
|
+
direction=direction,
|
2640
|
+
placement=placement,
|
2641
|
+
tolerance=tolerance,
|
2642
|
+
silent=silent)
|
2643
|
+
return Face.ByWire(l_shape_wire, tolerance=tolerance, silent=silent)
|
2644
|
+
|
2297
2645
|
@staticmethod
|
2298
2646
|
def MedialAxis(face, resolution: int = 0, externalVertices: bool = False, internalVertices: bool = False, toLeavesOnly: bool = False, angTolerance: float = 0.1, tolerance: float = 0.0001):
|
2299
2647
|
"""
|
@@ -3193,6 +3541,119 @@ class Face():
|
|
3193
3541
|
trimmed_face = face.Difference(trimmed_face)
|
3194
3542
|
return trimmed_face
|
3195
3543
|
|
3544
|
+
@staticmethod
|
3545
|
+
def TShape(origin=None,
|
3546
|
+
width=1,
|
3547
|
+
length=1,
|
3548
|
+
a=0.5,
|
3549
|
+
b=0.5,
|
3550
|
+
flipHorizontal = False,
|
3551
|
+
flipVertical = False,
|
3552
|
+
direction=[0,0,1],
|
3553
|
+
placement="center",
|
3554
|
+
tolerance=0.0001,
|
3555
|
+
silent=False):
|
3556
|
+
"""
|
3557
|
+
Creates a T-shape.
|
3558
|
+
|
3559
|
+
Parameters
|
3560
|
+
----------
|
3561
|
+
origin : topologic_core.Vertex , optional
|
3562
|
+
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).
|
3563
|
+
width : float , optional
|
3564
|
+
The overall width of the T-shape. The default is 1.0.
|
3565
|
+
length : float , optional
|
3566
|
+
The overall length of the T-shape. The default is 1.0.
|
3567
|
+
a : float , optional
|
3568
|
+
The hortizontal thickness of the vertical arm of the T-shape. The default is 0.5.
|
3569
|
+
b : float , optional
|
3570
|
+
The vertical thickness of the horizontal arm of the T-shape. The default is 0.5.
|
3571
|
+
direction : list , optional
|
3572
|
+
The vector representing the up direction of the T-shape. The default is [0, 0, 1].
|
3573
|
+
placement : str , optional
|
3574
|
+
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".
|
3575
|
+
tolerance : float , optional
|
3576
|
+
The desired tolerance. The default is 0.0001.
|
3577
|
+
silent : bool , optional
|
3578
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
3579
|
+
|
3580
|
+
Returns
|
3581
|
+
-------
|
3582
|
+
topologic_core.Face
|
3583
|
+
The created T-shape.
|
3584
|
+
|
3585
|
+
"""
|
3586
|
+
from topologicpy.Vertex import Vertex
|
3587
|
+
from topologicpy.Wire import Wire
|
3588
|
+
from topologicpy.Topology import Topology
|
3589
|
+
|
3590
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
3591
|
+
if not silent:
|
3592
|
+
print("Face.TShape - Error: The width input parameter is not a valid number. Returning None.")
|
3593
|
+
return None
|
3594
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
3595
|
+
if not silent:
|
3596
|
+
print("Face.TShape - Error: The length input parameter is not a valid number. Returning None.")
|
3597
|
+
return None
|
3598
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
3599
|
+
if not silent:
|
3600
|
+
print("Face.TShape - Error: The a input parameter is not a valid number. Returning None.")
|
3601
|
+
return None
|
3602
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
3603
|
+
if not silent:
|
3604
|
+
print("Face.LShape - Error: The b input parameter is not a valid number. Returning None.")
|
3605
|
+
return None
|
3606
|
+
if width <= tolerance:
|
3607
|
+
if not silent:
|
3608
|
+
print("Face.TShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
3609
|
+
return None
|
3610
|
+
if length <= tolerance:
|
3611
|
+
if not silent:
|
3612
|
+
print("Face.TShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
3613
|
+
return None
|
3614
|
+
if a <= tolerance:
|
3615
|
+
if not silent:
|
3616
|
+
print("Face.TShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
3617
|
+
return None
|
3618
|
+
if b <= tolerance:
|
3619
|
+
if not silent:
|
3620
|
+
print("Face.TShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
3621
|
+
return None
|
3622
|
+
if a >= (width - tolerance):
|
3623
|
+
if not silent:
|
3624
|
+
print("Face.TShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
3625
|
+
return None
|
3626
|
+
if b >= (length - tolerance):
|
3627
|
+
if not silent:
|
3628
|
+
print("Face.TShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
|
3629
|
+
return None
|
3630
|
+
if origin == None:
|
3631
|
+
origin = Vertex.Origin()
|
3632
|
+
if not Topology.IsInstance(origin, "vertex"):
|
3633
|
+
if not silent:
|
3634
|
+
print("Face.TShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
3635
|
+
return None
|
3636
|
+
if not isinstance(direction, list):
|
3637
|
+
if not silent:
|
3638
|
+
print("Face.TShape - Error: The direction input parameter is not a valid list. Returning None.")
|
3639
|
+
return None
|
3640
|
+
if not len(direction) == 3:
|
3641
|
+
if not silent:
|
3642
|
+
print("Face.TShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
3643
|
+
return None
|
3644
|
+
t_shape_wire = Wire.TShape(origin=origin,
|
3645
|
+
width=width,
|
3646
|
+
length=length,
|
3647
|
+
a=a,
|
3648
|
+
b=b,
|
3649
|
+
flipHorizontal=flipHorizontal,
|
3650
|
+
flipVertical=flipVertical,
|
3651
|
+
direction=direction,
|
3652
|
+
placement=placement,
|
3653
|
+
tolerance=tolerance,
|
3654
|
+
silent=silent)
|
3655
|
+
return Face.ByWire(t_shape_wire, tolerance=tolerance, silent=silent)
|
3656
|
+
|
3196
3657
|
@staticmethod
|
3197
3658
|
def VertexByParameters(face, u: float = 0.5, v: float = 0.5):
|
3198
3659
|
"""
|
topologicpy/Wire.py
CHANGED
@@ -1421,6 +1421,157 @@ class Wire():
|
|
1421
1421
|
ch = Topology.Unflatten(ch, origin=origin, direction=normal)
|
1422
1422
|
return ch
|
1423
1423
|
|
1424
|
+
|
1425
|
+
@staticmethod
|
1426
|
+
def CShape(origin=None,
|
1427
|
+
width=1,
|
1428
|
+
length=1,
|
1429
|
+
a=0.25,
|
1430
|
+
b=0.25,
|
1431
|
+
c =0.25,
|
1432
|
+
flipHorizontal = False,
|
1433
|
+
flipVertical = False,
|
1434
|
+
direction=[0,0,1],
|
1435
|
+
placement="center",
|
1436
|
+
tolerance=0.0001,
|
1437
|
+
silent=False):
|
1438
|
+
"""
|
1439
|
+
Creates a C-shape.
|
1440
|
+
|
1441
|
+
Parameters
|
1442
|
+
----------
|
1443
|
+
origin : topologic_core.Vertex , optional
|
1444
|
+
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).
|
1445
|
+
width : float , optional
|
1446
|
+
The overall width of the C-shape. The default is 1.0.
|
1447
|
+
length : float , optional
|
1448
|
+
The overall length of the C-shape. The default is 1.0.
|
1449
|
+
a : float , optional
|
1450
|
+
The hortizontal thickness of the vertical arm of the C-shape. The default is 0.25.
|
1451
|
+
b : float , optional
|
1452
|
+
The vertical thickness of the lower horizontal arm of the C-shape. The default is 0.25.
|
1453
|
+
c : float , optional
|
1454
|
+
The vertical thickness of the upper horizontal arm of the C-shape. The default is 0.25.
|
1455
|
+
direction : list , optional
|
1456
|
+
The vector representing the up direction of the C-shape. The default is [0, 0, 1].
|
1457
|
+
placement : str , optional
|
1458
|
+
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".
|
1459
|
+
tolerance : float , optional
|
1460
|
+
The desired tolerance. The default is 0.0001.
|
1461
|
+
silent : bool , optional
|
1462
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
1463
|
+
|
1464
|
+
Returns
|
1465
|
+
-------
|
1466
|
+
topologic_core.Wire
|
1467
|
+
The created C-shape.
|
1468
|
+
|
1469
|
+
"""
|
1470
|
+
from topologicpy.Vertex import Vertex
|
1471
|
+
from topologicpy.Wire import Wire
|
1472
|
+
from topologicpy.Topology import Topology
|
1473
|
+
|
1474
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
1475
|
+
if not silent:
|
1476
|
+
print("Wire.CShape - Error: The width input parameter is not a valid number. Returning None.")
|
1477
|
+
return None
|
1478
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
1479
|
+
if not silent:
|
1480
|
+
print("Wire.CShape - Error: The length input parameter is not a valid number. Returning None.")
|
1481
|
+
return None
|
1482
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
1483
|
+
if not silent:
|
1484
|
+
print("Wire.CShape - Error: The a input parameter is not a valid number. Returning None.")
|
1485
|
+
return None
|
1486
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
1487
|
+
if not silent:
|
1488
|
+
print("Wire.CShape - Error: The b input parameter is not a valid number. Returning None.")
|
1489
|
+
return None
|
1490
|
+
if width <= tolerance:
|
1491
|
+
if not silent:
|
1492
|
+
print("Wire.CShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1493
|
+
return None
|
1494
|
+
if length <= tolerance:
|
1495
|
+
if not silent:
|
1496
|
+
print("Wire.CShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1497
|
+
return None
|
1498
|
+
if a <= tolerance:
|
1499
|
+
if not silent:
|
1500
|
+
print("Wire.CShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1501
|
+
return None
|
1502
|
+
if b <= tolerance:
|
1503
|
+
if not silent:
|
1504
|
+
print("Wire.CShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1505
|
+
return None
|
1506
|
+
if c <= tolerance:
|
1507
|
+
if not silent:
|
1508
|
+
print("Wire.CShape - Error: The c input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
1509
|
+
return None
|
1510
|
+
if a >= (width - tolerance):
|
1511
|
+
if not silent:
|
1512
|
+
print("Wire.CShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
1513
|
+
return None
|
1514
|
+
if b+c >= (length - tolerance):
|
1515
|
+
if not silent:
|
1516
|
+
print("Wire.CShape - Error: The b and c input parameters must add to less than the length input parameter. Returning None.")
|
1517
|
+
return None
|
1518
|
+
if origin == None:
|
1519
|
+
origin = Vertex.Origin()
|
1520
|
+
if not Topology.IsInstance(origin, "vertex"):
|
1521
|
+
if not silent:
|
1522
|
+
print("Wire.CShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
1523
|
+
return None
|
1524
|
+
if not isinstance(direction, list):
|
1525
|
+
if not silent:
|
1526
|
+
print("Wire.CShape - Error: The direction input parameter is not a valid list. Returning None.")
|
1527
|
+
return None
|
1528
|
+
if not len(direction) == 3:
|
1529
|
+
if not silent:
|
1530
|
+
print("Wire.CShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
1531
|
+
return None
|
1532
|
+
|
1533
|
+
# Define the vertices of the C-shape (counterclockwise)
|
1534
|
+
v1 = Vertex.Origin() # Base origin
|
1535
|
+
v2 = Vertex.ByCoordinates(width, 0)
|
1536
|
+
v3 = Vertex.ByCoordinates(width, b)
|
1537
|
+
v4 = Vertex.ByCoordinates(a, b)
|
1538
|
+
v5 = Vertex.ByCoordinates(a, length-c)
|
1539
|
+
v6 = Vertex.ByCoordinates(width, length-c)
|
1540
|
+
v7 = Vertex.ByCoordinates(width, length)
|
1541
|
+
v8 = Vertex.ByCoordinates(0, length)
|
1542
|
+
|
1543
|
+
# Create the C-shaped wire
|
1544
|
+
c_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8], close=True)
|
1545
|
+
c_shape = Topology.Translate(c_shape, -width/2, -length/2, 0)
|
1546
|
+
c_shape = Topology.Translate(c_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
|
1547
|
+
reverse = False
|
1548
|
+
if flipHorizontal == True:
|
1549
|
+
xScale = -1
|
1550
|
+
reverse = not reverse
|
1551
|
+
else:
|
1552
|
+
xScale = 1
|
1553
|
+
if flipVertical == True:
|
1554
|
+
yScale = -1
|
1555
|
+
reverse = not reverse
|
1556
|
+
else:
|
1557
|
+
yScale = 1
|
1558
|
+
if xScale == -1 or yScale == -1:
|
1559
|
+
c_shape = Topology.Scale(c_shape, x=xScale, y=yScale, z=1)
|
1560
|
+
if reverse == True:
|
1561
|
+
c_shape = Wire.Reverse(c_shape)
|
1562
|
+
if placement.lower() == "lowerleft":
|
1563
|
+
c_shape = Topology.Translate(c_shape, width/2, length/2, 0)
|
1564
|
+
elif placement.lower() == "upperright":
|
1565
|
+
c_shape = Topology.Translate(c_shape, -width/2, -length/2, 0)
|
1566
|
+
elif placement.lower() == "upperleft":
|
1567
|
+
c_shape = Topology.Translate(c_shape, width/2, -length/2, 0)
|
1568
|
+
elif placement.lower() == "lowerright":
|
1569
|
+
c_shape = Topology.Translate(c_shape, -width/2, length/2, 0)
|
1570
|
+
|
1571
|
+
if direction != [0, 0, 1]:
|
1572
|
+
c_shape = Topology.Orient(c_shape, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
1573
|
+
return c_shape
|
1574
|
+
|
1424
1575
|
@staticmethod
|
1425
1576
|
def Cycles(wire, maxVertices: int = 4, tolerance: float = 0.0001) -> list:
|
1426
1577
|
"""
|
@@ -2387,6 +2538,161 @@ class Wire():
|
|
2387
2538
|
return True
|
2388
2539
|
return False
|
2389
2540
|
|
2541
|
+
|
2542
|
+
@staticmethod
|
2543
|
+
def IShape(origin=None,
|
2544
|
+
width=1,
|
2545
|
+
length=1,
|
2546
|
+
a=0.25,
|
2547
|
+
b=0.25,
|
2548
|
+
c =0.25,
|
2549
|
+
flipHorizontal = False,
|
2550
|
+
flipVertical = False,
|
2551
|
+
direction=[0,0,1],
|
2552
|
+
placement="center",
|
2553
|
+
tolerance=0.0001,
|
2554
|
+
silent=False):
|
2555
|
+
"""
|
2556
|
+
Creates an I-shape.
|
2557
|
+
|
2558
|
+
Parameters
|
2559
|
+
----------
|
2560
|
+
origin : topologic_core.Vertex , optional
|
2561
|
+
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).
|
2562
|
+
width : float , optional
|
2563
|
+
The overall width of the I-shape. The default is 1.0.
|
2564
|
+
length : float , optional
|
2565
|
+
The overall length of the I-shape. The default is 1.0.
|
2566
|
+
a : float , optional
|
2567
|
+
The hortizontal thickness of the central vertical arm of the I-shape. The default is 0.25.
|
2568
|
+
b : float , optional
|
2569
|
+
The vertical thickness of the lower horizontal arm of the I-shape. The default is 0.25.
|
2570
|
+
c : float , optional
|
2571
|
+
The vertical thickness of the upper horizontal arm of the I-shape. The default is 0.25.
|
2572
|
+
direction : list , optional
|
2573
|
+
The vector representing the up direction of the I-shape. The default is [0, 0, 1].
|
2574
|
+
placement : str , optional
|
2575
|
+
The description of the placement of the origin of the I-shape. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
2576
|
+
tolerance : float , optional
|
2577
|
+
The desired tolerance. The default is 0.0001.
|
2578
|
+
silent : bool , optional
|
2579
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
2580
|
+
|
2581
|
+
Returns
|
2582
|
+
-------
|
2583
|
+
topologic_core.Wire
|
2584
|
+
The created I-shape.
|
2585
|
+
|
2586
|
+
"""
|
2587
|
+
from topologicpy.Vertex import Vertex
|
2588
|
+
from topologicpy.Wire import Wire
|
2589
|
+
from topologicpy.Topology import Topology
|
2590
|
+
|
2591
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
2592
|
+
if not silent:
|
2593
|
+
print("Wire.IShape - Error: The width input parameter is not a valid number. Returning None.")
|
2594
|
+
return None
|
2595
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
2596
|
+
if not silent:
|
2597
|
+
print("Wire.IShape - Error: The length input parameter is not a valid number. Returning None.")
|
2598
|
+
return None
|
2599
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
2600
|
+
if not silent:
|
2601
|
+
print("Wire.IShape - Error: The a input parameter is not a valid number. Returning None.")
|
2602
|
+
return None
|
2603
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
2604
|
+
if not silent:
|
2605
|
+
print("Wire.IShape - Error: The b input parameter is not a valid number. Returning None.")
|
2606
|
+
return None
|
2607
|
+
if width <= tolerance:
|
2608
|
+
if not silent:
|
2609
|
+
print("Wire.IShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2610
|
+
return None
|
2611
|
+
if length <= tolerance:
|
2612
|
+
if not silent:
|
2613
|
+
print("Wire.IShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2614
|
+
return None
|
2615
|
+
if a <= tolerance:
|
2616
|
+
if not silent:
|
2617
|
+
print("Wire.IShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2618
|
+
return None
|
2619
|
+
if b <= tolerance:
|
2620
|
+
if not silent:
|
2621
|
+
print("Wire.IShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2622
|
+
return None
|
2623
|
+
if c <= tolerance:
|
2624
|
+
if not silent:
|
2625
|
+
print("Wire.IShape - Error: The c input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2626
|
+
return None
|
2627
|
+
if a >= (width - tolerance):
|
2628
|
+
if not silent:
|
2629
|
+
print("Wire.IShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
2630
|
+
return None
|
2631
|
+
if b+c >= (length - tolerance):
|
2632
|
+
if not silent:
|
2633
|
+
print("Wire.IShape - Error: The b and c input parameters must add to less than the length input parameter. Returning None.")
|
2634
|
+
return None
|
2635
|
+
if origin == None:
|
2636
|
+
origin = Vertex.Origin()
|
2637
|
+
if not Topology.IsInstance(origin, "vertex"):
|
2638
|
+
if not silent:
|
2639
|
+
print("Wire.IShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
2640
|
+
return None
|
2641
|
+
if not isinstance(direction, list):
|
2642
|
+
if not silent:
|
2643
|
+
print("Wire.IShape - Error: The direction input parameter is not a valid list. Returning None.")
|
2644
|
+
return None
|
2645
|
+
if not len(direction) == 3:
|
2646
|
+
if not silent:
|
2647
|
+
print("Wire.IShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
2648
|
+
return None
|
2649
|
+
|
2650
|
+
# Define the vertices of the I-shape (counterclockwise)
|
2651
|
+
v1 = Vertex.Origin() # Base origin
|
2652
|
+
v2 = Vertex.ByCoordinates(width, 0)
|
2653
|
+
v3 = Vertex.ByCoordinates(width, b)
|
2654
|
+
v4 = Vertex.ByCoordinates(width/2+a/2, b)
|
2655
|
+
v5 = Vertex.ByCoordinates(width/2+a/2, length-c)
|
2656
|
+
v6 = Vertex.ByCoordinates(width, length-c)
|
2657
|
+
v7 = Vertex.ByCoordinates(width, length)
|
2658
|
+
v8 = Vertex.ByCoordinates(0, length)
|
2659
|
+
v9 = Vertex.ByCoordinates(0, length-c)
|
2660
|
+
v10 = Vertex.ByCoordinates(width/2-a/2, length-c)
|
2661
|
+
v11 = Vertex.ByCoordinates(width/2-a/2, b)
|
2662
|
+
v12 = Vertex.ByCoordinates(0,b)
|
2663
|
+
|
2664
|
+
# Create the I-shaped wire
|
2665
|
+
i_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12], close=True)
|
2666
|
+
i_shape = Topology.Translate(i_shape, -width/2, -length/2, 0)
|
2667
|
+
i_shape = Topology.Translate(i_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
|
2668
|
+
reverse = False
|
2669
|
+
if flipHorizontal == True:
|
2670
|
+
xScale = -1
|
2671
|
+
reverse = not reverse
|
2672
|
+
else:
|
2673
|
+
xScale = 1
|
2674
|
+
if flipVertical == True:
|
2675
|
+
yScale = -1
|
2676
|
+
reverse = not reverse
|
2677
|
+
else:
|
2678
|
+
yScale = 1
|
2679
|
+
if xScale == -1 or yScale == -1:
|
2680
|
+
i_shape = Topology.Scale(i_shape, x=xScale, y=yScale, z=1)
|
2681
|
+
if reverse == True:
|
2682
|
+
i_shape = Wire.Reverse(i_shape)
|
2683
|
+
if placement.lower() == "lowerleft":
|
2684
|
+
i_shape = Topology.Translate(i_shape, width/2, length/2, 0)
|
2685
|
+
elif placement.lower() == "upperright":
|
2686
|
+
i_shape = Topology.Translate(i_shape, -width/2, -length/2, 0)
|
2687
|
+
elif placement.lower() == "upperleft":
|
2688
|
+
i_shape = Topology.Translate(i_shape, width/2, -length/2, 0)
|
2689
|
+
elif placement.lower() == "lowerright":
|
2690
|
+
i_shape = Topology.Translate(i_shape, -width/2, length/2, 0)
|
2691
|
+
|
2692
|
+
if direction != [0, 0, 1]:
|
2693
|
+
i_shape = Topology.Orient(i_shape, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
2694
|
+
return i_shape
|
2695
|
+
|
2390
2696
|
@staticmethod
|
2391
2697
|
def Length(wire, mantissa: int = 6) -> float:
|
2392
2698
|
"""
|
@@ -2480,7 +2786,148 @@ class Wire():
|
|
2480
2786
|
vertices.append(Edge.VertexByParameter(edge, i*unitDistance))
|
2481
2787
|
vertices.append(Edge.EndVertex(edge))
|
2482
2788
|
return Wire.ByVertices(vertices)
|
2483
|
-
|
2789
|
+
|
2790
|
+
@staticmethod
|
2791
|
+
def LShape(origin=None,
|
2792
|
+
width=1,
|
2793
|
+
length=1,
|
2794
|
+
a=0.25,
|
2795
|
+
b=0.25,
|
2796
|
+
flipHorizontal = False,
|
2797
|
+
flipVertical = False,
|
2798
|
+
direction=[0,0,1],
|
2799
|
+
placement="center",
|
2800
|
+
tolerance=0.0001,
|
2801
|
+
silent=False):
|
2802
|
+
"""
|
2803
|
+
Creates an L-shape.
|
2804
|
+
|
2805
|
+
Parameters
|
2806
|
+
----------
|
2807
|
+
origin : topologic_core.Vertex , optional
|
2808
|
+
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).
|
2809
|
+
width : float , optional
|
2810
|
+
The overall width of the L-shape. The default is 1.0.
|
2811
|
+
length : float , optional
|
2812
|
+
The overall length of the L-shape. The default is 1.0.
|
2813
|
+
a : float , optional
|
2814
|
+
The hortizontal thickness of the vertical arm of the L-shape. The default is 0.25.
|
2815
|
+
b : float , optional
|
2816
|
+
The vertical thickness of the horizontal arm of the L-shape. The default is 0.25.
|
2817
|
+
direction : list , optional
|
2818
|
+
The vector representing the up direction of the L-shape. The default is [0, 0, 1].
|
2819
|
+
placement : str , optional
|
2820
|
+
The description of the placement of the origin of the L-shape. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
|
2821
|
+
tolerance : float , optional
|
2822
|
+
The desired tolerance. The default is 0.0001.
|
2823
|
+
silent : bool , optional
|
2824
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
2825
|
+
|
2826
|
+
Returns
|
2827
|
+
-------
|
2828
|
+
topologic_core.Wire
|
2829
|
+
The created L-shape.
|
2830
|
+
|
2831
|
+
"""
|
2832
|
+
from topologicpy.Vertex import Vertex
|
2833
|
+
from topologicpy.Wire import Wire
|
2834
|
+
from topologicpy.Topology import Topology
|
2835
|
+
|
2836
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
2837
|
+
if not silent:
|
2838
|
+
print("Wire.LShape - Error: The width input parameter is not a valid number. Returning None.")
|
2839
|
+
return None
|
2840
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
2841
|
+
if not silent:
|
2842
|
+
print("Wire.LShape - Error: The length input parameter is not a valid number. Returning None.")
|
2843
|
+
return None
|
2844
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
2845
|
+
if not silent:
|
2846
|
+
print("Wire.LShape - Error: The a input parameter is not a valid number. Returning None.")
|
2847
|
+
return None
|
2848
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
2849
|
+
if not silent:
|
2850
|
+
print("Wire.LShape - Error: The b input parameter is not a valid number. Returning None.")
|
2851
|
+
return None
|
2852
|
+
if width <= tolerance:
|
2853
|
+
if not silent:
|
2854
|
+
print("Wire.LShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2855
|
+
return None
|
2856
|
+
if length <= tolerance:
|
2857
|
+
if not silent:
|
2858
|
+
print("Wire.LShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2859
|
+
return None
|
2860
|
+
if a <= tolerance:
|
2861
|
+
if not silent:
|
2862
|
+
print("Wire.LShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2863
|
+
return None
|
2864
|
+
if b <= tolerance:
|
2865
|
+
if not silent:
|
2866
|
+
print("Wire.LShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
2867
|
+
return None
|
2868
|
+
if a >= (width - tolerance):
|
2869
|
+
if not silent:
|
2870
|
+
print("Wire.LShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
2871
|
+
return None
|
2872
|
+
if b >= (length - tolerance):
|
2873
|
+
if not silent:
|
2874
|
+
print("Wire.LShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
|
2875
|
+
return None
|
2876
|
+
if origin == None:
|
2877
|
+
origin = Vertex.Origin()
|
2878
|
+
if not Topology.IsInstance(origin, "vertex"):
|
2879
|
+
if not silent:
|
2880
|
+
print("Wire.LShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
2881
|
+
return None
|
2882
|
+
if not isinstance(direction, list):
|
2883
|
+
if not silent:
|
2884
|
+
print("Wire.LShape - Error: The direction input parameter is not a valid list. Returning None.")
|
2885
|
+
return None
|
2886
|
+
if not len(direction) == 3:
|
2887
|
+
if not silent:
|
2888
|
+
print("Wire.LShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
2889
|
+
return None
|
2890
|
+
|
2891
|
+
# Define the vertices of the L-shape (counterclockwise)
|
2892
|
+
v1 = Vertex.Origin() # Base origin
|
2893
|
+
v2 = Vertex.ByCoordinates(width, 0) # End of horizontal arm
|
2894
|
+
v3 = Vertex.ByCoordinates(width, b) # Top of horizontal arm
|
2895
|
+
v4 = Vertex.ByCoordinates(a, b) # Transition to vertical arm
|
2896
|
+
v5 = Vertex.ByCoordinates(a, length) # End of vertical arm
|
2897
|
+
v6 = Vertex.ByCoordinates(0, length) # Top of vertical arm
|
2898
|
+
|
2899
|
+
# Create the L-shaped wire
|
2900
|
+
l_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6], close=True)
|
2901
|
+
l_shape = Topology.Translate(l_shape, -width/2, -length/2, 0)
|
2902
|
+
l_shape = Topology.Translate(l_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
|
2903
|
+
reverse = False
|
2904
|
+
if flipHorizontal == True:
|
2905
|
+
xScale = -1
|
2906
|
+
reverse = not reverse
|
2907
|
+
else:
|
2908
|
+
xScale = 1
|
2909
|
+
if flipVertical == True:
|
2910
|
+
yScale = -1
|
2911
|
+
reverse = not reverse
|
2912
|
+
else:
|
2913
|
+
yScale = 1
|
2914
|
+
if xScale == -1 or yScale == -1:
|
2915
|
+
l_shape = Topology.Scale(l_shape, x=xScale, y=yScale, z=1)
|
2916
|
+
if reverse == True:
|
2917
|
+
l_shape = Wire.Reverse(l_shape)
|
2918
|
+
if placement.lower() == "lowerleft":
|
2919
|
+
l_shape = Topology.Translate(l_shape, width/2, length/2, 0)
|
2920
|
+
elif placement.lower() == "upperright":
|
2921
|
+
l_shape = Topology.Translate(l_shape, -width/2, -length/2, 0)
|
2922
|
+
elif placement.lower() == "upperleft":
|
2923
|
+
l_shape = Topology.Translate(l_shape, width/2, -length/2, 0)
|
2924
|
+
elif placement.lower() == "lowerright":
|
2925
|
+
l_shape = Topology.Translate(l_shape, -width/2, length/2, 0)
|
2926
|
+
|
2927
|
+
if direction != [0, 0, 1]:
|
2928
|
+
l_shape = Topology.Orient(l_shape, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
2929
|
+
return l_shape
|
2930
|
+
|
2484
2931
|
@staticmethod
|
2485
2932
|
def Miter(wire, offset: float = 0, offsetKey: str = None, tolerance: float = 0.0001, silent: bool = False):
|
2486
2933
|
"""
|
@@ -4064,6 +4511,150 @@ class Wire():
|
|
4064
4511
|
baseWire = Topology.Orient(baseWire, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
4065
4512
|
return baseWire
|
4066
4513
|
|
4514
|
+
|
4515
|
+
@staticmethod
|
4516
|
+
def TShape(origin=None,
|
4517
|
+
width=1,
|
4518
|
+
length=1,
|
4519
|
+
a=0.25,
|
4520
|
+
b=0.25,
|
4521
|
+
flipHorizontal = False,
|
4522
|
+
flipVertical = False,
|
4523
|
+
direction=[0,0,1],
|
4524
|
+
placement="center",
|
4525
|
+
tolerance=0.0001,
|
4526
|
+
silent=False):
|
4527
|
+
"""
|
4528
|
+
Creates a T-shape.
|
4529
|
+
|
4530
|
+
Parameters
|
4531
|
+
----------
|
4532
|
+
origin : topologic_core.Vertex , optional
|
4533
|
+
The location of the origin of the T-shape. The default is None which results in the L-shape being placed at (0, 0, 0).
|
4534
|
+
width : float , optional
|
4535
|
+
The overall width of the T-shape. The default is 1.0.
|
4536
|
+
length : float , optional
|
4537
|
+
The overall length of the T-shape. The default is 1.0.
|
4538
|
+
a : float , optional
|
4539
|
+
The hortizontal thickness of the vertical arm of the T-shape. The default is 0.5.
|
4540
|
+
b : float , optional
|
4541
|
+
The vertical thickness of the horizontal arm of the T-shape. The default is 0.5.
|
4542
|
+
direction : list , optional
|
4543
|
+
The vector representing the up direction of the T-shape. The default is [0, 0, 1].
|
4544
|
+
placement : str , optional
|
4545
|
+
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".
|
4546
|
+
tolerance : float , optional
|
4547
|
+
The desired tolerance. The default is 0.0001.
|
4548
|
+
silent : bool , optional
|
4549
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
4550
|
+
|
4551
|
+
Returns
|
4552
|
+
-------
|
4553
|
+
topologic_core.Wire
|
4554
|
+
The created T-shape.
|
4555
|
+
|
4556
|
+
"""
|
4557
|
+
from topologicpy.Vertex import Vertex
|
4558
|
+
from topologicpy.Wire import Wire
|
4559
|
+
from topologicpy.Topology import Topology
|
4560
|
+
|
4561
|
+
if not isinstance(width, int) and not isinstance(width, float):
|
4562
|
+
if not silent:
|
4563
|
+
print("Wire.LShape - Error: The width input parameter is not a valid number. Returning None.")
|
4564
|
+
return None
|
4565
|
+
if not isinstance(length, int) and not isinstance(length, float):
|
4566
|
+
if not silent:
|
4567
|
+
print("Wire.LShape - Error: The length input parameter is not a valid number. Returning None.")
|
4568
|
+
return None
|
4569
|
+
if not isinstance(a, int) and not isinstance(a, float):
|
4570
|
+
if not silent:
|
4571
|
+
print("Wire.LShape - Error: The a input parameter is not a valid number. Returning None.")
|
4572
|
+
return None
|
4573
|
+
if not isinstance(b, int) and not isinstance(b, float):
|
4574
|
+
if not silent:
|
4575
|
+
print("Wire.LShape - Error: The b input parameter is not a valid number. Returning None.")
|
4576
|
+
return None
|
4577
|
+
if width <= tolerance:
|
4578
|
+
if not silent:
|
4579
|
+
print("Wire.LShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
4580
|
+
return None
|
4581
|
+
if length <= tolerance:
|
4582
|
+
if not silent:
|
4583
|
+
print("Wire.LShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
4584
|
+
return None
|
4585
|
+
if a <= tolerance:
|
4586
|
+
if not silent:
|
4587
|
+
print("Wire.LShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
4588
|
+
return None
|
4589
|
+
if b <= tolerance:
|
4590
|
+
if not silent:
|
4591
|
+
print("Wire.LShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
|
4592
|
+
return None
|
4593
|
+
if a >= (width - tolerance):
|
4594
|
+
if not silent:
|
4595
|
+
print("Wire.LShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
|
4596
|
+
return None
|
4597
|
+
if b >= (length - tolerance):
|
4598
|
+
if not silent:
|
4599
|
+
print("Wire.LShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
|
4600
|
+
return None
|
4601
|
+
if origin == None:
|
4602
|
+
origin = Vertex.Origin()
|
4603
|
+
if not Topology.IsInstance(origin, "vertex"):
|
4604
|
+
if not silent:
|
4605
|
+
print("Wire.LShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
|
4606
|
+
return None
|
4607
|
+
if not isinstance(direction, list):
|
4608
|
+
if not silent:
|
4609
|
+
print("Wire.LShape - Error: The direction input parameter is not a valid list. Returning None.")
|
4610
|
+
return None
|
4611
|
+
if not len(direction) == 3:
|
4612
|
+
if not silent:
|
4613
|
+
print("Wire.LShape - Error: The direction input parameter is not a valid vector. Returning None.")
|
4614
|
+
return None
|
4615
|
+
|
4616
|
+
# Define the vertices of the T-shape (counterclockwise)
|
4617
|
+
v1 = Vertex.ByCoordinates(width/2-a/2, 0)
|
4618
|
+
v2 = Vertex.ByCoordinates(width/2+a/2, 0)
|
4619
|
+
v3 = Vertex.ByCoordinates(width/2+a/2, length-b)
|
4620
|
+
v4 = Vertex.ByCoordinates(width, length-b)
|
4621
|
+
v5 = Vertex.ByCoordinates(width, length)
|
4622
|
+
v6 = Vertex.ByCoordinates(0, length)
|
4623
|
+
v7 = Vertex.ByCoordinates(0, length-b)
|
4624
|
+
v8 = Vertex.ByCoordinates(width/2-a/2, length-b) # Top of vertical arm
|
4625
|
+
|
4626
|
+
# Create the T-shaped wire
|
4627
|
+
t_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8], close=True)
|
4628
|
+
t_shape = Topology.Translate(t_shape, -width/2, -length/2, 0)
|
4629
|
+
t_shape = Topology.Translate(t_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
|
4630
|
+
reverse = False
|
4631
|
+
if flipHorizontal == True:
|
4632
|
+
xScale = -1
|
4633
|
+
reverse = not reverse
|
4634
|
+
else:
|
4635
|
+
xScale = 1
|
4636
|
+
if flipVertical == True:
|
4637
|
+
yScale = -1
|
4638
|
+
reverse = not reverse
|
4639
|
+
else:
|
4640
|
+
yScale = 1
|
4641
|
+
if xScale == -1 or yScale == -1:
|
4642
|
+
t_shape = Topology.Scale(t_shape, x=xScale, y=yScale, z=1)
|
4643
|
+
if reverse == True:
|
4644
|
+
t_shape = Wire.Reverse(t_shape)
|
4645
|
+
if placement.lower() == "lowerleft":
|
4646
|
+
t_shape = Topology.Translate(t_shape, width/2, length/2, 0)
|
4647
|
+
elif placement.lower() == "upperright":
|
4648
|
+
t_shape = Topology.Translate(t_shape, -width/2, -length/2, 0)
|
4649
|
+
elif placement.lower() == "upperleft":
|
4650
|
+
t_shape = Topology.Translate(t_shape, width/2, -length/2, 0)
|
4651
|
+
elif placement.lower() == "lowerright":
|
4652
|
+
t_shape = Topology.Translate(t_shape, -width/2, length/2, 0)
|
4653
|
+
|
4654
|
+
if direction != [0, 0, 1]:
|
4655
|
+
t_shape = Topology.Orient(t_shape, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
4656
|
+
return t_shape
|
4657
|
+
|
4067
4658
|
@staticmethod
|
4068
4659
|
def VertexDistance(wire, vertex, origin= None, mantissa: int = 6, tolerance: float = 0.0001):
|
4069
4660
|
"""
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.94'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.94
|
4
4
|
Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
6
6
|
License: AGPL v3 License
|
@@ -10,7 +10,7 @@ topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
|
|
10
10
|
topologicpy/Dictionary.py,sha256=t0O7Du-iPq46FyKqZfcjHfsUK1E8GS_e67R2V5cpkbw,33186
|
11
11
|
topologicpy/Edge.py,sha256=KWOJCkLDwCWyZJ5MKwDhT5umWwCYBHtLOz6ulHrSOfY,67205
|
12
12
|
topologicpy/EnergyModel.py,sha256=AqTtmXE35SxvRXhG3vYAQd7GQDW-6HtjYPHua6ME4Eg,53762
|
13
|
-
topologicpy/Face.py,sha256=
|
13
|
+
topologicpy/Face.py,sha256=wczXpMcfub8Eb10lA4rrXksvi5YYCbRjBdp3lOTUwK0,172618
|
14
14
|
topologicpy/Graph.py,sha256=oA647-h9McD0jm2JDsLl0DV93k5ikk8tSGxptlRgL-s,455440
|
15
15
|
topologicpy/Grid.py,sha256=2s9cSlWldivn1i9EUz4OOokJyANveqmRe_vR93CAndI,18245
|
16
16
|
topologicpy/Helper.py,sha256=F3h4_qcOD_PHAoVe0tEbEE7_jYyVcaHjtwVs4QHOZuI,23978
|
@@ -26,11 +26,11 @@ topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
|
|
26
26
|
topologicpy/Topology.py,sha256=d99wryPPXvw7eRw12GVKV-DT6jhlmVq6GsMAjg-E-40,441693
|
27
27
|
topologicpy/Vector.py,sha256=Cl7besf20cAGmyNPh-9gbFAHnRU5ZWSMChJ3VyFIDs4,35416
|
28
28
|
topologicpy/Vertex.py,sha256=sYWTbAHqKGRUAJRCIUqrCO_xFhvsXK09Sx7E4dafPLQ,73754
|
29
|
-
topologicpy/Wire.py,sha256=
|
29
|
+
topologicpy/Wire.py,sha256=KDmnBzzM-9qNBt1vBPnj3t7g0y3R-sRFD2hz6zd769s,218625
|
30
30
|
topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
|
31
|
-
topologicpy/version.py,sha256=
|
32
|
-
topologicpy-0.7.
|
33
|
-
topologicpy-0.7.
|
34
|
-
topologicpy-0.7.
|
35
|
-
topologicpy-0.7.
|
36
|
-
topologicpy-0.7.
|
31
|
+
topologicpy/version.py,sha256=t2Dbe3Vr_6iOI6IajmMK9OGe8SMnlHO_9Zd7vUrwzAg,23
|
32
|
+
topologicpy-0.7.94.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
|
33
|
+
topologicpy-0.7.94.dist-info/METADATA,sha256=fh-3ZDxjF6yIejVjCdy7CR1S5prt8Ew8xS4KST5rZRw,10513
|
34
|
+
topologicpy-0.7.94.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
35
|
+
topologicpy-0.7.94.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
36
|
+
topologicpy-0.7.94.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|