topologicpy 0.7.34__py3-none-any.whl → 0.7.36__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
@@ -276,9 +276,9 @@ class Face():
276
276
  return face
277
277
 
278
278
  @staticmethod
279
- def ByOffset(face, offset: float = 1.0, tolerance: float = 0.0001):
279
+ def ByOffset(face, offset: float = 1.0, offsetKey: str = "offset", stepOffsetA: float = 0, stepOffsetB: float = 0, stepOffsetKeyA: str = "stepOffsetA", stepOffsetKeyB: str = "stepOffsetB", reverse: bool = False, bisectors: bool = False, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False):
280
280
  """
281
- Creates an offset face from the input face. A positive offset value results in a smaller face to the inside of the input face.
281
+ Creates an offset face from the input face. A positive offset value results in an offset to the interior of an anti-clockwise face.
282
282
 
283
283
  Parameters
284
284
  ----------
@@ -286,32 +286,105 @@ class Face():
286
286
  The input face.
287
287
  offset : float , optional
288
288
  The desired offset distance. The default is 1.0.
289
+ offsetKey : str , optional
290
+ The edge dictionary key under which to find the offset value. If a value cannot be found, the offset input parameter value is used instead. The default is "offset".
291
+ stepOffsetA : float , optional
292
+ The amount to offset along the previous edge when transitioning between parallel edges with different offsets. The default is 0.
293
+ stepOffsetB : float , optional
294
+ The amount to offset along the next edge when transitioning between parallel edges with different offsets. The default is 0.
295
+ stepOffsetKeyA : str , optional
296
+ The vertex dictionary key under which to find the step offset A value. If a value cannot be found, the stepOffsetA input parameter value is used instead. The default is "stepOffsetA".
297
+ stepOffsetKeyB : str , optional
298
+ The vertex dictionary key under which to find the step offset B value. If a value cannot be found, the stepOffsetB input parameter value is used instead. The default is "stepOffsetB".
299
+ bisectors : bool , optional
300
+ If set to True, The bisectors (seams) edges will be included in the returned wire. This will result in the returned shape to be a shell rather than a face. The default is False.
301
+ reverse : bool , optional
302
+ If set to True, the direction of offsets is reversed. Otherwise, it is not. The default is False.
303
+ transferDictionaries : bool , optional
304
+ If set to True, the dictionaries of the original wire, its edges, and its vertices are transfered to the new wire. Otherwise, they are not. The default is False.
289
305
  tolerance : float , optional
290
306
  The desired tolerance. The default is 0.0001.
307
+ silent : bool , optional
308
+ If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
291
309
 
292
310
  Returns
293
311
  -------
294
- topologic_core.Face
295
- The created face.
312
+ topologic_core.Face or topologic_core.Shell
313
+ The created face or shell.
296
314
 
297
315
  """
298
316
  from topologicpy.Wire import Wire
317
+ from topologicpy.Cluster import Cluster
299
318
  from topologicpy.Topology import Topology
319
+ from topologicpy.Helper import Helper
300
320
 
301
321
  if not Topology.IsInstance(face, "Face"):
302
- print("Face.ByOffset - Warning: The input face parameter is not a valid face. Returning None.")
322
+ if not silent:
323
+ print("Face.ByOffset - Warning: The input face parameter is not a valid face. Returning None.")
303
324
  return None
325
+
304
326
  eb = Face.Wire(face)
305
327
  internal_boundaries = Face.InternalBoundaries(face)
306
- offset_external_boundary = Wire.ByOffset(wire=eb, offset=offset, bisectors=False, tolerance=tolerance)
328
+ offset_external_boundary = Wire.ByOffset(eb,
329
+ offset=offset,
330
+ offsetKey=offsetKey,
331
+ stepOffsetA=stepOffsetA,
332
+ stepOffsetB=stepOffsetB,
333
+ stepOffsetKeyA=stepOffsetKeyA,
334
+ stepOffsetKeyB=stepOffsetKeyB,
335
+ reverse=reverse,
336
+ bisectors=bisectors,
337
+ transferDictionaries=transferDictionaries,
338
+ tolerance=tolerance,
339
+ silent=silent)
307
340
  offset_internal_boundaries = []
308
341
  for internal_boundary in internal_boundaries:
