topologicpy 0.2.1__py3-none-any.whl → 0.2.3__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/Plotly.py CHANGED
@@ -92,7 +92,7 @@ class Plotly:
92
92
  edgeGroupKey : str , optional
93
93
  The dictionary key to use to display the edge group. The default is None.
94
94
  edgeColor : str , optional
95
- The desired color of the output wires (edges). This can be any plotly color string and may be specified as:
95
+ The desired color of the output edges. This can be any plotly color string and may be specified as:
96
96
  - A hex string (e.g. '#ff0000')
97
97
  - An rgb/rgba string (e.g. 'rgb(255,0,0)')
98
98
  - An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
@@ -250,14 +250,14 @@ class Plotly:
250
250
  return data
251
251
 
252
252
  @staticmethod
253
- def DataByTopology(topology, vertexLabelKey=None, vertexGroupKey=None, edgeLabelKey=None, edgeGroupKey=None, faceLabelKey=None, faceGroupKey=None, vertexGroups=[], edgeGroups=[], faceGroups=[], faceColor="white", faceOpacity=0.5, edgeColor="black", edgeWidth=1, vertexColor="black", vertexSize=1.1, showFaces=True, showEdges=True, showVertices=True):
253
+ def DataByTopology(topology, vertexLabelKey=None, vertexGroupKey=None, edgeLabelKey=None, edgeGroupKey=None, faceLabelKey=None, faceGroupKey=None, vertexGroups=[], edgeGroups=[], faceGroups=[], faceColor="white", faceOpacity=0.5, edgeColor="black", edgeWidth=1, vertexColor="black", vertexSize=1.1, showFaces=True, showEdges=True, showVertices=True, verticesLabel="Topology Vertices", edgesLabel="Topology Edges", facesLabel="Topology Faces"):
254
254
  """
255
- Creates plotly face, wire, and vertex data.
255
+ Creates plotly face, edge, and vertex data.
256
256
 
257
257
  Parameters
258
258
  ----------
259
259
  topology : topologic.Topology
260
- The input topology. This must contain faces and or wires.
260
+ The input topology. This must contain faces and or edges.
261
261
  vertexLabelKey : str , optional
262
262
  The dictionary key to use to display the vertex label. The default is None.
263
263
  vertexGroupKey : str , optional
@@ -287,7 +287,7 @@ class Plotly:
287
287
  faceOpacity : float , optional
288
288
  The desired opacity of the output faces (0=transparent, 1=opaque). The default is 0.5.
289
289
  edgeColor : str , optional
290
- The desired color of the output wires (edges). This can be any plotly color string and may be specified as:
290
+ The desired color of the output edges. This can be any plotly color string and may be specified as:
291
291
  - A hex string (e.g. '#ff0000')
292
292
  - An rgb/rgba string (e.g. 'rgb(255,0,0)')
293
293
  - An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
@@ -312,7 +312,12 @@ class Plotly:
312
312
  If set to True the edges will be drawn. Otherwise, they will not be drawn. The default is True.
313
313
  showVertices : bool , optional
314
314
  If set to True the vertices will be drawn. Otherwise, they will not be drawn. The default is True.
315
-
315
+ verticesLabel : str , optional
316
+ The legend label string used to identify vertices. The default is "Topology Vertices".
317
+ edgesLabel : str , optional
318
+ The legend label string used to identify edges. The default is "Topology Edges".
319
+ facesLabel : str , optional
320
+ The legend label string used to idenitfy edges. The default is "Topology Faces".
316
321
  Returns
317
322
  -------
318
323
  list
@@ -322,7 +327,7 @@ class Plotly:
322
327
  from topologicpy.Topology import Topology
323
328
  from topologicpy.Dictionary import Dictionary
324
329
 
325
- def vertexData(vertices, dictionaries=None, vertexColor="black", vertexSize=1.1, vertexLabelKey=None, vertexGroupKey=None, vertexGroups=[]):
330
+ def vertexData(vertices, dictionaries=None, vertexColor="black", vertexSize=1.1, vertexLabelKey=None, vertexGroupKey=None, vertexGroups=[], verticesLabel="Topology Vertices"):
326
331
  x = []
327
332
  y = []
328
333
  z = []
@@ -368,7 +373,7 @@ class Plotly:
368
373
  return go.Scatter3d(x=x,
369
374
  y=y,
370
375
  z=z,
371
- name='Topology Vertices',
376
+ name=verticesLabel,
372
377
  showlegend=True,
373
378
  marker=dict(color=v_groupList, size=vertexSize),
374
379
  mode='markers',
@@ -378,7 +383,7 @@ class Plotly:
378
383
  hoverinfo='text',
379
384
  hovertext=v_labels)
380
385
 
381
- def edgeData(vertices, edges, dictionaries=None, edgeColor="black", edgeWidth=1, edgeLabelKey=None, edgeGroupKey=None, edgeGroups=[]):
386
+ def edgeData(vertices, edges, dictionaries=None, edgeColor="black", edgeWidth=1, edgeLabelKey=None, edgeGroupKey=None, edgeGroups=[], edgesLabel="Topology Edges"):
382
387
  x = []
383
388
  y = []
384
389
  z = []
@@ -427,7 +432,7 @@ class Plotly:
427
432
  return go.Scatter3d(x=x,
428
433
  y=y,
429
434
  z=z,
430
- name="Topology Edges",
435
+ name=edgesLabel,
431
436
  showlegend=True,
432
437
  marker_size=0,
433
438
  mode="lines",
@@ -554,7 +559,7 @@ class Plotly:
554
559
  ev = Edge.EndVertex(tp_edge)
555
560
  ei = Vertex.Index(ev, tp_verts)
556
561
  edges.append([si, ei])
557
- data.append(edgeData(vertices, edges, dictionaries=[], edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups))
562
+ data.append(edgeData(vertices, edges, dictionaries=[], edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, edgesLabel=edgesLabel))
558
563
  if showFaces and topology.Type() >= topologic.Face.Type():
559
564
  tp_faces = Topology.SubTopologies(topology, subTopologyType="face")
560
565
  triangles = []
@@ -591,6 +596,7 @@ class Plotly:
591
596
  height=500,
592
597
  showScale = True,
593
598
  colorScale='Viridis',
599
+ colorSamples=10,
594
600
  backgroundColor='rgba(0,0,0,0)',
595
601
  marginLeft=0,
596
602
  marginRight=0,
@@ -623,6 +629,8 @@ class Plotly:
623
629
  If set to True, a color scale is shown on the right side of the figure. The default is True.
624
630
  colorScale : str , optional
625
631
  The desired type of plotly color scales to use (e.g. "Viridis", "Plasma"). The default is "Viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
632
+ colorSamples : int , optional
633
+ The number of discrete color samples to use for displaying the data. The default is 10.
626
634
  backgroundColor : str , optional
627
635
  The desired background color. This can be any plotly color string and may be specified as:
628
636
  - A hex string (e.g. '#ff0000')
@@ -643,9 +651,13 @@ class Plotly:
643
651
  """
