Commit 2b215d81 authored by dickelbeck's avatar dickelbeck

amazing free specctra software

parent dd141c17
...@@ -6,6 +6,21 @@ Please add newer entries at the top, list the date and your name with ...@@ -6,6 +6,21 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Feb-11 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
* Added case TYPETRACK, TYPEVIA, and TYPEMODULE support to Board::Add() so
that we can over time hide more of the storage architecture of a BOARD and
isolate those dependencies in fewer places.
* Fixed some pad orientation issues in specctra_export.
* Added VIA_MICROVIA & VIA_BLIND_BURIED support to SPECCTRA::makeVIA().
* Commented out the specctra design import menu choice for now, don't have
time or need for this import.
* Specctra export adds 1/2 mil to clearance rules for freerouter so that
the routed board clears our DRC checker OK.
* Session import seems done now.
2008-Feb-7 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Feb-7 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew +pcbnew
......
...@@ -20,7 +20,8 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC ) ...@@ -20,7 +20,8 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
/* Restitution d'un element (MODULE ou TRACK ) Efface /* Restitution d'un element (MODULE ou TRACK ) Efface
*/ */
{ {
EDA_BaseStruct* PtStruct, * PtNext; BOARD_ITEM* item;
BOARD_ITEM* next;
TRACK* pt_track; TRACK* pt_track;
int net_code; int net_code;
...@@ -28,25 +29,25 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC ) ...@@ -28,25 +29,25 @@ void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
return; return;
g_UnDeleteStackPtr--; g_UnDeleteStackPtr--;
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; item = g_UnDeleteStack[g_UnDeleteStackPtr];
if( PtStruct == NULL ) if( item == NULL )
return; // Ne devrait pas se produire return; // Ne devrait pas se produire
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case TYPEVIA: case TYPEVIA:
case TYPETRACK: case TYPETRACK:
for( ; PtStruct != NULL; PtStruct = PtNext ) for( ; item; item = next )
{ {
PtNext = PtStruct->Pnext; next = item->Next();
PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */ item->SetState( DELETED, OFF ); /* Effacement du bit DELETED */
Trace_Segment( DrawPanel, DC, (TRACK*) PtStruct, GR_OR ); Trace_Segment( DrawPanel, DC, (TRACK*) item, GR_OR );
} }
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; item = g_UnDeleteStack[g_UnDeleteStackPtr];
net_code = ( (TRACK*) PtStruct )->GetNet(); net_code = ((TRACK*) item)->GetNet();
pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb );
( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track ); m_Pcb->Add( item );
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
break; break;
...@@ -97,7 +98,7 @@ BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems ) ...@@ -97,7 +98,7 @@ BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems )
{ {
NextS = PtStruct->Next(); NextS = PtStruct->Next();
( (TRACK*) PtStruct )->UnLink(); ( (TRACK*) PtStruct )->UnLink();
PtStruct->SetState( DELETED, ON ); PtStruct->SetState( DELETED, ON );
if( nbitems <= 1 ) if( nbitems <= 1 )
NextS = NULL; /* fin de chaine */ NextS = NULL; /* fin de chaine */
......
This diff is collapsed.
This diff is collapsed.
...@@ -150,9 +150,9 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings() ...@@ -150,9 +150,9 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_ViaDrill = 250; // defualt via drill (for the entire board) m_ViaDrill = 250; // defualt via drill (for the entire board)
m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value
m_CurrentViaSize = 450; // Current via size m_CurrentViaSize = 450; // Current via size
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA) m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_CurrentTrackWidth = 170; // current track width m_CurrentTrackWidth = 170; // current track width
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_MicroViaDrill = 50; // micro via drill (for the entire board) m_MicroViaDrill = 50; // micro via drill (for the entire board)
m_CurrentMicroViaSize = 150; // Current micro via size m_CurrentMicroViaSize = 150; // Current micro via size
m_MicroViasAllowed = false; // true to allow micro vias m_MicroViasAllowed = false; // true to allow micro vias
......
...@@ -387,7 +387,6 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC ) ...@@ -387,7 +387,6 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
* Routine de fin de trace d'une piste (succession de segments) * Routine de fin de trace d'une piste (succession de segments)
*/ */
{ {
TRACK* pt_track;
int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer]; int masquelayer = g_TabOneLayerMask[GetScreen()->m_Active_Layer];
wxPoint pos; wxPoint pos;
EDA_BaseStruct* LockPoint; EDA_BaseStruct* LockPoint;
...@@ -453,11 +452,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC ) ...@@ -453,11 +452,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
/* Test if no segment left. Can happend on a double click on the start point */ /* Test if no segment left. Can happend on a double click on the start point */
if( g_FirstTrackSegment != NULL ) if( g_FirstTrackSegment != NULL )
{ {
/* Put new track in buffer: search the best insertion poinr */ // Put new track in board
pt_track = g_FirstTrackSegment->GetBestInsertPoint( m_Pcb ); m_Pcb->Add( g_FirstTrackSegment );
/* Uut track in linked list */
g_FirstTrackSegment->Insert( m_Pcb, pt_track );
trace_ratsnest_pad( DC ); trace_ratsnest_pad( DC );
Trace_Une_Piste( DrawPanel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR ); Trace_Une_Piste( DrawPanel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR );
...@@ -466,7 +462,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC ) ...@@ -466,7 +462,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
TRACK* ptr = g_FirstTrackSegment; int ii; TRACK* ptr = g_FirstTrackSegment; int ii;
for( ii = 0; (ptr != NULL) && (ii < g_TrackSegmentCount); ii++ ) for( ii = 0; (ptr != NULL) && (ii < g_TrackSegmentCount); ii++ )
{ {
ptr->m_Flags = 0; ptr = ptr->Next(); ptr->m_Flags = 0;
ptr = ptr->Next();
} }
/* Delete the old track, if exists */ /* Delete the old track, if exists */
...@@ -527,16 +524,16 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ...@@ -527,16 +524,16 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
/* dessin de la nouvelle piste : mise a jour du point d'arrivee */ /* dessin de la nouvelle piste : mise a jour du point d'arrivee */
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth ) if( ! g_DesignSettings.m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth; g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
TRACK* previous_track = (TRACK*) g_CurrentTrackSegment->Pback; TRACK* previous_track = (TRACK*) g_CurrentTrackSegment->Pback;
if( previous_track && (previous_track->Type() == TYPETRACK) ) if( previous_track && (previous_track->Type() == TYPETRACK) )
{ {
previous_track->SetLayer( screen->m_Active_Layer ); previous_track->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth ) if( ! g_DesignSettings.m_UseConnectedTrackWidth )
previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth; previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
} }
} }
if( Track_45_Only ) if( Track_45_Only )
......
This diff is collapsed.
...@@ -312,7 +312,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides ) ...@@ -312,7 +312,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
* coord destination (row,col) * coord destination (row,col)
* net_code * net_code
* pointeur sur le chevelu de reference * pointeur sur le chevelu de reference
* *
* Retourne : * Retourne :
* SUCCESS si route trouvee * SUCCESS si route trouvee
* TRIVIAL_SUCCESS si pads connectes par superposition ( pas de piste a tirer) * TRIVIAL_SUCCESS si pads connectes par superposition ( pas de piste a tirer)
...@@ -722,10 +722,10 @@ static long bit[8][9] = { /* OT=Otherside */ ...@@ -722,10 +722,10 @@ static long bit[8][9] = { /* OT=Otherside */
* La recherche se fait en sens inverse du routage, * La recherche se fait en sens inverse du routage,
* c.a.d du point d'arrivee (target) vers le point de depart (source) * c.a.d du point d'arrivee (target) vers le point de depart (source)
* du routeur. * du routeur.
* *
* target_side = cote (TOP / BOTTOM) de depart * target_side = cote (TOP / BOTTOM) de depart
* mask_layer_source = masque des couches d'arrivee * mask_layer_source = masque des couches d'arrivee
* *
* Retourne: * Retourne:
* 0 si erreur * 0 si erreur
* > 0 si Ok * > 0 si Ok
...@@ -983,7 +983,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -983,7 +983,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
NewTrack->Insert( pcb, g_CurrentTrackSegment ); NewTrack->Insert( pcb, g_CurrentTrackSegment );
g_CurrentTrackSegment->m_Start = pt_cur_ch->pad_end->GetPosition(); g_CurrentTrackSegment->m_Start = pt_cur_ch->pad_end->GetPosition();
NewTrack->m_Start = g_CurrentTrackSegment->m_End; NewTrack->m_Start = g_CurrentTrackSegment->m_End;
g_CurrentTrackSegment = NewTrack; g_CurrentTrackSegment = NewTrack;
...@@ -1065,10 +1065,10 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC ) ...@@ -1065,10 +1065,10 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
NewTrack->Insert( pcbframe->m_Pcb, g_CurrentTrackSegment ); NewTrack->Insert( pcbframe->m_Pcb, g_CurrentTrackSegment );
NewTrack->m_End = pt_cur_ch->pad_start->GetPosition(); NewTrack->m_End = pt_cur_ch->pad_start->GetPosition();
NewTrack->m_Start = g_CurrentTrackSegment->m_End; NewTrack->m_Start = g_CurrentTrackSegment->m_End;
g_CurrentTrackSegment = NewTrack; g_CurrentTrackSegment = NewTrack;
g_TrackSegmentCount++; g_TrackSegmentCount++;
} }
...@@ -1082,8 +1082,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC ) ...@@ -1082,8 +1082,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
g_CurrentTrackSegment->SetState( END_ONPAD, ON ); g_CurrentTrackSegment->SetState( END_ONPAD, ON );
/* recherche de la zone de rangement et insertion de la nouvelle piste */ /* recherche de la zone de rangement et insertion de la nouvelle piste */
pt_track = g_FirstTrackSegment->GetBestInsertPoint( pcbframe->m_Pcb ); pcbframe->m_Pcb->Add( g_FirstTrackSegment );
g_FirstTrackSegment->Insert( pcbframe->m_Pcb, pt_track );
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR ); Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_TrackSegmentCount, GR_OR );
......
...@@ -3760,7 +3760,12 @@ class SPECCTRA_DB : public OUTPUTFORMATTER ...@@ -3760,7 +3760,12 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
TRACK* makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) throw( IOError ); TRACK* makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) throw( IOError );
SEGVIA* makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode ); /**
* Function makeVIA
* instantiates a Kicad SEGVIA on the heap and initializes it with internal
* values consistent with the given PADSTACK, POINT, and netcode.
*/
SEGVIA* makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode ) throw( IOError );
//-----</FromSESSION>---------------------------------------------------- //-----</FromSESSION>----------------------------------------------------
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include "wxPcbStruct.h" // Change_Side_Module() #include "wxPcbStruct.h" // Change_Side_Module()
#include "pcbstruct.h" // HISTORY_NUMBER #include "pcbstruct.h" // HISTORY_NUMBER
#include "autorout.h" // NET_CODES_OK #include "autorout.h" // NET_CODES_OK
#include "trigo.h" // RotatePoint()
#include <set> // std::set #include <set> // std::set
...@@ -351,8 +353,38 @@ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule ) ...@@ -351,8 +353,38 @@ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule )
pin->padstack_id = padstack->padstack_id; pin->padstack_id = padstack->padstack_id;
pin->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() ); pin->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() );
// copper shape's position is hole position + offset #if 0
wxPoint pos = pad->m_Pos0 + pad->m_Offset; if( pad->m_Orient )
{
int angle = pad->m_Orient - aModule->m_Orient; // tenths of degrees
NORMALIZE_ANGLE_POS(angle);
pin->SetRotation( angle / 10.0 );
}
#else
{
int angle = pad->m_Orient - aModule->m_Orient; // tenths of degrees
if( angle )
{
NORMALIZE_ANGLE_POS(angle);
pin->SetRotation( angle / 10.0 );
}
}
#endif
wxPoint pos;
int angle = pad->m_Orient - aModule->m_Orient; // tenths of degrees
if( angle && (pad->m_Offset.x || pad->m_Offset.y) )
{
wxPoint offset( pad->m_Offset.x, pad->m_Offset.y );
RotatePoint( &offset, angle );
pos = pad->m_Pos0 + offset;
}
else
{
// copper shape's position is hole position + offset
pos = pad->m_Pos0 + pad->m_Offset;
}
pin->SetVertex( mapPt( pos ) ); pin->SetVertex( mapPt( pos ) );
} }
...@@ -385,8 +417,8 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia ) ...@@ -385,8 +417,8 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
circle->SetLayerId( "signal" ); circle->SetLayerId( "signal" );
snprintf( name, sizeof(name), "Via_%.6g:%.6g_mil", dsnDiameter, snprintf( name, sizeof(name), "Via[A]%.6g:%.6g_mil", dsnDiameter,
// encode the drill value in the name for later import // encode the drill value into the name for later import
scale( aVia->GetDrillValue() ) ); scale( aVia->GetDrillValue() ) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name ); padstack->SetPadstackId( name );
...@@ -418,7 +450,7 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia ) ...@@ -418,7 +450,7 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
snprintf( name, sizeof(name), "Via[%d-%d]_%.6g:%.6g_mil", snprintf( name, sizeof(name), "Via[%d-%d]_%.6g:%.6g_mil",
topLayer, botLayer, dsnDiameter, topLayer, botLayer, dsnDiameter,
// encode the drill value in the name for later import // encode the drill value into the name for later import
scale( aVia->GetDrillValue() ) scale( aVia->GetDrillValue() )
); );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
...@@ -446,8 +478,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter ) ...@@ -446,8 +478,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter )
circle->SetLayerId( "signal" ); circle->SetLayerId( "signal" );
snprintf( name, sizeof(name), "Via_%.6g:%.6g_mil", dsnDiameter, snprintf( name, sizeof(name), "Via[A]%.6g:%.6g_mil", dsnDiameter,
// encode the drill value in the name for later import // encode the drill value into the name for later import
scale( aDrillDiameter ) ); scale( aDrillDiameter ) );
name[ sizeof(name)-1 ] = 0; name[ sizeof(name)-1 ] = 0;
padstack->SetPadstackId( name ); padstack->SetPadstackId( name );
......
...@@ -150,6 +150,14 @@ static int scale( double distance, UNIT_RES* aResolution ) ...@@ -150,6 +150,14 @@ static int scale( double distance, UNIT_RES* aResolution )
return ret; return ret;
} }
/**
* Function mapPt
* translates a point from the Specctra Session format coordinate system
* to the Kicad coordinate system.
* @param aPoint The session point to translate
* @return wxPoint - The Kicad coordinate system point.
*/
static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution )
{ {
wxPoint ret( scale( aPoint.x, aResolution ), wxPoint ret( scale( aPoint.x, aResolution ),
...@@ -182,16 +190,14 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro ...@@ -182,16 +190,14 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro
} }
SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode ) SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode ) throw( IOError )
{ {
SEGVIA* via = 0; SEGVIA* via = 0;
SHAPE* shape; SHAPE* shape;
int shapeCount = aPadstack->Length(); int shapeCount = aPadstack->Length();
int drillDiam = -1; int drillDiam = -1;
int viaDiam = 400; int copperLayerCount = sessionBoard->GetCopperLayerCount();
// @todo this needs a lot of work yet, it is not complete yet.
// The drill diameter is encoded in the padstack name if PCBNEW did the DSN export. // The drill diameter is encoded in the padstack name if PCBNEW did the DSN export.
...@@ -200,15 +206,16 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet ...@@ -200,15 +206,16 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
if( drillStartNdx != -1 ) if( drillStartNdx != -1 )
{ {
++drillStartNdx; // skip over the ':'
int drillEndNdx = aPadstack->padstack_id.rfind( '_' ); int drillEndNdx = aPadstack->padstack_id.rfind( '_' );
if( drillEndNdx != -1 ) if( drillEndNdx != -1 )
{ {
std::string diamTxt( aPadstack->padstack_id, drillStartNdx+1, drillEndNdx-drillStartNdx-1 ); std::string diamTxt( aPadstack->padstack_id, drillStartNdx, drillEndNdx-drillStartNdx );
const char* sdiamTxt = diamTxt.c_str(); const char* sdiamTxt = diamTxt.c_str();
double drillMils = strtod( sdiamTxt, 0 ); double drillMils = strtod( sdiamTxt, 0 );
// drillMils is not in the session units, but actual mils so we don't use scale() // drillMils is not in the session units, but actual mils so we don't use scale()
drillDiam = drillMils * 10; drillDiam = (int) (drillMils * 10);
if( drillDiam == g_DesignSettings.m_ViaDrill ) // default if( drillDiam == g_DesignSettings.m_ViaDrill ) // default
drillDiam = -1; // import as default drillDiam = -1; // import as default
...@@ -217,38 +224,94 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet ...@@ -217,38 +224,94 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
if( shapeCount == 0 ) if( shapeCount == 0 )
{ {
ThrowIOError( _( "Session via padstack has no shapes") );
} }
else if( shapeCount == 1 ) else if( shapeCount == 1 )
{ {
shape = (SHAPE*) (*aPadstack)[0]; shape = (SHAPE*) (*aPadstack)[0];
if( shape->shape->Type() == T_circle ) DSN_T type = shape->shape->Type();
{ if( type != T_circle )
CIRCLE* circle = (CIRCLE*) shape->shape; ThrowIOError( _( "Unsupported via shape: \"%s\""),
viaDiam = scale( circle->diameter, routeResolution ); LEXER::GetTokenString( type ).GetData() );
via = new SEGVIA( sessionBoard ); CIRCLE* circle = (CIRCLE*) shape->shape;
via->SetPosition( mapPt( aPoint, routeResolution ) ); int viaDiam = scale( circle->diameter, routeResolution );
via->SetDrillValue( drillDiam );
via->m_Shape = VIA_THROUGH; via = new SEGVIA( sessionBoard );
via->m_Width = viaDiam; via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetLayerPair( CMP_N, COPPER_LAYER_N ); via->SetDrillValue( drillDiam );
} via->m_Shape = VIA_THROUGH;
via->m_Width = viaDiam;
via->SetLayerPair( CMP_N, COPPER_LAYER_N );
} }
else if( shapeCount == sessionBoard->GetCopperLayerCount() ) else if( shapeCount == copperLayerCount )
{ {
shape = (SHAPE*) (*aPadstack)[0]; shape = (SHAPE*) (*aPadstack)[0];
if( shape->shape->Type() == T_circle ) DSN_T type = shape->shape->Type();
if( type != T_circle )
ThrowIOError( _( "Unsupported via shape: \"%s\""),
LEXER::GetTokenString( type ).GetData() );
CIRCLE* circle = (CIRCLE*) shape->shape;
int viaDiam = scale( circle->diameter, routeResolution );
via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrillValue( drillDiam );
via->m_Shape = VIA_THROUGH;
via->m_Width = viaDiam;
via->SetLayerPair( CMP_N, COPPER_LAYER_N );
}
else // VIA_MICROVIA or VIA_BLIND_BURIED
{
int topLayerNdx = -1;
int botLayerNdx = 7000;
int viaDiam = -1;
for( int i=0; i<shapeCount; ++i )
{ {
shape = (SHAPE*) (*aPadstack)[i];
DSN_T type = shape->shape->Type();
if( type != T_circle )
ThrowIOError( _( "Unsupported via shape: \"%s\""),
LEXER::GetTokenString( type ).GetData() );
CIRCLE* circle = (CIRCLE*) shape->shape; CIRCLE* circle = (CIRCLE*) shape->shape;
viaDiam = scale( circle->diameter, routeResolution );
int layerNdx = findLayerName( circle->layer_id );
via = new SEGVIA( sessionBoard ); if( layerNdx == -1 )
via->SetPosition( mapPt( aPoint, routeResolution ) ); {
via->SetDrillValue( drillDiam ); wxString layerName = CONV_FROM_UTF8( circle->layer_id.c_str() );
via->m_Shape = VIA_THROUGH; ThrowIOError( _("Session file uses invalid layer id \"%s\""),
via->m_Width = viaDiam; layerName.GetData() );
via->SetLayerPair( CMP_N, COPPER_LAYER_N ); }
if( layerNdx > topLayerNdx )
topLayerNdx = layerNdx;
if( layerNdx < botLayerNdx )
botLayerNdx = layerNdx;
if( viaDiam == -1 )
viaDiam = scale( circle->diameter, routeResolution );
} }
via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrillValue( drillDiam );
if( (topLayerNdx==0 && botLayerNdx==1)
|| (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
via->m_Shape = VIA_MICROVIA;
else
via->m_Shape = VIA_BLIND_BURIED;
via->m_Width = viaDiam;
topLayerNdx = pcbLayer2kicad[topLayerNdx];
botLayerNdx = pcbLayer2kicad[botLayerNdx];
via->SetLayerPair( topLayerNdx, botLayerNdx );
} }
if( via ) if( via )
...@@ -365,7 +428,6 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) ...@@ -365,7 +428,6 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
// else netCode remains 0 // else netCode remains 0
} }
WIRES& wires = net->wires; WIRES& wires = net->wires;
for( unsigned i=0; i<wires.size(); ++i ) for( unsigned i=0; i<wires.size(); ++i )
{ {
...@@ -386,9 +448,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) ...@@ -386,9 +448,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
for( unsigned pt=0; pt<path->points.size()-1; ++pt ) for( unsigned pt=0; pt<path->points.size()-1; ++pt )
{ {
TRACK* track = makeTRACK( path, pt, netCode ); TRACK* track = makeTRACK( path, pt, netCode );
aBoard->Add( track );
TRACK* insertAid = track->GetBestInsertPoint( aBoard );
track->Insert( aBoard, insertAid );
} }
} }
...@@ -428,12 +488,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) ...@@ -428,12 +488,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError )
for( unsigned v=0; v<wire_via->vertexes.size(); ++v ) for( unsigned v=0; v<wire_via->vertexes.size(); ++v )
{ {
SEGVIA* via = makeVIA( padstack, wire_via->vertexes[v], netCode ); SEGVIA* via = makeVIA( padstack, wire_via->vertexes[v], netCode );
aBoard->Add( via );
if( !via )
ThrowIOError( _("Unable to make a via") );
TRACK* insertAid = via->GetBestInsertPoint( aBoard );
via->Insert( aBoard, insertAid );
} }
} }
} }
......
...@@ -21,33 +21,33 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC ) ...@@ -21,33 +21,33 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/* Restitution d'un element (MODULE ou TRACK ) Efface /* Restitution d'un element (MODULE ou TRACK ) Efface
*/ */
{ {
BOARD_ITEM* PtStruct, * PtNext; BOARD_ITEM* item;
TRACK* pt_track; BOARD_ITEM* next;
int net_code; int net_code;
if( !g_UnDeleteStackPtr ) if( !g_UnDeleteStackPtr )
return; return;
g_UnDeleteStackPtr--; g_UnDeleteStackPtr--;
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; item = g_UnDeleteStack[g_UnDeleteStackPtr];
if( PtStruct == NULL ) if( item == NULL )
return; // Ne devrait pas se produire return; // Ne devrait pas se produire
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case TYPEVIA: case TYPEVIA:
case TYPETRACK: case TYPETRACK:
for( ; PtStruct != NULL; PtStruct = PtNext ) for( ; item; item = next )
{ {
PtNext = PtStruct->Next(); next = item->Next();
PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */ item->SetState( DELETED, OFF ); /* Effacement du bit DELETED */
( (TRACK*) PtStruct )->Draw( DrawPanel, DC, GR_OR ); ((TRACK*) item)->Draw( DrawPanel, DC, GR_OR );
} }
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; item = g_UnDeleteStack[g_UnDeleteStackPtr];
net_code = ( (TRACK*) PtStruct )->GetNet(); net_code = ((TRACK*) item)->GetNet();
pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb );
( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track ); m_Pcb->Add( item );
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
test_1_net_connexion( DC, net_code ); test_1_net_connexion( DC, net_code );
...@@ -61,18 +61,14 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC ) ...@@ -61,18 +61,14 @@ void WinEDA_PcbFrame::UnDeleteItem( wxDC* DC )
/* Reinsertion du module dans la liste chainee des modules, /* Reinsertion du module dans la liste chainee des modules,
* en debut de chaine */ * en debut de chaine */
PtStruct->Pback = m_Pcb; m_Pcb->Add( item );
PtNext = m_Pcb->m_Modules;
PtStruct->Pnext = PtNext;
if( PtNext )
PtNext->Pback = PtStruct;
m_Pcb->m_Modules = (MODULE*) PtStruct;
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
( (MODULE*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); ((MODULE*) item)->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
PtStruct->SetState( DELETED, OFF ); /* Creal DELETED flag */ item->SetState( DELETED, OFF ); /* Creal DELETED flag */
PtStruct->m_Flags = 0; item->m_Flags = 0;
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
build_liste_pads(); build_liste_pads();
ReCompile_Ratsnest_After_Changes( DC ); ReCompile_Ratsnest_After_Changes( DC );
...@@ -124,11 +120,11 @@ BOARD_ITEM* WinEDA_PcbFrame::SaveItemEfface( BOARD_ITEM* PtItem, int nbitems ) ...@@ -124,11 +120,11 @@ BOARD_ITEM* WinEDA_PcbFrame::SaveItemEfface( BOARD_ITEM* PtItem, int nbitems )
{ {
NextS = PtStruct->Next(); NextS = PtStruct->Next();
( (TRACK*) PtStruct )->UnLink(); ( (TRACK*) PtStruct )->UnLink();
PtStruct->SetState( DELETED, ON ); PtStruct->SetState( DELETED, ON );
if( nbitems <= 1 ) if( nbitems <= 1 )
NextS = NULL; /* fin de chaine */ NextS = NULL; /* fin de chaine */
PtStruct->Pnext = NextS; PtStruct->Pnext = NextS;
PtStruct->Pback = Back; Back = PtStruct; PtStruct->Pback = Back; Back = PtStruct;
if( NextS == NULL ) if( NextS == NULL )
......
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