topologicpy 0.8.29__py3-none-any.whl → 0.8.31__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/BVH.py CHANGED
@@ -252,7 +252,7 @@ class BVH:
252
252
  return clash_detection(bvh, query)
253
253
 
254
254
  # Function to recursively add nodes and edges to the TopologicPy Graph
255
- def Graph(bvh, tolerance=0.0001):
255
+ def Graph(bvh, tolerance: float = 0.0001, silent: bool = False):
256
256
  """
257
257
  Creates a graph from the input bvh tree.
258
258
 
@@ -262,6 +262,8 @@ class BVH:
262
262
  The input BVH Tree.
263
263
  tolerance : float , optional
264
264
  The desired tolerance. The default is 0.0001.
265
+ silent : bool , optional
266
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
265
267
 
266
268
  Returns
267
269
  -------
@@ -284,8 +286,8 @@ class BVH:
284
286
  d = Vertex.Distance(parent_vertex, current_vertex)
285
287
  if d <= tolerance:
286
288
  current_vertex = Topology.Translate(current_vertex, tolerance*random.uniform(2,50), tolerance*random.uniform(2,50), tolerance*random.uniform(2,50))
287
- edge = Edge.ByVertices(parent_vertex, current_vertex, tolerance=tolerance)
288
- graph = Graph.AddEdge(graph, edge, silent=True)
289
+ edge = Edge.ByVertices(parent_vertex, current_vertex, tolerance=tolerance, silent=silent)
290
+ graph = Graph.AddEdge(graph, edge, silent=silent)
289
291
 
290
292
  # Recursively add child nodes
291
293
  if bvh_node.left:
topologicpy/CSG.py CHANGED
@@ -202,7 +202,7 @@ class CSG():
202
202
  if not silent:
203
203
  print("CSG.Connect - Error: The input vertexB parameter is not a valid vertex. Returning None.")
204
204
  return None
205
- edge = Edge.ByVertices(vertexA, vertexB, tolerance=tolerance)
205
+ edge = Edge.ByVertices(vertexA, vertexB, tolerance=tolerance, silent=silent)
206
206
  if graph == None:
207
207
  vertices = [vertexA, vertexB]
208
208
  edges = [edge]
topologicpy/Cell.py CHANGED
@@ -301,7 +301,7 @@ class Cell():
301
301
 
302
302
  @staticmethod
303
303
  def ByThickenedFace(face, thickness: float = 1.0, bothSides: bool = True, reverse: bool = False,
304
- planarize: bool = False, tolerance: float = 0.0001):
304
+ planarize: bool = False, tolerance: float = 0.0001, silent: bool = False):
305
305
  """
306
306
  Creates a cell by thickening the input face.
307
307
 
@@ -319,6 +319,8 @@ class Cell():
319
319
  If set to True, the input faces of the input shell are planarized before building the cell. Otherwise, they are not. The default is False.
320
320
  tolerance : float , optional
321
321
  The desired tolerance. The default is 0.0001.
322
+ silent : bool , optional
323
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
322
324
 
323
325
  Returns
324
326
  -------
@@ -348,15 +350,15 @@ class Cell():
348
350
  bottomEdges = Topology.Edges(bottomFace)
349
351
  for bottomEdge in bottomEdges:
350
352
  topEdge = Topology.Translate(bottomEdge, faceNormal[0]*thickness, faceNormal[1]*thickness, faceNormal[2]*thickness)
351
- sideEdge1 = Edge.ByVertices([Edge.StartVertex(bottomEdge), Edge.StartVertex(topEdge)], tolerance=tolerance, silent=True)
352
- sideEdge2 = Edge.ByVertices([Edge.EndVertex(bottomEdge), Edge.EndVertex(topEdge)], tolerance=tolerance, silent=True)
353
+ sideEdge1 = Edge.ByVertices([Edge.StartVertex(bottomEdge), Edge.StartVertex(topEdge)], tolerance=tolerance, silent=silent)
354
+ sideEdge2 = Edge.ByVertices([Edge.EndVertex(bottomEdge), Edge.EndVertex(topEdge)], tolerance=tolerance, silent=silent)
353
355
  cellWire = Topology.SelfMerge(Cluster.ByTopologies([bottomEdge, sideEdge1, topEdge, sideEdge2]), tolerance=tolerance)
354
356
  cellFaces.append(Face.ByWire(cellWire, tolerance=tolerance))
355
357
  return Cell.ByFaces(cellFaces, planarize=planarize, tolerance=tolerance)
356
358
 
357
359
  @staticmethod
358
360
  def ByThickenedShell(shell, direction: list = [0, 0, 1], thickness: float = 1.0, bothSides: bool = True, reverse: bool = False,
359
- planarize: bool = False, tolerance: float = 0.0001):
361
+ planarize: bool = False, tolerance: float = 0.0001, silent: bool = False):
360
362
  """
361
363
  Creates a cell by thickening the input shell. The shell must be open.
362
364
 
@@ -374,6 +376,8 @@ class Cell():
374
376
  If set to True, the input faces of the input shell are planarized before building the cell. Otherwise, they are not. The default is False.
375
377
  tolerance : float , optional
376
378
  The desired tolerance. The default is 0.0001.
379
+ silent : bool , optional
380
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
377
381
 
378
382
  Returns
379
383
  -------
@@ -388,7 +392,8 @@ class Cell():
388
392
  from topologicpy.Cluster import Cluster
389
393
  from topologicpy.Topology import Topology
390
394
  if not Topology.IsInstance(shell, "Shell"):
391
- print("Cell.ByThickenedShell - Error: The input shell parameter is not a valid topologic Shell. Returning None.")
395
+ if not silent:
396
+ print("Cell.ByThickenedShell - Error: The input shell parameter is not a valid topologic Shell. Returning None.")
392
397
  return None
393
398
  if reverse == True and bothSides == False:
394
399
  thickness = -thickness
@@ -403,8 +408,8 @@ class Cell():
403
408
  bottomEdges = Wire.Edges(bottomWire)
404
409
  for bottomEdge in bottomEdges:
405
410
  topEdge = Topology.Translate(bottomEdge, direction[0]*thickness, direction[1]*thickness, direction[2]*thickness)
406
- sideEdge1 = Edge.ByVertices([Edge.StartVertex(bottomEdge), Edge.StartVertex(topEdge)], tolerance=tolerance, silent=True)
407
- sideEdge2 = Edge.ByVertices([Edge.EndVertex(bottomEdge), Edge.EndVertex(topEdge)], tolerance=tolerance, silent=True)
411
+ sideEdge1 = Edge.ByVertices([Edge.StartVertex(bottomEdge), Edge.StartVertex(topEdge)], tolerance=tolerance, silent=silent)
412
+ sideEdge2 = Edge.ByVertices([Edge.EndVertex(bottomEdge), Edge.EndVertex(topEdge)], tolerance=tolerance, silent=silent)
408
413
  cellWire = Topology.SelfMerge(Cluster.ByTopologies([bottomEdge, sideEdge1, topEdge, sideEdge2]), tolerance=tolerance)
409
414
  cellFace = Face.ByWire(cellWire, tolerance=tolerance)
410
415
  cellFaces.append(cellFace)
topologicpy/Cluster.py CHANGED
@@ -1105,7 +1105,7 @@ class Cluster():
1105
1105
  return Cluster.ByTopologies(cellComplexes+cells)
1106
1106
 
1107
1107
  @staticmethod
1108
- def MysticRose(wire= None, origin= None, radius: float = 0.5, sides: int = 16, perimeter: bool = True, direction: list = [0, 0, 1], placement:str = "center", tolerance: float = 0.0001):
1108
+ def MysticRose(wire= None, origin= None, radius: float = 0.5, sides: int = 16, perimeter: bool = True, direction: list = [0, 0, 1], placement:str = "center", tolerance: float = 0.0001, silent: bool = False):
1109
1109
  """
1110
1110
  Creates a mystic rose.
1111
1111
 
@@ -1127,6 +1127,8 @@ class Cluster():
1127
1127
  The description of the placement of the origin of the mystic rose. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
1128
1128
  tolerance : float , optional
1129
1129
  The desired tolerance. The default is 0.0001.
1130
+ silent : bool , optional
1131
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1130
1132
 
1131
1133
  Returns
1132
1134
  -------
@@ -1153,7 +1155,7 @@ class Cluster():
1153
1155
  if perimeter:
1154
1156
  edges = Wire.Edges(wire)
1155
1157
  for comb in combs:
1156
- edges.append(Edge.ByVertices([vertices[comb[0]], vertices[comb[1]]], tolerance=tolerance))
1158
+ edges.append(Edge.ByVertices([vertices[comb[0]], vertices[comb[1]]], tolerance=tolerance, silent=silent))
1157
1159
  return Cluster.ByTopologies(edges)
1158
1160
 
1159
1161
  @staticmethod
topologicpy/Edge.py CHANGED
@@ -114,7 +114,7 @@ class Edge():
114
114
  return round(ang, mantissa)
115
115
 
116
116
  @staticmethod
117
- def Bisect(edgeA, edgeB, length: float = 1.0, placement: int = 0, tolerance: float = 0.0001):
117
+ def Bisect(edgeA, edgeB, length: float = 1.0, placement: int = 0, tolerance: float = 0.0001, silent: bool = False):
118
118
  """
119
119
  Creates a bisecting edge between edgeA and edgeB.
120
120
 
@@ -134,6 +134,8 @@ class Edge():
134
134
  If set to any number other than 0, 1, or 2, the bisecting edge centroid will be placed at the end vertex of the first edge. The default is 0.
135
135
  tolerance : float , optional
136
136
  The desired tolerance to decide if an Edge can be created. The default is 0.0001.
137
+ silent : bool , optional
138
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
137
139
 
138
140
  Returns
139
141
  -------
@@ -171,29 +173,34 @@ class Edge():
171
173
  return edge1, edge2
172
174
 
173
175
  if not Topology.IsInstance(edgeA, "Edge"):
174
- print("Edge.Bisect - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
176
+ if not silent:
177
+ print("Edge.Bisect - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
175
178
  return None
176
179
  if not Topology.IsInstance(edgeB, "Edge"):
177
- print("Edge.Bisect - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
180
+ if not silent:
181
+ print("Edge.Bisect - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
178
182
  return None
179
183
  if Edge.Length(edgeA) <= tolerance:
180
- print("Edge.Bisect - Error: The input edgeA parameter is shorter than the input tolerance parameter. Returning None.")
184
+ if not silent:
185
+ print("Edge.Bisect - Error: The input edgeA parameter is shorter than the input tolerance parameter. Returning None.")
181
186
  return None
182
187
  if Edge.Length(edgeB) <= tolerance:
183
- print("Edge.Bisect - Error: The input edgeB parameter is shorter than the input tolerance parameter. Returning None.")
188
+ if not silent:
189
+ print("Edge.Bisect - Error: The input edgeB parameter is shorter than the input tolerance parameter. Returning None.")
184
190
  return None
185
191
 
186
192
 
187
193
  edge1, edge2 = process_edges(edgeA, edgeB, tolerance=tolerance)
188
194
  if edge1 == None or edge2 == None:
189
- print("Edge.Bisect - Error: The input edgeA and edgeB parameters do not share a vertex and thus cannot be bisected. Returning None.")
195
+ if not silent:
196
+ print("Edge.Bisect - Error: The input edgeA and edgeB parameters do not share a vertex and thus cannot be bisected. Returning None.")
190
197
  return None
191
198
  sv = Edge.StartVertex(edge1)
192
199
  dir1 = Edge.Direction(edge1)
193
200
  dir2 = Edge.Direction(edge2)
194
201
  bisecting_vector = Vector.Bisect(dir1, dir2)
195
202
  ev = Topology.TranslateByDirectionDistance(sv, bisecting_vector, length)
196
- bisecting_edge = Edge.ByVertices([sv, ev])
203
+ bisecting_edge = Edge.ByVertices([sv, ev], tolerance=tolerance, silent=silent)
197
204
  if placement == 0:
198
205
  bisecting_edge = Topology.TranslateByDirectionDistance(bisecting_edge, Vector.Reverse(bisecting_vector), length*0.5)
199
206
  elif placement == 2:
@@ -366,7 +373,7 @@ class Edge():
366
373
  return None
367
374
 
368
375
  endVertex = Topology.TranslateByDirectionDistance(origin, direction=direction[:3], distance=length)
369
- edge = Edge.ByVertices(origin, endVertex, tolerance=tolerance)
376
+ edge = Edge.ByVertices(origin, endVertex, tolerance=tolerance, silent=silent)
370
377
  return edge
371
378
 
372
379
  @staticmethod
@@ -472,11 +479,11 @@ class Edge():
472
479
  The first input edge. This edge will be extended to meet edgeB.
473
480
  edgeB : topologic_core.Edge
474
481
  The second input edge. This edge will be used to extend edgeA.
475
- silent : bool , optional
476
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
477
482
  tolerance : float , optional
478
483
  The desired tolerance. The default is 0.0001.
479
-
484
+ silent : bool , optional
485
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
486
+
480
487
  Returns
481
488
  -------
482
489
  topologic_core.Edge or topologic_core.Wire
@@ -496,7 +503,7 @@ class Edge():
496
503
  distances.append(Vertex.Distance(pair[0], pair[1]))
497
504
  v_list = Helper.Sort(v_list, distances)
498
505
  closest_pair = v_list[0]
499
- return_edge = Edge.ByVertices(closest_pair, silent=silent)
506
+ return_edge = Edge.ByVertices(closest_pair, tolerance=tolerance, silent=silent)
500
507
  if return_edge == None:
501
508
  if not silent:
502
509
  print("Edge.ConnectToEdge - Warning: Could not connect the two edges. Returning None.")
@@ -617,7 +624,7 @@ class Edge():
617
624
 
618
625
 
619
626
  @staticmethod
620
- def Extend(edge, distance: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001):
627
+ def Extend(edge, distance: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001, silent: bool = False):
621
628
  """
