Footprint wizard: fixes and enhancements in python scripts.
This commit is contained in:
parent
ad2c4b807b
commit
c94a5dd46f
|
@ -3,29 +3,29 @@ EESchema-LIBRARY Version 2.3
|
||||||
#
|
#
|
||||||
# +12V
|
# +12V
|
||||||
#
|
#
|
||||||
DEF +12V #PWR 0 0 N Y 1 F P
|
DEF +12V #PWR 0 0 Y Y 1 F P
|
||||||
F0 "#PWR" 0 -50 20 H I C CNN
|
F0 "#PWR" 0 -150 50 H I C CNN
|
||||||
F1 "+12V" 0 100 30 H V C CNN
|
F1 "+12V" 0 140 50 H V C CNN
|
||||||
F2 "" 0 0 60 H V C CNN
|
F2 "" 0 0 60 H V C CNN
|
||||||
F3 "" 0 0 60 H V C CNN
|
F3 "" 0 0 60 H V C CNN
|
||||||
DRAW
|
DRAW
|
||||||
X +12V 1 0 0 0 U 20 30 0 0 W N
|
P 2 0 1 0 -30 50 0 100 N
|
||||||
C 0 60 20 0 1 0 N
|
P 2 0 1 0 0 0 0 100 N
|
||||||
P 3 0 1 0 0 0 0 40 0 40 N
|
P 2 0 1 0 0 100 30 50 N
|
||||||
|
X +12V 1 0 0 0 U 50 50 1 1 W N
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
# -12V
|
# -12V
|
||||||
#
|
#
|
||||||
DEF -12V #PWR 0 0 Y Y 1 F P
|
DEF -12V #PWR 0 0 Y Y 1 F N
|
||||||
F0 "#PWR" 0 130 20 H I C CNN
|
F0 "#PWR" 0 100 50 H I C CNN
|
||||||
F1 "-12V" 0 100 30 H V C CNN
|
F1 "-12V" 0 150 50 H V C CNN
|
||||||
F2 "" 0 0 60 H V C CNN
|
F2 "" 0 0 60 H V C CNN
|
||||||
F3 "" 0 0 60 H V C CNN
|
F3 "" 0 0 60 H V C CNN
|
||||||
DRAW
|
DRAW
|
||||||
X -12V 1 0 0 0 U 20 20 0 0 W N
|
X -12V 1 0 0 0 U 20 20 0 0 W N
|
||||||
P 3 0 1 0 0 0 0 50 0 50 N
|
P 6 0 1 0 0 0 0 50 30 50 0 100 -30 50 0 50 F
|
||||||
P 7 0 1 0 0 80 30 50 -20 50 -30 50 0 80 0 80 0 80 F
|
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
|
@ -87,20 +87,22 @@ ENDDEF
|
||||||
# C
|
# C
|
||||||
#
|
#
|
||||||
DEF C C 0 10 N Y 1 F N
|
DEF C C 0 10 N Y 1 F N
|
||||||
F0 "C" 0 100 40 H V L CNN
|
F0 "C" 25 100 50 H V L CNN
|
||||||
F1 "C" 6 -85 40 H V L CNN
|
F1 "C" 25 -100 50 H V L CNN
|
||||||
F2 "" 38 -150 30 H V C CNN
|
F2 "" 38 -150 30 H V C CNN
|
||||||
F3 "" 0 100 30 H V C CNN
|
F3 "" 0 0 60 H V C CNN
|
||||||
$FPLIST
|
$FPLIST
|
||||||
SM*
|
|
||||||
C?
|
C?
|
||||||
C1-1
|
C_????_*
|
||||||
|
C_????
|
||||||
|
SMD*_c
|
||||||
|
Capacitor*
|
||||||
$ENDFPLIST
|
$ENDFPLIST
|
||||||
DRAW
|
DRAW
|
||||||
P 2 0 1 20 -80 -30 80 -30 N
|
P 2 0 1 20 -80 -30 80 -30 N
|
||||||
P 2 0 1 20 -80 30 80 30 N
|
P 2 0 1 20 -80 30 80 30 N
|
||||||
X ~ 1 0 200 170 D 40 40 1 1 P
|
X ~ 1 0 150 110 D 40 40 1 1 P
|
||||||
X ~ 2 0 -200 170 U 40 40 1 1 P
|
X ~ 2 0 -150 110 U 40 40 1 1 P
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
|
@ -151,21 +153,29 @@ ENDDEF
|
||||||
#
|
#
|
||||||
# CP
|
# CP
|
||||||
#
|
#
|
||||||
DEF CP C 0 10 N N 1 F N
|
DEF CP C 0 10 N Y 1 F N
|
||||||
F0 "C" 50 100 40 H V L CNN
|
F0 "C" 25 100 50 H V L CNN
|
||||||
F1 "CP" 50 -100 40 H V L CNN
|
F1 "CP" 25 -100 50 H V L CNN
|
||||||
F2 "" 100 -150 30 H V C CNN
|
F2 "" 38 -150 30 H V C CNN
|
||||||
F3 "" 50 100 30 H V C CNN
|
F3 "" 0 0 60 H V C CNN
|
||||||
ALIAS CAPAPOL
|
|
||||||
$FPLIST
|
$FPLIST
|
||||||
CP*
|
CP*
|
||||||
SM*
|
Elko*
|
||||||
|
TantalC*
|
||||||
|
C*elec
|
||||||
|
c_elec*
|
||||||
|
SMD*_Pol
|
||||||
$ENDFPLIST
|
$ENDFPLIST
|
||||||
DRAW
|
DRAW
|
||||||
P 4 0 1 8 -80 50 -80 -50 80 -50 80 50 N
|
S -90 20 -90 40 0 1 0 N
|
||||||
P 4 0 1 0 -50 50 -50 -20 50 -20 50 50 F
|
S -90 20 90 20 0 1 0 N
|
||||||
X ~ 1 0 200 150 D 40 40 1 1 P
|
S -70 90 -30 90 0 1 0 N
|
||||||
X ~ 2 0 -200 150 U 40 40 1 1 P
|
S -50 70 -50 110 0 1 0 N
|
||||||
|
S 90 -20 -90 -40 0 1 0 F
|
||||||
|
S 90 40 -90 40 0 1 0 N
|
||||||
|
S 90 40 90 20 0 1 0 N
|
||||||
|
X ~ 1 0 150 110 D 40 40 1 1 P
|
||||||
|
X ~ 2 0 -150 110 U 40 40 1 1 P
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
|
@ -331,7 +341,7 @@ ENDDEF
|
||||||
#
|
#
|
||||||
# DIODE
|
# DIODE
|
||||||
#
|
#
|
||||||
DEF DIODE D 0 40 N N 1 F N
|
DEF DIODE D 0 0 Y Y 1 F N
|
||||||
F0 "D" 0 100 40 H V C CNN
|
F0 "D" 0 100 40 H V C CNN
|
||||||
F1 "DIODE" 0 -100 40 H V C CNN
|
F1 "DIODE" 0 -100 40 H V C CNN
|
||||||
F2 "" 0 0 60 H V C CNN
|
F2 "" 0 0 60 H V C CNN
|
||||||
|
@ -343,21 +353,21 @@ $ENDFPLIST
|
||||||
DRAW
|
DRAW
|
||||||
P 2 0 1 6 50 50 50 -50 N
|
P 2 0 1 6 50 50 50 -50 N
|
||||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
||||||
X A 1 -200 0 150 R 40 40 1 1 P
|
X A 1 -200 0 150 R 20 20 1 1 P
|
||||||
X K 2 200 0 150 L 40 40 1 1 P
|
X K 2 200 0 150 L 20 20 1 1 P
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
# GND
|
# GND
|
||||||
#
|
#
|
||||||
DEF ~GND #PWR 0 0 Y Y 1 F P
|
DEF GND #PWR 0 0 Y Y 1 F P
|
||||||
F0 "#PWR" 0 0 30 H I C CNN
|
F0 "#PWR" 0 -150 50 H I C CNN
|
||||||
F1 "GND" 0 -70 30 H I C CNN
|
F1 "GND" 0 -123 30 H V C CNN
|
||||||
F2 "" 0 0 60 H V C CNN
|
F2 "" 0 0 60 H V C CNN
|
||||||
F3 "" 0 0 60 H V C CNN
|
F3 "" 0 0 60 H V C CNN
|
||||||
DRAW
|
DRAW
|
||||||
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
|
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
|
||||||
X GND 1 0 0 0 U 30 30 1 1 W N
|
X GND 1 0 0 0 D 20 30 1 1 W N
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
|
@ -378,12 +388,12 @@ $FPLIST
|
||||||
LEDV
|
LEDV
|
||||||
$ENDFPLIST
|
$ENDFPLIST
|
||||||
DRAW
|
DRAW
|
||||||
P 2 0 1 0 50 50 50 -50 N
|
P 2 0 1 0 -50 50 -50 -50 N
|
||||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
P 3 0 1 0 -80 -25 -125 -65 -120 -40 N
|
||||||
P 3 0 1 0 65 -40 110 -80 105 -55 N
|
P 3 0 1 0 -65 -40 -110 -80 -105 -55 N
|
||||||
P 3 0 1 0 80 -25 125 -65 120 -40 N
|
P 3 0 1 0 50 50 -50 0 50 -50 F
|
||||||
X A 1 -200 0 150 R 40 40 1 1 P
|
X K 1 -200 0 150 R 40 40 1 1 P
|
||||||
X K 2 200 0 150 L 40 40 1 1 P
|
X A 2 200 0 150 L 40 40 1 1 P
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
|
@ -428,21 +438,18 @@ ENDDEF
|
||||||
# R
|
# R
|
||||||
#
|
#
|
||||||
DEF R R 0 0 N Y 1 F N
|
DEF R R 0 0 N Y 1 F N
|
||||||
F0 "R" 80 0 40 V V C CNN
|
F0 "R" 80 0 50 V V C CNN
|
||||||
F1 "R" 7 1 40 V V C CNN
|
F1 "R" 0 0 50 V V C CNN
|
||||||
F2 "" -70 0 30 V V C CNN
|
F2 "" -70 0 30 V V C CNN
|
||||||
F3 "" 0 0 30 H V C CNN
|
F3 "" 0 0 30 H V C CNN
|
||||||
$FPLIST
|
$FPLIST
|
||||||
R?
|
R_*
|
||||||
SM0603
|
Resistor_*
|
||||||
SM0805
|
|
||||||
R?-*
|
|
||||||
SM1206
|
|
||||||
$ENDFPLIST
|
$ENDFPLIST
|
||||||
DRAW
|
DRAW
|
||||||
S -40 150 40 -150 0 1 12 N
|
S -40 -100 40 100 0 1 10 N
|
||||||
X ~ 1 0 250 100 D 60 60 1 1 P
|
X ~ 1 0 150 50 D 60 60 1 1 P
|
||||||
X ~ 2 0 -250 100 U 60 60 1 1 P
|
X ~ 2 0 -150 50 U 60 60 1 1 P
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
|
@ -550,14 +557,14 @@ ENDDEF
|
||||||
# VCC
|
# VCC
|
||||||
#
|
#
|
||||||
DEF VCC #PWR 0 0 Y Y 1 F P
|
DEF VCC #PWR 0 0 Y Y 1 F P
|
||||||
F0 "#PWR" 0 100 30 H I C CNN
|
F0 "#PWR" 0 -150 50 H I C CNN
|
||||||
F1 "VCC" 0 100 30 H V C CNN
|
F1 "VCC" 0 150 50 H V C CNN
|
||||||
F2 "" 0 0 60 H V C CNN
|
F2 "" 0 0 60 H V C CNN
|
||||||
F3 "" 0 0 60 H V C CNN
|
F3 "" 0 0 60 H V C CNN
|
||||||
DRAW
|
DRAW
|
||||||
X VCC 1 0 0 0 U 20 20 0 0 W N
|
C 0 75 25 0 1 0 N
|
||||||
C 0 50 20 0 1 0 N
|
P 2 0 1 0 0 0 0 50 N
|
||||||
P 3 0 1 0 0 0 0 30 0 30 N
|
X VCC 1 0 0 0 U 50 50 1 1 W N
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
||||||
update=18/05/2015 09:09:57
|
update=30/10/2015 11:04:44
|
||||||
version=1
|
version=1
|
||||||
last_client=kicad
|
last_client=kicad
|
||||||
[pcbnew]
|
[pcbnew]
|
||||||
|
@ -84,5 +84,6 @@ version=1
|
||||||
version=1
|
version=1
|
||||||
LibDir=
|
LibDir=
|
||||||
[eeschema/libraries]
|
[eeschema/libraries]
|
||||||
LibName1=carte_test_schlib
|
LibName1=device
|
||||||
LibName2=power
|
LibName2=carte_test_schlib
|
||||||
|
LibName3=power
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,34 +1,6 @@
|
||||||
EESchema-LIBRARY Version 2.3
|
EESchema-LIBRARY Version 2.3
|
||||||
#encoding utf-8
|
#encoding utf-8
|
||||||
#
|
#
|
||||||
# +12V
|
|
||||||
#
|
|
||||||
DEF +12V #PWR 0 0 N Y 1 F P
|
|
||||||
F0 "#PWR" 0 -50 20 H I C CNN
|
|
||||||
F1 "+12V" 0 100 30 H V C CNN
|
|
||||||
F2 "" 0 0 60 H V C CNN
|
|
||||||
F3 "" 0 0 60 H V C CNN
|
|
||||||
DRAW
|
|
||||||
X +12V 1 0 0 0 U 20 30 0 0 W N
|
|
||||||
C 0 60 20 0 1 0 N
|
|
||||||
P 3 0 1 0 0 0 0 40 0 40 N
|
|
||||||
ENDDRAW
|
|
||||||
ENDDEF
|
|
||||||
#
|
|
||||||
# -12V
|
|
||||||
#
|
|
||||||
DEF -12V #PWR 0 0 Y Y 1 F P
|
|
||||||
F0 "#PWR" 0 130 20 H I C CNN
|
|
||||||
F1 "-12V" 0 100 30 H V C CNN
|
|
||||||
F2 "" 0 0 60 H V C CNN
|
|
||||||
F3 "" 0 0 60 H V C CNN
|
|
||||||
DRAW
|
|
||||||
X -12V 1 0 0 0 U 20 20 0 0 W N
|
|
||||||
P 3 0 1 0 0 0 0 50 0 50 N
|
|
||||||
P 7 0 1 0 0 80 30 50 -20 50 -30 50 0 80 0 80 0 80 F
|
|
||||||
ENDDRAW
|
|
||||||
ENDDEF
|
|
||||||
#
|
|
||||||
# 74HCT04
|
# 74HCT04
|
||||||
#
|
#
|
||||||
DEF 74HCT04 U 0 30 Y Y 6 F N
|
DEF 74HCT04 U 0 30 Y Y 6 F N
|
||||||
|
@ -331,7 +303,7 @@ ENDDEF
|
||||||
#
|
#
|
||||||
# DIODE
|
# DIODE
|
||||||
#
|
#
|
||||||
DEF DIODE D 0 40 N N 1 F N
|
DEF DIODE D 0 0 Y Y 1 F N
|
||||||
F0 "D" 0 100 40 H V C CNN
|
F0 "D" 0 100 40 H V C CNN
|
||||||
F1 "DIODE" 0 -100 40 H V C CNN
|
F1 "DIODE" 0 -100 40 H V C CNN
|
||||||
F2 "" 0 0 60 H V C CNN
|
F2 "" 0 0 60 H V C CNN
|
||||||
|
@ -343,21 +315,8 @@ $ENDFPLIST
|
||||||
DRAW
|
DRAW
|
||||||
P 2 0 1 6 50 50 50 -50 N
|
P 2 0 1 6 50 50 50 -50 N
|
||||||
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
P 3 0 1 0 -50 50 50 0 -50 -50 F
|
||||||
X A 1 -200 0 150 R 40 40 1 1 P
|
X K 1 200 0 150 L 20 20 1 1 P
|
||||||
X K 2 200 0 150 L 40 40 1 1 P
|
X A 2 -200 0 150 R 20 20 1 1 P
|
||||||
ENDDRAW
|
|
||||||
ENDDEF
|
|
||||||
#
|
|
||||||
# GND
|
|
||||||
#
|
|
||||||
DEF ~GND #PWR 0 0 Y Y 1 F P
|
|
||||||
F0 "#PWR" 0 0 30 H I C CNN
|
|
||||||
F1 "GND" 0 -70 30 H I C CNN
|
|
||||||
F2 "" 0 0 60 H V C CNN
|
|
||||||
F3 "" 0 0 60 H V C CNN
|
|
||||||
DRAW
|
|
||||||
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
|
|
||||||
X GND 1 0 0 0 U 30 30 1 1 W N
|
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
|
@ -547,20 +506,6 @@ X VCCA 16 100 900 300 D 50 50 1 2 W
|
||||||
ENDDRAW
|
ENDDRAW
|
||||||
ENDDEF
|
ENDDEF
|
||||||
#
|
#
|
||||||
# VCC
|
|
||||||
#
|
|
||||||
DEF VCC #PWR 0 0 Y Y 1 F P
|
|
||||||
F0 "#PWR" 0 100 30 H I C CNN
|
|
||||||
F1 "VCC" 0 100 30 H V C CNN
|
|
||||||
F2 "" 0 0 60 H V C CNN
|
|
||||||
F3 "" 0 0 60 H V C CNN
|
|
||||||
DRAW
|
|
||||||
X VCC 1 0 0 0 U 20 20 0 0 W N
|
|
||||||
C 0 50 20 0 1 0 N
|
|
||||||
P 3 0 1 0 0 0 0 30 0 30 N
|
|
||||||
ENDDRAW
|
|
||||||
ENDDEF
|
|
||||||
#
|
|
||||||
# XC95108PC84
|
# XC95108PC84
|
||||||
#
|
#
|
||||||
DEF XC95108PC84 U 0 30 Y Y 1 F N
|
DEF XC95108PC84 U 0 30 Y Y 1 F N
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
(fp_lib_table
|
||||||
|
(lib (name Capacitors_SMD)(type KiCad)(uri "$(KISYSMOD)\\Capacitors_SMD.pretty")(options "")(descr ""))
|
||||||
|
(lib (name Sockets_DIP)(type KiCad)(uri "$(KISYSMOD)\\Sockets_DIP.pretty")(options "")(descr ""))
|
||||||
|
(lib (name Pin_Headers)(type KiCad)(uri "$(KISYSMOD)/Pin_Headers.pretty")(options "")(descr ""))
|
||||||
|
(lib (name SMD_Packages)(type KiCad)(uri "$(KISYSMOD)/SMD_Packages.pretty")(options "")(descr ""))
|
||||||
|
(lib (name Sockets)(type KiCad)(uri "$(KISYSMOD)/Sockets.pretty")(options "")(descr ""))
|
||||||
|
)
|
File diff suppressed because it is too large
Load Diff
|
@ -53,8 +53,8 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
||||||
|
|
||||||
// Choose selection mode and insert the needed rows
|
// Choose selection mode and insert the needed rows
|
||||||
|
|
||||||
m_footprintWizardsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
|
m_footprintGeneratorsGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
|
||||||
m_footprintWizardsGrid->InsertRows( 0, n_wizards, true );
|
m_footprintGeneratorsGrid->InsertRows( 0, n_wizards, true );
|
||||||
|
|
||||||
// Put all wizards in the list
|
// Put all wizards in the list
|
||||||
for( int i=0; i<n_wizards; i++ )
|
for( int i=0; i<n_wizards; i++ )
|
||||||
|
@ -64,14 +64,14 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
||||||
wxString description = wizard->GetDescription();
|
wxString description = wizard->GetDescription();
|
||||||
wxString image = wizard->GetImage();
|
wxString image = wizard->GetImage();
|
||||||
|
|
||||||
m_footprintWizardsGrid->SetCellValue( i, ROW_NAME, name );
|
m_footprintGeneratorsGrid->SetCellValue( i, ROW_NAME, name );
|
||||||
m_footprintWizardsGrid->SetCellValue( i, ROW_DESCR, description );
|
m_footprintGeneratorsGrid->SetCellValue( i, ROW_DESCR, description );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select the first row
|
// Select the first row
|
||||||
m_footprintWizardsGrid->ClearSelection();
|
m_footprintGeneratorsGrid->ClearSelection();
|
||||||
m_footprintWizardsGrid->SelectRow( 0, false );
|
m_footprintGeneratorsGrid->SelectRow( 0, false );
|
||||||
|
|
||||||
if( m_config )
|
if( m_config )
|
||||||
{
|
{
|
||||||
|
@ -96,11 +96,11 @@ DIALOG_FOOTPRINT_WIZARD_LIST::~DIALOG_FOOTPRINT_WIZARD_LIST()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_FOOTPRINT_WIZARD_LIST::OnCellWizardClick( wxGridEvent& event )
|
void DIALOG_FOOTPRINT_WIZARD_LIST::OnCellFpGeneratorClick( wxGridEvent& event )
|
||||||
{
|
{
|
||||||
int click_row = event.GetRow();
|
int click_row = event.GetRow();
|
||||||
m_footprintWizard = FOOTPRINT_WIZARDS::GetWizard( click_row );
|
m_footprintWizard = FOOTPRINT_WIZARDS::GetWizard( click_row );
|
||||||
m_footprintWizardsGrid->SelectRow( event.GetRow(), false );
|
m_footprintGeneratorsGrid->SelectRow( event.GetRow(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
FOOTPRINT_WIZARD* GetWizard();
|
FOOTPRINT_WIZARD* GetWizard();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnCellWizardClick( wxGridEvent& event );
|
void OnCellFpGeneratorClick( wxGridEvent& event );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DIALOG_FOOTPRINT_WIZARD_LIST_H_
|
#endif // _DIALOG_FOOTPRINT_WIZARD_LIST_H_
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Jun 5 2014)
|
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -16,38 +16,38 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
||||||
wxBoxSizer* bSizerMain;
|
wxBoxSizer* bSizerMain;
|
||||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_footprintWizardsGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
m_footprintGeneratorsGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
m_footprintWizardsGrid->CreateGrid( 0, 2 );
|
m_footprintGeneratorsGrid->CreateGrid( 0, 2 );
|
||||||
m_footprintWizardsGrid->EnableEditing( false );
|
m_footprintGeneratorsGrid->EnableEditing( false );
|
||||||
m_footprintWizardsGrid->EnableGridLines( true );
|
m_footprintGeneratorsGrid->EnableGridLines( true );
|
||||||
m_footprintWizardsGrid->EnableDragGridSize( false );
|
m_footprintGeneratorsGrid->EnableDragGridSize( false );
|
||||||
m_footprintWizardsGrid->SetMargins( 0, 0 );
|
m_footprintGeneratorsGrid->SetMargins( 0, 0 );
|
||||||
|
|
||||||
// Columns
|
// Columns
|
||||||
m_footprintWizardsGrid->SetColSize( 0, 160 );
|
m_footprintGeneratorsGrid->SetColSize( 0, 160 );
|
||||||
m_footprintWizardsGrid->SetColSize( 1, 325 );
|
m_footprintGeneratorsGrid->SetColSize( 1, 325 );
|
||||||
m_footprintWizardsGrid->EnableDragColMove( false );
|
m_footprintGeneratorsGrid->EnableDragColMove( false );
|
||||||
m_footprintWizardsGrid->EnableDragColSize( true );
|
m_footprintGeneratorsGrid->EnableDragColSize( true );
|
||||||
m_footprintWizardsGrid->SetColLabelSize( 20 );
|
m_footprintGeneratorsGrid->SetColLabelSize( 20 );
|
||||||
m_footprintWizardsGrid->SetColLabelValue( 0, _("Name") );
|
m_footprintGeneratorsGrid->SetColLabelValue( 0, _("Name") );
|
||||||
m_footprintWizardsGrid->SetColLabelValue( 1, _("Description") );
|
m_footprintGeneratorsGrid->SetColLabelValue( 1, _("Description") );
|
||||||
m_footprintWizardsGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
|
m_footprintGeneratorsGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
|
||||||
|
|
||||||
// Rows
|
// Rows
|
||||||
m_footprintWizardsGrid->AutoSizeRows();
|
m_footprintGeneratorsGrid->AutoSizeRows();
|
||||||
m_footprintWizardsGrid->EnableDragRowSize( true );
|
m_footprintGeneratorsGrid->EnableDragRowSize( true );
|
||||||
m_footprintWizardsGrid->SetRowLabelSize( 1 );
|
m_footprintGeneratorsGrid->SetRowLabelSize( 1 );
|
||||||
m_footprintWizardsGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
m_footprintGeneratorsGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||||
|
|
||||||
// Label Appearance
|
// Label Appearance
|
||||||
|
|
||||||
// Cell Defaults
|
// Cell Defaults
|
||||||
m_footprintWizardsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
m_footprintGeneratorsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||||
m_footprintWizardsGrid->SetMinSize( wxSize( 485,120 ) );
|
m_footprintGeneratorsGrid->SetMinSize( wxSize( 485,120 ) );
|
||||||
|
|
||||||
bSizerMain->Add( m_footprintWizardsGrid, 1, wxALL|wxEXPAND, 5 );
|
bSizerMain->Add( m_footprintGeneratorsGrid, 1, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
bSizerMain->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
|
bSizerMain->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
|
||||||
|
@ -68,12 +68,12 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
|
||||||
this->Centre( wxBOTH );
|
this->Centre( wxBOTH );
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
m_footprintWizardsGrid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellWizardClick ), NULL, this );
|
m_footprintGeneratorsGrid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellFpGeneratorClick ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_FOOTPRINT_WIZARD_LIST_BASE::~DIALOG_FOOTPRINT_WIZARD_LIST_BASE()
|
DIALOG_FOOTPRINT_WIZARD_LIST_BASE::~DIALOG_FOOTPRINT_WIZARD_LIST_BASE()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
m_footprintWizardsGrid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellWizardClick ), NULL, this );
|
m_footprintGeneratorsGrid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FOOTPRINT_WIZARD_LIST_BASE::OnCellFpGeneratorClick ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<property name="size">501,273</property>
|
<property name="size">501,273</property>
|
||||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||||
<property name="title">Footprint Wizards</property>
|
<property name="title">Footprint Generators</property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
|
@ -157,7 +157,7 @@
|
||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size">485,120</property>
|
<property name="minimum_size">485,120</property>
|
||||||
<property name="moveable">1</property>
|
<property name="moveable">1</property>
|
||||||
<property name="name">m_footprintWizardsGrid</property>
|
<property name="name">m_footprintGeneratorsGrid</property>
|
||||||
<property name="pane_border">1</property>
|
<property name="pane_border">1</property>
|
||||||
<property name="pane_position"></property>
|
<property name="pane_position"></property>
|
||||||
<property name="pane_size"></property>
|
<property name="pane_size"></property>
|
||||||
|
@ -183,7 +183,7 @@
|
||||||
<event name="OnEnterWindow"></event>
|
<event name="OnEnterWindow"></event>
|
||||||
<event name="OnEraseBackground"></event>
|
<event name="OnEraseBackground"></event>
|
||||||
<event name="OnGridCellChange"></event>
|
<event name="OnGridCellChange"></event>
|
||||||
<event name="OnGridCellLeftClick">OnCellWizardClick</event>
|
<event name="OnGridCellLeftClick">OnCellFpGeneratorClick</event>
|
||||||
<event name="OnGridCellLeftDClick"></event>
|
<event name="OnGridCellLeftDClick"></event>
|
||||||
<event name="OnGridCellRightClick"></event>
|
<event name="OnGridCellRightClick"></event>
|
||||||
<event name="OnGridCellRightDClick"></event>
|
<event name="OnGridCellRightDClick"></event>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Jun 5 2014)
|
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -36,19 +36,19 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM
|
||||||
private:
|
private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxGrid* m_footprintWizardsGrid;
|
wxGrid* m_footprintGeneratorsGrid;
|
||||||
wxStaticLine* m_staticline;
|
wxStaticLine* m_staticline;
|
||||||
wxStdDialogButtonSizer* m_sdbSizer;
|
wxStdDialogButtonSizer* m_sdbSizer;
|
||||||
wxButton* m_sdbSizerOK;
|
wxButton* m_sdbSizerOK;
|
||||||
wxButton* m_sdbSizerCancel;
|
wxButton* m_sdbSizerCancel;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnCellWizardClick( wxGridEvent& event ) { event.Skip(); }
|
virtual void OnCellFpGeneratorClick( wxGridEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Wizards"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 501,273 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Generators"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 501,273 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||||
~DIALOG_FOOTPRINT_WIZARD_LIST_BASE();
|
~DIALOG_FOOTPRINT_WIZARD_LIST_BASE();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
import pcbnew
|
import pcbnew
|
||||||
import FootprintWizardDrawingAids as FpWDA
|
|
||||||
import HelpfulFootprintWizardPlugin as HFPW
|
import HelpfulFootprintWizardPlugin as HFPW
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ class FootprintWizardDrawingAids:
|
||||||
def TransformRotation(self, x, y, rot, push=True):
|
def TransformRotation(self, x, y, rot, push=True):
|
||||||
"""
|
"""
|
||||||
Set up and return a transform matrix representing a rotation
|
Set up and return a transform matrix representing a rotation
|
||||||
about the pooint (x,y), and optionally push onto the stack
|
about the point (x,y), and optionally push onto the stack
|
||||||
|
|
||||||
This is performed by a translate-to-origin, rotate, translate-
|
This is performed by a translate-to-origin, rotate, translate-
|
||||||
back sequence
|
back sequence
|
||||||
|
@ -368,7 +368,7 @@ class FootprintWizardDrawingAids:
|
||||||
_PolyLineInternal(pts)
|
_PolyLineInternal(pts)
|
||||||
self.PopTransform()
|
self.PopTransform()
|
||||||
|
|
||||||
def Reference(self, x, y, size):
|
def Reference(self, x, y, size, orientation_degree = 0):
|
||||||
"""
|
"""
|
||||||
Draw the module's reference as the given point.
|
Draw the module's reference as the given point.
|
||||||
|
|
||||||
|
@ -382,8 +382,9 @@ class FootprintWizardDrawingAids:
|
||||||
self.module.Reference().SetTextPosition(
|
self.module.Reference().SetTextPosition(
|
||||||
self.module.Reference().GetPos0())
|
self.module.Reference().GetPos0())
|
||||||
self.module.Reference().SetSize(text_size)
|
self.module.Reference().SetSize(text_size)
|
||||||
|
self.module.Reference().SetOrientation(orientation_degree*10) # internal angles are in 0.1 deg
|
||||||
|
|
||||||
def Value(self, x, y, size):
|
def Value(self, x, y, size, orientation_degree = 0):
|
||||||
"""
|
"""
|
||||||
As for references, draw the module's value
|
As for references, draw the module's value
|
||||||
"""
|
"""
|
||||||
|
@ -393,6 +394,7 @@ class FootprintWizardDrawingAids:
|
||||||
self.module.Value().SetTextPosition(self.module.Value().GetPos0())
|
self.module.Value().SetTextPosition(self.module.Value().GetPos0())
|
||||||
self.module.Value().SetSize(text_size)
|
self.module.Value().SetSize(text_size)
|
||||||
self.module.Value().SetLayer(self.DefaultTextValueLayer())
|
self.module.Value().SetLayer(self.DefaultTextValueLayer())
|
||||||
|
self.module.Value().SetOrientation(orientation_degree*10) # internal angles are in 0.1 deg
|
||||||
|
|
||||||
def Box(self, x, y, w, h):
|
def Box(self, x, y, w, h):
|
||||||
"""
|
"""
|
||||||
|
@ -408,13 +410,15 @@ class FootprintWizardDrawingAids:
|
||||||
|
|
||||||
self.Polyline(pts)
|
self.Polyline(pts)
|
||||||
|
|
||||||
def NotchedCircle(self, x, y, r, notch_w, notch_h):
|
def NotchedCircle(self, x, y, r, notch_w, notch_h, rotate=0):
|
||||||
"""
|
"""
|
||||||
Circle radus r centred at (x, y) with a raised or depressed notch
|
Circle radus r centred at (x, y) with a raised or depressed notch
|
||||||
at the top
|
at the top
|
||||||
|
|
||||||
Notch height is measured from the top of the circle radius
|
Notch height is measured from the top of the circle radius
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.TransformRotation(x, y, rotate)
|
||||||
|
|
||||||
# find the angle where the notch vertical meets the circle
|
# find the angle where the notch vertical meets the circle
|
||||||
angle_intercept = math.asin(notch_w/(2 * r))
|
angle_intercept = math.asin(notch_w/(2 * r))
|
||||||
|
|
||||||
|
@ -433,11 +437,15 @@ class FootprintWizardDrawingAids:
|
||||||
[-sx, sy]]
|
[-sx, sy]]
|
||||||
|
|
||||||
self.Polyline(pts)
|
self.Polyline(pts)
|
||||||
|
self.PopTransform()
|
||||||
|
|
||||||
def NotchedBox(self, x, y, w, h, notchW, notchH):
|
def NotchedBox(self, x, y, w, h, notchW, notchH, rotate=0):
|
||||||
"""
|
"""
|
||||||
Draw a box with a notch in the top edge
|
Draw a box with a notch in the top edge
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.TransformRotation(x, y, rotate)
|
||||||
|
|
||||||
# limit to half the overall width
|
# limit to half the overall width
|
||||||
notchW = min(x + w/2, notchW)
|
notchW = min(x + w/2, notchW)
|
||||||
|
|
||||||
|
@ -455,6 +463,8 @@ class FootprintWizardDrawingAids:
|
||||||
(x - w/2, y - h/2)
|
(x - w/2, y - h/2)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
self.PopTransform()
|
||||||
|
|
||||||
def BoxWithDiagonalAtCorner(self, x, y, w, h,
|
def BoxWithDiagonalAtCorner(self, x, y, w, h,
|
||||||
setback=pcbnew.FromMM(1.27), flip=flipNone):
|
setback=pcbnew.FromMM(1.27), flip=flipNone):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -81,9 +81,16 @@ class FootprintWizardParameterManager:
|
||||||
param = "*%s" % param # star prefix for natural
|
param = "*%s" % param # star prefix for natural
|
||||||
|
|
||||||
if section not in self.parameters:
|
if section not in self.parameters:
|
||||||
|
if not hasattr(self, 'page_order'):
|
||||||
|
self.page_order = []
|
||||||
|
self.page_order.append(section)
|
||||||
self.parameters[section] = {}
|
self.parameters[section] = {}
|
||||||
|
if not hasattr(self, 'parameter_order'):
|
||||||
|
self.parameter_order = {}
|
||||||
|
self.parameter_order[section] = []
|
||||||
|
|
||||||
self.parameters[section][param] = val
|
self.parameters[section][param] = val
|
||||||
|
self.parameter_order[section].append(param)
|
||||||
|
|
||||||
return error
|
return error
|
||||||
|
|
||||||
|
@ -95,7 +102,7 @@ class FootprintWizardParameterManager:
|
||||||
message = ""
|
message = ""
|
||||||
|
|
||||||
for name, section in self.parameters.iteritems():
|
for name, section in self.parameters.iteritems():
|
||||||
message += " %s:" % name
|
message += " %s:\n" % name
|
||||||
|
|
||||||
for key, value in section.iteritems():
|
for key, value in section.iteritems():
|
||||||
unit = ""
|
unit = ""
|
||||||
|
|
|
@ -32,16 +32,14 @@ class PadMaker:
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
|
|
||||||
def THPad(self, w, l, drill, shape=pcbnew.PAD_SHAPE_OVAL):
|
def THPad(self, Vsize, Hsize, drill, shape=pcbnew.PAD_SHAPE_OVAL, rot_degree = 0):
|
||||||
pad = pcbnew.D_PAD(self.module)
|
pad = pcbnew.D_PAD(self.module)
|
||||||
|
pad.SetSize(pcbnew.wxSize(Hsize, Vsize))
|
||||||
pad.SetSize(pcbnew.wxSize(l, w))
|
|
||||||
|
|
||||||
pad.SetShape(shape)
|
pad.SetShape(shape)
|
||||||
|
|
||||||
pad.SetAttribute(pcbnew.PAD_ATTRIB_STANDARD)
|
pad.SetAttribute(pcbnew.PAD_ATTRIB_STANDARD)
|
||||||
pad.SetLayerSet(pad.StandardMask())
|
pad.SetLayerSet(pad.StandardMask())
|
||||||
pad.SetDrillSize(pcbnew.wxSize(drill, drill))
|
pad.SetDrillSize(pcbnew.wxSize(drill, drill))
|
||||||
|
pad.SetOrientation(rot_degree*10) # rotation is in 0.1 degrees
|
||||||
|
|
||||||
return pad
|
return pad
|
||||||
|
|
||||||
|
@ -51,24 +49,20 @@ class PadMaker:
|
||||||
|
|
||||||
def NPTHRoundPad(self, drill):
|
def NPTHRoundPad(self, drill):
|
||||||
pad = pcbnew.D_PAD(self.module)
|
pad = pcbnew.D_PAD(self.module)
|
||||||
|
|
||||||
pad.SetSize(pcbnew.wxSize(drill, drill))
|
pad.SetSize(pcbnew.wxSize(drill, drill))
|
||||||
|
|
||||||
pad.SetShape(pcbnew.PAD_SHAPE_CIRCLE)
|
pad.SetShape(pcbnew.PAD_SHAPE_CIRCLE)
|
||||||
|
|
||||||
pad.SetAttribute(pcbnew.PAD_ATTRIB_HOLE_NOT_PLATED)
|
pad.SetAttribute(pcbnew.PAD_ATTRIB_HOLE_NOT_PLATED)
|
||||||
pad.SetLayerSet(pad.UnplatedHoleMask())
|
pad.SetLayerSet(pad.UnplatedHoleMask())
|
||||||
pad.SetDrillSize(pcbnew.wxSize(drill, drill))
|
pad.SetDrillSize(pcbnew.wxSize(drill, drill))
|
||||||
return pad
|
return pad
|
||||||
|
|
||||||
def SMDPad(self, w, l, shape=pcbnew.PAD_SHAPE_RECT):
|
def SMDPad(self, Vsize, Hsize, shape=pcbnew.PAD_SHAPE_RECT, rot_degree=0):
|
||||||
pad = pcbnew.D_PAD(self.module)
|
pad = pcbnew.D_PAD(self.module)
|
||||||
pad.SetSize(pcbnew.wxSize(l, w))
|
pad.SetSize(pcbnew.wxSize(Hsize, Vsize))
|
||||||
|
|
||||||
pad.SetShape(shape)
|
pad.SetShape(shape)
|
||||||
|
|
||||||
pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD)
|
pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD)
|
||||||
pad.SetLayerSet(pad.SMDMask())
|
pad.SetLayerSet(pad.SMDMask())
|
||||||
|
pad.SetOrientation(rot_degree*10) # rotation is in 0.1 degrees
|
||||||
|
|
||||||
return pad
|
return pad
|
||||||
|
|
||||||
|
@ -100,7 +94,6 @@ class PadArray:
|
||||||
self.pad.GetParent().Add(pad)
|
self.pad.GetParent().Add(pad)
|
||||||
|
|
||||||
def GetPad(self, is_first_pad, pos):
|
def GetPad(self, is_first_pad, pos):
|
||||||
|
|
||||||
if (self.firstPad and is_first_pad):
|
if (self.firstPad and is_first_pad):
|
||||||
pad = self.firstPad
|
pad = self.firstPad
|
||||||
else:
|
else:
|
||||||
|
@ -108,7 +101,6 @@ class PadArray:
|
||||||
|
|
||||||
# create a new pad with same characteristics
|
# create a new pad with same characteristics
|
||||||
pad = pad.Duplicate()
|
pad = pad.Duplicate()
|
||||||
|
|
||||||
pad.SetPos0(pos)
|
pad.SetPos0(pos)
|
||||||
pad.SetPosition(pos)
|
pad.SetPosition(pos)
|
||||||
|
|
||||||
|
@ -167,21 +159,56 @@ class PadGridArray(PadArray):
|
||||||
pin1posY = self.centre.y - self.py * (self.ny - 1) / 2
|
pin1posY = self.centre.y - self.py * (self.ny - 1) / 2
|
||||||
|
|
||||||
for x in range(0, self.nx):
|
for x in range(0, self.nx):
|
||||||
|
|
||||||
posX = pin1posX + (x * self.px)
|
posX = pin1posX + (x * self.px)
|
||||||
|
|
||||||
for y in range(self.ny):
|
for y in range(self.ny):
|
||||||
posY = pin1posY + (self.py * y)
|
posY = pin1posY + (self.py * y)
|
||||||
|
|
||||||
pos = dc.TransformPoint(posX, posY)
|
pos = dc.TransformPoint(posX, posY)
|
||||||
|
|
||||||
pad = self.GetPad(x == 0 and y == 0, pos)
|
pad = self.GetPad(x == 0 and y == 0, pos)
|
||||||
|
|
||||||
pad.SetPadName(self.GetName(x,y))
|
pad.SetPadName(self.GetName(x,y))
|
||||||
|
|
||||||
self.AddPad(pad)
|
self.AddPad(pad)
|
||||||
|
|
||||||
|
|
||||||
|
class PadZGridArray(PadArray):
|
||||||
|
|
||||||
|
def __init__(self, pad, pad_count, line_count, line_pitch,
|
||||||
|
pad_pitch, centre=pcbnew.wxPoint(0, 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
|
||||||
|
self.pad = pad
|
||||||
|
self.pad_count = int(pad_count)
|
||||||
|
self.line_count = int(line_count)
|
||||||
|
self.line_pitch = line_pitch
|
||||||
|
self.pad_pitch = pad_pitch
|
||||||
|
self.centre = centre
|
||||||
|
|
||||||
|
|
||||||
|
# right to left, top to bottom
|
||||||
|
def NamingFunction(self, pad_pos):
|
||||||
|
return self.firstPadNum + pad_pos
|
||||||
|
|
||||||
|
#relocate the pad and add it as many times as we need
|
||||||
|
def AddPadsToModule(self, dc):
|
||||||
|
|
||||||
|
pin1posX = self.centre.x - self.pad_pitch * (self.pad_count - 1) / 2
|
||||||
|
pin1posY = self.centre.y + self.line_pitch * (self.line_count - 1) / 2
|
||||||
|
line = 0
|
||||||
|
|
||||||
|
for padnum in range(0, self.pad_count):
|
||||||
|
posX = pin1posX + (padnum * self.pad_pitch)
|
||||||
|
posY = pin1posY - (self.line_pitch * line)
|
||||||
|
|
||||||
|
pos = dc.TransformPoint(posX, posY)
|
||||||
|
pad = self.GetPad(padnum == 0, pos)
|
||||||
|
pad.SetPadName(self.GetName(padnum))
|
||||||
|
self.AddPad(pad)
|
||||||
|
|
||||||
|
line += 1
|
||||||
|
|
||||||
|
if line >= self.line_count:
|
||||||
|
line = 0
|
||||||
|
|
||||||
class PadLineArray(PadGridArray):
|
class PadLineArray(PadGridArray):
|
||||||
|
|
||||||
def __init__(self, pad, n, pitch, isVertical,
|
def __init__(self, pad, n, pitch, isVertical,
|
||||||
|
@ -212,9 +239,7 @@ class PadCircleArray(PadArray):
|
||||||
|
|
||||||
#relocate the pad and add it as many times as we need
|
#relocate the pad and add it as many times as we need
|
||||||
def AddPadsToModule(self, dc):
|
def AddPadsToModule(self, dc):
|
||||||
|
|
||||||
for pin in range(0, self.n):
|
for pin in range(0, self.n):
|
||||||
|
|
||||||
angle = self.angle_offset + (360 / self.n) * pin
|
angle = self.angle_offset + (360 / self.n) * pin
|
||||||
|
|
||||||
if not self.clockwise:
|
if not self.clockwise:
|
||||||
|
@ -222,13 +247,9 @@ class PadCircleArray(PadArray):
|
||||||
|
|
||||||
pos_x = math.sin(angle * math.pi / 180) * self.r
|
pos_x = math.sin(angle * math.pi / 180) * self.r
|
||||||
pos_y = -math.cos(angle * math.pi / 180) * self.r
|
pos_y = -math.cos(angle * math.pi / 180) * self.r
|
||||||
|
|
||||||
pos = dc.TransformPoint(pos_x, pos_y)
|
pos = dc.TransformPoint(pos_x, pos_y)
|
||||||
|
|
||||||
pad = self.GetPad(pin == 0, pos)
|
pad = self.GetPad(pin == 0, pos)
|
||||||
|
|
||||||
pad.SetPadName(self.GetName(pin))
|
pad.SetPadName(self.GetName(pin))
|
||||||
|
|
||||||
self.AddPad(pad)
|
self.AddPad(pad)
|
||||||
|
|
||||||
class PadCustomArray(PadArray):
|
class PadCustomArray(PadArray):
|
||||||
|
@ -239,7 +260,6 @@ class PadCustomArray(PadArray):
|
||||||
def __init__(self, pad, array):
|
def __init__(self, pad, array):
|
||||||
PadArray.__init__(self)
|
PadArray.__init__(self)
|
||||||
self.pad = pad
|
self.pad = pad
|
||||||
|
|
||||||
self.array = array
|
self.array = array
|
||||||
|
|
||||||
def NamingFunction(self, n):
|
def NamingFunction(self, n):
|
||||||
|
@ -249,11 +269,7 @@ class PadCustomArray(PadArray):
|
||||||
def AddPadsToModule(self, dc):
|
def AddPadsToModule(self, dc):
|
||||||
|
|
||||||
for i in range(len(self.array)):
|
for i in range(len(self.array)):
|
||||||
|
|
||||||
pos = dc.TransformPoint(self.array[i][0], self.array[i][1])
|
pos = dc.TransformPoint(self.array[i][0], self.array[i][1])
|
||||||
|
|
||||||
pad = self.GetPad(i == 0, pos)
|
pad = self.GetPad(i == 0, pos)
|
||||||
|
|
||||||
pad.SetPadName(self.GetName(i))
|
pad.SetPadName(self.GetName(i))
|
||||||
|
|
||||||
self.AddPad(pad)
|
self.AddPad(pad)
|
||||||
|
|
|
@ -62,9 +62,7 @@ class BGAWizard(HFPW.HelpfulFootprintWizardPlugin):
|
||||||
rows = pads["*row count"]
|
rows = pads["*row count"]
|
||||||
cols = pads["*column count"]
|
cols = pads["*column count"]
|
||||||
pad_size = pads["pad size"]
|
pad_size = pads["pad size"]
|
||||||
|
|
||||||
pad_size = pcbnew.wxSize(pad_size, pad_size)
|
pad_size = pcbnew.wxSize(pad_size, pad_size)
|
||||||
|
|
||||||
pad_pitch = pads["pad pitch"]
|
pad_pitch = pads["pad pitch"]
|
||||||
|
|
||||||
# add in the pads
|
# add in the pads
|
||||||
|
@ -83,6 +81,13 @@ class BGAWizard(HFPW.HelpfulFootprintWizardPlugin):
|
||||||
self.draw.BoxWithDiagonalAtCorner(0, 0, ssx*2, ssy*2,
|
self.draw.BoxWithDiagonalAtCorner(0, 0, ssx*2, ssy*2,
|
||||||
pads["outline x margin"])
|
pads["outline x margin"])
|
||||||
|
|
||||||
|
# Courtyard
|
||||||
|
cmargin = self.draw.GetLineTickness()
|
||||||
|
self.draw.SetLayer(pcbnew.F_CrtYd)
|
||||||
|
sizex = (ssx + cmargin) * 2
|
||||||
|
sizey = (ssy + cmargin) * 2
|
||||||
|
self.draw.Box(0, 0, sizex, sizey)
|
||||||
|
|
||||||
#reference and value
|
#reference and value
|
||||||
text_size = self.GetTextSize() # IPC nominal
|
text_size = self.GetTextSize() # IPC nominal
|
||||||
ypos = ssy + text_size
|
ypos = ssy + text_size
|
||||||
|
|
|
@ -57,9 +57,7 @@ class circular_pad_array_wizard(HFPW.HelpfulFootprintWizardPlugin):
|
||||||
pad_size = prm['pad width']
|
pad_size = prm['pad width']
|
||||||
|
|
||||||
pad = PA.PadMaker(self.module).THPad(
|
pad = PA.PadMaker(self.module).THPad(
|
||||||
prm['pad width'],
|
prm['pad width'], prm['pad width'], prm['drill'])
|
||||||
prm['pad width'],
|
|
||||||
prm['drill'])
|
|
||||||
|
|
||||||
array = PA.PadCircleArray(
|
array = PA.PadCircleArray(
|
||||||
pad, prm['*n'], prm['circle diameter'] / 2,
|
pad, prm['*n'], prm['circle diameter'] / 2,
|
||||||
|
|
|
@ -38,8 +38,9 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
|
||||||
self.AddParam("Pads", "horizontal pitch", self.uMM, 15)
|
self.AddParam("Pads", "horizontal pitch", self.uMM, 15)
|
||||||
self.AddParam("Pads", "oval", self.uBool, True)
|
self.AddParam("Pads", "oval", self.uBool, True)
|
||||||
|
|
||||||
self.AddParam("Pads", "package width", self.uMM, 14)
|
self.AddParam("Package", "package width", self.uMM, 14)
|
||||||
self.AddParam("Pads", "package height", self.uMM, 14)
|
self.AddParam("Package", "package height", self.uMM, 14)
|
||||||
|
self.AddParam("Package", "courtyard margin", self.uMM, 1)
|
||||||
|
|
||||||
def CheckParameters(self):
|
def CheckParameters(self):
|
||||||
self.CheckParamInt("Pads", "*n", is_multiple_of=4)
|
self.CheckParamInt("Pads", "*n", is_multiple_of=4)
|
||||||
|
@ -64,7 +65,8 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
|
||||||
|
|
||||||
pad_shape = pcbnew.PAD_SHAPE_OVAL if pads["*oval"] else pcbnew.PAD_SHAPE_RECT
|
pad_shape = pcbnew.PAD_SHAPE_OVAL if pads["*oval"] else pcbnew.PAD_SHAPE_RECT
|
||||||
|
|
||||||
h_pad = PA.PadMaker(self.module).SMDPad( pad_width, pad_length, shape=pad_shape)
|
h_pad = PA.PadMaker(self.module).SMDPad( pad_length, pad_width,
|
||||||
|
shape=pad_shape, rot_degree=90.0)
|
||||||
v_pad = PA.PadMaker(self.module).SMDPad( pad_length, pad_width, shape=pad_shape)
|
v_pad = PA.PadMaker(self.module).SMDPad( pad_length, pad_width, shape=pad_shape)
|
||||||
|
|
||||||
#left row
|
#left row
|
||||||
|
@ -75,8 +77,7 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
|
||||||
|
|
||||||
#bottom row
|
#bottom row
|
||||||
pin1Pos = pcbnew.wxPoint(0, v_pitch / 2)
|
pin1Pos = pcbnew.wxPoint(0, v_pitch / 2)
|
||||||
array = PA.PadLineArray(v_pad, pads_per_row, pad_pitch, False,
|
array = PA.PadLineArray(v_pad, pads_per_row, pad_pitch, False, pin1Pos)
|
||||||
pin1Pos)
|
|
||||||
array.SetFirstPadInArray(pads_per_row + 1)
|
array.SetFirstPadInArray(pads_per_row + 1)
|
||||||
array.AddPadsToModule(self.draw)
|
array.AddPadsToModule(self.draw)
|
||||||
|
|
||||||
|
@ -94,8 +95,8 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
|
||||||
array.SetFirstPadInArray(3*pads_per_row + 1)
|
array.SetFirstPadInArray(3*pads_per_row + 1)
|
||||||
array.AddPadsToModule(self.draw)
|
array.AddPadsToModule(self.draw)
|
||||||
|
|
||||||
lim_x = pads["package width"] / 2
|
lim_x = self.parameters["Package"]["package width"] / 2
|
||||||
lim_y = pads["package height"] / 2
|
lim_y = self.parameters["Package"]["package height"] / 2
|
||||||
inner = (row_len / 2) + pad_pitch
|
inner = (row_len / 2) + pad_pitch
|
||||||
|
|
||||||
#top left - diagonal
|
#top left - diagonal
|
||||||
|
@ -107,6 +108,13 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
|
||||||
# bottom right
|
# bottom right
|
||||||
self.draw.Polyline([(inner, lim_y), (lim_x, lim_y), (lim_x, inner)])
|
self.draw.Polyline([(inner, lim_y), (lim_x, lim_y), (lim_x, inner)])
|
||||||
|
|
||||||
|
# Courtyard
|
||||||
|
cmargin = self.parameters["Package"]["courtyard margin"]
|
||||||
|
self.draw.SetLayer(pcbnew.F_CrtYd)
|
||||||
|
sizex = (lim_x + cmargin) * 2 + pad_length
|
||||||
|
sizey = (lim_y + cmargin) * 2 + pad_length
|
||||||
|
self.draw.Box(0, 0, sizex, sizey)
|
||||||
|
|
||||||
#reference and value
|
#reference and value
|
||||||
text_size = self.GetTextSize() # IPC nominal
|
text_size = self.GetTextSize() # IPC nominal
|
||||||
text_offset = v_pitch / 2 + text_size + pad_length / 2
|
text_offset = v_pitch / 2 + text_size + pad_length / 2
|
||||||
|
|
|
@ -24,73 +24,98 @@ import PadArray as PA
|
||||||
class RowedGridArray(PA.PadGridArray):
|
class RowedGridArray(PA.PadGridArray):
|
||||||
|
|
||||||
def NamingFunction(self, x, y):
|
def NamingFunction(self, x, y):
|
||||||
if (x % 2) == 0: # even row, count up
|
pad_cnt = self.nx*self.ny
|
||||||
return (x * self.ny) + y + 1
|
|
||||||
else: # odd row, count down
|
if self.ny == 1:
|
||||||
return (self.ny * (x + 1)) - y
|
return x+1
|
||||||
|
|
||||||
|
if (y % 2) == 0: # upper row, count down
|
||||||
|
return pad_cnt-x
|
||||||
|
else: # lower row, count up
|
||||||
|
return x+1
|
||||||
|
|
||||||
|
|
||||||
class RowedFootprint(HFPW.HelpfulFootprintWizardPlugin):
|
class RowedFootprint(HFPW.HelpfulFootprintWizardPlugin):
|
||||||
|
|
||||||
|
pad_count_key = 'pas count'
|
||||||
|
row_count_key = 'row count'
|
||||||
|
row_spacing_key = 'row spacing'
|
||||||
|
pad_length_key = 'pad length'
|
||||||
|
pad_width_key = 'pad width'
|
||||||
|
pad_pitch_key = 'pad pitch'
|
||||||
|
|
||||||
|
silkscreen_inside_key = 'silk screen inside'
|
||||||
|
outline_x_margin_key = 'outline x margin'
|
||||||
|
outline_y_margin_key = 'outline y margin'
|
||||||
|
|
||||||
def GenerateParameterList(self):
|
def GenerateParameterList(self):
|
||||||
# defaults for a DIP package
|
# defaults for a DIP package
|
||||||
self.AddParam("Pads", "n", self.uNatural, 24)
|
self.AddParam("Pads", self.pad_count_key, self.uNatural, 24)
|
||||||
self.AddParam("Pads", "silk screen inside", self.uBool, False)
|
self.AddParam("Pads", self.row_count_key, self.uNatural, 2)
|
||||||
self.AddParam("Pads", "row count", self.uNatural, 2)
|
|
||||||
|
self.AddParam("Body", self.silkscreen_inside_key, self.uBool, False)
|
||||||
|
self.AddParam("Body", self.outline_x_margin_key, self.uMM, 0.5)
|
||||||
|
self.AddParam("Body", self.outline_y_margin_key, self.uMM, 0.5)
|
||||||
|
|
||||||
def CheckParameters(self):
|
def CheckParameters(self):
|
||||||
self.CheckParamInt("Pads", "*row count", min_value=1, max_value=2)
|
self.CheckParamInt("Pads", '*' + self.row_count_key, min_value=1, max_value=2)
|
||||||
self.CheckParamInt(
|
self.CheckParamInt(
|
||||||
"Pads", "*n",
|
"Pads", '*' + self.pad_count_key,
|
||||||
is_multiple_of=self.parameters["Pads"]["*row count"])
|
is_multiple_of=self.parameters["Pads"]['*' + self.row_count_key])
|
||||||
|
|
||||||
# can do this internally to parameter manager?
|
# can do this internally to parameter manager?
|
||||||
self.CheckParamBool("Pads", "*silk screen inside")
|
self.CheckParamBool("Body", '*' + self.silkscreen_inside_key)
|
||||||
|
|
||||||
def BuildThisFootprint(self):
|
def BuildThisFootprint(self):
|
||||||
pads = self.parameters["Pads"]
|
pads = self.parameters["Pads"]
|
||||||
num_pads = pads["*n"]
|
body = self.parameters["Body"]
|
||||||
pad_length = pads["pad length"]
|
num_pads = pads['*' + self.pad_count_key]
|
||||||
pad_width = pads["pad width"]
|
pad_length = pads[self.pad_length_key]
|
||||||
row_pitch = pads["row spacing"]
|
pad_width = pads[self.pad_width_key]
|
||||||
pad_pitch = pads["pad pitch"]
|
row_pitch = pads[self.row_spacing_key]
|
||||||
num_rows = pads["*row count"]
|
pad_pitch = pads[self.pad_pitch_key]
|
||||||
|
num_rows = pads['*' + self.row_count_key]
|
||||||
|
|
||||||
pads_per_row = num_pads // num_rows
|
pads_per_row = num_pads // num_rows
|
||||||
row_length = pad_pitch * (pads_per_row - 1) # fenceposts
|
|
||||||
|
|
||||||
# add in the pads
|
# add in the pads
|
||||||
pad = self.GetPad()
|
pad = self.GetPad()
|
||||||
|
|
||||||
pin1_pos = pcbnew.wxPoint(
|
array = RowedGridArray(pad, pads_per_row, num_rows, pad_pitch, row_pitch)
|
||||||
-((num_rows - 1) * row_pitch) / 2,
|
|
||||||
-row_length / 2)
|
|
||||||
|
|
||||||
array = RowedGridArray(pad, num_rows, pads_per_row, row_pitch,
|
|
||||||
pad_pitch)
|
|
||||||
array.AddPadsToModule(self.draw)
|
array.AddPadsToModule(self.draw)
|
||||||
|
|
||||||
# draw the Silk Screen
|
# draw the Silk Screen
|
||||||
|
Hsize = pad_pitch * (num_pads / num_rows - 1)
|
||||||
|
Vsize = row_pitch * (num_rows - 1)
|
||||||
|
pin1_posY = -Vsize / 2
|
||||||
|
pin1_posX = -Hsize / 2
|
||||||
|
|
||||||
pad_length = pads["pad length"]
|
pad_length = pads[self.pad_length_key]
|
||||||
pad_width = pads["pad width"]
|
pad_width = pads[self.pad_width_key]
|
||||||
|
|
||||||
ssx_offset = -pad_length / 2 - pads["outline x margin"]
|
ssx_offset = -pad_width / 2 - body[self.outline_x_margin_key]
|
||||||
ssy_offset = -pad_width / 2 - pads["outline y margin"]
|
ssy_offset = -pad_length / 2 - body[self.outline_y_margin_key]
|
||||||
|
|
||||||
if pads["*silk screen inside"]:
|
if body['*' + self.silkscreen_inside_key]:
|
||||||
ssx_offset *= -1
|
ssy_offset *= -1
|
||||||
|
|
||||||
ssx = -pin1_pos.x - ssx_offset
|
ssx = -pin1_posX - ssx_offset
|
||||||
ssy = -pin1_pos.y - ssy_offset
|
ssy = -pin1_posY - ssy_offset
|
||||||
|
|
||||||
self.DrawBox(ssx, ssy)
|
self.DrawBox(ssx, ssy)
|
||||||
|
|
||||||
#reference and value
|
#reference and value
|
||||||
text_size = self.GetTextSize() # IPC nominal
|
text_size = self.GetTextSize() # IPC nominal
|
||||||
|
|
||||||
self.draw.Value(0, - ssy - text_size, text_size)
|
if num_rows == 1:
|
||||||
self.draw.Reference(0, ssy + text_size, text_size)
|
text_py = ssy + text_size
|
||||||
|
self.draw.Value(0, -text_py, text_size)
|
||||||
|
self.draw.Reference(0, text_py, text_size)
|
||||||
|
else:
|
||||||
|
text_px = ssx + text_size
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
|
||||||
class SDIPWizard(RowedFootprint):
|
class SDIPWizard(RowedFootprint):
|
||||||
|
@ -104,34 +129,44 @@ class SDIPWizard(RowedFootprint):
|
||||||
def GenerateParameterList(self):
|
def GenerateParameterList(self):
|
||||||
RowedFootprint.GenerateParameterList(self)
|
RowedFootprint.GenerateParameterList(self)
|
||||||
|
|
||||||
self.AddParam("Pads", "pad pitch", self.uMils, 100)
|
self.AddParam("Pads", self.pad_pitch_key, self.uMM, 2.54)
|
||||||
self.AddParam("Pads", "pad width", self.uMils, 60)
|
self.AddParam("Pads", self.pad_width_key, self.uMM, 1.2)
|
||||||
self.AddParam("Pads", "pad length", self.uMils, 150)
|
self.AddParam("Pads", self.pad_length_key, self.uMM, 2)
|
||||||
self.AddParam("Pads", "row spacing", self.uMils, 300)
|
self.AddParam("Pads", self.row_spacing_key, self.uMM, 7.52)
|
||||||
self.AddParam("Pads", "drill size", self.uMM, 1)
|
self.AddParam("Pads", "drill size", self.uMM, 0.8)
|
||||||
self.AddParam("Pads", "outline x margin", self.uMM, 0.5)
|
|
||||||
self.AddParam("Pads", "outline y margin", self.uMM, 1)
|
|
||||||
|
|
||||||
def GetValue(self):
|
def GetValue(self):
|
||||||
rows = self.parameters["Pads"]["*row count"]
|
pads = self.parameters["Pads"]
|
||||||
|
rows = pads['*' + self.row_count_key]
|
||||||
|
pad_count = pads['*' + self.pad_count_key]
|
||||||
|
row_dist_mil = pcbnew.Iu2Mils(int(self.parameters["Pads"][self.row_spacing_key])) #int(self.parameters["Pads"][self.row_spacing_key] / 2.54 * 100)
|
||||||
|
pad_shape = ""
|
||||||
|
|
||||||
|
if pads[self.pad_width_key] != pads[self.pad_length_key]:
|
||||||
|
pad_shape = '_ELL'
|
||||||
|
|
||||||
if rows == 1:
|
if rows == 1:
|
||||||
name = "SIP"
|
name = "SIP"
|
||||||
else:
|
return "%s-%d" % (name, pad_count)
|
||||||
name = "DIP"
|
|
||||||
|
|
||||||
return "%s-%d" % (name, self.parameters["Pads"]["*n"])
|
name = "DIP"
|
||||||
|
return "%s-%d_%d%s" % (name, pad_count, row_dist_mil, pad_shape)
|
||||||
|
|
||||||
def GetPad(self):
|
def GetPad(self):
|
||||||
pad_length = self.parameters["Pads"]["pad length"]
|
pad_length = self.parameters["Pads"][self.pad_length_key]
|
||||||
pad_width = self.parameters["Pads"]["pad width"]
|
pad_width = self.parameters["Pads"][self.pad_width_key]
|
||||||
drill = self.parameters["Pads"]["drill size"]
|
drill = self.parameters["Pads"]["drill size"]
|
||||||
|
shape = pcbnew.PAD_SHAPE_CIRCLE
|
||||||
|
|
||||||
|
if pad_length != pad_width:
|
||||||
|
shape = pcbnew.PAD_SHAPE_OVAL
|
||||||
|
|
||||||
return PA.PadMaker(self.module).THPad(
|
return PA.PadMaker(self.module).THPad(
|
||||||
pad_width, pad_length, drill, shape=pcbnew.PAD_SHAPE_OVAL)
|
pad_length, pad_width, drill, shape=shape)
|
||||||
|
|
||||||
def DrawBox(self, ssx, ssy):
|
def DrawBox(self, ssx, ssy):
|
||||||
|
|
||||||
if self.parameters["Pads"]["*row count"] == 2:
|
if self.parameters["Pads"]['*' + self.row_count_key] == 2:
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
# |8 7 6 5 |
|
# |8 7 6 5 |
|
||||||
|
@ -140,10 +175,12 @@ class SDIPWizard(RowedFootprint):
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
# draw the notch
|
# draw the notch
|
||||||
notchWidth = pcbnew.FromMM(3)
|
notchWidth = ssy/1.5
|
||||||
notchHeight = pcbnew.FromMM(1)
|
notchHeight = self.draw.GetLineTickness()*3
|
||||||
|
|
||||||
self.draw.NotchedBox(0, 0, ssx*2, ssy*2, notchWidth, notchHeight)
|
# NotchedBox draws the notch on top. Rotate the box 90 degrees
|
||||||
|
# to have it on the left
|
||||||
|
self.draw.NotchedBox(0, 0, ssy*2, ssx*2, notchWidth, notchHeight, -90)
|
||||||
else:
|
else:
|
||||||
# -----------------
|
# -----------------
|
||||||
# |1|2 3 4 5 6 7 8|
|
# |1|2 3 4 5 6 7 8|
|
||||||
|
@ -151,9 +188,10 @@ class SDIPWizard(RowedFootprint):
|
||||||
self.draw.Box(0, 0, ssx*2, ssy*2)
|
self.draw.Box(0, 0, ssx*2, ssy*2)
|
||||||
|
|
||||||
#line between pin1 and pin2
|
#line between pin1 and pin2
|
||||||
pad_pitch = self.parameters["Pads"]["pad pitch"]
|
pad_pitch = self.parameters["Pads"][self.pad_pitch_key]
|
||||||
line_y = - (self.parameters["Pads"]["*n"] - 2) * pad_pitch / 2
|
pad_cnt = self.parameters["Pads"]['*' + self.pad_count_key]
|
||||||
self.draw.HLine(-ssx, line_y, ssx * 2)
|
line_x = ( pad_cnt/2 - 1) * pad_pitch
|
||||||
|
self.draw.VLine(-line_x, -ssy, ssy * 2)
|
||||||
|
|
||||||
return ssx, ssy
|
return ssx, ssy
|
||||||
|
|
||||||
|
@ -169,25 +207,23 @@ class SOICWizard(RowedFootprint):
|
||||||
return "SOIC, MSOP, SSOP, TSSOP, etc, footprint wizard"
|
return "SOIC, MSOP, SSOP, TSSOP, etc, footprint wizard"
|
||||||
|
|
||||||
def GetValue(self):
|
def GetValue(self):
|
||||||
return "%s-%d" % ("SOIC", self.parameters["Pads"]["*n"])
|
pad_count = self.parameters["Pads"]['*' + self.pad_count_key]
|
||||||
|
return "%s-%d" % ("SOIC", pad_count)
|
||||||
|
|
||||||
def GenerateParameterList(self):
|
def GenerateParameterList(self):
|
||||||
RowedFootprint.GenerateParameterList(self)
|
RowedFootprint.GenerateParameterList(self)
|
||||||
|
|
||||||
#and override some of them
|
#and override some of them
|
||||||
self.AddParam("Pads", "pad pitch", self.uMM, 1.27)
|
self.AddParam("Pads", self.pad_pitch_key, self.uMM, 1.27)
|
||||||
self.AddParam("Pads", "pad width", self.uMM, 0.6)
|
self.AddParam("Pads", self.pad_width_key, self.uMM, 0.6)
|
||||||
self.AddParam("Pads", "pad length", self.uMM, 2.2)
|
self.AddParam("Pads", self.pad_length_key, self.uMM, 2.2)
|
||||||
self.AddParam("Pads", "row spacing", self.uMM, 5.2)
|
self.AddParam("Pads", self.row_spacing_key, self.uMM, 5.2)
|
||||||
|
|
||||||
self.AddParam("Pads", "outline x margin", self.uMM, 0.5)
|
|
||||||
self.AddParam("Pads", "outline y margin", self.uMM, 0.5)
|
|
||||||
|
|
||||||
def GetPad(self):
|
def GetPad(self):
|
||||||
pad_length = self.parameters["Pads"]["pad length"]
|
pad_length = self.parameters["Pads"][self.pad_length_key]
|
||||||
pad_width = self.parameters["Pads"]["pad width"]
|
pad_width = self.parameters["Pads"][self.pad_width_key]
|
||||||
return PA.PadMaker(self.module).SMDPad(
|
return PA.PadMaker(self.module).SMDPad(
|
||||||
pad_width, pad_length, shape=pcbnew.PAD_SHAPE_RECT)
|
pad_length, pad_width, shape=pcbnew.PAD_SHAPE_RECT)
|
||||||
|
|
||||||
def DrawBox(self, ssx, ssy):
|
def DrawBox(self, ssx, ssy):
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,201 @@
|
||||||
|
# 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
# MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
import pcbnew
|
||||||
|
|
||||||
|
import HelpfulFootprintWizardPlugin as HFPW
|
||||||
|
import PadArray as PA
|
||||||
|
|
||||||
|
|
||||||
|
class RowedFootprint(HFPW.HelpfulFootprintWizardPlugin):
|
||||||
|
|
||||||
|
pad_count_key = '#pad count'
|
||||||
|
line_count_key = '#line count'
|
||||||
|
pad_vertical_size_key = 'pad vertical size'
|
||||||
|
pad_horizontal_size_key = 'pad horizontal size'
|
||||||
|
line_spacing_key = 'line spacing'
|
||||||
|
pad_pitch_key = 'pad pitch'
|
||||||
|
drill_size_key = 'drill size'
|
||||||
|
|
||||||
|
courtyard_x_margin_key = 'courtyard x margin'
|
||||||
|
courtyard_y_margin_key = 'courtyard y margin'
|
||||||
|
outline_x_margin_key = 'outline x margin'
|
||||||
|
outline_y_margin_key = 'outline y margin'
|
||||||
|
silkscreen_inside_key = 'silk screen inside'
|
||||||
|
|
||||||
|
def GenerateParameterList(self):
|
||||||
|
|
||||||
|
# defaults for a ZIP package
|
||||||
|
self.AddParam("Pads", self.pad_count_key, self.uNatural, 24)
|
||||||
|
self.AddParam("Pads", self.line_count_key, self.uNatural, 2)
|
||||||
|
self.AddParam("Body", self.silkscreen_inside_key, self.uBool, False)
|
||||||
|
self.AddParam("Body", self.courtyard_x_margin_key, self.uMM, 1)
|
||||||
|
self.AddParam("Body", self.courtyard_y_margin_key, self.uMM, 1)
|
||||||
|
|
||||||
|
def CheckParameters(self):
|
||||||
|
self.CheckParamInt("Pads", '*' + self.pad_count_key)
|
||||||
|
self.CheckParamInt("Pads", '*' + self.line_count_key)
|
||||||
|
|
||||||
|
# can do this internally to parameter manager?
|
||||||
|
self.CheckParamBool("Body", '*' + self.silkscreen_inside_key)
|
||||||
|
|
||||||
|
def BuildThisFootprint(self):
|
||||||
|
pads = self.parameters["Pads"]
|
||||||
|
body = self.parameters["Body"]
|
||||||
|
|
||||||
|
pad_count = pads['*' + self.pad_count_key]
|
||||||
|
pad_Vsize = pads[self.pad_vertical_size_key]
|
||||||
|
pad_Hsize = pads[self.pad_horizontal_size_key]
|
||||||
|
line_pitch = pads[self.line_spacing_key]
|
||||||
|
pad_pitch = pads[self.pad_pitch_key]
|
||||||
|
line_count = pads['*' + self.line_count_key]
|
||||||
|
|
||||||
|
if line_count == 1:
|
||||||
|
singleline = True
|
||||||
|
else:
|
||||||
|
singleline = False
|
||||||
|
|
||||||
|
# add in the pads
|
||||||
|
pad = self.GetPad()
|
||||||
|
|
||||||
|
array = PA.PadZGridArray(pad, pad_count, line_count, line_pitch, pad_pitch)
|
||||||
|
array.AddPadsToModule(self.draw)
|
||||||
|
|
||||||
|
# draw the Silk Screen
|
||||||
|
pads_per_line = pad_count // line_count
|
||||||
|
row_length = pad_pitch * (pads_per_line - 1) # fenceposts
|
||||||
|
ssx_offset = pad_Hsize / 2 + body[self.outline_x_margin_key]
|
||||||
|
ssy_offset = pad_Vsize / 2 + body[self.outline_y_margin_key]
|
||||||
|
|
||||||
|
pin1posX = pad_pitch * (pad_count - 1) / 2
|
||||||
|
pin1posY = line_pitch * (line_count - 1) / 2
|
||||||
|
leftx = pin1posX + ssx_offset
|
||||||
|
lowy = pin1posY + ssy_offset
|
||||||
|
|
||||||
|
cornery = lowy
|
||||||
|
|
||||||
|
# body inside pads is possible only for 2 rows.
|
||||||
|
# for other values, there is no room
|
||||||
|
linew = self.draw.GetLineTickness()
|
||||||
|
if body['*'+self.silkscreen_inside_key] and line_count == 2:
|
||||||
|
cornery = pin1posY - ssy_offset
|
||||||
|
if cornery < linew:
|
||||||
|
cornery = linew
|
||||||
|
|
||||||
|
self.DrawBox(leftx*2, cornery*2)
|
||||||
|
|
||||||
|
# Courtyard
|
||||||
|
cmarginx = body[self.courtyard_x_margin_key]
|
||||||
|
cmarginy = body[self.courtyard_y_margin_key]
|
||||||
|
self.draw.SetLayer(pcbnew.F_CrtYd)
|
||||||
|
sizex = (pin1posX + cmarginx) * 2 + pad_Hsize
|
||||||
|
sizey = (pin1posY + cmarginy) * 2 + pad_Vsize
|
||||||
|
self.draw.Box(0, 0, sizex, sizey)
|
||||||
|
|
||||||
|
#reference and value
|
||||||
|
text_size = self.GetTextSize() # IPC nominal
|
||||||
|
t_posy = lowy + text_size
|
||||||
|
|
||||||
|
self.draw.Value(0, t_posy, text_size)
|
||||||
|
self.draw.Reference(0, -t_posy, text_size)
|
||||||
|
|
||||||
|
def DrawBox(self, sizex, sizey):
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
# | 2 4 6 8|
|
||||||
|
# |1 3 5 7 |
|
||||||
|
# \---------
|
||||||
|
setback = pcbnew.FromMM(1)
|
||||||
|
|
||||||
|
if setback > sizey/2:
|
||||||
|
setback = sizey/2
|
||||||
|
|
||||||
|
self.draw.BoxWithDiagonalAtCorner(0, 0, sizex, sizey, setback, self.draw.flipY)
|
||||||
|
|
||||||
|
|
||||||
|
class ZIPWizard(RowedFootprint):
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return "ZIP"
|
||||||
|
|
||||||
|
def GetDescription(self):
|
||||||
|
return "N lines Zip Package Footprint Wizard"
|
||||||
|
|
||||||
|
def GenerateParameterList(self):
|
||||||
|
RowedFootprint.GenerateParameterList(self)
|
||||||
|
|
||||||
|
self.AddParam("Pads", self.pad_pitch_key, self.uMM, 1.27)
|
||||||
|
self.AddParam("Pads", self.pad_horizontal_size_key, self.uMM, 1.2)
|
||||||
|
self.AddParam("Pads", self.pad_vertical_size_key, self.uMM, 2)
|
||||||
|
self.AddParam("Pads", self.line_spacing_key, self.uMM, 2.54)
|
||||||
|
self.AddParam("Pads", self.drill_size_key, self.uMM, 0.8)
|
||||||
|
self.AddParam("Body", self.outline_x_margin_key, self.uMM, 1)
|
||||||
|
self.AddParam("Body", self.outline_y_margin_key, self.uMM, 0.5)
|
||||||
|
|
||||||
|
def GetValue(self):
|
||||||
|
rows = self.parameters["Pads"]['*' + self.line_count_key]
|
||||||
|
pad_cnt = self.parameters["Pads"]['*' + self.pad_count_key]
|
||||||
|
|
||||||
|
if rows == 1:
|
||||||
|
name = "SIP"
|
||||||
|
elif rows == 2:
|
||||||
|
name = "ZIP"
|
||||||
|
else: # triple and up aren't really a thing, but call it something!
|
||||||
|
name = "xIP"
|
||||||
|
|
||||||
|
return "%s-%d" % (name, pad_cnt)
|
||||||
|
|
||||||
|
def GetPad(self):
|
||||||
|
pad_Vsize = self.parameters["Pads"][self.pad_vertical_size_key]
|
||||||
|
pad_Hsize = self.parameters["Pads"][self.pad_horizontal_size_key]
|
||||||
|
drill = self.parameters["Pads"][self.drill_size_key]
|
||||||
|
return PA.PadMaker(self.module).THPad(
|
||||||
|
pad_Vsize, pad_Hsize, drill, shape=pcbnew.PAD_SHAPE_OVAL)
|
||||||
|
|
||||||
|
ZIPWizard().register()
|
||||||
|
|
||||||
|
|
||||||
|
class ZOICWizard(RowedFootprint):
|
||||||
|
|
||||||
|
def GetName(self):
|
||||||
|
return "ZOIC"
|
||||||
|
|
||||||
|
def GetDescription(self):
|
||||||
|
return "ZOIC, etc, Footprint Wizard"
|
||||||
|
|
||||||
|
def GetValue(self):
|
||||||
|
return "%s-%d" % ("ZOIC", self.parameters["Pads"]['*' + self.pad_count_key])
|
||||||
|
|
||||||
|
def GenerateParameterList(self):
|
||||||
|
RowedFootprint.GenerateParameterList(self)
|
||||||
|
|
||||||
|
#and override some of them
|
||||||
|
self.AddParam("Pads", self.pad_pitch_key, self.uMM, 0.6)
|
||||||
|
self.AddParam("Pads", self.pad_horizontal_size_key, self.uMM, 0.6)
|
||||||
|
self.AddParam("Pads", self.pad_vertical_size_key, self.uMM, 1.8)
|
||||||
|
self.AddParam("Pads", self.line_spacing_key, self.uMM, 5.2)
|
||||||
|
|
||||||
|
self.AddParam("Body", self.outline_x_margin_key, self.uMM, 0.5)
|
||||||
|
self.AddParam("Body", self.outline_y_margin_key, self.uMM, 1)
|
||||||
|
|
||||||
|
def GetPad(self):
|
||||||
|
pad_Vsize = self.parameters["Pads"][self.pad_vertical_size_key]
|
||||||
|
pad_Hsize = self.parameters["Pads"][self.pad_horizontal_size_key]
|
||||||
|
return PA.PadMaker(self.module).SMDPad(
|
||||||
|
pad_Vsize, pad_Hsize, shape=pcbnew.PAD_SHAPE_RECT)
|
||||||
|
|
||||||
|
ZOICWizard().register()
|
|
@ -156,6 +156,7 @@ class FilePlugin(KiCadPlugin):
|
||||||
KiCadPlugin.__init__(self)
|
KiCadPlugin.__init__(self)
|
||||||
|
|
||||||
|
|
||||||
|
from math import ceil, floor, sqrt
|
||||||
|
|
||||||
class FootprintWizardPlugin(KiCadPlugin):
|
class FootprintWizardPlugin(KiCadPlugin):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -185,43 +186,45 @@ class FootprintWizardPlugin(KiCadPlugin):
|
||||||
return len(self.parameters)
|
return len(self.parameters)
|
||||||
|
|
||||||
def GetParameterPageName(self,page_n):
|
def GetParameterPageName(self,page_n):
|
||||||
return self.parameters.keys()[page_n]
|
return self.page_order[page_n]
|
||||||
|
|
||||||
def GetParameterNames(self,page_n):
|
def GetParameterNames(self,page_n):
|
||||||
name = self.GetParameterPageName(page_n)
|
name = self.GetParameterPageName(page_n)
|
||||||
return self.parameters[name].keys()
|
return self.parameter_order[name]
|
||||||
|
|
||||||
def GetParameterValues(self,page_n):
|
def GetParameterValues(self,page_n):
|
||||||
name = self.GetParameterPageName(page_n)
|
name = self.GetParameterPageName(page_n)
|
||||||
values = self.parameters[name].values()
|
names = self.GetParameterNames(page_n)
|
||||||
return map( lambda x: str(x) , values) # list elements as strings
|
values = [self.parameters[name][n] for n in names]
|
||||||
|
return map(lambda x: str(x), values) # list elements as strings
|
||||||
|
|
||||||
def GetParameterErrors(self,page_n):
|
def GetParameterErrors(self,page_n):
|
||||||
self.CheckParameters()
|
self.CheckParameters()
|
||||||
name = self.GetParameterPageName(page_n)
|
name = self.GetParameterPageName(page_n)
|
||||||
values = self.parameter_errors[name].values()
|
names = self.GetParameterNames(page_n)
|
||||||
return map( lambda x: str(x) , values) # list elements as strings
|
values = [self.parameter_errors[name][n] for n in names]
|
||||||
|
return map(lambda x: str(x), values) # list elements as strings
|
||||||
|
|
||||||
def CheckParameters(self):
|
def CheckParameters(self):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def TryConvertToFloat(self,value):
|
def ConvertValue(self,v):
|
||||||
v = value
|
|
||||||
try:
|
try:
|
||||||
v = float(value)
|
v = float(v)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
if type(v) is float:
|
||||||
|
if ceil(v) == floor(v):
|
||||||
|
v = int(v)
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
|
||||||
def SetParameterValues(self,page_n,values):
|
def SetParameterValues(self,page_n,values):
|
||||||
name = self.GetParameterPageName(page_n)
|
name = self.GetParameterPageName(page_n)
|
||||||
keys = self.parameters[name].keys()
|
keys = self.GetParameterNames(page_n)
|
||||||
n=0
|
for n, key in enumerate(keys):
|
||||||
for key in keys:
|
val = self.ConvertValue(values[n])
|
||||||
val = self.TryConvertToFloat(values[n])
|
|
||||||
self.parameters[name][key] = val
|
self.parameters[name][key] = val
|
||||||
n+=1
|
|
||||||
|
|
||||||
|
|
||||||
def ClearErrors(self):
|
def ClearErrors(self):
|
||||||
|
|
Loading…
Reference in New Issue