footprint wizards: fixes and enhancements
From master branch
This commit is contained in:
parent
1d37d3fdf7
commit
c599385c8b
|
@ -133,7 +133,7 @@ class FPC_FootprintWizard(FootprintWizardBase.FootprintWizard):
|
||||||
self.draw.Line(-xstart, posy, -xend, yend)
|
self.draw.Line(-xstart, posy, -xend, yend)
|
||||||
|
|
||||||
# set SMD attribute
|
# set SMD attribute
|
||||||
self.module.SetAttributes(pcbnew.PAD_ATTRIB_SMD)
|
self.module.SetAttributes(pcbnew.FP_SMD)
|
||||||
|
|
||||||
# vertical segment at left of the pad
|
# vertical segment at left of the pad
|
||||||
xstart = xend
|
xstart = xend
|
||||||
|
|
|
@ -603,9 +603,10 @@ class FootprintWizardDrawingAids:
|
||||||
for i in range(0, len(pts) - 1):
|
for i in range(0, len(pts) - 1):
|
||||||
self.Line(pts[i][0], pts[i][1], pts[i+1][0], pts[i+1][1])
|
self.Line(pts[i][0], pts[i][1], pts[i+1][0], pts[i+1][1])
|
||||||
|
|
||||||
|
if mirrorX is None and mirrorY is None:
|
||||||
_PolyLineInternal(pts) # original
|
_PolyLineInternal(pts) # original
|
||||||
|
|
||||||
if mirrorX is not None and mirrorY is not None:
|
elif mirrorX is not None and mirrorY is not None:
|
||||||
self.TransformFlip(mirrorX, mirrorY, self.flipBoth) # both
|
self.TransformFlip(mirrorX, mirrorY, self.flipBoth) # both
|
||||||
_PolyLineInternal(pts)
|
_PolyLineInternal(pts)
|
||||||
self.PopTransform()
|
self.PopTransform()
|
||||||
|
|
|
@ -163,7 +163,15 @@ class BGAWizard(FootprintWizardBase.FootprintWizard):
|
||||||
self.draw.Value(0, ypos, text_size)
|
self.draw.Value(0, ypos, text_size)
|
||||||
self.draw.Reference(0, -ypos, text_size)
|
self.draw.Reference(0, -ypos, text_size)
|
||||||
|
|
||||||
|
# Add a extra text (${REFERENCE}) on the F_Fab layer
|
||||||
|
extra_text = pcbnew.FP_TEXT( self.module, pcbnew.FP_TEXT.TEXT_is_DIVERS )
|
||||||
|
extra_text.SetLayer( pcbnew.F_Fab )
|
||||||
|
extra_text.SetPosition( pcbnew.VECTOR2I( 0, 0) )
|
||||||
|
extra_text.SetTextSize( pcbnew.VECTOR2I( text_size, text_size ) )
|
||||||
|
extra_text.SetText( "${REFERENCE}" )
|
||||||
|
self.module.Add( extra_text )
|
||||||
|
|
||||||
# set SMD attribute
|
# set SMD attribute
|
||||||
self.module.SetAttributes(pcbnew.PAD_ATTRIB_SMD)
|
self.module.SetAttributes(pcbnew.FP_SMD)
|
||||||
|
|
||||||
BGAWizard().register()
|
BGAWizard().register()
|
||||||
|
|
|
@ -136,7 +136,7 @@ class MicroMaTchWizard(FPWbase.FootprintWizard):
|
||||||
# Use value to fill the modules description
|
# Use value to fill the modules description
|
||||||
desc = self.GetValue()
|
desc = self.GetValue()
|
||||||
self.module.SetDescription(desc)
|
self.module.SetDescription(desc)
|
||||||
self.module.SetAttributes(1)
|
self.module.SetAttributes( pcbnew.FP_SMD )
|
||||||
|
|
||||||
# add in the pads
|
# add in the pads
|
||||||
pad = self.GetPad()
|
pad = self.GetPad()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# Copyright 2019-2020 Julian Fellinger
|
# Copyright 2019-2020 Julian Fellinger
|
||||||
|
# Copyright (C) 2023 KiCad Developers.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -17,7 +18,6 @@
|
||||||
|
|
||||||
import FootprintWizardBase
|
import FootprintWizardBase
|
||||||
import pcbnew
|
import pcbnew
|
||||||
from pcbnew import *
|
|
||||||
|
|
||||||
class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
|
class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
|
||||||
|
|
||||||
|
@ -55,10 +55,10 @@ class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
|
||||||
|
|
||||||
# build a rectangular pad
|
# build a rectangular pad
|
||||||
def smdRectPad(self,module,size,pos,name):
|
def smdRectPad(self,module,size,pos,name):
|
||||||
pad = PAD(module)
|
pad = pcbnew.PAD(module)
|
||||||
pad.SetSize(size)
|
pad.SetSize(size)
|
||||||
pad.SetShape(PAD_SHAPE_RECT)
|
pad.SetShape(pcbnew.PAD_SHAPE_RECT)
|
||||||
pad.SetAttribute(PAD_ATTRIB_SMD)
|
pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD)
|
||||||
|
|
||||||
layerset = pcbnew.LSET()
|
layerset = pcbnew.LSET()
|
||||||
layerset.AddLayer(pcbnew.F_Cu)
|
layerset.AddLayer(pcbnew.F_Cu)
|
||||||
|
@ -87,7 +87,7 @@ class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
|
||||||
clearance = oew/2
|
clearance = oew/2
|
||||||
|
|
||||||
###border h
|
###border h
|
||||||
self.module.SetLayer(F_Cu)
|
self.module.SetLayer(pcbnew.F_Cu)
|
||||||
size_pad = pcbnew.VECTOR2I( w, oew )
|
size_pad = pcbnew.VECTOR2I( w, oew )
|
||||||
self.module.Add(self.smdRectPad(self.module,size_pad,
|
self.module.Add(self.smdRectPad(self.module,size_pad,
|
||||||
pcbnew.VECTOR2I(0, (int)((-h/2)+oew/2) ),
|
pcbnew.VECTOR2I(0, (int)((-h/2)+oew/2) ),
|
||||||
|
@ -130,8 +130,24 @@ class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
|
||||||
self.draw.Value(0, h/2+textSize, textSize)
|
self.draw.Value(0, h/2+textSize, textSize)
|
||||||
self.draw.Reference(0, -h/2-textSize, textSize)
|
self.draw.Reference(0, -h/2-textSize, textSize)
|
||||||
|
|
||||||
|
# Add a extra text (${REFERENCE}) on the F_Fab layer
|
||||||
|
extra_text = pcbnew.FP_TEXT( self.module, pcbnew.FP_TEXT.TEXT_is_DIVERS )
|
||||||
|
extra_text.SetLayer( pcbnew.F_Fab )
|
||||||
|
extra_text.SetPosition( pcbnew.VECTOR2I( 0, 0) )
|
||||||
|
extra_text.SetTextSize( pcbnew.VECTOR2I( textSize, textSize ) )
|
||||||
|
extra_text.SetText( "${REFERENCE}" )
|
||||||
|
self.module.Add( extra_text )
|
||||||
|
|
||||||
#optionally draw silkscreen line around button
|
#optionally draw silkscreen line around button
|
||||||
if(drawBox):
|
if(drawBox):
|
||||||
self.draw.Box(0,0,w,h)
|
self.draw.SetLayer( pcbnew.F_SilkS )
|
||||||
|
self.draw.SetLineThickness( pcbnew.FromMM( 0.12 ) ) #Default per KLC F5.3
|
||||||
|
self.draw.Box( 0, 0, w, h )
|
||||||
|
|
||||||
|
# draw coutyard around button
|
||||||
|
self.draw.SetLayer( pcbnew.F_CrtYd )
|
||||||
|
self.draw.SetLineThickness( pcbnew.FromMM( 0.05 ) ) #Default per KLC F5.3
|
||||||
|
margin = pcbnew.FromMM( 0.25 ) #Default per KLC F5.3
|
||||||
|
self.draw.Box( 0, 0, w + margin*2 , h + margin*2 )
|
||||||
|
|
||||||
MutualcapButtonWizard().register()
|
MutualcapButtonWizard().register()
|
||||||
|
|
|
@ -227,7 +227,7 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
|
||||||
self.draw.Reference(0, -text_offset, text_size)
|
self.draw.Reference(0, -text_offset, text_size)
|
||||||
|
|
||||||
# set SMD attribute
|
# set SMD attribute
|
||||||
self.module.SetAttributes(pcbnew.PAD_ATTRIB_SMD)
|
self.module.SetAttributes(pcbnew.FP_SMD)
|
||||||
|
|
||||||
QFNWizard().register()
|
QFNWizard().register()
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,6 @@ class QFPWizard(FootprintWizardBase.FootprintWizard):
|
||||||
self.draw.Reference(0, -text_offset, text_size)
|
self.draw.Reference(0, -text_offset, text_size)
|
||||||
|
|
||||||
# set SMD attribute
|
# set SMD attribute
|
||||||
self.module.SetAttributes(pcbnew.PAD_ATTRIB_SMD)
|
self.module.SetAttributes(pcbnew.FP_SMD)
|
||||||
|
|
||||||
QFPWizard().register()
|
QFPWizard().register()
|
||||||
|
|
|
@ -132,9 +132,9 @@ class RowedFootprint(FootprintWizardBase.FootprintWizard):
|
||||||
|
|
||||||
# set the attribute
|
# set the attribute
|
||||||
if self.GetName() == "S-DIP":
|
if self.GetName() == "S-DIP":
|
||||||
self.module.SetAttributes(pcbnew.PAD_ATTRIB_PTH)
|
self.module.SetAttributes(pcbnew.FP_THROUGH_HOLE)
|
||||||
elif self.GetName() == "SOIC":
|
elif self.GetName() == "SOIC":
|
||||||
self.module.SetAttributes(pcbnew.PAD_ATTRIB_SMD)
|
self.module.SetAttributes(pcbnew.FP_SMD)
|
||||||
|
|
||||||
class SDIPWizard(RowedFootprint):
|
class SDIPWizard(RowedFootprint):
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
|
||||||
self.draw.Reference(0, -ypos, t_size)
|
self.draw.Reference(0, -ypos, t_size)
|
||||||
|
|
||||||
# set SMD attribute
|
# set SMD attribute
|
||||||
self.module.SetAttributes(PAD_ATTRIB_SMD)
|
self.module.SetAttributes(FP_SMD)
|
||||||
|
|
||||||
# starting pad
|
# starting pad
|
||||||
band_width = touch_width/bands
|
band_width = touch_width/bands
|
||||||
|
|
|
@ -113,9 +113,9 @@ class RowedFootprint(FootprintWizardBase.FootprintWizard):
|
||||||
|
|
||||||
# set SMD attribute
|
# set SMD attribute
|
||||||
if self.GetName() == "ZIP":
|
if self.GetName() == "ZIP":
|
||||||
self.module.SetAttributes(pcbnew.PAD_ATTRIB_PTH)
|
self.module.SetAttributes(pcbnew.FP_THROUGH_HOLE)
|
||||||
elif self.GetName() == "ZOIC":
|
elif self.GetName() == "ZOIC":
|
||||||
self.module.SetAttributes(pcbnew.PAD_ATTRIB_SMD)
|
self.module.SetAttributes(pcbnew.FP_SMD)
|
||||||
|
|
||||||
def DrawBox(self, sizex, sizey):
|
def DrawBox(self, sizex, sizey):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue