topologicpy 0.4.75__py3-none-any.whl → 0.4.77__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
@@ -4969,7 +4969,10 @@ class Graph:
4969
4969
  if ang < 180:
4970
4970
  viewpointsA.append(vertices[i])
4971
4971
  viewpointsB.append(vertices[i])
4972
- obstacle_cluster = Cluster.ByTopologies(obstacles)
4972
+ if len(obstacles) > 0:
4973
+ obstacle_cluster = Cluster.ByTopologies(obstacles)
4974
+ else:
4975
+ obstacle_cluster = None
4973
4976
  final_edges = []
4974
4977
  for i in tqdm(range(len(viewpointsA))):
4975
4978
  va = viewpointsA[i]
@@ -4977,18 +4980,23 @@ class Graph:
4977
4980
  vb = viewpointsB[j]
4978
4981
  if Vertex.Distance(va, vb) > tolerance:
4979
4982
  edge = Edge.ByVertices([va,vb])
4980
- result = Topology.Difference(edge, obstacle_cluster)
4983
+ if not obstacle_cluster == None:
4984
+ result = Topology.Difference(edge, obstacle_cluster)
4985
+ else:
4986
+ result = edge
4981
4987
  if not result == None:
4982
4988
  result2 = Topology.Difference(result, face)
4983
4989
  if isinstance(result2, topologic.Edge) or isinstance(result2, topologic.Cluster):
4984
4990
  result = result2
4985
4991
  if isinstance(result, topologic.Edge):
4986
- sv = Edge.StartVertex(result)
4987
- ev = Edge.EndVertex(result)
4988
- if (not Vertex.Index(sv, viewpointsA+viewpointsB) == None) and (not Vertex.Index(ev, viewpointsA+viewpointsB) == None):
4989
- final_edges.append(result)
4990
- face_edges = Topology.Edges(face)
4991
- final_edges += face_edges
4992
+ if abs(Edge.Length(result) - Edge.Length(edge)) < tolerance:
4993
+ sv = Edge.StartVertex(result)
4994
+ ev = Edge.EndVertex(result)
4995
+ if (not Vertex.Index(sv, viewpointsA+viewpointsB) == None) and (not Vertex.Index(ev, viewpointsA+viewpointsB) == None):
4996
+ final_edges.append(result)
4997
+ if len(i_boundaries) > 0:
4998
+ holes_edges = Topology.Edges(Cluster.ByTopologies(i_boundaries))
4999
+ final_edges += holes_edges
4992
5000
  if len(final_edges) > 0:
4993
5001
  final_vertices = Topology.Vertices(Cluster.ByTopologies(final_edges))
4994
5002
  g = Graph.ByVerticesEdges(final_vertices, final_edges)
@@ -5149,7 +5157,7 @@ class Graph:
5149
5157
  @staticmethod
5150
5158
  def PyvisGraph(graph, path, overwrite=True, height=900, backgroundColor="white", fontColor="black", notebook=False,
5151
5159
  vertexSize=6, vertexSizeKey=None, vertexColor="black", vertexColorKey=None, vertexLabelKey=None, vertexGroupKey=None, vertexGroups=None, minVertexGroup=None, maxVertexGroup=None,
5152
- edgeWeight=0, edgeWeightKey=None, showNeighbours=True, selectMenu=True, filterMenu=True, colorScale="viridis"):
5160
+ edgeLabelKey=None, edgeWeight=0, edgeWeightKey=None, showNeighbours=True, selectMenu=True, filterMenu=True, colorScale="viridis"):
5153
5161
  """
5154
5162
  Displays a pyvis graph. See https://pyvis.readthedocs.io/.
5155
5163
 
@@ -5192,6 +5200,8 @@ class Graph:
5192
5200
  The desired default weight of the edge. This determines its thickness. The default is 0.
5193
5201
  edgeWeightKey : str, optional
5194
5202
  If not set to None, the edge weight will be derived from the dictionary value set at this key. If set to "length" or "distance", the weight of the edge will be determined by its geometric length. The default is None.
5203
+ edgeLabelKey : str , optional
5204
+ If not set to None, the edge label will be derived from the dictionary value set at this key. The default is None.
5195
5205
  showNeighbors : bool , optional
5196
5206
  If set to True, a list of neighbors is shown when you hover over a vertex. The default is True.
5197
5207
  selectMenu : bool , optional
@@ -5269,6 +5279,12 @@ class Graph:
5269
5279
  net.add_nodes(nodes, label=node_labels, title=node_titles, color=colors)
5270
5280
 
5271
5281
  for e in edges:
5282
+ edge_label = ""
5283
+ if not edgeLabelKey == None:
5284
+ d = Topology.Dictionary(e)
5285
+ edge_label = Dictionary.ValueAtKey(d, edgeLabelKey)
5286
+ if edge_label == None:
5287
+ edge_label = ""
5272
5288
  w = edgeWeight
5273
5289
  if not edgeWeightKey == None:
5274
5290
  d = Topology.Dictionary(e)
@@ -5282,7 +5298,7 @@ class Graph:
5282
5298
  ev = Edge.EndVertex(e)
5283
5299
  svi = Vertex.Index(sv, vertices)
5284
5300
  evi = Vertex.Index(ev, vertices)
5285
- net.add_edge(svi, evi, weight=w)
5301
+ net.add_edge(svi, evi, weight=w, label=edge_label)
5286
5302
  net.inherit_edge_colors(False)
5287
5303
 
5288
5304
  # add neighbor data to node hover data and compute vertexSize
@@ -5742,6 +5758,8 @@ class Graph:
5742
5758
 
5743
5759
  """
