Update footprint wizards after changes wxPoint->VECTOR2I

This commit is contained in:
jean-pierre charras 2022-01-03 11:43:15 +01:00
parent 211820a689
commit 5879227ee2
12 changed files with 67 additions and 51 deletions

View File

@ -480,6 +480,7 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx
DEPENDS ${CMAKE_SOURCE_DIR}/common/swig/kicad.i
DEPENDS ${CMAKE_SOURCE_DIR}/common/swig/wx.i
DEPENDS ${CMAKE_SOURCE_DIR}/common/swig/math.i
DEPENDS ${CMAKE_SOURCE_DIR}/common/swig/ki_exception.i
DEPENDS ${CMAKE_SOURCE_DIR}/common/swig/netclass.i
DEPENDS ${CMAKE_SOURCE_DIR}/scripting/kicadplugins.i

View File

@ -84,17 +84,17 @@ class FPC_FootprintWizard(FootprintWizardBase.FootprintWizard):
# create a pad array and add it to the module
for n in range ( 0, pad_count ):
xpos = pad_pitch*n - offsetX
pad = self.smdRectPad(self.module,size_pad, pcbnew.wxPoint(xpos,0),str(n+1))
xpos = (int)(pad_pitch*n - offsetX)
pad = self.smdRectPad(self.module,size_pad, pcbnew.VECTOR2I( xpos, 0), str(n+1))
self.module.Add(pad)
# Mechanical shield pads: left pad and right pad
xpos = -shl_to_pad-offsetX
pad_s0_pos = pcbnew.wxPoint(xpos,shl_from_top)
xpos = (int)(-shl_to_pad-offsetX)
pad_s0_pos = pcbnew.VECTOR2I( xpos, (int)shl_from_top )
pad_s0 = self.smdRectPad(self.module, size_shld, pad_s0_pos, "0")
xpos = (pad_count-1) * pad_pitch+shl_to_pad - offsetX
pad_s1_pos = pcbnew.wxPoint(xpos,shl_from_top)
pad_s1_pos = pcbnew.VECTOR2I( xpos, (int)shl_from_top )
pad_s1 = self.smdRectPad(self.module, size_shld, pad_s1_pos, "0")
self.module.Add(pad_s0)

View File

@ -433,14 +433,14 @@ class FootprintWizardDrawingAids:
@param x: the x coordinate of the point to transform
@param y: the y coordinate of the point to transform
@param mat: the transform matrix to use or None to use the current DC's
@return: the transformed point as a wxPoint
@return: the transformed point as a VECTOR2I
"""
if not mat:
mat = self.dc['transform']
return pcbnew.wxPoint(x * mat[0] + y * mat[1] + mat[2],
x * mat[3] + y * mat[4] + mat[5])
return pcbnew.VECTOR2I( (int)(x * mat[0] + y * mat[1] + mat[2]),
(int)(x * mat[3] + y * mat[4] + mat[5]) )
def SetLineThickness(self, lineThickness):
"""!

View File

@ -203,7 +203,7 @@ class PadGridArray(PadArray):
A basic grid of pads
"""
def __init__(self, pad, nx, ny, px, py, centre=pcbnew.wxPoint(0, 0)):
def __init__(self, pad, nx, ny, px, py, centre=pcbnew.VECTOR2I(0, 0)):
"""!
@param pad: the prototypical pad of the array
@param nx: number of pads in x-direction
@ -297,7 +297,7 @@ class PadZGridArray(PadArray):
"""
def __init__(self, pad, pad_count, line_count, line_pitch,
pad_pitch, centre=pcbnew.wxPoint(0, 0)):
pad_pitch, centre=pcbnew.VECTOR2I(0, 0)):
"""!
@param pad: the prototypical pad
@param pad_count: total pad count
@ -353,7 +353,7 @@ class PadLineArray(PadGridArray):
"""
def __init__(self, pad, n, pitch, isVertical,
centre=pcbnew.wxPoint(0, 0)):
centre=pcbnew.VECTOR2I(0, 0)):
"""!
@param pad: the prototypical pad
@param n: number of pads in array
@ -374,7 +374,7 @@ class PadCircleArray(PadArray):
Circular pad array
"""
def __init__(self, pad, n, r, angle_offset=0, centre=pcbnew.wxPoint(0, 0),
def __init__(self, pad, n, r, angle_offset=0, centre=pcbnew.VECTOR2I(0, 0),
clockwise=True, padRotationEnable=False, padRotationOffset=0):
"""!
@param pad: the prototypical pad

View File

@ -80,9 +80,9 @@ class BGAWizard(FootprintWizardBase.FootprintWizard):
# add in the pads
pad = PA.PadMaker(self.module).SMTRoundPad(pads["size"])
pin1_pos = pcbnew.wxPoint(-((cols - 1) * pad_pitch) / 2,
-((rows - 1) * pad_pitch) / 2)
px = (int)( -((cols - 1) * pad_pitch) / 2)
py = (int)(-((rows - 1) * pad_pitch) / 2)
pin1_pos = pcbnew.VECTOR2I( px, py )
array = BGAPadGridArray(pad, cols, rows, pad_pitch, pad_pitch)
array.AddPadsToModule(self.draw)

View File

@ -89,7 +89,7 @@ class circular_pad_array_wizard(FootprintWizardBase.FootprintWizard):
array = PA.PadCircleArray(
pad, pads['count'], pads['center diameter'] / 2,
angle_offset=pads["angle"],
centre=pcbnew.wxPoint(0, 0),
centre=pcbnew.VECTOR2I(0, 0),
clockwise=numbering["clockwise"],
padRotationEnable= padRotation["pad rotation"],
padRotationOffset = padRotation["pad angle offset"])

View File

@ -31,7 +31,7 @@ class PadStaggeredZGridArray(PA.PadArray):
o o o o
"""
def __init__(self, aPad, aPadCount, aLineCount, aLinePitch,
aPadPitch, aStagger=0, aCentre=pcbnew.wxPoint(0, 0)):
aPadPitch, aStagger=0, aCentre=pcbnew.VECTOR2I(0, 0)):
"""
@param aPad Template for all pads
@param aPadCount Overall pad count

View File

@ -89,27 +89,42 @@ class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
###border h
self.module.SetLayer(F_Cu)
size_pad = pcbnew.wxSize( w, oew )
self.module.Add(self.smdRectPad(self.module,size_pad, pcbnew.wxPoint(0,(-h/2)+oew/2),str(1)))
self.module.Add(self.smdRectPad(self.module,size_pad, pcbnew.wxPoint(0,( h/2)-oew/2),str(1)))
self.module.Add(self.smdRectPad(self.module,size_pad,
pcbnew.VECTOR2I(0, (int)((-h/2)+oew/2) ),
str(1)))
self.module.Add(self.smdRectPad(self.module,size_pad,
pcbnew.VECTOR2I(0, (int)(( h/2)-oew/2) ),
str(1)))
###border v
size_pad = pcbnew.wxSize(oBorderWidth, h-2*oew)
self.module.Add(self.smdRectPad(self.module,size_pad, pcbnew.wxPoint((-w/2)+oBorderWidth/2,0),str(1)))
self.module.Add(self.smdRectPad(self.module,size_pad, pcbnew.wxPoint(( w/2)-oBorderWidth/2,0),str(1)))
self.module.Add(self.smdRectPad(self.module,size_pad,
pcbnew.VECTOR2I( (int)((-w/2)+oBorderWidth/2), 0),
str(1)))
self.module.Add(self.smdRectPad(self.module,size_pad,
pcbnew.VECTOR2I( (int)((w/2)-oBorderWidth/2), 0),
str(1)))
xPos = -w/2+oBorderWidth+clearance+iew
oFingerSize = pcbnew.wxSize(oew/2, h-oew-iew-2*clearance-oew)
iFingerSize = pcbnew.wxSize(iew,h-2*oew-2*clearance)
#horizontal inner electrode trace
self.module.Add(self.smdRectPad(self.module,pcbnew.wxSize(w-2*oBorderWidth-2*clearance,iew), pcbnew.wxPoint(0,h/2-oew-clearance-iew/2),str(2)))
self.module.Add(self.smdRectPad(self.module,pcbnew.wxSize(w-2*oBorderWidth-2*clearance,iew),
pcbnew.VECTOR2I(0, (int)(h/2-oew-clearance-iew/2) ),str(2)))
for i in range(0,oFingerCount):
#inner electrode fingers
self.module.Add(self.smdRectPad(self.module,iFingerSize, pcbnew.wxPoint(xPos-iew/2 ,0),str(2)))
self.module.Add(self.smdRectPad(self.module,iFingerSize,
pcbnew.VECTOR2I( (int)(xPos-iew/2) ,0),
str(2)))
#outer electrode fingers
self.module.Add(self.smdRectPad(self.module,oFingerSize, pcbnew.wxPoint(xPos+oew*0.75,-w/h-oew-iew/2+oew/2),str(1)))
self.module.Add(self.smdRectPad(self.module,oFingerSize,
pcbnew.VECTOR2I( (int)(xPos+oew*0.75),
(int)(-w/h-oew-iew/2+oew/2) ),
str(1)))
xPos += oew*1.5+iew
#rightmost inner electrode finger
self.module.Add(self.smdRectPad(self.module,iFingerSize, pcbnew.wxPoint(xPos-iew/2,0),str(2)))
self.module.Add(self.smdRectPad(self.module,iFingerSize,
pcbnew.VECTOR2I( (int)(xPos-iew/2), 0),str(2)))
textSize = self.GetTextSize()
self.draw.Value(0, h/2+textSize, textSize)

View File

@ -99,30 +99,30 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
shape=pad_shape, rot_degree=90.0)
v_pad = PA.PadMaker(self.module).SMDPad( pad_length, pad_width, shape=pad_shape)
h_pitch = h_pitch / 2 - pad_length + pad_offset + pad_length/2
v_pitch = v_pitch / 2 - pad_length +pad_offset + pad_length/2
h_pitch = (int)(h_pitch / 2 - pad_length + pad_offset + pad_length/2)
v_pitch = (int)(v_pitch / 2 - pad_length +pad_offset + pad_length/2)
#left row
pin1Pos = pcbnew.wxPoint(-h_pitch, 0)
pin1Pos = pcbnew.VECTOR2I( -h_pitch), 0)
array = PA.PadLineArray(h_pad, pads_per_row, pad_pitch, True, pin1Pos)
array.SetFirstPadInArray(1)
array.AddPadsToModule(self.draw)
#bottom row
pin1Pos = pcbnew.wxPoint(0, v_pitch)
pin1Pos = pcbnew.VECTOR2I(0, v_pitch)
array = PA.PadLineArray(v_pad, pads_per_row, pad_pitch, False, pin1Pos)
array.SetFirstPadInArray(pads_per_row + 1)
array.AddPadsToModule(self.draw)
#right row
pin1Pos = pcbnew.wxPoint(h_pitch, 0)
pin1Pos = pcbnew.VECTOR2I(h_pitch, 0)
array = PA.PadLineArray(h_pad, pads_per_row, -pad_pitch, True,
pin1Pos)
array.SetFirstPadInArray(2*pads_per_row + 1)
array.AddPadsToModule(self.draw)
#top row
pin1Pos = pcbnew.wxPoint(0, -v_pitch)
pin1Pos = pcbnew.VECTOR2I(0, -v_pitch)
array = PA.PadLineArray(v_pad, pads_per_row, -pad_pitch, False,
pin1Pos)
array.SetFirstPadInArray(3*pads_per_row + 1)
@ -158,7 +158,7 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
layers.AddLayer(pcbnew.F_Paste)
epad.SetName(epad_num)
array = PA.EPADGridArray( epad, epad_ny, epad_nx, epad_l, epad_w, pcbnew.wxPoint(0,0) )
array = PA.EPADGridArray( epad, epad_ny, epad_nx, epad_l, epad_w, pcbnew.VECTOR2I(0,0) )
array.SetFirstPadInArray(epad_num)
array.AddPadsToModule(self.draw)
@ -173,7 +173,7 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
layers.AddLayer(pcbnew.F_Mask)
via.SetLayerSet(layers)
via_array = PA.EPADGridArray(via, epad_ny, epad_nx, epad_l, epad_w, pcbnew.wxPoint(0,0) )
via_array = PA.EPADGridArray(via, epad_ny, epad_nx, epad_l, epad_w, pcbnew.VECTOR2I(0,0) )
via_array.SetFirstPadInArray(epad_num)
via_array.AddPadsToModule(self.draw)

View File

@ -81,26 +81,26 @@ class QFPWizard(FootprintWizardBase.FootprintWizard):
v_pad = PA.PadMaker(self.module).SMDPad( pad_length, pad_width, shape=pad_shape)
#left row
pin1Pos = pcbnew.wxPoint(-h_pitch / 2, 0)
pin1Pos = pcbnew.VECTOR2I( (int)(-h_pitch / 2), 0)
array = PA.PadLineArray(h_pad, pads_per_row, pad_pitch, True, pin1Pos)
array.SetFirstPadInArray(1)
array.AddPadsToModule(self.draw)
#bottom row
pin1Pos = pcbnew.wxPoint(0, v_pitch / 2)
pin1Pos = pcbnew.VECTOR2I( 0, (int)(v_pitch / 2) )
array = PA.PadLineArray(v_pad, pads_per_row, pad_pitch, False, pin1Pos)
array.SetFirstPadInArray(pads_per_row + 1)
array.AddPadsToModule(self.draw)
#right row
pin1Pos = pcbnew.wxPoint(h_pitch / 2, 0)
pin1Pos = pcbnew.VECTOR2I( (int)(h_pitch / 2), 0)
array = PA.PadLineArray(h_pad, pads_per_row, -pad_pitch, True,
pin1Pos)
array.SetFirstPadInArray(2*pads_per_row + 1)
array.AddPadsToModule(self.draw)
#top row
pin1Pos = pcbnew.wxPoint(0, -v_pitch / 2)
pin1Pos = pcbnew.VECTOR2I(0, (int)(-v_pitch / 2) )
array = PA.PadLineArray(v_pad, pads_per_row, -pad_pitch, False,
pin1Pos)
array.SetFirstPadInArray(3*pads_per_row + 1)

View File

@ -88,7 +88,7 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
if self.UseCu:
pad = pcbnew.PAD(self.module)
pad.SetSize(pcbnew.wxSize(self.X, self.X))
pad_pos = pcbnew.wxPoint(xposition,yposition)
pad_pos = pcbnew.VECTOR2I(xposition,yposition)
pad.SetPosition(pad_pos)
pad.SetPos0(pad_pos)
pad.SetShape(pcbnew.PAD_SHAPE_RECT)
@ -147,7 +147,7 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
# Add value field
textPosition = int((self.textHeight) + ((1 + half_number_of_elements) * self.X))
pos = pcbnew.wxPoint(0, - textPosition)
pos = pcbnew.VECTOR2I(0, - textPosition)
self.module.Value().SetPosition(pos)
self.module.Value().SetPos0(pos)
self.module.Value().SetTextHeight(self.textHeight)
@ -155,7 +155,7 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
self.module.Value().SetTextThickness(self.textThickness)
# Add Reference field
pos = pcbnew.wxPoint(0, textPosition)
pos = pcbnew.VECTOR2I(0, textPosition)
self.module.Reference().SetPosition(pos)
self.module.Reference().SetPos0(pos)
self.module.Reference().SetTextHeight(self.textHeight)

View File

@ -97,17 +97,17 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
module = self.module
step_length = step_length - clearance
size_pad = wxSize(step_length/2.0+(step_length/3),touch_width)
pad = self.smdRectPad(module,size_pad,position-wxPoint(step_length/6,0),name)
pad = self.smdRectPad(module,size_pad,(VECTOR2I(position)-VECTOR2I( (int)(step_length/6),0),name)
module.Add(pad)
size_pad = wxSize(step_length/2.0,touch_width)
tp = self.smdTrianglePad(module,wxSize(size_pad[0],size_pad[1]/2),
position+wxPoint(size_pad[0]/2,size_pad[1]/4),
position+VECTOR2I( (int)(size_pad[0]/2), (int)(size_pad[1]/4) ),
name)
module.Add(tp)
tp = self.smdTrianglePad(module,wxSize(size_pad[0],size_pad[1]/2),
position+wxPoint(size_pad[0]/2,-size_pad[1]/4),
position+VECTOR2I( (int)(size_pad[0]/2), (int)(-size_pad[1]/4) ),
name
,-1)
module.Add(tp)
@ -124,17 +124,17 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
module.Add(pad)
tp = self.smdTrianglePad(module,wxSize(size_pad[0],size_pad[1]/2),
position+wxPoint(size_pad[0]/2,size_pad[1]/4),
position+VECTOR2I( (int)(size_pad[0]/2), (int)(size_pad[1]/4) ),
name)
module.Add(tp)
tp = self.smdTrianglePad(module,wxSize(size_pad[0],size_pad[1]/2),
position+wxPoint(size_pad[0]/2,-size_pad[1]/4),
position+VECTOR2I( (int)(size_pad[0]/2), (int)(-size_pad[1]/4) ),
name
,-1)
module.Add(tp)
tp = self.smdTrianglePad(module,wxSize(size_pad[0],size_pad[1]/2),
position+wxPoint(-size_pad[0],0),
position+VECTOR2I( -size_pad[0],0),
name,
0,
-1)
@ -148,12 +148,12 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
pad = self.smdRectPad(module,
wxSize(size_pad[0]+(step_length/3),size_pad[1]),
position+wxPoint(step_length/6,0),
position+VECTOR2I( (int)(step_length/6),0),
name)
module.Add(pad)
tp = self.smdTrianglePad(module,wxSize(size_pad[0],size_pad[1]/2),
position+wxPoint(-size_pad[0],0),
position+VECTOR2I(-size_pad[0],0),
name,
0,
-1)
@ -163,10 +163,10 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
self.AddStartPad(pos,touch_width,step_length,touch_clearance,"1")
for n in range(2,steps):
pos = pos + wxPoint(step_length,0)
pos = pos + VECTOR2I(step_length,0)
self.AddMiddlePad(pos,touch_width,step_length,touch_clearance,str(n))
pos = pos + wxPoint(step_length,0)
pos = pos + VECTOR2I(step_length,0)
self.AddFinalPad(pos,touch_width,step_length,touch_clearance,str(steps))
# build the footprint from parameters
@ -201,7 +201,7 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
for b in range(bands):
self.AddStrip(pos,steps,band_width,step_length,touch_clearance)
pos += wxPoint(0,band_width)
pos += VECTOR2I(0,band_width)
TouchSliderWizard().register()