kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #23062
Re: PATCH: Set SMD attribute in footprint wizard
Hi guys,
Here is the updated patch including changes from
https://lists.launchpad.net/kicad-developers/msg23059.html
This patch fixes the following KLC violations in the generated footprints:
- fixes the text size as specified in rule 6.9
- rounds the courtyard position on a 0.05mm grid as specified in rule 6.6
- set the attribute for SMD components as specified in rule 10.5
Cheers,
Mikael Arguedas
On Thu, Feb 11, 2016 at 6:54 PM, Mikael Arguedas <mikael.arguedas@xxxxxxxxx>
wrote:
> Hi guys,
>
> Sorry for spamming.
> This patch sets the footprint attibute to SMD if needed. This allows the
> generated footprints to comply with KLC rule 10.5.
>
> Cheers,
> Mikael Arguedas
>
=== modified file 'pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py'
--- pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py 2016-02-11 15:02:37 +0000
+++ pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py 2016-02-12 02:38:32 +0000
@@ -152,5 +152,7 @@
# right pad side
self.draw.Line(-xstart, posy, -xend, yend)
+ # set attribute
+ self.module.SetAttributes(pcbnew.MOD_CMS)
FPC_FootprintWizard().register()
=== modified file 'pcbnew/scripting/plugins/HelpfulFootprintWizardPlugin.py'
--- pcbnew/scripting/plugins/HelpfulFootprintWizardPlugin.py 2015-10-31 11:54:48 +0000
+++ pcbnew/scripting/plugins/HelpfulFootprintWizardPlugin.py 2016-02-12 03:42:23 +0000
@@ -259,7 +259,7 @@
"""
IPC nominal
"""
- return pcbnew.FromMM(1.2)
+ return pcbnew.FromMM(1.0)
def GetTextThickness(self):
"""
=== modified file 'pcbnew/scripting/plugins/bga_wizard.py'
--- pcbnew/scripting/plugins/bga_wizard.py 2016-02-11 15:02:37 +0000
+++ pcbnew/scripting/plugins/bga_wizard.py 2016-02-12 03:38:17 +0000
@@ -86,6 +86,8 @@
self.draw.SetLayer(pcbnew.F_CrtYd)
sizex = (ssx + cmargin) * 2
sizey = (ssy + cmargin) * 2
+ sizex = (int(sizex/100000)+1)*100000
+ sizey = (int(sizey/100000)+1)*100000
# set courtyard line thickness to the one defined in KLC
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
self.draw.Box(0, 0, sizex, sizey)
@@ -98,5 +100,7 @@
self.draw.Value(0, ypos, text_size)
self.draw.Reference(0, -ypos, text_size)
+ # set SMD attribute
+ self.module.SetAttributes(pcbnew.MOD_CMS)
BGAWizard().register()
=== modified file 'pcbnew/scripting/plugins/qfp_wizard.py'
--- pcbnew/scripting/plugins/qfp_wizard.py 2016-02-11 15:02:37 +0000
+++ pcbnew/scripting/plugins/qfp_wizard.py 2016-02-12 03:39:11 +0000
@@ -113,6 +113,8 @@
self.draw.SetLayer(pcbnew.F_CrtYd)
sizex = (lim_x + cmargin) * 2 + pad_length
sizey = (lim_y + cmargin) * 2 + pad_length
+ sizex = (int(sizex/100000)+1)*100000
+ sizey = (int(sizey/100000)+1)*100000
# set courtyard line thickness to the one defined in KLC
thick = self.draw.GetLineThickness()
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
@@ -127,4 +129,6 @@
self.draw.Value(0, text_offset, text_size)
self.draw.Reference(0, -text_offset, text_size)
+ # set SMD attribute
+ self.module.SetAttributes(pcbnew.MOD_CMS)
QFPWizard().register()
=== modified file 'pcbnew/scripting/plugins/sdip_wizard.py'
--- pcbnew/scripting/plugins/sdip_wizard.py 2016-02-11 15:02:37 +0000
+++ pcbnew/scripting/plugins/sdip_wizard.py 2016-02-12 03:37:26 +0000
@@ -109,6 +109,8 @@
self.draw.SetLayer(pcbnew.F_CrtYd)
sizex = (ssx + cmargin) * 2
sizey = (ssy + cmargin) * 2
+ sizex = (int(sizex/100000)+1)*100000
+ sizey = (int(sizey/100000)+1)*100000
# set courtyard line thickness to the one defined in KLC
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
self.draw.Box(0, 0, sizex, sizey)
@@ -127,6 +129,11 @@
# self.draw.Value(text_px, 0, text_size, orientation_degree=90)
self.draw.Value(0, 0, text_size)
self.draw.Reference(-text_px, 0, text_size, orientation_degree=90)
+ #set the attribute
+ if self.GetName() == "S-DIP":
+ self.module.SetAttributes(pcbnew.MOD_DEFAULT)
+ elif self.GetName() == "SOIC":
+ self.module.SetAttributes(pcbnew.MOD_CMS)
class SDIPWizard(RowedFootprint):
=== modified file 'pcbnew/scripting/plugins/touch_slider_wizard.py'
--- pcbnew/scripting/plugins/touch_slider_wizard.py 2016-02-11 15:02:37 +0000
+++ pcbnew/scripting/plugins/touch_slider_wizard.py 2016-02-12 02:51:13 +0000
@@ -193,6 +193,9 @@
ypos += t_size + w_text*2
self.draw.Reference(0, -ypos, t_size)
+ #set SMD attribute
+ self.module.SetAttributes(MOD_CMS)
+
# starting pad
pos = wxPointMM(0,0)
band_width = touch_width/bands
=== modified file 'pcbnew/scripting/plugins/zip_wizard.py'
--- pcbnew/scripting/plugins/zip_wizard.py 2016-02-11 15:02:37 +0000
+++ pcbnew/scripting/plugins/zip_wizard.py 2016-02-12 03:31:52 +0000
@@ -106,6 +106,8 @@
thick = self.draw.GetLineThickness()
sizex = (pin1posX + cmarginx) * 2 + pad_Hsize + thick
sizey = (pin1posY + cmarginy) * 2 + pad_Vsize + thick
+ sizex = (int(sizex/100000)+1)*100000
+ sizey = (int(sizey/100000)+1)*100000
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
self.draw.Box(0, 0, sizex, sizey)
# restore line thickness to previous value
@@ -118,6 +120,13 @@
self.draw.Value(0, t_posy, text_size)
self.draw.Reference(0, -t_posy, text_size)
+ # set SMD attribute
+
+ if self.GetName() == "ZIP":
+ self.module.SetAttributes(pcbnew.MOD_DEFAULT)
+ elif self.GetName() == "ZOIC":
+ self.module.SetAttributes(pcbnew.MOD_CMS)
+
def DrawBox(self, sizex, sizey):
# ----------
Follow ups
References