Commit 28b17187 authored by g_harland's avatar g_harland

Improvements related to vias

parent 460a678f
...@@ -5,6 +5,14 @@ Please add newer entries at the top, list the date and your name with ...@@ -5,6 +5,14 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Oct-15 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ pcbnew
* Made some changes involving vias so that these would have the correct value
of the Shape property assigned to them - while being created, and while files
are being saved, and while files are being loaded.
2007-Oct-14 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Oct-14 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+ pcbnew: + pcbnew:
...@@ -38,7 +46,6 @@ email address. ...@@ -38,7 +46,6 @@ email address.
with genliste.cpp.notused with genliste.cpp.notused
2007-Oct-12 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Oct-12 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+ all + all
......
...@@ -226,7 +226,6 @@ bool SEGVIA::IsOnLayer( int layer_number ) const ...@@ -226,7 +226,6 @@ bool SEGVIA::IsOnLayer( int layer_number ) const
// VIA_BORGNE ou VIA_ENTERREE: // VIA_BORGNE ou VIA_ENTERREE:
*/ */
int bottom_layer, top_layer; int bottom_layer, top_layer;
ReturnLayerPair( &top_layer, &bottom_layer ); ReturnLayerPair( &top_layer, &bottom_layer );
...@@ -256,8 +255,7 @@ int TRACK::ReturnMaskLayer() ...@@ -256,8 +255,7 @@ int TRACK::ReturnMaskLayer()
// VIA_BORGNE ou VIA_ENTERREE: // VIA_BORGNE ou VIA_ENTERREE:
int bottom_layer; int bottom_layer, top_layer;
int top_layer;
// ReturnLayerPair() knows how layers are stored // ReturnLayerPair() knows how layers are stored
((SEGVIA*)this)->ReturnLayerPair( &top_layer, &bottom_layer ); ((SEGVIA*)this)->ReturnLayerPair( &top_layer, &bottom_layer );
...@@ -549,6 +547,7 @@ bool TRACK::WriteTrackDescr( FILE* File ) ...@@ -549,6 +547,7 @@ bool TRACK::WriteTrackDescr( FILE* File )
/********************************************/ /********************************************/
{ {
int type = 0; int type = 0;
int shape; // Stores genuine value of via's shape property
if( Type() == TYPEVIA ) if( Type() == TYPEVIA )
type = 1; type = 1;
...@@ -556,7 +555,50 @@ bool TRACK::WriteTrackDescr( FILE* File ) ...@@ -556,7 +555,50 @@ bool TRACK::WriteTrackDescr( FILE* File )
if( GetState( DELETED ) ) if( GetState( DELETED ) )
return FALSE; return FALSE;
fprintf( File, "Po %d %d %d %d %d %d %d\n", m_Shape, // In the case of a via, check the values of its top_layer and
// bottom_layer properties, to determine what value should *really*
// be assigned to its shape property (as all versions of KiCad up
// until revision 335 (committed on 2007-Oct-13) could sometimes
// assign an inappropriate value to that property).
if( Type() == TYPEVIA )
{
// int bottom_layer, top_layer;
// ((SEGVIA*)this)->ReturnLayerPair( &top_layer, &bottom_layer );
// For reasons of efficiency, replace the previous two commands
// with these (next three) commands.
int bottom_layer = (m_Layer >> 4) & 15;
int top_layer = m_Layer & 15;
if( bottom_layer > top_layer )
EXCHG( bottom_layer, top_layer );
// Now determine what type of via this really is
if( bottom_layer == COPPER_LAYER_N && top_layer == CMP_N )
{
// The via is really of a "standard" (through-hole) type
shape = VIA_NORMALE;
}
else if( bottom_layer == COPPER_LAYER_N || top_layer == CMP_N )
{
// The via is really of a "blind" type
shape = VIA_BORGNE;
}
else
{
// The via is really of a "buried" type
shape = VIA_ENTERREE;
}
}
else
shape = m_Shape; // Cater for other (non-via) types of objects
// fprintf( File, "Po %d %d %d %d %d %d %d\n", m_Shape,
// m_Start.x, m_Start.y, m_End.x, m_End.y, m_Width, m_Drill );
// (Replace m_Shape within the previous command with shape)
fprintf( File, "Po %d %d %d %d %d %d %d\n", shape,
m_Start.x, m_Start.y, m_End.x, m_End.y, m_Width, m_Drill ); m_Start.x, m_Start.y, m_End.x, m_End.y, m_Width, m_Drill );
fprintf( File, "De %d %d %d %lX %X\n", fprintf( File, "De %d %d %d %lX %X\n",
...@@ -701,8 +743,8 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode ) ...@@ -701,8 +743,8 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
} }
/* Trace de l'isolation (pour segments type CUIVRE et TRACK uniquement */ /* Trace de l'isolation (pour segments type CUIVRE et TRACK uniquement */
if( (DisplayOpt.DisplayTrackIsol) && (m_Layer <= CMP_N ) if( DisplayOpt.DisplayTrackIsol && ( m_Layer <= CMP_N )
&& ( Type() == TYPETRACK) ) && ( Type() == TYPETRACK ) )
{ {
GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
m_End.x, m_End.y, m_End.x, m_End.y,
...@@ -903,11 +945,22 @@ void SEGVIA::Show( int nestLevel, std::ostream& os ) ...@@ -903,11 +945,22 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
switch( Shape() ) switch( Shape() )
{ {
case VIA_NORMALE: cp = "through"; break; case VIA_NORMALE:
case VIA_ENTERREE: cp = "blind"; break; cp = "through";
case VIA_BORGNE: cp = "buried"; break; break;
case VIA_ENTERREE:
cp = "blind";
break;
case VIA_BORGNE:
cp = "buried";
break;
default: default:
case VIA_NOT_DEFINED: cp = "undefined"; break; case VIA_NOT_DEFINED:
cp = "undefined";
break;
} }
int topLayer; int topLayer;
...@@ -933,5 +986,3 @@ void SEGVIA::Show( int nestLevel, std::ostream& os ) ...@@ -933,5 +986,3 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
#endif #endif
...@@ -214,42 +214,73 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC ) ...@@ -214,42 +214,73 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* create the via */ // Create the via - but before doing so, determine what
Via = new SEGVIA( m_Pcb ); // value should really be assigned to its Shape property.
Via->m_Flags = IS_NEW; // (Use ii to temporarily "store" the appropriate value.)
Via->m_Width = g_DesignSettings.m_CurrentViaSize;
Via->m_Shape = g_DesignSettings.m_CurrentViaType;
Via->SetNet( g_HightLigth_NetCode );
Via->m_Start = Via->m_End = g_CurrentTrackSegment->m_End;
int old_layer = GetScreen()->m_Active_Layer; int old_layer = GetScreen()->m_Active_Layer;
//swap the layers. // swap the layers.
if( GetScreen()->m_Active_Layer != GetScreen()->m_Route_Layer_TOP ) if( GetScreen()->m_Active_Layer != GetScreen()->m_Route_Layer_TOP )
GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_TOP; GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_TOP;
else else
GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_BOTTOM; GetScreen()->m_Active_Layer = GetScreen()->m_Route_Layer_BOTTOM;
/* Assess the type of via */
/* Adjust the via layer pair */ if( g_DesignSettings.m_CurrentViaType == VIA_NORMALE ) // normal via
if( Via->Shape() == VIA_ENTERREE )
{ {
Via->SetLayerPair( old_layer, GetScreen()->m_Active_Layer ); ii = VIA_NORMALE;
} }
else
else if( Via->Shape() == VIA_BORGNE ) //blind via // Either a blind via or buried via was "requested", but still
// check both layers of the layer pair, to determine the truly
// appropriate value to assign to the via's Type property.
{ {
// A revoir! ( la via devrait deboucher sur 1 cote ) if( ( old_layer == COPPER_LAYER_N
Via->SetLayerPair( old_layer, GetScreen()->m_Active_Layer ); && GetScreen()->m_Active_Layer == CMP_N )
|| ( old_layer == CMP_N
&& GetScreen()->m_Active_Layer == COPPER_LAYER_N ) )
{
// Specify the via's Shape property as Standard
ii = VIA_NORMALE;
}
else if( old_layer == COPPER_LAYER_N
|| old_layer == CMP_N
|| GetScreen()->m_Active_Layer == COPPER_LAYER_N
|| GetScreen()->m_Active_Layer == CMP_N )
{
// Specify the via's Shape property as Blind
ii = VIA_BORGNE;
} }
else else
{
// Specify the via's Shape property as Buried
ii = VIA_ENTERREE;
}
}
Via = new SEGVIA( m_Pcb );
Via->m_Flags = IS_NEW;
Via->m_Width = g_DesignSettings.m_CurrentViaSize;
Via->m_Shape = ii; // ( instead of g_DesignSettings.m_CurrentViaType )
Via->SetNet( g_HightLigth_NetCode );
Via->m_Start = Via->m_End = g_CurrentTrackSegment->m_End;
/* Adjust the via layer pair */
if( Via->Shape() == VIA_NORMALE ) // Normal via
{ {
// Usual via is from copper to component; layer pair is 0 and 0x0F. // Usual via is from copper to component; layer pair is 0 and 0x0F.
Via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N ); Via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N );
} }
else // Either a blind via or buried via.
{
if( old_layer < GetScreen()->m_Active_Layer)
Via->SetLayerPair( old_layer, GetScreen()->m_Active_Layer );
else
Via->SetLayerPair( GetScreen()->m_Active_Layer, old_layer );
}
if( Drc_On &&( Drc( this, DC, Via, m_Pcb->m_Track, 1 ) == BAD_DRC ) ) if( Drc_On && ( Drc( this, DC, Via, m_Pcb->m_Track, 1 ) == BAD_DRC ) )
{ {
/* DRC fault: the Via cannot be placed here ... */ /* DRC fault: the Via cannot be placed here ... */
delete Via; delete Via;
......
...@@ -171,6 +171,34 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( wxDC* DC, FILE* File, ...@@ -171,6 +171,34 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( wxDC* DC, FILE* File,
&PtSegm->m_Drill ); &PtSegm->m_Drill );
PtSegm->m_Width = width; PtSegm->m_Width = width;
// Before specifying the value for any new via's Shape property, check
// the values of its top_layer and bottom_layer properties, to determine
// what value should *really* be assigned to that property (as all
// versions of KiCad up until revision 335 (committed on 2007-Oct-13)
// could sometimes assign an inappropriate value to that property).
if( makeType == TYPEVIA )
{
int b_layer = (layer >> 4) & 15;
int t_layer = layer & 15;
if( ( ( b_layer == COPPER_LAYER_N ) && ( t_layer == CMP_N ) )
|| ( ( b_layer == CMP_N ) && ( t_layer == COPPER_LAYER_N ) ) )
{
// The via is really of a "standard" (through-hole) type
shape = VIA_NORMALE;
}
else if( ( b_layer == COPPER_LAYER_N ) || ( t_layer == CMP_N )
|| ( b_layer == CMP_N ) || ( t_layer == COPPER_LAYER_N ) )
{
// The via is really of a "blind" type
shape = VIA_BORGNE;
}
else
{
// The via is really of a "buried" type
shape = VIA_ENTERREE;
}
}
PtSegm->m_Shape = shape; PtSegm->m_Shape = shape;
if( arg_count < 7 ) if( arg_count < 7 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment