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/Cell.py CHANGED
@@ -15,19 +15,16 @@
15
15
  # this program. If not, see <https://www.gnu.org/licenses/>.
16
16
 
17
17
  import topologic_core as topologic
18
- from topologicpy.Wire import Wire
19
- from topologicpy.Topology import Topology
20
- import math
21
18
 
22
- class Cell(Topology):
19
+ class Cell():
23
20
  @staticmethod
24
- def Area(cell: topologic.Cell, mantissa: int = 6) -> float:
21
+ def Area(cell, mantissa: int = 6):
25
22
  """
26
23
  Returns the surface area of the input cell.
27
24
 
28
25
  Parameters
29
26
  ----------
30
- cell : topologic.Cell
27
+ cell : topologic_core.Cell
31
28
  The cell.
32
29
  mantissa : int , optional
33
30
  The desired length of the mantissa. The default is 6.
@@ -39,25 +36,25 @@ class Cell(Topology):
39
36
 
40
37
  """
41
38
  from topologicpy.Face import Face
39
+ from topologicpy.Topology import Topology
42
40
 
43
- faces = []
44
- _ = cell.Faces(None, faces)
41
+ faces = Topology.Faces(cell)
45
42
  area = 0.0
46
43
  for aFace in faces:
47
44
  area = area + Face.Area(aFace)
48
45
  return round(area, mantissa)
49
46
 
50
47
  @staticmethod
51
- def Box(origin: topologic.Vertex = None,
48
+ def Box(origin = None,
52
49
  width: float = 1, length: float = 1, height: float = 1,
53
50
  uSides: int = 1, vSides: int = 1, wSides: int = 1,
54
- direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
51
+ direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
55
52
  """
56
53
  Creates a box.
57
54
 
58
55
  Parameters
59
56
  ----------
60
- origin : topologic.Vertex , optional
57
+ origin : topologic_core.Vertex , optional
61
58
  The origin location of the box. The default is None which results in the box being placed at (0, 0, 0).
62
59
  width : float , optional
63
60
  The width of the box. The default is 1.
@@ -80,7 +77,7 @@ class Cell(Topology):
80
77
 
81
78
  Returns
82
79
  -------
83
- topologic.Cell
80
+ topologic_core.Cell
84
81
  The created box.
85
82
 
86
83
  """
@@ -89,7 +86,7 @@ class Cell(Topology):
89
86
  direction=direction, placement=placement, tolerance=tolerance)
90
87
 
91
88
  @staticmethod
92
- def ByFaces(faces: list, planarize: bool = False, tolerance: float = 0.0001, silent=False) -> topologic.Cell:
89
+ def ByFaces(faces: list, planarize: bool = False, tolerance: float = 0.0001, silent=False):
93
90
  """
94
91
  Creates a cell from the input list of faces.
95
92
 
@@ -106,7 +103,7 @@ class Cell(Topology):
106
103
 
107
104
  Returns
108
105
  -------
109
- topologic.Cell
106
+ topologic_core.Cell
110
107
  The created cell.
111
108
 
112
109
  """
@@ -119,14 +116,14 @@ class Cell(Topology):
119
116
  if not silent:
120
117
  print("Cell.ByFaces - Error: The input faces parameter is not a valid list. Returning None.")
121
118
  return None
122
- faceList = [x for x in faces if isinstance(x, topologic.Face)]
119
+ faceList = [x for x in faces if Topology.IsInstance(x, "Face")]
123
120
  if len(faceList) < 1:
124
121
  if not silent:
125
122
  print("Cell.ByFaces - Error: The input faces parameter does not contain valid faces. Returning None.")
126
123
  return None
127
124
  # Try the default method
128
- cell = topologic.Cell.ByFaces(faceList, tolerance)
129
- if isinstance(cell, topologic.Cell):
125
+ cell = topologic.Cell.ByFaces(faceList, tolerance) # Hook to Core
126
+ if Topology.IsInstance(cell, "Cell"):
130
127
  return cell
131
128
 
132
129
  # Fuse all the vertices first and rebuild the faces
@@ -145,9 +142,9 @@ class Cell(Topology):
145
142
  if not index == None:
146
143
  face_vertices.append(all_vertices[index])
147
144
  new_w = Wire.ByVertices(face_vertices)
148
- if isinstance(new_w, topologic.Wire):
145
+ if Topology.IsInstance(new_w, "Wire"):
149
146
  new_f = Face.ByWire(new_w, silent=True)
150
- if isinstance(new_f, topologic.Face):
147
+ if Topology.IsInstance(new_f, "Face"):
151
148
  new_faces.append(new_f)
152
149
  elif isinstance(new_f, list):
153
150
  new_faces += new_f
@@ -157,7 +154,7 @@ class Cell(Topology):
157
154
  if planarize:
158
155
  planarizedList = [Face.Planarize(f, tolerance=tolerance) for f in faceList]
159
156
  enlargedList = [Face.ByOffset(f, offset=-tolerance*10) for f in planarizedList]
160
- cell = topologic.Cell.ByFaces(enlargedList, tolerance)
157
+ cell = topologic.Cell.ByFaces(enlargedList, tolerance) # Hook to Core
161
158
  faceList = Topology.SubTopologies(cell, subTopologyType="face")
162
159
  finalFaces = []
163
160
  for f in faceList:
@@ -171,11 +168,11 @@ class Cell(Topology):
171
168
  vertices = Face.Vertices(f)
172
169
  w = Wire.Cycles(Face.ExternalBoundary(f), maxVertices=len(vertices))[0]
173
170
  f1 = Face.ByWire(w, tolerance=tolerance, silent=True)
174
- if isinstance(f1, topologic.Face):
171
+ if Topology.IsInstance(f1, "Face"):
175
172
  finalFinalFaces.append(f1)
176
173
  elif isinstance(f1, list):
177
174
  finalFinalFaces += f1
178
- cell = topologic.Cell.ByFaces(finalFinalFaces, tolerance)
175
+ cell = topologic.Cell.ByFaces(finalFinalFaces, tolerance) # Hook to Core
179
176
  if cell == None:
180
177
  if not silent:
181
178
  print("Cell.ByFaces - Error: The operation failed. Returning None.")
@@ -183,7 +180,7 @@ class Cell(Topology):
183
180
  else:
184
181
  return cell
185
182
  else:
186
- cell = topologic.Cell.ByFaces(faces, tolerance)
183
+ cell = topologic.Cell.ByFaces(faces, tolerance) # Hook to Core
187
184
  if cell == None:
188
185
  if not silent:
189
186
  print("Cell.ByFaces - Error: The operation failed. Returning None.")
@@ -191,13 +188,13 @@ class Cell(Topology):
191
188
  else:
192
189
  return cell
193
190
  @staticmethod
194
- def ByOffset(cell: topologic.Cell, offset: float = 1.0, tolerance: float = 0.0001) -> topologic.Face:
191
+ def ByOffset(cell, offset: float = 1.0, tolerance: float = 0.0001):
195
192
  """
196
193
  Creates an offset cell from the input cell.
197
194
 
198
195
  Parameters
199
196
  ----------
200
- cell : topologic.Cell
197
+ cell : topologic_core.Cell
201
198
  The input cell.
202
199
  offset : float , optional
203
200
  The desired offset distance. The default is 1.0.
@@ -206,7 +203,7 @@ class Cell(Topology):
206
203
 
207
204
  Returns
208
205
  -------
209
- topologic.Topology
206
+ Topology
210
207
  The created offset topology. WARNING: This method may fail to create a cell if the offset creates self-intersecting faces. Always check the type being returned by this method.
211
208
 
212
209
  """
@@ -229,13 +226,13 @@ class Cell(Topology):
229
226
  return new_cell
230
227
 
231
228
  @staticmethod
232
- def ByShell(shell: topologic.Shell, planarize: bool = False, tolerance: float = 0.0001) -> topologic.Cell:
229
+ def ByShell(shell, planarize: bool = False, tolerance: float = 0.0001):
233
230
  """
234
231
  Creates a cell from the input shell.
235
232
 
236
233
  Parameters
237
234
  ----------
238
- shell : topologic.Shell
235
+ shell : topologic_core.Shell
239
236
  The input shell. The shell must be closed for this method to succeed.
240
237
  planarize : bool, optional
241
238
  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.
@@ -244,26 +241,27 @@ class Cell(Topology):
244
241
 
245
242
  Returns
246
243
  -------
247
- topologic.Cell
244
+ topologic_core.Cell
248
245
  The created cell.
249
246
 
250
247
  """
251
248
  from topologicpy.Topology import Topology
252
- if not isinstance(shell, topologic.Shell):
249
+
250
+ if not Topology.IsInstance(shell, "Shell"):
253
251
  print("Cell.ByShell - Error: The input shell parameter is not a valid topologic shell. Returning None.")
254
252
  return None
255
253
  faces = Topology.SubTopologies(shell, subTopologyType="face")
256
254
  return Cell.ByFaces(faces, planarize=planarize, tolerance=tolerance)
257
255
 
258
256
  @staticmethod
259
- def ByThickenedFace(face: topologic.Face, thickness: float = 1.0, bothSides: bool = True, reverse: bool = False,
260
- planarize: bool = False, tolerance: float = 0.0001) -> topologic.Cell:
257
+ def ByThickenedFace(face, thickness: float = 1.0, bothSides: bool = True, reverse: bool = False,
258
+ planarize: bool = False, tolerance: float = 0.0001):
261
259
  """
262
260
  Creates a cell by thickening the input face.
263
261
 
264
262
  Parameters
265
263
  ----------
266
- face : topologic.Face
264
+ face : topologic_core.Face
267
265
  The input face to be thickened.
268
266
  thickness : float , optional
269
267
  The desired thickness. The default is 1.0.
@@ -278,7 +276,7 @@ class Cell(Topology):
278
276
 
279
277
  Returns
280
278
  -------
281
- topologic.Cell
279
+ topologic_core.Cell
282
280
  The created cell.
283
281
 
284
282
  """
@@ -287,7 +285,7 @@ class Cell(Topology):
287
285
  from topologicpy.Cluster import Cluster
288
286
  from topologicpy.Topology import Topology
289
287
 
290
- if not isinstance(face, topologic.Face):
288
+ if not Topology.IsInstance(face, "Face"):
291
289
  print("Cell.ByThickenedFace - Error: The input face parameter is not a valid topologic face. Returning None.")
292
290
  return None
293
291
  if reverse == True and bothSides == False:
@@ -301,8 +299,7 @@ class Cell(Topology):
301
299
  topFace = Topology.Translate(face, faceNormal[0]*thickness, faceNormal[1]*thickness, faceNormal[2]*thickness)
302
300
 
303
301
  cellFaces = [bottomFace, topFace]
304
- bottomEdges = []
305
- _ = bottomFace.Edges(None, bottomEdges)
302
+ bottomEdges = Topology.Edges(bottomFace)
306
303
  for bottomEdge in bottomEdges:
307
304
  topEdge = Topology.Translate(bottomEdge, faceNormal[0]*thickness, faceNormal[1]*thickness, faceNormal[2]*thickness)
308
305
  sideEdge1 = Edge.ByVertices([bottomEdge.StartVertex(), topEdge.StartVertex()], tolerance=tolerance, silent=True)
@@ -312,14 +309,14 @@ class Cell(Topology):
312
309
  return Cell.ByFaces(cellFaces, planarize=planarize, tolerance=tolerance)
313
310
 
314
311
  @staticmethod
315
- def ByThickenedShell(shell: topologic.Shell, direction: list = [0, 0, 1], thickness: float = 1.0, bothSides: bool = True, reverse: bool = False,
316
- planarize: bool = False, tolerance: float = 0.0001) -> topologic.Cell:
312
+ def ByThickenedShell(shell, direction: list = [0, 0, 1], thickness: float = 1.0, bothSides: bool = True, reverse: bool = False,
313
+ planarize: bool = False, tolerance: float = 0.0001):
317
314
  """
318
315
  Creates a cell by thickening the input shell. The shell must be open.
319
316
 
320
317
  Parameters
321
318
  ----------
322
- shell : topologic.Shell
319
+ shell : topologic_core.Shell
323
320
  The input shell to be thickened.
324
321
  thickness : float , optional
325
322
  The desired thickness. The default is 1.0.
@@ -334,7 +331,7 @@ class Cell(Topology):
334
331
 
335
332
  Returns
336
333
  -------
337
- topologic.Cell
334
+ topologic_core.Cell
338
335
  The created cell.
339
336
 
340
337
  """
@@ -344,7 +341,7 @@ class Cell(Topology):
344
341
  from topologicpy.Shell import Shell
345
342
  from topologicpy.Cluster import Cluster
346
343
  from topologicpy.Topology import Topology
347
- if not isinstance(shell, topologic.Shell):
344
+ if not Topology.IsInstance(shell, "Shell"):
348
345
  print("Cell.ByThickenedShell - Error: The input shell parameter is not a valid topologic Shell. Returning None.")
349
346
  return None
350
347
  if reverse == True and bothSides == False:
@@ -368,13 +365,13 @@ class Cell(Topology):
368
365
  return Cell.ByFaces(cellFaces, planarize=planarize, tolerance=tolerance)
369
366
 
370
367
  @staticmethod
371
- def ByWires(wires: list, close: bool = False, triangulate: bool = True, planarize: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent=False) -> topologic.Cell:
368
+ def ByWires(wires: list, close: bool = False, triangulate: bool = True, planarize: bool = False, mantissa: int = 6, tolerance: float = 0.0001, silent=False):
372
369
  """
373
370
  Creates a cell by lofting through the input list of wires.
374
371
 
375
372
  Parameters
376
373
  ----------
377
- wires : topologic.Wire
374
+ wires : list
378
375
  The input list of wires.
379
376
  close : bool , optional
380
377
  If set to True, the last wire in the list of input wires will be connected to the first wire in the list of input wires. The default is False.
@@ -394,7 +391,7 @@ class Cell(Topology):
394
391
 
395
392
  Returns
396
393
  -------
397
- topologic.Cell
394
+ topologic_core.Cell
398
395
  The created cell.
399
396
 
400
397
  """
@@ -408,7 +405,7 @@ class Cell(Topology):
408
405
  if not silent:
409
406
  print("Cell.ByWires - Error: The input wires parameter is not a valid list. Returning None.")
410
407
  return None
411
- wires = [w for w in wires if isinstance(w, topologic.Wire)]
408
+ wires = [w for w in wires if Topology.IsInstance(w, "Wire")]
412
409
  if len(wires) < 2:
413
410
  if not silent:
414
411
  print("Cell.ByWires - Error: The input wires parameter contains less than two valid topologic wires. Returning None.")
@@ -427,10 +424,8 @@ class Cell(Topology):
427
424
  for i in range(len(wires)-1):
428
425
  wire1 = wires[i]
429
426
  wire2 = wires[i+1]
430
- w1_edges = []
431
- _ = wire1.Edges(None, w1_edges)
432
- w2_edges = []
433
- _ = wire2.Edges(None, w2_edges)
427
+ w1_edges = Topology.Edges(wire1)
428
+ w2_edges = Topology.Edges(wire2)
434
429
  if len(w1_edges) != len(w2_edges):
435
430
  if not silent:
436
431
  print("Cell.ByWires - Error: The input wires parameter contains wires with different number of edges. Returning None.")
@@ -493,22 +488,22 @@ class Cell(Topology):
493
488
  cell = Cell.ByFaces(faces, planarize=planarize, tolerance=tolerance, silent=silent)
494
489
  if not cell:
495
490
  shell = Shell.ByFaces(faces, tolerance=tolerance)
496
- if isinstance(shell, topologic.Shell):
491
+ if Topology.IsInstance(shell, "Shell"):
497
492
  geom = Topology.Geometry(shell, mantissa=mantissa)
498
493
  cell = Topology.ByGeometry(geom['vertices'], geom['edges'], geom['faces'])
499
- if not isinstance(cell, topologic.Cell):
494
+ if not Topology.IsInstance(cell, "Cell"):
500
495
  print("Cell.ByWires - Error: Could not create a cell. Returning None.")
501
496
  return None
502
497
  return cell
503
498
 
504
499
  @staticmethod
505
- def ByWiresCluster(cluster: topologic.Cluster, close: bool = False, triangulate: bool = True, planarize: bool = False, tolerance: float = 0.0001) -> topologic.Cell:
500
+ def ByWiresCluster(cluster, close: bool = False, triangulate: bool = True, planarize: bool = False, tolerance: float = 0.0001):
506
501
  """
507
502
  Creates a cell by lofting through the input cluster of wires.
508
503
 
509
504
  Parameters
510
505
  ----------
511
- cluster : topologic.Cluster
506
+ cluster : Cluster
512
507
  The input Cluster of wires.
513
508
  close : bool , optional
514
509
  If set to True, the last wire in the cluster of input wires will be connected to the first wire in the cluster of input wires. The default is False.
@@ -524,25 +519,26 @@ class Cell(Topology):
524
519
 
525
520
  Returns
526
521
  -------
527
- topologic.Cell
522
+ topologic_core.Cell
528
523
  The created cell.
529
524
 
530
525
  """
531
- if not isinstance(cluster, topologic.Cluster):
526
+ from topologicpy.Topology import Topology
527
+
528
+ if not Topology.IsInstance(cluster, "Cluster"):
532
529
  print("Cell.ByWiresCluster - Error: The input cluster parameter is not a valid topologic cluster. Returning None.")
533
530
  return None
534
- wires = []
535
- _ = cluster.Wires(None, wires)
531
+ wires = Topology.Wires(cluster)
536
532
  return Cell.ByWires(wires, close=close, triangulate=triangulate, planarize=planarize, tolerance=tolerance)
537
533
 
538
534
  @staticmethod
539
- def Capsule(origin: topologic.Vertex = None, radius: float = 0.25, height: float = 1, uSides: int = 16, vSidesEnds:int = 8, vSidesMiddle: int = 1, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
535
+ def Capsule(origin = None, radius: float = 0.25, height: float = 1, uSides: int = 16, vSidesEnds:int = 8, vSidesMiddle: int = 1, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001):
540
536
  """
541
537
  Creates a capsule shape. A capsule is a cylinder with hemispherical ends.
542
538
 
543
539
  Parameters
544
540
  ----------
545
- origin : topologic.Vertex , optional
541
+ origin : topologic_core.Vertex , optional
546
542
  The location of the origin of the cylinder. The default is None which results in the cylinder being placed at (0, 0, 0).
547
543
  radius : float , optional
548
544
  The radius of the capsule. The default is 0.25.
@@ -563,7 +559,7 @@ class Cell(Topology):
563
559
 
564
560
  Returns
565
561
  -------
566
- topologic.Cell
562
+ topologic_core.Cell
567
563
  The created cell.
568
564
 
569
565
  """
@@ -572,7 +568,7 @@ class Cell(Topology):
572
568
  from topologicpy.Vertex import Vertex
573
569
  if not origin:
574
570
  origin = Vertex.ByCoordinates(0, 0, 0)
575
- if not isinstance(origin, topologic.Vertex):
571
+ if not Topology.IsInstance(origin, "Vertex"):
576
572
  print("Cell.Capsule - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
577
573
  return None
578
574
  cyl_height = height - radius*2
@@ -600,13 +596,13 @@ class Cell(Topology):
600
596
  return capsule
601
597
 
602
598
  @staticmethod
603
- def Compactness(cell: topologic.Cell, reference = "sphere", mantissa: int = 6) -> float:
599
+ def Compactness(cell, reference = "sphere", mantissa: int = 6) -> float:
604
600
  """
605
601
  Returns the compactness measure of the input cell. If the reference is "sphere", this is also known as 'sphericity' (https://en.wikipedia.org/wiki/Sphericity).
606
602
 
607
603
  Parameters
608
604
  ----------
609
- cell : topologic.Cell
605
+ cell : topologic_core.Cell
610
606
  The input cell.
611
607
  reference : str , optional
612
608
  The desired reference to which to compare this compactness. The options are "sphere" and "cube". It is case insensitive. The default is "sphere".
@@ -620,12 +616,14 @@ class Cell(Topology):
620
616
 
621
617
  """
622
618
  from topologicpy.Face import Face
623
- faces = []
624
- _ = cell.Faces(None, faces)
619
+ from topologicpy.Topology import Topology
620
+ import math
621
+
622
+ faces = Topology.Faces(cell)
625
623
  area = 0.0
626
624
  for aFace in faces:
627
625
  area = area + abs(Face.Area(aFace))
628
- volume = abs(topologic.CellUtility.Volume(cell))
626
+ volume = abs(Cell.Volume(cell, mantissa=mantissa))
629
627
  compactness = 0
630
628
  #From https://en.wikipedia.org/wiki/Sphericity
631
629
  if area > 0:
@@ -639,14 +637,14 @@ class Cell(Topology):
639
637
  return round(compactness, mantissa)
640
638
 
641
639
  @staticmethod
642
- def Cone(origin: topologic.Vertex = None, baseRadius: float = 0.5, topRadius: float = 0, height: float = 1, uSides: int = 16, vSides: int = 1, direction: list = [0, 0, 1],
643
- dirZ: float = 1, placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
640
+ def Cone(origin = None, baseRadius: float = 0.5, topRadius: float = 0, height: float = 1, uSides: int = 16, vSides: int = 1, direction: list = [0, 0, 1],
641
+ dirZ: float = 1, placement: str = "center", tolerance: float = 0.0001):
644
642
  """
645
643
  Creates a cone.
646
644
 
647
645
  Parameters
648
646
  ----------
649
- origin : topologic.Vertex , optional
647
+ origin : topologic_core.Vertex , optional
650
648
  The location of the origin of the cone. The default is None which results in the cone being placed at (0, 0, 0).
651
649
  baseRadius : float , optional
652
650
  The radius of the base circle of the cone. The default is 0.5.
@@ -665,16 +663,17 @@ class Cell(Topology):
665
663
 
666
664
  Returns
667
665
  -------
668
- topologic.Cell
666
+ topologic_core.Cell
669
667
  The created cone.
670
668
 
671
669
  """
672
670
  from topologicpy.Vertex import Vertex
673
671
  from topologicpy.Wire import Wire
674
672
  from topologicpy.Face import Face
675
- from topologicpy.Shell import Shell
676
673
  from topologicpy.Cluster import Cluster
677
674
  from topologicpy.Topology import Topology
675
+ import math
676
+
678
677
  def createCone(baseWire, topWire, baseVertex, topVertex, tolerance):
679
678
  if baseWire == None and topWire == None:
680
679
  raise Exception("Cell.Cone - Error: Both radii of the cone cannot be zero at the same time")
@@ -685,9 +684,8 @@ class Cell(Topology):
685
684
  apex = topVertex
686
685
  wire = baseWire
687
686
  else:
688
- return topologic.CellUtility.ByLoft([baseWire, topWire])
689
- vertices = []
690
- _ = wire.Vertices(None,vertices)
687
+ return Cell.ByWires([baseWire, topWire])
688
+ vertices = Topology.Vertices(wire)
691
689
  faces = [Face.ByWire(wire, tolerance=tolerance)]
692
690
  for i in range(0, len(vertices)-1):
693
691
  w = Wire.ByVertices([apex, vertices[i], vertices[i+1]])
@@ -699,7 +697,7 @@ class Cell(Topology):
699
697
  return Cell.ByFaces(faces, tolerance=tolerance)
700
698
  if not origin:
701
699
  origin = Vertex.ByCoordinates(0, 0, 0)
702
- if not isinstance(origin, topologic.Vertex):
700
+ if not Topology.IsInstance(origin, "Vertex"):
703
701
  print("Cell.Cone - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
704
702
  return None
705
703
  xOffset = 0
@@ -761,15 +759,15 @@ class Cell(Topology):
761
759
  return cone
762
760
 
763
761
  @staticmethod
764
- def ContainmentStatus(cell: topologic.Cell, vertex: topologic.Vertex, tolerance: float = 0.0001) -> int:
762
+ def ContainmentStatus(cell, vertex, tolerance: float = 0.0001) -> int:
765
763
  """
766
764
  Returns the containment status of the input vertex in relationship to the input cell
767
765
 
768
766
  Parameters
769
767
  ----------
770
- cell : topologic.Cell
768
+ cell : topologic_core.Cell
771
769
  The input cell.
772
- vertex : topologic.Vertex
770
+ vertex : topologic_core.Vertex
773
771
  The input vertex.
774
772
  tolerance : float , optional
775
773
  The desired tolerance. The default is 0.0001.
@@ -780,14 +778,16 @@ class Cell(Topology):
780
778
  Returns 0 if the vertex is inside, 1 if it is on the boundary of, and 2 if it is outside the input cell.
781
779
 
782
780
  """
783
- if not isinstance(cell, topologic.Cell):
781
+ from topologicpy.Topology import Topology
782
+
783
+ if not Topology.IsInstance(cell, "Cell"):
784
784
  print("Cell.ContainmentStatus - Error: The input cell parameter is not a valid topologic cell. Returning None.")
785
785
  return None
786
- if not isinstance(vertex, topologic.Vertex):
786
+ if not Topology.IsInstance(vertex, "Vertex"):
787
787
  print("Cell.ContainmentStatus - Error: The input vertex parameter is not a valid topologic vertex. Returning None.")
788
788
  return None
789
789
  try:
790
- status = topologic.CellUtility.Contains(cell, vertex, tolerance)
790
+ status = topologic.CellUtility.Contains(cell, vertex, tolerance) # Hook to Core
791
791
  if status == 0:
792
792
  return 0
793
793
  elif status == 1:
@@ -799,14 +799,14 @@ class Cell(Topology):
799
799
  return None
800
800
 
801
801
  @staticmethod
802
- def Cylinder(origin: topologic.Vertex = None, radius: float = 0.5, height: float = 1, uSides: int = 16, vSides: int = 1, direction: list = [0, 0, 1],
803
- placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
802
+ def Cylinder(origin = None, radius: float = 0.5, height: float = 1, uSides: int = 16, vSides: int = 1, direction: list = [0, 0, 1],
803
+ placement: str = "center", tolerance: float = 0.0001):
804
804
  """
805
805
  Creates a cylinder.
806
806
 
807
807
  Parameters
808
808
  ----------
809
- origin : topologic.Vertex , optional
809
+ origin : topologic_core.Vertex , optional
810
810
  The location of the origin of the cylinder. The default is None which results in the cylinder being placed at (0, 0, 0).
811
811
  radius : float , optional
812
812
  The radius of the cylinder. The default is 0.5.
@@ -825,18 +825,19 @@ class Cell(Topology):
825
825
 
826
826
  Returns
827
827
  -------
828
- topologic.Cell
828
+ topologic_core.Cell
829
829
  The created cell.
830
830
 
831
831
  """
832
832
  from topologicpy.Vertex import Vertex
833
+ from topologicpy.Wire import Wire
833
834
  from topologicpy.Face import Face
834
835
  from topologicpy.CellComplex import CellComplex
835
836
  from topologicpy.Cluster import Cluster
836
837
  from topologicpy.Topology import Topology
837
838
  if not origin:
838
839
  origin = Vertex.ByCoordinates(0, 0, 0)
839
- if not isinstance(origin, topologic.Vertex):
840
+ if not Topology.IsInstance(origin, "Vertex"):
840
841
  print("Cell.Cylinder - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
841
842
  return None
842
843
  xOffset = 0
@@ -869,13 +870,13 @@ class Cell(Topology):
869
870
  return cylinder
870
871
 
871
872
  @staticmethod
872
- def Decompose(cell: topologic.Cell, tiltAngle: float = 10, tolerance: float = 0.0001) -> dict:
873
+ def Decompose(cell, tiltAngle: float = 10, tolerance: float = 0.0001) -> dict:
873
874
  """
874
875
  Decomposes the input cell into its logical components. This method assumes that the positive Z direction is UP.
875
876
 
876
877
  Parameters
877
878
  ----------
878
- cell : topologic.Cell
879
+ cell : topologic_core.Cell
879
880
  the input cell.
880
881
  tiltAngle : float , optional
881
882
  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.
@@ -922,7 +923,7 @@ class Cell(Topology):
922
923
  apTopologies.append(Aperture.Topology(aperture))
923
924
  return apTopologies
924
925
 
925
- if not isinstance(cell, topologic.Cell):
926
+ if not Topology.IsInstance(cell, "Cell"):
926
927
  print("Cell.Decompose - Error: The input cell parameter is not a valid topologic cell. Returning None.")
927
928
  return None
928
929
  verticalFaces = []
@@ -977,8 +978,8 @@ class Cell(Topology):
977
978
  return d
978
979
 
979
980
  @staticmethod
980
- def Dodecahedron(origin: topologic.Vertex = None, radius: float = 0.5,
981
- direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
981
+ def Dodecahedron(origin= None, radius: float = 0.5,
982
+ direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
982
983
  """
983
984
  Description
984
985
  ----------
@@ -986,7 +987,7 @@ class Cell(Topology):
986
987
 
987
988
  Parameters
988
989
  ----------
989
- origin : topologic.Vertex , optional
990
+ origin : topologic_core.Vertex , optional
990
991
  The origin location of the dodecahedron. The default is None which results in the dodecahedron being placed at (0, 0, 0).
991
992
  radius : float , optional
992
993
  The radius of the dodecahedron's circumscribed sphere. The default is 0.5.
@@ -999,7 +1000,7 @@ class Cell(Topology):
999
1000
 
1000
1001
  Returns
1001
1002
  -------
1002
- topologic.Cell
1003
+ topologic_core.Cell
1003
1004
  The created dodecahedron.
1004
1005
 
1005
1006
  """
@@ -1011,7 +1012,7 @@ class Cell(Topology):
1011
1012
 
1012
1013
  if not origin:
1013
1014
  origin = Vertex.ByCoordinates(0, 0, 0)
1014
- if not isinstance(origin, topologic.Vertex):
1015
+ if not Topology.IsInstance(origin, "Vertex"):
1015
1016
  print("Cell.Dodecahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1016
1017
  return None
1017
1018
  pen = Face.Circle(sides=5, radius=0.5)
@@ -1050,13 +1051,13 @@ class Cell(Topology):
1050
1051
  return dodecahedron
1051
1052
 
1052
1053
  @staticmethod
1053
- def Edges(cell: topologic.Cell) -> list:
1054
+ def Edges(cell) -> list:
1054
1055
  """
1055
1056
  Returns the edges of the input cell.
1056
1057
 
1057
1058
  Parameters
1058
1059
  ----------
1059
- cell : topologic.Cell
1060
+ cell : topologic_core.Cell
1060
1061
  The input cell.
1061
1062
 
1062
1063
  Returns
@@ -1064,23 +1065,24 @@ class Cell(Topology):
1064
1065
  list
1065
1066
  The list of edges.
1066
1067
 
1067
- """
1068
- if not isinstance(cell, topologic.Cell):
1068
+ """
1069
+ from topologicpy.Topology import Topology
1070
+
1071
+ if not Topology.IsInstance(cell, "Cell"):
1069
1072
  print("Cell.Edges - Error: The input cell parameter is not a valid topologic cell. Returning None.")
1070
1073
  return None
1071
- edges = []
1072
- _ = cell.Edges(None, edges)
1074
+ edges = Topology.Edges(cell)
1073
1075
  return edges
1074
1076
 
1075
1077
  @staticmethod
1076
- def Egg(origin: topologic.Vertex = None, height: float = 1.0, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1],
1077
- placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
1078
+ def Egg(origin= None, height: float = 1.0, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1],
1079
+ placement: str = "center", tolerance: float = 0.0001):
1078
1080
  """
1079
1081
  Creates an egg-shaped cell.
1080
1082
 
1081
1083
  Parameters
1082
1084
  ----------
1083
- origin : topologic.Vertex , optional
1085
+ origin : topologic_core.Vertex , optional
1084
1086
  The origin location of the sphere. The default is None which results in the egg-shaped cell being placed at (0, 0, 0).
1085
1087
  height : float , optional
1086
1088
  The desired height of of the egg-shaped cell. The default is 1.0.
@@ -1097,18 +1099,19 @@ class Cell(Topology):
1097
1099
 
1098
1100
  Returns
1099
1101
  -------
1100
- topologic.Cell
1102
+ topologic_core.Cell
1101
1103
  The created egg-shaped cell.
1102
1104
 
1103
1105
  """
1104
1106
 
1105
1107
  from topologicpy.Vertex import Vertex
1108
+ from topologicpy.Wire import Wire
1106
1109
  from topologicpy.Topology import Topology
1107
1110
  from topologicpy.Dictionary import Dictionary
1108
1111
 
1109
1112
  if not origin:
1110
1113
  origin = Vertex.ByCoordinates(0, 0, 0)
1111
- if not isinstance(origin, topologic.Vertex):
1114
+ if not Topology.IsInstance(origin, "Vertex"):
1112
1115
  print("Cell.Sphere - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1113
1116
  return None
1114
1117
 
@@ -1139,10 +1142,10 @@ class Cell(Topology):
1139
1142
  new_verts.append(Wire.VertexByParameter(c, i/vSides))
1140
1143
  c = Wire.ByVertices(new_verts, close=False)
1141
1144
  egg = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0, 0, 1], angle=360, sides=uSides, tolerance=tolerance)
1142
- if egg.Type() == topologic.CellComplex.Type():
1145
+ if Topology.IsInstance(egg, "CellComplex"):
1143
1146
  egg = egg.ExternalBoundary()
1144
- if egg.Type() == topologic.Shell.Type():
1145
- egg = topologic.Cell.ByShell(egg)
1147
+ if Topology.IsInstance(egg, "Shell"):
1148
+ egg = Cell.ByShell(egg)
1146
1149
  egg = Topology.Scale(egg, origin=Vertex.Origin(), x=height, y=height, z=height)
1147
1150
  if placement.lower() == "bottom":
1148
1151
  egg = Topology.Translate(egg, 0, 0, height/2)
@@ -1157,23 +1160,24 @@ class Cell(Topology):
1157
1160
  return egg
1158
1161
 
1159
1162
  @staticmethod
1160
- def ExternalBoundary(cell: topologic.Cell) -> topologic.Shell:
1163
+ def ExternalBoundary(cell):
1161
1164
  """
1162
1165
  Returns the external boundary of the input cell.
1163
1166
 
1164
1167
  Parameters
1165
1168
  ----------
1166
- cell : topologic.Cell
1169
+ cell : topologic_core.Cell
1167
1170
  The input cell.
1168
1171
 
1169
1172
  Returns
1170
1173
  -------
1171
- topologic.Shell
1174
+ topologic_core.Shell
1172
1175
  The external boundary of the input cell.
1173
1176
 
1174
1177
  """
1178
+ from topologicpy.Topology import Topology
1175
1179
 
1176
- if not isinstance(cell, topologic.Cell):
1180
+ if not Topology.IsInstance(cell, "Cell"):
1177
1181
  print("Cell.ExternalBoundary - Error: The input cell parameter is not a valid topologic cell. Returning None.")
1178
1182
  return None
1179
1183
  try:
@@ -1183,13 +1187,13 @@ class Cell(Topology):
1183
1187
  return None
1184
1188
 
1185
1189
  @staticmethod
1186
- def Faces(cell: topologic.Cell) -> list:
1190
+ def Faces(cell) -> list:
1187
1191
  """
1188
1192
  Returns the faces of the input cell.
1189
1193
 
1190
1194
  Parameters
1191
1195
  ----------
1192
- cell : topologic.Cell
1196
+ cell : topologic_core.Cell
1193
1197
  The input cell.
1194
1198
 
1195
1199
  Returns
@@ -1198,22 +1202,23 @@ class Cell(Topology):
1198
1202
  The list of faces.
1199
1203
 
1200
1204
  """
1201
- if not isinstance(cell, topologic.Cell):
1205
+ from topologicpy.Topology import Topology
1206
+
1207
+ if not Topology.IsInstance(cell, "Cell"):
1202
1208
  print("Cell.Faces - Error: The input cell parameter is not a valid topologic cell. Returning None.")
1203
1209
  return None
1204
- faces = []
1205
- _ = cell.Faces(None, faces)
1210
+ faces = Topology.Faces(cell)
1206
1211
  return faces
1207
1212
 
1208
1213
  @staticmethod
1209
- def Hyperboloid(origin: topologic.Cell = None, baseRadius: float = 0.5, topRadius: float = 0.5, height: float = 1, sides: int = 24, direction: list = [0, 0, 1],
1210
- twist: float = 60, placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
1214
+ def Hyperboloid(origin = None, baseRadius: float = 0.5, topRadius: float = 0.5, height: float = 1, sides: int = 24, direction: list = [0, 0, 1],
1215
+ twist: float = 60, placement: str = "center", tolerance: float = 0.0001):
1211
1216
  """
1212
1217
  Creates a hyperboloid.
1213
1218
 
1214
1219
  Parameters
1215
1220
  ----------
1216
- origin : topologic.Vertex , optional
1221
+ origin : topologic_core.Vertex , optional
1217
1222
  The location of the origin of the hyperboloid. The default is None which results in the hyperboloid being placed at (0, 0, 0).
1218
1223
  baseRadius : float , optional
1219
1224
  The radius of the base circle of the hyperboloid. The default is 0.5.
@@ -1234,14 +1239,16 @@ class Cell(Topology):
1234
1239
 
1235
1240
  Returns
1236
1241
  -------
1237
- topologic.Cell
1242
+ topologic_core.Cell
1238
1243
  The created hyperboloid.
1239
1244
 
1240
1245
  """
1241
1246
  from topologicpy.Cluster import Cluster
1242
1247
  from topologicpy.Vertex import Vertex
1248
+ from topologicpy.Wire import Wire
1243
1249
  from topologicpy.Face import Face
1244
1250
  from topologicpy.Topology import Topology
1251
+ import math
1245
1252
 
1246
1253
  def createHyperboloid(baseVertices, topVertices, tolerance):
1247
1254
  baseWire = Wire.ByVertices(baseVertices, close=True)
@@ -1269,7 +1276,7 @@ class Cell(Topology):
1269
1276
 
1270
1277
  if not origin:
1271
1278
  origin = Vertex.ByCoordinates(0, 0, 0)
1272
- if not isinstance(origin, topologic.Vertex):
1279
+ if not Topology.IsInstance(origin, "Vertex"):
1273
1280
  print("Cell.Hyperboloid - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1274
1281
  return None
1275
1282
  w_origin = Vertex.Origin()
@@ -1307,8 +1314,8 @@ class Cell(Topology):
1307
1314
  return hyperboloid
1308
1315
 
1309
1316
  @staticmethod
1310
- def Icosahedron(origin: topologic.Vertex = None, radius: float = 0.5,
1311
- direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
1317
+ def Icosahedron(origin= None, radius: float = 0.5,
1318
+ direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
1312
1319
  """
1313
1320
  Description
1314
1321
  ----------
@@ -1316,7 +1323,7 @@ class Cell(Topology):
1316
1323
 
1317
1324
  Parameters
1318
1325
  ----------
1319
- origin : topologic.Vertex , optional
1326
+ origin : topologic_core.Vertex , optional
1320
1327
  The origin location of the icosahedron. The default is None which results in the icosahedron being placed at (0, 0, 0).
1321
1328
  radius : float , optional
1322
1329
  The radius of the icosahedron's circumscribed sphere. The default is 0.5.
@@ -1329,7 +1336,7 @@ class Cell(Topology):
1329
1336
 
1330
1337
  Returns
1331
1338
  -------
1332
- topologic.Cell
1339
+ topologic_core.Cell
1333
1340
  The created icosahedron.
1334
1341
 
1335
1342
  """
@@ -1341,7 +1348,7 @@ class Cell(Topology):
1341
1348
 
1342
1349
  if not origin:
1343
1350
  origin = Vertex.ByCoordinates(0, 0, 0)
1344
- if not isinstance(origin, topologic.Vertex):
1351
+ if not Topology.IsInstance(origin, "Vertex"):
1345
1352
  print("Cell.Dodecahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1346
1353
  return None
1347
1354
  rect1 = Wire.Rectangle(width=(1+math.sqrt(5))/2, length=1)
@@ -1393,63 +1400,64 @@ class Cell(Topology):
1393
1400
 
1394
1401
 
1395
1402
  @staticmethod
1396
- def InternalBoundaries(cell: topologic.Cell) -> list:
1403
+ def InternalBoundaries(cell) -> list:
1397
1404
  """
1398
1405
  Returns the internal boundaries of the input cell.
1399
1406
 
1400
1407
  Parameters
1401
1408
  ----------
1402
- cell : topologic.Cell
1409
+ cell : topologic_core.Cell
1403
1410
  The input cell.
1404
1411
 
1405
1412
  Returns
1406
1413
  -------
1407
1414
  list
1408
- The list of internal boundaries ([topologic.Shell]).
1415
+ The list of internal boundaries ([topologic_core.Shell]).
1409
1416
 
1410
1417
  """
1411
1418
  shells = []
1412
- _ = cell.InternalBoundaries(shells)
1419
+ _ = cell.InternalBoundaries(shells) # Hook to Core
1413
1420
  return shells
1414
1421
 
1415
1422
  @staticmethod
1416
- def InternalVertex(cell: topologic.Cell, tolerance: float = 0.0001):
1423
+ def InternalVertex(cell, tolerance: float = 0.0001):
1417
1424
  """
1418
1425
  Creates a vertex that is guaranteed to be inside the input cell.
1419
1426
 
1420
1427
  Parameters
1421
1428
  ----------
1422
- cell : topologic.Cell
1429
+ cell : topologic_core.Cell
1423
1430
  The input cell.
1424
1431
  tolerance : float , optional
1425
1432
  The desired tolerance. The default is 0.0001.
1426
1433
 
1427
1434
  Returns
1428
1435
  -------
1429
- topologic.Vertex
1436
+ topologic_core.Vertex
1430
1437
  The internal vertex.
1431
1438
 
1432
1439
  """
1440
+ from topologicpy.Topology import Topology
1433
1441
 
1434
- if not isinstance(cell, topologic.Cell):
1442
+ if not Topology.IsInstance(cell, "Cell"):
1435
1443
  print("Cell.InternalVertex - Error: The input cell parameter is not a valid topologic cell. Returning None.")
1436
1444
  return None
1437
1445
  try:
1438
- return topologic.CellUtility.InternalVertex(cell, tolerance)
1446
+ return topologic.CellUtility.InternalVertex(cell, tolerance) # Hook to Core
1439
1447
  except:
1440
1448
  print("Cell.InternalVertex - Error: Could not create an internal vertex. Returning None.")
1441
1449
  return None
1442
1450
 
1443
1451
  @staticmethod
1444
- def IsOnBoundary(cell: topologic.Cell, vertex: topologic.Vertex, tolerance: float = 0.0001) -> bool:
1452
+ def IsOnBoundary(cell, vertex, tolerance: float = 0.0001) -> bool:
1445
1453
  """
1446
1454
  Returns True if the input vertex is on the boundary of the input cell. Returns False otherwise.
1447
1455
 
1448
1456
  Parameters
1449
1457
  ----------
1450
- cell : topologic.Cell
1458
+ cell : topologic_core.Cell
1451
1459
  The input cell.
1452
- vertex : topologic.Vertex
1460
+ vertex : topologic_core.Vertex
1453
1461
  The input vertex.
1454
1462
  tolerance : float , optional
1455
1463
  The desired tolerance. The default is 0.0001.
@@ -1460,22 +1468,23 @@ class Cell(Topology):
1460
1468
  Returns True if the input vertex is inside the input cell. Returns False otherwise.
1461
1469
 
1462
1470
  """
1471
+ from topologicpy.Topology import Topology
1463
1472
 
1464
- if not isinstance(cell, topologic.Cell):
1473
+ if not Topology.IsInstance(cell, "Cell"):
1465
1474
  print("Cell.IsOnBoundary - Error: The input cell parameter is not a valid topologic cell. Returning None.")
1466
1475
  return None
1467
- if not isinstance(vertex, topologic.Vertex):
1476
+ if not Topology.IsInstance(vertex, "Vertex"):
1468
1477
  print("Cell.IsOnBoundary - Error: The input vertex parameter is not a valid topologic vertex. Returning None.")
1469
1478
  return None
1470
1479
  try:
1471
- return (topologic.CellUtility.Contains(cell, vertex, tolerance) == 1)
1480
+ return (Cell.ContainmentStatus(cell, vertex, tolerance = tolerance) == 1)
1472
1481
  except:
1473
1482
  print("Cell.IsOnBoundary - Error: Could not determine if the input vertex is on the boundary of the input cell. Returning None.")
1474
1483
  return None
1475
1484
 
1476
1485
  @staticmethod
1477
- def Octahedron(origin: topologic.Vertex = None, radius: float = 0.5,
1478
- direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
1486
+ def Octahedron(origin= None, radius: float = 0.5,
1487
+ direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
1479
1488
  """
1480
1489
  Description
1481
1490
  ----------
@@ -1483,7 +1492,7 @@ class Cell(Topology):
1483
1492
 
1484
1493
  Parameters
1485
1494
  ----------
1486
- origin : topologic.Vertex , optional
1495
+ origin : topologic_core.Vertex , optional
1487
1496
  The origin location of the octahedron. The default is None which results in the octahedron being placed at (0, 0, 0).
1488
1497
  radius : float , optional
1489
1498
  The radius of the octahedron's circumscribed sphere. The default is 0.5.
@@ -1496,7 +1505,7 @@ class Cell(Topology):
1496
1505
 
1497
1506
  Returns
1498
1507
  -------
1499
- topologic.Cell
1508
+ topologic_core.Cell
1500
1509
  The created octahedron.
1501
1510
 
1502
1511
  """
@@ -1507,7 +1516,7 @@ class Cell(Topology):
1507
1516
 
1508
1517
  if not origin:
1509
1518
  origin = Vertex.ByCoordinates(0, 0, 0)
1510
- if not isinstance(origin, topologic.Vertex):
1519
+ if not Topology.IsInstance(origin, "Vertex"):
1511
1520
  print("Cell.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1512
1521
  return None
1513
1522
 
@@ -1537,7 +1546,7 @@ class Cell(Topology):
1537
1546
  return octahedron
1538
1547
 
1539
1548
  @staticmethod
1540
- def Pipe(edge: topologic.Edge, profile: topologic.Wire = None, radius: float = 0.5, sides: int = 16, startOffset: float = 0, endOffset: float = 0, endcapA: topologic.Topology = None, endcapB: topologic.Topology = None) -> dict:
1549
+ def Pipe(edge, profile = None, radius: float = 0.5, sides: int = 16, startOffset: float = 0, endOffset: float = 0, endcapA = None, endcapB = None) -> dict:
1541
1550
  """
1542
1551
  Description
1543
1552
  ----------
@@ -1545,9 +1554,9 @@ class Cell(Topology):
1545
1554
 
1546
1555
  Parameters
1547
1556
  ----------
1548
- edge : topologic.Edge
1557
+ edge : topologic_core.Edge
1549
1558
  The centerline of the pipe.
1550
- profile : topologic.Wire , optional
1559
+ profile : topologic_core.Wire , optional
1551
1560
  The profile of the pipe. It is assumed that the profile is in the XY plane. If set to None, a circle of radius 0.5 will be used. The default is None.
1552
1561
  radius : float , optional
1553
1562
  The radius of the pipe. The default is 0.5.
@@ -1557,9 +1566,9 @@ class Cell(Topology):
1557
1566
  The offset distance from the start vertex of the centerline edge. The default is 0.
1558
1567
  endOffset : float , optional
1559
1568
  The offset distance from the end vertex of the centerline edge. The default is 0.
1560
- endcapA : topologic.Topology, optional
1569
+ endcapA, optional
1561
1570
  The topology to place at the start vertex of the centerline edge. The positive Z direction of the end cap will be oriented in the direction of the centerline edge.
1562
- endcapB : topologic.Topology, optional
1571
+ endcapB, optional
1563
1572
  The topology to place at the end vertex of the centerline edge. The positive Z direction of the end cap will be oriented in the inverse direction of the centerline edge.
1564
1573
 
1565
1574
  Returns
@@ -1574,9 +1583,11 @@ class Cell(Topology):
1574
1583
 
1575
1584
  from topologicpy.Vertex import Vertex
1576
1585
  from topologicpy.Edge import Edge
1586
+ from topologicpy.Wire import Wire
1577
1587
  from topologicpy.Topology import Topology
1588
+ import math
1578
1589
 
1579
- if not isinstance(edge, topologic.Edge):
1590
+ if not Topology.IsInstance(edge, "Edge"):
1580
1591
  print("Cell.Pipe - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1581
1592
  return None
1582
1593
  length = Edge.Length(edge)
@@ -1598,7 +1609,7 @@ class Cell(Topology):
1598
1609
  baseV = []
1599
1610
  topV = []
1600
1611
 
1601
- if isinstance(profile, topologic.Wire):
1612
+ if Topology.IsInstance(profile, "Wire"):
1602
1613
  baseWire = Topology.Translate(profile, 0 , 0, sv.Z())
1603
1614
  topWire = Topology.Translate(profile, 0 , 0, sv.Z()+dist)
1604
1615
  else:
@@ -1667,8 +1678,8 @@ class Cell(Topology):
1667
1678
  return {'pipe': pipe, 'endcapA': endcapA, 'endcapB': endcapB}
1668
1679
 
1669
1680
  @staticmethod
1670
- def Prism(origin: topologic.Vertex = None, width: float = 1, length: float = 1, height: float = 1, uSides: int = 1, vSides: int = 1, wSides: int = 1,
1671
- direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
1681
+ def Prism(origin= None, width: float = 1, length: float = 1, height: float = 1, uSides: int = 1, vSides: int = 1, wSides: int = 1,
1682
+ direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
1672
1683
  """
1673
1684
  Description
1674
1685
  ----------
@@ -1676,7 +1687,7 @@ class Cell(Topology):
1676
1687
 
1677
1688
  Parameters
1678
1689
  ----------
1679
- origin : topologic.Vertex , optional
1690
+ origin : topologic_core.Vertex , optional
1680
1691
  The origin location of the prism. The default is None which results in the prism being placed at (0, 0, 0).
1681
1692
  width : float , optional
1682
1693
  The width of the prism. The default is 1.
@@ -1699,14 +1710,17 @@ class Cell(Topology):
1699
1710
 
1700
1711
  Returns
1701
1712
  -------
1702
- topologic.Cell
1713
+ topologic_core.Cell
1703
1714
  The created prism.
1704
1715
 
1705
1716
  """
1717
+ from topologicpy.Wire import Wire
1718
+ from topologicpy.Cluster import Cluster
1719
+ from topologicpy.Topology import Topology
1720
+
1706
1721
  def sliceCell(cell, width, length, height, uSides, vSides, wSides):
1707
- origin = cell.Centroid()
1708
- shells = []
1709
- _ = cell.Shells(None, shells)
1722
+ origin = Topology.Centroid(cell)
1723
+ shells = Topology.Shells(cell)
1710
1724
  shell = shells[0]
1711
1725
  wRect = Wire.Rectangle(origin=origin, width=width*1.2, length=length*1.2, direction=[0, 0, 1], placement="center")
1712
1726
  sliceFaces = []
@@ -1719,7 +1733,7 @@ class Cell(Topology):
1719
1733
  for i in range(1, vSides):
1720
1734
  sliceFaces.append(Topology.Translate(Face.ByWire(vRect, tolerance=tolerance), 0, length/vSides*i - length*0.5, 0))
1721
1735
  if len(sliceFaces) > 0:
1722
- sliceCluster = topologic.Cluster.ByTopologies(sliceFaces)
1736
+ sliceCluster = Cluster.ByTopologies(sliceFaces)
1723
1737
  shell = Topology.Slice(topologyA=shell, topologyB=sliceCluster, tranDict=False, tolerance=tolerance)
1724
1738
  return Cell.ByShell(shell)
1725
1739
  return cell
@@ -1730,7 +1744,7 @@ class Cell(Topology):
1730
1744
 
1731
1745
  if not origin:
1732
1746
  origin = Vertex.ByCoordinates(0, 0, 0)
1733
- if not isinstance(origin, topologic.Vertex):
1747
+ if not Topology.IsInstance(origin, "Vertex"):
1734
1748
  print("Cell.Prism - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1735
1749
  return None
1736
1750
  xOffset = 0
@@ -1757,13 +1771,13 @@ class Cell(Topology):
1757
1771
  return prism
1758
1772
 
1759
1773
  @staticmethod
1760
- def RemoveCollinearEdges(cell: topologic.Cell, angTolerance: float = 0.1, tolerance: float = 0.0001) -> topologic.Wire:
1774
+ def RemoveCollinearEdges(cell, angTolerance: float = 0.1, tolerance: float = 0.0001):
1761
1775
  """
1762
1776
  Removes any collinear edges in the input cell.
1763
1777
 
1764
1778
  Parameters
1765
1779
  ----------
1766
- cell : topologic.Cell
1780
+ cell : topologic_core.Cell
1767
1781
  The input cell.
1768
1782
  angTolerance : float , optional
1769
1783
  The desired angular tolerance. The default is 0.1.
@@ -1772,13 +1786,14 @@ class Cell(Topology):
1772
1786
 
1773
1787
  Returns
1774
1788
  -------
1775
- topologic.Cell
1789
+ topologic_core.Cell
1776
1790
  The created cell without any collinear edges.
1777
1791
 
1778
1792
  """
1779
1793
  from topologicpy.Face import Face
1794
+ from topologicpy.Topology import Topology
1780
1795
 
1781
- if not isinstance(cell, topologic.Cell):
1796
+ if not Topology.IsInstance(cell, "Cell"):
1782
1797
  print("Cell.RemoveCollinearEdges - Error: The input cell parameter is not a valid cell. Returning None.")
1783
1798
  return None
1784
1799
  faces = Cell.Faces(cell)
@@ -1795,7 +1810,7 @@ class Cell(Topology):
1795
1810
 
1796
1811
  Parameters
1797
1812
  ----------
1798
- face : topologic.Face
1813
+ face : topologic_core.Face
1799
1814
  The input face.
1800
1815
  angle : float , optioal
1801
1816
  The desired angle in degrees of the roof. The default is 45.
@@ -1852,11 +1867,11 @@ class Cell(Topology):
1852
1867
  if not isinstance(superCells, list):
1853
1868
  print("Cell.Sets - Error: The input superCells parameter is not a valid list. Returning None.")
1854
1869
  return None
1855
- cells = [c for c in cells if isinstance(c, topologic.Cell)]
1870
+ cells = [c for c in cells if Topology.IsInstance(c, "Cell")]
1856
1871
  if len(cells) < 1:
1857
1872
  print("Cell.Sets - Error: The input cells parameter does not contain any valid cells. Returning None.")
1858
1873
  return None
1859
- superCells = [c for c in superCells if isinstance(c, topologic.Cell)]
1874
+ superCells = [c for c in superCells if Topology.IsInstance(c, "Cell")]
1860
1875
  if len(cells) < 1:
1861
1876
  print("Cell.Sets - Error: The input cells parameter does not contain any valid cells. Returning None.")
1862
1877
  return None
@@ -1866,8 +1881,7 @@ class Cell(Topology):
1866
1881
  oldCluster = cluster
1867
1882
  cluster = cluster.Union(cells[i])
1868
1883
  del oldCluster
1869
- superCells = []
1870
- _ = cluster.Cells(None, superCells)
1884
+ superCells = Topology.Cells(cluster)
1871
1885
  unused = []
1872
1886
  for i in range(len(cells)):
1873
1887
  unused.append(True)
@@ -1884,13 +1898,13 @@ class Cell(Topology):
1884
1898
  return sets
1885
1899
 
1886
1900
  @staticmethod
1887
- def Shells(cell: topologic.Cell) -> list:
1901
+ def Shells(cell) -> list:
1888
1902
  """
1889
1903
  Returns the shells of the input cell.
1890
1904
 
1891
1905
  Parameters
1892
1906
  ----------
1893
- cell : topologic.Cell
1907
+ cell : topologic_core.Cell
1894
1908
  The input cell.
1895
1909
 
1896
1910
  Returns
@@ -1899,22 +1913,24 @@ class Cell(Topology):
1899
1913
  The list of shells.
1900
1914
 
1901
1915
  """
1902
- if not isinstance(cell, topologic.Cell):
1916
+ from topologicpy.Topology import Topology
1917
+
1918
+ if not Topology.IsInstance(cell, "Cell"):
1903
1919
  print("Cell.Shells - Error: The input cell parameter is not a valid topologic cell. Returning None.")
1904
1920
  return None
1905
1921
  shells = []
1906
- _ = cell.Shells(None, shells)
1922
+ _ = cell.Shells(None, shells) # Hook to Core
1907
1923
  return shells
1908
1924
 
1909
1925
  @staticmethod
1910
- def Sphere(origin: topologic.Vertex = None, radius: float = 0.5, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1],
1911
- placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
1926
+ def Sphere(origin= None, radius: float = 0.5, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1],
1927
+ placement: str = "center", tolerance: float = 0.0001):
1912
1928
  """
1913
1929
  Creates a sphere.
1914
1930
 
1915
1931
  Parameters
1916
1932
  ----------
1917
- origin : topologic.Vertex , optional
1933
+ origin : topologic_core.Vertex , optional
1918
1934
  The origin location of the sphere. The default is None which results in the sphere being placed at (0, 0, 0).
1919
1935
  radius : float , optional
1920
1936
  The radius of the sphere. The default is 0.5.
@@ -1931,26 +1947,27 @@ class Cell(Topology):
1931
1947
 
1932
1948
  Returns
1933
1949
  -------
1934
- topologic.Cell
1950
+ topologic_core.Cell
1935
1951
  The created sphere.
1936
1952
 
1937
1953
  """
1938
1954
 
1939
1955
  from topologicpy.Vertex import Vertex
1956
+ from topologicpy.Wire import Wire
1940
1957
  from topologicpy.Topology import Topology
1941
1958
 
1942
1959
  if not origin:
1943
1960
  origin = Vertex.ByCoordinates(0, 0, 0)
1944
- if not isinstance(origin, topologic.Vertex):
1961
+ if not Topology.IsInstance(origin, "Vertex"):
1945
1962
  print("Cell.Sphere - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1946
1963
  return None
1947
1964
  c = Wire.Circle(origin=Vertex.Origin(), radius=radius, sides=vSides, fromAngle=-90, toAngle=90, close=False, direction=[0, 0, 1], placement="center")
1948
1965
  c = Topology.Rotate(c, origin=Vertex.Origin(), axis=[1, 0, 0], angle=90)
1949
1966
  sphere = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0, 0, 1], angle=360, sides=uSides, tolerance=tolerance)
1950
- if sphere.Type() == topologic.CellComplex.Type():
1967
+ if Topology.Type(sphere) == Topology.TypeID("CellComplex"):
1951
1968
  sphere = sphere.ExternalBoundary()
1952
- if sphere.Type() == topologic.Shell.Type():
1953
- sphere = topologic.Cell.ByShell(sphere)
1969
+ if Topology.Type(sphere) == Topology.TypeID("Shell"):
1970
+ sphere = Cell.ByShell(sphere)
1954
1971
  if placement.lower() == "bottom":
1955
1972
  sphere = Topology.Translate(sphere, 0, 0, radius)
1956
1973
  elif placement.lower() == "lowerleft":
@@ -1960,13 +1977,13 @@ class Cell(Topology):
1960
1977
  return sphere
1961
1978
 
1962
1979
  @staticmethod
1963
- def SurfaceArea(cell: topologic.Cell, mantissa: int = 6) -> float:
1980
+ def SurfaceArea(cell, mantissa: int = 6) -> float:
1964
1981
  """
1965
1982
  Returns the surface area of the input cell.
1966
1983
 
1967
1984
  Parameters
1968
1985
  ----------
1969
- cell : topologic.Cell
1986
+ cell : topologic_core.Cell
1970
1987
  The cell.
1971
1988
  mantissa : int , optional
1972
1989
  The desired length of the mantissa. The default is 6.
@@ -1980,8 +1997,8 @@ class Cell(Topology):
1980
1997
  return Cell.Area(cell=cell, mantissa=mantissa)
1981
1998
 
1982
1999
  @staticmethod
1983
- def Tetrahedron(origin: topologic.Vertex = None, radius: float = 0.5,
1984
- direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
2000
+ def Tetrahedron(origin= None, radius: float = 0.5,
2001
+ direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001):
1985
2002
  """
1986
2003
  Description
1987
2004
  ----------
@@ -1989,7 +2006,7 @@ class Cell(Topology):
1989
2006
 
1990
2007
  Parameters
1991
2008
  ----------
1992
- origin : topologic.Vertex , optional
2009
+ origin : topologic_core.Vertex , optional
1993
2010
  The origin location of the tetrahedron. The default is None which results in the tetrahedron being placed at (0, 0, 0).
1994
2011
  radius : float , optional
1995
2012
  The radius of the tetrahedron's circumscribed sphere. The default is 0.5.
@@ -2002,7 +2019,7 @@ class Cell(Topology):
2002
2019
 
2003
2020
  Returns
2004
2021
  -------
2005
- topologic.Cell
2022
+ topologic_core.Cell
2006
2023
  The created tetrahedron.
2007
2024
 
2008
2025
  """
@@ -2015,7 +2032,7 @@ class Cell(Topology):
2015
2032
 
2016
2033
  if not origin:
2017
2034
  origin = Vertex.ByCoordinates(0, 0, 0)
2018
- if not isinstance(origin, topologic.Vertex):
2035
+ if not Topology.IsInstance(origin, "Vertex"):
2019
2036
  print("Cell.Tetrahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
2020
2037
  return None
2021
2038
 
@@ -2040,13 +2057,13 @@ class Cell(Topology):
2040
2057
  return tetrahedron
2041
2058
 
2042
2059
  @staticmethod
2043
- def Torus(origin: topologic.Vertex = None, majorRadius: float = 0.5, minorRadius: float = 0.125, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
2060
+ def Torus(origin= None, majorRadius: float = 0.5, minorRadius: float = 0.125, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001):
2044
2061
  """
2045
2062
  Creates a torus.
2046
2063
 
2047
2064
  Parameters
2048
2065
  ----------
2049
- origin : topologic.Vertex , optional
2066
+ origin : topologic_core.Vertex , optional
2050
2067
  The origin location of the torus. The default is None which results in the torus being placed at (0, 0, 0).
2051
2068
  majorRadius : float , optional
2052
2069
  The major radius of the torus. The default is 0.5.
@@ -2065,24 +2082,25 @@ class Cell(Topology):
2065
2082
 
2066
2083
  Returns
2067
2084
  -------
2068
- topologic.Cell
2085
+ topologic_core.Cell
2069
2086
  The created torus.
2070
2087
 
2071
2088
  """
2072
2089
 
2073
2090
  from topologicpy.Vertex import Vertex
2091
+ from topologicpy.Wire import Wire
2074
2092
  from topologicpy.Topology import Topology
2075
2093
 
2076
2094
  if not origin:
2077
2095
  origin = Vertex.ByCoordinates(0, 0, 0)
2078
- if not isinstance(origin, topologic.Vertex):
2096
+ if not Topology.IsInstance(origin, "Vertex"):
2079
2097
  print("Cell.Torus - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
2080
2098
  return None
2081
2099
  c = Wire.Circle(origin=Vertex.Origin(), radius=minorRadius, sides=vSides, fromAngle=0, toAngle=360, close=False, direction=[0, 1, 0], placement="center")
2082
2100
  c = Topology.Translate(c, abs(majorRadius-minorRadius), 0, 0)
2083
2101
  torus = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0, 0, 1], angle=360, sides=uSides, tolerance=tolerance)
2084
- if torus.Type() == topologic.Shell.Type():
2085
- torus = topologic.Cell.ByShell(torus)
2102
+ if Topology.Type(torus) == Topology.TypeID("Shell"):
2103
+ torus = Cell.ByShell(torus)
2086
2104
  if placement.lower() == "bottom":
2087
2105
  torus = Topology.Translate(torus, 0, 0, minorRadius)
2088
2106
  elif placement.lower() == "lowerleft":
@@ -2093,13 +2111,13 @@ class Cell(Topology):
2093
2111
  return torus
2094
2112
 
2095
2113
  @staticmethod
2096
- def Vertices(cell: topologic.Cell) -> list:
2114
+ def Vertices(cell) -> list:
2097
2115
  """
2098
2116
  Returns the vertices of the input cell.
2099
2117
 
2100
2118
  Parameters
2101
2119
  ----------
2102
- cell : topologic.Cell
2120
+ cell : topologic_core.Cell
2103
2121
  The input cell.
2104
2122
 
2105
2123
  Returns
@@ -2108,21 +2126,23 @@ class Cell(Topology):
2108
2126
  The list of vertices.
2109
2127
 
2110
2128
  """
2111
- if not isinstance(cell, topologic.Cell):
2129
+ from topologicpy.Topology import Topology
2130
+
2131
+ if not Topology.IsInstance(cell, "Cell"):
2112
2132
  print("Cell.Vertices - Error: The input cell parameter is not a valid topologic cell. Returning None.")
2113
2133
  return None
2114
2134
  vertices = []
2115
- _ = cell.Vertices(None, vertices)
2135
+ _ = cell.Vertices(None, vertices) # Hook to Core
2116
2136
  return vertices
2117
2137
 
2118
2138
  @staticmethod
2119
- def Volume(cell: topologic.Cell, mantissa: int = 6) -> float:
2139
+ def Volume(cell, mantissa: int = 6) -> float:
2120
2140
  """
2121
2141
  Returns the volume of the input cell.
2122
2142
 
2123
2143
  Parameters
2124
2144
  ----------
2125
- cell : topologic.Cell
2145
+ cell : topologic_core.Cell
2126
2146
  The input cell.
2127
2147
  manitssa: int , optional
2128
2148
  The desired length of the mantissa. The default is 6.
@@ -2133,25 +2153,27 @@ class Cell(Topology):
2133
2153
  The volume of the input cell.
2134
2154
 
2135
2155
  """
2136
- if not isinstance(cell, topologic.Cell):
2156
+ from topologicpy.Topology import Topology
2157
+
2158
+ if not Topology.IsInstance(cell, "Cell"):
2137
2159
  print("Cell.Volume - Error: The input cell parameter is not a valid topologic cell. Returning None.")
2138
2160
  return None
2139
2161
  volume = None
2140
2162
  try:
2141
- volume = round(topologic.CellUtility.Volume(cell), mantissa)
2163
+ volume = round(topologic.CellUtility.Volume(cell), mantissa) # Hook to Core
2142
2164
  except:
2143
2165
  print("Cell.Volume - Error: Could not compute the volume of the input cell. Returning None.")
2144
2166
  volume = None
2145
2167
  return volume
2146
2168
 
2147
2169
  @staticmethod
2148
- def Wires(cell: topologic.Cell) -> list:
2170
+ def Wires(cell) -> list:
2149
2171
  """
2150
2172
  Returns the wires of the input cell.
2151
2173
 
2152
2174
  Parameters
2153
2175
  ----------
2154
- cell : topologic.Cell
2176
+ cell : topologic_core.Cell
2155
2177
  The input cell.
2156
2178
 
2157
2179
  Returns
@@ -2160,10 +2182,12 @@ class Cell(Topology):
2160
2182
  The list of wires.
2161
2183
 
2162
2184
  """
2163
- if not isinstance(cell, topologic.Cell):
2185
+ from topologicpy.Topology import Topology
2186
+
2187
+ if not Topology.IsInstance(cell, "Cell"):
2164
2188
  print("Cell.Wires - Error: The input cell parameter is not a valid topologic cell. Returning None.")
2165
2189
  return None
2166
2190
  wires = []
2167
- _ = cell.Wires(None, wires)
2191
+ _ = cell.Wires(None, wires) # Hook to Core
2168
2192
  return wires
2169
2193