Minor Python pad array improvement.

Allow selection of square pads and allow to rotate the pads in the
circular pad array wizard
This commit is contained in:
Christoph Riehl
2018-01-06 10:39:32 -05:00
committed by Wayne Stambaugh
parent b98f6a2fd1
commit f6023d22e4
2 changed files with 19 additions and 3 deletions
+7 -1
View File
@@ -228,7 +228,7 @@ class PadLineArray(PadGridArray):
class PadCircleArray(PadArray):
def __init__(self, pad, n, r, angle_offset=0, centre=pcbnew.wxPoint(0, 0),
clockwise=True):
clockwise=True, padRotationEnable=False, padRotationOffset =0):
PadArray.__init__(self)
# this pad is more of a "context", we will use it as a source of
# pad data, but not actually add it
@@ -238,6 +238,8 @@ class PadCircleArray(PadArray):
self.angle_offset = angle_offset
self.centre = centre
self.clockwise = clockwise
self.padRotationEnable = padRotationEnable
self.padRotationOffset = padRotationOffset
# around the circle, CW or CCW according to the flag
def NamingFunction(self, n):
@@ -255,6 +257,10 @@ class PadCircleArray(PadArray):
pos_y = -math.cos(angle * math.pi / 180) * self.r
pos = dc.TransformPoint(pos_x, pos_y)
pad = self.GetPad(pin == 0, pos)
padAngle = self.padRotationOffset
if self.padRotationEnable:
padAngle -=angle
pad.SetOrientation(padAngle*10)
pad.SetName(self.GetName(pin))
self.AddPad(pad)