topologicpy 0.6.3__py3-none-any.whl → 0.7.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/Aperture.py +12 -13
- topologicpy/Cell.py +234 -210
- topologicpy/CellComplex.py +130 -118
- topologicpy/Cluster.py +108 -91
- topologicpy/Context.py +11 -7
- topologicpy/DGL.py +1 -1
- topologicpy/Dictionary.py +55 -65
- topologicpy/Edge.py +217 -164
- topologicpy/EnergyModel.py +23 -24
- topologicpy/Face.py +526 -315
- topologicpy/Graph.py +437 -349
- topologicpy/Grid.py +40 -43
- topologicpy/Honeybee.py +1 -1
- topologicpy/Matrix.py +28 -27
- topologicpy/Neo4j.py +5 -5
- topologicpy/Plotly.py +135 -51
- topologicpy/Shell.py +160 -145
- topologicpy/Sun.py +17 -13
- topologicpy/Topology.py +544 -765
- topologicpy/Vector.py +4 -4
- topologicpy/Vertex.py +145 -126
- topologicpy/Wire.py +545 -328
- topologicpy/version.py +1 -1
- {topologicpy-0.6.3.dist-info → topologicpy-0.7.2.dist-info}/METADATA +1 -1
- topologicpy-0.7.2.dist-info/RECORD +33 -0
- topologicpy-0.6.3.dist-info/RECORD +0 -33
- {topologicpy-0.6.3.dist-info → topologicpy-0.7.2.dist-info}/LICENSE +0 -0
- {topologicpy-0.6.3.dist-info → topologicpy-0.7.2.dist-info}/WHEEL +0 -0
- {topologicpy-0.6.3.dist-info → topologicpy-0.7.2.dist-info}/top_level.txt +0 -0
topologicpy/CellComplex.py
CHANGED
@@ -17,7 +17,6 @@
|
|
17
17
|
import topologic_core as topologic
|
18
18
|
import math
|
19
19
|
import os
|
20
|
-
from topologicpy.Topology import Topology
|
21
20
|
import warnings
|
22
21
|
|
23
22
|
try:
|
@@ -48,18 +47,18 @@ except:
|
|
48
47
|
except:
|
49
48
|
warnings.warn("CellComplex - Error: Could not import scipy.")
|
50
49
|
|
51
|
-
class CellComplex(
|
50
|
+
class CellComplex():
|
52
51
|
@staticmethod
|
53
|
-
def Box(origin
|
52
|
+
def Box(origin= None,
|
54
53
|
width: float = 1.0, length: float = 1.0, height: float = 1.0,
|
55
54
|
uSides: int = 2, vSides: int = 2, wSides: int = 2,
|
56
|
-
direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001)
|
55
|
+
direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001):
|
57
56
|
"""
|
58
57
|
Creates a box with internal cells.
|
59
58
|
|
60
59
|
Parameters
|
61
60
|
----------
|
62
|
-
origin :
|
61
|
+
origin : topologic_core.Vertex , optional
|
63
62
|
The origin location of the box. The default is None which results in the box being placed at (0, 0, 0).
|
64
63
|
width : float , optional
|
65
64
|
The width of the box. The default is 1.
|
@@ -82,7 +81,7 @@ class CellComplex(Topology):
|
|
82
81
|
|
83
82
|
Returns
|
84
83
|
-------
|
85
|
-
|
84
|
+
topologic_core.CellComplex
|
86
85
|
The created box.
|
87
86
|
|
88
87
|
"""
|
@@ -92,7 +91,7 @@ class CellComplex(Topology):
|
|
92
91
|
direction=direction, placement=placement, tolerance=tolerance)
|
93
92
|
|
94
93
|
@staticmethod
|
95
|
-
def ByCells(cells: list, tolerance: float = 0.0001, silent: bool = False)
|
94
|
+
def ByCells(cells: list, tolerance: float = 0.0001, silent: bool = False):
|
96
95
|
"""
|
97
96
|
Creates a cellcomplex by merging the input cells.
|
98
97
|
|
@@ -105,7 +104,7 @@ class CellComplex(Topology):
|
|
105
104
|
|
106
105
|
Returns
|
107
106
|
-------
|
108
|
-
|
107
|
+
topologic_core.CellComplex
|
109
108
|
The created cellcomplex.
|
110
109
|
|
111
110
|
"""
|
@@ -116,25 +115,25 @@ class CellComplex(Topology):
|
|
116
115
|
if not silent:
|
117
116
|
print("CellComplex.ByCells - Error: The input cells parameter is not a valid list. Returning None.")
|
118
117
|
return None
|
119
|
-
cells = [x for x in cells if
|
118
|
+
cells = [x for x in cells if Topology.IsInstance(x, "Cell")]
|
120
119
|
if len(cells) < 1:
|
121
120
|
if not silent:
|
122
121
|
print("CellComplex.ByCells - Error: The input cells parameter does not contain any valid cells. Returning None.")
|
123
122
|
return None
|
124
123
|
cellComplex = None
|
125
124
|
if len(cells) == 1:
|
126
|
-
return topologic.CellComplex.ByCells(cells)
|
125
|
+
return topologic.CellComplex.ByCells(cells) # Hook to Core
|
127
126
|
else:
|
128
127
|
try:
|
129
|
-
cellComplex = topologic.CellComplex.ByCells(cells)
|
128
|
+
cellComplex = topologic.CellComplex.ByCells(cells) # Hook to Core
|
130
129
|
except:
|
131
130
|
topA = cells[0]
|
132
131
|
topB = Cluster.ByTopologies(cells[1:])
|
133
132
|
cellComplex = Topology.Merge(topA, topB, tranDict=False, tolerance=tolerance)
|
134
133
|
|
135
|
-
if not
|
134
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
136
135
|
if not silent:
|
137
|
-
print("CellComplex.ByCells - Warning: Could not create a CellComplex. Returning object of type
|
136
|
+
print("CellComplex.ByCells - Warning: Could not create a CellComplex. Returning object of type topologic_core.Cluster instead of topologic_core.CellComplex.")
|
138
137
|
return Cluster.ByTopologies(cells)
|
139
138
|
else:
|
140
139
|
temp_cells = CellComplex.Cells(cellComplex)
|
@@ -148,64 +147,67 @@ class CellComplex(Topology):
|
|
148
147
|
return None
|
149
148
|
elif len(temp_cells) == 1:
|
150
149
|
if not silent:
|
151
|
-
print("CellComplex.ByCells - Warning: Resulting object contains only one cell. Returning object of type
|
150
|
+
print("CellComplex.ByCells - Warning: Resulting object contains only one cell. Returning object of type topologic_core.Cell instead of topologic_core.CellComplex.")
|
152
151
|
return(temp_cells[0])
|
153
152
|
return cellComplex
|
154
153
|
|
155
154
|
@staticmethod
|
156
|
-
def ByCellsCluster(cluster
|
155
|
+
def ByCellsCluster(cluster, tolerance: float = 0.0001):
|
157
156
|
"""
|
158
157
|
Creates a cellcomplex by merging the cells within the input cluster.
|
159
158
|
|
160
159
|
Parameters
|
161
160
|
----------
|
162
|
-
cluster :
|
161
|
+
cluster : topologic_core.Cluster
|
163
162
|
The input cluster of cells.
|
164
163
|
tolerance : float , optional
|
165
164
|
The desired tolerance. The default is 0.0001.
|
166
165
|
|
167
166
|
Returns
|
168
167
|
-------
|
169
|
-
|
168
|
+
topologic_core.CellComplex
|
170
169
|
The created cellcomplex.
|
171
170
|
|
172
171
|
"""
|
173
172
|
|
174
|
-
|
173
|
+
from topologicpy.Topology import Topology
|
174
|
+
|
175
|
+
if not Topology.IsInstance(cluster, "Cluster"):
|
175
176
|
print("CellComplex.ByCellsCluster - Error: The input cluster parameter is not a valid topologic cluster. Returning None.")
|
176
177
|
return None
|
177
|
-
cells =
|
178
|
-
_ = cluster.Cells(None, cells)
|
178
|
+
cells = Topology.Cells(cluster)
|
179
179
|
return CellComplex.ByCells(cells, tolerance)
|
180
180
|
|
181
181
|
@staticmethod
|
182
|
-
def ByFaces(faces: list, tolerance: float = 0.0001)
|
182
|
+
def ByFaces(faces: list, tolerance: float = 0.0001):
|
183
183
|
"""
|
184
184
|
Creates a cellcomplex by merging the input faces.
|
185
185
|
|
186
186
|
Parameters
|
187
187
|
----------
|
188
|
-
faces :
|
188
|
+
faces : list
|
189
189
|
The input faces.
|
190
190
|
tolerance : float , optional
|
191
191
|
The desired tolerance. The default is 0.0001.
|
192
192
|
|
193
193
|
Returns
|
194
194
|
-------
|
195
|
-
|
195
|
+
topologic_core.CellComplex
|
196
196
|
The created cellcomplex.
|
197
197
|
|
198
198
|
"""
|
199
|
+
from topologicpy.Cluster import Cluster
|
200
|
+
from topologicpy.Topology import Topology
|
199
201
|
|
200
202
|
if not isinstance(faces, list):
|
201
203
|
print("CellComplex.ByFaces - Error: The input faces parameter is not a valid list. Returning None.")
|
202
204
|
return None
|
203
|
-
faces = [x for x in faces if
|
205
|
+
faces = [x for x in faces if Topology.IsInstance(x, "Face")]
|
204
206
|
if len(faces) < 1:
|
205
207
|
print("CellComplex.ByFaces - Error: The input faces parameter does not contain any valid faces. Returning None.")
|
206
208
|
return None
|
207
209
|
try:
|
208
|
-
cellComplex = topologic.CellComplex.ByFaces(faces, tolerance, False)
|
210
|
+
cellComplex = topologic.CellComplex.ByFaces(faces, tolerance, False) # Hook to Core
|
209
211
|
except:
|
210
212
|
cellComplex = None
|
211
213
|
if not cellComplex:
|
@@ -219,11 +221,10 @@ class CellComplex(Topology):
|
|
219
221
|
print("CellComplex.ByFaces - Warning: Failed to merge face #"+str(i)+". Skipping.")
|
220
222
|
if newCellComplex:
|
221
223
|
cellComplex = newCellComplex
|
222
|
-
if
|
224
|
+
if not Topology.Type(cellComplex) == Topology.TypeID("CellComplex"):
|
223
225
|
print("CellComplex.ByFaces - Warning: The input faces do not form a cellcomplex")
|
224
|
-
if
|
225
|
-
returnCellComplexes =
|
226
|
-
_ = cellComplex.CellComplexes(None, returnCellComplexes)
|
226
|
+
if Topology.Type(cellComplex) == Topology.TypeID("Cluster"):
|
227
|
+
returnCellComplexes = Cluster.CellComplexes(cellComplex)
|
227
228
|
if len(returnCellComplexes) > 0:
|
228
229
|
return returnCellComplexes[0]
|
229
230
|
else:
|
@@ -236,33 +237,33 @@ class CellComplex(Topology):
|
|
236
237
|
return cellComplex
|
237
238
|
|
238
239
|
@staticmethod
|
239
|
-
def ByFacesCluster(cluster
|
240
|
+
def ByFacesCluster(cluster, tolerance: float = 0.0001):
|
240
241
|
"""
|
241
242
|
Creates a cellcomplex by merging the faces within the input cluster.
|
242
243
|
|
243
244
|
Parameters
|
244
245
|
----------
|
245
|
-
cluster :
|
246
|
+
cluster : topologic_core.Cluster
|
246
247
|
The input cluster of faces.
|
247
248
|
tolerance : float , optional
|
248
249
|
The desired tolerance. The default is 0.0001.
|
249
250
|
|
250
251
|
Returns
|
251
252
|
-------
|
252
|
-
|
253
|
+
topologic_core.CellComplex
|
253
254
|
The created cellcomplex.
|
254
255
|
|
255
256
|
"""
|
257
|
+
from topologicpy.Topology import Topology
|
256
258
|
|
257
|
-
if not
|
259
|
+
if not Topology.IsInstance(cluster, "Cluster"):
|
258
260
|
print("CellComplex.ByFacesCluster - Error: The input cluster parameter is not a valid topologic cluster. Returning None.")
|
259
261
|
return None
|
260
|
-
faces =
|
261
|
-
_ = cluster.Faces(None, faces)
|
262
|
+
faces = Topology.Faces(cluster)
|
262
263
|
return CellComplex.ByFaces(faces, tolerance)
|
263
264
|
|
264
265
|
@staticmethod
|
265
|
-
def ByWires(wires: list, triangulate: bool = True, tolerance: float = 0.0001)
|
266
|
+
def ByWires(wires: list, triangulate: bool = True, tolerance: float = 0.0001):
|
266
267
|
"""
|
267
268
|
Creates a cellcomplex by lofting through the input wires.
|
268
269
|
|
@@ -277,7 +278,7 @@ class CellComplex(Topology):
|
|
277
278
|
|
278
279
|
Returns
|
279
280
|
-------
|
280
|
-
|
281
|
+
topologic_core.CellComplex
|
281
282
|
The created cellcomplex.
|
282
283
|
|
283
284
|
"""
|
@@ -289,7 +290,7 @@ class CellComplex(Topology):
|
|
289
290
|
if not isinstance(wires, list):
|
290
291
|
print("CellComplex.ByFaces - Error: The input wires parameter is not a valid list. Returning None.")
|
291
292
|
return None
|
292
|
-
wires = [x for x in wires if
|
293
|
+
wires = [x for x in wires if Topology.IsInstance(x, "Wire")]
|
293
294
|
if len(wires) < 2:
|
294
295
|
print("CellComplex.ByWires - Error: The input wires parameter contains less than two valid wires. Returning None.")
|
295
296
|
return None
|
@@ -314,10 +315,8 @@ class CellComplex(Topology):
|
|
314
315
|
faces += triangles
|
315
316
|
else:
|
316
317
|
faces.append(f)
|
317
|
-
w1_edges =
|
318
|
-
|
319
|
-
w2_edges = []
|
320
|
-
_ = wire2.Edges(None, w2_edges)
|
318
|
+
w1_edges = Topology.Edges(wire1)
|
319
|
+
w2_edges = Topology.Edges(wire2)
|
321
320
|
if len(w1_edges) != len(w2_edges):
|
322
321
|
print("CellComplex.ByWires - Error: The input wires parameter contains wires with different number of edges. Returning None.")
|
323
322
|
return None
|
@@ -375,13 +374,13 @@ class CellComplex(Topology):
|
|
375
374
|
return CellComplex.ByFaces(faces, tolerance=tolerance)
|
376
375
|
|
377
376
|
@staticmethod
|
378
|
-
def ByWiresCluster(cluster
|
377
|
+
def ByWiresCluster(cluster, triangulate: bool = True, tolerance: float = 0.0001):
|
379
378
|
"""
|
380
379
|
Creates a cellcomplex by lofting through the wires in the input cluster.
|
381
380
|
|
382
381
|
Parameters
|
383
382
|
----------
|
384
|
-
cluster :
|
383
|
+
cluster : topologic_core.Cluster
|
385
384
|
The input cluster of wires.
|
386
385
|
triangulate : bool , optional
|
387
386
|
If set to True, the faces will be triangulated. The default is True.
|
@@ -390,26 +389,26 @@ class CellComplex(Topology):
|
|
390
389
|
|
391
390
|
Returns
|
392
391
|
-------
|
393
|
-
|
392
|
+
topologic_core.CellComplex
|
394
393
|
The created cellcomplex.
|
395
394
|
|
396
395
|
"""
|
396
|
+
from topologicpy.Topology import Topology
|
397
397
|
|
398
|
-
if not
|
398
|
+
if not Topology.IsInstance(cluster, "Cluster"):
|
399
399
|
print("CellComplex.ByWiresCluster - Error: The input cluster parameter is not a valid topologic cluster. Returning None.")
|
400
400
|
return None
|
401
|
-
wires =
|
402
|
-
_ = cluster.Wires(None, wires)
|
401
|
+
wires = Topology.Wires(cluster)
|
403
402
|
return CellComplex.ByWires(wires, triangulate=triangulate, tolerance=tolerance)
|
404
403
|
|
405
404
|
@staticmethod
|
406
|
-
def Cells(cellComplex
|
405
|
+
def Cells(cellComplex) -> list:
|
407
406
|
"""
|
408
407
|
Returns the cells of the input cellComplex.
|
409
408
|
|
410
409
|
Parameters
|
411
410
|
----------
|
412
|
-
cellComplex :
|
411
|
+
cellComplex : topologic_core.CellComplex
|
413
412
|
The input cellComplex.
|
414
413
|
|
415
414
|
Returns
|
@@ -418,21 +417,23 @@ class CellComplex(Topology):
|
|
418
417
|
The list of cells.
|
419
418
|
|
420
419
|
"""
|
421
|
-
|
420
|
+
from topologicpy.Topology import Topology
|
421
|
+
|
422
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
422
423
|
print("CellComplex.Cells - Error: The input cellcomplex parameter is not a valid topologic cellcomplex. Returning None.")
|
423
424
|
return None
|
424
425
|
cells = []
|
425
|
-
_ = cellComplex.Cells(None, cells)
|
426
|
+
_ = cellComplex.Cells(None, cells) # Hook to Core
|
426
427
|
return cells
|
427
428
|
|
428
429
|
@staticmethod
|
429
|
-
def Decompose(cellComplex
|
430
|
+
def Decompose(cellComplex, tiltAngle: float = 10.0, tolerance: float = 0.0001) -> dict:
|
430
431
|
"""
|
431
432
|
Decomposes the input cellComplex into its logical components. This method assumes that the positive Z direction is UP.
|
432
433
|
|
433
434
|
Parameters
|
434
435
|
----------
|
435
|
-
cellComplex :
|
436
|
+
cellComplex : topologic_core.CellComplex
|
436
437
|
the input cellComplex.
|
437
438
|
tiltAngle : float , optional
|
438
439
|
The threshold tilt angle in degrees to determine if a face is vertical, horizontal, or tilted. The tilt angle is measured from the nearest cardinal direction. The default is 10.
|
@@ -486,7 +487,7 @@ class CellComplex(Topology):
|
|
486
487
|
apTopologies.append(Aperture.Topology(aperture))
|
487
488
|
return apTopologies
|
488
489
|
|
489
|
-
if not
|
490
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
490
491
|
print("CellComplex.Decompose - Error: The input cellcomplex parameter is not a valid topologic cellcomplex. Returning None.")
|
491
492
|
return None
|
492
493
|
externalVerticalFaces = []
|
@@ -574,7 +575,7 @@ class CellComplex(Topology):
|
|
574
575
|
return d
|
575
576
|
|
576
577
|
@staticmethod
|
577
|
-
def Delaunay(vertices: list = None, tolerance: float = 0.0001)
|
578
|
+
def Delaunay(vertices: list = None, tolerance: float = 0.0001):
|
578
579
|
"""
|
579
580
|
Triangulates the input vertices based on the Delaunay method. See https://en.wikipedia.org/wiki/Delaunay_triangulation.
|
580
581
|
|
@@ -588,7 +589,7 @@ class CellComplex(Topology):
|
|
588
589
|
|
589
590
|
Returns
|
590
591
|
-------
|
591
|
-
|
592
|
+
topologic_core.CellComplex
|
592
593
|
The created delaunay cellComplex.
|
593
594
|
|
594
595
|
"""
|
@@ -604,7 +605,7 @@ class CellComplex(Topology):
|
|
604
605
|
cell = Cell.Prism()
|
605
606
|
vertices = Topology.Vertices(cell)
|
606
607
|
|
607
|
-
vertices = [v for v in vertices if
|
608
|
+
vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
|
608
609
|
if len(vertices) < 3:
|
609
610
|
print("CellComplex/Delaunay - Error: The input vertices parameter does not contain enough valid vertices. Returning None.")
|
610
611
|
return None
|
@@ -635,13 +636,13 @@ class CellComplex(Topology):
|
|
635
636
|
return cc
|
636
637
|
|
637
638
|
@staticmethod
|
638
|
-
def Edges(cellComplex
|
639
|
+
def Edges(cellComplex) -> list:
|
639
640
|
"""
|
640
641
|
Returns the edges of the input cellComplex.
|
641
642
|
|
642
643
|
Parameters
|
643
644
|
----------
|
644
|
-
cellComplex :
|
645
|
+
cellComplex : topologic_core.CellComplex
|
645
646
|
The input cellComplex.
|
646
647
|
|
647
648
|
Returns
|
@@ -649,40 +650,42 @@ class CellComplex(Topology):
|
|
649
650
|
list
|
650
651
|
The list of edges.
|
651
652
|
|
652
|
-
"""
|
653
|
-
|
653
|
+
"""
|
654
|
+
from topologicpy.Topology import Topology
|
655
|
+
|
656
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
654
657
|
print("CellComplex.Edges - Error: The input cellcomplex parameter is not a valid topologic cellcomplex. Returning None.")
|
655
658
|
return None
|
656
659
|
edges = []
|
657
|
-
_ = cellComplex.Edges(None, edges)
|
660
|
+
_ = cellComplex.Edges(None, edges) # Hook to Core
|
658
661
|
return edges
|
659
662
|
|
660
663
|
@staticmethod
|
661
|
-
def ExternalBoundary(cellComplex
|
664
|
+
def ExternalBoundary(cellComplex):
|
662
665
|
"""
|
663
666
|
Returns the external boundary (cell) of the input cellComplex.
|
664
667
|
|
665
668
|
Parameters
|
666
669
|
----------
|
667
|
-
cellComplex :
|
670
|
+
cellComplex : topologic_core.CellComplex
|
668
671
|
The input cellComplex.
|
669
672
|
|
670
673
|
Returns
|
671
674
|
-------
|
672
|
-
|
675
|
+
topologic_core.Cell
|
673
676
|
The external boundary of the input cellComplex.
|
674
677
|
|
675
678
|
"""
|
676
679
|
return cellComplex.ExternalBoundary()
|
677
680
|
|
678
681
|
@staticmethod
|
679
|
-
def ExternalFaces(cellComplex
|
682
|
+
def ExternalFaces(cellComplex) -> list:
|
680
683
|
"""
|
681
684
|
Returns the external faces of the input cellComplex.
|
682
685
|
|
683
686
|
Parameters
|
684
687
|
----------
|
685
|
-
cellComplex :
|
688
|
+
cellComplex : topologic_core.CellComplex
|
686
689
|
The input cellComplex.
|
687
690
|
|
688
691
|
Returns
|
@@ -696,13 +699,13 @@ class CellComplex(Topology):
|
|
696
699
|
return Cell.Faces(cell)
|
697
700
|
|
698
701
|
@staticmethod
|
699
|
-
def Faces(cellComplex
|
702
|
+
def Faces(cellComplex) -> list:
|
700
703
|
"""
|
701
704
|
Returns the faces of the input cellComplex.
|
702
705
|
|
703
706
|
Parameters
|
704
707
|
----------
|
705
|
-
cellComplex :
|
708
|
+
cellComplex : topologic_core.CellComplex
|
706
709
|
The input cellComplex.
|
707
710
|
|
708
711
|
Returns
|
@@ -711,21 +714,23 @@ class CellComplex(Topology):
|
|
711
714
|
The list of faces.
|
712
715
|
|
713
716
|
"""
|
714
|
-
|
717
|
+
from topologicpy.Topology import Topology
|
718
|
+
|
719
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
715
720
|
print("CellComplex.Faces - Error: The input cellcomplex parameter is not a valid topologic cellcomplex. Returning None.")
|
716
721
|
return None
|
717
722
|
faces = []
|
718
|
-
_ = cellComplex.Faces(None, faces)
|
723
|
+
_ = cellComplex.Faces(None, faces) # Hook to Core
|
719
724
|
return faces
|
720
725
|
|
721
726
|
@staticmethod
|
722
|
-
def InternalFaces(cellComplex
|
727
|
+
def InternalFaces(cellComplex) -> list:
|
723
728
|
"""
|
724
729
|
Returns the internal boundaries (faces) of the input cellComplex.
|
725
730
|
|
726
731
|
Parameters
|
727
732
|
----------
|
728
|
-
cellComplex :
|
733
|
+
cellComplex : topologic_core.CellComplex
|
729
734
|
The input cellComplex.
|
730
735
|
|
731
736
|
Returns
|
@@ -735,17 +740,17 @@ class CellComplex(Topology):
|
|
735
740
|
|
736
741
|
"""
|
737
742
|
faces = []
|
738
|
-
_ = cellComplex.InternalBoundaries(faces)
|
743
|
+
_ = cellComplex.InternalBoundaries(faces) # Hook to Core
|
739
744
|
return faces
|
740
745
|
|
741
746
|
@staticmethod
|
742
|
-
def NonManifoldFaces(cellComplex
|
747
|
+
def NonManifoldFaces(cellComplex) -> list:
|
743
748
|
"""
|
744
749
|
Returns the non-manifold faces of the input cellComplex.
|
745
750
|
|
746
751
|
Parameters
|
747
752
|
----------
|
748
|
-
cellComplex :
|
753
|
+
cellComplex : topologic_core.CellComplex
|
749
754
|
The input cellComplex.
|
750
755
|
|
751
756
|
Returns
|
@@ -755,12 +760,12 @@ class CellComplex(Topology):
|
|
755
760
|
|
756
761
|
"""
|
757
762
|
faces = []
|
758
|
-
_ = cellComplex.NonManifoldFaces(faces)
|
763
|
+
_ = cellComplex.NonManifoldFaces(faces) # Hook to Core
|
759
764
|
return faces
|
760
765
|
|
761
766
|
@staticmethod
|
762
|
-
def Octahedron(origin
|
763
|
-
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001)
|
767
|
+
def Octahedron(origin= None, radius: float = 0.5,
|
768
|
+
direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
|
764
769
|
"""
|
765
770
|
Description
|
766
771
|
----------
|
@@ -768,7 +773,7 @@ class CellComplex(Topology):
|
|
768
773
|
|
769
774
|
Parameters
|
770
775
|
----------
|
771
|
-
origin :
|
776
|
+
origin : topologic_core.Vertex , optional
|
772
777
|
The origin location of the octahedron. The default is None which results in the octahedron being placed at (0, 0, 0).
|
773
778
|
radius : float , optional
|
774
779
|
The radius of the octahedron's circumscribed sphere. The default is 0.5.
|
@@ -781,7 +786,7 @@ class CellComplex(Topology):
|
|
781
786
|
|
782
787
|
Returns
|
783
788
|
-------
|
784
|
-
|
789
|
+
topologic_core.CellComplex
|
785
790
|
The created octahedron.
|
786
791
|
|
787
792
|
"""
|
@@ -792,7 +797,7 @@ class CellComplex(Topology):
|
|
792
797
|
|
793
798
|
if not origin:
|
794
799
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
795
|
-
if not
|
800
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
796
801
|
print("CellComplex.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
797
802
|
return None
|
798
803
|
|
@@ -823,16 +828,16 @@ class CellComplex(Topology):
|
|
823
828
|
return octahedron
|
824
829
|
|
825
830
|
@staticmethod
|
826
|
-
def Prism(origin
|
831
|
+
def Prism(origin= None,
|
827
832
|
width: float = 1.0, length: float = 1.0, height: float = 1.0,
|
828
833
|
uSides: int = 2, vSides: int = 2, wSides: int = 2,
|
829
|
-
direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001)
|
834
|
+
direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001):
|
830
835
|
"""
|
831
836
|
Creates a prismatic cellComplex with internal cells.
|
832
837
|
|
833
838
|
Parameters
|
834
839
|
----------
|
835
|
-
origin :
|
840
|
+
origin : topologic_core.Vertex , optional
|
836
841
|
The origin location of the prism. The default is None which results in the prism being placed at (0, 0, 0).
|
837
842
|
width : float , optional
|
838
843
|
The width of the prism. The default is 1.
|
@@ -855,7 +860,7 @@ class CellComplex(Topology):
|
|
855
860
|
|
856
861
|
Returns
|
857
862
|
-------
|
858
|
-
|
863
|
+
topologic_core.CellComplex
|
859
864
|
The created prism.
|
860
865
|
|
861
866
|
"""
|
@@ -866,8 +871,7 @@ class CellComplex(Topology):
|
|
866
871
|
from topologicpy.Topology import Topology
|
867
872
|
|
868
873
|
def bb(topology):
|
869
|
-
vertices =
|
870
|
-
_ = topology.Vertices(None, vertices)
|
874
|
+
vertices = Topology.Vertices(topology)
|
871
875
|
x = []
|
872
876
|
y = []
|
873
877
|
z = []
|
@@ -909,8 +913,8 @@ class CellComplex(Topology):
|
|
909
913
|
f_clus = Cluster.ByTopologies(uFaces+vFaces+wFaces)
|
910
914
|
return Topology.Slice(topology, f_clus, tolerance=tolerance)
|
911
915
|
else:
|
912
|
-
return
|
913
|
-
if not
|
916
|
+
return CellComplex.ByCells([topology])
|
917
|
+
if not Topology.IsInstance(origin, "Vertex"):
|
914
918
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
915
919
|
|
916
920
|
c = Cell.Prism(origin=origin, width=width, length=length, height=height, uSides=1, vSides=1, wSides=1, placement=placement, tolerance=tolerance)
|
@@ -923,13 +927,13 @@ class CellComplex(Topology):
|
|
923
927
|
return None
|
924
928
|
|
925
929
|
@staticmethod
|
926
|
-
def RemoveCollinearEdges(cellComplex
|
930
|
+
def RemoveCollinearEdges(cellComplex, angTolerance: float = 0.1, tolerance: float = 0.0001):
|
927
931
|
"""
|
928
932
|
Removes any collinear edges in the input cellComplex.
|
929
933
|
|
930
934
|
Parameters
|
931
935
|
----------
|
932
|
-
cellComplex :
|
936
|
+
cellComplex : topologic_core.CellComplex
|
933
937
|
The input cellComplex.
|
934
938
|
angTolerance : float , optional
|
935
939
|
The desired angular tolerance. The default is 0.1.
|
@@ -938,13 +942,14 @@ class CellComplex(Topology):
|
|
938
942
|
|
939
943
|
Returns
|
940
944
|
-------
|
941
|
-
|
945
|
+
topologic_core.CellComplex
|
942
946
|
The created cellComplex without any collinear edges.
|
943
947
|
|
944
948
|
"""
|
945
949
|
from topologicpy.Cell import Cell
|
950
|
+
from topologicpy.Topology import Topology
|
946
951
|
|
947
|
-
if not
|
952
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
948
953
|
print("CellComplex.RemoveCollinearEdges - Error: The input cellComplex parameter is not a valid cellComplex. Returning None.")
|
949
954
|
return None
|
950
955
|
cells = CellComplex.Cells(cellComplex)
|
@@ -954,13 +959,13 @@ class CellComplex(Topology):
|
|
954
959
|
return CellComplex.ByCells(clean_cells, tolerance=tolerance)
|
955
960
|
|
956
961
|
@staticmethod
|
957
|
-
def Shells(cellComplex
|
962
|
+
def Shells(cellComplex) -> list:
|
958
963
|
"""
|
959
964
|
Returns the shells of the input cellComplex.
|
960
965
|
|
961
966
|
Parameters
|
962
967
|
----------
|
963
|
-
cellComplex :
|
968
|
+
cellComplex : topologic_core.CellComplex
|
964
969
|
The input cellComplex.
|
965
970
|
|
966
971
|
Returns
|
@@ -969,21 +974,22 @@ class CellComplex(Topology):
|
|
969
974
|
The list of shells.
|
970
975
|
|
971
976
|
"""
|
972
|
-
|
977
|
+
from topologicpy.Topology import Topology
|
978
|
+
|
979
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
973
980
|
print("CellComplex.Shells - Error: The input cellcomplex parameter is not a valid topologic cellcomplex. Returning None.")
|
974
981
|
return None
|
975
|
-
shells =
|
976
|
-
_ = cellComplex.Shells(None, shells)
|
982
|
+
shells = Topology.Shells(cellComplex)
|
977
983
|
return shells
|
978
984
|
|
979
985
|
@staticmethod
|
980
|
-
def Vertices(cellComplex
|
986
|
+
def Vertices(cellComplex) -> list:
|
981
987
|
"""
|
982
988
|
Returns the vertices of the input cellComplex.
|
983
989
|
|
984
990
|
Parameters
|
985
991
|
----------
|
986
|
-
cellComplex :
|
992
|
+
cellComplex : topologic_core.CellComplex
|
987
993
|
The input cellComplex.
|
988
994
|
|
989
995
|
Returns
|
@@ -992,21 +998,23 @@ class CellComplex(Topology):
|
|
992
998
|
The list of vertices.
|
993
999
|
|
994
1000
|
"""
|
995
|
-
|
1001
|
+
from topologicpy.Topology import Topology
|
1002
|
+
|
1003
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
996
1004
|
print("CellComplex.Vertices - Error: The input cellcomplex parameter is not a valid topologic cellcomplex. Returning None.")
|
997
1005
|
return None
|
998
1006
|
vertices = []
|
999
|
-
_ = cellComplex.Vertices(None, vertices)
|
1007
|
+
_ = cellComplex.Vertices(None, vertices) # Hook to Core
|
1000
1008
|
return vertices
|
1001
1009
|
|
1002
1010
|
@staticmethod
|
1003
|
-
def Volume(cellComplex
|
1011
|
+
def Volume(cellComplex, mantissa: int = 6) -> float:
|
1004
1012
|
"""
|
1005
1013
|
Returns the volume of the input cellComplex.
|
1006
1014
|
|
1007
1015
|
Parameters
|
1008
1016
|
----------
|
1009
|
-
cellComplex :
|
1017
|
+
cellComplex : topologic_core.CellComplex
|
1010
1018
|
The input cellComplex.
|
1011
1019
|
manitssa: int , optional
|
1012
1020
|
The desired length of the mantissa. The default is 6.
|
@@ -1018,7 +1026,9 @@ class CellComplex(Topology):
|
|
1018
1026
|
|
1019
1027
|
"""
|
1020
1028
|
from topologicpy.Cell import Cell
|
1021
|
-
|
1029
|
+
from topologicpy.Topology import Topology
|
1030
|
+
|
1031
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
1022
1032
|
print("CellComplex.Volume - Error: The input cellcomplex parameter is not a valid topologic cellcomplex. Returning None.")
|
1023
1033
|
return None
|
1024
1034
|
cells = CellComplex.Cells(cellComplex)
|
@@ -1030,7 +1040,7 @@ class CellComplex(Topology):
|
|
1030
1040
|
return round(volume, mantissa)
|
1031
1041
|
|
1032
1042
|
@staticmethod
|
1033
|
-
def Voronoi(vertices: list = None, cell
|
1043
|
+
def Voronoi(vertices: list = None, cell= None, tolerance: float = 0.0001):
|
1034
1044
|
"""
|
1035
1045
|
Partitions the input cell based on the Voronoi method. See https://en.wikipedia.org/wiki/Voronoi_diagram.
|
1036
1046
|
|
@@ -1039,7 +1049,7 @@ class CellComplex(Topology):
|
|
1039
1049
|
vertices: list , optional
|
1040
1050
|
The input list of vertices to use for voronoi partitioning. If set to None, the algorithm uses the vertices of the input cell parameter.
|
1041
1051
|
if both are set to none, a unit cube centered around the origin is used.
|
1042
|
-
cell :
|
1052
|
+
cell : topologic_core.Cell , optional
|
1043
1053
|
The input bounding cell. If set to None, an axes-aligned bounding cell is created from the list of vertices. The default is None.
|
1044
1054
|
tolerance : float , optional
|
1045
1055
|
the desired tolerance. The default is 0.0001.
|
@@ -1047,7 +1057,7 @@ class CellComplex(Topology):
|
|
1047
1057
|
|
1048
1058
|
Returns
|
1049
1059
|
-------
|
1050
|
-
|
1060
|
+
topologic_core.CellComplex
|
1051
1061
|
The created voronoi cellComplex.
|
1052
1062
|
|
1053
1063
|
"""
|
@@ -1072,7 +1082,7 @@ class CellComplex(Topology):
|
|
1072
1082
|
for item in region:
|
1073
1083
|
temp_list.append(verts[item])
|
1074
1084
|
f = Face.ByVertices(temp_list)
|
1075
|
-
if
|
1085
|
+
if Topology.IsInstance(f, "Face"):
|
1076
1086
|
faces.append(f)
|
1077
1087
|
if len(faces) < 1:
|
1078
1088
|
return None
|
@@ -1084,13 +1094,13 @@ class CellComplex(Topology):
|
|
1084
1094
|
vertices = Topology.Vertices(cell)
|
1085
1095
|
vertices.append(Vertex.Origin())
|
1086
1096
|
else:
|
1087
|
-
vertices = [v for v in vertices if
|
1097
|
+
vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
|
1088
1098
|
if len(vertices) < 1:
|
1089
1099
|
print("CellComplex.Voronoi - Error: The input vertices parameter does not contain any valid vertices. Returning None.")
|
1090
1100
|
return None
|
1091
1101
|
cell = Topology.BoundingBox(Cluster.ByTopologies(vertices))
|
1092
1102
|
if not isinstance(vertices, list):
|
1093
|
-
if not
|
1103
|
+
if not Topology.IsInstance(cell, "Cell"):
|
1094
1104
|
cell = Cell.Prism()
|
1095
1105
|
vertices = Topology.Vertices(cell)
|
1096
1106
|
else:
|
@@ -1107,19 +1117,19 @@ class CellComplex(Topology):
|
|
1107
1117
|
print("CellComplex.Voronoi - Error: the operation failed. Returning None.")
|
1108
1118
|
return None
|
1109
1119
|
cellComplex = Topology.Slice(cell, cluster)
|
1110
|
-
if not
|
1120
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
1111
1121
|
print("CellComplex.Voronoi - Error: the operation failed. Returning None.")
|
1112
1122
|
return None
|
1113
1123
|
return cellComplex
|
1114
1124
|
|
1115
1125
|
@staticmethod
|
1116
|
-
def Wires(cellComplex
|
1126
|
+
def Wires(cellComplex) -> list:
|
1117
1127
|
"""
|
1118
1128
|
Returns the wires of the input cellComplex.
|
1119
1129
|
|
1120
1130
|
Parameters
|
1121
1131
|
----------
|
1122
|
-
cellComplex :
|
1132
|
+
cellComplex : topologic_core.CellComplex
|
1123
1133
|
The input cellComplex.
|
1124
1134
|
|
1125
1135
|
Returns
|
@@ -1128,10 +1138,12 @@ class CellComplex(Topology):
|
|
1128
1138
|
The list of wires.
|
1129
1139
|
|
1130
1140
|
"""
|
1131
|
-
|
1141
|
+
from topologicpy.Topology import Topology
|
1142
|
+
|
1143
|
+
if not Topology.IsInstance(cellComplex, "CellComplex"):
|
1132
1144
|
print("CellComplex.Wires - Error: The input cellcomplex parameter is not a valid topologic cellcomplex. Returning None.")
|
1133
1145
|
return None
|
1134
1146
|
wires = []
|
1135
|
-
_ = cellComplex.Wires(None, wires)
|
1147
|
+
_ = cellComplex.Wires(None, wires) # Hook to Core
|
1136
1148
|
return wires
|
1137
1149
|
|