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/Edge.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.Vertex import Vertex
19
- from topologicpy.Vector import Vector
20
- from topologicpy.Topology import Topology
21
18
 
22
- class Edge(Topology):
19
+ class Edge():
23
20
  @staticmethod
24
- def Angle(edgeA: topologic.Edge, edgeB: topologic.Edge, mantissa: int = 6, bracket: bool = False) -> float:
21
+ def Angle(edgeA, edgeB, mantissa: int = 6, bracket: bool = False) -> float:
25
22
  """
26
23
  Returns the angle in degrees between the two input edges.
27
24
 
28
25
  Parameters
29
26
  ----------
30
- edgeA : topologic.Edge
27
+ edgeA : topologic_core.Edge
31
28
  The first input edge.
32
29
  edgeB : topologic Edge
33
30
  The second input edge.
@@ -42,11 +39,13 @@ class Edge(Topology):
42
39
  The angle in degrees between the two input edges.
43
40
 
44
41
  """
42
+ from topologicpy.Topology import Topology
43
+ from topologicpy.Vector import Vector
45
44
 
46
- if not isinstance(edgeA, topologic.Edge):
45
+ if not Topology.IsInstance(edgeA, "Edge"):
47
46
  print("Edge.Angle - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
48
47
  return None
49
- if not isinstance(edgeB, topologic.Edge):
48
+ if not Topology.IsInstance(edgeB, "Edge"):
50
49
  print("Edge.Angle - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
51
50
  return None
52
51
  dirA = Edge.Direction(edgeA, mantissa)
@@ -58,13 +57,13 @@ class Edge(Topology):
58
57
  return round(ang, mantissa)
59
58
 
60
59
  @staticmethod
61
- def Bisect(edgeA: topologic.Edge, edgeB: topologic.Edge, length: float = 1.0, placement: int = 0, tolerance: float = 0.0001) -> topologic.Edge:
60
+ def Bisect(edgeA, edgeB, length: float = 1.0, placement: int = 0, tolerance: float = 0.0001):
62
61
  """
63
62
  Creates a bisecting edge between edgeA and edgeB.
64
63
 
65
64
  Parameters
66
65
  ----------
67
- edgeA : topologic.Edge
66
+ edgeA : topologic_core.Edge
68
67
  The first topologic Edge.
69
68
  edgeB : topologic Edge
70
69
  The second topologic Edge.
@@ -81,7 +80,7 @@ class Edge(Topology):
81
80
 
82
81
  Returns
83
82
  -------
84
- topologic.Edge
83
+ topologic_core.Edge
85
84
  The created bisecting edge.
86
85
 
87
86
  """
@@ -92,10 +91,10 @@ class Edge(Topology):
92
91
  from topologicpy.Topology import Topology
93
92
  from topologicpy.Vector import Vector
94
93
 
95
- if not isinstance(edgeA, topologic.Edge):
94
+ if not Topology.IsInstance(edgeA, "Edge"):
96
95
  print("Edge.Bisect - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
97
96
  return None
98
- if not isinstance(edgeB, topologic.Edge):
97
+ if not Topology.IsInstance(edgeB, "Edge"):
99
98
  print("Edge.Bisect - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
100
99
  return None
101
100
  if Edge.Length(edgeA) < tolerance:
@@ -106,7 +105,7 @@ class Edge(Topology):
106
105
  return None
107
106
 
108
107
  wire = Topology.SelfMerge(Cluster.ByTopologies([edgeA, edgeB]), tolerance=tolerance)
109
- if not isinstance(wire, topologic.Wire):
108
+ if not Topology.IsInstance(wire, "Wire"):
110
109
  print("Edge.Bisect - Error: The input edgeA and edgeB parameters do not share a vertex and thus cannot be bisected. Returning None.")
111
110
  return None
112
111
  edges = Topology.Edges(wire)
@@ -123,13 +122,13 @@ class Edge(Topology):
123
122
  return bisecting_edge
124
123
 
125
124
  @staticmethod
126
- def ByFaceNormal(face: topologic.Face, origin: topologic.Vertex = None, length: float = 1.0, tolerance: float = 0.0001) -> topologic.Edge:
125
+ def ByFaceNormal(face, origin= None, length: float = 1.0, tolerance: float = 0.0001):
127
126
  """
128
127
  Creates a straight edge representing the normal to the input face.
129
128
 
130
129
  Parameters
131
130
  ----------
132
- face : topologic.Face
131
+ face : topologic_core.Face
133
132
  The input face
134
133
  origin : toopologic.Vertex , optional
135
134
  The desired origin of the edge. If set to None, the centroid of the face is chosen as the origin of the edge. The default is None.
@@ -140,7 +139,7 @@ class Edge(Topology):
140
139
 
141
140
  Returns
142
141
  -------
143
- edge : topologic.Edge
142
+ edge : topologic_core.Edge
144
143
  The created edge.
145
144
 
146
145
  """
@@ -148,34 +147,34 @@ class Edge(Topology):
148
147
  from topologicpy.Face import Face
149
148
  from topologicpy.Topology import Topology
150
149
  edge = None
151
- if not isinstance(face, topologic.Face):
150
+ if not Topology.IsInstance(face, "Face"):
152
151
  print("Edge.ByFaceNormal - Error: The input face parameter is not a valid topologic face. Returning None.")
153
152
  return None
154
- if not isinstance(origin, topologic.Vertex):
153
+ if not Topology.IsInstance(origin, "Vertex"):
155
154
  origin = Topology.Centroid(face)
156
- if not isinstance(origin, topologic.Vertex):
155
+ if not Topology.IsInstance(origin, "Vertex"):
157
156
  print("Edge.ByFaceNormal - Error: The input origin parameter is not a valid topologic origin. Returning None.")
158
157
  return None
159
158
  n = Face.Normal(face)
160
159
  v2 = Topology.Translate(origin, n[0], n[1], n[2])
161
160
  edge = Edge.ByStartVertexEndVertex(origin, v2, tolerance=tolerance, silent=True)
162
- if not isinstance(edge, topologic.Edge):
161
+ if not Topology.IsInstance(edge, "Edge"):
163
162
  print("Edge.ByFaceNormal - Error: Could not create an edge. Returning None.")
164
163
  return None
165
164
  edge = Edge.SetLength(edge, length, bothSides=False)
166
- if not isinstance(edge, topologic.Edge):
165
+ if not Topology.IsInstance(edge, "Edge"):
167
166
  print("Edge.ByFaceNormal - Error: Could not create an edge. Returning None.")
168
167
  return None
169
168
  return edge
170
169
 
171
170
  @staticmethod
172
- def ByOffset2D(edge: topologic.Edge, offset: float = 1.0, tolerance: float = 0.0001) -> topologic.Edge:
171
+ def ByOffset2D(edge, offset: float = 1.0, tolerance: float = 0.0001):
173
172
  """
174
173
  Creates and edge offset from the input edge. This method is intended for edges that are in the XY plane.
175
174
 
176
175
  Parameters
177
176
  ----------
178
- edge : topologic.Edge
177
+ edge : topologic_core.Edge
179
178
  The input edge.
180
179
  offset : float , optional
181
180
  The desired offset. The default is 1.
@@ -184,11 +183,13 @@ class Edge(Topology):
184
183
 
185
184
  Returns
186
185
  -------
187
- topologic.Edge
186
+ topologic_core.Edge
188
187
  An edge offset from the input edge.
189
188
 
190
189
  """
191
190
  from topologicpy.Topology import Topology
191
+ from topologicpy.Vector import Vector
192
+
192
193
  n = Edge.Normal(edge)
193
194
  n = Vector.Normalize(n)
194
195
  n = Vector.Multiply(n, offset, tolerance)
@@ -197,13 +198,13 @@ class Edge(Topology):
197
198
 
198
199
 
199
200
  @staticmethod
200
- def ByStartVertexEndVertex(vertexA: topologic.Vertex, vertexB: topologic.Vertex, tolerance: float = 0.0001, silent=False) -> topologic.Edge:
201
+ def ByStartVertexEndVertex(vertexA, vertexB, tolerance: float = 0.0001, silent=False):
201
202
  """
202
203
  Creates a straight edge that connects the input vertices.
203
204
 
204
205
  Parameters
205
206
  ----------
206
- vertexA : topologic.Vertex
207
+ vertexA : topologic_core.Vertex
207
208
  The first input vertex. This is considered the start vertex.
208
209
  vertexB : toopologic.Vertex
209
210
  The second input vertex. This is considered the end vertex.
@@ -214,21 +215,23 @@ class Edge(Topology):
214
215
 
215
216
  Returns
216
217
  -------
217
- edge : topologic.Edge
218
+ edge : topologic_core.Edge
218
219
  The created edge.
219
220
 
220
221
  """
221
222
  from topologicpy.Vertex import Vertex
223
+ from topologicpy.Topology import Topology
224
+
222
225
  edge = None
223
- if not isinstance(vertexA, topologic.Vertex):
226
+ if not Topology.IsInstance(vertexA, "Vertex"):
224
227
  if not silent:
225
228
  print("Edge.ByStartVertexEndVertex - Error: The input vertexA parameter is not a valid topologic vertex. Returning None.")
226
229
  return None
227
- if not isinstance(vertexB, topologic.Vertex):
230
+ if not Topology.IsInstance(vertexB, "Vertex"):
228
231
  if not silent:
229
232
  print("Edge.ByStartVertexEndVertex - Error: The input vertexB parameter is not a valid topologic vertex. Returning None.")
230
233
  return None
231
- if topologic.Topology.IsSame(vertexA, vertexB):
234
+ if Topology.IsSame(vertexA, vertexB):
232
235
  if not silent:
233
236
  print("Edge.ByStartVertexEndVertex - Error: The input vertexA and vertexB parameters are the same vertex. Returning None.")
234
237
  return None
@@ -237,7 +240,7 @@ class Edge(Topology):
237
240
  print("Edge.ByStartVertexEndVertex - Error: The distance between the input vertexA and vertexB parameters is less than the input tolerance. Returning None.")
238
241
  return None
239
242
  try:
240
- edge = topologic.Edge.ByStartVertexEndVertex(vertexA, vertexB)
243
+ edge = topologic.Edge.ByStartVertexEndVertex(vertexA, vertexB) # Hook to Core
241
244
  except:
242
245
  if not silent:
243
246
  print("Edge.ByStartVertexEndVertex - Error: Could not create an edge. Returning None.")
@@ -245,7 +248,7 @@ class Edge(Topology):
245
248
  return edge
246
249
 
247
250
  @staticmethod
248
- def ByVertices(*args, tolerance: float = 0.0001, silent: bool = False) -> topologic.Edge:
251
+ def ByVertices(*args, tolerance: float = 0.0001, silent: bool = False):
249
252
  """
250
253
  Creates a straight edge that connects the input list of vertices.
251
254
 
@@ -260,12 +263,12 @@ class Edge(Topology):
260
263
 
261
264
  Returns
262
265
  -------
263
- topologic.Edge
266
+ topologic_core.Edge
264
267
  The created edge.
265
268
 
266
269
  """
267
-
268
270
  from topologicpy.Helper import Helper
271
+ from topologicpy.Topology import Topology
269
272
 
270
273
  if len(args) == 0:
271
274
  print("Edge.ByVertices - Error: The input vertices parameter is an empty list. Returning None.")
@@ -278,7 +281,7 @@ class Edge(Topology):
278
281
  print("Edge.ByVertices - Error: The input vertices parameter is an empty list. Returning None.")
279
282
  return None
280
283
  else:
281
- vertexList = [x for x in vertices if isinstance(x, topologic.Vertex)]
284
+ vertexList = [x for x in vertices if Topology.IsInstance(x, "Vertex")]
282
285
  if len(vertexList) == 0:
283
286
  if not silent:
284
287
  print("Edge.ByVertices - Error: The input vertices parameter does not contain any valid vertices. Returning None.")
@@ -289,7 +292,7 @@ class Edge(Topology):
289
292
  return None
290
293
  else:
291
294
  vertexList = Helper.Flatten(list(args))
292
- vertexList = [x for x in vertexList if isinstance(x, topologic.Vertex)]
295
+ vertexList = [x for x in vertexList if Topology.IsInstance(x, "Vertex")]
293
296
  if len(vertexList) < 2:
294
297
  if not silent:
295
298
  print("Edge.ByVertices - Error: The input vertices parameter has less than two vertices. Returning None.")
@@ -297,42 +300,44 @@ class Edge(Topology):
297
300
  return Edge.ByStartVertexEndVertex(vertexList[0], vertexList[-1], tolerance=tolerance, silent=silent)
298
301
 
299
302
  @staticmethod
300
- def ByVerticesCluster(cluster: topologic.Cluster, tolerance: float = 0.0001) -> topologic.Edge:
303
+ def ByVerticesCluster(cluster, tolerance: float = 0.0001):
301
304
  """
302
305
  Creates a straight edge that connects the input cluster of vertices.
303
306
 
304
307
  Parameters
305
308
  ----------
306
- cluster : topologic.Cluster
309
+ cluster : topologic_core.Cluster
307
310
  The input cluster of vertices. The first item is considered the start vertex and the last item is considered the end vertex.
308
311
  tolerance : float , optional
309
312
  The desired tolerance to decide if an edge can be created. The default is 0.0001.
310
313
 
311
314
  Returns
312
315
  -------
313
- topologic.Edge
316
+ topologic_core.Edge
314
317
  The created edge.
315
318
 
316
319
  """
317
320
  from topologicpy.Cluster import Cluster
318
- if not isinstance(cluster, topologic.Cluster):
321
+ from topologicpy.Topology import Topology
322
+
323
+ if not Topology.IsInstance(cluster, "Cluster"):
319
324
  print("Edge.ByVerticesCluster - Error: The input cluster parameter is not a valid topologic cluster. Returning None.")
320
325
  return None
321
326
  vertices = Cluster.Vertices(cluster)
322
- vertexList = [x for x in vertices if isinstance(x, topologic.Vertex)]
327
+ vertexList = [x for x in vertices if Topology.IsInstance(x, "Vertex")]
323
328
  if len(vertexList) < 2:
324
329
  print("Edge.ByVerticesCluster - Error: The input cluster parameter contains less than two vertices. Returning None.")
325
330
  return None
326
331
  return Edge.ByStartVertexEndVertex(vertexList[0], vertexList[-1], tolerance=tolerance)
327
332
 
328
333
  @staticmethod
329
- def Direction(edge: topologic.Edge, mantissa: int = 6) -> list:
334
+ def Direction(edge, mantissa: int = 6) -> list:
330
335
  """
331
336
  Returns the direction of the input edge expressed as a list of three numbers.
332
337
 
333
338
  Parameters
334
339
  ----------
335
- edge : topologic.Edge
340
+ edge : topologic_core.Edge
336
341
  The input edge.
337
342
  mantissa : int , optional
338
343
  The desired length of the mantissa. The default is 6.
@@ -343,10 +348,10 @@ class Edge(Topology):
343
348
  The direction of the input edge.
344
349
 
345
350
  """
346
-
347
351
  from topologicpy.Vector import Vector
352
+ from topologicpy.Topology import Topology
348
353
 
349
- if not isinstance(edge, topologic.Edge):
354
+ if not Topology.IsInstance(edge, "Edge"):
350
355
  print("Edge.Direction - Error: The input edge parameter is not a valid topologic edge. Returning None.")
351
356
  return None
352
357
  ev = edge.EndVertex()
@@ -361,22 +366,24 @@ class Edge(Topology):
361
366
  return [x, y, z]
362
367
 
363
368
  @staticmethod
364
- def EndVertex(edge: topologic.Edge) -> topologic.Vertex:
369
+ def EndVertex(edge):
365
370
  """
366
371
  Returns the end vertex of the input edge.
367
372
 
368
373
  Parameters
369
374
  ----------
370
- edge : topologic.Edge
375
+ edge : topologic_core.Edge
371
376
  The input edge.
372
377
 
373
378
  Returns
374
379
  -------
375
- topologic.Vertex
380
+ topologic_core.Vertex
376
381
  The end vertex of the input edge.
377
382
 
378
383
  """
379
- if not isinstance(edge, topologic.Edge):
384
+ from topologicpy.Topology import Topology
385
+
386
+ if not Topology.IsInstance(edge, "Edge"):
380
387
  print("Edge.EndVertex - Error: The input edge parameter is not a valid topologic edge. Returning None.")
381
388
  return None
382
389
  vert = None
@@ -387,13 +394,13 @@ class Edge(Topology):
387
394
  return vert
388
395
 
389
396
  @staticmethod
390
- def Extend(edge: topologic.Edge, distance: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001) -> topologic.Edge:
397
+ def Extend(edge, distance: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001):
391
398
  """
392
399
  Extends the input edge by the input distance.
393
400
 
394
401
  Parameters
395
402
  ----------
396
- edge : topologic.Edge
403
+ edge : topologic_core.Edge
397
404
  The input edge.
398
405
  distance : float , optional
399
406
  The offset distance. The default is 1.
@@ -406,11 +413,13 @@ class Edge(Topology):
406
413
 
407
414
  Returns
408
415
  -------
409
- topologic.Edge
416
+ topologic_core.Edge
410
417
  The extended edge.
411
418
 
412
419
  """
413
- if not isinstance(edge, topologic.Edge):
420
+ from topologicpy.Topology import Topology
421
+
422
+ if not Topology.IsInstance(edge, "Edge"):
414
423
  print("Edge.Extend - Error: The input edge parameter is not a valid topologic edge. Returning None.")
415
424
  return None
416
425
  distance = abs(distance)
@@ -430,22 +439,22 @@ class Edge(Topology):
430
439
  return Edge.ByVertices([sve, eve], tolerance=tolerance, silent=True)
431
440
 
432
441
  @staticmethod
433
- def ExtendToEdge2D(edgeA: topologic.Edge, edgeB: topologic.Edge, tolerance: float = 0.0001) -> topologic.Edge:
442
+ def ExtendToEdge2D(edgeA, edgeB, tolerance: float = 0.0001):
434
443
  """
435
444
  Extends the first input edge to meet the second input edge. This works only in the XY plane. Z coordinates are ignored.
436
445
 
437
446
  Parameters
438
447
  ----------
439
- edgeA : topologic.Edge
448
+ edgeA : topologic_core.Edge
440
449
  The first input edge.
441
- edgeB : topologic.Edge
450
+ edgeB : topologic_core.Edge
442
451
  The second input edge.
443
452
  tolerance : float , optional
444
453
  The desired tolerance. The default is 0.0001.
445
454
 
446
455
  Returns
447
456
  -------
448
- topologic.Edge
457
+ topologic_core.Edge
449
458
  The extended edge.
450
459
 
451
460
  """
@@ -453,10 +462,10 @@ class Edge(Topology):
453
462
  from topologicpy.Vertex import Vertex
454
463
  from topologicpy.Topology import Topology
455
464
 
456
- if not isinstance(edgeA, topologic.Edge):
465
+ if not Topology.IsInstance(edgeA, "Edge"):
457
466
  print("Edge.ExtendToEdge2D - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
458
467
  return None
459
- if not isinstance(edgeB, topologic.Edge):
468
+ if not Topology.IsInstance(edgeB, "Edge"):
460
469
  print("Edge.ExtendToEdge2D - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
461
470
  return None
462
471
  sva = Edge.StartVertex(edgeA)
@@ -475,13 +484,13 @@ class Edge(Topology):
475
484
  return None
476
485
 
477
486
  @staticmethod
478
- def Index(edge: topologic.Edge, edges: list, strict: bool = False, tolerance: float = 0.0001) -> int:
487
+ def Index(edge, edges: list, strict: bool = False, tolerance: float = 0.0001) -> int:
479
488
  """
480
489
  Returns index of the input edge in the input list of edges
481
490
 
482
491
  Parameters
483
492
  ----------
484
- edge : topologic.Edge
493
+ edge : topologic_core.Edge
485
494
  The input edge.
486
495
  edges : list
487
496
  The input list of edges.
@@ -497,13 +506,15 @@ class Edge(Topology):
497
506
 
498
507
  """
499
508
  from topologicpy.Topology import Topology
500
- if not isinstance(edge, topologic.Edge):
509
+ from topologicpy.Vertex import Vertex
510
+
511
+ if not Topology.IsInstance(edge, "Edge"):
501
512
  print("Edge.Index - Error: The input edge parameter is not a valid topologic edge. Returning None.")
502
513
  return None
503
514
  if not isinstance(edges, list):
504
515
  print("Edge.Index - Error: The input edges parameter is not a valid list. Returning None.")
505
516
  return None
506
- edges = [e for e in edges if isinstance(e, topologic.Edge)]
517
+ edges = [e for e in edges if Topology.IsInstance(e, "Edge")]
507
518
  if len(edges) < 1:
508
519
  print("Edge.Index - Error: The input edges parameter contains no valid edges. Returning None.")
509
520
  return None
@@ -527,30 +538,33 @@ class Edge(Topology):
527
538
  return None
528
539
 
529
540
  @staticmethod
530
- def Intersect2D(edgeA: topologic.Edge, edgeB: topologic.Edge, silent: bool = False) -> topologic.Vertex:
541
+ def Intersect2D(edgeA, edgeB, silent: bool = False):
531
542
  """
532
- Returns the intersection of the two input edges as a topologic.Vertex. This works only in the XY plane. Z coordinates are ignored.
543
+ Returns the intersection of the two input edges as a topologic_core.Vertex. This works only in the XY plane. Z coordinates are ignored.
533
544
 
534
545
  Parameters
535
546
  ----------
536
- edgeA : topologic.Edge
547
+ edgeA : topologic_core.Edge
537
548
  The first input edge.
538
- edgeB : topologic.Edge
549
+ edgeB : topologic_core.Edge
539
550
  The second input edge.
540
551
  silent : bool , optional
541
552
  If set to False, error and warning messages are displayed. Otherwise they are not. The default is False.
542
553
 
543
554
  Returns
544
555
  -------
545
- topologic.Vertex
556
+ topologic_core.Vertex
546
557
  The intersection of the two input edges.
547
558
 
548
559
  """
549
- if not isinstance(edgeA, topologic.Edge):
560
+ from topologicpy.Vertex import Vertex
561
+ from topologicpy.Topology import Topology
562
+
563
+ if not Topology.IsInstance(edgeA, "Edge"):
550
564
  if not silent:
551
565
  print("Edge.Intersect2D - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
552
566
  return None
553
- if not isinstance(edgeB, topologic.Edge):
567
+ if not Topology.IsInstance(edgeB, "Edge"):
554
568
  if not silent:
555
569
  print("Edge.Intersect2D - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
556
570
  return None
@@ -583,20 +597,19 @@ class Edge(Topology):
583
597
 
584
598
 
585
599
  @staticmethod
586
- def IsCollinear(edgeA: topologic.Edge, edgeB: topologic.Edge, mantissa: int = 6, angTolerance: float = 0.1, tolerance: float = 0.0001) -> bool:
600
+ def IsCollinear(edgeA, edgeB, mantissa: int = 6, tolerance: float = 0.0001) -> bool:
587
601
  """
588
602
  Return True if the two input edges are collinear. Returns False otherwise.
603
+ This code is based on a contribution by https://github.com/gaoxipeng
589
604
 
590
605
  Parameters
591
606
  ----------
592
- edgeA : topologic.Edge
607
+ edgeA : topologic_core.Edge
593
608
  The first input edge.
594
- edgeB : topologic.Edge
609
+ edgeB : topologic_core.Edge
595
610
  The second input edge.
596
611
  mantissa : int , optional
597
612
  The desired length of the mantissa. The default is 6.
598
- angTolerance : float , optional
599
- The angular tolerance used for the test. The default is 0.1.
600
613
  tolerance : float , optional
601
614
  The desired tolerance. The default is 0.0001.
602
615
 
@@ -606,35 +619,55 @@ class Edge(Topology):
606
619
  True if the two edges are collinear. False otherwise.
607
620
 
608
621
  """
609
- if not isinstance(edgeA, topologic.Edge):
610
- print("Edge.IsCollinear - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
622
+ from topologicpy.Vertex import Vertex
623
+ from topologicpy.Topology import Topology
624
+ import numpy as np
625
+
626
+ if not Topology.IsInstance(edgeA, "Edge"):
627
+ print("Edge.IsCollinear - Error: The input parameter edgeA is not a valid edge. Returning None")
611
628
  return None
612
- if not isinstance(edgeB, topologic.Edge):
613
- print("Edge.IsCollinear - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
629
+ if not Topology.IsInstance(edgeB, "Edge"):
630
+ print("Edge.IsCollinear - Error: The input parameter edgeB is not a valid edge. Returning None")
614
631
  return None
615
- ang = Edge.Angle(edgeA, edgeB, mantissa=mantissa, bracket=True)
616
- svA = Edge.StartVertex(edgeA)
617
- evA = Edge.EndVertex(edgeA)
618
- svB = Edge.StartVertex(edgeB)
619
- evB = Edge.EndVertex(edgeB)
620
- d1 = Vertex.Distance(svA, svB)
621
- d2 = Vertex.Distance(svA, evB)
622
- d3 = Vertex.Distance(evA, svB)
623
- d4 = Vertex.Distance(evA, evB)
624
- if (d1 < tolerance or d2 < tolerance or d3 < tolerance or d4 < tolerance) and (abs(ang) < angTolerance or (abs(180 - ang) < angTolerance)):
625
- return True
626
- return False
632
+ if Edge.Length(edgeA) < tolerance:
633
+ print("Edge.IsCollinear - Error: The length of edgeA is less than the tolerance. Returning None")
634
+ return None
635
+ if Edge.Length(edgeB) < tolerance:
636
+ print("Edge.IsCollinear - Error: The length of edgeB is less than the tolerance. Returning None")
637
+ return None
638
+ # Calculate coefficients A, B, C from edgeA
639
+ start_a = Edge.StartVertex(edgeA)
640
+ end_a = Edge.EndVertex(edgeA)
641
+ A = Vertex.Y(end_a, mantissa=mantissa) - Vertex.Y(start_a, mantissa=mantissa)
642
+ B = -(Vertex.X(end_a, mantissa=mantissa) - Vertex.X(start_a, mantissa=mantissa))
643
+ norm = np.sqrt(A ** 2 + B ** 2)
644
+ A /= norm
645
+ B /= norm
646
+ C = -(A * Vertex.X(start_a, mantissa=mantissa) + B * Vertex.Y(start_a, mantissa=mantissa))
647
+
648
+ # Calculate perpendicular distance for start vertex of edgeB
649
+ start_b = Edge.StartVertex(edgeB)
650
+ x0, y0 = Vertex.X(start_b, mantissa=mantissa), Vertex.Y(start_b, mantissa=mantissa)
651
+ distance_start = abs(A * x0 + B * y0 + C)
652
+
653
+ # Calculate perpendicular distance for end vertex of edgeB
654
+ end_b = Edge.EndVertex(edgeB)
655
+ x0, y0 = Vertex.X(end_b, mantissa=mantissa), Vertex.Y(end_b, mantissa=mantissa)
656
+ distance_end = abs(A * x0 + B * y0 + C)
657
+
658
+ # Check if both distances are within tolerance
659
+ return bool(distance_start < tolerance) and bool(distance_end < tolerance)
627
660
 
628
661
  @staticmethod
629
- def IsParallel(edgeA: topologic.Edge, edgeB: topologic.Edge, mantissa: int = 6, angTolerance: float = 0.1) -> bool:
662
+ def IsParallel(edgeA, edgeB, mantissa: int = 6, angTolerance: float = 0.1) -> bool:
630
663
  """
631
664
  Return True if the two input edges are parallel. Returns False otherwise.
632
665
 
633
666
  Parameters
634
667
  ----------
635
- edgeA : topologic.Edge
668
+ edgeA : topologic_core.Edge
636
669
  The first input edge.
637
- edgeB : topologic.Edge
670
+ edgeB : topologic_core.Edge
638
671
  The second input edge.
639
672
  mantissa : int , optional
640
673
  The desired length of the mantissa. The default is 6.
@@ -647,10 +680,12 @@ class Edge(Topology):
647
680
  True if the two edges are collinear. False otherwise.
648
681
 
649
682
  """
650
- if not isinstance(edgeA, topologic.Edge):
683
+ from topologicpy.Topology import Topology
684
+
685
+ if not Topology.IsInstance(edgeA, "Edge"):
651
686
  print("Edge.IsParallel - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
652
687
  return None
653
- if not isinstance(edgeB, topologic.Edge):
688
+ if not Topology.IsInstance(edgeB, "Edge"):
654
689
  print("Edge.IsParallel - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
655
690
  return None
656
691
  ang = Edge.Angle(edgeA, edgeB, mantissa=mantissa, bracket=True)
@@ -659,13 +694,13 @@ class Edge(Topology):
659
694
  return False
660
695
 
661
696
  @staticmethod
662
- def Length(edge: topologic.Edge, mantissa: int = 6) -> float:
697
+ def Length(edge, mantissa: int = 6) -> float:
663
698
  """
664
699
  Returns the length of the input edge.
665
700
 
666
701
  Parameters
667
702
  ----------
668
- edge : topologic.Edge
703
+ edge : topologic_core.Edge
669
704
  The input edge.
670
705
  mantissa : int , optional
671
706
  The desired length of the mantissa. The default is 6.
@@ -676,12 +711,14 @@ class Edge(Topology):
676
711
  The length of the input edge.
677
712
 
678
713
  """
679
- if not isinstance(edge, topologic.Edge):
714
+ from topologicpy.Topology import Topology
715
+
716
+ if not Topology.IsInstance(edge, "Edge"):
680
717
  print("Edge.Length - Error: The input edge parameter is not a valid topologic edge. Returning None.")
681
718
  return None
682
719
  length = None
683
720
  try:
684
- length = round(topologic.EdgeUtility.Length(edge), mantissa)
721
+ length = round(topologic.EdgeUtility.Length(edge), mantissa) # Hook to Core
685
722
  except:
686
723
  length = None
687
724
  if length == None:
@@ -689,13 +726,13 @@ class Edge(Topology):
689
726
  return length
690
727
 
691
728
  @staticmethod
692
- def Line(origin: topologic.Vertex = None, length: float = 1, direction: list = [1,0,0], placement: str ="center", tolerance: float = 0.0001) -> topologic.Edge:
729
+ def Line(origin= None, length: float = 1, direction: list = [1,0,0], placement: str ="center", tolerance: float = 0.0001):
693
730
  """
694
731
  Creates a straight edge (line) using the input parameters.
695
732
 
696
733
  Parameters
697
734
  ----------
698
- origin : topologic.Vertex , optional
735
+ origin : topologic_core.Vertex , optional
699
736
  The origin location of the box. The default is None which results in the edge being placed at (0, 0, 0).
700
737
  length : float , optional
701
738
  The desired length of the edge. The default is 1.0.
@@ -711,7 +748,7 @@ class Edge(Topology):
711
748
  The desired tolerance. The default is 0.0001.
712
749
  Returns
713
750
  -------
714
- topology.Edge
751
+ topologic_core.Edge
715
752
  The created edge
716
753
  """
717
754
 
@@ -721,7 +758,7 @@ class Edge(Topology):
721
758
 
722
759
  if origin == None:
723
760
  origin = Vertex.Origin()
724
- if not isinstance(origin, topologic.Vertex):
761
+ if not Topology.IsInstance(origin, "Vertex"):
725
762
  print("Edge.Line - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
726
763
  return None
727
764
  if length <= 0:
@@ -751,13 +788,13 @@ class Edge(Topology):
751
788
  return None
752
789
 
753
790
  @staticmethod
754
- def Normal(edge: topologic.Edge, angle: float = 0.0):
791
+ def Normal(edge, angle: float = 0.0):
755
792
  """
756
793
  Returns the normal (perpendicular) vector to the input edge.
757
794
 
758
795
  Parameters
759
796
  ----------
760
- edge : topologic.Edge
797
+ edge : topologic_core.Edge
761
798
  The input edge.
762
799
  angle : float , optional
763
800
  The desired rotational offset angle in degrees for the normal edge. This rotates the normal edge
@@ -769,20 +806,22 @@ class Edge(Topology):
769
806
  The normal (perpendicular ) vector to the input edge.
770
807
 
771
808
  """
772
- if not isinstance(edge, topologic.Edge):
809
+ from topologicpy.Topology import Topology
810
+
811
+ if not Topology.IsInstance(edge, "Edge"):
773
812
  print("Edge.Normal - Error: The input edge parameter is not a valid edge. Returning None.")
774
813
  return None
775
814
  normal_edge = Edge.NormalAsEdge(edge, length=1.0, u=0.5, angle=angle)
776
815
  return Edge.Direction(normal_edge)
777
816
 
778
817
  @staticmethod
779
- def NormalAsEdge(edge: topologic.Edge, length: float = 1.0, u: float = 0.5, angle: float = 0.0):
818
+ def NormalAsEdge(edge, length: float = 1.0, u: float = 0.5, angle: float = 0.0):
780
819
  """
781
820
  Returns the normal (perpendicular) vector to the input edge as an edge.
782
821
 
783
822
  Parameters
784
823
  ----------
785
- edge : topologic.Edge
824
+ edge : topologic_core.Edge
786
825
  The input edge.
787
826
  length : float , optional
788
827
  The desired length of the normal edge. The default is 1.0.
@@ -797,7 +836,7 @@ class Edge(Topology):
797
836
 
798
837
  Returns
799
838
  -------
800
- topologic.Edge
839
+ topologic_core.Edge
801
840
  The normal (perpendicular) vector to the input edge as an edge.
802
841
 
803
842
  """
@@ -832,7 +871,7 @@ class Edge(Topology):
832
871
  # Return the start and end vertices of the normal line
833
872
  return start_vertex, list(normal_end_vertex)
834
873
 
835
- if not isinstance(edge, topologic.Edge):
874
+ if not Topology.IsInstance(edge, "Edge"):
836
875
  print("Edge.NormalAsEdge - Error: The input edge parameter is not a valid edge. Returning None.")
837
876
  return None
838
877
  if length <= 0.0:
@@ -853,13 +892,13 @@ class Edge(Topology):
853
892
  return normal_edge
854
893
 
855
894
  @staticmethod
856
- def Normalize(edge: topologic.Edge, useEndVertex: bool = False, tolerance: float = 0.0001) -> topologic.Edge:
895
+ def Normalize(edge, useEndVertex: bool = False, tolerance: float = 0.0001):
857
896
  """
858
897
  Creates a normalized edge that has the same direction as the input edge, but a length of 1.
859
898
 
860
899
  Parameters
861
900
  ----------
862
- edge : topologic.Edge
901
+ edge : topologic_core.Edge
863
902
  The input edge.
864
903
  useEndVertex : bool , optional
865
904
  If True the normalized edge end vertex will be placed at the end vertex of the input edge. Otherwise, the normalized edge start vertex will be placed at the start vertex of the input edge. The default is False.
@@ -868,11 +907,13 @@ class Edge(Topology):
868
907
 
869
908
  Returns
870
909
  -------
871
- topologic.Edge
910
+ topologic_core.Edge
872
911
  The normalized edge.
873
912
 
874
913
  """
875
- if not isinstance(edge, topologic.Edge):
914
+ from topologicpy.Topology import Topology
915
+
916
+ if not Topology.IsInstance(edge, "Edge"):
876
917
  print("Edge.Normalize - Error: The input edge parameter is not a valid topologic edge. Returning None.")
877
918
  return None
878
919
  if not useEndVertex:
@@ -884,15 +925,15 @@ class Edge(Topology):
884
925
  return Edge.ByVertices([sv, ev], tolerance=tolerance)
885
926
 
886
927
  @staticmethod
887
- def ParameterAtVertex(edge: topologic.Edge, vertex: topologic.Vertex, mantissa: int = 6, silent: bool = False) -> float:
928
+ def ParameterAtVertex(edge, vertex, mantissa: int = 6, silent: bool = False) -> float:
888
929
  """
889
930
  Returns the *u* parameter along the input edge based on the location of the input vertex.
890
931
 
891
932
  Parameters
892
933
  ----------
893
- edge : topologic.Edge
934
+ edge : topologic_core.Edge
894
935
  The input edge.
895
- vertex : topologic.Vertex
936
+ vertex : topologic_core.Vertex
896
937
  The input vertex.
897
938
  mantissa : int , optional
898
939
  The desired length of the mantissa. The default is 6.
@@ -905,52 +946,56 @@ class Edge(Topology):
905
946
  The *u* parameter along the input edge based on the location of the input vertex.
906
947
 
907
948
  """
908
- if not isinstance(edge, topologic.Edge):
949
+ from topologicpy.Topology import Topology
950
+
951
+ if not Topology.IsInstance(edge, "Edge"):
909
952
  if not silent:
910
953
  print("Edge.ParameterAtVertex - Error: The input edge parameter is not a valid topologic edge. Returning None.")
911
954
  return None
912
- if not isinstance(vertex, topologic.Vertex):
955
+ if not Topology.IsInstance(vertex, "Vertex"):
913
956
  if not silent:
914
957
  print("Edge.ParameterAtVertex - Error: The input vertex parameter is not a valid topologic vertex. Returning None.")
915
958
  return None
916
959
  parameter = None
917
960
  try:
918
- parameter = topologic.EdgeUtility.ParameterAtPoint(edge, vertex)
961
+ parameter = topologic.EdgeUtility.ParameterAtPoint(edge, vertex) # Hook to Core
919
962
  except:
920
963
  return None #Return silently because topologic C++ returns a runtime error if point is not on curve.
921
964
  return round(parameter, mantissa)
922
965
 
923
966
  @staticmethod
924
- def Reverse(edge: topologic.Edge, tolerance: float = 0.0001) -> topologic.Edge:
967
+ def Reverse(edge, tolerance: float = 0.0001):
925
968
  """
926
969
  Creates an edge that has the reverse direction of the input edge.
927
970
 
928
971
  Parameters
929
972
  ----------
930
- edge : topologic.Edge
973
+ edge : topologic_core.Edge
931
974
  The input edge.
932
975
  tolerance : float , optional
933
976
  The desired tolerance. The default is 0.0001.
934
977
 
935
978
  Returns
936
979
  -------
937
- topologic.Edge
980
+ topologic_core.Edge
938
981
  The reversed edge.
939
982
 
940
983
  """
941
- if not isinstance(edge, topologic.Edge):
984
+ from topologicpy.Topology import Topology
985
+
986
+ if not Topology.IsInstance(edge, "Edge"):
942
987
  print("Edge.Reverse - Error: The input edge parameter is not a valid topologic edge. Returning None.")
943
988
  return None
944
989
  return Edge.ByVertices([edge.EndVertex(), edge.StartVertex()], tolerance=tolerance)
945
990
 
946
991
  @staticmethod
947
- def SetLength(edge: topologic.Edge , length: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001) -> topologic.Edge:
992
+ def SetLength(edge , length: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001):
948
993
  """
949
994
  Returns an edge with the new length in the same direction as the input edge.
950
995
 
951
996
  Parameters
952
997
  ----------
953
- edge : topologic.Edge
998
+ edge : topologic_core.Edge
954
999
  The input edge.
955
1000
  length : float , optional
956
1001
  The desired length of the edge. The default is 1.
@@ -963,11 +1008,13 @@ class Edge(Topology):
963
1008
 
964
1009
  Returns
965
1010
  -------
966
- topologic.Edge
1011
+ topologic_core.Edge
967
1012
  The extended edge.
968
1013
 
969
1014
  """
970
- if not isinstance(edge, topologic.Edge):
1015
+ from topologicpy.Topology import Topology
1016
+
1017
+ if not Topology.IsInstance(edge, "Edge"):
971
1018
  print("Edge.SetLength - Error: The input edge parameter is not a valid topologic edge. Returning None.")
972
1019
  return None
973
1020
  distance = (length - Edge.Length(edge))
@@ -976,22 +1023,24 @@ class Edge(Topology):
976
1023
  return Edge.Trim(edge=edge, distance=distance, bothSides=bothSides, reverse=reverse, tolerance=tolerance)
977
1024
 
978
1025
  @staticmethod
979
- def StartVertex(edge: topologic.Edge) -> topologic.Vertex:
1026
+ def StartVertex(edge):
980
1027
  """
981
1028
  Returns the start vertex of the input edge.
982
1029
 
983
1030
  Parameters
984
1031
  ----------
985
- edge : topologic.Edge
1032
+ edge : topologic_core.Edge
986
1033
  The input edge.
987
1034
 
988
1035
  Returns
989
1036
  -------
990
- topologic.Vertex
1037
+ topologic_core.Vertex
991
1038
  The start vertex of the input edge.
992
1039
 
993
1040
  """
994
- if not isinstance(edge, topologic.Edge):
1041
+ from topologicpy.Topology import Topology
1042
+
1043
+ if not Topology.IsInstance(edge, "Edge"):
995
1044
  print("Edge.StartVertex - Error: The input edge parameter is not a valid topologic edge. Returning None.")
996
1045
  return None
997
1046
  vert = None
@@ -1002,13 +1051,13 @@ class Edge(Topology):
1002
1051
  return vert
1003
1052
 
1004
1053
  @staticmethod
1005
- def Trim(edge: topologic.Edge, distance: float = 0.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001) -> topologic.Edge:
1054
+ def Trim(edge, distance: float = 0.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001):
1006
1055
  """
1007
1056
  Trims the input edge by the input distance.
1008
1057
 
1009
1058
  Parameters
1010
1059
  ----------
1011
- edge : topologic.Edge
1060
+ edge : topologic_core.Edge
1012
1061
  The input edge.
1013
1062
  distance : float , optional
1014
1063
  The offset distance. The default is 0.
@@ -1021,11 +1070,13 @@ class Edge(Topology):
1021
1070
 
1022
1071
  Returns
1023
1072
  -------
1024
- topologic.Edge
1073
+ topologic_core.Edge
1025
1074
  The trimmed edge.
1026
1075
 
1027
1076
  """
1028
- if not isinstance(edge, topologic.Edge):
1077
+ from topologicpy.Topology import Topology
1078
+
1079
+ if not Topology.IsInstance(edge, "Edge"):
1029
1080
  print("Edge.Trim - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1030
1081
  return None
1031
1082
  distance = abs(distance)
@@ -1048,30 +1099,32 @@ class Edge(Topology):
1048
1099
  return Edge.ByVertices([sve, eve], tolerance=tolerance, silent=True)
1049
1100
 
1050
1101
  @staticmethod
1051
- def TrimByEdge2D(edgeA: topologic.Edge, edgeB: topologic.Edge, reverse: bool = False, tolerance: float = 0.0001) -> topologic.Edge:
1102
+ def TrimByEdge2D(edgeA, edgeB, reverse: bool = False, tolerance: float = 0.0001):
1052
1103
  """
1053
1104
  Trims the first input edge by the second input edge. This works only in the XY plane. Z coordinates are ignored.
1054
1105
 
1055
1106
  Parameters
1056
1107
  ----------
1057
- edgeA : topologic.Edge
1108
+ edgeA : topologic_core.Edge
1058
1109
  The first input edge.
1059
- edgeB : topologic.Edge
1110
+ edgeB : topologic_core.Edge
1060
1111
  The second input edge.
1061
1112
  tolerance : float , optional
1062
1113
  The desired tolerance. The default is 0.0001.
1063
1114
 
1064
1115
  Returns
1065
1116
  -------
1066
- topologic.Edge
1117
+ topologic_core.Edge
1067
1118
  The trimmed edge.
1068
1119
 
1069
1120
  """
1121
+ from topologicpy.Vertex import Vertex
1070
1122
  from topologicpy.Topology import Topology
1071
- if not isinstance(edgeA, topologic.Edge):
1123
+
1124
+ if not Topology.IsInstance(edgeA, "Edge"):
1072
1125
  print("Edge.TrimByEdge2D - Error: The input edgeA parameter is not a valid topologic edge. Returning None.")
1073
1126
  return None
1074
- if not isinstance(edgeB, topologic.Edge):
1127
+ if not Topology.IsInstance(edgeB, "Edge"):
1075
1128
  print("Edge.TrimByEdge2D - Error: The input edgeB parameter is not a valid topologic edge. Returning None.")
1076
1129
  return None
1077
1130
  sva = Edge.StartVertex(edgeA)
@@ -1085,34 +1138,37 @@ class Edge(Topology):
1085
1138
  return edgeA
1086
1139
 
1087
1140
  @staticmethod
1088
- def VertexByDistance(edge: topologic.Edge, distance: float = 0.0, origin: topologic.Vertex = None, tolerance: float = 0.0001) -> topologic.Vertex:
1141
+ def VertexByDistance(edge, distance: float = 0.0, origin= None, tolerance: float = 0.0001):
1089
1142
  """
1090
1143
  Creates a vertex along the input edge offset by the input distance from the input origin.
1091
1144
 
1092
1145
  Parameters
1093
1146
  ----------
1094
- edge : topologic.Edge
1147
+ edge : topologic_core.Edge
1095
1148
  The input edge.
1096
1149
  distance : float , optional
1097
1150
  The offset distance. The default is 0.
1098
- origin : topologic.Vertex , optional
1151
+ origin : topologic_core.Vertex , optional
1099
1152
  The origin of the offset distance. If set to None, the origin will be set to the start vertex of the input edge. The default is None.
1100
1153
  tolerance : float , optional
1101
1154
  The desired tolerance. The default is 0.0001.
1102
1155
 
1103
1156
  Returns
1104
1157
  -------
1105
- topologic.Vertex
1158
+ topologic_core.Vertex
1106
1159
  The created vertex.
1107
1160
 
1108
1161
  """
1162
+ from topologicpy.Vertex import Vertex
1163
+ from topologicpy.Vector import Vector
1164
+ from topologicpy.Topology import Topology
1109
1165
 
1110
- if not isinstance(edge, topologic.Edge):
1166
+ if not Topology.IsInstance(edge, "Edge"):
1111
1167
  print("Edge.TrimByEdge2D - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1112
1168
  return None
1113
1169
  if not origin:
1114
1170
  origin = edge.StartVertex()
1115
- if not isinstance(origin, topologic.Vertex):
1171
+ if not Topology.IsInstance(origin, "Vertex"):
1116
1172
  print("Edge.TrimByEdge2D - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1117
1173
  return None
1118
1174
  sv = edge.StartVertex()
@@ -1122,29 +1178,29 @@ class Edge(Topology):
1122
1178
  vz = ev.Z() - sv.Z()
1123
1179
  vector = Vector.Normalize([vx, vy, vz])
1124
1180
  vector = Vector.Multiply(vector, distance, tolerance)
1125
- return topologic.Vertex.ByCoordinates(origin.X()+vector[0], origin.Y()+vector[1], origin.Z()+vector[2])
1181
+ return Vertex.ByCoordinates(origin.X()+vector[0], origin.Y()+vector[1], origin.Z()+vector[2])
1126
1182
 
1127
1183
  @staticmethod
1128
- def VertexByParameter(edge: topologic.Edge, u: float = 0.0) -> topologic.Vertex:
1184
+ def VertexByParameter(edge, u: float = 0.0):
1129
1185
  """
1130
1186
  Creates a vertex along the input edge offset by the input *u* parameter.
1131
1187
 
1132
1188
  Parameters
1133
1189
  ----------
1134
- edge : topologic.Edge
1190
+ edge : topologic_core.Edge
1135
1191
  The input edge.
1136
1192
  u : float , optional
1137
1193
  The *u* parameter along the input topologic Edge. A parameter of 0 returns the start vertex. A parameter of 1 returns the end vertex. The default is 0.
1138
1194
 
1139
1195
  Returns
1140
1196
  -------
1141
- topologic.Vertex
1197
+ topologic_core.Vertex
1142
1198
  The created vertex.
1143
1199
 
1144
1200
  """
1145
1201
  from topologicpy.Topology import Topology
1146
1202
 
1147
- if not isinstance(edge, topologic.Edge):
1203
+ if not Topology.IsInstance(edge, "Edge"):
1148
1204
  print("Edge.VertexByParameter - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1149
1205
  return None
1150
1206
  vertex = None
@@ -1157,21 +1213,16 @@ class Edge(Topology):
1157
1213
  edge_length = Edge.Length(edge)
1158
1214
  dist = edge_length*u
1159
1215
  vertex = Topology.TranslateByDirectionDistance(Edge.StartVertex(edge), direction=dir, distance=dist)
1160
- #try:
1161
- #vertex = topologic.EdgeUtility.PointAtParameter(edge, u)
1162
- #except:
1163
- #print("Edge.VertexByParameter - Error: Could not create a vertex at the input parameter. Returning None.")
1164
- #vertex = None
1165
1216
  return vertex
1166
1217
 
1167
1218
  @staticmethod
1168
- def Vertices(edge: topologic.Edge) -> list:
1219
+ def Vertices(edge) -> list:
1169
1220
  """
1170
1221
  Returns the list of vertices of the input edge.
1171
1222
 
1172
1223
  Parameters
1173
1224
  ----------
1174
- edge : topologic.Edge
1225
+ edge : topologic_core.Edge
1175
1226
  The input edge.
1176
1227
 
1177
1228
  Returns
@@ -1180,9 +1231,11 @@ class Edge(Topology):
1180
1231
  The list of vertices.
1181
1232
 
1182
1233
  """
1183
- if not isinstance(edge, topologic.Edge):
1234
+ from topologicpy.Topology import Topology
1235
+
1236
+ if not Topology.IsInstance(edge, "Edge"):
1184
1237
  print("Edge.Vertices - Error: The input edge parameter is not a valid topologic edge. Returning None.")
1185
1238
  return None
1186
1239
  vertices = []
1187
- _ = edge.Vertices(None, vertices)
1240
+ _ = edge.Vertices(None, vertices) # Hook to Core
1188
1241
  return vertices