kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #32803
[PATCH] Allow selection of square pads and allow to rotate the pads in the circular pad array wizard
---
pcbnew/python/plugins/PadArray.py | 8 +++++++-
pcbnew/python/plugins/circular_pad_array_wizard.py | 14 ++++++++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
--------------2.7.4
Content-Type: text/x-patch;
name="0001-Allow-selection-of-square-pads-and-allow-to-rotate-t.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment;
filename="0001-Allow-selection-of-square-pads-and-allow-to-rotate-t.patch"
diff --git a/pcbnew/python/plugins/PadArray.py
b/pcbnew/python/plugins/PadArray.py
index 3d7c082..28b8d4b 100644
--- a/pcbnew/python/plugins/PadArray.py
+++ b/pcbnew/python/plugins/PadArray.py
@@ -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)
diff --git a/pcbnew/python/plugins/circular_pad_array_wizard.py
b/pcbnew/python/plugins/circular_pad_array_wizard.py
index 42c08c9..28ee00d 100644
--- a/pcbnew/python/plugins/circular_pad_array_wizard.py
+++ b/pcbnew/python/plugins/circular_pad_array_wizard.py
@@ -37,6 +37,11 @@ class
circular_pad_array_wizard(FootprintWizardBase.FootprintWizard):
self.AddParam("Pads", "diameter", self.uMM, 1.5)
self.AddParam("Pads", "drill", self.uMM, 0.8)
self.AddParam("Pads", "angle", self.uDegrees, 0, designator='a')
+ self.AddParam("Pads", "rectangle", self.uBool, False)
+
+
+ self.AddParam("Pad rotation", "pad rotation", self.uBool,
False, designator='r')
+ self.AddParam("Pad rotation", "pad angle offset",
self.uDegrees, 0, designator='o')
self.AddParam("Numbering", "initial", self.uInteger, 1,
min_value=1)
#self.AddParam("Numbering", "increment", self.uInteger, 1,
min_value=1)
@@ -50,6 +55,7 @@ class
circular_pad_array_wizard(FootprintWizardBase.FootprintWizard):
pads = self.parameters['Pads']
numbering = self.parameters['Numbering']
outline = self.parameters['Outline']
+ padRotation = self.parameters['Pad rotation']
# Check that pads do not overlap
pad_dia = pcbnew.ToMM(pads['diameter'])
@@ -73,16 +79,20 @@ class
circular_pad_array_wizard(FootprintWizardBase.FootprintWizard):
pads = self.parameters['Pads']
numbering = self.parameters['Numbering']
outline = self.parameters['Outline']
+ padRotation = self.parameters['Pad rotation']
pad_size = pads['diameter']
+ pad_shape = pcbnew.PAD_SHAPE_RECT if pads["rectangle"] else
pcbnew.PAD_SHAPE_OVAL
- pad = PA.PadMaker(self.module).THPad(pads['diameter'],
pads['diameter'], pads['drill'])
+ pad = PA.PadMaker(self.module).THPad(pads['diameter'],
pads['diameter'], pads['drill'], shape=pad_shape)
array = PA.PadCircleArray(
pad, pads['count'], pads['center diameter'] / 2,
angle_offset=pads["angle"],
centre=pcbnew.wxPoint(0, 0),
- clockwise=numbering["clockwise"])
+ clockwise=numbering["clockwise"],
+ padRotationEnable= padRotation["pad rotation"],
+ padRotationOffset = padRotation["pad angle offset"])
array.SetFirstPadInArray(numbering["initial"])
--------------2.7.4--
>From 6a28b246535f68354c3d86b6ecf01176af1628c8 Mon Sep 17 00:00:00 2001
From: Christoph Riehl <f4eru@xxxxxxx>
Date: Wed, 3 Jan 2018 17:11:27 +0100
Subject: [PATCH] Allow selection of square pads and allow to rotate the pads
in the circular pad array wizard
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.7.4"
This is a multi-part message in MIME format.
--------------2.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
pcbnew/python/plugins/PadArray.py | 8 +++++++-
pcbnew/python/plugins/circular_pad_array_wizard.py | 14 ++++++++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
--------------2.7.4
Content-Type: text/x-patch; name="0001-Allow-selection-of-square-pads-and-allow-to-rotate-t.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Allow-selection-of-square-pads-and-allow-to-rotate-t.patch"
diff --git a/pcbnew/python/plugins/PadArray.py b/pcbnew/python/plugins/PadArray.py
index 3d7c082..28b8d4b 100644
--- a/pcbnew/python/plugins/PadArray.py
+++ b/pcbnew/python/plugins/PadArray.py
@@ -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)
diff --git a/pcbnew/python/plugins/circular_pad_array_wizard.py b/pcbnew/python/plugins/circular_pad_array_wizard.py
index 42c08c9..28ee00d 100644
--- a/pcbnew/python/plugins/circular_pad_array_wizard.py
+++ b/pcbnew/python/plugins/circular_pad_array_wizard.py
@@ -37,6 +37,11 @@ class circular_pad_array_wizard(FootprintWizardBase.FootprintWizard):
self.AddParam("Pads", "diameter", self.uMM, 1.5)
self.AddParam("Pads", "drill", self.uMM, 0.8)
self.AddParam("Pads", "angle", self.uDegrees, 0, designator='a')
+ self.AddParam("Pads", "rectangle", self.uBool, False)
+
+
+ self.AddParam("Pad rotation", "pad rotation", self.uBool, False, designator='r')
+ self.AddParam("Pad rotation", "pad angle offset", self.uDegrees, 0, designator='o')
self.AddParam("Numbering", "initial", self.uInteger, 1, min_value=1)
#self.AddParam("Numbering", "increment", self.uInteger, 1, min_value=1)
@@ -50,6 +55,7 @@ class circular_pad_array_wizard(FootprintWizardBase.FootprintWizard):
pads = self.parameters['Pads']
numbering = self.parameters['Numbering']
outline = self.parameters['Outline']
+ padRotation = self.parameters['Pad rotation']
# Check that pads do not overlap
pad_dia = pcbnew.ToMM(pads['diameter'])
@@ -73,16 +79,20 @@ class circular_pad_array_wizard(FootprintWizardBase.FootprintWizard):
pads = self.parameters['Pads']
numbering = self.parameters['Numbering']
outline = self.parameters['Outline']
+ padRotation = self.parameters['Pad rotation']
pad_size = pads['diameter']
+ pad_shape = pcbnew.PAD_SHAPE_RECT if pads["rectangle"] else pcbnew.PAD_SHAPE_OVAL
- pad = PA.PadMaker(self.module).THPad(pads['diameter'], pads['diameter'], pads['drill'])
+ pad = PA.PadMaker(self.module).THPad(pads['diameter'], pads['diameter'], pads['drill'], shape=pad_shape)
array = PA.PadCircleArray(
pad, pads['count'], pads['center diameter'] / 2,
angle_offset=pads["angle"],
centre=pcbnew.wxPoint(0, 0),
- clockwise=numbering["clockwise"])
+ clockwise=numbering["clockwise"],
+ padRotationEnable= padRotation["pad rotation"],
+ padRotationOffset = padRotation["pad angle offset"])
array.SetFirstPadInArray(numbering["initial"])
--------------2.7.4--
Follow ups