topologicpy 0.4.55__tar.gz → 0.4.57__tar.gz

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.
Files changed (94) hide show
  1. {topologicpy-0.4.55/src/topologicpy.egg-info → topologicpy-0.4.57}/PKG-INFO +1 -1
  2. {topologicpy-0.4.55 → topologicpy-0.4.57}/pyproject.toml +1 -1
  3. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Cell.py +95 -22
  4. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/CellComplex.py +36 -5
  5. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/DGL.py +4 -1
  6. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Edge.py +1 -1
  7. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Face.py +86 -64
  8. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Graph.py +37 -34
  9. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Helper.py +83 -44
  10. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Plotly.py +15 -14
  11. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Shell.py +70 -28
  12. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Topology.py +155 -174
  13. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Wire.py +64 -146
  14. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/__init__.py +22 -22
  15. topologicpy-0.4.57/src/topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so +0 -0
  16. topologicpy-0.4.57/src/topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so +0 -0
  17. topologicpy-0.4.57/src/topologicpy/bin/linux/topologic/topologic.cpython-38-x86_64-linux-gnu.so +0 -0
  18. topologicpy-0.4.57/src/topologicpy/bin/linux/topologic/topologic.cpython-39-x86_64-linux-gnu.so +0 -0
  19. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKBO-6bdf205d.so.7.7.0 +0 -0
  20. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKBRep-2960a069.so.7.7.0 +0 -0
  21. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKBool-c44b74bd.so.7.7.0 +0 -0
  22. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKFillet-9a670ba0.so.7.7.0 +0 -0
  23. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKG2d-8f31849e.so.7.7.0 +0 -0
  24. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKG3d-4c6bce57.so.7.7.0 +0 -0
  25. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
  26. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
  27. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKMath-72572fa8.so.7.7.0 +0 -0
  28. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKMesh-2a060427.so.7.7.0 +0 -0
  29. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKOffset-6cab68ff.so.7.7.0 +0 -0
  30. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKPrim-eb1262b3.so.7.7.0 +0 -0
  31. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
  32. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
  33. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/linux/topologic.libs/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
  34. topologicpy-0.4.57/src/topologicpy/bin/linux/topologic.libs/libgcc_s-32c1665e.so.1 +0 -0
  35. topologicpy-0.4.57/src/topologicpy/bin/linux/topologic.libs/libstdc++-672d7b41.so.6.0.30 +0 -0
  36. {topologicpy-0.4.55/src/topologicpy/bin/linux → topologicpy-0.4.57/src/topologicpy/bin/macos}/topologic/__init__.py +2 -2
  37. {topologicpy-0.4.55/src/topologicpy/bin/macos → topologicpy-0.4.57/src/topologicpy/bin/windows}/topologic/__init__.py +2 -2
  38. topologicpy-0.4.57/src/topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd +0 -0
  39. topologicpy-0.4.57/src/topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd +0 -0
  40. topologicpy-0.4.57/src/topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd +0 -0
  41. topologicpy-0.4.57/src/topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd +0 -0
  42. {topologicpy-0.4.55 → topologicpy-0.4.57/src/topologicpy.egg-info}/PKG-INFO +1 -1
  43. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy.egg-info/SOURCES.txt +2 -6
  44. topologicpy-0.4.55/src/topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so +0 -0
  45. topologicpy-0.4.55/src/topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so +0 -0
  46. topologicpy-0.4.55/src/topologicpy/bin/linux/topologic/topologic.cpython-38-x86_64-linux-gnu.so +0 -0
  47. topologicpy-0.4.55/src/topologicpy/bin/linux/topologic/topologic.cpython-39-x86_64-linux-gnu.so +0 -0
  48. topologicpy-0.4.55/src/topologicpy/bin/linux/topologic.libs/libgcc_s-b928ac34.so.1 +0 -0
  49. topologicpy-0.4.55/src/topologicpy/bin/linux/topologic.libs/libstdc++-e9ef912c.so.6.0.32 +0 -0
  50. topologicpy-0.4.55/src/topologicpy/bin/macos/topologic/topologic.cpython-310-darwin.so +0 -0
  51. topologicpy-0.4.55/src/topologicpy/bin/macos/topologic/topologic.cpython-311-darwin.so +0 -0
  52. topologicpy-0.4.55/src/topologicpy/bin/macos/topologic/topologic.cpython-38-darwin.so +0 -0
  53. topologicpy-0.4.55/src/topologicpy/bin/macos/topologic/topologic.cpython-39-darwin.so +0 -0
  54. topologicpy-0.4.55/src/topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd +0 -0
  55. topologicpy-0.4.55/src/topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd +0 -0
  56. topologicpy-0.4.55/src/topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd +0 -0
  57. topologicpy-0.4.55/src/topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd +0 -0
  58. {topologicpy-0.4.55 → topologicpy-0.4.57}/LICENSE +0 -0
  59. {topologicpy-0.4.55 → topologicpy-0.4.57}/MANIFEST.in +0 -0
  60. {topologicpy-0.4.55 → topologicpy-0.4.57}/README.md +0 -0
  61. {topologicpy-0.4.55 → topologicpy-0.4.57}/setup.cfg +0 -0
  62. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Aperture.py +0 -0
  63. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Cluster.py +0 -0
  64. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Color.py +0 -0
  65. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Context.py +0 -0
  66. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Dictionary.py +0 -0
  67. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/EnergyModel.py +0 -0
  68. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Grid.py +0 -0
  69. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Honeybee.py +0 -0
  70. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Matrix.py +0 -0
  71. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Neo4j.py +0 -0
  72. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Polyskel.py +0 -0
  73. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Speckle.py +0 -0
  74. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Vector.py +0 -0
  75. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/Vertex.py +0 -0
  76. {topologicpy-0.4.55/src/topologicpy/bin/windows → topologicpy-0.4.57/src/topologicpy/bin/linux}/topologic/__init__.py +0 -0
  77. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKBO-f6b191de.dll +0 -0
  78. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKBRep-e56a600e.dll +0 -0
  79. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKBool-7b8d47ae.dll +0 -0
  80. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKFillet-0ddbf0a8.dll +0 -0
  81. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKG2d-2e2dee3d.dll +0 -0
  82. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKG3d-6674513d.dll +0 -0
  83. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKGeomAlgo-d240e370.dll +0 -0
  84. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKGeomBase-df87aba5.dll +0 -0
  85. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKMath-45bd625a.dll +0 -0
  86. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKMesh-d6e826b1.dll +0 -0
  87. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKOffset-79b9cc94.dll +0 -0
  88. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKPrim-aa430a86.dll +0 -0
  89. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKShHealing-bb48be89.dll +0 -0
  90. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKTopAlgo-7d0d1e22.dll +0 -0
  91. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy/bin/windows/topologic/TKernel-08c8cfbb.dll +0 -0
  92. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy.egg-info/dependency_links.txt +0 -0
  93. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy.egg-info/requires.txt +0 -0
  94. {topologicpy-0.4.55 → topologicpy-0.4.57}/src/topologicpy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.4.55
3
+ Version: 0.4.57
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
@@ -3,7 +3,7 @@ requires = ["setuptools>=61"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [project]
5
5
  name = "topologicpy"
6
- version = "0.4.55"
6
+ version = "0.4.57"
7
7
  authors = [
8
8
  { name="Wassim Jabi", email="wassim.jabi@gmail.com" },
9
9
  ]
@@ -93,8 +93,10 @@ class Cell(Topology):
93
93
  The created cell.
94
94
 
95
95
  """
96
+ from topologicpy.Vertex import Vertex
96
97
  from topologicpy.Wire import Wire
97
98
  from topologicpy.Face import Face
99
+ from topologicpy.Cluster import Cluster
98
100
  from topologicpy.Topology import Topology
99
101
  if not isinstance(faces, list):
100
102
  print("Cell.ByFaces - Error: The input faces parameter is not a valid list. Returning None.")
@@ -103,15 +105,41 @@ class Cell(Topology):
103
105
  if len(faceList) < 1:
104
106
  print("Cell.ByFaces - Error: The input faces parameter does not contain valid faces. Returning None.")
105
107
  return None
108
+ # Try the default method
109
+ cell = topologic.Cell.ByFaces(faceList, tolerance)
110
+ if isinstance(cell, topologic.Cell):
111
+ return cell
112
+
113
+ # Fuse all the vertices first and rebuild the faces
114
+ all_vertices = []
115
+ wires = []
116
+ for f in faceList:
117
+ w = Face.Wire(f)
118
+ wires.append(w)
119
+ all_vertices += Topology.Vertices(w)
120
+ all_vertices = Vertex.Fuse(all_vertices, tolerance=tolerance)
121
+ new_faces = []
122
+ for w in wires:
123
+ face_vertices = []
124
+ for v in Topology.Vertices(w):
125
+ index = Vertex.Index(v, all_vertices, tolerance=tolerance)
126
+ if not index == None:
127
+ face_vertices.append(all_vertices[index])
128
+ new_w = Wire.ByVertices(face_vertices)
129
+ if isinstance(new_w, topologic.Wire):
130
+ new_f = Face.ByWire(new_w)
131
+ if isinstance(new_f, topologic.Face):
132
+ new_faces.append(new_f)
133
+ faceList = new_faces
106
134
  planarizedList = []
107
135
  enlargedList = []
108
136
  if planarize:
109
137
  planarizedList = [Face.Planarize(f, tolerance=tolerance) for f in faceList]
110
138
  enlargedList = [Face.ByOffset(f, offset=-tolerance*10) for f in planarizedList]
111
139
  cell = topologic.Cell.ByFaces(enlargedList, tolerance)
112
- faces = Topology.SubTopologies(cell, subTopologyType="face")
140
+ faceList = Topology.SubTopologies(cell, subTopologyType="face")
113
141
  finalFaces = []
114
- for f in faces:
142
+ for f in faceList:
115
143
  centroid = Topology.Centroid(f)
116
144
  n = Face.Normal(f)
117
145
  v = Topology.Translate(centroid, n[0]*0.01,n[1]*0.01,n[2]*0.01)
@@ -121,10 +149,22 @@ class Cell(Topology):
121
149
  for f in finalFaces:
122
150
  vertices = Face.Vertices(f)
123
151
  w = Wire.Cycles(Face.ExternalBoundary(f), maxVertices=len(vertices))[0]
124
- finalFinalFaces.append(Face.ByWire(w, tolerance=tolerance))
125
- return topologic.Cell.ByFaces(finalFinalFaces, tolerance)
152
+ f1 = Face.ByWire(w, tolerance=tolerance)
153
+ if isinstance(f1, topologic.Face):
154
+ finalFinalFaces.append(f1)
155
+ cell = topologic.Cell.ByFaces(finalFinalFaces, tolerance)
156
+ if cell == None:
157
+ print("1. Cell.ByFaces - Error: The operation failed. Returning None.")
158
+ return None
159
+ else:
160
+ return cell
126
161
  else:
127
- return topologic.Cell.ByFaces(faces, tolerance)
162
+ cell = topologic.Cell.ByFaces(faces, tolerance)
163
+ if cell == None:
164
+ print("2. Cell.ByFaces - Error: The operation failed. Returning None.")
165
+ return None
166
+ else:
167
+ return cell
128
168
 
129
169
  @staticmethod
130
170
  def ByShell(shell: topologic.Shell, planarize: bool = False, tolerance: float = 0.0001) -> topologic.Cell:
@@ -294,15 +334,25 @@ class Cell(Topology):
294
334
  The created cell.
295
335
 
296
336
  """
337
+ from topologicpy.Vertex import Vertex
338
+ from topologicpy.Edge import Edge
339
+ from topologicpy.Wire import Wire
340
+ from topologicpy.Face import Face
341
+ from topologicpy.Shell import Shell
342
+ from topologicpy.Cluster import Cluster
343
+ from topologicpy.Topology import Topology
344
+ from topologicpy.Dictionary import Dictionary
297
345
 
298
346
  def cleanup(f):
299
- flatFace = Face.Flatten(f, tolerance=tolerance)
347
+ origin = Topology.Centroid(f)
348
+ normal = Face.Normal(f)
349
+ flatFace = Topology.Flatten(f, origin=origin, direction=normal)
300
350
  world_origin = Vertex.ByCoordinates(0,0,0)
301
351
  # Retrieve the needed transformations
302
352
  dictionary = Topology.Dictionary(flatFace)
303
- xTran = Dictionary.ValueAtKey(dictionary,"xTran")
304
- yTran = Dictionary.ValueAtKey(dictionary,"yTran")
305
- zTran = Dictionary.ValueAtKey(dictionary,"zTran")
353
+ xTran = Dictionary.ValueAtKey(dictionary,"x")
354
+ yTran = Dictionary.ValueAtKey(dictionary,"y")
355
+ zTran = Dictionary.ValueAtKey(dictionary,"z")
306
356
  phi = Dictionary.ValueAtKey(dictionary,"phi")
307
357
  theta = Dictionary.ValueAtKey(dictionary,"theta")
308
358
 
@@ -310,15 +360,6 @@ class Cell(Topology):
310
360
  f = Topology.Rotate(f, origin=world_origin, x=0, y=0, z=1, degree=phi)
311
361
  f = Topology.Translate(f, xTran, yTran, zTran)
312
362
  return f
313
-
314
- from topologicpy.Vertex import Vertex
315
- from topologicpy.Edge import Edge
316
- from topologicpy.Wire import Wire
317
- from topologicpy.Face import Face
318
- from topologicpy.Shell import Shell
319
- from topologicpy.Cluster import Cluster
320
- from topologicpy.Topology import Topology
321
- from topologicpy.Dictionary import Dictionary
322
363
 
323
364
  if not isinstance(wires, list):
324
365
  print("Cell.ByWires - Error: The input wires parameter is not a valid list. Returning None.")
@@ -1437,8 +1478,40 @@ class Cell(Topology):
1437
1478
  prism = Topology.Rotate(prism, origin, 0, 1, 0, theta)
1438
1479
  prism = Topology.Rotate(prism, origin, 0, 0, 1, phi)
1439
1480
  return prism
1481
+
1482
+ @staticmethod
1483
+ def RemoveCollinearEdges(cell: topologic.Cell, angTolerance: float = 0.1, tolerance: float = 0.0001) -> topologic.Wire:
1484
+ """
1485
+ Removes any collinear edges in the input cell.
1486
+
1487
+ Parameters
1488
+ ----------
1489
+ cell : topologic.Cell
1490
+ The input cell.
1491
+ angTolerance : float , optional
1492
+ The desired angular tolerance. The default is 0.1.
1493
+ tolerance : float , optional
1494
+ The desired tolerance. The default is 0.0001.
1495
+
1496
+ Returns
1497
+ -------
1498
+ topologic.Cell
1499
+ The created cell without any collinear edges.
1500
+
1501
+ """
1502
+ from topologicpy.Face import Face
1503
+
1504
+ if not isinstance(cell, topologic.Cell):
1505
+ print("Cell.RemoveCollinearEdges - Error: The input cell parameter is not a valid cell. Returning None.")
1506
+ return None
1507
+ faces = Cell.Faces(cell)
1508
+ clean_faces = []
1509
+ for face in faces:
1510
+ clean_faces.append(Face.RemoveCollinearEdges(face, angTolerance=angTolerance, tolerance=tolerance))
1511
+ return Cell.ByFaces(clean_faces, tolerance=tolerance)
1440
1512
 
1441
- def Roof(face, degree: float = 45, angTolerance: float = 2.0 , tolerance: float = 0.001):
1513
+ @staticmethod
1514
+ def Roof(face, degree: float = 45, epsilon: float = 0.01 , tolerance: float = 0.001):
1442
1515
  """
1443
1516
  Creates a hipped roof through a straight skeleton. This method is contributed by 高熙鹏 xipeng gao <gaoxipeng1998@gmail.com>
1444
1517
  This algorithm depends on the polyskel code which is included in the library. Polyskel code is found at: https://github.com/Botffy/polyskel
@@ -1449,8 +1522,8 @@ class Cell(Topology):
1449
1522
  The input face.
1450
1523
  degree : float , optioal
1451
1524
  The desired angle in degrees of the roof. The default is 45.
1452
- angTolerance : float , optional
1453
- The desired angular tolerance. The default is 2. (This is set to a larger number as it was found to work better)
1525
+ epsilon : float , optional
1526
+ The desired epsilon (another form of tolerance for distance from plane). The default is 0.01. (This is set to a larger number as it was found to work better)
1454
1527
  tolerance : float , optional
1455
1528
  The desired tolerance. The default is 0.001. (This is set to a larger number as it was found to work better)
1456
1529
 
@@ -1464,7 +1537,7 @@ class Cell(Topology):
1464
1537
  from topologicpy.Cell import Cell
1465
1538
  from topologicpy.Topology import Topology
1466
1539
 
1467
- shell = Shell.Roof(face=face, degree=degree, angTolerance=angTolerance, tolerance=tolerance)
1540
+ shell = Shell.Roof(face=face, degree=degree, epsilon=epsilon, tolerance=tolerance)
1468
1541
  faces = Topology.Faces(shell) + [face]
1469
1542
  cell = Cell.ByFaces(faces, tolerance=tolerance)
1470
1543
  if not cell:
@@ -275,10 +275,10 @@ class CellComplex(topologic.CellComplex):
275
275
  e3 = None
276
276
  e4 = None
277
277
  try:
278
- e3 = Edge.ByStartVertexEndVertex(e1.StartVertex(), e2.StartVertex(), tolerance=tolerance)
278
+ e3 = Edge.ByStartVertexEndVertex(e1.StartVertex(), e2.StartVertex(), tolerance=tolerance, verbose=False)
279
279
  except:
280
280
  try:
281
- e4 = Edge.ByStartVertexEndVertex(e1.EndVertex(), e2.EndVertex(), tolerance=tolerance)
281
+ e4 = Edge.ByStartVertexEndVertex(e1.EndVertex(), e2.EndVertex(), tolerance=tolerance, verbose=False)
282
282
  f = Face.ByExternalBoundary(Wire.ByEdges([e1, e2, e4], tolerance=tolerance))
283
283
  if triangulate == True:
284
284
  if len(Topology.Vertices(face)) > 3:
@@ -291,10 +291,10 @@ class CellComplex(topologic.CellComplex):
291
291
  except:
292
292
  pass
293
293
  try:
294
- e4 = Edge.ByStartVertexEndVertex(e1.EndVertex(), e2.EndVertex(), tolerance=tolerance)
294
+ e4 = Edge.ByStartVertexEndVertex(e1.EndVertex(), e2.EndVertex(), tolerance=tolerance, verbose=False)
295
295
  except:
296
296
  try:
297
- e3 = Edge.ByStartVertexEndVertex(e1.StartVertex(), e2.StartVertex(), tolerance=tolerance)
297
+ e3 = Edge.ByStartVertexEndVertex(e1.StartVertex(), e2.StartVertex(), tolerance=tolerance, verbose=False)
298
298
  f = Face.ByWire(Wire.ByEdges([e1, e2, e3], tolerance=tolerance), tolerance=tolerance)
299
299
  if triangulate == True:
300
300
  if len(Topology.Vertices(face)) > 3:
@@ -308,7 +308,7 @@ class CellComplex(topologic.CellComplex):
308
308
  pass
309
309
  if e3 and e4:
310
310
  if triangulate == True:
311
- e5 = Edge.ByStartVertexEndVertex(e1.StartVertex(), e2.EndVertex(), tolerance=tolerance)
311
+ e5 = Edge.ByStartVertexEndVertex(e1.StartVertex(), e2.EndVertex(), tolerance=tolerance, verbose=False)
312
312
  faces.append(Face.ByWire(Wire.ByEdges([e1, e5, e4], tolerance=tolerance), tolerance=tolerance))
313
313
  faces.append(Face.ByWire(Wire.ByEdges([e2, e5, e3], tolerance=tolerance), tolerance=tolerance))
314
314
  else:
@@ -759,6 +759,37 @@ class CellComplex(topologic.CellComplex):
759
759
  print("CellComplex.Prism - Error: Could not create a prism. Returning None.")
760
760
  return None
761
761
 
762
+ @staticmethod
763
+ def RemoveCollinearEdges(cellComplex: topologic.CellComplex, angTolerance: float = 0.1, tolerance: float = 0.0001) -> topologic.Wire:
764
+ """
765
+ Removes any collinear edges in the input cellComplex.
766
+
767
+ Parameters
768
+ ----------
769
+ cellComplex : topologic.CellComplex
770
+ The input cellComplex.
771
+ angTolerance : float , optional
772
+ The desired angular tolerance. The default is 0.1.
773
+ tolerance : float , optional
774
+ The desired tolerance. The default is 0.0001.
775
+
776
+ Returns
777
+ -------
778
+ topologic.CellComplex
779
+ The created cellComplex without any collinear edges.
780
+
781
+ """
782
+ from topologicpy.Cell import Cell
783
+
784
+ if not isinstance(cellComplex, topologic.CellComplex):
785
+ print("CellComplex.RemoveCollinearEdges - Error: The input cellComplex parameter is not a valid cellComplex. Returning None.")
786
+ return None
787
+ cells = CellComplex.Cells(cellComplex)
788
+ clean_cells = []
789
+ for cell in cells:
790
+ clean_cells.append(Cell.RemoveCollinearEdges(cell, angTolerance=angTolerance, tolerance=tolerance))
791
+ return CellComplex.ByCells(clean_cells, tolerance=tolerance)
792
+
762
793
  @staticmethod
763
794
  def Shells(cellComplex: topologic.CellComplex) -> list:
764
795
  """
@@ -2234,7 +2234,10 @@ class DGL:
2234
2234
  validate_ds = DGL.DatasetByGraphs({'graphs': graph_sublists[1], 'labels' :labels_sublists[1]})
2235
2235
  if split[2] > 0 and len(graph_sublists[2]) > 0:
2236
2236
  test_ds = DGL.DatasetByGraphs({'graphs': graph_sublists[2], 'labels' :labels_sublists[2]})
2237
-
2237
+ # Print label shapes for debugging
2238
+ print("Train Labels Shapes:", [labels.shape for labels in labels_sublists[0]])
2239
+ print("Validate Labels Shapes:", [labels.shape for labels in labels_sublists[1]])
2240
+ print("Test Labels Shapes:", [labels.shape for labels in labels_sublists[2]])
2238
2241
  return {
2239
2242
  "train_ds" : train_ds,
2240
2243
  "validate_ds" : validate_ds,
@@ -140,7 +140,7 @@ class Edge():
140
140
  return None
141
141
  n = Face.Normal(face)
142
142
  v2 = Topology.Translate(origin, n[0], n[1], n[2])
143
- edge = Edge.ByStartVertexEndVertex(origin, v2, tolerance=tolerance)
143
+ edge = Edge.ByStartVertexEndVertex(origin, v2, tolerance=tolerance, verbose=False)
144
144
  if not isinstance(edge, topologic.Edge):
145
145
  print("Edge.ByFaceNormal - Error: Could not create an edge. Returning None.")
146
146
  return None
@@ -356,7 +356,9 @@ class Face(topologic.Face):
356
356
  from topologicpy.Vertex import Vertex
357
357
  from topologicpy.Wire import Wire
358
358
  from topologicpy.Shell import Shell
359
+ from topologicpy.Cluster import Cluster
359
360
  from topologicpy.Topology import Topology
361
+ from topologicpy.Dictionary import Dictionary
360
362
 
361
363
  def planarizeList(wireList):
362
364
  returnList = []
@@ -369,14 +371,20 @@ class Face(topologic.Face):
369
371
  return None
370
372
 
371
373
  if origin == None:
372
- origin = Vertex.Origin()
374
+ origin = Topology.Centroid(shell)
373
375
  if not isinstance(origin, topologic.Vertex):
374
- print("Shell.Planarize - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
376
+ print("Face.ByShell - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
375
377
  return None
376
-
378
+ world_origin = Vertex.Origin()
377
379
  planar_shell = Shell.Planarize(shell)
378
380
  normal = Face.Normal(Topology.Faces(planar_shell)[0])
379
- planar_shell = Topology.Flatten(planar_shell, origin=origin, vector=normal)
381
+ planar_shell = Topology.Flatten(planar_shell, origin=origin, direction=normal)
382
+ d = Topology.Dictionary(planar_shell)
383
+ phi = Dictionary.ValueAtKey(d, 'phi')
384
+ theta = Dictionary.ValueAtKey(d, 'theta')
385
+ x_tran = Dictionary.ValueAtKey(d, 'x')
386
+ y_tran = Dictionary.ValueAtKey(d, 'y')
387
+ z_tran = Dictionary.ValueAtKey(d, 'z')
380
388
  vertices = Shell.Vertices(planar_shell)
381
389
  new_vertices = []
382
390
  for v in vertices:
@@ -395,10 +403,12 @@ class Face(topologic.Face):
395
403
  ext_boundary = Wire.Planarize(ext_boundary, origin=origin, tolerance=tolerance)
396
404
  ext_boundary = Topology.RemoveCollinearEdges(ext_boundary, angTolerance)
397
405
  try:
398
- return Face.ByWire(ext_boundary)
406
+ face = Face.ByWire(ext_boundary)
407
+ face = Topology.Rotate(face, world_origin, 0, 1, 0, theta)
408
+ face = Topology.Rotate(face, world_origin, 0, 0, 1, phi)
409
+ face = Topology.Translate(face, x_tran, y_tran, z_tran)
410
+ return face
399
411
  except:
400
- normal = Face.Normal(Topology.Faces(ext_boundary)[0])
401
- planar_shell = Topology.Flatten(planar_shell, vector=normal)
402
412
  print("Face.ByShell - Error: The operation failed. Returning None.")
403
413
  return None
404
414
  elif isinstance(ext_boundary, topologic.Cluster): # The shell has holes.
@@ -407,10 +417,9 @@ class Face(topologic.Face):
407
417
  faces = []
408
418
  areas = []
409
419
  for wire in wires:
410
- #wire = Wire.Planarize(Wire.RemoveCollinearEdges(Wire.Planarize(wire, origin=origin, tolerance=tolerance), angTolerance), origin=origin, tolerance=tolerance)
411
420
  aFace = Face.ByWire(wire, tolerance=tolerance)
412
421
  if not isinstance(aFace, topologic.Face):
413
- print("2. Face.ByShell - Error: The operation failed. Returning None.")
422
+ print("Face.ByShell - Error: The operation failed. Returning None.")
414
423
  return None
415
424
  anArea = abs(Face.Area(aFace))
416
425
  faces.append(aFace)
@@ -422,13 +431,15 @@ class Face(topologic.Face):
422
431
  for int_boundary in int_boundaries:
423
432
  temp_wires = []
424
433
  _ = int_boundary.Wires(None, temp_wires)
425
- int_wires.append(temp_wires[0])
434
+ int_wires.append(Topology.RemoveCollinearEdges(temp_wires[0], angTolerance))
426
435
  temp_wires = []
427
436
  _ = ext_boundary.Wires(None, temp_wires)
428
437
  ext_wire = Topology.RemoveCollinearEdges(temp_wires[0], angTolerance)
429
438
  face = Face.ByWires(ext_wire, int_wires)
430
- face = Topology.Orient(face, origin=origin, dirA=[0,0,1], dirB=normal)
431
- #face = Topology.Translate(face, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
439
+
440
+ face = Topology.Rotate(face, world_origin, 0, 1, 0, theta)
441
+ face = Topology.Rotate(face, world_origin, 0, 0, 1, phi)
442
+ face = Topology.Translate(face, x_tran, y_tran, z_tran)
432
443
  return face
433
444
  else:
434
445
  return None
@@ -523,8 +534,12 @@ class Face(topologic.Face):
523
534
  print("Face.ByWire - Error: The input wire parameter is not a valid topologic wire. Returning None.")
524
535
  return None
525
536
  if not Wire.IsClosed(wire):
526
- print("Face.ByWire - Error: The input wire parameter is not a closed topologic wire. Returning None.")
527
- return None
537
+ print("Face.ByWire - Error: The input wire parameter is not a closed topologic wire. Attempting to close it.")
538
+ wire = Wire.Close(wire)
539
+ wire = Wire.Planarize(wire)
540
+ if not Wire.IsClosed(wire):
541
+ print("Face.ByWire - Error: Could not close the input wire parameter. Giving up and returning None.")
542
+ return None
528
543
 
529
544
  edges = Wire.Edges(wire)
530
545
  wire = Topology.SelfMerge(Cluster.ByTopologies(edges), tolerance=tolerance)
@@ -1036,7 +1051,7 @@ class Face(topologic.Face):
1036
1051
  tempVertices = rotate_vertices(tempVertices, temp_v)
1037
1052
  flatInternalBoundaries.append(Wire.ByVertices(tempVertices))
1038
1053
  flatFace = Face.ByWires(flatExternalBoundary, flatInternalBoundaries, tolerance=tolerance)
1039
- dictionary = Dictionary.ByKeysValues(["xTran", "yTran", "zTran", "phi", "theta"], [cm.X(), cm.Y(), cm.Z(), phi, theta])
1054
+ dictionary = Dictionary.ByKeysValues(["x", "y", "z", "phi", "theta"], [cm.X(), cm.Y(), cm.Z(), phi, theta])
1040
1055
  flatFace = Topology.SetDictionary(flatFace, dictionary)
1041
1056
  return flatFace
1042
1057
 
@@ -1064,14 +1079,17 @@ class Face(topologic.Face):
1064
1079
  from topologicpy.Dictionary import Dictionary
1065
1080
 
1066
1081
  if not isinstance(face, topologic.Face):
1082
+ print("Face.Harmonize - Error: The input face parameter is not a valid face. Returning None.")
1067
1083
  return None
1068
- flatFace = Face.Flatten(face, tolerance=tolerance)
1069
- world_origin = Vertex.ByCoordinates(0,0,0)
1084
+ normal = Face.Normal(face)
1085
+ origin = Topology.Centroid(face)
1086
+ flatFace = Topology.Flatten(face, origin=origin, direction=normal)
1087
+ world_origin = Vertex.Origin()
1070
1088
  # Retrieve the needed transformations
1071
1089
  dictionary = Topology.Dictionary(flatFace)
1072
- xTran = Dictionary.ValueAtKey(dictionary,"xTran")
1073
- yTran = Dictionary.ValueAtKey(dictionary,"yTran")
1074
- zTran = Dictionary.ValueAtKey(dictionary,"zTran")
1090
+ xTran = Dictionary.ValueAtKey(dictionary,"x")
1091
+ yTran = Dictionary.ValueAtKey(dictionary,"y")
1092
+ zTran = Dictionary.ValueAtKey(dictionary,"z")
1075
1093
  phi = Dictionary.ValueAtKey(dictionary,"phi")
1076
1094
  theta = Dictionary.ValueAtKey(dictionary,"theta")
1077
1095
  vertices = Wire.Vertices(Face.ExternalBoundary(flatFace))
@@ -1259,7 +1277,6 @@ class Face(topologic.Face):
1259
1277
  except:
1260
1278
  print("Face.IsInternal - Warning: Could not determine if vertex is inside face. Returning False.")
1261
1279
  clus = Cluster.ByTopologies([vertex, face])
1262
- Topology.Show(clus, renderer="browser")
1263
1280
  status = False
1264
1281
  return status
1265
1282
 
@@ -1311,17 +1328,19 @@ class Face(topologic.Face):
1311
1328
  return False
1312
1329
 
1313
1330
  # Flatten the input face
1314
- flatFace = Face.Flatten(face, tolerance=tolerance)
1331
+ origin = Topology.Centroid(face)
1332
+ normal = Face.Normal(face)
1333
+ flatFace = Topology.Flatten(face, origin=origin, direction=normal)
1315
1334
  # Retrieve the needed transformations
1316
1335
  dictionary = Topology.Dictionary(flatFace)
1317
- xTran = Dictionary.ValueAtKey(dictionary,"xTran")
1318
- yTran = Dictionary.ValueAtKey(dictionary,"yTran")
1319
- zTran = Dictionary.ValueAtKey(dictionary,"zTran")
1336
+ xTran = Dictionary.ValueAtKey(dictionary,"x")
1337
+ yTran = Dictionary.ValueAtKey(dictionary,"y")
1338
+ zTran = Dictionary.ValueAtKey(dictionary,"z")
1320
1339
  phi = Dictionary.ValueAtKey(dictionary,"phi")
1321
1340
  theta = Dictionary.ValueAtKey(dictionary,"theta")
1322
1341
 
1323
1342
  # Create a Vertex at the world's origin (0,0,0)
1324
- world_origin = Vertex.ByCoordinates(0,0,0)
1343
+ world_origin = Vertex.Origin()
1325
1344
 
1326
1345
  faceEdges = Face.Edges(flatFace)
1327
1346
  vertices = []
@@ -1560,17 +1579,17 @@ class Face(topologic.Face):
1560
1579
  if not isinstance(face, topologic.Face):
1561
1580
  return None
1562
1581
  if not isinstance(origin, topologic.Vertex):
1563
- origin = Topology.CenterOfMass(face)
1582
+ origin = Topology.Centroid(face)
1564
1583
  if not isinstance(direction, list):
1565
- direction = Face.NormalAtParameters(face, 0.5, 0.5)
1566
- flatFace = Face.Flatten(face, oldLocation=origin, direction=direction, tolerance=tolerance)
1584
+ normal = Face.Normal(face)
1585
+ flatFace = Topology.Flatten(face, origin=origin, direction=normal)
1567
1586
 
1568
1587
  world_origin = Vertex.ByCoordinates(0,0,0)
1569
1588
  # Retrieve the needed transformations
1570
1589
  dictionary = Topology.Dictionary(flatFace)
1571
- xTran = Dictionary.ValueAtKey(dictionary,"xTran")
1572
- yTran = Dictionary.ValueAtKey(dictionary,"yTran")
1573
- zTran = Dictionary.ValueAtKey(dictionary,"zTran")
1590
+ xTran = Dictionary.ValueAtKey(dictionary,"x")
1591
+ yTran = Dictionary.ValueAtKey(dictionary,"y")
1592
+ zTran = Dictionary.ValueAtKey(dictionary,"z")
1574
1593
  phi = Dictionary.ValueAtKey(dictionary,"phi")
1575
1594
  theta = Dictionary.ValueAtKey(dictionary,"theta")
1576
1595
 
@@ -1678,6 +1697,35 @@ class Face(topologic.Face):
1678
1697
  return None
1679
1698
  return Face.ByWire(wire, tolerance=tolerance)
1680
1699
 
1700
+ @staticmethod
1701
+ def RemoveCollinearEdges(face: topologic.Face, angTolerance: float = 0.1, tolerance: float = 0.0001) -> topologic.Wire:
1702
+ """
1703
+ Removes any collinear edges in the input face.
1704
+
1705
+ Parameters
1706
+ ----------
1707
+ face : topologic.Face
1708
+ The input face.
1709
+ angTolerance : float , optional
1710
+ The desired angular tolerance. The default is 0.1.
1711
+ tolerance : float , optional
1712
+ The desired tolerance. The default is 0.0001.
1713
+
1714
+ Returns
1715
+ -------
1716
+ topologic.Face
1717
+ The created face without any collinear edges.
1718
+
1719
+ """
1720
+ from topologicpy.Wire import Wire
1721
+
1722
+ if not isinstance(face, topologic.Face):
1723
+ print("Face.RemoveCollinearEdges - Error: The input face parameter is not a valid face. Returning None.")
1724
+ return None
1725
+ eb = Wire.RemoveCollinearEdges(Face.Wire(face), angTolerance=angTolerance, tolerance=tolerance)
1726
+ ib = [Wire.RemoveCollinearEdges(w, angTolerance=angTolerance, tolerance=tolerance) for w in Face.InternalBoundaries(face)]
1727
+ return Face.ByWires(eb, ib)
1728
+
1681
1729
  @staticmethod
1682
1730
  def Skeleton(face, tolerance=0.001):
1683
1731
  """
@@ -1823,43 +1871,17 @@ class Face(topologic.Face):
1823
1871
  """
1824
1872
  from topologicpy.Vertex import Vertex
1825
1873
  from topologicpy.Wire import Wire
1874
+ from topologicpy.Shell import Shell
1826
1875
  from topologicpy.Topology import Topology
1827
1876
  from topologicpy.Dictionary import Dictionary
1828
1877
 
1829
1878
  if not isinstance(face, topologic.Face):
1879
+ print("Face.Triangulate - Error: The input face parameter is not a valid face. Returning None.")
1830
1880
  return None
1831
- flatFace = Face.Flatten(face, tolerance=tolerance)
1832
- world_origin = Vertex.ByCoordinates(0,0,0)
1833
- # Retrieve the needed transformations
1834
- dictionary = Topology.Dictionary(flatFace)
1835
- xTran = Dictionary.ValueAtKey(dictionary,"xTran")
1836
- yTran = Dictionary.ValueAtKey(dictionary,"yTran")
1837
- zTran = Dictionary.ValueAtKey(dictionary,"zTran")
1838
- phi = Dictionary.ValueAtKey(dictionary,"phi")
1839
- theta = Dictionary.ValueAtKey(dictionary,"theta")
1840
-
1841
- faceTriangles = []
1842
- for i in range(0,5,1):
1843
- try:
1844
- _ = topologic.FaceUtility.Triangulate(flatFace, float(i)*0.1, faceTriangles)
1845
- break
1846
- except:
1847
- continue
1848
- if len(faceTriangles) < 1:
1849
- return [face]
1850
- finalFaces = []
1851
- for f in faceTriangles:
1852
- f = Topology.Rotate(f, origin=world_origin, x=0, y=1, z=0, degree=theta)
1853
- f = Topology.Rotate(f, origin=world_origin, x=0, y=0, z=1, degree=phi)
1854
- f = Topology.Translate(f, xTran, yTran, zTran)
1855
- if Face.Angle(face, f) > 90:
1856
- wire = Face.ExternalBoundary(f)
1857
- wire = Wire.Invert(wire)
1858
- f = topologic.Face.ByExternalBoundary(wire)
1859
- finalFaces.append(f)
1860
- else:
1861
- finalFaces.append(f)
1862
- return finalFaces
1881
+ vertices = Topology.Vertices(face)
1882
+ shell = Shell.Delaunay(vertices=vertices, face=face, tolerance=tolerance)
1883
+ triangles = Topology.Faces(shell)
1884
+ return triangles
1863
1885
 
1864
1886
  @staticmethod
1865
1887
  def TrimByWire(face: topologic.Face, wire: topologic.Wire, reverse: bool = False) -> topologic.Face: