topologicpy 0.7.19__py3-none-any.whl → 0.7.20__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/Face.py CHANGED
@@ -189,7 +189,13 @@ class Face():
189
189
  from topologicpy.Topology import Topology
190
190
 
191
191
  br_wire = Wire.BoundingRectangle(topology=topology, optimize=optimize, tolerance=tolerance)
192
+ if not Topology.IsInstance(br_wire, "Wire"):
193
+ print("Face.BoundingRectangle - Warning: Could not create base wire. Returning None.")
194
+ return None
192
195
  br_face = Face.ByWire(br_wire)
196
+ if not Topology.IsInstance(br_face, "Face"):
197
+ print("Face.BoundingRectangle - Warning: Could not create face from base wire. Returning None.")
198
+ return None
193
199
  br_face = Topology.SetDictionary(br_face, Topology.Dictionary(br_wire))
194
200
  return br_face
195
201
 
@@ -225,7 +231,11 @@ class Face():
225
231
  if not Topology.IsInstance(wire, "Wire"):
226
232
  print("Face.ByEdges - Error: Could not create the required wire. Returning None.")
227
233
  return None
228
- return Face.ByWire(wire, tolerance=tolerance)
234
+ face = Face.ByWire(wire, tolerance=tolerance)
235
+ if not Topology.IsInstance(face, "Face"):
236
+ print("Face.ByEdges - Warning: Could not create face from base wire. Returning None.")
237
+ return None
238
+ return face
229
239
 
230
240
  @staticmethod
231
241
  def ByEdgesCluster(cluster, tolerance: float = 0.0001):
@@ -255,7 +265,11 @@ class Face():
255
265
  if len(edges) < 1:
256
266
  print("Face.ByEdgesCluster - Warning: The input cluster parameter does not contain any valid edges. Returning None.")
257
267
  return None
258
- return Face.ByEdges(edges, tolerance=tolerance)
268
+ face = Face.ByEdges(edges, tolerance=tolerance)
269
+ if not Topology.IsInstance(face, "Face"):
270
+ print("Face.ByEdgesCluster - Warning: Could not create face from edges. Returning None.")
271
+ return None
272
+ return face
259
273
 
260
274
  @staticmethod
261
275
  def ByOffset(face, offset: float = 1.0, tolerance: float = 0.0001):
@@ -289,7 +303,11 @@ class Face():
289
303
  offset_internal_boundaries = []
290
304
  for internal_boundary in internal_boundaries:
291
305
  offset_internal_boundaries.append(Wire.ByOffset(wire=internal_boundary, offset=offset, bisectors=False, tolerance=tolerance))
292
- return Face.ByWires(offset_external_boundary, offset_internal_boundaries, tolerance=tolerance)
306
+ face = Face.ByWires(offset_external_boundary, offset_internal_boundaries, tolerance=tolerance)
307
+ if not Topology.IsInstance(face, "Face"):
308
+ print("Face.ByOffset - Warning: Could not create face from wires. Returning None.")
309
+ return None
310
+ return face
293
311
 
294
312
  @staticmethod
295
313
  def ByShell(shell, origin= None, angTolerance: float = 0.1, tolerance: float = 0.0001, silent=False):
topologicpy/Graph.py CHANGED
@@ -280,7 +280,7 @@ class Graph:
280
280
  vertexLabelKey : str , optional
281
281
  The returned vertices are labelled according to the dictionary values stored under this key.
282
282
  If the vertexLabelKey does not exist, it will be created and the vertices are labelled numerically and stored in the vertex dictionary under this key. The default is "label".
283
- edgeWeightKey : str , optional
283
+ edgeKey : str , optional
284
284
  If set, the edges' dictionaries will be searched for this key to set their weight. If the key is set to "length" (case insensitive), the length of the edge will be used as its weight. If set to None, a weight of 1 will be used. The default is "Length".
285
285
  reverse : bool , optional
286
286
  If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not. The default is False.
@@ -515,8 +515,10 @@ class Graph:
515
515
  The input graph.
516
516
  edge : topologic_core.Edge
517
517
  The input edge.
