topologicpy 0.4.95__py3-none-any.whl → 0.4.96__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
@@ -23,92 +23,124 @@ import itertools
23
23
 
24
24
  class Wire(Topology):
25
25
  @staticmethod
26
- def Arc(origin: topologic.Vertex = None, length: float = 1, height: float=0.5, sides: int = 16, close: bool = True, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001):
26
+ def Arc(startVertex: topologic.Vertex, middleVertex: topologic.Vertex, endVertex: topologic.Vertex, sides: int = 16, close: bool = True, tolerance: float = 0.0001):
27
27
  """
28
28
  Creates an arc. The base chord will be parallel to the x-axis and the height will point in the positive y-axis direction.
29
29
 
30
30
  Parameters
31
31
  ----------
32
- origin : topologic.Vertex , optional
33
- The location of the origin of the arc. The default is None which results in the arc being placed at (0,0,0).
34
- length : float , optional
35
- The length of the base chord of the arc. The default is 1.
36
- height : float , optional
37
- The perpendicular distance from the chord to the cricumference of the arc. The default is 0.5.
32
+ startVertex : topologic.Vertex
33
+ The location of the start vertex of the arc.
34
+ middleVertex : topologic.Vertex
35
+ The location of the middle vertex (apex) of the arc.
36
+ endVertex : topologic.Vertex
37
+ The location of the end vertex of the arc.
38
38
  sides : int , optional
39
39
  The number of sides of the circle. The default is 16.
40
40
  close : bool , optional
41
41
  If set to True, the arc will be closed by connecting the last vertex to the first vertex. Otherwise, it will be left open.
42
- direction : list , optional
43
- The vector representing the up direction of the arc. The default is [0,0,1].
44
- placement : str , optional
45
- The description of the placement of the origin of the arc. This can be "center", "lowerleft", "upperleft", "lowerright", or "upperright".
46
- It is case insensitive. If "center", the origin will be placed at the mnid-point of the arc.The default is "center".
47
42
  tolerance : float , optional
48
43
  The desired tolerance. The default is 0.0001.
49
44
 
50
45
  Returns
51
46
  -------
52
47
  topologic.Wire
53
- The created arc .
48
+ The created arc.
54
49
 
55
50
  """
56
51
 
57
52
  from topologicpy.Vertex import Vertex
53
+ from topologicpy.Face import Face
58
54
  from topologicpy.Topology import Topology
59
- import math
60
55
 
61
- h = abs(height)
62
- l = abs(length)
63
- if l < tolerance:
64
- print("Wire.Arc - Error: The chord length parameter is less than the desired tolerance. Returning None.")
65
- return None
66
- if h < tolerance:
67
- print("Wire.Arc - Error: The height parameter is less than the desired tolerance. Returning None.")
56
+ def segmented_arc(x1, y1, x2, y2, x3, y3, sides):
57
+ import math
58
+ """
59
+ Generates a segmented arc passing through the three given points.
60
+
61
+ Arguments:
62
+ x1, y1: Coordinates of the first point
63
+ x2, y2: Coordinates of the second point
64
+ x3, y3: Coordinates of the third point
65
+ sides: Number of sides to divide the arc
66
+
67
+ Returns:
68
+ List of tuples [x, y] representing the segmented arc passing through the points
69
+ """
70
+
71
+ # Calculate the center of the circle
72
+ A = x2 - x1
73
+ B = y2 - y1
74
+ C = x3 - x1
75
+ D = y3 - y1
76
+ E = A * (x1 + x2) + B * (y1 + y2)
77
+ F = C * (x1 + x3) + D * (y1 + y3)
78
+ G = 2 * (A * (y3 - y2) - B * (x3 - x2))
79
+ if G == 0:
80
+ center_x = 0
81
+ center_y = 0
82
+ else:
83
+ center_x = (D * E - B * F) / G
84
+ center_y = (A * F - C * E) / G
85
+
86
+ # Calculate the radius of the circle
87
+ radius = math.sqrt((center_x - x1) ** 2 + (center_y - y1) ** 2)
88
+
89
+ # Calculate the angles between the center and the three points
90
+ angle1 = math.atan2(y1 - center_y, x1 - center_x)
91
+ angle3 = math.atan2(y3 - center_y, x3 - center_x)
92
+
93
+ # Calculate the angle between points 1 and 3
94
+ angle13 = (angle3 - angle1) % (2 * math.pi)
95
+ if angle13 < 0:
96
+ angle13 += 2 * math.pi
97
+
98
+ # Determine the direction of the arc based on the angle between points 1 and 3
99
+ if angle13 < math.pi:
100
+ start_angle = angle1
101
+ end_angle = angle3
102
+ else:
103
+ start_angle = angle3
104
+ end_angle = angle1
105
+
106
+ # Calculate the angle increment
107
+ angle_increment = (end_angle - start_angle) / sides
108
+
109
+ # Generate the points of the arc passing through the points
110
+ arc_points = []
111
+ for i in range(sides + 1):
112
+ angle = start_angle + i * angle_increment
113
+ x = center_x + radius * math.cos(angle)
114
+ y = center_y + radius * math.sin(angle)
115
+ arc_points.append([x, y])
116
+
117
+ return arc_points
118
+ if not isinstance(startVertex, topologic.Vertex):
119
+ print("Wire.Arc - Error: The startVertex parameter is not a valid vertex. Returning None.")
68
120
  return None