5744
5760
  from topologicpy.Vertex import Vertex
5761
+ from topologicpy.Edge import Edge
5762
+
5745
5763
  def vertexInList(vertex, vertexList):
5746
5764
  if vertex and vertexList:
5747
5765
  if isinstance(vertex, topologic.Vertex) and isinstance(vertexList, list):
@@ -5771,7 +5789,11 @@ class Graph:
5771
5789
  if not vertexInList(vertex, vertices):
5772
5790
  vertices.append(vertex)
5773
5791
  if parent:
5774
- edges.append(Graph.Edge(graph, parent, vertex, tolerance))
5792
+ edge = Graph.Edge(graph, parent, vertex, tolerance)
5793
+ ev = Edge.EndVertex(edge)
5794
+ if Vertex.Distance(parent, ev) < tolerance:
5795
+ edge = Edge.Reverse(edge)
5796
+ edges.append(edge)
5775
5797
  if parent == None:
5776
5798
  parent = vertex
5777
5799
  children = getChildren(vertex, parent, graph, vertices)
topologicpy/Topology.py CHANGED
@@ -1500,7 +1500,7 @@ class Topology():
1500
1500
  return Topology.ByBREPFile(file)
1501
1501
 
1502
1502
  @staticmethod
1503
- def ByIFCFile(file, transferDictionaries=False):
1503
+ def ByIFCFile(file, transferDictionaries=False, includeTypes=[], excludeTypes=[]):
1504
1504
  """
1505
1505
  Create a topology by importing it from an IFC file.
1506
1506
 
@@ -1510,6 +1510,10 @@ class Topology():
1510
1510
  The input IFC file.
1511
1511
  transferDictionaries : bool , optional
1512
1512
  If set to True, the dictionaries from the IFC file will be transfered to the topology. Otherwise, they won't. The default is False.
1513
+ includeTypes : list , optional
1514
+ The list of IFC object types to include. It is case insensitive. If set to an empty list, all types are included. The default is [].
1515
+ excludeTypes : list , optional
1516
+ The list of IFC object types to exclude. It is case insensitive. If set to an empty list, no types are excluded. The default is [].
1513
1517
 
1514
1518
  Returns
1515
1519
  -------
@@ -1525,6 +1529,8 @@ class Topology():
1525
1529
  if not file:
1526
1530
  print("Topology.ByIFCFile - Error: the input file parameter is not a valid file. Returning None.")
1527
1531
  return None
1532
+ includeTypes = [s.lower() for s in includeTypes]
1533
+ excludeTypes = [s.lower() for s in excludeTypes]
1528
1534
  topologies = []
1529
1535
  settings = ifcopenshell.geom.settings()
1530
1536
  settings.set(settings.DISABLE_TRIANGULATION, True)
@@ -1535,38 +1541,43 @@ class Topology():
1535
1541
  if iterator.initialize():
1536
1542
  while True:
1537
1543
  shape = iterator.get()
1538
- brep = shape.geometry.brep_data
1539
- topology = Topology.ByBREPString(brep)
1540
- if transferDictionaries:
1541
- keys = []
1542
- values = []
1543
- keys.append("TOPOLOGIC_color")
1544
- values.append([1.0,1.0,1.0,1.0])
1545
- keys.append("TOPOLOGIC_id")
1546
- values.append(str(uuid.uuid4()))
1547
- keys.append("TOPOLOGIC_name")
1548
- values.append(shape.name)
1549
- keys.append("TOPOLOGIC_type")
1550
- values.append(Topology.TypeAsString(topology))
1551
- keys.append("IFC_id")
1552
- values.append(str(shape.id))
1553
- keys.append("IFC_guid")
1554
- values.append(str(shape.guid))
1555
- keys.append("IFC_unique_id")
1556
- values.append(str(shape.unique_id))
1557
- keys.append("IFC_name")
1558
- values.append(shape.name)
1559
- keys.append("IFC_type")
1560
- values.append(shape.type)
1561
- d = Dictionary.ByKeysValues(keys, values)
1562
- topology = Topology.SetDictionary(topology, d)
1563
- topologies.append(topology)
1544
+ is_a = shape.type.lower()
1545
+ if (is_a in includeTypes or len(includeTypes) == 0) and (not is_a in excludeTypes):
1546
+ try:
1547
+ brep = shape.geometry.brep_data
1548
+ topology = Topology.SelfMerge(Topology.ByBREPString(brep))
1549
+ if transferDictionaries:
1550
+ keys = []
1551
+ values = []
1552
+ keys.append("TOPOLOGIC_color")
1553
+ values.append([1.0,1.0,1.0,1.0])
1554
+ keys.append("TOPOLOGIC_id")
1555
+ values.append(str(uuid.uuid4()))
1556
+ keys.append("TOPOLOGIC_name")
1557
+ values.append(shape.name)
1558
+ keys.append("TOPOLOGIC_type")
1559
+ values.append(Topology.TypeAsString(topology))
1560
+ keys.append("IFC_id")
1561
+ values.append(str(shape.id))
1562
+ keys.append("IFC_guid")
1563
+ values.append(str(shape.guid))
1564
+ keys.append("IFC_unique_id")
1565
+ values.append(str(shape.unique_id))
1566
+ keys.append("IFC_name")
1567
+ values.append(shape.name)
1568
+ keys.append("IFC_type")
1569
+ values.append(shape.type)
1570
+ d = Dictionary.ByKeysValues(keys, values)
1571
+ topology = Topology.SetDictionary(topology, d)
1572
+ topologies.append(topology)
1573
+ except:
1574
+ pass
1564
1575
  if not iterator.next():
1565
1576
  break
1566
1577
  return topologies
1567
1578
 
1568
1579
  @staticmethod
1569
- def ByIFCPath(path, transferDictionaries=False):
1580
+ def ByIFCPath(path, transferDictionaries=False, includeTypes=[], excludeTypes=[]):
1570
1581
  """