518
- transferDictionaries : bool, optional
519
- If set to True, the dictionaries of the edge and its vertices are transferred to the graph.
518
+ transferVertexDictionaries : bool, optional
519
+ If set to True, the dictionaries of the vertices are transferred to the graph.
520
+ transferEdgeDictionaries : bool, optional
521
+ If set to True, the dictionaries of the edges are transferred to the graph.
520
522
  tolerance : float , optional
521
523
  The desired tolerance. The default is 0.0001.
522
524
 
topologicpy/Shell.py CHANGED
@@ -1419,6 +1419,7 @@ class Shell():
1419
1419
  shell = Topology.RemoveCoplanarFaces(shell, epsilon=epsilon, tolerance=tolerance)
1420
1420
  except:
1421
1421
  pass
1422
+ shell = Topology.Unflatten(shell, origin=origin, direction=normal)
1422
1423
  return shell
1423
1424
 
1424
1425
  @staticmethod
@@ -1519,11 +1520,18 @@ class Shell():
1519
1520
  if not Topology.IsInstance(face, "Face"):
1520
1521
  return None
1521
1522
  roof = Wire.Skeleton(face, tolerance=tolerance)
1522
- if not roof:
1523
+ if not (Topology.IsInstance(roof, "Wire") or Topology.IsInstance(roof, "Cluster")):
1524
+ print("Shell.Skeleton - Error: Could not create base skeleton wire. Returning None.")
1523
1525
  return None
1524
1526
  br = Wire.BoundingRectangle(roof) #This works even if it is a Cluster not a Wire
1527
+ if not Topology.IsInstance(br, "Wire"):
1528
+ print("Shell.Skeleton - Error: Could not create a bounding rectangle wire. Returning None.")
1529
+ return None
1525
1530
  br = Topology.Scale(br, Topology.Centroid(br), 1.5, 1.5, 1)
1526
1531
  bf = Face.ByWire(br, tolerance=tolerance)
1532
+ if not Topology.IsInstance(bf, "Face"):
1533
+ print("Shell.Skeleton - Error: Could not create a bounding rectangle face. Returning None.")
1534
+ return None
1527
1535
  large_shell = Topology.Boolean(bf, roof, operation="slice", tolerance=tolerance)
1528
1536
  if not large_shell:
1529
1537
  return None
@@ -1536,6 +1544,9 @@ class Shell():
1536
1544
  if len(internalBoundaries) == 0:
1537
1545
  final_faces.append(f)
1538
1546
  shell = Shell.ByFaces(final_faces, tolerance=tolerance)
1547
+ if not Topology.IsInstance(shell, "Shell"):
1548
+ print("Shell.Skeleton - Error: Could not create shell. Returning None.")
1549
+ return None
1539
1550
  return shell
1540
1551
 
1541
1552
  @staticmethod
topologicpy/Wire.py CHANGED
@@ -152,7 +152,9 @@ class Wire(Topology):
152
152
  topology : topologic_core.Topology
153
153
  The input topology.
154
154
  optimize : int , optional
155
- If set to an integer from 1 (low optimization) to 10 (high optimization), the method will attempt to optimize the bounding rectangle so that it reduces its surface area. The default is 0 which will result in an axis-aligned bounding rectangle. The default is 0.
155
+ If set to an integer from 1 (low optimization) to 10 (high optimization), the method will attempt to optimize the bounding rectangle so that it reduces its surface area.
156
+ The minimum optimization number of 0 will result in an axis-aligned bounding rectangle.
157
+ A maximum optimization number of 10 will attempt to reduce the bounding rectangle's area by 50%. The default is 0.
156
158
  mantissa : int , optional
157
159
  The desired length of the mantissa. The default is 6.
158
160
  tolerance : float , optional
@@ -190,9 +192,11 @@ class Wire(Topology):
190
192
  if not Topology.IsInstance(topology, "Topology"):
191
193
  return None
192
194
 
193
- world_origin = Vertex.Origin()
194
195
 
195
196
  vertices = Topology.SubTopologies(topology=topology, subTopologyType="vertex")
197
+ if Vertex.AreCollinear(vertices, mantissa=mantissa, tolerance=tolerance):
198
+ print("Wire.BoundingRectangle - Error: All vertices of the input topology parameter are collinear and thus no bounding rectangle can be created. Returning None.")
199
+ return None
196
200
  start = time.time()
197
201
  period = 0
198
202
  result = True
@@ -205,7 +209,13 @@ class Wire(Topology):
205
209
  print("Wire.BoundingRectangle - Error: Could not find three vertices that are not colinear within 30 seconds. Returning None.")
206
210
  return None
207
211
  w = Wire.ByVertices(vList)
212
+ if not Topology.IsInstance(w, "Wire"):
213
+ print("Wire.BoundingRectangle - Error: Could not create wire from three vertices. Returning None.")
214
+ return None
208
215
  f = Face.ByWire(w, tolerance=tolerance)
216
+ if not Topology.IsInstance(f, "Face"):
217
+ print("Wire.BoundingRectangle - Error: Could not create face from wire. Returning None.")
218
+ return None
209
219
  f_origin = Topology.Centroid(f)
210
220
  normal = Face.Normal(f, mantissa=mantissa)
211
221
  topology = Topology.Flatten(topology, origin=f_origin, direction=normal)
@@ -224,7 +234,7 @@ class Wire(Topology):
224
234
  origin = Topology.Centroid(topology)
225
235
  optimize = min(max(optimize, 0), 10)
226
236
  if optimize > 0:
227
- factor = (round(((11 - optimize)/30 + 0.57), 2))
237
+ factor = 1.0 - float(optimize)*0.05 # This will give a range of 0 to 0.5. Equivalent to a maximum 50% reduction in area.
228
238
  flag = False
229
239
  for n in range(10, 0, -1):
230
240
  if flag:
@@ -240,7 +250,7 @@ class Wire(Topology):
240
250
  w = abs(maxX - minX)
241
251
  l = abs(maxY - minY)
242
252
  area = l*w
243
- if area < orig_area*factor:
253
+ if area <= orig_area*factor: # If new area is less than or equal to a certain percentage of the original area then break. e.g. if area is less than or qual to 50% of original area then break.
244
254
  best_area = area
245
255
  best_z = z
246
256
  best_br = [minX, minY, maxX, maxY]
@@ -253,7 +263,6 @@ class Wire(Topology):
253
263
 
254
264
  else:
255
265
  best_br = boundingRectangle
256
-
257
266
  minX, minY, maxX, maxY = best_br
258
267
  vb1 = Vertex.ByCoordinates(minX, minY, 0)
259
268
  vb2 = Vertex.ByCoordinates(maxX, minY, 0)
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.19'
1
+ __version__ = '0.7.20'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.19
3
+ Version: 0.7.20
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
@@ -1,4 +1,4 @@
1
- topologicpy/ANN.py,sha256=MPgMJxJVdEt0ETpxt1TliUosByDEqKQcKq7iqrJjRXc,53073
1
+ topologicpy/ANN.py,sha256=H_L81-RLdmzL0wehqcZz9IUgRENFxIH7mYxS3aKL7oE,48982
2
2
  topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
3
3
  topologicpy/Cell.py,sha256=1AAruEDSUJqQFED7fL5-nTon2lR1FrkZxo59iEHOCY0,99833
4
4
  topologicpy/CellComplex.py,sha256=Fd70Dj7E4LqV5O-7kcCCYnrFEyqheZvxc0YWktm0EL8,47440
@@ -9,8 +9,8 @@ topologicpy/DGL.py,sha256=5jNn1L8F8REx1-oAh9sr_cfil0R5kUuueCNDKwNU_GM,138991
9
9
  topologicpy/Dictionary.py,sha256=pMbfE2RYGCNpVr2x58qiHRc-aBWnp1jLlyzwS9nz6-w,25891
10
10
  topologicpy/Edge.py,sha256=f7LjP662_yoqopAXBh1Gqv8DvdzvfM_heJTP2XnFskY,58447
11
11
  topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
12
- topologicpy/Face.py,sha256=1J1dnS3tNnaoFQyWdWjn9YnHldyiN-J67IjytIT0-R4,108142
13
- topologicpy/Graph.py,sha256=JM4N6EShvDspFcE9_E027HKAkHhZ5e5UD4I9LxlRfmA,391560
12
+ topologicpy/Face.py,sha256=DpV4ZOurOmqV3H3cDZG8FIt9NSm1DspYQjSIwfyzJjE,109083
13
+ topologicpy/Graph.py,sha256=tafjhTMr4cixcQnyj6FaIeDucc0SGTwn7kNFtnU4Q0U,391685
14
14
  topologicpy/Grid.py,sha256=Cpzs9l5-SptMQbUR8AvbbIOHrGMGlK0Qx8FWmQBgvX0,18497
15
15
  topologicpy/Helper.py,sha256=07V9IFu5ilMpvAdZVhIbdBOjBJSRTtJ0BfR1IoRaRXU,17743
16
16
  topologicpy/Honeybee.py,sha256=dlr5OEH93q51ZmEgvi8PXGfCHBDAjIZ1cm38Rft1Bz4,20235
@@ -18,17 +18,17 @@ topologicpy/Matrix.py,sha256=VV-kbT0Qt5QO38HRFJmD4IMnQUzYbLjBF4xaFAqLh3Q,8352
18
18
  topologicpy/Neo4j.py,sha256=Gy2PS4Ky8BNhohKreoV4zgzW9OXCjhSwiZF_Aq21_wU,19589
19
19
  topologicpy/Plotly.py,sha256=6ZYVAvSSDtoHZ7OsofIDwOKRDF_CTE_UOEzEtcxHAuU,98845
20
20
  topologicpy/Polyskel.py,sha256=pNawz5lnvy4oTzCL91fGY2PblW2hmcYBdT5268m2RZs,19743
21
- topologicpy/Shell.py,sha256=fdMhCKH5Oq2id16XjTWRe8-06jZ8z8LnrVqMR-33F3s,79144
21
+ topologicpy/Shell.py,sha256=gQZb0LEdzHjvQbjEOX5wT9fOYB71E6WkPLz9Kr1i4_s,79903
22
22
  topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
23
23
  topologicpy/Sun.py,sha256=mN3RzlslcZT3APUtwmWIXVbPkJ6OcKTaTf6338gbMJE,37152
24
24
  topologicpy/Topology.py,sha256=arsO_TXFLt_M0ulUIKIOgI-xn-gjrtwKlT6Je2_R-ZU,338696
25
25
  topologicpy/Vector.py,sha256=G4mIIcE5Y-EHfiNV_rxiOz8pJeV3NMEwLu5EOgM0gKA,32653
26
26
  topologicpy/Vertex.py,sha256=bD3JnNhizbp6HFhHRve2LK_y5w27jytCbsagOLxKjZQ,71198
27
- topologicpy/Wire.py,sha256=vkDmfHjV7_ejZmrnCWFf4zdhhoI88ZDWY9Su_TQwjas,143577
27
+ topologicpy/Wire.py,sha256=ujU77xbwsmZqMmlIhfAlmJsM32ZXWoxCSM7Pc7Yj4T0,144545
28
28
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
29
- topologicpy/version.py,sha256=UOy-EMduBicLVj1Dfuz2h9Dr9n4BtAE9AAVmMLbBN6s,23
30
- topologicpy-0.7.19.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
31
- topologicpy-0.7.19.dist-info/METADATA,sha256=SYu8MxTVov2F8IWtiwnK1YLB_kEPdVrhEjn8omSXefU,10916
32
- topologicpy-0.7.19.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
33
- topologicpy-0.7.19.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
34
- topologicpy-0.7.19.dist-info/RECORD,,
29
+ topologicpy/version.py,sha256=VIiPuXuXNrG_S2UPdi_XO4PF0FZA9CnJGIDymw2UNro,23
30
+ topologicpy-0.7.20.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
31
+ topologicpy-0.7.20.dist-info/METADATA,sha256=kVffMsaS5-2HNrTirl-E14NV4ugX2IVruTcXx98-UXw,10916
32
+ topologicpy-0.7.20.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
33
+ topologicpy-0.7.20.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
34
+ topologicpy-0.7.20.dist-info/RECORD,,