topologicpy 0.8.8__py3-none-any.whl → 0.8.9__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 CHANGED
@@ -2352,6 +2352,128 @@ class Cell():
2352
2352
  volume = None
2353
2353
  return volume
2354
2354
 
2355
+ @staticmethod
2356
+ def Wedge(origin=None,
2357
+ width=1,
2358
+ length=1,
2359
+ height=1,
2360
+ flipHorizontal = False,
2361
+ flipVertical = False,
2362
+ direction=[0,0,1],
2363
+ placement="center",
2364
+ tolerance=0.0001,
2365
+ silent=False):
2366
+ """
2367
+ Creates a Wedge.
2368
+
2369
+ Parameters
2370
+ ----------
2371
+ origin : topologic_core.Vertex , optional
2372
+ The location of the origin of the Wedge. The default is None which results in the Wedge being placed at (0, 0, 0).
2373
+ width : float , optional
2374
+ The overall width of the Wedge. The default is 1.0.
2375
+ length : float , optional
2376
+ The overall length of the Wedge. The default is 1.0.
2377
+ height : float , optional
2378
+ The overall height of the Wedge. The default is 1.0.
2379
+ direction : list , optional
2380
+ The vector representing the up direction of the Wedge. The default is [0, 0, 1].
2381
+ placement : str , optional
2382
+ The description of the placement of the origin of the Wedge. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
2383
+ tolerance : float , optional
2384
+ The desired tolerance. The default is 0.0001.
2385
+ silent : bool , optional
2386
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
2387
+
2388
+ Returns
2389
+ -------
2390
+ topologic_core.Cell
2391
+ The created Wedge.
2392
+
2393
+ """
2394
+ from topologicpy.Vertex import Vertex
2395
+ from topologicpy.Face import Face
2396
+ from topologicpy.Topology import Topology
2397
+
2398
+ if not isinstance(width, int) and not isinstance(width, float):
2399
+ if not silent:
2400
+ print("Cell.Wedge - Error: The width input parameter is not a valid number. Returning None.")
2401
+ return None
2402
+ if not isinstance(length, int) and not isinstance(length, float):
2403
+ if not silent:
2404
+ print("Cell.Wedge - Error: The length input parameter is not a valid number. Returning None.")
2405
+ return None
2406
+ if not isinstance(height, int) and not isinstance(height, float):
2407
+ if not silent:
2408
+ print("Cell.Wedge - Error: The height input parameter is not a valid number. Returning None.")
2409
+ return None
2410
+ if width <= tolerance:
2411
+ if not silent:
2412
+ print("Cell.Wedge - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
2413
+ return None
2414
+ if length <= tolerance:
2415
+ if not silent:
2416
+ print("Cell.Wedge - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
2417
+ return None
2418
+ if height <= tolerance:
2419
+ if not silent:
2420
+ print("Cell.Wedge - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
2421
+ return None
2422
+ if origin == None:
2423
+ origin = Vertex.Origin()
2424
+ if not Topology.IsInstance(origin, "vertex"):
2425
+ if not silent:
2426
+ print("Cell.Wedge - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
2427
+ return None
2428
+ if not isinstance(direction, list):
2429
+ if not silent:
2430
+ print("Cell.Wedge - Error: The direction input parameter is not a valid list. Returning None.")
2431
+ return None
2432
+ if not len(direction) == 3:
2433
+ if not silent:
2434
+ print("Cell.Wedge - Error: The direction input parameter is not a valid vector. Returning None.")
2435
+ return None
2436
+
2437
+ # Define the vertices of the T-shape (counterclockwise)
2438
+ v1 = Vertex.ByCoordinates(0,0,0)
2439
+ v2 = Vertex.ByCoordinates(width, 0, 0)
2440
+ v3 = Vertex.ByCoordinates(width, length, 0)
2441
+ v4 = Vertex.ByCoordinates(0, length, 0)
2442
+ v5 = Vertex.ByCoordinates(0, length, height)
2443
+ v6 = Vertex.ByCoordinates(0, 0, height)
2444
+
2445
+ f1 = Face.ByVertices([v1, v2, v3, v4], tolerance=tolerance)
2446
+ f2 = Face.ByVertices([v1, v2, v6], tolerance=tolerance)
2447
+ f3 = Face.ByVertices([v4, v5, v3], tolerance=tolerance)
2448
+ f4 = Face.ByVertices([v1, v6, v5, v4], tolerance=tolerance)
2449
+ f5 = Face.ByVertices([v2, v3, v5, v6], tolerance=tolerance)
2450
+ cell = Cell.ByFaces([f1, f2, f3, f4, f5])
2451
+ cell = Topology.Translate(cell, -width/2, -length/2, -height/2)
2452
+ cell = Topology.Translate(cell, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
2453
+ if flipHorizontal == True:
2454
+ xScale = -1
2455
+ else:
2456
+ xScale = 1
2457
+ if flipVertical == True:
2458
+ zScale = -1
2459
+ else:
2460
+ zScale = 1
2461
+ if xScale == -1 or zScale == -1:
2462
+ cell = Topology.Scale(cell, origin=origin, x=xScale, y=1, z=zScale)
2463
+ if placement.lower() == "lowerleft":
2464
+ cell = Topology.Translate(cell, origin=origin, x=width/2, y=length/2, z=height/2)
2465
+ elif placement.lower() == "upperright":
2466
+ cell = Topology.Translate(cell, origin=origin, x=-width/2, y=-length/2, z=-height/2)
2467
+ elif placement.lower() == "upperleft":
2468
+ cell = Topology.Translate(cell, origin=origin, x=width/2, y=-length/2, z=-height/2)
2469
+ elif placement.lower() == "lowerright":
2470
+ cell = Topology.Translate(cell, origin=origin, x=-width/2, y=length/2, z=height/2)
2471
+
2472
+ if direction != [0, 0, 1]:
2473
+ cell = Topology.Orient(cell, origin=origin, dirA=[0, 0, 1], dirB=direction)
2474
+
2475
+ return cell
2476
+
2355
2477
  @staticmethod
2356
2478
  def Wires(cell) -> list:
2357
2479
  """
topologicpy/Vertex.py CHANGED
@@ -35,7 +35,7 @@ except:
35
35
 
36
36
  class Vertex():
37
37
  @staticmethod
38
- def AlignCoordinates(vertex, xList=None, yList=None, zList=None, transferDictionary=False, mantissa=6, silent=False):
38
+ def AlignCoordinates(vertex, xList: list = None, yList: list = None, zList: list = None, xEpsilon: float = 0.0001, yEpsilon: float = 0.0001, zEpsilon: float = 0.0001, transferDictionary: bool = False, mantissa: int = 6, silent: bool = False):
39
39
  """
40
40
  Aligns the coordinates of the input vertex with the list of x,y, and z coordinates.
41
41
 
@@ -49,6 +49,12 @@ class Vertex():
49
49
  The input numerical list of y-coordinates. The default is None.
50
50
  zList : list , optional
51
51
  The input numerical list of z-coordinates. The default is None.
52
+ xEpsilon : float , optional
53
+ The desired tolerance for the x coordinates. The default is 0.0001.
54
+ yEpsilon : float , optional
55
+ The desired tolerance for the y coordinates. The default is 0.0001.
56
+ zEpsilon : float , optional
57
+ The desired tolerance for the z coordinates. The default is 0.0001.
52
58
  transferDictionary : bool , optional
53
59
  if set to True, the dictionary of the input vertex is transferred to the new vertex.
54
60
  mantissa : int , optional
@@ -70,17 +76,24 @@ class Vertex():
70
76
  print("Vertex.AlignCoordinates - Error: The input vertex parameter is not a topologic vertex. Returning None.")
71
77
  return None
72
78
 
73
- closest_x, closest_y, closest_z = Vertex.Coordinates(vertex, mantissa=mantissa)
79
+ x, y, z = Vertex.Coordinates(vertex, mantissa=mantissa)
74
80
  if isinstance(xList, list):
75
81
  if len(xList) > 0:
76
- closest_x = xList[Helper.ClosestMatch(closest_x, xList)]
82
+ closest_x = round(xList[Helper.ClosestMatch(x, xList)], mantissa)
77
83
  if isinstance(yList, list):
78
84
  if len(yList) > 0:
79
- closest_y = yList[Helper.ClosestMatch(closest_y, yList)]
85
+ closest_y = round(yList[Helper.ClosestMatch(y, yList)], mantissa)
80
86
  if isinstance(zList, list):
81
87
  if len(zList) > 0:
82
- closest_z = zList[Helper.ClosestMatch(closest_z, zList)]
83
- return_vertex = Vertex.ByCoordinates(closest_x, closest_y, closest_z)
88
+ closest_z = round(zList[Helper.ClosestMatch(z, zList)], mantissa)
89
+
90
+ if abs(x - closest_x) < xEpsilon:
91
+ x = closest_x
92
+ if abs(y - closest_y) < yEpsilon:
93
+ y = closest_y
94
+ if abs(z - closest_z) < zEpsilon:
95
+ z = closest_z
96
+ return_vertex = Vertex.ByCoordinates(x, y, z)
84
97
  if transferDictionary == True:
85
98
  return_vertex = Topology.SetDictionary(return_vertex, Topology.Dictionary(vertex), silent=silent)
86
99
  return return_vertex
topologicpy/Wire.py CHANGED
@@ -51,7 +51,6 @@ class Wire():
51
51
 
52
52
  """
53
53
  from topologicpy.Vertex import Vertex
54
- from topologicpy.Wire import Wire
55
54
  from topologicpy.Topology import Topology
56
55
  import numpy as np
57
56
 
@@ -183,7 +182,6 @@ class Wire():
183
182
 
184
183
  """
185
184
  from topologicpy.Edge import Edge
186
- from topologicpy.Wire import Wire
187
185
  from topologicpy.Topology import Topology
188
186
 
189
187
  if not Topology.IsInstance(edge, "Edge"):
@@ -233,7 +231,6 @@ class Wire():
233
231
 
234
232
  """
235
233
  from topologicpy.Vertex import Vertex
236
- from topologicpy.Wire import Wire
237
234
  from topologicpy.Face import Face
238
235
  from topologicpy.Topology import Topology
239
236
  from topologicpy.Dictionary import Dictionary
@@ -453,7 +450,6 @@ class Wire():
453
450
  from topologicpy.Edge import Edge
454
451
  from topologicpy.Face import Face
455
452
  from topologicpy.Dictionary import Dictionary
456
- from topologicpy.Wire import Wire
457
453
  from topologicpy.Cluster import Cluster
458
454
  from topologicpy.Topology import Topology
459
455
  from topologicpy.Vector import Vector
@@ -724,7 +720,6 @@ class Wire():
724
720
  The created wire.
725
721
 
726
722
  """
727
- from topologicpy.Wire import Wire
728
723
  from topologicpy.Face import Face
729
724
  from topologicpy.Topology import Topology
730
725
  from topologicpy.Dictionary import Dictionary
@@ -1472,7 +1467,6 @@ class Wire():
1472
1467
 
1473
1468
  """
1474
1469
  from topologicpy.Vertex import Vertex
1475
- from topologicpy.Wire import Wire
1476
1470
  from topologicpy.Topology import Topology
1477
1471
 
1478
1472
  if not isinstance(width, int) and not isinstance(width, float):
@@ -1595,7 +1589,7 @@ class Wire():
1595
1589
  else:
1596
1590
  yScale = 1
1597
1591
  if xScale == -1 or yScale == -1:
1598
- cross_shape = Topology.Scale(cross_shape, x=xScale, y=yScale, z=1)
1592
+ cross_shape = Topology.Scale(cross_shape, origin=origin, x=xScale, y=yScale, z=1)
1599
1593
  if reverse == True:
1600
1594
  cross_shape = Wire.Reverse(cross_shape)
1601
1595
  if placement.lower() == "lowerleft":
@@ -1657,7 +1651,6 @@ class Wire():
1657
1651
 
1658
1652
  """
1659
1653
  from topologicpy.Vertex import Vertex
1660
- from topologicpy.Wire import Wire
1661
1654
  from topologicpy.Topology import Topology
1662
1655
 
1663
1656
  if not isinstance(width, int) and not isinstance(width, float):
@@ -1745,7 +1738,7 @@ class Wire():
1745
1738
  else:
1746
1739
  yScale = 1
1747
1740
  if xScale == -1 or yScale == -1:
1748
- c_shape = Topology.Scale(c_shape, x=xScale, y=yScale, z=1)
1741
+ c_shape = Topology.Scale(c_shape, origin=origin, x=xScale, y=yScale, z=1)
1749
1742
  if reverse == True:
1750
1743
  c_shape = Wire.Reverse(c_shape)
1751
1744
  if placement.lower() == "lowerleft":
@@ -2287,7 +2280,6 @@ class Wire():
2287
2280
  import math
2288
2281
  from topologicpy.Vertex import Vertex
2289
2282
  from topologicpy.Edge import Edge
2290
- from topologicpy.Wire import Wire
2291
2283
  from topologicpy.Face import Face
2292
2284
  from topologicpy.Topology import Topology
2293
2285
  from topologicpy.Vector import Vector
@@ -2777,7 +2769,6 @@ class Wire():
2777
2769
 
2778
2770
  """
2779
2771
  from topologicpy.Vertex import Vertex
2780
- from topologicpy.Wire import Wire
2781
2772
  from topologicpy.Topology import Topology
2782
2773
 
2783
2774
  if not isinstance(width, int) and not isinstance(width, float):
@@ -2869,7 +2860,7 @@ class Wire():
2869
2860
  else:
2870
2861
  yScale = 1
2871
2862
  if xScale == -1 or yScale == -1:
2872
- i_shape = Topology.Scale(i_shape, x=xScale, y=yScale, z=1)
2863
+ i_shape = Topology.Scale(i_shape, origin=origin, x=xScale, y=yScale, z=1)
2873
2864
  if reverse == True:
2874
2865
  i_shape = Wire.Reverse(i_shape)
2875
2866
  if placement.lower() == "lowerleft":
@@ -3024,7 +3015,6 @@ class Wire():
3024
3015
 
3025
3016
  """
3026
3017
  from topologicpy.Vertex import Vertex
3027
- from topologicpy.Wire import Wire
3028
3018
  from topologicpy.Topology import Topology
3029
3019
 
3030
3020
  if not isinstance(width, int) and not isinstance(width, float):
@@ -3106,7 +3096,7 @@ class Wire():
3106
3096
  else:
3107
3097
  yScale = 1
3108
3098
  if xScale == -1 or yScale == -1:
3109
- l_shape = Topology.Scale(l_shape, x=xScale, y=yScale, z=1)
3099
+ l_shape = Topology.Scale(l_shape, origin=origing, x=xScale, y=yScale, z=1)
3110
3100
  if reverse == True:
3111
3101
  l_shape = Wire.Reverse(l_shape)
3112
3102
  if placement.lower() == "lowerleft":
@@ -3163,9 +3153,7 @@ class Wire():
3163
3153
  import math
3164
3154
  from topologicpy.Vertex import Vertex
3165
3155
  from topologicpy.Edge import Edge
3166
- from topologicpy.Wire import Wire
3167
3156
  from topologicpy.Face import Face
3168
- from topologicpy.Cluster import Cluster
3169
3157
  from topologicpy.Topology import Topology
3170
3158
  from topologicpy.Vector import Vector
3171
3159
  from topologicpy.Dictionary import Dictionary
@@ -3632,7 +3620,6 @@ class Wire():
3632
3620
  """
3633
3621
  from topologicpy.Vertex import Vertex
3634
3622
  from topologicpy.Edge import Edge
3635
- from topologicpy.Wire import Wire
3636
3623
  from topologicpy.Cluster import Cluster
3637
3624
  from topologicpy.Topology import Topology
3638
3625
 
@@ -3727,7 +3714,6 @@ class Wire():
3727
3714
  """
3728
3715
  from topologicpy.Vertex import Vertex
3729
3716
  from topologicpy.Edge import Edge
3730
- from topologicpy.Wire import Wire
3731
3717
  from topologicpy.Cluster import Cluster
3732
3718
  from topologicpy.Topology import Topology
3733
3719
  import inspect
@@ -4537,7 +4523,6 @@ class Wire():
4537
4523
  return x*radius, y*radius
4538
4524
 
4539
4525
  from topologicpy.Vertex import Vertex
4540
- from topologicpy.Wire import Wire
4541
4526
  from topologicpy.Topology import Topology
4542
4527
 
4543
4528
  if not Topology.IsInstance(origin, "Vertex"):
@@ -4788,7 +4773,6 @@ class Wire():
4788
4773
  baseWire = Topology.Orient(baseWire, origin=origin, dirA=[0, 0, 1], dirB=direction)
4789
4774
  return baseWire
4790
4775
 
4791
-
4792
4776
  @staticmethod
4793
4777
  def TShape(origin=None,
4794
4778
  width=1,
@@ -4832,7 +4816,6 @@ class Wire():
4832
4816
 
4833
4817
  """
4834
4818
  from topologicpy.Vertex import Vertex
4835
- from topologicpy.Wire import Wire
4836
4819
  from topologicpy.Topology import Topology
4837
4820
 
4838
4821
  if not isinstance(width, int) and not isinstance(width, float):
@@ -4916,7 +4899,7 @@ class Wire():
4916
4899
  else:
4917
4900
  yScale = 1
4918
4901
  if xScale == -1 or yScale == -1:
4919
- t_shape = Topology.Scale(t_shape, x=xScale, y=yScale, z=1)
4902
+ t_shape = Topology.Scale(t_shape, origin=origin, x=xScale, y=yScale, z=1)
4920
4903
  if reverse == True:
4921
4904
  t_shape = Wire.Reverse(t_shape)
4922
4905
  if placement.lower() == "lowerleft":
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.8.8'
1
+ __version__ = '0.8.9'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: topologicpy
3
- Version: 0.8.8
3
+ Version: 0.8.9
4
4
  Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  License: AGPL v3 License
@@ -1,7 +1,7 @@
1
1
  topologicpy/ANN.py,sha256=m_WxD1lgQqDhUpaM20Lia6TmJACDYaAE96wigsi-99U,47932
2
2
  topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
3
3
  topologicpy/BVH.py,sha256=mKVCAu9K8qzcWXtPDVH5usXZV1DNNNJl4n3rU5Lh1ZM,12931
4
- topologicpy/Cell.py,sha256=o5CxsBXxtnV439I4f8VMUoDMVwO5o3q0lHinHHMSmFg,108571
4
+ topologicpy/Cell.py,sha256=9bF1pS0oyYmUzyXZ4zAQrwJPrQ7KeHRAo8OZudp_2Kg,114341
5
5
  topologicpy/CellComplex.py,sha256=-s8RKGa2H1eqLO7g6qyQvvuFMFJ0aIgXvIr9kOVgpjA,51608
6
6
  topologicpy/Cluster.py,sha256=o5jdMRpcGfSGGiXQdFg-e9XcnBF5AqTj3xb1nSpwJWE,58606
7
7
  topologicpy/Color.py,sha256=q9xsGmxFMz7sQKmygwSVS12GaTRB-OT0-_i6t3-cthE,20307
@@ -25,12 +25,12 @@ topologicpy/Speckle.py,sha256=AlsGlSDuKRtX5jhVsPNSSjjbZis079HbUchDH_5RJmE,18187
25
25
  topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
26
26
  topologicpy/Topology.py,sha256=qw64d3Ct6u7W8Fy_-JIg3_xsyOzDIQ1hdnpxF2p_wH4,463931
27
27
  topologicpy/Vector.py,sha256=3gW0Y7mTcpc6ctjSfRWQXGKjIyHASKrMyIyPDT0kO2E,39573
28
- topologicpy/Vertex.py,sha256=tv6C-rbuNgXHDGgVLT5fbalynLdXqlUuiCDKtkeQ0vk,77814
29
- topologicpy/Wire.py,sha256=Gl3Jpygwp8775SG57ua5r5ffTHcN4FOAkeI87yP1cok,234001
28
+ topologicpy/Vertex.py,sha256=8_7iGDPlNWsiNfxcuNRO5u7P07i1Y58Gprw7KtA2Wmw,78505
29
+ topologicpy/Wire.py,sha256=Pt2li4cZ1omQKcMDCOqdB01ZKqjA4KBR0K3lGNVUoDs,233398
30
30
  topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
31
- topologicpy/version.py,sha256=ysM7ZSdOuCpaNFiqoGIRai1zq8iwLDlTTCvJsGJ1_eA,22
32
- topologicpy-0.8.8.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
- topologicpy-0.8.8.dist-info/METADATA,sha256=h8t8ZxpBukHW7YQu9muct8f09ZIkb_tZFhP_IPWtc4c,10512
34
- topologicpy-0.8.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
- topologicpy-0.8.8.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.8.8.dist-info/RECORD,,
31
+ topologicpy/version.py,sha256=NlRwwFdz-gLvpPJ1P15liW62rdqtILNRJEm3y_yv3z8,22
32
+ topologicpy-0.8.9.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
+ topologicpy-0.8.9.dist-info/METADATA,sha256=cFgD49CaDIZRj1a8FDEMkyw2dINg6WQZxTqbp55p--4,10512
34
+ topologicpy-0.8.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
+ topologicpy-0.8.9.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
+ topologicpy-0.8.9.dist-info/RECORD,,