topologicpy 0.7.36__py3-none-any.whl → 0.7.38__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/Graph.py CHANGED
@@ -1289,7 +1289,7 @@ class Graph:
1289
1289
  return values
1290
1290
 
1291
1291
  @staticmethod
1292
- def ByAdjacencyMatrixCSVPath(path):
1292
+ def ByAdjacencyMatrixCSVPath(path: str, dictionaries: list = None, silent: bool = False):
1293
1293
  """
1294
1294
  Returns graphs according to the input path. This method assumes the CSV files follow an adjacency matrix schema.
1295
1295
 
@@ -1297,6 +1297,11 @@ class Graph:
1297
1297
  ----------
1298
1298
  path : str
1299
1299
  The file path to the adjacency matrix CSV file.
1300
+ dictionaries : list , optional
1301
+ A list of dictionaries to assign to the vertices of the graph. This list should be in
1302
+ the same order and of the same length as the rows in the adjacency matrix.
1303
+ silent : bool , optional
1304
+ If set to True, no warnings or error messages are displayed. The default is False.
1300
1305
 
1301
1306
  Returns
1302
1307
  -------
@@ -1310,10 +1315,10 @@ class Graph:
1310
1315
 
1311
1316
  # Convert DataFrame to a nested list
1312
1317
  adjacency_matrix = adjacency_matrix_df.values.tolist()
1313
- return Graph.ByAdjacencyMatrix(adjacencyMatrix=adjacency_matrix)
1318
+ return Graph.ByAdjacencyMatrix(adjacencyMatrix=adjacency_matrix, dictionaries=dictionaries, silent=silent)
1314
1319
 
1315
1320
  @staticmethod
1316
- def ByAdjacencyMatrix(adjacencyMatrix, xMin=-0.5, yMin=-0.5, zMin=-0.5, xMax=0.5, yMax=0.5, zMax=0.5):
1321
+ def ByAdjacencyMatrix(adjacencyMatrix, dictionaries = None, xMin=-0.5, yMin=-0.5, zMin=-0.5, xMax=0.5, yMax=0.5, zMax=0.5, silent=False):
1317
1322
  """
1318
1323
  Returns graphs according to the input folder path. This method assumes the CSV files follow DGL's schema.
1319
1324
 
@@ -1321,18 +1326,23 @@ class Graph:
1321
1326
  ----------
1322
1327
  adjacencyMatrix : list
1323
1328
  The adjacency matrix expressed as a nested list of 0s and 1s.
1324
- xMin : float, optional
1329
+ dictionaries : list , optional
1330
+ A list of dictionaries to assign to the vertices of the graph. This list should be in
1331
+ the same order and of the same length as the rows in the adjacency matrix.
1332
+ xMin : float , optional
1325
1333
  The desired minimum value to assign for a vertex's X coordinate. The default is -0.5.
1326
- yMin : float, optional
1334
+ yMin : float , optional
1327
1335
  The desired minimum value to assign for a vertex's Y coordinate. The default is -0.5.
1328
- zMin : float, optional
1336
+ zMin : float , optional
1329
1337
  The desired minimum value to assign for a vertex's Z coordinate. The default is -0.5.
1330
- xMax : float, optional
1338
+ xMax : float , optional
1331
1339
  The desired maximum value to assign for a vertex's X coordinate. The default is 0.5.
1332
- yMax : float, optional
1340
+ yMax : float , optional
1333
1341
  The desired maximum value to assign for a vertex's Y coordinate. The default is 0.5.
1334
- zMax : float, optional
1342
+ zMax : float , optional
1335
1343
  The desired maximum value to assign for a vertex's Z coordinate. The default is 0.5.
1344
+ silent : bool , optional
1345
+ If set to True, no warnings or error messages are displayed. The default is False.
1336
1346
 
1337
1347
  Returns
1338
1348
  -------
@@ -1342,16 +1352,25 @@ class Graph:
1342
1352
  """
1343
1353
  from topologicpy.Vertex import Vertex
1344
1354
  from topologicpy.Edge import Edge
1355
+ from topologicpy.Topology import Topology
1345
1356
  import random
1346
1357
 
1347
1358
  if not isinstance(adjacencyMatrix, list):
1348
1359
  print("Graph.ByAdjacencyMatrix - Error: The input adjacencyMatrix parameter is not a valid list. Returning None.")
1349
1360
  return None
1361
+ if isinstance(dictionaries, list):
1362
+ if not len(dictionaries) == len(adjacencyMatrix):
1363
+ if not silent:
1364
+ print("Graph.ByAdjacencyMatrix - Error: The length of the dictionaries list and the adjacency matrix are different. Returning None.")
1365
+ return None
1366
+
1350
1367
  # Add vertices with random coordinates
1351
1368
  vertices = []
1352
1369
  for i in range(len(adjacencyMatrix)):
1353
1370
  x, y, z = random.uniform(xMin,xMax), random.uniform(yMin,yMax), random.uniform(zMin,zMax)
1354
- vertices.append(Vertex.ByCoordinates(x, y, z))
1371
+ v = Vertex.ByCoordinates(x, y, z)
1372
+ v = Topology.SetDictionary(v, dictionaries[i])
1373
+ vertices.append(v)
1355
1374
 
1356
1375
  # Create the graph using vertices and edges
1357
1376
  if len(vertices) == 0:
topologicpy/Sun.py CHANGED
@@ -132,7 +132,6 @@ class Sun():
132
132
  -------
133
133
  datetime
134
134
  The datetime of the summer solstice
135
-
136
135
  """
137
136
  import os
138
137
  import warnings
@@ -173,7 +172,6 @@ class Sun():
173
172
  -------
174
173
  datetime
175
174
  The datetime of the summer solstice
176
-
177
175
  """
178
176
  import os
179
177
  import warnings
@@ -216,7 +214,6 @@ class Sun():
216
214
  -------
217
215
  float
218
216
  The azimuth angle.
219
-
220
217
  """
221
218
  import os
222
219
  import warnings
@@ -263,7 +260,6 @@ class Sun():
263
260
  -------
264
261
  float
265
262
  The altitude angle.
266
-
267
263
  """
268
264
  import os
269
265
  import warnings
@@ -310,8 +306,8 @@ class Sun():
310
306
  -------
311
307
  datetime
312
308
  The Sunrise datetime.
313
-
314
309
  """
310
+
315
311
  import os
316
312
  import warnings
317
313
  try:
@@ -355,8 +351,8 @@ class Sun():
355
351
  -------
356
352
  datetime
357
353
  The Sunset datetime.
358
-
359
354
  """
355
+
360
356
  import os
361
357
  import warnings
362
358
  try:
@@ -383,7 +379,7 @@ class Sun():
383
379
  return sunset
384
380
 
385
381
  @staticmethod
386
- def Vector(latitude: float, longitude: float, date, north: float = 0, mantissa: int = 6, tolerance: float = 0.0001):
382
+ def Vector(latitude, longitude, date, north=0):
387
383
  """
388
384
  Returns the Sun as a vector.
389
385
 
@@ -402,12 +398,11 @@ class Sun():
402
398
  -------
403
399
  list
404
400
  The sun vector pointing from the location of the sun towards the origin.
405
-
406
401
  """
407
402
  from topologicpy.Vector import Vector
408
403
  azimuth = Sun.Azimuth(latitude=latitude, longitude=longitude, date=date)
409
404
  altitude = Sun.Altitude(latitude=latitude, longitude=longitude, date=date)
410
- return Vector.ByAzimuthAltitude(azimuth=azimuth, altitude=altitude, north=north, reverse=True, mantissa=mantissa, tolerance=tolerance)
405
+ return Vector.ByAzimuthAltitude(azimuth=azimuth, altitude=altitude, north=north, reverse=True)
411
406
 
412
407
  @staticmethod
413
408
  def Position(latitude, longitude, date, origin=None, radius=0.5, north=0, mantissa=6):
@@ -422,7 +417,7 @@ class Sun():
422
417
  The input longitude. See https://en.wikipedia.org/wiki/Longitude.
423
418
  date : datetime
424
419
  The input datetime.
425
- origin : topologic_core.Vertex , optional
420
+ origin : topologic.Vertex , optional
426
421
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
427
422
  radius : float , optional
428
423
  The desired radius of the sun orbit. The default is 0.5.
@@ -431,14 +426,13 @@ class Sun():
431
426
  mantissa : int , optional
432
427
  The desired length of the mantissa. The default is 6.
433
428
 
429
+
434
430
  Returns
435
431
  -------
436
- topologic_core.Vertex
432
+ topologic.Vertex
437
433
  The sun represented as a vertex.
438
-
439
434
  """
440
435
  from topologicpy.Vertex import Vertex
441
-
442
436
  sun_v = Sun.Vertex(latitude=latitude, longitude=longitude, date=date, origin=origin, radius=radius, north=north)
443
437
  return Vertex.Coordinates(sun_v, mantissa=mantissa)
444
438
 
@@ -455,7 +449,7 @@ class Sun():
455
449
  The input longitude. See https://en.wikipedia.org/wiki/Longitude.
456
450
  date : datetime
457
451
  The input datetime.
458
- origin : topologic_core.Vertex , optional
452
+ origin : topologic.Vertex , optional
459
453
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
460
454
  radius : float , optional
461
455
  The desired radius of the sun orbit. The default is 0.5.
@@ -464,14 +458,14 @@ class Sun():
464
458
 
465
459
  Returns
466
460
  -------
467
- topologic_core.Vertex
461
+ topologic.Vertex
468
462
  The sun represented as a vertex.
469
463
  """
470
464
  from topologicpy.Vertex import Vertex
471
465
  from topologicpy.Topology import Topology
472
466
  from topologicpy.Vector import Vector
473
467
 
474
- if not Topology.IsInstance(origin, "Vertex"):
468
+ if origin == None:
475
469
  origin = Vertex.Origin()
476
470
  vector = Vector.Reverse(Sun.Vector(latitude=latitude, longitude=longitude, date=date, north=north))
477
471
  sun_v = Topology.TranslateByDirectionDistance(origin, direction=vector, distance=radius)
@@ -490,7 +484,7 @@ class Sun():
490
484
  The input longitude. See https://en.wikipedia.org/wiki/Longitude.
491
485
  date : datetime
492
486
  The input datetime.
493
- origin : topologic_core.Vertex , optional
487
+ origin : topologic.Vertex , optional
494
488
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
495
489
  radius : float , optional
496
490
  The desired radius of the sun orbit. The default is 0.5.
@@ -499,7 +493,7 @@ class Sun():
499
493
 
500
494
  Returns
501
495
  -------
502
- topologic_core.Edge
496
+ topologic.Edge
503
497
  The sun represented as an edge pointing from the location of the sun towards the origin.
504
498
  """
505
499
  from topologicpy.Vertex import Vertex
@@ -507,7 +501,7 @@ class Sun():
507
501
  from topologicpy.Topology import Topology
508
502
  from topologicpy.Vector import Vector
509
503
 
510
- if not Topology.IsInstance(origin, "Vertex"):
504
+ if origin == None:
511
505
  origin = Vertex.Origin()
512
506
  vector = Vector.Reverse(Sun.Vector(latitude=latitude, longitude=longitude, date=date, north=north))
513
507
  sun_v = Topology.TranslateByDirectionDistance(origin, direction=vector, distance=radius)
@@ -533,7 +527,7 @@ class Sun():
533
527
  The desired end time to compute the sun location. If set to None, Sun.Sunset is used. The default is None.
534
528
  interval : int , optional
535
529
  The interval in minutes to compute the sun location. The default is 60.
536
- origin : topologic_core.Vertex , optional
530
+ origin : topologic.Vertex , optional
537
531
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
538
532
  radius : float , optional
539
533
  The desired radius of the sun orbit. The default is 0.5.
@@ -577,7 +571,7 @@ class Sun():
577
571
  The desired end time to compute the sun location. If set to None, Sun.Sunset is used. The default is None.
578
572
  interval : int , optional
579
573
  The interval in minutes to compute the sun location. The default is 60.
580
- origin : topologic_core.Vertex , optional
574
+ origin : topologic.Vertex , optional
581
575
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
582
576
  radius : float , optional
583
577
  The desired radius of the sun orbit. The default is 0.5.
@@ -589,16 +583,14 @@ class Sun():
589
583
 
590
584
  Returns
591
585
  -------
592
- topologic_core.Wire
586
+ topologic.Wire
593
587
  The sun path represented as a wire.
594
-
595
588
  """
596
589
  from topologicpy.Vertex import Vertex
597
590
  from topologicpy.Wire import Wire
598
- from topologicpy.Dictionary import Dictionary
599
591
  from topologicpy.Topology import Topology
600
-
601
- if not Topology.IsInstance(origin, "Vertex"):
592
+ from topologicpy.Dictionary import Dictionary
593
+ if origin == None:
602
594
  origin = Vertex.Origin()
603
595
  if startTime == None:
604
596
  startTime = Sun.Sunrise(latitude=latitude, longitude=longitude, date=date)
@@ -641,7 +633,7 @@ class Sun():
641
633
  The desired end day to compute the sun location. The default is 365.
642
634
  interval : int , optional
643
635
  The interval in days to compute the sun location. The default is 5.
644
- origin : topologic_core.Vertex , optional
636
+ origin : topologic.Vertex , optional
645
637
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
646
638
  radius : float , optional
647
639
  The desired radius of the sun orbit. The default is 0.5.
@@ -652,11 +644,9 @@ class Sun():
652
644
  -------
653
645
  list
654
646
  The sun locations represented as a list of vertices.
655
-
656
647
  """
657
648
  from datetime import datetime
658
649
  from datetime import timedelta
659
-
660
650
  def day_of_year_to_datetime(year, day_of_year):
661
651
  # Construct a datetime object for the first day of the year
662
652
  base_date = datetime(year, 1, 1)
@@ -694,7 +684,7 @@ class Sun():
694
684
  The desired end day of the year to compute the sun location. The default is 365.
695
685
  interval : int , optional
696
686
  The interval in days to compute the sun location. The default is 5.
697
- origin : topologic_core.Vertex , optional
687
+ origin : topologic.Vertex , optional
698
688
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
699
689
  radius : float , optional
700
690
  The desired radius of the sun orbit. The default is 0.5.
@@ -706,13 +696,13 @@ class Sun():
706
696
 
707
697
  Returns
708
698
  -------
709
- topologic_core.Wire
699
+ topologic.Wire
710
700
  The sun path represented as a topologic wire.
711
-
712
701
  """
702
+
713
703
  from topologicpy.Wire import Wire
714
- from topologicpy.Dictionary import Dictionary
715
704
  from topologicpy.Topology import Topology
705
+ from topologicpy.Dictionary import Dictionary
716
706
 
717
707
  vertices = Sun.VerticesByHour(latitude=latitude, longitude=longitude, hour=hour,
718
708
  startDay=startDay, endDay=endDay, interval=interval,
@@ -749,7 +739,7 @@ class Sun():
749
739
  The interval in minutes to compute the sun location for the date path. The default is 30.
750
740
  dayInterval : int , optional
751
741
  The interval in days for the hourly path to compute the sun location. The default is 15.
752
- origin : topologic_core.Vertex , optional
742
+ origin : topologic.Vertex , optional
753
743
  The desired origin of the world. If set to None, the origin will be set to (0,0,0). The default is None.
754
744
  radius : float , optional
755
745
  The desired radius of the sun orbit. The default is 0.5.
@@ -776,8 +766,8 @@ class Sun():
776
766
  - 'center' : This is a cross-shape (wire) at the center of the diagram. This is included only if the compass option is set to True.
777
767
  - 'ground' : This is a circle (face) on the ground. It is made of 36 sides. This is included only if
778
768
  the compass option is set to False.
779
-
780
769
  """
770
+
781
771
  from datetime import datetime
782
772
  from datetime import timedelta
783
773
  from topologicpy.Vertex import Vertex
@@ -789,7 +779,7 @@ class Sun():
789
779
  from topologicpy.Topology import Topology
790
780
  from topologicpy.Dictionary import Dictionary
791
781
 
792
- if not Topology.IsInstance(origin, "Vertex"):
782
+ if origin == None:
793
783
  origin = Vertex.Origin()
794
784
 
795
785
  cutter = Cell.Prism(origin=origin, width=radius*4, length=radius*4, height=radius*2)
topologicpy/Topology.py CHANGED
@@ -1893,7 +1893,7 @@ class Topology():
1893
1893
  return Topology.ByBREPFile(file)
1894
1894
 
1895
1895
  @staticmethod
1896
- def ByDXFFile(file):
1896
+ def ByDXFFile(file, sides: int = 16):
1897
1897
  """
1898
1898
  Imports a list of topologies from a DXF file.
1899
1899
  This is an experimental method with limited capabilities.
@@ -1902,6 +1902,8 @@ class Topology():
1902
1902
  ----------
1903
1903
  file : a DXF file object
1904
1904
  The DXF file object.
1905
+ sides : int , optional
1906
+ The desired number of sides of splines. The default is 16.
1905
1907
 
1906
1908
  Returns
1907
1909
  -------
@@ -1916,6 +1918,8 @@ class Topology():
1916
1918
  from topologicpy.Cell import Cell
1917
1919
  from topologicpy.CellComplex import CellComplex
1918
1920
  from topologicpy.Topology import Topology
1921
+ from topologicpy.Dictionary import Dictionary
1922
+
1919
1923
 
1920
1924
  try:
1921
1925
  import ezdxf
@@ -1936,34 +1940,123 @@ class Topology():
1936
1940
  print("Topology.ByDXFFile - Error: the input file parameter is not a valid file. Returning None.")
1937
1941
  return None
1938
1942
 
1939
- def convert_entity(entity):
1940
- entity_type = entity.dxftype()
1941
- converted_entity = None
1943
+ import ezdxf
1942
1944
 
1943
- if entity_type == 'POINT':
1944
- x, y, z = entity.dxf.location.x, entity.dxf.location.y, entity.dxf.location.z
1945
- converted_entity = Vertex.ByCoordinates(x, y, z)
1946
1945
 
1947
- elif entity_type == 'LINE':
1948
- start = Vertex.ByCoordinates(entity.dxf.start.x, entity.dxf.start.y, entity.dxf.start.z)
1949
- end = Vertex.ByCoordinates(entity.dxf.end.x, entity.dxf.end.y, entity.dxf.end.z)
1950
- converted_entity = Edge.ByVertices(start, end)
1951
1946
 
1947
+ def get_layer_color(layers, layer_name):
1948
+ # iteration
1949
+ for layer in layers:
1950
+ if layer_name == layer.dxf.name:
1951
+ r,g,b = layer.rgb
1952
+ return [r,g,b]
1953
+ return
1954
+
1955
+ def convert_entity(entity, file, sides=36):
1956
+ entity_type = entity.dxftype()
1957
+ python_dict = entity.dxf.all_existing_dxf_attribs()
1958
+ keys = python_dict.keys()
1959
+ for key in keys:
1960
+ if python_dict[key].__class__ == ezdxf.acc.vector.Vec3:
1961
+ python_dict[key] = list(python_dict[key])
1962
+ try:
1963
+ r,g,b = entity.rgb
1964
+ except:
1965
+ rgb_list = get_layer_color(file.layers, entity.dxf.layer)
1966
+ if rgb_list == None:
1967
+ rgb_list = [0,0,0]
1968
+ python_dict['color'] = rgb_list
1969
+ python_dict['type'] = entity_type
1970
+ d = Dictionary.ByPythonDictionary(python_dict)
1971
+
1972
+ if entity_type == 'POINT':
1973
+ point = entity.dxf.location.xyz
1974
+ e = Vertex.ByCoordinates(point[0], point[1], point[2])
1975
+ e = Topology.SetDictionary(e, d)
1976
+
1977
+ elif entity_type == 'LINE':
1978
+ sp = entity.dxf.start.xyz
1979
+ ep = entity.dxf.end.xyz
1980
+ sv = Vertex.ByCoordinates(sp[0], sp[1], sp[2])
1981
+ ev = Vertex.ByCoordinates(ep[0], ep[1], ep[2])
1982
+ e = Edge.ByVertices(sv,ev)
1983
+ e = Topology.SetDictionary(e, d)
1984
+
1985
+ elif entity_type == 'POLYLINE':
1986
+ if entity.dxf.flags == 1:
1987
+ closed = True
1988
+ else:
1989
+ closed = False
1990
+ vertices = []
1991
+ for vertex in entity.vertices:
1992
+ point = vertex.dxf.location.xyz
1993
+ vertices.append(Vertex.ByCoordinates(point[0], point[1], point[2]))
1994
+ if entity.dxf.hasattr("closed"):
1995
+ closed = entity.closed
1996
+ e = Wire.ByVertices(vertices, close=closed)
1997
+ e = Topology.SetDictionary(e, d)
1998
+
1999
+ elif entity_type == 'LWPOLYLINE':
2000
+ vertices = []
2001
+ for point in entity.get_points():
2002
+ vertices.append(Vertex.ByCoordinates(point[0], point[1], 0))
2003
+ if entity.dxf.hasattr("closed"):
2004
+ close = entity.closed
2005
+ else:
2006
+ close = False
2007
+ e = Wire.ByVertices(vertices, close=close)
2008
+ e = Topology.SetDictionary(e, d)
2009
+
1952
2010
  elif entity_type == 'CIRCLE':
1953
- origin = Vertex.ByCoordinates(entity.dxf.center.x, entity.dxf.center.y, entity.dxf.center.z)
2011
+ center = entity.dxf.center.xyz
1954
2012
  radius = entity.dxf.radius
1955
- converted_entity = Wire.Circle(origin, radius)
1956
-
1957
- elif entity_type in ['POLYLINE', 'LWPOLYLINE']:
1958
- with entity.points('xyz') as points:
1959
- vertices = [Vertex.ByCoordinates(*_) for _ in points]
1960
- converted_entity = Wire.ByVertices(vertices)
1961
-
2013
+ num_points = 36 # Approximate the circle with 36 points
2014
+ vertices = []
2015
+ for i in range(sides):
2016
+ angle = 2 * np.pi * i / num_points
2017
+ x = center[0] + radius * np.cos(angle)
2018
+ y = center[1] + radius * np.sin(angle)
2019
+ z = center[2]
2020
+ vertices.append(Vertex.ByCoordinates(x,y,z))
2021
+ e = Wire.ByVertices(vertices, close=True)
2022
+ e = Topology.SetDictionary(e, d)
2023
+
1962
2024
  elif entity_type == 'ARC':
1963
- with entity.points('xyz') as points:
1964
- vertices = [Vertex.ByCoordinates(*_) for _ in points]
1965
- converted_entity = Wire.ByVertices(vertices)
2025
+ center = entity.dxf.center.xyz
2026
+ radius = entity.dxf.radius
2027
+ start_angle = np.deg2rad(entity.dxf.start_angle)
2028
+ end_angle = np.deg2rad(entity.dxf.end_angle)
2029
+ vertices = []
2030
+ for i in range(sides+1):
2031
+ angle = start_angle + (end_angle - start_angle) * i / (num_points - 1)
2032
+ x = center[0] + radius * np.cos(angle)
2033
+ y = center[1] + radius * np.sin(angle)
2034
+ z = center[2]
2035
+ vertices.append(Vertex.ByCoordinates(x,y,z))
2036
+ e = Wire.ByVertices(vertices, close=False)
2037
+ e = Topology.SetDictionary(e, d)
2038
+
2039
+ elif entity_type == 'SPLINE':
2040
+ # draw the curve tangents as red lines:
2041
+ ct = entity.construction_tool()
2042
+ vertices = []
2043
+ for t in np.linspace(0, ct.max_t, 64):
2044
+ point, derivative = ct.derivative(t, 1)
2045
+ vertices.append(Vertex.ByCoordinates(list(point)))
2046
+ converted_entity = Wire.ByVertices(vertices, close=entity.closed)
2047
+ vertices = []
2048
+ for i in range(sides+1):
2049
+ if i == 0:
2050
+ u = 0
2051
+ elif i == sides:
2052
+ u = 1
2053
+ else:
2054
+ u = float(i)/float(sides)
2055
+ vertices.append(Wire.VertexByParameter(converted_entity, u))
1966
2056
 
2057
+ e = Wire.ByVertices(vertices, close=entity.closed)
2058
+ e = Topology.SetDictionary(e, d)
2059
+
1967
2060
  elif entity_type == 'MESH':
1968
2061
  vertices = [list(v) for v in entity.vertices]
1969
2062
  faces = [list(face) for face in entity.faces]
@@ -1976,16 +2069,17 @@ class Topology():
1976
2069
  temp = Shell.ByFaces(Topology.Faces(converted_entity))
1977
2070
  if not Topology.IsInstance(temp, "Shell"):
1978
2071
  temp = converted_entity
1979
- converted_entity = temp
1980
- return converted_entity
2072
+ e = temp
2073
+ e = Topology.SetDictionary(e, d)
2074
+ return e
1981
2075
 
1982
- def convert_insert(entity, file):
2076
+ def convert_insert(entity, file, sides=16):
1983
2077
  block_name = entity.dxf.name
1984
2078
  block = file.blocks.get(block_name)
1985
2079
  converted_entities = []
1986
2080
 
1987
2081
  for block_entity in block:
1988
- converted_entity = convert_entity(block_entity)
2082
+ converted_entity = convert_entity(block_entity, sides=sides)
1989
2083
  if converted_entity is not None:
1990
2084
  converted_entities.append(converted_entity)
1991
2085
 
@@ -2006,9 +2100,9 @@ class Topology():
2006
2100
  continue # Ignore TEXT and MTEXT
2007
2101
 
2008
2102
  if entity_type == 'INSERT':
2009
- converted_entities.extend(convert_insert(entity, file))
2103
+ converted_entities.extend(convert_insert(entity, file, sides=sides))
2010
2104
  else:
2011
- converted_entity = convert_entity(entity)
2105
+ converted_entity = convert_entity(entity, file, sides=sides)
2012
2106
  if converted_entity is not None:
2013
2107
  converted_entities.append(converted_entity)
2014
2108
 
@@ -2017,7 +2111,7 @@ class Topology():
2017
2111
  return converted_entities
2018
2112
 
2019
2113
  @staticmethod
2020
- def ByDXFPath(path):
2114
+ def ByDXFPath(path, sides: int = 16):
2021
2115
  """
2022
2116
  Imports a list of topologies from a DXF file path.
2023
2117
  This is an experimental method with limited capabilities.
@@ -2026,6 +2120,8 @@ class Topology():
2026
2120
  ----------
2027
2121
  path : str
2028
2122
  The path to the DXF file.
2123
+ sides : int , optional
2124
+ The desired number of sides of splines. The default is 16.
2029
2125
 
2030
2126
  Returns
2031
2127
  -------
@@ -2057,7 +2153,7 @@ class Topology():
2057
2153
  if not file:
2058
2154
  print("Topology.ByDXFPath - Error: the input file parameter is not a valid file. Returning None.")
2059
2155
  return None
2060
- return Topology.ByDXFFile(file)
2156
+ return Topology.ByDXFFile(file, sides=sides)
2061
2157
 
2062
2158
  @staticmethod
2063
2159
  def ByIFCFile(file, transferDictionaries=False, includeTypes=[], excludeTypes=[]):
@@ -6989,6 +7085,8 @@ class Topology():
6989
7085
  if isinstance(colorKey, str):
6990
7086
  f_color = Dictionary.ValueAtKey(d, colorKey)
6991
7087
  if f_color:
7088
+ vertexColor = Color.PlotlyColor(f_color, alpha=1.0, useAlpha=False)
7089
+ edgeColor = Color.PlotlyColor(f_color, alpha=1.0, useAlpha=False)
6992
7090
  faceColor = Color.PlotlyColor(f_color, alpha=1.0, useAlpha=False)
6993
7091
  faceOpacity = Dictionary.ValueAtKey(d, opacityKey) or faceOpacity
6994
7092
  data += Plotly.DataByTopology(topology=topology,
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.36'
1
+ __version__ = '0.7.38'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.36
3
+ Version: 0.7.38
4
4
  Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  License: MIT License
@@ -10,7 +10,7 @@ topologicpy/Dictionary.py,sha256=KqJ29YyE23Y3Xc6XmKLSCZXRfBvm-OEOxlMZ4dt-rfM,270
10
10
  topologicpy/Edge.py,sha256=vhYHkobSLGSWV-oe2oJFFDobqFToDyb7s71yQ840AAA,65166
11
11
  topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
12
12
  topologicpy/Face.py,sha256=SrP7LbOK9wjArYTO2fDVrtxItGXNkCMqmMRNz4-46gA,115473
13
- topologicpy/Graph.py,sha256=ICwFUYLka6tEPMo43I9QAe24ljItMUZOZYL21xpDPIg,392146
13
+ topologicpy/Graph.py,sha256=PnOjkQ6Zp2ykrY3rS21HhPN7R0YNW-7euz1m-wU0YiU,393433
14
14
  topologicpy/Grid.py,sha256=Q-2WNBkvIsJks7pbGkzzkRWVB4fTMYgWipG3lcDXbpE,18496
15
15
  topologicpy/Helper.py,sha256=mLwJmhyc-d-JqW82MBf7JwM91zWHVx8RzOmndPWHm-k,17717
16
16
  topologicpy/Honeybee.py,sha256=vcBECJlgWVjNNdD9ZmjNik_pA1Y_ZNoOorsQb2CiyGA,21965
@@ -20,15 +20,15 @@ topologicpy/Plotly.py,sha256=qMhBMAYoNMsc-cKdNpqM2p9rqAVXWvBNTzmTKw7iU_0,98963
20
20
  topologicpy/Polyskel.py,sha256=4R5_DEdfrmi-4gR6axHNoHTCSAE2TCekOyN8jvb7bHQ,19722
21
21
  topologicpy/Shell.py,sha256=bJ8zu5gj-TSOADR-p3YQ9yLPHFTffnv-29uD5b6Zvuc,79912
22
22
  topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
23
- topologicpy/Sun.py,sha256=_gZfVyH0SDLQmmt775UeeAJ_BtwXO1STQnUMV1qkU0s,37161
24
- topologicpy/Topology.py,sha256=iL2kCRHtFTMBqFbvdJy_-E0NtLChsD7606x_F1UrKFE,362074
23
+ topologicpy/Sun.py,sha256=InnKtX8eKwtAgcScuABH6yp0ljmWh5m_fDR4-n3jJMY,36869
24
+ topologicpy/Topology.py,sha256=Sfw0C5Sd1m3ndLyM_zrCLzegfMd6ytnaK82J_ToK5lQ,366264
25
25
  topologicpy/Vector.py,sha256=WQQUbwrg7VKImtxuBUi2i-FRiPT77WlrzLP05gdXKM8,33079
26
26
  topologicpy/Vertex.py,sha256=EQdVYHmW85_pZdHZB3N8pEi0GiadCCkF3z_oqohA7B0,71161
27
27
  topologicpy/Wire.py,sha256=Ls2ItdNQ_qbC1RUc8bAtGbM5B5A-uShjHdiOFVVwx-8,153711
28
28
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
29
- topologicpy/version.py,sha256=h99CjXFyBnlX7m8jRVJPMpJ90azTXpjOurMUUqAElKY,23
30
- topologicpy-0.7.36.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
31
- topologicpy-0.7.36.dist-info/METADATA,sha256=3wd8EHITpe7rztfsjLyGZTUDqeahTQrEAzXcf_ndvWo,10916
32
- topologicpy-0.7.36.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
33
- topologicpy-0.7.36.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
34
- topologicpy-0.7.36.dist-info/RECORD,,
29
+ topologicpy/version.py,sha256=UnhU_ln7vUcinj8Cem2quVLc3nZ_d5hPc8CCYOzG0A8,23
30
+ topologicpy-0.7.38.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
31
+ topologicpy-0.7.38.dist-info/METADATA,sha256=yquirb6uoTD1IEJsn62E6VtN1bR3zAVPv_KeA5LGK_o,10916
32
+ topologicpy-0.7.38.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
33
+ topologicpy-0.7.38.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
34
+ topologicpy-0.7.38.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (71.1.0)
2
+ Generator: setuptools (72.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5