309
- offset_internal_boundaries.append(Wire.ByOffset(wire=internal_boundary, offset=offset, bisectors=False, tolerance=tolerance))
310
- face = Face.ByWires(offset_external_boundary, offset_internal_boundaries, tolerance=tolerance)
311
- if not Topology.IsInstance(face, "Face"):
312
- print("Face.ByOffset - Warning: Could not create face from wires. Returning None.")
342
+ offset_internal_boundary = Wire.ByOffset(internal_boundary,
343
+ offset=offset,
344
+ offsetKey=offsetKey,
345
+ stepOffsetA=stepOffsetA,
346
+ stepOffsetB=stepOffsetB,
347
+ stepOffsetKeyA=stepOffsetKeyA,
348
+ stepOffsetKeyB=stepOffsetKeyB,
349
+ reverse=reverse,
350
+ bisectors=bisectors,
351
+ transferDictionaries=transferDictionaries,
352
+ tolerance=tolerance,
353
+ silent=silent)
354
+ offset_internal_boundaries.append(offset_internal_boundary)
355
+
356
+ if bisectors == True:
357
+ return_face = Face.ByOffset(face,
358
+ offset=offset,
359
+ offsetKey=offsetKey,
360
+ stepOffsetA=stepOffsetA,
361
+ stepOffsetB=stepOffsetB,
362
+ stepOffsetKeyA=stepOffsetKeyA,
363
+ stepOffsetKeyB=stepOffsetKeyB,
364
+ reverse=reverse,
365
+ bisectors=False,
366
+ transferDictionaries=transferDictionaries,
367
+ tolerance=tolerance,
368
+ silent=silent)
369
+ all_edges = Topology.Edges(offset_external_boundary)+[Topology.Edges(ib) for ib in offset_internal_boundaries]
370
+ all_edges += Topology.Edges(face)
371
+ all_edges = Helper.Flatten(all_edges)
372
+ all_edges_cluster = Cluster.ByTopologies(all_edges)
373
+ if reverse == True:
374
+ return_face = Topology.Slice(return_face, all_edges_cluster)
375
+ else:
376
+ return_face = Topology.Slice(face, all_edges_cluster)
377
+ if not Topology.IsInstance(return_face, "Shell"):
378
+ if not silent:
379
+ print("Face.ByOffset - Warning: Could not create shell by slicing. Returning None.")
380
+ return None
381
+ return return_face
382
+ return_face = Face.ByWires(offset_external_boundary, offset_internal_boundaries, tolerance=tolerance)
383
+ if not Topology.IsInstance(return_face, "Face"):
384
+ if not silent:
385
+ print("Face.ByOffset - Warning: Could not create face from wires. Returning None.")
313
386
  return None
314
- return face
387
+ return return_face
315
388
 
316
389
  @staticmethod
317
390
  def ByShell(shell, origin= None, angTolerance: float = 0.1, tolerance: float = 0.0001, silent=False):
@@ -563,7 +636,7 @@ class Face():
563
636
  The input wire.
564
637
  tolerance : float , optional
565
638
  The desired tolerance. The default is 0.0001.
566
- silent : bool , optional
639
+ silent : bool , optional
567
640
  If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
568
641
 
569
642
  Returns
topologicpy/Wire.py CHANGED
@@ -310,7 +310,7 @@ class Wire():
310
310
  return Wire.ByEdges(edges, tolerance=tolerance)
311
311
 
312
312
  @staticmethod
313
- def ByOffset(wire, offset: float = 1.0, offsetKey: str = "offset", stepOffsetA: float = 0, stepOffsetB: float = 0, stepOffsetKeyA: str = "stepOffsetA", stepOffsetKeyB: str = "stepOffsetB", bisectors: bool = False, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False):
313
+ def ByOffset(wire, offset: float = 1.0, offsetKey: str = "offset", stepOffsetA: float = 0, stepOffsetB: float = 0, stepOffsetKeyA: str = "stepOffsetA", stepOffsetKeyB: str = "stepOffsetB", reverse: bool = False, bisectors: bool = False, transferDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False):
314
314
  """
315
315
  Creates an offset wire from the input wire. A positive offset value results in an offset to the interior of an anti-clockwise wire.
316
316
 
@@ -330,9 +330,11 @@ class Wire():
330
330
  The vertex dictionary key under which to find the step offset A value. If a value cannot be found, the stepOffsetA input parameter value is used instead. The default is "stepOffsetA".
331
331
  stepOffsetKeyB : str , optional
332
332
  The vertex dictionary key under which to find the step offset B value. If a value cannot be found, the stepOffsetB input parameter value is used instead. The default is "stepOffsetB".
333
+ reverse : bool , optional
334
+ If set to True, the direction of offsets is reversed. Otherwise, it is not. The default is False.
333
335
  bisectors : bool , optional
334
336
  If set to True, The bisectors (seams) edges will be included in the returned wire. The default is False.
335
- tranferDictionaries : bool , optional
337
+ transferDictionaries : bool , optional
336
338
  If set to True, the dictionaries of the original wire, its edges, and its vertices are transfered to the new wire. Otherwise, they are not. The default is False.
337
339
  tolerance : float , optional
338
340
  The desired tolerance. The default is 0.0001.
@@ -359,6 +361,10 @@ class Wire():
359
361
  print("Wire.ByOffset - Error: The input wire parameter is not a valid wire. Returning None.")
360
362
  return None
361
363
 
364
+ if reverse == True:
365
+ fac = -1
366
+ else:
367
+ fac = 1
362
368
  origin = Vertex.Origin()
363
369
  temp_vertices = [Topology.Vertices(wire)[0], Topology.Vertices(wire)[1], Topology.Centroid(wire)]
364
370
  temp_face = Face.ByWire(Wire.ByVertices(temp_vertices, close=True))
@@ -377,6 +383,7 @@ class Wire():
377
383
  d_offset = Dictionary.ValueAtKey(d, offsetKey)
378
384
  if d_offset == None:
379
385
  d_offset = offset
386
+ d_offset = d_offset*fac
380
387
  offsets.append(d_offset)
381
388
  offset_edge = Edge.ByOffset2D(edge, d_offset)
382
389
  offset_edges.append(offset_edge)
@@ -387,7 +394,6 @@ class Wire():
387
394
  if Wire.IsClosed(wire) == False:
388
395
  v1 = Edge.StartVertex(offset_edges[0])
389
396
  if transferDictionaries == True:
390
- d_temp = Topology.Dictionary(v_a)
391
397
  v1 = Topology.SetDictionary(v1, Topology.Dictionary(v_a), silent=True)
392
398
  edge_dictionaries.append(Topology.Dictionary(edges[i]))
393
399
  final_vertices.append(v1)
@@ -400,7 +406,6 @@ class Wire():
400
406
  if bisectors == True:
401
407
  bisectors_list.append(Edge.ByVertices(v_a, v1))
402
408
  if transferDictionaries == True:
403
- d_temp = Topology.Dictionary(v_a)
404
409
  v1 = Topology.SetDictionary(v1, Topology.Dictionary(v_a))
405
410
  edge_dictionaries.append(Topology.Dictionary(edges[i]))
406
411
  final_vertices.append(v1)
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.34'
1
+ __version__ = '0.7.36'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.34
3
+ Version: 0.7.36
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
@@ -9,7 +9,7 @@ topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
9
9
  topologicpy/Dictionary.py,sha256=KqJ29YyE23Y3Xc6XmKLSCZXRfBvm-OEOxlMZ4dt-rfM,27094
10
10
  topologicpy/Edge.py,sha256=vhYHkobSLGSWV-oe2oJFFDobqFToDyb7s71yQ840AAA,65166
11
11
  topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
12
- topologicpy/Face.py,sha256=u-DPS5guhzfwxZUuUNYqtPJG6OdeHpY1XQHRSKn6rqk,110148
12
+ topologicpy/Face.py,sha256=SrP7LbOK9wjArYTO2fDVrtxItGXNkCMqmMRNz4-46gA,115473
13
13
  topologicpy/Graph.py,sha256=ICwFUYLka6tEPMo43I9QAe24ljItMUZOZYL21xpDPIg,392146
14
14
  topologicpy/Grid.py,sha256=Q-2WNBkvIsJks7pbGkzzkRWVB4fTMYgWipG3lcDXbpE,18496
15
15
  topologicpy/Helper.py,sha256=mLwJmhyc-d-JqW82MBf7JwM91zWHVx8RzOmndPWHm-k,17717
@@ -24,11 +24,11 @@ topologicpy/Sun.py,sha256=_gZfVyH0SDLQmmt775UeeAJ_BtwXO1STQnUMV1qkU0s,37161
24
24
  topologicpy/Topology.py,sha256=iL2kCRHtFTMBqFbvdJy_-E0NtLChsD7606x_F1UrKFE,362074
25
25
  topologicpy/Vector.py,sha256=WQQUbwrg7VKImtxuBUi2i-FRiPT77WlrzLP05gdXKM8,33079
26
26
  topologicpy/Vertex.py,sha256=EQdVYHmW85_pZdHZB3N8pEi0GiadCCkF3z_oqohA7B0,71161
27
- topologicpy/Wire.py,sha256=Luau9ko3AA-CxPx--JX_OzscSFgUU23m8_bs5KNYgHc,153544
27
+ topologicpy/Wire.py,sha256=Ls2ItdNQ_qbC1RUc8bAtGbM5B5A-uShjHdiOFVVwx-8,153711
28
28
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
29
- topologicpy/version.py,sha256=cxijp04lr4v3ZnLuLmrlFIoTuvxTkFkuNf13YTxYPmo,23
30
- topologicpy-0.7.34.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
31
- topologicpy-0.7.34.dist-info/METADATA,sha256=YtAZb3NSLWZL8AsRQy3xLzd7Ja1pvRnrgypt0V_hKVE,10916
32
- topologicpy-0.7.34.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
33
- topologicpy-0.7.34.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
34
- topologicpy-0.7.34.dist-info/RECORD,,
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,,