topologicpy 0.8.0__py3-none-any.whl → 0.8.2__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/Wire.py CHANGED
@@ -147,7 +147,7 @@ class Wire():
147
147
  vertices = []
148
148
  for arc_point in arc_points:
149
149
  vertices.append(Vertex.ByCoordinates(list(arc_point)))
150
- arc = Wire.ByVertices(vertices, close=False)
150
+ arc = Wire.ByVertices(vertices, close=False, tolerance=tolerance)
151
151
  if not Topology.IsInstance(arc, "Wire"):
152
152
  if not silent:
153
153
  print("Wire.Arc - Error: Could not create an arc. Returning None.")
@@ -271,7 +271,7 @@ class Wire():
271
271
  if result == True:
272
272
  print("Wire.BoundingRectangle - Error: Could not find three vertices that are not colinear within 30 seconds. Returning None.")
273
273
  return None
274
- w = Wire.ByVertices(vList)
274
+ w = Wire.ByVertices(vList, close=True, tolerance=tolerance)
275
275
  if not Topology.IsInstance(w, "Wire"):
276
276
  print("Wire.BoundingRectangle - Error: Could not create wire from three vertices. Returning None.")
277
277
  return None
@@ -472,7 +472,7 @@ class Wire():
472
472
  fac = 1
473
473
  origin = Topology.Centroid(wire)
474
474
  temp_vertices = [Topology.Vertices(wire)[0], Topology.Vertices(wire)[1], Topology.Centroid(wire)]
475
- temp_face = Face.ByWire(Wire.ByVertices(temp_vertices, close=True), silent=silent)
475
+ temp_face = Face.ByWire(Wire.ByVertices(temp_vertices, close=True, tolerance=tolerance), silent=silent)
476
476
  temp_normal = Face.Normal(temp_face)
477
477
  flat_wire = Topology.Flatten(wire, direction=temp_normal, origin=origin)
478
478
  normal = Face.Normal(temp_face)
@@ -602,7 +602,7 @@ class Wire():
602
602
  # #w_e = Edge.SetLength(w_e, Edge.Length(w_e)+(2*epsilon), bothSides = True)
603
603
  # wire_edges.append(w_e)
604
604
 
605
- return_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire))
605
+ return_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire), tolerance=tolerance)
606
606
  #wire_edges = Topology.Edges(wire_edges)
607
607
  wire_edges = [Edge.SetLength(w_e, Edge.Length(w_e)+(2*epsilon), bothSides=True) for w_e in Topology.Edges(return_wire)]
608
608
  return_wire_edges = Topology.Edges(return_wire)
@@ -895,7 +895,7 @@ class Wire():
895
895
  return wire
896
896
 
897
897
  @staticmethod
