Skip to content

Commit

Permalink
Pcbnew: Add NPTH pads (seen changelog).
Browse files Browse the repository at this point in the history
Minor fixes and enhancements.
  • Loading branch information
jp-charras committed Aug 19, 2011
1 parent c64a693 commit 1e2b145
Show file tree
Hide file tree
Showing 27 changed files with 5,415 additions and 1,365 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.

2011-Aug-19, UPDATE Jean-Pierre Charras <[email protected]>
================================================================================
Pcbnew:
Add support for not plated through holes (NPTH) pads
* These NPTH pads are used for mechanical purpose only, and cannot be connected to a net.
* When these pads have a same size and shape for the hole and the pad, the pad is not plotted
in GERBER files.

2011-Apr-12, UPDATE Jerry Jacobs <[email protected]>
================================================================================
Minor UI changes that affect OS X platform.
Expand Down
14 changes: 12 additions & 2 deletions eeschema/backanno.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFile, bool aSetFieldAttributeToVis
SCH_REFERENCE_LIST referencesList;
SheetList.GetComponents( referencesList, false );

// Now, foe each component found in file,
// replace footprint field value by the new value:
while( GetLine( aFile, Line, &LineNum, sizeof(Line) ) )
{
if( sscanf( Line, "comp = \"%s module = \"%s", Ref, FootPrint ) == 2 )
Expand All @@ -58,12 +60,20 @@ bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFile, bool aSetFieldAttributeToVis
// So we do not stop the search here
SCH_COMPONENT* component = referencesList[ii].GetComponent();
SCH_FIELD * fpfield = component->GetField( FOOTPRINT );
/* Give a reasonable value to the field position and
* orientation, if the text is empty at position 0, because
* it is probably not yet initialized
*/
if( fpfield->m_Text.IsEmpty()
&& ( fpfield->m_Pos == wxPoint( 0, 0 ) ) )
&& ( fpfield->m_Pos == component->m_Pos ) )
{
fpfield->m_Orient = component->GetField( VALUE )->m_Orient;
fpfield->m_Pos = component->GetField( VALUE )->m_Pos;
fpfield->m_Pos.y -= 100;
fpfield->m_Size = component->GetField( VALUE )->m_Size;
if( fpfield->m_Orient == 0 )
fpfield->m_Pos.y += 100;
else
fpfield->m_Pos.x += 100;
}

fpfield->m_Text = footprint;
Expand Down
21 changes: 13 additions & 8 deletions eeschema/sch_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,20 +1065,25 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri
* orientation, if the text is empty at position 0, because
* it is probably not yet initialized
*/
if( component->GetField( FOOTPRINT )->m_Text.IsEmpty()
&& ( component->GetField( FOOTPRINT )->m_Pos == wxPoint( 0, 0 ) ) )
SCH_FIELD * fpfield = component->GetField( FOOTPRINT );
if( fpfield->m_Text.IsEmpty()
&& ( fpfield->m_Pos == component->m_Pos ) )
{
component->GetField( FOOTPRINT )->m_Orient = component->GetField( VALUE )->m_Orient;
component->GetField( FOOTPRINT )->m_Pos = component->GetField( VALUE )->m_Pos;
component->GetField( FOOTPRINT )->m_Pos.y -= 100;
fpfield->m_Orient = component->GetField( VALUE )->m_Orient;
fpfield->m_Pos = component->GetField( VALUE )->m_Pos;
fpfield->m_Size = component->GetField( VALUE )->m_Size;
if( fpfield->m_Orient == 0 )
fpfield->m_Pos.y += 100;
else
fpfield->m_Pos.x += 100;
}

component->GetField( FOOTPRINT )->m_Text = aFootPrint;
fpfield->m_Text = aFootPrint;

if( aSetVisible )
component->GetField( FOOTPRINT )->m_Attributs &= ~TEXT_NO_VISIBLE;
fpfield->m_Attributs &= ~TEXT_NO_VISIBLE;
else
component->GetField( FOOTPRINT )->m_Attributs |= TEXT_NO_VISIBLE;
fpfield->m_Attributs |= TEXT_NO_VISIBLE;