1571
1582
  Create a topology by importing it from an IFC file path.
1572
1583
 
@@ -1576,7 +1587,10 @@ class Topology():
1576
1587
  The path to the IFC file.
1577
1588
  transferDictionaries : bool , optional
1578
1589
  If set to True, the dictionaries from the IFC file will be transfered to the topology. Otherwise, they won't. The default is False.
1579
-
1590
+ includeTypes : list , optional
1591
+ The list of IFC object types to include. It is case insensitive. If set to an empty list, all types are included. The default is [].
1592
+ excludeTypes : list , optional
1593
+ The list of IFC object types to exclude. It is case insensitive. If set to an empty list, no types are excluded. The default is [].
1580
1594
  Returns
1581
1595
  -------
1582
1596
  list
@@ -1595,7 +1609,7 @@ class Topology():
1595
1609
  if not file:
1596
1610
  print("Topology.ByIFCPath - Error: the input file parameter is not a valid file. Returning None.")
1597
1611
  return None
1598
- return Topology.ByIFCFile(file, transferDictionaries=transferDictionaries)
1612
+ return Topology.ByIFCFile(file, transferDictionaries=transferDictionaries, includeTypes=includeTypes, excludeTypes=excludeTypes)
1599
1613
 
1600
1614
  '''
1601
1615
  @staticmethod
topologicpy/__init__.py CHANGED
@@ -18,7 +18,7 @@ import sys
18
18
  import os, re
19
19
  from sys import platform
20
20
 
21
- __version__ = '0.4.75'
21
+ __version__ = '0.4.77'
22
22
  __version_info__ = tuple([ int(num) for num in __version__.split('.')])
23
23
 
24
24
  if platform == 'win32':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.4.75
3
+ Version: 0.4.77
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
  Project-URL: Homepage, https://github.com/wassimj/TopologicPy
@@ -9,7 +9,7 @@ topologicpy/Dictionary.py,sha256=vGhiXPu7e7GsgQyTsX6rZBncnnrDlcYfM9xRb9h-l3U,247
9
9
  topologicpy/Edge.py,sha256=lMO4TSzN3AJNgS5Vfvl0DBY-aMn8S82xT4TXs7LdUnc,45644
10
10
  topologicpy/EnergyModel.py,sha256=WsK40w0eO6WswV6JxYztvX6zBFwTNFvDHOScXxACf08,51760
11
11
  topologicpy/Face.py,sha256=jVy6_t0ZUec7l_gXzCEUfAs1Kaap7lfPNvipwRbgLI8,93590
12
- topologicpy/Graph.py,sha256=JwKHWoHHJmdDZglI2qkzhi7KIFa06bV1kXNejKY8-iU,285304
12
+ topologicpy/Graph.py,sha256=EhEIBpxV_ulY-poOOZVmbzUQVjw6I3Thcq27D1tUjAk,286407
13
13
  topologicpy/Grid.py,sha256=q6uAs8MGbdteYNbjqRjqlhFMquYAvSngwzxsFl9-338,17371
14
14
  topologicpy/Helper.py,sha256=nG9v3_v4XhPH0HM1lNkLqJ_z1LIjxsugCu_HxG0voYA,13680
15
15
  topologicpy/Honeybee.py,sha256=ygiGMS7u-YQJWpK2CmkBuJu1DBABVUmpMdg9HewOhN4,20349
@@ -19,11 +19,11 @@ topologicpy/Plotly.py,sha256=ZlqdrP8uY118fRkX08B95ZUO7pLa04s5-daaSmFCgHo,95277
19
19
  topologicpy/Polyskel.py,sha256=-M47SAFWrFOheZ9KWUEgYOmCn-V_rfKPKvU8KY4B-1s,16450
20
20
  topologicpy/Shell.py,sha256=UEbSaahZ4kDqAagwIvOLBt7QR3YshjQ4oNVNBlAlz8s,81460
21
21
  topologicpy/Speckle.py,sha256=zKqiHYuw7498W_9UWvDn2xsdBskhahNjJejxegMpbJA,14773
22
- topologicpy/Topology.py,sha256=zjGBxnVvlx8-7EARFgnIpD49nVfdDAyYKoHuABWHLgU,286145
22
+ topologicpy/Topology.py,sha256=gZtes0iY6gk5l57H2znUJZHG3P6Xjm4jhewWIeJ_TpI,287484
23
23
  topologicpy/Vector.py,sha256=g28SO3yggTfYfpGqjE-dXpk1loQb9ZaZvP12B7Fzdcw,19564
24
24
  topologicpy/Vertex.py,sha256=A7hCI-WpHaemow4eDiaqVhZ0ekgifXcWFpa-82txwYM,55187
25
25
  topologicpy/Wire.py,sha256=gMqOqNOmph2Elup6j8bNrorBZfCScVChjTvq03rB6NA,133812
26
- topologicpy/__init__.py,sha256=z5esdHnV5HVFvZvCsauWZOvak_fb9HNSvWnJsEjvDM4,1445
26
+ topologicpy/__init__.py,sha256=hRG-QJ5JILLbi3xBXGIkLR7fso8R-SdVBlQpC96Gd1w,1445
27
27
  topologicpy/bin/linux/topologic/__init__.py,sha256=XlFReDf3FWlYdM9uXtanYPIafgPb6GVTQczS_xJAXD0,60
28
28
  topologicpy/bin/linux/topologic/libTKBO-6bdf205d.so.7.7.0,sha256=ANok9DQKcnWcLd9T_LAt-i-X4nsYYy16q9kQlcTre1E,2996488
29
29
  topologicpy/bin/linux/topologic/libTKBRep-2960a069.so.7.7.0,sha256=OJ3XesL79du8LeBHrsleGPXub6OpJdOilxha0mwjqQo,1378768
@@ -84,8 +84,8 @@ topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd,sha256=F0sPLuMpD
84
84
  topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd,sha256=aBAJQj3OmJ58MOAF1ZIFybL_5fFK7FNR9hrIps6b6pc,1551872
85
85
  topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd,sha256=aLgNf54nbJmGc7Tdmkuy-V0m6B9zLxabIbpRwAy7cBA,1551360
86
86
  topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd,sha256=_8cp205hiRxkFHtzQQOweA4DhCPk8caH4kTVLWGQeVw,1411584
87
- topologicpy-0.4.75.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
88
- topologicpy-0.4.75.dist-info/METADATA,sha256=eeXMZOoeqEX35lE8WX81atMRaTrz-qy5gF1YOMY19Dk,7252
89
- topologicpy-0.4.75.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
90
- topologicpy-0.4.75.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
91
- topologicpy-0.4.75.dist-info/RECORD,,
87
+ topologicpy-0.4.77.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
88
+ topologicpy-0.4.77.dist-info/METADATA,sha256=u2Tw8i9lrJBM4zcsmXBNZbaPhNTVYr0pxTy3k2DczRE,7252
89
+ topologicpy-0.4.77.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
90
+ topologicpy-0.4.77.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
91
+ topologicpy-0.4.77.dist-info/RECORD,,