69
- if sides < 2:
70
- print("Wire.Arc - Error: The input sides parameter should not be lass than 2. Returning None.")
121
+ if not isinstance(middleVertex, topologic.Vertex):
122
+ print("Wire.Arc - Error: The middleVertex parameter is not a valid vertex. Returning None.")
71
123
  return None
72
- if h > l/2:
73
- print("Wire.Arc - Error: The input height parameter should not be larger than the input length parameter. Returning None.")
124
+ if not isinstance(endVertex, topologic.Vertex):
125
+ print("Wire.Arc - Error: The endVertex parameter is not a valid vertex. Returning None.")
74
126
  return None
75
- if abs(h - l/2) < tolerance:
76
- radius = h
77
- fromAngle = 0
78
- toAngle = 180
79
- else:
80
- radius = (h**2 + (l/2)**2) / (2 * h)
81
- spx = math.sqrt( radius**2 - (length/2)**2)
82
- fromAngle = math.degrees(math.asin(spx / radius))
83
- toAngle = 180-fromAngle
84
- baseWire = Wire.Circle(origin=Vertex.ByCoordinates(0, 0, 0), radius=radius, fromAngle=fromAngle, toAngle=toAngle, sides=sides, close=close, direction=[0,0,1])
85
- baseWire = Topology.Translate(baseWire, -(radius-h), 0, 0)
86
- baseWire = Topology.Rotate(baseWire, degree=90)
87
- if height < 0:
88
- baseWire = Topology.Rotate(baseWire, degree=180)
89
- if placement.lower() == "lowerleft":
90
- baseWire = Topology.Translate(baseWire, l/2, h, 0)
91
- elif placement.lower() == "upperleft":
92
- baseWire = Topology.Translate(baseWire, l/2, 0, 0)
93
- elif placement.lower() == "lowerright":
94
- baseWire = Topology.Translate(baseWire, -l/2, 0, 0)
95
- elif placement.lower() == "upperright":
96
- baseWire = Topology.Translate(baseWire, -l/2, h, 0)
97
- else:
98
- if placement.lower() == "lowerleft":
99
- baseWire = Topology.Translate(baseWire, l/2, 0, 0)
100
- elif placement.lower() == "upperleft":
101
- baseWire = Topology.Translate(baseWire, l/2, -h, 0)
102
- elif placement.lower() == "lowerright":
103
- baseWire = Topology.Translate(baseWire, -l/2, 0, 0)
104
- elif placement.lower() == "upperright":
105
- baseWire = Topology.Translate(baseWire, -l/2, -h, 0)
127
+ if Vertex.AreCollinear([startVertex, middleVertex, endVertex], tolerance = tolerance):
128
+ return Wire.ByVertices([startVertex,middleVertex,endVertex], close=False)
106
129
 