622
629
  Extends the input edge by the input distance.
623
630
 
@@ -633,6 +640,8 @@ class Edge():
633
640
  If set to True, the edge will be extended from its start vertex. Otherwise, it will be extended from its end vertex. The default is False.
634
641
  tolerance : float , optional
635
642
  The desired tolerance. The default is 0.0001.
643
+ silent : bool , optional
644
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
636
645
 
637
646
  Returns
638
647
  -------
@@ -659,7 +668,7 @@ class Edge():
659
668
  else:
660
669
  sve = Edge.StartVertex(edge)
661
670
  eve = Edge.VertexByDistance(edge, distance=distance, origin=ev, tolerance=tolerance)
662
- return Edge.ByVertices([sve, eve], tolerance=tolerance, silent=True)
671
+ return Edge.ByVertices([sve, eve], tolerance=tolerance, silent=silent)
663
672
 
664
673
  @staticmethod
665
674
  def ExtendToEdge(edgeA, edgeB, mantissa: int = 6, step: bool = True, tolerance: float = 0.0001, silent: bool = False):
@@ -728,14 +737,14 @@ class Edge():
728
737
 
729
738
  d = max(d1, d2)*2
730
739
  v2 = Topology.TranslateByDirectionDistance(v2, direction=edge_direction, distance=d)
731
- new_edge = Edge.ByVertices(v1, v2)
740
+ new_edge = Edge.ByVertices([v1, v2], tolerance=tolerance, silent=silent)
732
741
 
733
742
  svb = Edge.StartVertex(edgeB)
734
743
  evb = Edge.EndVertex(edgeB)
735
744
 
736
745
  intVertex = Topology.Intersect(new_edge, edgeB, tolerance=tolerance)
737
746
  if intVertex:
738
- return Edge.ByVertices([v1, intVertex], tolerance=tolerance, silent=True)
747
+ return Edge.ByVertices([v1, intVertex], tolerance=tolerance, silent=silent)
739
748
  if not silent:
740
749
  print("Edge.ExtendToEdge - Warning: The operation failed. Connecting the edges instead. Returning a Wire.")
741
750
  return Edge.ConnectToEdge(edgeA, edgeB, tolerance=tolerance)
@@ -1323,7 +1332,7 @@ class Edge():
1323
1332
  return normal_edge
1324
1333
 
1325
1334
  @staticmethod
1326
- def Normalize(edge, useEndVertex: bool = False, tolerance: float = 0.0001):
1335
+ def Normalize(edge, useEndVertex: bool = False, tolerance: float = 0.0001, silent: bool = False):
1327
1336
  """
1328
1337
  Creates a normalized edge that has the same direction as the input edge, but a length of 1.
1329
1338
 
@@ -1335,6 +1344,8 @@ class Edge():
1335
1344
  If True the normalized edge end vertex will be placed at the end vertex of the input edge. Otherwise, the normalized edge start vertex will be placed at the start vertex of the input edge. The default is False.
1336
1345
  tolerance : float , optional
1337
1346
  The desired tolerance. The default is 0.0001.
1347
+ silent : bool , optional
1348
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1338
1349
 
1339
1350
  Returns
1340
1351
  -------
@@ -1345,7 +1356,8 @@ class Edge():
1345
1356
  from topologicpy.Topology import Topology
1346
1357
 
1347
1358
  if not Topology.IsInstance(edge, "Edge"):
1348
- print("Edge.Normalize - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1359
+ if not silent:
1360
+ print("Edge.Normalize - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1349
1361
  return None
1350
1362
  if not useEndVertex:
1351
1363
  sv = Edge.StartVertex(edge)
@@ -1353,7 +1365,7 @@ class Edge():
1353
1365
  else:
1354
1366
  sv = Edge.VertexByDistance(edge, 1.0, Edge.StartVertex(edge))
1355
1367
  ev = Edge.EndVertex(edge)
1356
- return Edge.ByVertices([sv, ev], tolerance=tolerance)
1368
+ return Edge.ByVertices([sv, ev], tolerance=tolerance, silent=silent)
1357
1369
 
1358
1370
  @staticmethod
1359
1371
  def ParameterAtVertex(edge, vertex, mantissa: int = 6, silent: bool = False) -> float:
@@ -1395,7 +1407,7 @@ class Edge():
1395
1407
  return round(parameter, mantissa)
1396
1408
 
1397
1409
  @staticmethod
1398
- def Reverse(edge, tolerance: float = 0.0001):
1410
+ def Reverse(edge, tolerance: float = 0.0001, silent: bool = False):
1399
1411
  """
1400
1412
  Creates an edge that has the reverse direction of the input edge.
1401
1413
 
@@ -1405,6 +1417,8 @@ class Edge():
1405
1417
  The input edge.
1406
1418
  tolerance : float , optional
1407
1419
  The desired tolerance. The default is 0.0001.
1420
+ silent : bool , optional
1421
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1408
1422
 
1409
1423
  Returns
1410
1424
  -------
@@ -1415,9 +1429,10 @@ class Edge():
1415
1429
  from topologicpy.Topology import Topology
1416
1430
 
1417
1431
  if not Topology.IsInstance(edge, "Edge"):
1418
- print("Edge.Reverse - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1432
+ if not silent:
1433
+ print("Edge.Reverse - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1419
1434
  return None
1420
- return Edge.ByVertices([Edge.EndVertex(edge), Edge.StartVertex(edge)], tolerance=tolerance)
1435
+ return Edge.ByVertices([Edge.EndVertex(edge), Edge.StartVertex(edge)], tolerance=tolerance, silent=silent)
1421
1436
 
1422
1437
  @staticmethod
1423
1438
  def SetLength(edge , length: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001):
@@ -1482,7 +1497,7 @@ class Edge():
1482
1497
  return vert
1483
1498
 
1484
1499
  @staticmethod
1485
- def Trim(edge, distance: float = 0.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001):
1500
+ def Trim(edge, distance: float = 0.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001, silent: bool = False):
1486
1501
  """
1487
1502
  Trims the input edge by the input distance.
1488
1503
 
@@ -1498,6 +1513,8 @@ class Edge():
1498
1513
  If set to True, the edge will be trimmed from its start vertex. Otherwise, it will be trimmed from its end vertex. The default is False.
1499
1514
  tolerance : float , optional
1500
1515
  The desired tolerance. The default is 0.0001.
1516
+ silent : bool , optional
1517
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1501
1518
 
1502
1519
  Returns
1503
1520
  -------
@@ -1527,7 +1544,7 @@ class Edge():
1527
1544
  else:
1528
1545
  sve = Edge.StartVertex(edge)
1529
1546
  eve = Edge.VertexByDistance(edge, distance=-distance, origin=ev, tolerance=tolerance)
1530
- return Edge.ByVertices([sve, eve], tolerance=tolerance, silent=True)
1547
+ return Edge.ByVertices([sve, eve], tolerance=tolerance, silent=silent)
1531
1548
 
1532
1549
  @staticmethod
1533
1550
  def TrimByEdge(edgeA, edgeB, reverse: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False):
@@ -1587,9 +1604,9 @@ class Edge():
1587
1604
  intVertex = None
1588
1605
  if intVertex:
1589
1606
  if reverse:
1590
- return Edge.ByVertices([eva, intVertex], tolerance=tolerance, silent=True)
1607
+ return Edge.ByVertices([eva, intVertex], tolerance=tolerance, silent=silent)
1591
1608
  else:
1592
- return Edge.ByVertices([sva, intVertex], tolerance=tolerance, silent=True)
1609
+ return Edge.ByVertices([sva, intVertex], tolerance=tolerance, silent=silent)
1593
1610
  else:
1594
1611
  return None
1595
1612
 
@@ -1598,9 +1615,9 @@ class Edge():
1598
1615
  intVertex = Topology.Intersect(edgeA, edgeB)
1599
1616
  if intVertex and (Vertex.IsInternal(intVertex, edgeA)):
1600
1617
  if reverse:
1601
- return Edge.ByVertices([eva, intVertex], tolerance=tolerance, silent=True)
1618
+ return Edge.ByVertices([eva, intVertex], tolerance=tolerance, silent=slient)
1602
1619
  else:
1603
- return Edge.ByVertices([sva, intVertex], tolerance=tolerance, silent=True)
1620
+ return Edge.ByVertices([sva, intVertex], tolerance=tolerance, silent=silent)
1604
1621
  return edgeA
1605
1622
 
1606
1623
  @staticmethod