898
- def ByVerticesCluster(cluster, close: bool = True):
898
+ def ByVerticesCluster(cluster, close: bool = True, tolerance: float = 0.0001):
899
899
  """
900
900
  Creates a wire from the input cluster of vertices.
901
901
 
@@ -905,6 +905,8 @@ class Wire():
905
905
  the input cluster of vertices.
906
906
  close : bool , optional
907
907
  If True the last vertex will be connected to the first vertex to close the wire. The default is True.
908
+ tolerance : float , optional
909
+ The desired tolerance. The default is 0.0001
908
910
 
909
911
  Returns
910
912
  -------
@@ -917,7 +919,7 @@ class Wire():
917
919
  if not Topology.IsInstance(cluster, "Cluster"):
918
920
  return None
919
921
  vertices = Topology.Vertices(cluster)
920
- return Wire.ByVertices(vertices, close)
922
+ return Wire.ByVertices(vertices, close=close, tolerance=tolerance)
921
923
 
922
924
  @staticmethod
923
925
  def Circle(origin= None, radius: float = 0.5, sides: int = 16, fromAngle: float = 0.0, toAngle: float = 360.0, close: bool = True, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001):
@@ -990,9 +992,9 @@ class Wire():
990
992
  baseV.append(Vertex.ByCoordinates(x, y, z))
991
993
 
992
994
  if angleRange == 360:
993
- baseWire = Wire.ByVertices(baseV[::-1], close=False) #reversing the list so that the normal points up in Blender
995
+ baseWire = Wire.ByVertices(baseV[::-1], close=False, tolerance=tolerance) #reversing the list so that the normal points up in Blender
994
996
  else:
995
- baseWire = Wire.ByVertices(baseV[::-1], close=close) #reversing the list so that the normal points up in Blender
997
+ baseWire = Wire.ByVertices(baseV[::-1], close=close, tolerance=tolerance) #reversing the list so that the normal points up in Blender
996
998
 
997
999
  if placement.lower() == "lowerleft":
998
1000
  baseWire = Topology.Translate(baseWire, radius, radius, 0)
@@ -1268,7 +1270,7 @@ class Wire():
1268
1270
  while not Topology.IsInstance(f, "Face"):
1269
1271
  vertices = Topology.SubTopologies(topology=topology, subTopologyType="vertex")
1270
1272
  v = sample(vertices, 3)
1271
- w = Wire.ByVertices(v)
1273
+ w = Wire.ByVertices(v, tolerance=tolerance)
1272
1274
  f = Face.ByWire(w, tolerance=tolerance, silent=True)
1273
1275
  if not f == None:
1274
1276
  origin = Topology.Centroid(f)
@@ -1283,7 +1285,7 @@ class Wire():
1283
1285
  hull_vertices = []
1284
1286
  for p in hull:
1285
1287
  hull_vertices.append(Vertex.ByCoordinates(p[0], p[1], 0))
1286
- ch = Wire.ByVertices(hull_vertices, close=True)
1288
+ ch = Wire.ByVertices(hull_vertices, close=True, tolerance=tolerance)
1287
1289
  ch = Topology.Unflatten(ch, origin=origin, direction=normal)
1288
1290
  return ch
1289
1291
 
@@ -1403,7 +1405,7 @@ class Wire():
1403
1405
  while not Topology.IsInstance(f, "Face"):
1404
1406
  vertices = Topology.SubTopologies(topology=topology, subTopologyType="vertex")
1405
1407
  v = sample(vertices, 3)
1406
- w = Wire.ByVertices(v)
1408
+ w = Wire.ByVertices(v, tolerance=tolerance)
1407
1409
  f = Face.ByWire(w, tolerance=tolerance)
1408
1410
  origin = Topology.Centroid(f)
1409
1411
  normal = Face.Normal(f, mantissa=mantissa)
@@ -1417,11 +1419,198 @@ class Wire():
1417
1419
  hull_vertices = []
1418
1420
  for p in hull:
1419
1421
  hull_vertices.append(Vertex.ByCoordinates(points[p][0], points[p][1], 0))
1420
- ch = Wire.ByVertices(hull_vertices)
1422
+ ch = Wire.ByVertices(hull_vertices, tolerance=tolerance)
1421
1423
  ch = Topology.Unflatten(ch, origin=origin, direction=normal)
1422
1424
  return ch
1423
1425
 
1426
+ @staticmethod
1427
+ def CrossShape(origin=None,
1428
+ width=1,
1429
+ length=1,
1430
+ a=0.25,
1431
+ b=0.25,
1432
+ c=None,
1433
+ d=None,
1434
+ flipHorizontal = False,
1435
+ flipVertical = False,
1436
+ direction=[0,0,1],
1437
+ placement="center",
1438
+ tolerance=0.0001,
1439
+ silent=False):
1440
+ """
1441
+ Creates a Cross-shape.
1442
+
1443
+ Parameters
1444
+ ----------
1445
+ origin : topologic_core.Vertex , optional
1446
+ 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).
1447
+ width : float , optional
1448
+ The overall width of the Cross-shape. The default is 1.0.
1449
+ length : float , optional
1450
+ The overall length of the Cross-shape. The default is 1.0.
1451
+ a : float , optional
1452
+ The hortizontal thickness of the vertical arm of the Cross-shape. The default is 0.25.
1453
+ b : float , optional
1454
+ The vertical thickness of the horizontal arm of the Cross-shape. The default is 0.25.
1455
+ c : float , optional
1456
+ 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.
1457
+ d : float , optional
1458
+ 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.
1459
+ direction : list , optional
1460
+ The vector representing the up direction of the Cross-shape. The default is [0, 0, 1].
1461
+ placement : str , optional
1462
+ 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".
1463
+ tolerance : float , optional
1464
+ The desired tolerance. The default is 0.0001.
1465
+ silent : bool , optional
1466
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1467
+
1468
+ Returns
1469
+ -------
1470
+ topologic_core.Wire
1471
+ The created Cross-shape.
1472
+
1473
+ """
1474
+ from topologicpy.Vertex import Vertex
1475
+ from topologicpy.Wire import Wire
1476
+ from topologicpy.Topology import Topology
1477
+
1478
+ if not isinstance(width, int) and not isinstance(width, float):
1479
+ if not silent:
1480
+ print("Wire.CrossShape - Error: The width input parameter is not a valid number. Returning None.")
1481
+ return None
1482
+ if not isinstance(length, int) and not isinstance(length, float):
1483
+ if not silent:
1484
+ print("Wire.CrossShape - Error: The length input parameter is not a valid number. Returning None.")
1485
+ return None
1486
+ if not isinstance(a, int) and not isinstance(a, float):
1487
+ if not silent:
1488
+ print("Wire.CrossShape - Error: The a input parameter is not a valid number. Returning None.")
1489
+ return None
1490
+ if not isinstance(b, int) and not isinstance(b, float):
1491
+ if not silent:
1492
+ print("Wire.CrossShape - Error: The b input parameter is not a valid number. Returning None.")
1493
+ return None
1494
+ if c == None:
1495
+ c = width/2
1496
+ if d == None:
1497
+ d = length/2
1498
+ if not isinstance(c, int) and not isinstance(c, float):
1499
+ if not silent:
1500
+ print("Wire.CrossShape - Error: The c input parameter is not a valid number. Returning None.")
1501
+ return None
1502
+ if not isinstance(d, int) and not isinstance(d, float):
1503
+ if not silent:
1504
+ print("Wire.CrossShape - Error: The d input parameter is not a valid number. Returning None.")
1505
+ if width <= tolerance:
1506
+ if not silent:
1507
+ print("Wire.CrossShape - Error: The width input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
1508
+ return None
1509
+ if length <= tolerance:
1510
+ if not silent:
1511
+ print("Wire.CrossShape - Error: The length input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
1512
+ return None
1513
+ if a <= tolerance:
1514
+ if not silent:
1515
+ print("Wire.CrossShape - Error: The a input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
1516
+ return None
1517
+ if b <= tolerance:
1518
+ if not silent:
1519
+ print("Wire.CrossShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
1520
+ return None
1521
+ if c <= tolerance:
1522
+ if not silent:
1523
+ print("Wire.CrossShape - Error: The c input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
1524
+ return None
1525
+ if d <= tolerance:
1526
+ if not silent:
1527
+ print("Wire.CrossShape - Error: The d input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
1528
+ return None
1529
+ if a >= (width - tolerance*2):
1530
+ if not silent:
1531
+ print("Wire.CrossShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
1532
+ return None
1533
+ if b >= (length - tolerance*2):
1534
+ if not silent:
1535
+ print("Wire.CrossShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
1536
+ return None
1537
+ if c <= (tolerance + a/2):
1538
+ if not silent:
1539
+ print("Wire.CrossShape - Error: The c input parameter must be more than half the a input parameter. Returning None.")
1540
+ return None
1541
+ if d <= (tolerance + b/2):
1542
+ if not silent:
1543
+ print("Wire.CrossShape - Error: The c input parameter must be more than half the b input parameter. Returning None.")
1544
+ return None
1545
+ if c >= (width - tolerance - a/2):
1546
+ if not silent:
1547
+ print("Wire.CrossShape - Error: The c input parameter must be less than the width minus half the a input parameter. Returning None.")
1548
+ return None
1549
+ if d >= (length - tolerance - b/2):
1550
+ if not silent:
1551
+ print("Wire.CrossShape - Error: The c input parameter must be less than the width minus half the b input parameter. Returning None.")
1552
+ return None
1553
+ if origin == None:
1554
+ origin = Vertex.Origin()
1555
+ if not Topology.IsInstance(origin, "vertex"):
1556
+ if not silent:
1557
+ print("Wire.CrossShape - Error: The origin input parameter is not a valid topologic vertex. Returning None.")
1558
+ return None
1559
+ if not isinstance(direction, list):
1560
+ if not silent:
1561
+ print("Wire.CrossShape - Error: The direction input parameter is not a valid list. Returning None.")
1562
+ return None
1563
+ if not len(direction) == 3:
1564
+ if not silent:
1565
+ print("Wire.CrossShape - Error: The direction input parameter is not a valid vector. Returning None.")
1566
+ return None
1567
+
1568
+ # Define the vertices of the Cross-shape (counterclockwise)
1569
+ v1 = Vertex.ByCoordinates(c-a/2, 0)
1570
+ v2 = Vertex.ByCoordinates(c+a/2, 0)
1571
+ v3 = Vertex.ByCoordinates(c+a/2, d-b/2)
1572
+ v4 = Vertex.ByCoordinates(width, d-b/2)
1573
+ v5 = Vertex.ByCoordinates(width, d+b/2)
1574
+ v6 = Vertex.ByCoordinates(c+a/2, d+b/2)
1575
+ v7 = Vertex.ByCoordinates(c+a/2, length)
1576
+ v8 = Vertex.ByCoordinates(c-a/2, length) # Top of vertical arm
1577
+ v9 = Vertex.ByCoordinates(c-a/2, d+b/2) # Top of vertical arm
1578
+ v10 = Vertex.ByCoordinates(0, d+b/2) # Top of vertical arm
1579
+ v11 = Vertex.ByCoordinates(0, d-b/2) # Top of vertical arm
1580
+ v12 = Vertex.ByCoordinates(c-a/2, d-b/2) # Top of vertical arm
1424
1581
 
1582
+ # Create the T-shaped wire
1583
+ cross_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8, v9,v10, v11, v12], close=True, tolerance=tolerance)
1584
+ cross_shape = Topology.Translate(cross_shape, -width/2, -length/2, 0)
1585
+ cross_shape = Topology.Translate(cross_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
1586
+ reverse = False
1587
+ if flipHorizontal == True:
1588
+ xScale = -1
1589
+ reverse = not reverse
1590
+ else:
1591
+ xScale = 1
1592
+ if flipVertical == True:
1593
+ yScale = -1
1594
+ reverse = not reverse
1595
+ else:
1596
+ yScale = 1
1597
+ if xScale == -1 or yScale == -1:
1598
+ cross_shape = Topology.Scale(cross_shape, x=xScale, y=yScale, z=1)
1599
+ if reverse == True:
1600
+ cross_shape = Wire.Reverse(cross_shape)
1601
+ if placement.lower() == "lowerleft":
1602
+ cross_shape = Topology.Translate(cross_shape, width/2, length/2, 0)
1603
+ elif placement.lower() == "upperright":
1604
+ cross_shape = Topology.Translate(cross_shape, -width/2, -length/2, 0)
1605
+ elif placement.lower() == "upperleft":
1606
+ cross_shape = Topology.Translate(cross_shape, width/2, -length/2, 0)
1607
+ elif placement.lower() == "lowerright":
1608
+ cross_shape = Topology.Translate(cross_shape, -width/2, length/2, 0)
1609
+
1610
+ if direction != [0, 0, 1]:
1611
+ cross_shape = Topology.Orient(cross_shape, origin=origin, dirA=[0, 0, 1], dirB=direction)
1612
+ return cross_shape
1613
+
1425
1614
  @staticmethod
1426
1615
  def CShape(origin=None,
1427
1616
  width=1,
@@ -1541,7 +1730,7 @@ class Wire():
1541
1730
  v8 = Vertex.ByCoordinates(0, length)
1542
1731
 
1543
1732
  # Create the C-shaped wire
1544
- c_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8], close=True)
1733
+ c_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8], close=True, tolerance=tolerance)
1545
1734
  c_shape = Topology.Translate(c_shape, -width/2, -length/2, 0)
1546
1735
  c_shape = Topology.Translate(c_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
1547
1736
  reverse = False
@@ -1713,7 +1902,7 @@ class Wire():
1713
1902
  return edges
1714
1903
 
1715
1904
  @staticmethod
1716
- def Einstein(origin= None, radius: float = 0.5, direction: list = [0, 0, 1], placement: str = "center", mantissa: int = 6):
1905
+ def Einstein(origin= None, radius: float = 0.5, direction: list = [0, 0, 1], placement: str = "center", mantissa: int = 6, tolerance: float = 0.0001):
1717
1906
  """
1718
1907
  Creates an aperiodic monotile, also called an 'einstein' tile (meaning one tile in German, not the name of the famous physicist). See https://arxiv.org/abs/2303.10798
1719
1908
 
@@ -1729,6 +1918,8 @@ class Wire():
1729
1918
  The description of the placement of the origin of the hexagon determining the location of the tile. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
1730
1919
  mantissa : int , optional
1731
1920
  The desired length of the mantissa. The default is 6.
1921
+ tolerance : float , optional
1922
+ The desired tolerance. The default is 0.0001.
1732
1923
  Returns
1733
1924
  -------
1734
1925
  topologic_core.Wire
@@ -1761,7 +1952,7 @@ class Wire():
1761
1952
  v13 = Vertex.ByCoordinates(-cos(30)*d, sin(30)*d, 0)
1762
1953
  vertices = [v1, v13, v12, v11, v10, v9, v8, v7, v6, v5, v4, v3, v2]
1763
1954
  # [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13]
1764
- einstein = Wire.ByVertices(vertices, close=True)
1955
+ einstein = Wire.ByVertices(vertices, close=True, tolerance=tolerance)
1765
1956
 
1766
1957
  einstein = Topology.Rotate(einstein, origin=origin, axis=[1,0,0], angle=180)
1767
1958
 
@@ -1960,9 +2151,9 @@ class Wire():
1960
2151
  baseV.append(Vertex.ByCoordinates(x, y, z))
1961
2152
 
1962
2153
  if angleRange == 360:
1963
- baseWire = Wire.ByVertices(baseV[::-1], close=False) #reversing the list so that the normal points up in Blender
2154
+ baseWire = Wire.ByVertices(baseV[::-1], close=False, tolerance=tolerance) #reversing the list so that the normal points up in Blender
1964
2155
  else:
1965
- baseWire = Wire.ByVertices(baseV[::-1], close=close) #reversing the list so that the normal points up in Blender
2156
+ baseWire = Wire.ByVertices(baseV[::-1], close=close, tolerance=tolerance) #reversing the list so that the normal points up in Blender
1966
2157
 
1967
2158
  if placement.lower() == "lowerleft":
1968
2159
  baseWire = Topology.Translate(baseWire, a, b, 0)
@@ -2170,7 +2361,7 @@ class Wire():
2170
2361
  final_vertices.append(v)
2171
2362
  else:
2172
2363
  final_vertices.append(v)
2173
- flat_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire))
2364
+ flat_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire), tolerance=tolerance)
2174
2365
  # Unflatten the wire
2175
2366
  return_wire = Topology.Unflatten(flat_wire, origin=Vertex.Origin(), direction=normal)
2176
2367
  return return_wire
@@ -2331,7 +2522,7 @@ class Wire():
2331
2522
  contour = process(verticesA=verticesA, verticesB=verticesB, n=n)
2332
2523
  contours += contour
2333
2524
  for c in contour:
2334
- finalWires.append(Wire.ByVertices(c, Wire.IsClosed(wires[i])))
2525
+ finalWires.append(Wire.ByVertices(c, close=Wire.IsClosed(wires[i], tolerance=tolerance)))
2335
2526
 
2336
2527
  contours.append(vertices[-1])
2337
2528
  finalWires.append(wires[-1])
@@ -2356,7 +2547,7 @@ class Wire():
2356
2547
  return Topology.SelfMerge(Cluster.ByTopologies(finalWires+ridges), tolerance=tolerance)
2357
2548
 
2358
2549
  @staticmethod
2359
- def Invert(wire):
2550
+ def Invert(wire, tolerance: float = 0.0001):
2360
2551
  """
2361
2552
  Creates a wire that is an inverse (mirror) of the input wire.
2362
2553
 
@@ -2364,6 +2555,8 @@ class Wire():
2364
2555
  ----------
2365
2556
  wire : topologic_core.Wire
2366
2557
  The input wire.
2558
+ tolerance : float , optional
2559
+ The desired tolerance. The default is 0.0001.
2367
2560
 
2368
2561
  Returns
2369
2562
  -------
@@ -2377,7 +2570,7 @@ class Wire():
2377
2570
  return None
2378
2571
  vertices = Topology.Vertices(wire)
2379
2572
  reversed_vertices = vertices[::-1]
2380
- return Wire.ByVertices(reversed_vertices)
2573
+ return Wire.ByVertices(reversed_vertices, close=Wire.IsClosed(wire), tolerance=tolerance)
2381
2574
 
2382
2575
  @staticmethod
2383
2576
  def IsClosed(wire) -> bool:
@@ -2661,7 +2854,7 @@ class Wire():
2661
2854
  v12 = Vertex.ByCoordinates(0,b)
2662
2855
 
2663
2856
  # Create the I-shaped wire
2664
- i_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12], close=True)
2857
+ i_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12], close=True, tolerance=tolerance)
2665
2858
  i_shape = Topology.Translate(i_shape, -width/2, -length/2, 0)
2666
2859
  i_shape = Topology.Translate(i_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
2667
2860
  reverse = False
@@ -2729,7 +2922,7 @@ class Wire():
2729
2922
  return totalLength
2730
2923
 
2731
2924
  @staticmethod
2732
- def Line(origin= None, length: float = 1, direction: list = [1, 0, 0], sides: int = 2, placement: str ="center"):
2925
+ def Line(origin= None, length: float = 1, direction: list = [1, 0, 0], sides: int = 2, placement: str ="center", tolerance: float = 0.0001):
2733
2926
  """
2734
2927
  Creates a straight line wire using the input parameters.
2735
2928
 
@@ -2749,6 +2942,8 @@ class Wire():
2749
2942
  2. "start" which places the start of the edge at the origin.
2750
2943
  3. "end" which places the end of the edge at the origin.
2751
2944
  The default is "center".
2945
+ tolerance : float , optional
2946
+ The desired tolerance. The default is 0.0001.
2752
2947
 
2753
2948
  Returns
2754
2949
  -------
@@ -2784,7 +2979,7 @@ class Wire():
2784
2979
  for i in range(1, sides):
2785
2980
  vertices.append(Edge.VertexByParameter(edge, i*unitDistance))
2786
2981
  vertices.append(Edge.EndVertex(edge))
2787
- return Wire.ByVertices(vertices)
2982
+ return Wire.ByVertices(vertices, closed=False, tolerance=tolerance)
2788
2983
 
2789
2984
  @staticmethod
2790
2985
  def LShape(origin=None,
@@ -2896,7 +3091,7 @@ class Wire():
2896
3091
  v6 = Vertex.ByCoordinates(0, length) # Top of vertical arm
2897
3092
 
2898
3093
  # Create the L-shaped wire
2899
- l_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6], close=True)
3094
+ l_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6], close=True, tolerance=tolerance)
2900
3095
  l_shape = Topology.Translate(l_shape, -width/2, -length/2, 0)
2901
3096
  l_shape = Topology.Translate(l_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
2902
3097
  reverse = False
@@ -3030,7 +3225,7 @@ class Wire():
3030
3225
  final_vertices.append(v)
3031
3226
  else:
3032
3227
  final_vertices.append(v)
3033
- flat_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire))
3228
+ flat_wire = Wire.ByVertices(final_vertices, close=Wire.IsClosed(wire), tolerance=tolerance)
3034
3229
  # Unflatten the wire
3035
3230
  return_wire = Topology.Unflatten(flat_wire, origin=Vertex.Origin(), direction=normal)
3036
3231
  return return_wire
@@ -3213,7 +3408,7 @@ class Wire():
3213
3408
  for i, edge in enumerate(oriented_edges):
3214
3409
  vertices.append(Edge.EndVertex(edge))
3215
3410
 
3216
- return_wire = Wire.ByVertices(vertices, close=Wire.IsClosed(wire))
3411
+ return_wire = Wire.ByVertices(vertices, close=Wire.IsClosed(wire), tolerance=tolerance)
3217
3412
  if transferDictionaries:
3218
3413
  return_wire = Topology.TransferDictionariesBySelectors(return_wire, selectors=edge_selectors, tranEdges=True)
3219
3414
  return_wire = Topology.TransferDictionariesBySelectors(return_wire, selectors=original_vertices, tranVertices=True)
@@ -3408,7 +3603,7 @@ class Wire():
3408
3603
  vb3 = Vertex.ByCoordinates(Vertex.X(origin)+width*0.5+xOffset,Vertex.Y(origin)+length*0.5+yOffset,Vertex.Z(origin))
3409
3604
  vb4 = Vertex.ByCoordinates(Vertex.X(origin)-width*0.5+xOffset,Vertex.Y(origin)+length*0.5+yOffset,Vertex.Z(origin))
3410
3605
 
3411
- baseWire = Wire.ByVertices([vb1, vb2, vb3, vb4], True)
3606
+ baseWire = Wire.ByVertices([vb1, vb2, vb3, vb4], close=True, tolerance=tolerance)
3412
3607
  if direction != [0, 0, 1]:
3413
3608
  baseWire = Topology.Orient(baseWire, origin=origin, dirA=[0, 0, 1], dirB=direction)
3414
3609
  return baseWire
@@ -3472,7 +3667,7 @@ class Wire():
3472
3667
  filtered_vertices.append(vertex)
3473
3668
 
3474
3669
  if len(filtered_vertices) > 2:
3475
- return Wire.ByVertices(filtered_vertices, close=wire.IsClosed())
3670
+ return Wire.ByVertices(filtered_vertices, close=wire.IsClosed(), tolerance=tolerance)
3476
3671
  elif len(filtered_vertices) == 2:
3477
3672
  return Edge.ByStartVertexEndVertex(filtered_vertices[0], filtered_vertices[1], tolerance=tolerance, silent=True)
3478
3673
  else:
@@ -3573,9 +3768,9 @@ class Wire():
3573
3768
  wire_verts.append(aVertex)
3574
3769
  if len(wire_verts) > 2:
3575
3770
  if wire.IsClosed():
3576
- final_wire = Wire.ByVertices(wire_verts, close=True)
3771
+ final_wire = Wire.ByVertices(wire_verts, close=True, tolerance=tolerance)
3577
3772
  else:
3578
- final_wire = Wire.ByVertices(wire_verts, close=False)
3773
+ final_wire = Wire.ByVertices(wire_verts, close=False, tolerance=tolerance)
3579
3774
  elif len(wire_verts) == 2:
3580
3775
  final_wire = Edge.ByStartVertexEndVertex(wire_verts[0], wire_verts[1], tolerance=tolerance, silent=True)
3581
3776
  return final_wire
@@ -4043,7 +4238,7 @@ class Wire():
4043
4238
  if not silent:
4044
4239
  print("Wire.Simplify - Warning: Could not generate enough vertices for a simplified wire. Returning the original wire.")
4045
4240
  wire
4046
- new_wire = Wire.ByVertices(new_vertices, close=Wire.IsClosed(wire))
4241
+ new_wire = Wire.ByVertices(new_vertices, close=Wire.IsClosed(wire), tolerance=tolerance)
4047
4242
  if not Topology.IsInstance(new_wire, "wire"):
4048
4243
  if not silent:
4049
4244
  print("Wire.Simplify - Warning: Could not generate a simplified wire. Returning the original wire.")
@@ -4102,7 +4297,8 @@ class Wire():
4102
4297
  The vector representing the up direction of the spiral. The default is [0, 0, 1].
4103
4298
  placement : str , optional
4104
4299
  The description of the placement of the origin of the spiral. This can be "center", "lowerleft", "upperleft", "lowerright", "upperright". It is case insensitive. The default is "center".
4105
-
4300
+ tolerance : float , optional
4301
+ The desired tolerance. The default is 0.0001.
4106
4302
  Returns
4107
4303
  -------
4108
4304
  topologic_core.Wire
@@ -4180,7 +4376,7 @@ class Wire():
4180
4376
  y_min = min(yList)
4181
4377
  maxY = max(yList)
4182
4378
  radius = radiusA + radiusB*turns*0.5
4183
- baseWire = Wire.ByVertices(vertices, close=False)
4379
+ baseWire = Wire.ByVertices(vertices, close=False, tolerance=tolerance)
4184
4380
  if placement.lower() == "center":
4185
4381
  baseWire = Topology.Translate(baseWire, 0, 0, -height*0.5)
4186
4382
  if placement.lower() == "lowerleft":
@@ -4369,7 +4565,7 @@ class Wire():
4369
4565
  for i, x in enumerate(x_list):
4370
4566
  v = Vertex.ByCoordinates(x, y_list[i], 0)
4371
4567
  vertices.append(v)
4372
- baseWire = Wire.ByVertices(vertices, close=True)
4568
+ baseWire = Wire.ByVertices(vertices, close=True, tolerance=tolerance)
4373
4569
  baseWire = Topology.RemoveCollinearEdges(baseWire, angTolerance=angTolerance, tolerance=tolerance)
4374
4570
  baseWire = Wire.Simplify(baseWire, tolerance=tolerance)
4375
4571
  if placement.lower() == "lowerleft":
@@ -4473,7 +4669,7 @@ class Wire():
4473
4669
  for coord in baseV:
4474
4670
  tranBase.append(Vertex.ByCoordinates(coord[0]+xOffset, coord[1]+yOffset, Vertex.Z(origin)))
4475
4671
 
4476
- baseWire = Wire.ByVertices(tranBase, True)
4672
+ baseWire = Wire.ByVertices(tranBase, close=True, tolerance=tolerance)
4477
4673
  baseWire = Wire.Reverse(baseWire)
4478
4674
  if direction != [0, 0, 1]:
4479
4675
  baseWire = Topology.Orient(baseWire, origin=origin, dirA=[0, 0, 1], dirB=direction)
@@ -4587,7 +4783,7 @@ class Wire():
4587
4783
  vb3 = Vertex.ByCoordinates(Vertex.X(origin)+widthB*0.5+offsetB+xOffset,Vertex.Y(origin)+length*0.5+yOffset,Vertex.Z(origin))
4588
4784
  vb4 = Vertex.ByCoordinates(Vertex.X(origin)-widthB*0.5++offsetB+xOffset,Vertex.Y(origin)+length*0.5+yOffset,Vertex.Z(origin))
4589
4785
 
4590
- baseWire = Wire.ByVertices([vb1, vb2, vb3, vb4], True)
4786
+ baseWire = Wire.ByVertices([vb1, vb2, vb3, vb4], close=True, tolerance=tolerance)
4591
4787
  if direction != [0, 0, 1]:
4592
4788
  baseWire = Topology.Orient(baseWire, origin=origin, dirA=[0, 0, 1], dirB=direction)
4593
4789
  return baseWire
@@ -4611,15 +4807,15 @@ class Wire():
4611
4807
  Parameters
4612
4808
  ----------
4613
4809
  origin : topologic_core.Vertex , optional
4614
- 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).
4810
+ 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).
4615
4811
  width : float , optional
4616
4812
  The overall width of the T-shape. The default is 1.0.
4617
4813
  length : float , optional
4618
4814
  The overall length of the T-shape. The default is 1.0.
4619
4815
  a : float , optional
4620
- The hortizontal thickness of the vertical arm of the T-shape. The default is 0.5.
4816
+ The hortizontal thickness of the vertical arm of the T-shape. The default is 0.25.
4621
4817
  b : float , optional
4622
- The vertical thickness of the horizontal arm of the T-shape. The default is 0.5.
4818
+ The vertical thickness of the horizontal arm of the T-shape. The default is 0.25.
4623
4819
  direction : list , optional
4624
4820
  The vector representing the up direction of the T-shape. The default is [0, 0, 1].
4625
4821
  placement : str , optional
@@ -4671,11 +4867,11 @@ class Wire():
4671
4867
  if not silent:
4672
4868
  print("Wire.LShape - Error: The b input parameter must be a positive number greater than the tolerance input parameter. Returning None.")
4673
4869
  return None
4674
- if a >= (width - tolerance):
4870
+ if a >= (width - tolerance*2):
4675
4871
  if not silent:
4676
4872
  print("Wire.LShape - Error: The a input parameter must be less than the width input parameter. Returning None.")
4677
4873
  return None
4678
- if b >= (length - tolerance):
4874
+ if b >= (length - tolerance*2):
4679
4875
  if not silent:
4680
4876
  print("Wire.LShape - Error: The b input parameter must be less than the length input parameter. Returning None.")
4681
4877
  return None
@@ -4705,7 +4901,7 @@ class Wire():
4705
4901
  v8 = Vertex.ByCoordinates(width/2-a/2, length-b) # Top of vertical arm
4706
4902
 
4707
4903
  # Create the T-shaped wire
4708
- t_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8], close=True)
4904
+ t_shape = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8], close=True, tolerance=tolerance)
4709
4905
  t_shape = Topology.Translate(t_shape, -width/2, -length/2, 0)
4710
4906
  t_shape = Topology.Translate(t_shape, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
4711
4907
  reverse = False
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.8.0'
1
+ __version__ = '0.8.2'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.8.0
3
+ Version: 0.8.2
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
@@ -3,19 +3,19 @@ topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
3
3
  topologicpy/BVH.py,sha256=mKVCAu9K8qzcWXtPDVH5usXZV1DNNNJl4n3rU5Lh1ZM,12931
4
4
  topologicpy/Cell.py,sha256=o5CxsBXxtnV439I4f8VMUoDMVwO5o3q0lHinHHMSmFg,108571
5
5
  topologicpy/CellComplex.py,sha256=-s8RKGa2H1eqLO7g6qyQvvuFMFJ0aIgXvIr9kOVgpjA,51608
6
- topologicpy/Cluster.py,sha256=__PvNVjRnFfy12aawd7HSrb3UBX3Rtd1iWSSQnPGpfk,55768
6
+ topologicpy/Cluster.py,sha256=o5jdMRpcGfSGGiXQdFg-e9XcnBF5AqTj3xb1nSpwJWE,58606
7
7
  topologicpy/Color.py,sha256=q9xsGmxFMz7sQKmygwSVS12GaTRB-OT0-_i6t3-cthE,20307
8
8
  topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
9
9
  topologicpy/DGL.py,sha256=M_znFtyPBJJz-iXLYZs2wwBj24fhevIo739dGha0chM,139041
10
10
  topologicpy/Dictionary.py,sha256=t0O7Du-iPq46FyKqZfcjHfsUK1E8GS_e67R2V5cpkbw,33186
11
- topologicpy/Edge.py,sha256=gaLqyjFOqFHpw69Ftr4rc-kvakYpauQwhOK4ZO-V35g,67287
11
+ topologicpy/Edge.py,sha256=4Rl6M9ex66Q9-kNvi_Lg7UlAwdvMzpeFlxlieI3amn0,69511
12
12
  topologicpy/EnergyModel.py,sha256=UoQ9Jm-hYsN383CbcLKw-y6BKitRHj0uyh84yQ-8ACg,53856
13
- topologicpy/Face.py,sha256=wczXpMcfub8Eb10lA4rrXksvi5YYCbRjBdp3lOTUwK0,172618
13
+ topologicpy/Face.py,sha256=D1g4O5i5QMPZvIoX06Z-FsyNsYBDkCiHWJp00uqnr5o,180742
14
14
  topologicpy/Graph.py,sha256=T_NC-Gvf7F7DWdfWvQB7sQ_v790lTT74SLKTl-UhSZE,492072
15
15
  topologicpy/Grid.py,sha256=2s9cSlWldivn1i9EUz4OOokJyANveqmRe_vR93CAndI,18245
16
- topologicpy/Helper.py,sha256=F3h4_qcOD_PHAoVe0tEbEE7_jYyVcaHjtwVs4QHOZuI,23978
16
+ topologicpy/Helper.py,sha256=DAAE_Ie_ekeMnCvcW08xXRwSAGCkjrS4lbz-o3ELuY4,27172
17
17
  topologicpy/Honeybee.py,sha256=Y_El6M8x3ixvvIe_VcRiwj_4C89ZZg5_WlT7adbCkpw,21849
18
- topologicpy/Matrix.py,sha256=tiPum1gTvkKxOyxHBDviH4BwLbdlAusBwMe7ZZfu6Po,10510
18
+ topologicpy/Matrix.py,sha256=QOQ7W12344hMLXfSTlJcluOm7od25LImWKKb2O0ADmg,9572
19
19
  topologicpy/Neo4j.py,sha256=BKOF29fRgXmdpMGkrNzuYbyqgCJ6ElPPMYlfTxXiVbc,22392
20
20
  topologicpy/Plotly.py,sha256=Tvo0_zKVEHtPhsMNNvLy5G0HIys5FPAOyp_o4QN_I_A,115760
21
21
  topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
@@ -23,14 +23,14 @@ topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
23
23
  topologicpy/Shell.py,sha256=fLRnQ79vtdBDRW1Xn8Gaap34XheGbw7UBFd-ALJ2Y1g,87978
24
24
  topologicpy/Speckle.py,sha256=AlsGlSDuKRtX5jhVsPNSSjjbZis079HbUchDH_5RJmE,18187
25
25
  topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
26
- topologicpy/Topology.py,sha256=kAnJrVyrwJX8c-C4q1cewJ80byG8uaoBWUuk0T6U4SY,441788
26
+ topologicpy/Topology.py,sha256=-7OsjGeJ64NKcEONee9SqOeh1YQ6yGHEzIPxycQCUdA,445348
27
27
  topologicpy/Vector.py,sha256=Cl7besf20cAGmyNPh-9gbFAHnRU5ZWSMChJ3VyFIDs4,35416
28
28
  topologicpy/Vertex.py,sha256=tv6C-rbuNgXHDGgVLT5fbalynLdXqlUuiCDKtkeQ0vk,77814
29
- topologicpy/Wire.py,sha256=bX8wO96gFa7HZPY0CFlmYQBOUP_1e0jCb02BPxaY-ao,222981
29
+ topologicpy/Wire.py,sha256=Gl3Jpygwp8775SG57ua5r5ffTHcN4FOAkeI87yP1cok,234001
30
30
  topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
31
- topologicpy/version.py,sha256=27YY3zFpeaDh6JoC40AqkjBrn68SqFlsWZzjZtw5jwU,22
32
- topologicpy-0.8.0.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
- topologicpy-0.8.0.dist-info/METADATA,sha256=OqI6ytVUGQkoA75zzzwsqmh2nhxJg5KbX42vCQPST3c,10512
34
- topologicpy-0.8.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
35
- topologicpy-0.8.0.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.8.0.dist-info/RECORD,,
31
+ topologicpy/version.py,sha256=K2rsUy8S7UHe3tStL6NCs5z92apbvbkrpGIEjcCNCNs,22
32
+ topologicpy-0.8.2.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
+ topologicpy-0.8.2.dist-info/METADATA,sha256=DBa_orJTbm3dIrzhCaCiTfsaqfvkAg1jaxCdeHFoeQA,10512
34
+ topologicpy-0.8.2.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
35
+ topologicpy-0.8.2.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
+ topologicpy-0.8.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.7.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5