Commit 8ab53fc6 authored by dickelbeck's avatar dickelbeck

thru hole padstack with different copper layer masks fix

parent 33e06f28
...@@ -292,13 +292,22 @@ static bool isRectangle( POINT_PAIRS& aList ) ...@@ -292,13 +292,22 @@ static bool isRectangle( POINT_PAIRS& aList )
/** /**
* Function isKeepout * Function isRoundKeepout
* decides if the pad is a copper-less through hole which needs to be made into * decides if the pad is a copper-less through hole which needs to be made into
* a round keepout. * a round keepout.
*/ */
static bool isKeepout( D_PAD* aPad ) static bool isRoundKeepout( D_PAD* aPad )
{ {
return aPad->m_PadShape==PAD_CIRCLE && aPad->m_Drill.x >= aPad->m_Size.x; if( aPad->m_PadShape==PAD_CIRCLE )
{
if( aPad->m_Drill.x >= aPad->m_Size.x )
return true;
if( (aPad->m_Masque_Layer & ALL_CU_LAYERS) == 0 )
return true;
}
return false;
} }
...@@ -344,33 +353,26 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -344,33 +353,26 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
char name[80]; // padstack name builder char name[80]; // padstack name builder
std::string uniqifier; std::string uniqifier;
bool doLayer[2] = { // top and bottom layers only
aPad->IsOnLayer( LAYER_CMP_N ),
aPad->IsOnLayer( COPPER_LAYER_N )
};
// caller must do these checks before calling here. // caller must do these checks before calling here.
wxASSERT( !isKeepout( aPad ) ); wxASSERT( !isRoundKeepout( aPad ) );
wxASSERT( doLayer[0] || doLayer[1] );
PADSTACK* padstack = new PADSTACK(); PADSTACK* padstack = new PADSTACK();
int reportedLayers = 0; // how many in reported padstack int reportedLayers = 0; // how many in reported padstack
const char* layerName[NB_COPPER_LAYERS]; const char* layerName[NB_COPPER_LAYERS];
if( aPad->m_Attribut==PAD_SMD || aPad->m_Attribut==PAD_CONN ) if( aPad->m_Attribut==PAD_SMD || aPad->m_Attribut==PAD_CONN )
{ {
// PAD_SMD and PAD_CONN are reported on each layer for which // PAD_SMD and PAD_CONN are reported on each layer for which
// they are present. // they are present.
uniqifier = '['; uniqifier = '[';
if( doLayer[0] ) if( aPad->IsOnLayer( LAYER_CMP_N ) )
{ {
layerName[reportedLayers++] = layerIds[0].c_str(); layerName[reportedLayers++] = layerIds[0].c_str();
uniqifier += 'T'; // T for top, could have used a layer index here alternatively uniqifier += 'T'; // T for top, could have used a layer index here alternatively
} }
if( doLayer[1] ) if( aPad->IsOnLayer( COPPER_LAYER_N ) )
{ {
int pcbLayerNdx = kicadLayer2pcb[COPPER_LAYER_N]; int pcbLayerNdx = kicadLayer2pcb[COPPER_LAYER_N];
layerName[reportedLayers++] = layerIds[ pcbLayerNdx ].c_str(); layerName[reportedLayers++] = layerIds[ pcbLayerNdx ].c_str();
...@@ -382,30 +384,37 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -382,30 +384,37 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
else // through hole pad else // through hole pad
{ {
#if 0 uniqifier = '[';
/* Through hole pads are reported on the <reserved_layer_name>
"signal". Reporting through hole pads on the special
"signal" layer may have problems when power layers are in the layer
stack. See bottom of page 74 of the SECCTRA Design Language
Reference, May 2000. We could do better if there was actually a
"layer type" field within Kicad which would hold one of: T_signal,
T_power, T_mixed, T_jumper.
*/
reportedLayers = 1;
layerName[0] = "signal";
uniqifier = "[A]"; // A for all
#else bool onAllCopperLayers = false;
// Through hole pads are reported on *all* copper layers. if( (aPad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
int copperLayers = aBoard->GetCopperLayerCount(); {
onAllCopperLayers = true;
uniqifier += 'A'; // A for all layers
}
for( int layer=0; layer<copperLayers; ++layer ) const int copperCount = aBoard->GetCopperLayerCount();
for( int layer=0; layer<copperCount; ++layer )
{ {
layerName[reportedLayers++] = layerIds[layer].c_str(); int kilayer = pcbLayer2kicad[layer];
if( onAllCopperLayers || aPad->IsOnLayer( kilayer ) )
{
layerName[reportedLayers++] = layerIds[layer].c_str();
if( !onAllCopperLayers )
{
if( layer == 0 )
uniqifier += 'T';
else if( layer == copperCount-1 )
uniqifier += 'B';
else
uniqifier += char('0' + layer); // layer index char
}
}
} }
uniqifier = "[A]"; // A for all
#endif uniqifier += ']';
} }
POINT dsnOffset; POINT dsnOffset;
...@@ -566,7 +575,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) ...@@ -566,7 +575,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
D_PAD* pad = (D_PAD*) moduleItems[p]; D_PAD* pad = (D_PAD*) moduleItems[p];
// see if this pad is a through hole with no copper on its perimeter // see if this pad is a through hole with no copper on its perimeter
if( isKeepout( pad ) ) if( isRoundKeepout( pad ) )
{ {
double diameter = scale( pad->m_Drill.x ); double diameter = scale( pad->m_Drill.x );
POINT vertex = mapPt( pad->m_Pos0 ); POINT vertex = mapPt( pad->m_Pos0 );
...@@ -585,6 +594,9 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) ...@@ -585,6 +594,9 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
circle->SetLayerId( layerIds[layer].c_str() ); circle->SetLayerId( layerIds[layer].c_str() );
} }
} }
// else if() could there be a square keepout here?
else else
{ {
PADSTACK* padstack = makePADSTACK( aBoard, pad ); PADSTACK* padstack = makePADSTACK( aBoard, pad );
......
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