found = true;
}
Expand Down
17 changes: 16 additions & 1 deletion include/wxBasePcbFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,23 @@ class PCB_BASE_FRAME : public EDA_DRAW_FRAME
void Plot_Layer( PLOTTER* plotter,
int Layer,
GRTraceMode trace_mode );
/**
* Function Plot_Standard_Layer
* plot copper or technical layers.
* not used for silk screen layers, because these layers have specific
* requirements, mainly for pads
* @param aPlotter = the plotter to use
* @param aLayerMask = the mask to define the layers to plot
* @param aPlotVia = true to plot vias, false to skip vias (has meaning
* only for solder mask layers).
* @param aPlotMode = the plot mode (files, sketch). Has meaning for some formats only
* @param aSkipNPTH_Pads = true to skip NPTH Pads, when the pad size and the pad hole
* have the same size. Used in GERBER format only.
*/
void Plot_Standard_Layer( PLOTTER* aPlotter, int aLayerMask,
bool aPlotVia, GRTraceMode aPlotMode );
bool aPlotVia, GRTraceMode aPlotMode,
bool aSkipNPTH_Pads = false );

void Plot_Serigraphie( PLOTTER* plotter,
int masque_layer,
GRTraceMode trace_mode );
Expand Down
13 changes: 7 additions & 6 deletions kicad/tree_project_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ const wxChar* s_AllowedExtensionsToList[] =
wxT( "^[^$].*\\.brd$" ),
wxT( "^.*\\.net$" ),
wxT( "^.*\\.txt$" ),
wxT( "^.*\\.pho$" ), // Gerber file
wxT( "^.*\\.gbr$" ), // Gerber file
wxT( "^.*\\.gb[alops]$" ), // Gerber back (or bottom) layer file
wxT( "^.*\\.gt[alops]$" ), // Gerber front (or top) layer file
wxT( "^.*\\.g[0-9]{1,2}$" ), // Gerber inner layer file
wxT( "^.*\\.pho$" ), // Gerber file
wxT( "^.*\\.gbr$" ), // Gerber file
wxT( "^.*\\.gb[alops]$" ), // Gerber back (or bottom) layer file
wxT( "^.*\\.gt[alops]$" ), // Gerber front (or top) layer file
wxT( "^.*\\.g[0-9]{1,2}$" ), // Gerber inner layer file
wxT( "^.*\\.odt$" ),
wxT( "^.*\\.sxw$" ),
wxT( "^.*\\.htm$" ),
wxT( "^.*\\.html$" ),
wxT( "^.*\\.rpt$" ),
wxT( "^.*\\.csv$" ),
NULL // end of list
wxT( "^.*\\.drl$" ), // Excellon drill files
NULL // end of list
};


Expand Down
21 changes: 14 additions & 7 deletions pcbnew/class_pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// Due to a bug in previous versions ( m_LengthDie not initialized in D_PAD ctor)
// m_LengthDie is no more read from .brd files
// Uncomment this next line to read m_LengthDie from .brd files
// #define READ_PAD_LENGTH_DIE
#define READ_PAD_LENGTH_DIE

int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode

Expand Down Expand Up @@ -758,13 +758,19 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
else
Line.Printf( wxT( "%3.1f" ), (float) m_Orient / 10 );

frame->AppendMsgPanel( _( "Orient" ), Line, BLUE );
frame->AppendMsgPanel( _( "Orient" ), Line, LIGHTBLUE );

valeur_param( m_Pos.x, Line );
frame->AppendMsgPanel( _( "X Pos" ), Line, BLUE );
frame->AppendMsgPanel( _( "X Pos" ), Line, LIGHTBLUE );

valeur_param( m_Pos.y, Line );
frame->AppendMsgPanel( _( "Y pos" ), Line, BLUE );
frame->AppendMsgPanel( _( "Y pos" ), Line, LIGHTBLUE );

if( m_LengthDie )
{
valeur_param( m_LengthDie, Line );
frame->AppendMsgPanel( _( "Length on die" ), Line, CYAN );
}
}


Expand Down Expand Up @@ -900,15 +906,16 @@ wxString D_PAD::ShowPadAttr() const
wxString D_PAD::GetSelectMenuText() const
{
wxString text;
BOARD * board = GetBoard();

text << _( "Pad" ) << wxT( " \"" ) << ReturnStringPadName() << wxT( "\" (" );

if ( (m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
text << _("all copper layers");
else if( (m_Masque_Layer & LAYER_BACK) == LAYER_BACK )
text << GetLayerName();
else if( (m_Masque_Layer & LAYER_BACK ) == LAYER_BACK )
text << board->GetLayerName(LAYER_N_BACK);
else if( (m_Masque_Layer & LAYER_FRONT) == LAYER_FRONT )
text << GetLayerName();
text << board->GetLayerName(LAYER_N_FRONT);
else
text << _( "???" );

Expand Down
9 changes: 5 additions & 4 deletions pcbnew/class_pad.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Pcb3D_GLCanvas;
#define PAD_SMD_DEFAULT_LAYERS LAYER_FRONT | SOLDERMASK_LAYER_FRONT

//PAD_HOLE_NOT_PLATED:
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_LAYER_FRONT | \
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT


Expand All @@ -40,12 +40,14 @@ class PAD_DRAWINFO
int m_Color; // color used to draw the pad shape , from pad layers and
// visible layers
int m_HoleColor; // color used to draw the pad hole
int m_NPHoleColor; // color used to draw a pad Not Plated hole
int m_PadClearance; // clearance value, used to draw the pad area outlines
wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown
bool m_Display_padnum; // true to show pad number
bool m_Display_netname; // true to show net name
bool m_ShowPadFilled; // true to show pad as solid area, false to show pas in sketch mode
bool m_ShowNCMark; // true to show pad not connected mark
bool m_ShowNotPlatedHole; // true when the pad hole in not plated, to draw a specifib pad shape
bool m_IsPrinting; // true to print, false to display on screen.
wxPoint m_Offset; // general draw offset

Expand Down Expand Up @@ -103,13 +105,12 @@ class D_PAD : public BOARD_CONNECTED_ITEM
// module anchor, orientation 0

int m_ShapeMaxRadius; // radius of the circle containing the pad shape
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
int m_Orient; // in 1/10 degrees
static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer)

// Length net from pad to die on chip
int m_LengthDie;
int m_LengthDie; // Length net from pad to die on chip

// Local clearance. When null, the module default value is used.
// when the module default value is null, the netclass value is used
Expand Down
20 changes: 15 additions & 5 deletions pcbnew/class_pad_draw_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ PAD_DRAWINFO::PAD_DRAWINFO()
m_DrawMode = 0;
m_Color = BLACK;
m_HoleColor = BLACK; // could be DARKGRAY;
m_NPHoleColor = YELLOW;
m_PadClearance = 0;
m_Display_padnum = true;
m_Display_netname = true;
m_ShowPadFilled = true;
m_ShowNCMark = true;
m_ShowNotPlatedHole = false;
m_IsPrinting = false;
}

Expand Down Expand Up @@ -320,6 +322,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
if( ( m_Masque_Layer & ALL_CU_LAYERS ) == 0 )
DisplayIsol = FALSE;

if( m_Attribut == PAD_HOLE_NOT_PLATED )
drawInfo.m_ShowNotPlatedHole = true;

drawInfo.m_DrawMode = aDraw_mode;
drawInfo.m_Color = color;
Expand All @@ -344,7 +348,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
drawInfo.m_Display_netname = false;

// Display net names is restricted to pads that are on the active layer
// in cotranst mode displae
// in hight contrast mode display
if( !IsOnLayer( screen->m_Active_Layer ) && DisplayOpt.ContrastModeDisplay )
drawInfo.m_Display_netname = false;

Expand Down Expand Up @@ -453,7 +457,10 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
wxPoint holepos = m_Pos - aDrawInfo.m_Offset;
int hole = m_Drill.x >> 1;

if( aDrawInfo.m_ShowPadFilled && hole )
bool drawhole = hole > 0;
if( !aDrawInfo.m_ShowPadFilled && !aDrawInfo. m_ShowNotPlatedHole )
drawhole = false;
if( drawhole )
{
bool blackpenstate = false;
if( aDrawInfo.m_IsPrinting )
Expand All @@ -468,13 +475,16 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
else
GRSetDrawMode( aDC, GR_XOR );

int hole_color = aDrawInfo.m_HoleColor;
if( aDrawInfo. m_ShowNotPlatedHole ) // Draw a specific hole color
hole_color = aDrawInfo.m_NPHoleColor;

switch( m_DrillShape )
{
case PAD_CIRCLE:

if( aDC->LogicalToDeviceXRel( hole ) > 1 )
GRFilledCircle( aClipBox, aDC, holepos.x, holepos.y, hole, 0,
aDrawInfo.m_Color, aDrawInfo.m_HoleColor );
aDrawInfo.m_Color, hole_color );
break;

case PAD_OVAL:
Expand All @@ -497,7 +507,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )

GRFillCSegm( aClipBox, aDC, holepos.x + delta_cx, holepos.y + delta_cy,
holepos.x - delta_cx, holepos.y - delta_cy, seg_width,
aDrawInfo.m_HoleColor );
hole_color );
break;

default:
Expand Down
Loading

0 comments on commit 1e2b145

Please sign in to comment.