topologicpy 0.7.84__py3-none-any.whl → 0.7.86__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/Grid.py CHANGED
@@ -86,7 +86,7 @@ class Grid():
86
86
  uRange.sort()
87
87
  uuVector = Vector.Normalize(uVector)
88
88
  for u in uRange:
89
- tempVec = Vector.Multiply(uuVector, u, tolerance)
89
+ tempVec = Vector.Multiply(uuVector, u, tolerance=tolerance)
90
90
  v1 = Vertex.ByCoordinates(Vertex.X(uOrigin, mantissa=mantissa)+tempVec[0], Vertex.Y(uOrigin, mantissa=mantissa)+tempVec[1], Vertex.Z(uOrigin, mantissa=mantissa)+tempVec[2])
91
91
  v2 = Vertex.ByCoordinates(Vertex.X(v1, mantissa=mantissa)+vVector[0], Vertex.Y(v1, mantissa=mantissa)+vVector[1], Vertex.Z(v1, mantissa=mantissa)+vVector[2])
92
92
  e = Edge.ByVertices([v1, v2], tolerance=tolerance)
@@ -107,7 +107,7 @@ class Grid():
107
107
  vRange.sort()
108
108
  uvVector = Vector.Normalize(vVector)
109
109
  for v in vRange:
110
- tempVec = Vector.Multiply(uvVector, v, tolerance)
110
+ tempVec = Vector.Multiply(uvVector, v, tolerance=tolerance)
111
111
  v1 = Vertex.ByCoordinates(Vertex.X(vOrigin, mantissa=mantissa)+tempVec[0], Vertex.Y(vOrigin, mantissa=mantissa)+tempVec[1], Vertex.Z(vOrigin, mantissa=mantissa)+tempVec[2])
112
112
  v2 = Vertex.ByCoordinates(Vertex.X(v1, mantissa=mantissa)+uVector[0], Vertex.Y(v1, mantissa=mantissa)+uVector[1], Vertex.Z(v1, mantissa=mantissa)+uVector[2])
113
113
  e = Edge.ByVertices([v1, v2], tolerance=tolerance)
@@ -282,8 +282,8 @@ class Grid():
282
282
  uvVector = Vector.Normalize(vVector)
283
283
  for u in uRange:
284
284
  for v in vRange:
285
- uTempVec = Vector.Multiply(uuVector, u, tolerance)
286
- vTempVec = Vector.Multiply(uvVector, v, tolerance)
285
+ uTempVec = Vector.Multiply(uuVector, u, tolerance=tolerance)
286
+ vTempVec = Vector.Multiply(uvVector, v, tolerance=tolerance)
287
287
  gridVertex = Vertex.ByCoordinates(Vertex.X(origin, mantissa=mantissa)+uTempVec[0], Vertex.Y(origin, mantissa=mantissa)+vTempVec[1], Vertex.Z(origin, mantissa=mantissa)+uTempVec[2])
288
288
  if clip and Topology.IsInstance(face, "Face"):
289
289
  gridVertex = gridVertex.Intersect(face, False)
topologicpy/Helper.py CHANGED
@@ -580,4 +580,45 @@ class Helper:
580
580
  The current version of the software.
581
581
 
582
582
  """
583
- return topologicpy.__version__
583
+
584
+ import requests
585
+ from packaging import version
586
+
587
+ def compare_version_with_pypi(library_name, input_version):
588
+ """
589
+ Compare an input version with the latest version of a Python library on PyPI.
590
+
591
+ Args:
592
+ library_name (str): The name of the Python library on PyPI.
593
+ input_version (str): The version number to compare (e.g., "0.7.58").
594
+
595
+ Returns:
596
+ str: A message indicating whether the input version is less than,
597
+ equal to, or greater than the latest version on PyPI.
598
+ """
599
+ try:
600
+ # Fetch library data from PyPI
601
+ url = f"https://pypi.org/pypi/{library_name}/json"
602
+ response = requests.get(url)
603
+ response.raise_for_status()
604
+
605
+ # Extract the latest version from the JSON response
606
+ data = response.json()
607
+ latest_version = data['info']['version']
608
+
609
+ # Compare versions using the packaging library
610
+ if version.parse(input_version) < version.parse(latest_version):
611
+ return (f"The version that you are using ({input_version}) is OLDER than the latest version {latest_version} from PyPI. Please consider upgrading to the latest version.")
612
+ elif version.parse(input_version) == version.parse(latest_version):
613
+ return (f"The version that you are using ({input_version}) is the latest version available on PyPI.")
614
+ else:
615
+ return (f"The version that you are using ({input_version}) is NEWER than the latest version ({latest_version}) available from PyPI.")
616
+
617
+ except requests.exceptions.RequestException as e:
618
+ return f"Error fetching data from PyPI: {e}"
619
+ except KeyError:
620
+ return "Error: Unable to find the latest version in the PyPI response."
621
+
622
+ current_version = topologicpy.__version__
623
+ result = compare_version_with_pypi("topologicpy", current_version)
624
+ return result
topologicpy/Plotly.py CHANGED
@@ -279,7 +279,7 @@ class Plotly:
279
279
  angle: float = 0,
280
280
  vertexColor: str = "black",
281
281
  vertexColorKey: str = None,
282
- vertexSize: float = 6,
282
+ vertexSize: float = 10,
283
283
  vertexSizeKey: str = None,
284
284
  vertexLabelKey: str = None,
285
285
  vertexGroupKey: str = None,
@@ -292,7 +292,7 @@ class Plotly:
292
292
  vertexLegendLabel="Graph Vertices",
293
293
  vertexLegendRank=4,
294
294
  vertexLegendGroup=4,
295
- edgeColor: str = "black",
295
+ edgeColor: str = "red",
296
296
  edgeColorKey: str = None,
297
297
  edgeWidth: float = 1,
298
298
  edgeWidthKey: str = None,
@@ -498,8 +498,6 @@ class Plotly:
498
498
  x.append(v[0])
499
499
  y.append(v[1])
500
500
  z.append(v[2])
501
- label = " "
502
- group = None
503
501
  colors.append(Color.AnyToHex(color))
504
502
  labels.append("Vertex_"+str(m+1).zfill(n))
505
503
  sizes.append(size)
@@ -507,36 +505,37 @@ class Plotly:
507
505
  d = dictionaries[m]
508
506
  if d:
509
507
  if not colorKey == None:
510
- colors[m] = Dictionary.ValueAtKey(d, key=colorKey) or colors[m]
508
+ temp_color = Dictionary.ValueAtKey(d, key=colorKey)
509
+ if not temp_color == None:
510
+ colors[m] = Color.AnyToHex(temp_color)
511
511
  if not labelKey == None:
512
512
  labels[m] = str(Dictionary.ValueAtKey(d, key=labelKey)) or labels[m]
513
513
  if not sizeKey == None:
514
514
  sizes[m] = Dictionary.ValueAtKey(d, key=sizeKey) or sizes[m]
515
515
  if not groupKey == None:
516
- colors[m] = Dictionary.ValueAtKey(d, key=groupKey) or colors[m]
517
- try:
518
- if type(colors[m]) == int or type(colors[m]) == float:
519
- if colors[m] < minGroup:
520
- colors[m] = minGroup
521
- if colors[m] > maxGroup:
522
- colors[m] = maxGroup
523
- temp_color = Color.ByValueInRange(colors[m], minValue=minGroup, maxValue=maxGroup, colorScale=colorScale)
524
- colors[m] = Color.AnyToHEX(temp_color)
525
-
526
- else:
527
- temp_color = Color.ByValueInRange(groups.index(colors[m]), minValue=minGroup, maxValue=maxGroup, colorScale=colorScale)
528
- colors[m] = Color.AnyToHex(temp_color)
529
- except:
530
- #groupList.append(Color.AnyToHex([0,0,0]))
531
- pass
516
+ c_value = Dictionary.ValueAtKey(d, key=groupKey)
517
+ if not c_value == None:
518
+ if type(c_value) == int or type(c_value) == float:
519
+ if c_value < minGroup:
520
+ c_value = minGroup
521
+ if c_value > maxGroup:
522
+ c_value = maxGroup
523
+ temp_color = Color.ByValueInRange(c_value,
524
+ minValue=minGroup,
525
+ maxValue=maxGroup,
526
+ colorScale=colorScale)
527
+ colors[m] = Color.AnyToHex(temp_color)
528
+ elif isinstance(c_value, str):
529
+ temp_color = Color.ByValueInRange(groups.index(c_value), minValue=minGroup, maxValue=maxGroup, colorScale=colorScale)
530
+ colors[m] = Color.AnyToHex(temp_color)
532
531
  else:
533
532
  for v in vertices:
534
533
  x.append(v[0])
535
534
  y.append(v[1])
536
535
  z.append(v[2])
537
536
 
538
- if len(list(set(colors))) < 2:
539
- colors = Color.AnyToHex(color)
537
+ # if len(list(set(colors))) < 2:
538
+ # colors = Color.AnyToHex(color)
540
539
  if len(labels) < 1:
541
540
  labels = "Vertex_1"
542
541
  if len(sizes) < 1:
@@ -903,7 +902,7 @@ class Plotly:
903
902
  label = ""
904
903
  group = None
905
904
  groupList.append(Color.AnyToHex(color)) # Store a default color for that face
906
- labels.append("Mace_"+str(m+1).zfill(n))
905
+ labels.append("Face_"+str(m+1).zfill(n))
907
906
  if len(dictionaries) > 0:
908
907
  d = dictionaries[m]
909
908
  if d:
topologicpy/Shell.py CHANGED
@@ -1008,7 +1008,7 @@ class Shell():
1008
1008
  v3 = Vertex.ByCoordinates(x3,y3,z3)
1009
1009
  f1 = Face.ByVertices([v2,v1,v3])
1010
1010
  faces.append(f1)
1011
- returnTopology = Shell.ByFaces(faces, tolerance)
1011
+ returnTopology = Shell.ByFaces(faces, tolerance=tolerance)
1012
1012
  if not returnTopology:
1013
1013
  returnTopology = Cluster.ByTopologies(faces)
1014
1014
  vertices = []
@@ -1745,7 +1745,7 @@ class Shell():
1745
1745
 
1746
1746
  return numerator / denominator
1747
1747
 
1748
- def douglas_peucker(wire, tolerance):
1748
+ def douglas_peucker(wire, tolerance=0.0001):
1749
1749
  if isinstance(wire, list):
1750
1750
  points = wire
1751
1751
  else:
@@ -1773,8 +1773,8 @@ class Shell():
1773
1773
  return [start_point, end_point]
1774
1774
 
1775
1775
  # Recursively simplify
1776
- first_segment = douglas_peucker(points[:max_index + 1], tolerance)
1777
- second_segment = douglas_peucker(points[max_index:], tolerance)
1776
+ first_segment = douglas_peucker(points[:max_index + 1], tolerance=tolerance)
1777
+ second_segment = douglas_peucker(points[max_index:], tolerance=tolerance)
1778
1778
 
1779
1779
  # Merge the two simplified segments
1780
1780
  return first_segment[:-1] + second_segment
@@ -1819,7 +1819,7 @@ class Shell():
1819
1819
  separators = Helper.Flatten(separators)
1820
1820
  results = []
1821
1821
  for w in wires:
1822
- temp_wire = Wire.ByVertices(douglas_peucker(w, tolerance), close=False)
1822
+ temp_wire = Wire.ByVertices(douglas_peucker(w, tolerance=tolerance), close=False)
1823
1823
  results.append(temp_wire)
1824
1824
  # Make a Cluster out of the results
1825
1825
  cluster = Cluster.ByTopologies(results)
topologicpy/Topology.py CHANGED
@@ -286,7 +286,7 @@ class Topology():
286
286
  usedTopologies.append(0)
287
287
  ap = 1
288
288
  for aperture in apertures:
289
- apCenter = Topology.InternalVertex(aperture, tolerance)
289
+ apCenter = Topology.InternalVertex(aperture, tolerance=tolerance)
290
290
  for i in range(len(subTopologies)):
291
291
  subTopology = subTopologies[i]
292
292
  if exclusive == True and usedTopologies[i] == 1:
@@ -319,7 +319,7 @@ class Topology():
319
319
  subTopologies = [topology]
320
320
  else:
321
321
  subTopologies = Topology.SubTopologies(topology, subTopologyType)
322
- processApertures(subTopologies, apertures, exclusive, tolerance)
322
+ processApertures(subTopologies, apertures, exclusive, tolerance=tolerance)
323
323
  return topology
324
324
 
325
325
  @staticmethod
@@ -1524,7 +1524,7 @@ class Topology():
1524
1524
  from topologicpy.CellComplex import CellComplex
1525
1525
  from topologicpy.Cluster import Cluster
1526
1526
 
1527
- def topologyByFaces(faces, topologyType, tolerance):
1527
+ def topologyByFaces(faces, topologyType, tolerance=0.0001):
1528
1528
  if len(faces) == 1:
1529
1529
  return faces[0]
1530
1530
 
@@ -1663,7 +1663,7 @@ class Topology():
1663
1663
  The created topology. The topology will have a dictionary embedded in it that records the input attributes (color, id, lengthUnit, name, type)
1664
1664
 
1665
1665
  """
1666
- def topologyByFaces(faces, outputMode, tolerance):
1666
+ def topologyByFaces(faces, outputMode, tolerance=0.0001):
1667
1667
  output = None
1668
1668
  if len(faces) == 1:
1669
1669
  return faces[0]
@@ -2386,6 +2386,10 @@ class Topology():
2386
2386
 
2387
2387
  import ifcopenshell, ifcopenshell.geom
2388
2388
  from topologicpy.Dictionary import Dictionary
2389
+ from topologicpy.Vertex import Vertex
2390
+ from topologicpy.Edge import Edge
2391
+ from topologicpy.Face import Face
2392
+ import numpy as np
2389
2393
 
2390
2394
  def get_psets(entity):
2391
2395
  # Initialize the PSET dictionary for this entity
@@ -2506,47 +2510,55 @@ class Topology():
2506
2510
  color = (random.random(), random.random(), random.random())
2507
2511
 
2508
2512
  return color, default_transparency, material_list
2509
-
2513
+ # Create a 4x4 unity matrix
2514
+ matrix = [[1.0 if i == j else 0.0 for j in range(4)] for i in range(4)]
2510
2515
  def convert_to_topology(entity, settings, transferDictionaries=False):
2511
2516
  if hasattr(entity, "Representation") and entity.Representation:
2512
2517
  for rep in entity.Representation.Representations:
2513
2518
  if rep.is_a("IfcShapeRepresentation"):
2514
2519
  # Generate the geometry for this entity
2515
2520
  shape = ifcopenshell.geom.create_shape(settings, entity)
2516
- shape_geometry = shape.geometry
2517
- verts = shape_geometry.verts
2518
- verts = [ [verts[i], verts[i + 1], verts[i + 2]] for i in range(0, len(verts), 3)]
2519
- edges = shape_geometry.edges
2520
- edges = [[edges[i], edges[i + 1]] for i in range(0, len(edges), 2)]
2521
- faces = shape_geometry.faces
2522
- faces = [ [faces[i], faces[i + 1], faces[i + 2]] for i in range(0, len(faces), 3)]
2523
- # Convert geometry to Topologic format
2521
+ try:
2522
+ trans = shape.transformation
2523
+ # Convert into a 4x4 matrix
2524
+ matrix = [trans.matrix[i:i+4] for i in range(0, len(trans.matrix), 4)]
2525
+ except:
2526
+ pass
2527
+ # Get grouped vertices and grouped faces
2528
+ grouped_verts = shape.geometry.verts
2529
+ verts = [ [grouped_verts[i], grouped_verts[i + 1], grouped_verts[i + 2]] for i in range(0, len(grouped_verts), 3)]
2530
+ grouped_edges = shape.geometry.edges
2531
+ edges = [[grouped_edges[i], grouped_edges[i + 1]] for i in range(0, len(grouped_edges), 2)]
2532
+ grouped_faces = shape.geometry.faces
2533
+ faces = [ [grouped_faces[i], grouped_faces[i + 1], grouped_faces[i + 2]] for i in range(0, len(grouped_faces), 3)]
2524
2534
  #shape_topology = ifc_to_topologic_geometry(verts, edges, faces)
2525
2535
  #shape_topology = Topology.SelfMerge(Topology.ByGeometry(verts, edges, faces))
2526
2536
  shape_topology = Topology.ByGeometry(verts, edges, faces, silent=True)
2527
- if removeCoplanarFaces == True:
2528
- shape_topology = Topology.RemoveCoplanarFaces(shape_topology, epsilon=0.0001)
2529
-
2530
- # Store relevant information
2531
- if transferDictionaries == True:
2532
- color, transparency, material_list = get_color_transparency_material(entity)
2533
- entity_dict = {
2534
- "TOPOLOGIC_id": str(Topology.UUID(shape_topology)),
2535
- "TOPOLOGIC_name": getattr(entity, 'Name', "Untitled"),
2536
- "TOPOLOGIC_type": Topology.TypeAsString(shape_topology),
2537
- "TOPOLOGIC_color": color,
2538
- "TOPOLOGIC_opacity": 1.0 - transparency,
2539
- "IFC_global_id": getattr(entity, 'GlobalId', 0),
2540
- "IFC_name": getattr(entity, 'Name', "Untitled"),
2541
- "IFC_type": entity.is_a(),
2542
- "IFC_material_list": material_list,
2543
- }
2544
- topology_dict = Dictionary.ByPythonDictionary(entity_dict)
2545
- # Get PSETs dictionary
2546
- pset_python_dict = get_psets(entity)
2547
- pset_dict = Dictionary.ByPythonDictionary(pset_python_dict)
2548
- topology_dict = Dictionary.ByMergedDictionaries([topology_dict, pset_dict])
2549
- shape_topology = Topology.SetDictionary(shape_topology, topology_dict)
2537
+ if not shape_topology == None:
2538
+ if removeCoplanarFaces == True:
2539
+ shape_topology = Topology.RemoveCoplanarFaces(shape_topology, epsilon=0.0001)
2540
+ shape_topology = Topology.Transform(shape_topology, matrix)
2541
+
2542
+ # Store relevant information
2543
+ if transferDictionaries == True:
2544
+ color, transparency, material_list = get_color_transparency_material(entity)
2545
+ entity_dict = {
2546
+ "TOPOLOGIC_id": str(Topology.UUID(shape_topology)),
2547
+ "TOPOLOGIC_name": getattr(entity, 'Name', "Untitled"),
2548
+ "TOPOLOGIC_type": Topology.TypeAsString(shape_topology),
2549
+ "TOPOLOGIC_color": color,
2550
+ "TOPOLOGIC_opacity": 1.0 - transparency,
2551
+ "IFC_global_id": getattr(entity, 'GlobalId', 0),
2552
+ "IFC_name": getattr(entity, 'Name', "Untitled"),
2553
+ "IFC_type": entity.is_a(),
2554
+ "IFC_material_list": material_list,
2555
+ }
2556
+ topology_dict = Dictionary.ByPythonDictionary(entity_dict)
2557
+ # Get PSETs dictionary
2558
+ pset_python_dict = get_psets(entity)
2559
+ pset_dict = Dictionary.ByPythonDictionary(pset_python_dict)
2560
+ topology_dict = Dictionary.ByMergedDictionaries([topology_dict, pset_dict])
2561
+ shape_topology = Topology.SetDictionary(shape_topology, topology_dict)
2550
2562
  return shape_topology
2551
2563
  return None
2552
2564
 
@@ -6228,7 +6240,7 @@ class Topology():
6228
6240
  return Topology.Type(topology)
6229
6241
 
6230
6242
  @staticmethod
6231
- def InternalVertex(topology, tolerance: float = 0.0001):
6243
+ def _InternalVertex(topology, tolerance: float = 0.0001):
6232
6244
  """
6233
6245
  Returns a vertex guaranteed to be inside the input topology.
6234
6246
 
@@ -6283,11 +6295,54 @@ class Topology():
6283
6295
  elif Topology.IsInstance(top, "Vertex"): #Vertex
6284
6296
  vst = top
6285
6297
  elif Topology.IsInstance(topology, "Aperture"): #Aperture
6286
- vst = Face.InternalVertex(Aperture.Topology(top), tolerance)
6298
+ vst = Face.InternalVertex(Aperture.Topology(top), tolerance=tolerance)
6287
6299
  else:
6288
6300
  vst = Topology.Centroid(top)
6289
6301
  return vst
6290
6302
 
6303
+
6304
+
6305
+ @staticmethod
6306
+ def InternalVertex(topology, timeout: int = 10, tolerance: float = 0.0001):
6307
+ """
6308
+ Returns a vertex guaranteed to be inside the input topology.
6309
+
6310
+ Parameters
6311
+ ----------
6312
+ topology : topologic_core.Topology
6313
+ The input topology.
6314
+ timeout : int , optional
6315
+ The amount of seconds to wait before timing out. The default is 10 seconds.
6316
+ tolerance : float , ptional
6317
+ The desired tolerance. The default is 0.0001.
6318
+
6319
+ Returns
6320
+ -------
6321
+ topologic_core.Vertex
6322
+ A vertex guaranteed to be inside the input topology.
6323
+
6324
+ """
6325
+ import concurrent.futures
6326
+ import time
6327
+ # Wrapper function with timeout
6328
+ def run_with_timeout(func, topology, tolerance=0.0001, timeout=10):
6329
+ with concurrent.futures.ThreadPoolExecutor() as executor:
6330
+ future = executor.submit(func, topology, tolerance=tolerance)
6331
+ try:
6332
+ result = future.result(timeout=timeout) # Wait for the result with a timeout
6333
+ return result
6334
+ except concurrent.futures.TimeoutError:
6335
+ print("Function took too long, retrying with a different solution.")
6336
+ return None # or try another approach here
6337
+
6338
+ result = run_with_timeout(Topology._InternalVertex, topology=topology, tolerance=tolerance, timeout=timeout) # Set a 10 second timeout
6339
+ if result is None:
6340
+ # Handle failure case (e.g., try a different solution)
6341
+ print("Using a different approach.")
6342
+ result = Topology.Centroid(topology)
6343
+ print("Result is:", result)
6344
+ return result
6345
+
6291
6346
  @staticmethod
6292
6347
  def IsInstance(topology, type: str):
6293
6348
  """
@@ -6371,7 +6426,7 @@ class Topology():
6371
6426
  """
6372
6427
  from topologicpy.Vertex import Vertex
6373
6428
 
6374
- def isOnPlane(v, plane, tolerance):
6429
+ def isOnPlane(v, plane, tolerance=0.0001):
6375
6430
  x, y, z = v
6376
6431
  a, b, c, d = plane
6377
6432
  if math.fabs(a*x + b*y + c*z + d) <= tolerance:
@@ -6402,7 +6457,7 @@ class Topology():
6402
6457
  else:
6403
6458
  p = plane(vertices[0], vertices[1], vertices[2])
6404
6459
  for i in range(len(vertices)):
6405
- if isOnPlane([Vertex.X(vertices[i], mantissa=mantissa), Vertex.Y(vertices[i], mantissa=mantissa), Vertex.Z(vertices[i], mantissa=mantissa)], p, tolerance) == False:
6460
+ if isOnPlane([Vertex.X(vertices[i], mantissa=mantissa), Vertex.Y(vertices[i], mantissa=mantissa), Vertex.Z(vertices[i], mantissa=mantissa)], p, tolerance=tolerance) == False:
6406
6461
  result = False
6407
6462
  break
6408
6463
  return result
@@ -7869,14 +7924,14 @@ class Topology():
7869
7924
  @staticmethod
7870
7925
  def Show(*topologies,
7871
7926
  opacityKey = "opacity",
7872
- showVertices=True, vertexSize=1.1, vertexSizeKey = None, vertexColor="black", vertexColorKey = None,
7927
+ showVertices=True, vertexSize=None, vertexSizeKey = None, vertexColor="black", vertexColorKey = None,
7873
7928
  vertexLabelKey=None, showVertexLabel= False,
7874
7929
  vertexGroupKey=None, vertexGroups=[],
7875
7930
  vertexMinGroup=None, vertexMaxGroup=None,
7876
7931
  showVertexLegend=False, vertexLegendLabel="Topology Vertices", vertexLegendRank=1,
7877
7932
  vertexLegendGroup=1,
7878
7933
 
7879
- showEdges=True, edgeWidth=1, edgeWidthKey = None, edgeColor="black", edgeColorKey = None,
7934
+ showEdges=True, edgeWidth=None, edgeWidthKey = None, edgeColor=None, edgeColorKey = None,
7880
7935
  edgeLabelKey=None, showEdgeLabel = False,
7881
7936
  edgeGroupKey=None, edgeGroups=[],
7882
7937
  edgeMinGroup=None, edgeMaxGroup=None,
@@ -7936,7 +7991,7 @@ class Topology():
7936
7991
  The list of vertex groups against which to index the color of the vertex. The default is [].
7937
7992
  vertexMinGroup : int or float , optional
7938
7993
  For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups. The default is None.
7939
- edgeMaxGroup : int or float , optional
7994
+ vertexMaxGroup : int or float , optional
7940
7995
  For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups. The default is None.
7941
7996
  showVertexLegend : bool, optional
7942
7997
  If set to True, the legend for the vertices of this topology is shown. Otherwise, it isn't. The default is False.
@@ -8105,23 +8160,78 @@ class Topology():
8105
8160
  if not silent:
8106
8161
  print("Topology.Show - Error: the input topologies parameter does not contain any valid topology. Returning None.")
8107
8162
  return None
8163
+
8108
8164
  if camera[0] == 0 and camera[1] == 0 and up == [0,0,1]:
8109
8165
  up = [0,1,0] #default to positive Y axis being up if looking down or up at the XY plane
8110
8166
  data = []
8111
8167
  for topology in new_topologies:
8112
8168
  if Topology.IsInstance(topology, "Graph"):
8113
- data += Plotly.DataByGraph(topology, sagitta=sagitta, absolute=absolute, sides=sides, angle=angle, vertexColor=vertexColor, vertexColorKey=vertexColorKey, vertexSize=vertexSize, vertexSizeKey=vertexSizeKey, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLabel=showVertexLabel, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeColorKey=edgeColorKey, edgeWidth=edgeWidth, edgeWidthKey=edgeWidthKey, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLabel=showEdgeLabel, showEdgeLegend=showEdgeLegend, colorScale=colorScale, silent=silent)
8169
+ if vertexSize == None:
8170
+ vSize = 10
8171
+ else:
8172
+ vSize = vertexSize
8173
+ if edgeWidth == None:
8174
+ eWidth = 1
8175
+ else:
8176
+ eWidth = edgeWidth
8177
+ if edgeColor == None:
8178
+ eColor = "red"
8179
+ else:
8180
+ eColor = edgeColor
8181
+ data += Plotly.DataByGraph(topology,
8182
+ sagitta=sagitta,
8183
+ absolute=absolute,
8184
+ sides=sides,
8185
+ angle=angle,
8186
+ vertexColor=vertexColor,
8187
+ vertexColorKey=vertexColorKey,
8188
+ vertexSize=vSize,
8189
+ vertexSizeKey=vertexSizeKey,
8190
+ vertexLabelKey=vertexLabelKey,
8191
+ vertexGroupKey=vertexGroupKey,
8192
+ vertexGroups=vertexGroups,
8193
+ vertexMinGroup=vertexMinGroup,
8194
+ vertexMaxGroup=vertexMaxGroup,
8195
+ showVertices=showVertices,
8196
+ showVertexLabel=showVertexLabel,
8197
+ showVertexLegend=showVertexLegend,
8198
+ edgeColor=eColor,
8199
+ edgeColorKey=edgeColorKey,
8200
+ edgeWidth=eWidth,
8201
+ edgeWidthKey=edgeWidthKey,
8202
+ edgeLabelKey=edgeLabelKey,
8203
+ edgeGroupKey=edgeGroupKey,
8204
+ edgeGroups=edgeGroups,
8205
+ edgeMinGroup=edgeMinGroup,
8206
+ edgeMaxGroup=edgeMaxGroup,
8207
+ showEdges=showEdges,
8208
+ showEdgeLabel=showEdgeLabel,
8209
+ showEdgeLegend=showEdgeLegend,
8210
+ colorScale=colorScale,
8211
+ silent=silent)
8114
8212
  else:
8213
+ if vertexSize == None:
8214
+ vSize = 1.1
8215
+ else:
8216
+ vSize = vertexSize
8217
+ if edgeWidth == None:
8218
+ eWidth = 1
8219
+ else:
8220
+ eWidth = edgeWidth
8221
+ if edgeColor == None:
8222
+ eColor = "black"
8223
+ else:
8224
+ eColor = edgeColor
8115
8225
  d = Topology.Dictionary(topology)
8116
8226
  if not d == None:
8117
8227
  faceOpacity = Dictionary.ValueAtKey(d, opacityKey) or faceOpacity
8118
8228
  data += Plotly.DataByTopology(topology=topology,
8119
- showVertices=showVertices, vertexSize=vertexSize, vertexSizeKey=vertexSizeKey, vertexColor=vertexColor, vertexColorKey=vertexColorKey,
8229
+ showVertices=showVertices, vertexSize=vSize, vertexSizeKey=vertexSizeKey, vertexColor=vertexColor, vertexColorKey=vertexColorKey,
8120
8230
  vertexLabelKey=vertexLabelKey, showVertexLabel=showVertexLabel, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups,
8121
8231
  vertexMinGroup=vertexMinGroup, vertexMaxGroup=vertexMaxGroup,
8122
8232
  showVertexLegend=showVertexLegend, vertexLegendLabel=vertexLegendLabel, vertexLegendRank=vertexLegendRank,
8123
8233
  vertexLegendGroup=vertexLegendGroup,
8124
- showEdges=showEdges, edgeWidth=edgeWidth, edgeWidthKey=edgeWidthKey, edgeColor=edgeColor, edgeColorKey=edgeColorKey,
8234
+ showEdges=showEdges, edgeWidth=eWidth, edgeWidthKey=edgeWidthKey, edgeColor=eColor, edgeColorKey=edgeColorKey,
8125
8235
  edgeLabelKey=edgeLabelKey, showEdgeLabel=showEdgeLabel, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups,
8126
8236
  edgeMinGroup=edgeMinGroup, edgeMaxGroup=edgeMaxGroup,
8127
8237
  showEdgeLegend=showEdgeLegend, edgeLegendLabel=edgeLegendLabel, edgeLegendRank=edgeLegendRank,
@@ -8176,7 +8286,7 @@ class Topology():
8176
8286
  found = False
8177
8287
  for j in range(len(topologies)):
8178
8288
  if usedTopologies[j] == 0:
8179
- if Vertex.IsInternal( selectors[i], topologies[j], tolerance):
8289
+ if Vertex.IsInternal( selectors[i], topologies[j], tolerance=tolerance):
8180
8290
  sortedTopologies.append(topologies[j])
8181
8291
  if exclusive == True:
8182
8292
  usedTopologies[j] = 1
@@ -8313,7 +8423,7 @@ class Topology():
8313
8423
  returnTopology = Cell.ByShell(returnTopology)
8314
8424
  except:
8315
8425
  try:
8316
- returnTopology = CellComplex.ByWires(topologies, tolerance)
8426
+ returnTopology = CellComplex.ByWires(topologies, tolerance=tolerance)
8317
8427
  try:
8318
8428
  returnTopology = CellComplex.ExternalBoundary(returnTopology)
8319
8429
  except:
@@ -8340,7 +8450,7 @@ class Topology():
8340
8450
  for t in topologies:
8341
8451
  external_wires.append(topologic.Face.ExternalBoundary(t))
8342
8452
  try:
8343
- returnTopology = CellComplex.ByWires(external_wires, tolerance)
8453
+ returnTopology = CellComplex.ByWires(external_wires, tolerance=tolerance)
8344
8454
  except:
8345
8455
  try:
8346
8456
  returnTopology = Shell.ByWires(external_wires, triangulate=triangulate, tolerance=tolerance, silent=True)
@@ -8850,7 +8960,7 @@ class Topology():
8850
8960
  mergingProcess = MergingProcess(queue, sources_str, sink_items, so_dicts)
8851
8961
  mergingProcess.start()
8852
8962
 
8853
- workerProcessPool = WorkerProcessPool(numWorkers, queue, sources_str, sink_items, so_dicts, tolerance)
8963
+ workerProcessPool = WorkerProcessPool(numWorkers, queue, sources_str, sink_items, so_dicts, tolerance=tolerance)
8854
8964
  workerProcessPool.startProcesses()
8855
8965
  workerProcessPool.join()
8856
8966
 
topologicpy/Vertex.py CHANGED
@@ -771,7 +771,7 @@ class Vertex():
771
771
  from topologicpy.Topology import Topology
772
772
  import numpy as np
773
773
 
774
- def fuse_vertices(vertices, tolerance):
774
+ def fuse_vertices(vertices, tolerance=0.0001):
775
775
  fused_vertices = []
776
776
  merged_indices = {}
777
777
 
@@ -818,7 +818,7 @@ class Vertex():
818
818
  return None
819
819
 
820
820
  vertices = [(Vertex.X(v, mantissa=mantissa), Vertex.Y(v, mantissa=mantissa), Vertex.Z(v, mantissa=mantissa)) for v in vertices]
821
- fused_vertices = fuse_vertices(vertices, tolerance)
821
+ fused_vertices = fuse_vertices(vertices, tolerance=tolerance)
822
822
  return_vertices = [Vertex.ByCoordinates(list(coord)) for coord in fused_vertices]
823
823
  return return_vertices
824
824