107
- if direction != [0,0,1]:
108
- baseWire = Topology.Orient(baseWire, origin=Vertex.ByCoordinates(0,0,0), dirA=[0,0,1], dirB=direction)
109
- if isinstance(origin, topologic.Vertex):
110
- baseWire = Topology.Translate(baseWire, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
111
- return baseWire
130
+ w = Wire.ByVertices([startVertex,middleVertex,endVertex], close=False)
131
+ f = Face.ByWire(w, tolerance=tolerance)
132
+ normal = Face.Normal(f)
133
+ flat_w = Topology.Flatten(w, origin=startVertex, direction=normal)
134
+ v1, v2, v3 = Topology.Vertices(flat_w)
135
+ x1, y1, z1 = Vertex.Coordinates(v1)
136
+ x2, y2, z2 = Vertex.Coordinates(v2)
137
+ x3, y3, z3 = Vertex.Coordinates(v3)
138
+ arc_points = segmented_arc(x1, y1, x2, y2, x3, y3, sides)
139
+ arc_verts = [Vertex.ByCoordinates(coord[0], coord[1], 0) for coord in arc_points]
140
+ arc = Wire.ByVertices(arc_verts, close=close)
141
+ # Unflatten the arc
142
+ arc = Topology.Unflatten(arc, origin=startVertex, direction=normal)
143
+ return arc
112
144
 
113
145
  @staticmethod
114
146
  def BoundingRectangle(topology: topologic.Topology, optimize: int = 0, tolerance=0.0001) -> topologic.Wire:
@@ -133,10 +165,8 @@ class Wire(Topology):
133
165
  from topologicpy.Vertex import Vertex
134
166
  from topologicpy.Wire import Wire
135
167
  from topologicpy.Face import Face
136
- from topologicpy.Cluster import Cluster
137
168
  from topologicpy.Topology import Topology
138
169
  from topologicpy.Dictionary import Dictionary
139
- from topologicpy.Vector import Vector
140
170
  from random import sample
141
171
  import time
142
172
 
@@ -176,17 +206,7 @@ class Wire(Topology):
176
206
  f = Face.ByWire(w, tolerance=tolerance)
177
207
  f_origin = Topology.Centroid(f)
178
208
  normal = Face.Normal(f)
179
- f = Topology.Flatten(f, origin=f_origin, direction=normal)
180
- dictionary = Topology.Dictionary(f)
181
- xTran = Dictionary.ValueAtKey(dictionary,"x")
182
- yTran = Dictionary.ValueAtKey(dictionary,"y")
183
- zTran = Dictionary.ValueAtKey(dictionary,"z")
184
- phi = Dictionary.ValueAtKey(dictionary,"phi")
185
- theta = Dictionary.ValueAtKey(dictionary,"theta")
186
-
187
- topology = Topology.Translate(topology, xTran*-1, yTran*-1, zTran*-1)
188
- topology = Topology.Rotate(topology, origin=world_origin, x=0, y=0, z=1, degree=-phi)
189
- topology = Topology.Rotate(topology, origin=world_origin, x=0, y=1, z=0, degree=-theta)
209
+ topology = Topology.Flatten(topology, origin=f_origin, direction=normal)
190
210
 
191
211
  boundingRectangle = br(topology)
192
212
  minX = boundingRectangle[0]
@@ -240,10 +260,7 @@ class Wire(Topology):
240
260
 
241
261
  boundingRectangle = Wire.ByVertices([vb1, vb2, vb3, vb4], close=True)
242
262
  boundingRectangle = Topology.Rotate(boundingRectangle, origin=origin, x=0,y=0,z=1, degree=-best_z)
243
- boundingRectangle = Topology.Rotate(boundingRectangle, origin=world_origin, x=0, y=1, z=0, degree=theta)
244
- boundingRectangle = Topology.Rotate(boundingRectangle, origin=world_origin, x=0, y=0, z=1, degree=phi)
245
- boundingRectangle = Topology.Translate(boundingRectangle, xTran, yTran, zTran)
246
-
263
+ boundingRectangle = Topology.Unflatten(boundingRectangle, origin=f_origin, direction=normal)
247
264
  dictionary = Dictionary.ByKeysValues(["zrot"], [best_z])
248
265
  boundingRectangle = Topology.SetDictionary(boundingRectangle, dictionary)
249
266
  return boundingRectangle
@@ -363,32 +380,17 @@ class Wire(Topology):
363
380
  normal = Face.Normal(flatFace)
364
381
  flatFace = Topology.Flatten(flatFace, origin=origin, direction=normal)
365
382
 
366
- world_origin = Vertex.ByCoordinates(0,0,0)
367
- # Retrieve the needed transformations
368
- dictionary = Topology.Dictionary(flatFace)
369
- xTran = Dictionary.ValueAtKey(dictionary,"x")
370
- yTran = Dictionary.ValueAtKey(dictionary,"y")
371
- zTran = Dictionary.ValueAtKey(dictionary,"z")
372
- phi = Dictionary.ValueAtKey(dictionary,"phi")
373
- theta = Dictionary.ValueAtKey(dictionary,"theta")
374
-
375
-
376
-
377
383
  edges = Wire.Edges(wire)
378
384
  vertices = Wire.Vertices(wire)
379
385
  flatEdges = []
380
386
  flatVertices = []
381
387
  newEdges = []
382
388
  for i in range(len(vertices)):
383
- flatVertex = Topology.Translate(vertices[i], -xTran, -yTran, -zTran)
384
- flatVertex = Topology.Rotate(flatVertex, origin=world_origin, x=0, y=0, z=1, degree=-phi)
385
- flatVertex = Topology.Rotate(flatVertex, origin=world_origin, x=0, y=1, z=0, degree=-theta)
389
+ flatVertex = Topology.Flatten(vertices[i], origin=origin, direction=normal)
386
390
  flatVertices.append(flatVertex)
387
391
  vertices = flatVertices
388
392
  for i in range(len(edges)):
389
- flatEdge = Topology.Translate(edges[i], -xTran, -yTran, -zTran)
390
- flatEdge = Topology.Rotate(flatEdge, origin=world_origin, x=0, y=0, z=1, degree=-phi)
391
- flatEdge = Topology.Rotate(flatEdge, origin=world_origin, x=0, y=1, z=0, degree=-theta)
393
+ flatEdge = Topology.Flatten(edges[i], origin=origin, direction=normal)
392
394
  flatEdges.append(flatEdge)
393
395
  if offsetKey:
394
396
  d = Topology.Dictionary(edges[i])
@@ -491,7 +493,7 @@ class Wire(Topology):
491
493
  miterEdge = Edge.SetLength(miterEdge, abs(offset)*10)
492
494
  msv = Edge.Intersect2D(miterEdge, e1)
493
495
  mev = Edge.Intersect2D(miterEdge, e2)
494
- if (Topology.IsInternal(e1, msv,tolerance=0.01) and (Topology.IsInternal(e2, mev, tolerance=0.01))):
496
+ if (Vertex.IsInternal(msv, e1,tolerance=0.01) and (Vertex.IsInternal(mev, e2, tolerance=0.01))):
495
497
  miterEdge = Edge.ByVertices([msv, mev], tolerance=tolerance)
496
498
  if miterEdge:
497
499
  cleanMiterEdges.append(miterEdge)
@@ -518,9 +520,7 @@ class Wire(Topology):
518
520
  if len(cleanMiterEdges) > 0:
519
521
  newWire = Topology.Boolean(newWire, Cluster.ByTopologies(cleanMiterEdges), operation="merge", tolerance=tolerance)
520
522
 
521
- newWire = Topology.Rotate(newWire, origin=world_origin, x=0, y=1, z=0, degree=theta)
522
- newWire = Topology.Rotate(newWire, origin=world_origin, x=0, y=0, z=1, degree=phi)
523
- newWire = Topology.Translate(newWire, xTran, yTran, zTran)
523
+ newWire = Topology.Unflatten(newWire, origin=origin, direction=normal)
524
524
  return newWire
525
525
 
526
526
  @staticmethod
@@ -861,10 +861,9 @@ class Wire(Topology):
861
861
  # Print Result
862
862
  return hull
863
863
 
864
-
865
- xTran = None
864
+ f = None
866
865
  # Create a sample face and flatten
867
- while not xTran:
866
+ while not isinstance(f, topologic.Face):
868
867
  vertices = Topology.SubTopologies(topology=topology, subTopologyType="vertex")
869
868
  v = sample(vertices, 3)
870
869
  w = Wire.ByVertices(v)
@@ -872,33 +871,17 @@ class Wire(Topology):
872
871
  origin = Topology.Centroid(f)
873
872
  normal = Face.Normal(f)
874
873
  f = Topology.Flatten(f, origin=origin, direction=normal)
875
- dictionary = Topology.Dictionary(f)
876
- xTran = Dictionary.ValueAtKey(dictionary,"x")
877
- yTran = Dictionary.ValueAtKey(dictionary,"y")
878
- zTran = Dictionary.ValueAtKey(dictionary,"z")
879
- phi = Dictionary.ValueAtKey(dictionary,"phi")
880
- theta = Dictionary.ValueAtKey(dictionary,"theta")
881
-
882
- world_origin = Vertex.Origin()
883
- topology = Topology.Translate(topology, xTran*-1, yTran*-1, zTran*-1)
884
- topology = Topology.Rotate(topology, origin=world_origin, x=0, y=0, z=1, degree=-phi)
885
- topology = Topology.Rotate(topology, origin=world_origin, x=0, y=1, z=0, degree=-theta)
886
-
874
+ topology = Topology.Flatten(topology, origin=origin, direction=normal)
887
875
  vertices = Topology.Vertices(topology)
888
-
889
876
  points = []
890
877
  for v in vertices:
891
878
  points.append((Vertex.X(v), Vertex.Y(v)))
892
879
  hull = convex_hull(points, len(points))
893
-
894
880
  hull_vertices = []
895
881
  for p in hull:
896
882
  hull_vertices.append(Vertex.ByCoordinates(points[p][0], points[p][1], 0))
897
-
898
883
  ch = Wire.ByVertices(hull_vertices)
899
- ch = Topology.Rotate(ch, origin=world_origin, x=0, y=1, z=0, degree=theta)
900
- ch = Topology.Rotate(ch, origin=world_origin, x=0, y=0, z=1, degree=phi)
901
- ch = Topology.Translate(ch, xTran, yTran, zTran)
884
+ ch = Topology.Unflatten(ch, origin=origin, direction=normal)
902
885
  return ch
903
886
 
904
887
  @staticmethod
@@ -1282,32 +1265,14 @@ class Wire(Topology):
1282
1265
 
1283
1266
  if placement.lower() == "lowerleft":
1284
1267
  baseWire = Topology.Translate(baseWire, a, b, 0)
1285
- x1 = origin.X()
1286
- y1 = origin.Y()
1287
- z1 = origin.Z()
1288
- x2 = origin.X() + direction[0]
1289
- y2 = origin.Y() + direction[1]
1290
- z2 = origin.Z() + direction[2]
1291
- dx = x2 - x1
1292
- dy = y2 - y1
1293
- dz = z2 - z1
1294
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1295
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1296
- if dist < 0.0001:
1297
- theta = 0
1298
- else:
1299
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1300
- baseWire = Topology.Rotate(baseWire, origin, 0, 1, 0, theta)
1301
- baseWire = Topology.Rotate(baseWire, origin, 0, 0, 1, phi)
1302
-
1268
+ baseWire = Topology.Orient(baseWire, origin=origin, dirA=[0,0,1], dirB=direction)
1303
1269
  # Create a Cluster of the two foci
1304
1270
  v1 = topologic.Vertex.ByCoordinates(c+origin.X(), 0+origin.Y(),0)
1305
1271
  v2 = topologic.Vertex.ByCoordinates(-c+origin.X(), 0+origin.Y(),0)
1306
1272
  foci = topologic.Cluster.ByTopologies([v1, v2])
1307
1273
  if placement.lower() == "lowerleft":
1308
1274
  foci = Topology.Translate(foci, a, b, 0)
1309
- foci = Topology.Rotate(foci, origin, 0, 1, 0, theta)
1310
- foci = Topology.Rotate(foci, origin, 0, 0, 1, phi)
1275
+ foci = Topology.Orient(foci, origin=origin, dirA=[0,0,1], dirB=direction)
1311
1276
  d = {}
1312
1277
  d['ellipse'] = baseWire
1313
1278
  d['foci'] = foci
@@ -1394,19 +1359,10 @@ class Wire(Topology):
1394
1359
  print("Wire.InteriorAngles - Error: The input wire parameter is not closed. Returning None")
1395
1360
  return None
1396
1361
 
1397
- f = Face.Flatten(Face.ByWire(wire))
1398
- world_origin = Vertex.ByCoordinates(0,0,0)
1399
- # Retrieve the needed transformations
1400
- dictionary = Topology.Dictionary(f)
1401
- xTran = Dictionary.ValueAtKey(dictionary,"x")
1402
- yTran = Dictionary.ValueAtKey(dictionary,"y")
1403
- zTran = Dictionary.ValueAtKey(dictionary,"z")
1404
- phi = Dictionary.ValueAtKey(dictionary,"phi")
1405
- theta = Dictionary.ValueAtKey(dictionary,"theta")
1406
-
1407
- w = Topology.Translate(wire, -xTran, -yTran, -zTran)
1408
- w = Topology.Rotate(w, world_origin, 0, 0, 1, -phi)
1409
- w = Topology.Rotate(w, world_origin, 0, 1, 0, -theta)
1362
+ f = Face.ByWire(wire)
1363
+ normal = Face.Normal(f)
1364
+ origin = Topology.Centroid(f)
1365
+ w = Topology.Flatten(wire, origin=origin, direction=normal)
1410
1366
  angles = []
1411
1367
  edges = Topology.Edges(w)
1412
1368
  for i in range(len(edges)-1):
@@ -1584,47 +1540,6 @@ class Wire(Topology):
1584
1540
  if isinstance(wire, topologic.Wire):
1585
1541
  status = wire.IsClosed()
1586
1542
  return status
1587
- @staticmethod
1588
- def IsInside(wire: topologic.Wire, vertex: topologic.Vertex, tolerance: float = 0.0001) -> bool:
1589
- """
1590
- DEPRECATED. DO NOT USE. INSTEAD USE Wire.IsInternal.
1591
- """
1592
- print("Wire.IsInside - Warning: Deprecated method. This method will be removed in the future. Instead, use Wire.IsInternal.")
1593
- return Wire.IsInternal(wire=wire, vertex=vertex, tolerance=tolerance)
1594
-
1595
- @staticmethod
1596
- def IsInternal(wire: topologic.Wire, vertex: topologic.Vertex, tolerance: float = 0.0001) -> bool:
1597
- """
1598
- Returns True if the input vertex is an internal vertex of the input wire. Returns False otherwise.
1599
-
1600
- Parameters
1601
- ----------
1602
- wire : topologic.Wire
1603
- The input wire.
1604
- vertex : topologic.Vertex
1605
- The input Vertex.
1606
- tolerance : float , optional
1607
- The desired tolerance. The default is 0.0001.
1608
-
1609
- Returns
1610
- -------
1611
- bool
1612
- True if the input vertex is inside the input wire. False otherwise.
1613
-
1614
- """
1615
- from topologicpy.Vertex import Vertex
1616
- from topologicpy.Edge import Edge
1617
-
1618
- if not isinstance(wire, topologic.Wire):
1619
- return None
1620
- if not isinstance(vertex, topologic.Vertex):
1621
- return None
1622
- is_inside = False
1623
- edges = Wire.Edges(wire)
1624
- for edge in edges:
1625
- if (Vertex.Distance(vertex, edge) <= tolerance):
1626
- return True
1627
- return False
1628
1543
 
1629
1544
  @staticmethod
1630
1545
  def IsManifold(wire: topologic.Wire) -> bool:
@@ -2244,7 +2159,7 @@ class Wire(Topology):
2244
2159
  ev = Edge.EndVertex(edge)
2245
2160
  ev = vertices[Vertex.Index(ev, vertices)]
2246
2161
  new_edges.append(Edge.ByVertices([sv,ev]))
2247
- new_wire = Topology.SelfMerge(Cluster.ByTopologies(new_edges))
2162
+ new_wire = Topology.SelfMerge(Cluster.ByTopologies(new_edges), tolerance=tolerance)
2248
2163
  return new_wire
2249
2164
 
2250
2165
  def rce(wire, angTolerance=0.1):
@@ -2441,14 +2356,7 @@ class Wire(Topology):
2441
2356
  roof = face_to_skeleton(flat_face, degree)
2442
2357
  if not roof:
2443
2358
  return None
2444
- xTran = Dictionary.ValueAtKey(d,"x")
2445
- yTran = Dictionary.ValueAtKey(d,"y")
2446
- zTran = Dictionary.ValueAtKey(d,"z")
2447
- phi = Dictionary.ValueAtKey(d,"phi")
2448
- theta = Dictionary.ValueAtKey(d,"theta")
2449
- roof = Topology.Rotate(roof, origin=Vertex.Origin(), x=0, y=1, z=0, degree=theta)
2450
- roof = Topology.Rotate(roof, origin=Vertex.Origin(), x=0, y=0, z=1, degree=phi)
2451
- roof = Topology.Translate(roof, xTran, yTran, zTran)
2359
+ roof = Topology.Unflatten(roof, origin=origin, direction=normal)
2452
2360
  return roof
2453
2361
 
2454
2362
  def Skeleton(face, tolerance=0.001):
@@ -2489,7 +2397,7 @@ class Wire(Topology):
2489
2397
  radiusB : float , optional
2490
2398
  The final radius of the spiral. The default is 0.5.
2491
2399
  height : float , optional
2492
- The height of the radius. The default is 0.
2400
+ The height of the spiral. The default is 1.
2493
2401
  turns : int , optional
2494
2402
  The number of turns of the spiral. The default is 10.
2495
2403
  sides : int , optional
@@ -2558,11 +2466,11 @@ class Wire(Topology):
2558
2466
  z = height
2559
2467
  else:
2560
2468
  z = 0
2561
- theta = 0
2469
+ ang = 0
2562
2470
  angOffset = float(360/float(sides))
2563
2471
  b = (radiusB - radiusA)/(2*math.pi*turns)
2564
- while theta <= 360*turns:
2565
- rad = math.radians(theta)
2472
+ while ang <= 360*turns:
2473
+ rad = math.radians(ang)
2566
2474
  x = (radiusA + b*rad)*math.cos(rad)*cw
2567
2475
  xList.append(x)
2568
2476
  y = (radiusA + b*rad)*math.sin(rad)
@@ -2573,7 +2481,7 @@ class Wire(Topology):
2573
2481
  else:
2574
2482
  z = z + zOffset
2575
2483
  vertices.append(Vertex.ByCoordinates(x,y,z))
2576
- theta = theta + angOffset
2484
+ ang = ang + angOffset
2577
2485
 
2578
2486
  minX = min(xList)
2579
2487
  maxX = max(xList)
@@ -2947,7 +2855,7 @@ class Wire(Topology):
2947
2855
  if not isinstance(origin, topologic.Vertex):
2948
2856
  print("Wire.VertexDistance - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
2949
2857
  return None
2950
- if not Topology.IsInternal(wire, vertex, tolerance=tolerance):
2858
+ if not Vertex.IsInternal(vertex, wire, tolerance=tolerance):
2951
2859
  print("Wire.VertexDistance: The input vertex parameter is not internal to the input wire parameter. Returning None.")
2952
2860
  return None
2953
2861
 
@@ -2956,7 +2864,7 @@ class Wire(Topology):
2956
2864
  found = False
2957
2865
  # Iterate over the edges of the wire
2958
2866
  for edge in Wire.Edges(wire):
2959
- if Topology.IsInternal(edge, v, tolerance=tolerance):
2867
+ if Vertex.IsInternal(v, edge, tolerance=tolerance):
2960
2868
  total_distance += Vertex.Distance(Edge.StartVertex(edge), v)
2961
2869
  found = True
2962
2870
  break
topologicpy/__init__.py CHANGED
@@ -18,7 +18,7 @@ import sys
18
18
  import os, re
19
19
  from sys import platform
20
20
 
21
- __version__ = '0.4.95'
21
+ __version__ = '0.4.96'
22
22
  __version_info__ = tuple([ int(num) for num in __version__.split('.')])
23
23
 
24
24
  if platform == 'win32':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.4.95
3
+ Version: 0.4.96
4
4
  Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/wassimj/TopologicPy
@@ -1,15 +1,15 @@
1
1
  topologicpy/Aperture.py,sha256=vENYlFaM6Pu-xCJB1YsW1I1_u5yDj-A70aU3bo3lpFA,2819
2
- topologicpy/Cell.py,sha256=k9ZgGxBLcLLAwxcovVq3rArASS9ye58BRYf52rpIslE,98709
3
- topologicpy/CellComplex.py,sha256=TS3TbitIM8O5wcFx0scYPz5HaXTeBHLOAbSUHRmw3jg,48021
4
- topologicpy/Cluster.py,sha256=hx0eRQP30I4Ssb3oKTxiNiCjyRiQmyd9Y1C2Ec48-IM,53111
2
+ topologicpy/Cell.py,sha256=flVjd6KAlQ1uxKuu8yaMSBwXtlqwgZEE6pbZzaMN6kY,94785
3
+ topologicpy/CellComplex.py,sha256=OEPa3VMjlXhnu6YCMA0coTp8uSY1fh_Rbv6v7oEU3OQ,47396
4
+ topologicpy/Cluster.py,sha256=OpgYOlQuHzgGHmvQbglpoHjsmf61irFFy5z_XVJiPHI,54856
5
5
  topologicpy/Color.py,sha256=I_Sm0F-5Hr3y6tFCBaLOplslLnu-wpA8T0VQkH8x54g,17057
6
6
  topologicpy/Context.py,sha256=bgwslZSu8Ijuz3fusdhP6XcDnCdwGhtbI0-uhVjB36U,2977
7
7
  topologicpy/DGL.py,sha256=qg0k5Ls-eLD6tbK06v_KPgg-GO3M3jY0IusHkco8kCY,138312
8
8
  topologicpy/Dictionary.py,sha256=vGhiXPu7e7GsgQyTsX6rZBncnnrDlcYfM9xRb9h-l3U,24799
9
- topologicpy/Edge.py,sha256=ikQbCwHVYKzQ_SMqMtbnE_kUMRJjEmVfXaep4QFdOS8,49841
9
+ topologicpy/Edge.py,sha256=C4VKk8leXTQySsGKCE4RSt3HiUhA12Ny_rGhEr71LWY,50009
10
10
  topologicpy/EnergyModel.py,sha256=kl8N-6NsKwKeSUt6vWm0B-MBacw9vMymE6lbvymJdVM,51758
11
- topologicpy/Face.py,sha256=uQyrXVtFQYlYZxiywl1S4cCHIAfQMbgeJ40Af34-CmI,93617
12
- topologicpy/Graph.py,sha256=HqVbF209a2QnRwtTBVke8paKMfMhf305hs-NlEYUx7o,314479
11
+ topologicpy/Face.py,sha256=Gc9xFAE5Am3apgftbACcaNyRgLmHfxyKscMjQmg_N6s,81732
12
+ topologicpy/Graph.py,sha256=bv9GkhXN2onAuju0em5eGri_0nU-SYrSmIUBu3iyN1I,320767
13
13
  topologicpy/Grid.py,sha256=q6uAs8MGbdteYNbjqRjqlhFMquYAvSngwzxsFl9-338,17371
14
14
  topologicpy/Helper.py,sha256=vqBZE-CcHBeTCnzC9OzbRaCTx4XT4SZpPF__Vi19nDQ,16049
15
15
  topologicpy/Honeybee.py,sha256=ygiGMS7u-YQJWpK2CmkBuJu1DBABVUmpMdg9HewOhN4,20349
@@ -17,13 +17,13 @@ topologicpy/Matrix.py,sha256=1aH7QKP6eNUbUXmZbB7e_4dw1ZSVQ8bsOsKJXtQq3_4,8357
17
17
  topologicpy/Neo4j.py,sha256=Wd3GRuTt66AkzJscLNIJCBQhd8y1OntX_9u4_33XQKw,19341
18
18
  topologicpy/Plotly.py,sha256=W4nuHVy7xUnRGJRcE2iPl0mLU0dp58CTHC1_YldfZ6I,96904
19
19
  topologicpy/Polyskel.py,sha256=-M47SAFWrFOheZ9KWUEgYOmCn-V_rfKPKvU8KY4B-1s,16450
20
- topologicpy/Shell.py,sha256=I-IpxDQi8BQvA3iTS4bGM-nwTQ4GQqm7zyNcoFzE2EE,80036
20
+ topologicpy/Shell.py,sha256=LJjdTfXcYNJalu2gAwpmFnxs8re7OBAThGn8irvlbqg,76317
21
21
  topologicpy/Speckle.py,sha256=zKqiHYuw7498W_9UWvDn2xsdBskhahNjJejxegMpbJA,14773
22
- topologicpy/Topology.py,sha256=TnJlwsHZkACTZdRvhRbmJrHpCyedKh4_2jb7Ah7nsLs,287935
23
- topologicpy/Vector.py,sha256=57ZoYLd3chEQhjN8Sf1Wv_UR3klltLoaT8TQN0kP-f8,22166
24
- topologicpy/Vertex.py,sha256=2fkErhKUDFQUCQ3gQRkGj-kIIAO4EuWhrKggiGupy98,56338
25
- topologicpy/Wire.py,sha256=l_GQ9yFVxUPTVztrQW2f36Ct3Vtsh3-pV2HOVIP4gyU,136640
26
- topologicpy/__init__.py,sha256=9wtiMOgA4NDLAr4IhjwgCsCwJI_XAXMm_WKV8alYmQg,1445
22
+ topologicpy/Topology.py,sha256=iRQjNVxC87C8Qi6ykGnsZooxg960FcmjVRqSXCgcQx8,299669
23
+ topologicpy/Vector.py,sha256=OtPPz0N_bKpXsGNOHYZTEXKHPAy9MgTG1NgoKmh8f0s,30347
24
+ topologicpy/Vertex.py,sha256=b3oPfMNFAXHcrcvOdd1LSFdO8BUeXEVVsQuks_uWtVY,66016
25
+ topologicpy/Wire.py,sha256=px0IB2Y6TIF5QKb4LkQ4ZAjWAgu76eDefT6vnyQ0idM,131506
26
+ topologicpy/__init__.py,sha256=MESltIVetyEsa0zFlilCBcXiUpaalL3H4fI_0IXSr1c,1445
27
27
  topologicpy/bin/linux/topologic/__init__.py,sha256=XlFReDf3FWlYdM9uXtanYPIafgPb6GVTQczS_xJAXD0,60
28
28
  topologicpy/bin/linux/topologic/libTKBO-6bdf205d.so.7.7.0,sha256=ANok9DQKcnWcLd9T_LAt-i-X4nsYYy16q9kQlcTre1E,2996488
29
29
  topologicpy/bin/linux/topologic/libTKBRep-2960a069.so.7.7.0,sha256=OJ3XesL79du8LeBHrsleGPXub6OpJdOilxha0mwjqQo,1378768
@@ -84,8 +84,8 @@ topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd,sha256=F0sPLuMpD
84
84
  topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd,sha256=aBAJQj3OmJ58MOAF1ZIFybL_5fFK7FNR9hrIps6b6pc,1551872
85
85
  topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd,sha256=aLgNf54nbJmGc7Tdmkuy-V0m6B9zLxabIbpRwAy7cBA,1551360
86
86
  topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd,sha256=_8cp205hiRxkFHtzQQOweA4DhCPk8caH4kTVLWGQeVw,1411584
87
- topologicpy-0.4.95.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
88
- topologicpy-0.4.95.dist-info/METADATA,sha256=rOnS9dfLdtmhkCAAmrW1g0OtVxikOQXp8RbDOCUJKH8,7278
89
- topologicpy-0.4.95.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
90
- topologicpy-0.4.95.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
91
- topologicpy-0.4.95.dist-info/RECORD,,
87
+ topologicpy-0.4.96.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
88
+ topologicpy-0.4.96.dist-info/METADATA,sha256=whQaEfI0A_W1FHAhYtkMe6wU96JH0GYQHSRqQ7q4sJs,7278
89
+ topologicpy-0.4.96.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
90
+ topologicpy-0.4.96.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
91
+ topologicpy-0.4.96.dist-info/RECORD,,