Commit 40e2fed3 authored by dickelbeck's avatar dickelbeck

specctra export pad fixes

parent 7dbb0da3
...@@ -434,7 +434,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter ) ...@@ -434,7 +434,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter )
void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads )
{ {
char name[80]; // padstack name builder char name[80]; // padstack name builder
std::string uniqifier;
if( aPads.GetCount() ) if( aPads.GetCount() )
{ {
...@@ -466,9 +467,7 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) ...@@ -466,9 +467,7 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads )
if( (!doLayer[0] && !doLayer[1]) if( (!doLayer[0] && !doLayer[1])
|| (pad->m_PadShape==PAD_CIRCLE && pad->m_Drill.x >= pad->m_Size.x) ) || (pad->m_PadShape==PAD_CIRCLE && pad->m_Drill.x >= pad->m_Size.x) )
{ {
// padstacks.size()-1 is the index of the matching padstack in LIBRARY::padstacks // pad->m_logical_connexion = pcb->library->padstacks.size()-1;
pad->m_logical_connexion = pcb->library->padstacks.size()-1;
continue; continue;
} }
...@@ -480,19 +479,49 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) ...@@ -480,19 +479,49 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads )
// padstacks.size()-1 is the index of the matching padstack in LIBRARY::padstacks // padstacks.size()-1 is the index of the matching padstack in LIBRARY::padstacks
pad->m_logical_connexion = pcb->library->padstacks.size()-1; pad->m_logical_connexion = pcb->library->padstacks.size()-1;
// For now, we will report only one layer for the pads. SMD pads are reported on the /* Through hole pads are reported on the <reserved_layer_name>
// top layer, and through hole are reported on <reserved_layer_name> "signal". "signal". Reporting through hole pads on the special
// We could do better if there was actually a "layer type" field within "signal" layer may have problems when power layers are in the layer
// Kicad which would hold one of: T_signal, T_power, T_mixed, T_jumper stack. See bottom of page 74 of the SECCTRA Design Language
// See bottom of page 74 of the SECCTRA Design Language Reference, May 2000. Reference, May 2000. We could do better if there was actually a
int reportedLayers = 1; // how many layers are reported. "layer type" field within Kicad which would hold one of: T_signal,
T_power, T_mixed, T_jumper.
PAD_SMD and PAD_CONN are reported on each layer for which
they are present.
*/
int reportedLayers; // how many layers are reported.
const char* layerName[NB_COPPER_LAYERS];
static const char signal[] = "signal";
doLayer[0] = true; if( pad->m_Attribut==PAD_SMD || pad->m_Attribut==PAD_CONN )
{
reportedLayers = 0;
uniqifier = '[';
const char* layerName = ( pad->m_Attribut == PAD_SMD ) ? if( doLayer[0] )
layerIds[0].c_str() : "signal"; {
layerName[reportedLayers++] = layerIds[0].c_str();
uniqifier += 'T'; // T for top, could have used a layer index here alternatively
}
if( doLayer[1] )
{
int pcbLayerNdx = kicadLayer2pcb[COPPER_LAYER_N];
layerName[reportedLayers++] = layerIds[ pcbLayerNdx ].c_str();
uniqifier += 'B'; // B for bottom
}
int coppers = 0; // will always be one for now uniqifier += ']';
}
else
{
reportedLayers = 1;
layerName[0] = signal;
uniqifier = "[A]"; // A for all
}
switch( pad->m_PadShape ) switch( pad->m_PadShape )
{ {
...@@ -501,23 +530,20 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) ...@@ -501,23 +530,20 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads )
{ {
double diameter = scale(pad->m_Size.x); double diameter = scale(pad->m_Size.x);
for( int layer=0; layer<reportedLayers; ++layer ) for( int ndx=0; ndx<reportedLayers; ++ndx )
{ {
if( doLayer[layer] ) SHAPE* shape = new SHAPE( padstack );
{ padstack->Append( shape );
SHAPE* shape = new SHAPE( padstack );
padstack->Append( shape );
CIRCLE* circle = new CIRCLE( shape ); CIRCLE* circle = new CIRCLE( shape );
shape->SetShape( circle ); shape->SetShape( circle );
circle->SetLayerId( layerName ); circle->SetLayerId( layerName[ndx] );
circle->SetDiameter( diameter ); circle->SetDiameter( diameter );
++coppers;
}
} }
snprintf( name, sizeof(name), "Round%dPad_%.6g_mil", coppers, scale(pad->m_Size.x) ); snprintf( name, sizeof(name), "Round%sPad_%.6g_mil",
uniqifier.c_str(), scale(pad->m_Size.x) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
// @todo verify that all pad names are unique, there is a chance that // @todo verify that all pad names are unique, there is a chance that
...@@ -536,24 +562,20 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) ...@@ -536,24 +562,20 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads )
POINT lowerLeft( -dx, -dy ); POINT lowerLeft( -dx, -dy );
POINT upperRight( dx, dy ); POINT upperRight( dx, dy );
for( int layer=0; layer<reportedLayers; ++layer ) for( int ndx=0; ndx<reportedLayers; ++ndx )
{ {
if( doLayer[layer] ) SHAPE* shape = new SHAPE( padstack );
{ padstack->Append( shape );
SHAPE* shape = new SHAPE( padstack );
padstack->Append( shape );
RECTANGLE* rect = new RECTANGLE( shape ); RECTANGLE* rect = new RECTANGLE( shape );
shape->SetShape( rect ); shape->SetShape( rect );
rect->SetLayerId( layerName ); rect->SetLayerId( layerName[ndx] );
rect->SetCorners( lowerLeft, upperRight ); rect->SetCorners( lowerLeft, upperRight );
++coppers;
}
} }
snprintf( name, sizeof(name), "Rect%dPad_%.6gx%.6g_mil", snprintf( name, sizeof(name), "Rect%sPad_%.6gx%.6g_mil",
coppers, scale(pad->m_Size.x), scale(pad->m_Size.y) ); uniqifier.c_str(), scale(pad->m_Size.x), scale(pad->m_Size.y) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
// @todo verify that all pad names are unique, there is a chance that // @todo verify that all pad names are unique, there is a chance that
...@@ -574,20 +596,16 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) ...@@ -574,20 +596,16 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads )
{ {
double radius = dy; double radius = dy;
for( int layer=0; layer<reportedLayers; ++layer ) for( int ndx=0; ndx<reportedLayers; ++ndx )
{ {
if( doLayer[layer] ) SHAPE* shape;
{ PATH* path;
SHAPE* shape; // see http://www.freerouting.net/usren/viewtopic.php?f=3&t=317#p408
PATH* path; shape = new SHAPE( padstack );
// see http://www.freerouting.net/usren/viewtopic.php?f=3&t=317#p408 padstack->Append( shape );
shape = new SHAPE( padstack ); path = makePath( POINT(-dr, 0.0), POINT(dr, 0.0), layerName[ndx] );
padstack->Append( shape ); shape->SetShape( path );
path = makePath( POINT(-dr, 0.0), POINT(dr, 0.0), layerName ); path->aperture_width = 2.0 * radius;
shape->SetShape( path );
path->aperture_width = 2.0 * radius;
++coppers;
}
} }
} }
else // oval is vertical else // oval is vertical
...@@ -596,25 +614,21 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) ...@@ -596,25 +614,21 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads )
dr = -dr; dr = -dr;
for( int layer=0; layer<reportedLayers; ++layer ) for( int ndx=0; ndx<reportedLayers; ++ndx )
{ {
if( doLayer[layer] ) SHAPE* shape;
{ PATH* path;
SHAPE* shape; // see http://www.freerouting.net/usren/viewtopic.php?f=3&t=317#p408
PATH* path; shape = new SHAPE( padstack );
// see http://www.freerouting.net/usren/viewtopic.php?f=3&t=317#p408 padstack->Append( shape );
shape = new SHAPE( padstack ); path = makePath( POINT(0.0, -dr), POINT(0.0, dr), layerName[ndx] );
padstack->Append( shape ); shape->SetShape( path );
path = makePath( POINT(0.0, -dr), POINT(0.0, dr), layerName ); path->aperture_width = 2.0 * radius;
shape->SetShape( path );
path->aperture_width = 2.0 * radius;
++coppers;
}
} }
} }
snprintf( name, sizeof(name), "Oval%dPad_%.6gx%.6g_mil", snprintf( name, sizeof(name), "Oval%sPad_%.6gx%.6g_mil",
coppers, scale(pad->m_Size.x), scale(pad->m_Size.y) ); uniqifier.c_str(), scale(pad->m_Size.x), scale(pad->m_Size.y) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
// @todo verify that all pad names are unique, there is a chance that // @todo verify that all pad names are unique, there is a chance that
......
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