topologicpy 0.7.84__py3-none-any.whl → 0.7.85__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- topologicpy/Cell.py +5 -5
- topologicpy/CellComplex.py +4 -4
- topologicpy/Cluster.py +8 -8
- topologicpy/Dictionary.py +34 -1
- topologicpy/Edge.py +2 -2
- topologicpy/Face.py +2 -2
- topologicpy/Graph.py +91 -49
- topologicpy/Grid.py +4 -4
- topologicpy/Helper.py +42 -1
- topologicpy/Plotly.py +21 -22
- topologicpy/Shell.py +5 -5
- topologicpy/Topology.py +152 -50
- topologicpy/Vertex.py +2 -2
- topologicpy/Wire.py +15 -15
- topologicpy/version.py +1 -1
- {topologicpy-0.7.84.dist-info → topologicpy-0.7.85.dist-info}/METADATA +1 -1
- topologicpy-0.7.85.dist-info/RECORD +36 -0
- topologicpy-0.7.84.dist-info/RECORD +0 -36
- {topologicpy-0.7.84.dist-info → topologicpy-0.7.85.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.84.dist-info → topologicpy-0.7.85.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.84.dist-info → topologicpy-0.7.85.dist-info}/top_level.txt +0 -0
topologicpy/Helper.py
CHANGED
@@ -580,4 +580,45 @@ class Helper:
|
|
580
580
|
The current version of the software.
|
581
581
|
|
582
582
|
"""
|
583
|
-
|
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
@@ -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
|
-
|
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
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
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
|
-
|
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("
|
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
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
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
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
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
|
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=
|
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=
|
7934
|
+
showEdges=True, edgeWidth=None, edgeWidthKey = None, edgeColor="black", 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
|
-
|
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,70 @@ 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
|
-
|
8169
|
+
if vertexSize == None:
|
8170
|
+
vSize = 6
|
8171
|
+
else:
|
8172
|
+
vSize = vertexSize
|
8173
|
+
if edgeWidth == None:
|
8174
|
+
eWidth = 1
|
8175
|
+
else:
|
8176
|
+
eWidth = edgeWidth
|
8177
|
+
data += Plotly.DataByGraph(topology,
|
8178
|
+
sagitta=sagitta,
|
8179
|
+
absolute=absolute,
|
8180
|
+
sides=sides,
|
8181
|
+
angle=angle,
|
8182
|
+
vertexColor=vertexColor,
|
8183
|
+
vertexColorKey=vertexColorKey,
|
8184
|
+
vertexSize=vSize,
|
8185
|
+
vertexSizeKey=vertexSizeKey,
|
8186
|
+
vertexLabelKey=vertexLabelKey,
|
8187
|
+
vertexGroupKey=vertexGroupKey,
|
8188
|
+
vertexGroups=vertexGroups,
|
8189
|
+
vertexMinGroup=vertexMinGroup,
|
8190
|
+
vertexMaxGroup=vertexMaxGroup,
|
8191
|
+
showVertices=showVertices,
|
8192
|
+
showVertexLabel=showVertexLabel,
|
8193
|
+
showVertexLegend=showVertexLegend,
|
8194
|
+
edgeColor=edgeColor,
|
8195
|
+
edgeColorKey=edgeColorKey,
|
8196
|
+
edgeWidth=eWidth,
|
8197
|
+
edgeWidthKey=edgeWidthKey,
|
8198
|
+
edgeLabelKey=edgeLabelKey,
|
8199
|
+
edgeGroupKey=edgeGroupKey,
|
8200
|
+
edgeGroups=edgeGroups,
|
8201
|
+
edgeMinGroup=edgeMinGroup,
|
8202
|
+
edgeMaxGroup=edgeMaxGroup,
|
8203
|
+
showEdges=showEdges,
|
8204
|
+
showEdgeLabel=showEdgeLabel,
|
8205
|
+
showEdgeLegend=showEdgeLegend,
|
8206
|
+
colorScale=colorScale,
|
8207
|
+
silent=silent)
|
8114
8208
|
else:
|
8209
|
+
if vertexSize == None:
|
8210
|
+
vSize = 1.1
|
8211
|
+
else:
|
8212
|
+
vSize = vertexSize
|
8213
|
+
if edgeWidth == None:
|
8214
|
+
eWidth = 1
|
8215
|
+
else:
|
8216
|
+
eWidth = edgeWidth
|
8115
8217
|
d = Topology.Dictionary(topology)
|
8116
8218
|
if not d == None:
|
8117
8219
|
faceOpacity = Dictionary.ValueAtKey(d, opacityKey) or faceOpacity
|
8118
8220
|
data += Plotly.DataByTopology(topology=topology,
|
8119
|
-
showVertices=showVertices, vertexSize=
|
8221
|
+
showVertices=showVertices, vertexSize=vSize, vertexSizeKey=vertexSizeKey, vertexColor=vertexColor, vertexColorKey=vertexColorKey,
|
8120
8222
|
vertexLabelKey=vertexLabelKey, showVertexLabel=showVertexLabel, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups,
|
8121
8223
|
vertexMinGroup=vertexMinGroup, vertexMaxGroup=vertexMaxGroup,
|
8122
8224
|
showVertexLegend=showVertexLegend, vertexLegendLabel=vertexLegendLabel, vertexLegendRank=vertexLegendRank,
|
8123
8225
|
vertexLegendGroup=vertexLegendGroup,
|
8124
|
-
showEdges=showEdges, edgeWidth=
|
8226
|
+
showEdges=showEdges, edgeWidth=eWidth, edgeWidthKey=edgeWidthKey, edgeColor=edgeColor, edgeColorKey=edgeColorKey,
|
8125
8227
|
edgeLabelKey=edgeLabelKey, showEdgeLabel=showEdgeLabel, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups,
|
8126
8228
|
edgeMinGroup=edgeMinGroup, edgeMaxGroup=edgeMaxGroup,
|
8127
8229
|
showEdgeLegend=showEdgeLegend, edgeLegendLabel=edgeLegendLabel, edgeLegendRank=edgeLegendRank,
|
@@ -8176,7 +8278,7 @@ class Topology():
|
|
8176
8278
|
found = False
|
8177
8279
|
for j in range(len(topologies)):
|
8178
8280
|
if usedTopologies[j] == 0:
|
8179
|
-
if Vertex.IsInternal( selectors[i], topologies[j], tolerance):
|
8281
|
+
if Vertex.IsInternal( selectors[i], topologies[j], tolerance=tolerance):
|
8180
8282
|
sortedTopologies.append(topologies[j])
|
8181
8283
|
if exclusive == True:
|
8182
8284
|
usedTopologies[j] = 1
|
@@ -8313,7 +8415,7 @@ class Topology():
|
|
8313
8415
|
returnTopology = Cell.ByShell(returnTopology)
|
8314
8416
|
except:
|
8315
8417
|
try:
|
8316
|
-
returnTopology = CellComplex.ByWires(topologies, tolerance)
|
8418
|
+
returnTopology = CellComplex.ByWires(topologies, tolerance=tolerance)
|
8317
8419
|
try:
|
8318
8420
|
returnTopology = CellComplex.ExternalBoundary(returnTopology)
|
8319
8421
|
except:
|
@@ -8340,7 +8442,7 @@ class Topology():
|
|
8340
8442
|
for t in topologies:
|
8341
8443
|
external_wires.append(topologic.Face.ExternalBoundary(t))
|
8342
8444
|
try:
|
8343
|
-
returnTopology = CellComplex.ByWires(external_wires, tolerance)
|
8445
|
+
returnTopology = CellComplex.ByWires(external_wires, tolerance=tolerance)
|
8344
8446
|
except:
|
8345
8447
|
try:
|
8346
8448
|
returnTopology = Shell.ByWires(external_wires, triangulate=triangulate, tolerance=tolerance, silent=True)
|
@@ -8850,7 +8952,7 @@ class Topology():
|
|
8850
8952
|
mergingProcess = MergingProcess(queue, sources_str, sink_items, so_dicts)
|
8851
8953
|
mergingProcess.start()
|
8852
8954
|
|
8853
|
-
workerProcessPool = WorkerProcessPool(numWorkers, queue, sources_str, sink_items, so_dicts, tolerance)
|
8955
|
+
workerProcessPool = WorkerProcessPool(numWorkers, queue, sources_str, sink_items, so_dicts, tolerance=tolerance)
|
8854
8956
|
workerProcessPool.startProcesses()
|
8855
8957
|
workerProcessPool.join()
|
8856
8958
|
|
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
|
|
topologicpy/Wire.py
CHANGED
@@ -1445,7 +1445,7 @@ class Wire():
|
|
1445
1445
|
from topologicpy.Edge import Edge
|
1446
1446
|
from topologicpy.Topology import Topology
|
1447
1447
|
|
1448
|
-
def vIndex(v, vList, tolerance):
|
1448
|
+
def vIndex(v, vList, tolerance=0.0001):
|
1449
1449
|
for i in range(len(vList)):
|
1450
1450
|
if Vertex.Distance(v, vList[i]) < tolerance:
|
1451
1451
|
return i+1
|
@@ -1512,7 +1512,7 @@ class Wire():
|
|
1512
1512
|
|
1513
1513
|
graph = []
|
1514
1514
|
for anEdge in tEdges:
|
1515
|
-
graph.append([vIndex(anEdge.StartVertex(), tVertices, tolerance), vIndex(anEdge.EndVertex(), tVertices, tolerance)])
|
1515
|
+
graph.append([vIndex(anEdge.StartVertex(), tVertices, tolerance), vIndex(anEdge.EndVertex(), tVertices, tolerance)]) # Hook to Core
|
1516
1516
|
|
1517
1517
|
cycles = []
|
1518
1518
|
resultingCycles = main(graph, cycles, maxVertices)
|
@@ -2331,7 +2331,7 @@ class Wire():
|
|
2331
2331
|
j += k
|
2332
2332
|
return False
|
2333
2333
|
|
2334
|
-
def angleBetweenEdges(e1, e2, tolerance):
|
2334
|
+
def angleBetweenEdges(e1, e2, tolerance=0.0001):
|
2335
2335
|
a = e1.EndVertex().X() - e1.StartVertex().X()
|
2336
2336
|
b = e1.EndVertex().Y() - e1.StartVertex().Y()
|
2337
2337
|
c = e1.EndVertex().Z() - e1.StartVertex().Z()
|
@@ -2350,16 +2350,16 @@ class Wire():
|
|
2350
2350
|
angleInDegrees = math.degrees(math.acos(angle))
|
2351
2351
|
return angleInDegrees
|
2352
2352
|
|
2353
|
-
def getInteriorAngles(edges, tolerance):
|
2353
|
+
def getInteriorAngles(edges, tolerance=0.0001):
|
2354
2354
|
angles = []
|
2355
2355
|
for i in range(len(edges)-1):
|
2356
2356
|
e1 = edges[i]
|
2357
2357
|
e2 = edges[i+1]
|
2358
|
-
angles.append(angleBetweenEdges(e1, e2, tolerance))
|
2358
|
+
angles.append(angleBetweenEdges(e1, e2, tolerance=tolerance))
|
2359
2359
|
return angles
|
2360
2360
|
|
2361
|
-
def getRep(edges, tolerance):
|
2362
|
-
angles = getInteriorAngles(edges, tolerance)
|
2361
|
+
def getRep(edges, tolerance=0.0001):
|
2362
|
+
angles = getInteriorAngles(edges, tolerance=tolerance)
|
2363
2363
|
lengths = []
|
2364
2364
|
for anEdge in edges:
|
2365
2365
|
lengths.append(Edge.Length(anEdge))
|
@@ -2379,8 +2379,8 @@ class Wire():
|
|
2379
2379
|
_ = wireB.Edges(None, edgesB)
|
2380
2380
|
if len(edgesA) != len(edgesB):
|
2381
2381
|
return False
|
2382
|
-
repA = getRep(list(edgesA), tolerance)
|
2383
|
-
repB = getRep(list(edgesB), tolerance)
|
2382
|
+
repA = getRep(list(edgesA), tolerance=tolerance)
|
2383
|
+
repB = getRep(list(edgesB), tolerance=tolerance)
|
2384
2384
|
if isCyclicallyEquivalent(repA, repB, tolerance, angTolerance):
|
2385
2385
|
return True
|
2386
2386
|
if isCyclicallyEquivalent(repA, repB[::-1], tolerance, angTolerance):
|
@@ -3091,7 +3091,7 @@ class Wire():
|
|
3091
3091
|
from topologicpy.Topology import Topology
|
3092
3092
|
import inspect
|
3093
3093
|
|
3094
|
-
def cleanup(wire, tolerance):
|
3094
|
+
def cleanup(wire, tolerance=0.0001):
|
3095
3095
|
vertices = Topology.Vertices(wire)
|
3096
3096
|
vertices = Vertex.Fuse(vertices, tolerance=tolerance)
|
3097
3097
|
edges = Topology.Edges(wire)
|
@@ -3393,7 +3393,7 @@ class Wire():
|
|
3393
3393
|
|
3394
3394
|
return numerator / denominator
|
3395
3395
|
|
3396
|
-
def douglas_peucker(wire, tolerance):
|
3396
|
+
def douglas_peucker(wire, tolerance=0.0001):
|
3397
3397
|
if isinstance(wire, list):
|
3398
3398
|
points = wire
|
3399
3399
|
else:
|
@@ -3416,12 +3416,12 @@ class Wire():
|
|
3416
3416
|
if max_distance <= tolerance:
|
3417
3417
|
return [start_point, end_point]
|
3418
3418
|
|
3419
|
-
first_segment = douglas_peucker(points[:max_index + 1], tolerance)
|
3420
|
-
second_segment = douglas_peucker(points[max_index:], tolerance)
|
3419
|
+
first_segment = douglas_peucker(points[:max_index + 1], tolerance=tolerance)
|
3420
|
+
second_segment = douglas_peucker(points[max_index:], tolerance=tolerance)
|
3421
3421
|
|
3422
3422
|
return first_segment[:-1] + second_segment
|
3423
3423
|
|
3424
|
-
def visvalingam_whyatt(wire, tolerance):
|
3424
|
+
def visvalingam_whyatt(wire, tolerance=0.0001):
|
3425
3425
|
if isinstance(wire, list):
|
3426
3426
|
points = wire
|
3427
3427
|
else:
|
@@ -3453,7 +3453,7 @@ class Wire():
|
|
3453
3453
|
|
3454
3454
|
return simplified_points
|
3455
3455
|
|
3456
|
-
def reumann_witkam(wire, tolerance):
|
3456
|
+
def reumann_witkam(wire, tolerance=0.0001):
|
3457
3457
|
if isinstance(wire, list):
|
3458
3458
|
points = wire
|
3459
3459
|
else:
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.85'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.85
|
4
4
|
Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
6
6
|
License: AGPL v3 License
|