644
652
  #import plotly.figure_factory as ff
645
653
  import plotly.graph_objects as go
654
+ import plotly.express as px
646
655
 
647
656
  annotations = []
648
-
657
+
658
+ # Transpose the confusion matrix
659
+ matrix = matrix.T
660
+ colors = px.colors.sample_colorscale(colorScale, [n/(colorSamples -1) for n in range(colorSamples)])
649
661
  if not minValue:
650
662
  minValue = 0
651
663
  if not maxValue:
@@ -655,10 +667,12 @@ class Plotly:
655
667
  for j, value in enumerate(row):
656
668
  annotations.append(
657
669
  {
658
- "x": categories[i],
659
- "y": categories[j],
660
- "font": {"color": "white"},
661
- "text": str(value),
670
+ "x": categories[j],
671
+ "y": categories[i],
672
+ "font": {"color": "black"},
673
+ "bgcolor": "white",
674
+ "opacity": 0.5,
675
+ "text": str(round(value,2)),
662
676
  "xref": "x1",
663
677
  "yref": "y1",
664
678
  "showarrow": False
@@ -670,16 +684,18 @@ class Plotly:
670
684
  for j, value in enumerate(row):
671
685
  annotations.append(
672
686
  {
673
- "x": categories[i],
674
- "y": categories[j],
675
- "font": {"color": "white"},
676
- "text": str(value),
687
+ "x": categories[j],
688
+ "y": categories[i],
689
+ "font": {"color": "black"},
690
+ "bgcolor": "white",
691
+ "opacity": 0.5,
692
+ "text": str(round(value,2)),
677
693
  "xref": "x1",
678
694
  "yref": "y1",
679
695
  "showarrow": False
680
696
  }
681
697
  )
682
- data = go.Heatmap(z=matrix, y=categories, x=categories, zmin=minValue, zmax=maxValue, showscale=showScale, colorscale=colorScale)
698
+ data = go.Heatmap(z=matrix, y=categories, x=categories, zmin=minValue, zmax=maxValue, showscale=showScale, colorscale=colors)
683
699
 
684
700
  layout = {
685
701
  "width": width,
@@ -690,7 +706,7 @@ class Plotly:
690
706
  "annotations": annotations,
691
707
  "paper_bgcolor": backgroundColor,
692
708
  "plot_bgcolor": backgroundColor,
693
- "margin":dict(l=marginLeft, r=marginRight, t=marginTop, b=marginBottom),
709
+ "margin":dict(l=marginLeft, r=marginRight, t=marginTop, b=marginBottom)
694
710
  }
695
711
  fig = go.Figure(data=data, layout=layout)
696
712
  return fig
@@ -752,7 +768,7 @@ class Plotly:
752
768
  return fig
753
769
 
754
770
  @staticmethod
755
- def FigureByData(data, color=None, width=950, height=500, xAxis=False, yAxis=False, zAxis=False, backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=20, marginBottom=0):
771
+ def FigureByData(data, color=None, width=950, height=500, xAxis=False, yAxis=False, zAxis=False, axisSize=1, backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=20, marginBottom=0):
756
772
  """
757
773
  Creates a plotly figure.
758
774
 
@@ -770,6 +786,8 @@ class Plotly:
770
786
  If set to True the y axis is drawn. Otherwise it is not drawn. The default is False.
771
787
  zAxis : bool , optional
772
788
  If set to True the z axis is drawn. Otherwise it is not drawn. The default is False.
789
+ axisSize : float , optional
790
+ The size of the X,Y,Z, axes. The default is 1.
773
791
  backgroundColor : str , optional
774
792
  The desired color of the background. This can be any plotly color string and may be specified as:
775
793
  - A hex string (e.g. '#ff0000')
@@ -800,24 +818,24 @@ class Plotly:
800
818
  return None
801
819
 
802
820
  v0 = Vertex.ByCoordinates(0,0,0)
803
- v1 = Vertex.ByCoordinates(1,0,0)
804
- v2 = Vertex.ByCoordinates(0,1,0)
805
- v3 = Vertex.ByCoordinates(0,0,1)
821
+ v1 = Vertex.ByCoordinates(axisSize,0,0)
822
+ v2 = Vertex.ByCoordinates(0,axisSize,0)
823
+ v3 = Vertex.ByCoordinates(0,0,axisSize)
806
824
 
807
825
  if xAxis:
808
826
  xEdge = Edge.ByVertices([v0,v1])
809
827
  xWire = Wire.ByEdges([xEdge])
810
- xData = Plotly.DataByTopology(xWire, wireColor="red", wireWidth=6, drawFaces=False, drawWires=True, drawVertices=False)
828
+ xData = Plotly.DataByTopology(xWire, edgeColor="red", edgeWidth=6, showFaces=False, showEdges=True, showVertices=False, edgesLabel="X-Axis")
811
829
  data = data + xData
812
830
  if yAxis:
813
831
  yEdge = Edge.ByVertices([v0,v2])
814
832
  yWire = Wire.ByEdges([yEdge])
815
- yData = Plotly.DataByTopology(yWire, wireColor="green", wireWidth=6, drawFaces=False, drawWires=True, drawVertices=False)
833
+ yData = Plotly.DataByTopology(yWire, edgeColor="green", edgeWidth=6, showFaces=False, showEdges=True, showVertices=False, edgesLabel="Y-Axis")
816
834
  data = data + yData
817
835
  if zAxis:
818
836
  zEdge = Edge.ByVertices([v0,v3])
819
837
  zWire = Wire.ByEdges([zEdge])
820
- zData = Plotly.DataByTopology(zWire, wireColor="blue", wireWidth=6, drawFaces=False, drawWires=True, drawVertices=False)
838
+ zData = Plotly.DataByTopology(zWire, edgeColor="blue", edgeWidth=6, showFaces=False, showEdges=True, showVertices=False, edgesLabel="Z-Axis")
821
839
  data = data + zData
822
840
 
823
841
  figure = go.Figure(data=data)
@@ -946,7 +964,7 @@ class Plotly:
946
964
  'iframe_connected', 'sphinx_gallery', 'sphinx_gallery_png']
947
965
 
948
966
  @staticmethod
949
- def ExportToImage(figure, filePath, format="png", width="1920", height="1080"):
967
+ def ExportToImage(figure, path, format="png", width="1920", height="1080"):
950
968
  """
951
969
  Exports the plotly figure to an image.
952
970
 
@@ -954,7 +972,7 @@ class Plotly:
954
972
  ----------
955
973
  figure : plotly.graph_objs._figure.Figure
956
974
  The input plotly figure.
957
- filePath : str
975
+ path : str
958
976
  The image file path.
959
977
  format : str , optional
960
978
  The desired format. This can be any of "jpg", "jpeg", "pdf", "png", "svg", or "webp". It is case insensitive. The default is "png".
@@ -971,13 +989,13 @@ class Plotly:
971
989
  """
972
990
  if not isinstance(figure, plotly.graph_objs._figure.Figure):
973
991
  return None
974
- if not isinstance(filePath, str):
992
+ if not isinstance(path, str):
975
993
  return None
976
994
  if not format.lower() in ["jpg", "jpeg", "pdf", "png", "svg", "webp"]:
977
995
  return None
978
996
  returnStatus = False
979
997
  try:
980
- plotly.io.write_image(figure, filePath, format=format.lower(), scale=None, width=width, height=height, validate=True, engine='auto')
998
+ plotly.io.write_image(figure, path, format=format.lower(), scale=None, width=width, height=height, validate=True, engine='auto')
981
999
  returnStatus = True
982
1000
  except:
983
1001
  returnStatus = False
topologicpy/Shell.py CHANGED
@@ -187,7 +187,7 @@ class Shell(Topology):
187
187
  return Shell.ByWires(wires, triangulate=triangulate, tolerance=tolerance)
188
188
 
189
189
  @staticmethod
190
- def Circle(origin=None, radius=0.5, sides=32, fromAngle=0, toAngle=360, dirX=0, dirY=0, dirZ=1, placement="center", tolerance=0.0001):
190
+ def Circle(origin=None, radius=0.5, sides=32, fromAngle=0, toAngle=360, direction=[0,0,1], placement="center", tolerance=0.0001):
191
191
  """
192
192
  Creates a circle.
193
193
 
@@ -203,12 +203,8 @@ class Shell(Topology):
203
203
  The angle in degrees from which to start creating the arc of the circle. The default is 0.
204
204
  toAngle : float , optional
205
205
  The angle in degrees at which to end creating the arc of the circle. The default is 360.
206
- dirX : float , optional
207
- The X component of the vector representing the up direction of the circle. The default is 0.
208
- dirY : float , optional
209
- The Y component of the vector representing the up direction of the circle. The default is 0.
210
- dirZ : float , optional
211
- The Z component of the vector representing the up direction of the circle. The default is 1.
206
+ direction : list , optional
207
+ The vector representing the up direction of the circle. The default is [0,0,1].
212
208
  placement : str , optional
213
209
  The description of the placement of the origin of the pie. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
214
210
  tolerance : float , optional
@@ -219,7 +215,7 @@ class Shell(Topology):
219
215
  topologic.Shell
220
216
  The created circle.
221
217
  """
222
- return Shell.Pie(origin=origin, radiusA=radius, radiusB=0, sides=sides, rings=1, fromAngle=fromAngle, toAngle=toAngle, dirX=dirX, dirY=dirY, dirZ=dirZ, placement=placement, tolerance=tolerance)
218
+ return Shell.Pie(origin=origin, radiusA=radius, radiusB=0, sides=sides, rings=1, fromAngle=fromAngle, toAngle=toAngle, direction=direction, placement=placement, tolerance=tolerance)
223
219
 
224
220
  @staticmethod
225
221
  def Delaunay(vertices, face=None):
@@ -393,7 +389,7 @@ class Shell(Topology):
393
389
  return faces
394
390
 
395
391
  @staticmethod
396
- def HyperbolicParaboloidRectangularDomain(origin=None, llVertex=None, lrVertex=None, ulVertex=None, urVertex=None, u=10, v=10, dirX=0, dirY=0, dirZ=1, placement="bottom"):
392
+ def HyperbolicParaboloidRectangularDomain(origin=None, llVertex=None, lrVertex=None, ulVertex=None, urVertex=None, u=10, v=10, direction=[0,0,1], placement="bottom"):
397
393
  """
398
394
  Creates a hyperbolic paraboloid with a rectangular domain.
399
395
 
@@ -413,14 +409,10 @@ class Shell(Topology):
413
409
  The number of segments along the X axis. The default is 10.
414
410
  v : int , optional
415
411
  The number of segments along the Y axis. The default is 10.
416
- dirX : float , optional
417
- The X component of the vector representing the up direction of the circle. The default is 0.
418
- dirY : float , optional
419
- The Y component of the vector representing the up direction of the circle. The default is 0.
420
- dirZ : float , optional
421
- The Z component of the vector representing the up direction of the circle. The default is 1.
412
+ direction : list , optional
413
+ The vector representing the up direction of the hyperbolic parabolid. The default is [0,0,1].
422
414
  placement : str , optional
423
- The description of the placement of the origin of the circle. This can be "center", "lowerleft", "bottom". It is case insensitive. The default is "center".
415
+ The description of the placement of the origin of the hyperbolic parabolid. This can be "center", "lowerleft", "bottom". It is case insensitive. The default is "center".
424
416
 
425
417
  Returns
426
418
  -------
@@ -487,9 +479,9 @@ class Shell(Topology):
487
479
  x1 = 0
488
480
  y1 = 0
489
481
  z1 = 0
490
- x2 = 0 + dirX
491
- y2 = 0 + dirY
492
- z2 = 0 + dirZ
482
+ x2 = 0 + direction[0]
483
+ y2 = 0 + direction[1]
484
+ z2 = 0 + direction[2]
493
485
  dx = x2 - x1
494
486
  dy = y2 - y1
495
487
  dz = z2 - z1
@@ -505,7 +497,7 @@ class Shell(Topology):
505
497
  return returnTopology
506
498
 
507
499
  @staticmethod
508
- def HyperbolicParaboloidCircularDomain(origin=None, radius=0.5, sides=36, rings=10, A=1.0, B=-1.0, dirX=0, dirY=0, dirZ=1, placement="bottom"):
500
+ def HyperbolicParaboloidCircularDomain(origin=None, radius=0.5, sides=36, rings=10, A=1.0, B=-1.0, direction=[0,0,1], placement="bottom"):
509
501
  """
510
502
  Creates a hyperbolic paraboloid with a circular domain. See https://en.wikipedia.org/wiki/Compactness_measure_of_a_shape
511
503
 
@@ -523,12 +515,8 @@ class Shell(Topology):
523
515
  The *A* constant in the equation z = A*x^2^ + B*y^2^. The default is 1.0.
524
516
  B : float , optional
525
517
  The *B* constant in the equation z = A*x^2^ + B*y^2^. The default is -1.0.
526
- dirX : float , optional
527
- The X component of the vector representing the up direction of the circle. The default is 0.
528
- dirY : float , optional
529
- The Y component of the vector representing the up direction of the circle. The default is 0.
530
- dirZ : float , optional
531
- The Z component of the vector representing the up direction of the circle. The default is 1.
518
+ direction : list , optional
519
+ The vector representing the up direction of the hyperbolic paraboloid. The default is [0,0,1.
532
520
  placement : str , optional
533
521
  The description of the placement of the origin of the circle. This can be "center", "lowerleft", "bottom". It is case insensitive. The default is "center".
534
522
 
@@ -663,9 +651,9 @@ class Shell(Topology):
663
651
  x1 = 0
664
652
  y1 = 0
665
653
  z1 = 0
666
- x2 = 0 + dirX
667
- y2 = 0 + dirY
668
- z2 = 0 + dirZ
654
+ x2 = 0 + direction[0]
655
+ y2 = 0 + direction[1]
656
+ z2 = 0 + direction[2]
669
657
  dx = x2 - x1
670
658
  dy = y2 - y1
671
659
  dz = z2 - z1
@@ -727,7 +715,7 @@ class Shell(Topology):
727
715
  return shell.IsClosed()
728
716
 
729
717
  @staticmethod
730
- def Pie(origin=None, radiusA=0.5, radiusB=0, sides=32, rings=1, fromAngle=0, toAngle=360, dirX=0, dirY=0, dirZ=1, placement="center", tolerance=0.0001):
718
+ def Pie(origin=None, radiusA=0.5, radiusB=0, sides=32, rings=1, fromAngle=0, toAngle=360, direction=[0,0,1], placement="center", tolerance=0.0001):
731
719
  """
732
720
  Creates a pie shape.
733
721
 
@@ -747,12 +735,8 @@ class Shell(Topology):
747
735
  The angle in degrees from which to start creating the arc of the pie. The default is 0.
748
736
  toAngle : float , optional
749
737
  The angle in degrees at which to end creating the arc of the pie. The default is 360.
750
- dirX : float , optional
751
- The X component of the vector representing the up direction of the pie. The default is 0.
752
- dirY : float , optional
753
- The Y component of the vector representing the up direction of the pie. The default is 0.
754
- dirZ : float , optional
755
- The Z component of the vector representing the up direction of the pie. The default is 1.
738
+ direction : list , optional
739
+ The vector representing the up direction of the pie. The default is [0,0,1].
756
740
  placement : str , optional
757
741
  The description of the placement of the origin of the pie. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
758
742
  tolerance : float , optional
@@ -852,9 +836,9 @@ class Shell(Topology):
852
836
  x1 = 0
853
837
  y1 = 0
854
838
  z1 = 0
855
- x2 = 0 + dirX
856
- y2 = 0 + dirY
857
- z2 = 0 + dirZ
839
+ x2 = 0 + direction[0]
840
+ y2 = 0 + direction[1]
841
+ z2 = 0 + direction[2]
858
842
  dx = x2 - x1
859
843
  dy = y2 - y1
860
844
  dz = z2 - z1
@@ -870,7 +854,7 @@ class Shell(Topology):
870
854
  return shell
871
855
 
872
856
  @staticmethod
873
- def Rectangle(origin=None, width=1.0, length=1.0, uSides=2, vSides=2, dirX=0, dirY=0, dirZ=1, placement="center", tolerance=0.0001):
857
+ def Rectangle(origin=None, width=1.0, length=1.0, uSides=2, vSides=2, direction=[0,0,1], placement="center", tolerance=0.0001):
874
858
  """
875
859
  Creates a rectangle.
876
860
 
@@ -886,12 +870,8 @@ class Shell(Topology):
886
870
  The number of sides along the width. The default is 2.
887
871
  vSides : int , optional
888
872
  The number of sides along the length. The default is 2.
889
- dirX : float , optional
890
- The X component of the vector representing the up direction of the rectangle. The default is 0.
891
- dirY : float , optional
892
- The Y component of the vector representing the up direction of the rectangle. The default is 0.
893
- dirZ : float , optional
894
- The Z component of the vector representing the up direction of the rectangle. The default is 1.
873
+ direction : list , optional
874
+ The vector representing the up direction of the rectangle. The default is [0,0,1].
895
875
  placement : str , optional
896
876
  The description of the placement of the origin of the rectangle. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
897
877
  tolerance : float , optional
@@ -922,16 +902,16 @@ class Shell(Topology):
922
902
  for i in range(uSides):
923
903
  for j in range(vSides):
924
904
  rOrigin = Vertex.ByCoordinates(i*uOffset - wOffset, j*vOffset - lOffset, 0)
925
- w = Wire.Rectangle(origin=rOrigin, width=uOffset, length=vOffset, dirX=0, dirY=0, dirZ=1, placement="lowerleft", tolerance=tolerance)
905
+ w = Wire.Rectangle(origin=rOrigin, width=uOffset, length=vOffset, placement="lowerleft", tolerance=tolerance)
926
906
  f = Face.ByWire(w)
927
907
  faces.append(f)
928
908
  shell = Shell.ByFaces(faces)
929
909
  x1 = origin.X()
930
910
  y1 = origin.Y()
931
911
  z1 = origin.Z()
932
- x2 = origin.X() + dirX
933
- y2 = origin.Y() + dirY
934
- z2 = origin.Z() + dirZ
912
+ x2 = origin.X() + direction[0]
913
+ y2 = origin.Y() + direction[1]
914
+ z2 = origin.Z() + direction[2]
935
915
  dx = x2 - x1
936
916
  dy = y2 - y1
937
917
  dz = z2 - z1