2009-11-14 22:15:22 +00:00
|
|
|
/****************************************************/
|
|
|
|
/* Routines for reading and saving of structures in */
|
|
|
|
/* ASCII file common to Pcbnew and CVPCB. */
|
|
|
|
/****************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
|
|
|
#include "kicad_string.h"
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifdef PCBNEW
|
|
|
|
#include "autorout.h"
|
2008-10-20 08:25:06 +00:00
|
|
|
#include "zones.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CVPCB
|
|
|
|
#include "cvpcb.h"
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 08:48:49 +00:00
|
|
|
#include "build_version.h"
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2008-12-05 16:03:05 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* ASCII format of structures:
|
|
|
|
*
|
|
|
|
* Structure PAD:
|
|
|
|
*
|
|
|
|
* $PAD
|
|
|
|
* Sh "name" form DIMVA dimH dV dH East: general form dV, dH = delta size
|
|
|
|
* Dr. diam dV dH: drill: diameter drilling offsets
|
|
|
|
* At Type S / N layers: standard, cms, conn, hole, meca.,
|
|
|
|
* Stack / Normal, 32-bit hexadecimal: occupation layers
|
|
|
|
* Nm net_code netname
|
|
|
|
* Po posrefX posrefy: reFX position, Y (0 = east position / anchor)
|
|
|
|
* $EndPAD
|
|
|
|
*
|
|
|
|
* Module Structure
|
|
|
|
*
|
|
|
|
* $MODULE namelib
|
|
|
|
* Po ax ay east layer masquelayer m_TimeCode
|
|
|
|
* ax ay ord = anchor (position module)
|
|
|
|
* east = east to 0.1 degree
|
|
|
|
* layer = layer number
|
|
|
|
* masquelayer = silkscreen layer for
|
|
|
|
* m_TimeCode internal use (groups)
|
|
|
|
* Li <namelib>
|
|
|
|
*
|
|
|
|
* Cd <text> description of the component (Component Doc)
|
|
|
|
* Kw <text> List of key words
|
|
|
|
*
|
|
|
|
* Sc schematic timestamp, reference schematic
|
|
|
|
*
|
|
|
|
* Op rot90 rot180 placement Options Auto (court rot 90, 180)
|
|
|
|
* rot90 is about 2x4-bit:
|
|
|
|
* lsb = cost rot 90, rot court msb = -90;
|
|
|
|
*
|
|
|
|
* Tn px py DIMVA dimh East thickness mirror visible "text"
|
|
|
|
* n = type (0 = ref, val = 1,> 1 = qcq
|
|
|
|
* Texts POS x, y / anchor and orient module 0
|
|
|
|
* DIMVA dimh East
|
|
|
|
* mirror thickness (Normal / Mirror)
|
|
|
|
* Visible V / I
|
|
|
|
* DS ox oy fx fy w
|
|
|
|
* Edge: coord segment ox, oy has fx, fy, on
|
|
|
|
* was the anchor and orient 0
|
|
|
|
* thickness w
|
|
|
|
* DC ox oy fx fy w descr circle (center, 1 point, thickness)
|
|
|
|
* $PAD
|
|
|
|
* $EndPAD section pads if available
|
|
|
|
* $Endmodule
|
|
|
|
*/
|
2008-12-05 16:03:05 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
int NbDraw, NbTrack, NbZone, NbMod, NbNets;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-12-03 06:54:19 +00:00
|
|
|
/** Read a list of segments (Tracks, zones)
|
|
|
|
* @return items count or - count if no end block ($End...) found.
|
2007-08-06 02:02:39 +00:00
|
|
|
*/
|
2009-11-14 22:15:22 +00:00
|
|
|
int WinEDA_BasePcbFrame::ReadListeSegmentDescr( FILE* File,
|
|
|
|
TRACK* insertBeforeMe,
|
|
|
|
int StructType,
|
|
|
|
int* LineNum,
|
|
|
|
int NumSegm )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
int shape, width, drill, layer, type, flags, net_code;
|
|
|
|
int ii = 0;
|
|
|
|
char line1[256];
|
|
|
|
char line2[256];
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
TRACK* newTrack;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
while( GetLine( File, line1, LineNum ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
int makeType;
|
|
|
|
unsigned long timeStamp;
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
if( line1[0] == '$' )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2007-12-03 06:54:19 +00:00
|
|
|
return ii; /* end of segmentlist: OK */
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
// Read the 2nd line to determine the exact type, one of:
|
2008-12-04 04:28:11 +00:00
|
|
|
// TYPE_TRACK, TYPE_VIA, or TYPE_ZONE. The type field in 2nd line
|
|
|
|
// differentiates between TYPE_TRACK and TYPE_VIA. With virtual
|
2009-11-14 22:15:22 +00:00
|
|
|
// functions in use, it is critical to instantiate the TYPE_VIA
|
|
|
|
// exactly.
|
2007-08-30 22:20:52 +00:00
|
|
|
if( GetLine( File, line2, LineNum ) == NULL )
|
|
|
|
break;
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
if( line2[0] == '$' )
|
|
|
|
break;
|
|
|
|
|
|
|
|
// parse the 2nd line first to determine the type of object
|
|
|
|
sscanf( line2 + 2, " %d %d %d %lX %X", &layer, &type, &net_code,
|
|
|
|
&timeStamp, &flags );
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( StructType==TYPE_TRACK && type==1 )
|
|
|
|
makeType = TYPE_VIA;
|
2007-08-30 22:20:52 +00:00
|
|
|
else
|
|
|
|
makeType = StructType;
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
switch( makeType )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
default:
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TRACK:
|
2009-01-05 05:21:35 +00:00
|
|
|
newTrack = new TRACK( GetBoard() );
|
|
|
|
GetBoard()->m_Track.Insert( newTrack, insertBeforeMe );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_VIA:
|
2009-01-05 05:21:35 +00:00
|
|
|
newTrack = new SEGVIA( GetBoard() );
|
|
|
|
GetBoard()->m_Track.Insert( newTrack, insertBeforeMe );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
|
2009-08-08 06:07:08 +00:00
|
|
|
case TYPE_ZONE: // this is now deprecated, but exits in old boards
|
2009-01-05 05:21:35 +00:00
|
|
|
newTrack = new SEGZONE( GetBoard() );
|
2009-11-14 22:15:22 +00:00
|
|
|
GetBoard()->m_Zone.Insert( (SEGZONE*) newTrack,
|
|
|
|
(SEGZONE*) insertBeforeMe );
|
2007-08-06 02:02:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
newTrack->m_TimeStamp = timeStamp;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
int arg_count = sscanf( line1 + 2, " %d %d %d %d %d %d %d", &shape,
|
2008-12-04 04:28:11 +00:00
|
|
|
&newTrack->m_Start.x, &newTrack->m_Start.y,
|
|
|
|
&newTrack->m_End.x, &newTrack->m_End.y, &width,
|
2008-01-12 20:31:56 +00:00
|
|
|
&drill );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
newTrack->m_Width = width;
|
|
|
|
newTrack->m_Shape = shape;
|
2007-10-15 07:50:59 +00:00
|
|
|
|
2008-01-12 20:31:56 +00:00
|
|
|
if( arg_count < 7 || drill <= 0 )
|
2008-12-04 04:28:11 +00:00
|
|
|
newTrack->SetDrillDefault();
|
2008-03-01 13:15:41 +00:00
|
|
|
else
|
2009-11-14 22:15:22 +00:00
|
|
|
newTrack->SetDrillValue( drill );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
newTrack->SetLayer( layer );
|
2009-05-21 12:45:21 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
if( makeType == TYPE_VIA ) // Ensure layers are OK when possible:
|
|
|
|
{
|
2009-05-21 12:45:21 +00:00
|
|
|
if( newTrack->Shape() == VIA_THROUGH )
|
2009-12-07 03:46:13 +00:00
|
|
|
( (SEGVIA*) newTrack )->SetLayerPair( LAYER_N_FRONT,
|
|
|
|
LAYER_N_BACK );
|
2009-05-21 12:45:21 +00:00
|
|
|
}
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
newTrack->SetNet( net_code );
|
|
|
|
newTrack->SetState( flags, ON );
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DisplayError( this, _( "Error: Unexpected end of file !" ) );
|
|
|
|
return -ii;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-12-03 06:54:19 +00:00
|
|
|
int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
char Line[1024], * data;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
while( GetLine( File, Line, LineNum ) != NULL )
|
|
|
|
{
|
|
|
|
data = strtok( Line, " =\n\r" );
|
|
|
|
if( strnicmp( data, "$EndGENERAL", 10 ) == 0 )
|
|
|
|
break;
|
|
|
|
|
2009-10-10 01:25:53 +00:00
|
|
|
if( stricmp( data, "EnabledLayers" ) == 0 )
|
|
|
|
{
|
|
|
|
int EnabledLayers = 0;
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
sscanf( data, "%X", &EnabledLayers );
|
|
|
|
|
|
|
|
// Setup layer visibility
|
2009-10-18 23:22:26 +00:00
|
|
|
GetBoard()->SetEnabledLayers( EnabledLayers );
|
2009-10-10 01:25:53 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
if( strncmp( data, "Ly", 2 ) == 0 ) // Old format for Layer count
|
|
|
|
{
|
|
|
|
int Masque_Layer = 1, ii;
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
sscanf( data, "%X", &Masque_Layer );
|
|
|
|
|
|
|
|
// Setup layer count
|
2009-10-28 11:48:47 +00:00
|
|
|
int layer_count = 0;
|
2007-08-06 02:02:39 +00:00
|
|
|
for( ii = 0; ii < NB_COPPER_LAYERS; ii++ )
|
|
|
|
{
|
|
|
|
if( Masque_Layer & 1 )
|
2009-10-28 11:48:47 +00:00
|
|
|
layer_count++;
|
2007-08-06 02:02:39 +00:00
|
|
|
Masque_Layer >>= 1;
|
|
|
|
}
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->SetCopperLayerCount( layer_count );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
if( stricmp( data, "BoardThickness" ) == 0 )
|
2009-06-19 20:13:22 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
data = strtok( NULL, " =\n\r" );
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_BoardThickness = atoi( data );;
|
2009-06-19 20:13:22 +00:00
|
|
|
continue;
|
|
|
|
}
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
if( strnicmp( data, "Links", 5 ) == 0 )
|
|
|
|
{
|
2009-05-28 08:42:24 +00:00
|
|
|
// Info only, do nothing
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( data, "NoConn", 6 ) == 0 )
|
|
|
|
{
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_NbNoconnect = atoi( data );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( data, "Di", 2 ) == 0 )
|
|
|
|
{
|
|
|
|
wxSize pcbsize, screensize;
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_BoundaryBox.SetX( atoi( data ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
data = strtok( NULL, " =\n\r" );
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_BoundaryBox.SetY( atoi( data ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
data = strtok( NULL, " =\n\r" );
|
2009-11-14 22:15:22 +00:00
|
|
|
GetBoard()->m_BoundaryBox.SetWidth(
|
|
|
|
atoi( data ) - GetBoard()->m_BoundaryBox.GetX() );
|
2007-08-06 02:02:39 +00:00
|
|
|
data = strtok( NULL, " =\n\r" );
|
2009-11-14 22:15:22 +00:00
|
|
|
GetBoard()->m_BoundaryBox.SetHeight(
|
|
|
|
atoi( data ) - GetBoard()->m_BoundaryBox.GetY() );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Reading the number of segments of type DRAW, TRACK, ZONE */
|
2007-08-06 02:02:39 +00:00
|
|
|
if( stricmp( data, "Ndraw" ) == 0 )
|
|
|
|
{
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
NbDraw = atoi( data );;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( data, "Ntrack" ) == 0 )
|
|
|
|
{
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
NbTrack = atoi( data );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( data, "Nzone" ) == 0 )
|
|
|
|
{
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
NbZone = atoi( data );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( data, "Nmodule" ) == 0 )
|
|
|
|
{
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
NbMod = atoi( data );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( data, "Nnets" ) == 0 )
|
|
|
|
{
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
NbNets = atoi( data );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
char Line[1024];
|
|
|
|
char* data;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
NETCLASS* netclass_default = GetBoard()->m_NetClasses.GetDefault();
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
while( GetLine( File, Line, LineNum ) != NULL )
|
|
|
|
{
|
|
|
|
strtok( Line, " =\n\r" );
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
|
|
|
|
if( stricmp( Line, "$EndSETUP" ) == 0 )
|
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
// Until such time as the *.brd file does not have the
|
|
|
|
// global parameters:
|
|
|
|
// "TrackWidth", "TrackMinWidth", "ViaSize", "ViaDrill",
|
|
|
|
// "ViaMinSize", and "TrackClearence", put those same global
|
|
|
|
// values into the default NETCLASS until later board load
|
|
|
|
// code should override them. *.brd files which have been
|
|
|
|
// saved with knowledge of NETCLASSes will override these
|
|
|
|
// defaults, old boards will not.
|
|
|
|
//
|
2009-09-10 15:22:26 +00:00
|
|
|
// @todo: I expect that at some point we can remove said global
|
2009-11-14 22:15:22 +00:00
|
|
|
// parameters from the *.brd file since the ones in the
|
|
|
|
// default netclass serve the same purpose. If needed
|
|
|
|
// at all, the global defaults should go into a preferences
|
|
|
|
// file instead so they are there to start new board
|
|
|
|
// projects.
|
2009-09-10 15:22:26 +00:00
|
|
|
GetBoard()->m_NetClasses.GetDefault()->SetParams();
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "AuxiliaryAxisOrg" ) == 0 )
|
|
|
|
{
|
|
|
|
int gx = 0, gy = 0;
|
|
|
|
gx = atoi( data );
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
if( data )
|
|
|
|
gy = atoi( data );
|
2008-03-01 13:15:41 +00:00
|
|
|
m_Auxiliary_Axis_Position.x = gx;
|
2007-10-13 06:18:44 +00:00
|
|
|
m_Auxiliary_Axis_Position.y = gy;
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef PCBNEW
|
2007-08-06 02:02:39 +00:00
|
|
|
if( stricmp( Line, "Layers" ) == 0 )
|
|
|
|
{
|
|
|
|
int tmp;
|
|
|
|
sscanf( data, "%d", &tmp );
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->SetCopperLayerCount( tmp );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
const int LAYERKEYZ = sizeof("Layer[") - 1;
|
2008-03-01 13:15:41 +00:00
|
|
|
|
|
|
|
if( strncmp( Line, "Layer[", LAYERKEYZ ) == 0 )
|
|
|
|
{
|
2008-03-04 04:22:27 +00:00
|
|
|
// parse:
|
2008-03-04 14:27:48 +00:00
|
|
|
// Layer[n] <a_Layer_name_with_no_spaces> <LAYER_T>
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
char* cp = Line + LAYERKEYZ;
|
|
|
|
int layer = atoi( cp );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
if( data )
|
|
|
|
{
|
|
|
|
wxString layerName = CONV_FROM_UTF8( data );
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->SetLayerName( layer, layerName );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
|
|
|
data = strtok( NULL, " " );
|
|
|
|
if( data )
|
|
|
|
{
|
|
|
|
LAYER_T type = LAYER::ParseType( data );
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->SetLayerType( layer, type );
|
2008-03-04 04:22:27 +00:00
|
|
|
}
|
|
|
|
}
|
2008-03-01 13:15:41 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
if( stricmp( Line, "TrackWidth" ) == 0 ) // no more used
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:19:40 +00:00
|
|
|
if( stricmp( Line, "TrackWidthList" ) == 0 )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
int tmp = atoi( data );
|
2009-10-06 13:19:40 +00:00
|
|
|
GetBoard()->m_TrackWidthList.push_back( tmp );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "TrackClearence" ) == 0 )
|
|
|
|
{
|
2009-10-21 19:16:25 +00:00
|
|
|
netclass_default->SetClearance( atoi( data ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
if( stricmp( Line, "TrackMinWidth" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_TrackMinWidth = atoi( data );
|
2009-06-18 13:30:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
if( stricmp( Line, "ZoneClearence" ) == 0 )
|
|
|
|
{
|
2008-10-23 10:26:06 +00:00
|
|
|
g_Zone_Default_Setting.m_ZoneClearance = atoi( data );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "DrawSegmWidth" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_DrawSegmentWidth = atoi( data );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "EdgeSegmWidth" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth = atoi( data );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
if( stricmp( Line, "ViaSize" ) == 0 ) // no more used
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
if( stricmp( Line, "ViaMinSize" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_ViasMinSize = atoi( data );
|
2009-06-18 13:30:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
if( stricmp( Line, "MicroViaSize" ) == 0 ) // Not used
|
2008-01-12 20:31:56 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-18 13:30:52 +00:00
|
|
|
if( stricmp( Line, "MicroViaMinSize" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_MicroViasMinSize = atoi( data );
|
2009-06-18 13:30:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-06 13:19:40 +00:00
|
|
|
if( stricmp( Line, "ViaSizeList" ) == 0 )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
int tmp = atoi( data );
|
2009-10-30 17:58:15 +00:00
|
|
|
VIA_DIMENSION via_dim;
|
|
|
|
via_dim.m_Diameter = tmp;
|
|
|
|
data = strtok( NULL, " \n\r" );
|
|
|
|
if( data )
|
|
|
|
{
|
|
|
|
tmp = atoi( data );
|
|
|
|
via_dim.m_Drill = tmp > 0 ? tmp : 0;
|
|
|
|
}
|
|
|
|
GetBoard()->m_ViasDimensionsList.push_back( via_dim );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "ViaDrill" ) == 0 )
|
|
|
|
{
|
2009-10-21 19:16:25 +00:00
|
|
|
int diameter = atoi( data );
|
|
|
|
netclass_default->SetViaDrill( diameter );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
if( stricmp( Line, "ViaMinDrill" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_ViasMinDrill = atoi( data );
|
2009-10-21 19:16:25 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-01-12 20:31:56 +00:00
|
|
|
if( stricmp( Line, "MicroViaDrill" ) == 0 )
|
|
|
|
{
|
2009-10-21 19:16:25 +00:00
|
|
|
int diameter = atoi( data );
|
|
|
|
netclass_default->SetuViaDrill( diameter );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "MicroViaMinDrill" ) == 0 )
|
|
|
|
{
|
|
|
|
int diameter = atoi( data );
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_MicroViasMinDrill = diameter;
|
2008-01-12 20:31:56 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "MicroViasAllowed" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_MicroViasAllowed = atoi( data );
|
2008-01-12 20:31:56 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
if( stricmp( Line, "TextPcbWidth" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth = atoi( data );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "TextPcbSize" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_PcbTextSize.x = atoi( data );
|
2007-08-06 02:02:39 +00:00
|
|
|
data = strtok( NULL, " =\n\r" );
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_PcbTextSize.y = atoi( data );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "EdgeModWidth" ) == 0 )
|
|
|
|
{
|
|
|
|
ModuleSegmentWidth = atoi( data );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "TextModWidth" ) == 0 )
|
|
|
|
{
|
|
|
|
ModuleTextWidth = atoi( data );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "TextModSize" ) == 0 )
|
|
|
|
{
|
|
|
|
ModuleTextSize.x = atoi( data );
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
ModuleTextSize.y = atoi( data );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "PadSize" ) == 0 )
|
|
|
|
{
|
|
|
|
g_Pad_Master.m_Size.x = atoi( data );
|
|
|
|
data = strtok( NULL, " =\n\r" );
|
|
|
|
g_Pad_Master.m_Size.y = atoi( data );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( stricmp( Line, "PadDrill" ) == 0 )
|
|
|
|
{
|
|
|
|
g_Pad_Master.m_Drill.x = atoi( data );
|
|
|
|
g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x;
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-06 13:19:40 +00:00
|
|
|
if( stricmp( Line, "Pad2MaskClearance" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_SolderMaskMargin = atoi( data );
|
2009-10-06 13:19:40 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-11-04 19:08:08 +00:00
|
|
|
if( stricmp( Line, "Pad2PasteClearance" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_SolderPasteMargin = atoi( data );
|
2009-11-04 19:08:08 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if( stricmp( Line, "Pad2PasteClearanceRatio" ) == 0 )
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GetBoard()->GetBoardDesignSettings()->m_SolderPasteMarginRatio = atof( data );
|
2009-11-04 19:08:08 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
|
|
|
|
2009-10-06 13:19:40 +00:00
|
|
|
/* Ensure tracks and vias sizes lists are ok:
|
|
|
|
* Sort lists by by increasing value and remove duplicates
|
|
|
|
* (the first value is not tested, because it is the netclass value
|
2009-11-14 22:15:22 +00:00
|
|
|
*/
|
|
|
|
sort( GetBoard()->m_ViasDimensionsList.begin() + 1,
|
|
|
|
GetBoard()->m_ViasDimensionsList.end() );
|
|
|
|
sort( GetBoard()->m_TrackWidthList.begin() + 1,
|
|
|
|
GetBoard()->m_TrackWidthList.end() );
|
|
|
|
for( unsigned ii = 1;
|
|
|
|
ii < GetBoard()->m_ViasDimensionsList.size() - 1;
|
|
|
|
ii++ )
|
2009-10-06 13:19:40 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
if( GetBoard()->m_ViasDimensionsList[ii]
|
|
|
|
== GetBoard()->m_ViasDimensionsList[ii + 1] )
|
2009-10-06 13:19:40 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
GetBoard()->m_ViasDimensionsList.erase(
|
|
|
|
GetBoard()->m_ViasDimensionsList.begin() + ii );
|
2009-10-06 13:19:40 +00:00
|
|
|
ii--;
|
|
|
|
}
|
|
|
|
}
|
2009-11-14 22:15:22 +00:00
|
|
|
|
|
|
|
for( unsigned ii = 1; ii < GetBoard()->m_TrackWidthList.size() - 1; ii++ )
|
2009-10-06 13:19:40 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
if( GetBoard()->m_TrackWidthList[ii]
|
|
|
|
== GetBoard()->m_TrackWidthList[ii + 1] )
|
2009-10-06 13:19:40 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
GetBoard()->m_TrackWidthList.erase(
|
|
|
|
GetBoard()->m_TrackWidthList.begin() + ii );
|
2009-10-06 13:19:40 +00:00
|
|
|
ii--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
return 1;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PCBNEW
|
2008-03-04 04:22:27 +00:00
|
|
|
static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
NETCLASS* netclass_default = aBoard->m_NetClasses.GetDefault();
|
2009-11-14 22:15:22 +00:00
|
|
|
char text[1024];
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-03-01 13:15:41 +00:00
|
|
|
fprintf( aFile, "$SETUP\n" );
|
2007-08-06 02:02:39 +00:00
|
|
|
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
|
2009-10-05 04:22:27 +00:00
|
|
|
fprintf( aFile, "%s", text );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-03-01 13:15:41 +00:00
|
|
|
fprintf( aFile, "ZoneGridSize %d\n", g_GridRoutingSize );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2008-03-01 13:15:41 +00:00
|
|
|
fprintf( aFile, "Layers %d\n", aBoard->GetCopperLayerCount() );
|
2008-05-01 06:21:07 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
unsigned layerMask =
|
|
|
|
g_TabAllCopperLayerMask[aBoard->GetCopperLayerCount() - 1];
|
2008-05-01 06:21:07 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
for( int layer = 0; layerMask; ++layer, layerMask >>= 1 )
|
2008-03-01 13:15:41 +00:00
|
|
|
{
|
2008-05-01 06:21:07 +00:00
|
|
|
if( layerMask & 1 )
|
|
|
|
{
|
|
|
|
fprintf( aFile, "Layer[%d] %s %s\n", layer,
|
2009-11-14 22:15:22 +00:00
|
|
|
CONV_TO_UTF8( aBoard->GetLayerName( layer ) ),
|
|
|
|
LAYER::ShowType( aBoard->GetLayerType( layer ) ) );
|
2008-05-01 06:21:07 +00:00
|
|
|
}
|
2008-03-01 13:15:41 +00:00
|
|
|
}
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// Save current default track width, for compatibility with older
|
|
|
|
// pcbnew version;
|
2009-10-30 17:58:15 +00:00
|
|
|
fprintf( aFile, "TrackWidth %d\n", aBoard->GetCurrentTrackWidth() );
|
2009-11-14 22:15:22 +00:00
|
|
|
|
|
|
|
// Save custom tracks width list (the first is not saved here: this is the
|
|
|
|
// netclass value
|
2009-10-06 13:19:40 +00:00
|
|
|
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile, "TrackWidthList %d\n", aBoard->m_TrackWidthList[ii] );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-06-19 20:13:22 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() );
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"ZoneClearence %d\n",
|
|
|
|
g_Zone_Default_Setting.m_ZoneClearance );
|
2010-01-31 20:01:46 +00:00
|
|
|
fprintf( aFile, "TrackMinWidth %d\n", aBoard->GetBoardDesignSettings()->m_TrackMinWidth );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_DrawSegmentWidth );
|
|
|
|
fprintf( aFile, "EdgeSegmWidth %d\n", aBoard->GetBoardDesignSettings()->m_EdgeSegmentWidth );
|
2009-11-14 22:15:22 +00:00
|
|
|
|
|
|
|
// Save current default via size, for compatibility with older pcbnew
|
|
|
|
// version;
|
2009-10-30 17:58:15 +00:00
|
|
|
fprintf( aFile, "ViaSize %d\n", netclass_default->GetViaDiameter() );
|
2009-10-21 19:16:25 +00:00
|
|
|
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() );
|
2010-01-31 20:01:46 +00:00
|
|
|
fprintf( aFile, "ViaMinSize %d\n", aBoard->GetBoardDesignSettings()->m_ViasMinSize );
|
|
|
|
fprintf( aFile, "ViaMinDrill %d\n", aBoard->GetBoardDesignSettings()->m_ViasMinDrill );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// Save custom vias diameters list (the first is not saved here: this is
|
|
|
|
// the netclass value
|
2009-10-30 17:58:15 +00:00
|
|
|
for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile, "ViaSizeList %d %d\n",
|
|
|
|
aBoard->m_ViasDimensionsList[ii].m_Diameter,
|
|
|
|
aBoard->m_ViasDimensionsList[ii].m_Drill );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
// for old versions compatibility:
|
|
|
|
fprintf( aFile, "MicroViaSize %d\n", netclass_default->GetuViaDiameter() );
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile, "MicroViaDrill %d\n", netclass_default->GetuViaDrill() );
|
|
|
|
fprintf( aFile,
|
|
|
|
"MicroViasAllowed %d\n",
|
2010-01-31 20:01:46 +00:00
|
|
|
aBoard->GetBoardDesignSettings()->m_MicroViasAllowed );
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"MicroViaMinSize %d\n",
|
2010-01-31 20:01:46 +00:00
|
|
|
aBoard->GetBoardDesignSettings()->m_MicroViasMinSize );
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"MicroViaMinDrill %d\n",
|
2010-01-31 20:01:46 +00:00
|
|
|
aBoard->GetBoardDesignSettings()->m_MicroViasMinDrill );
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
fprintf( aFile, "TextPcbWidth %d\n", aBoard->GetBoardDesignSettings()->m_PcbTextWidth );
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"TextPcbSize %d %d\n",
|
2010-01-31 20:01:46 +00:00
|
|
|
aBoard->GetBoardDesignSettings()->m_PcbTextSize.x,
|
|
|
|
aBoard->GetBoardDesignSettings()->m_PcbTextSize.y );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
|
|
|
fprintf( aFile, "EdgeModWidth %d\n", ModuleSegmentWidth );
|
|
|
|
fprintf( aFile, "TextModSize %d %d\n", ModuleTextSize.x, ModuleTextSize.y );
|
|
|
|
fprintf( aFile, "TextModWidth %d\n", ModuleTextWidth );
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"PadSize %d %d\n",
|
|
|
|
g_Pad_Master.m_Size.x,
|
|
|
|
g_Pad_Master.m_Size.y );
|
2008-03-01 13:15:41 +00:00
|
|
|
fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"Pad2MaskClearance %d\n",
|
2010-01-31 20:01:46 +00:00
|
|
|
aBoard->GetBoardDesignSettings()->m_SolderMaskMargin );
|
|
|
|
if( aBoard->GetBoardDesignSettings()->m_SolderPasteMargin != 0 )
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"Pad2PasteClearance %d\n",
|
2010-01-31 20:01:46 +00:00
|
|
|
aBoard->GetBoardDesignSettings()->m_SolderPasteMargin );
|
|
|
|
if( aBoard->GetBoardDesignSettings()->m_SolderPasteMarginRatio != 0 )
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"Pad2PasteClearanceRatio %g\n",
|
2010-01-31 20:01:46 +00:00
|
|
|
aBoard->GetBoardDesignSettings()->m_SolderPasteMarginRatio );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
fprintf( aFile,
|
|
|
|
"AuxiliaryAxisOrg %d %d\n",
|
|
|
|
aFrame->m_Auxiliary_Axis_Position.x,
|
|
|
|
aFrame->m_Auxiliary_Axis_Position.y );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
|
|
|
fprintf( aFile, "$EndSETUP\n\n" );
|
2007-08-06 02:02:39 +00:00
|
|
|
return 1;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
EDA_BaseStruct* PtStruct = GetBoard()->m_Modules;
|
2007-08-06 02:02:39 +00:00
|
|
|
int NbModules, NbDrawItem, NbLayers;
|
|
|
|
|
2007-12-03 06:54:19 +00:00
|
|
|
/* Write copper layer count */
|
2010-01-31 20:01:46 +00:00
|
|
|
NbLayers = GetBoard()->GetCopperLayerCount();
|
2007-08-06 02:02:39 +00:00
|
|
|
fprintf( File, "$GENERAL\n" );
|
|
|
|
fprintf( File, "LayerCount %d\n", NbLayers );
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// Write old format for Layer count (for compatibility with old versions of
|
|
|
|
// pcbnew
|
|
|
|
fprintf( File,
|
|
|
|
"Ly %8X\n",
|
|
|
|
g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS );
|
2009-10-18 23:22:26 +00:00
|
|
|
fprintf( File, "EnabledLayers %08X\n", GetBoard()->GetEnabledLayers() );
|
2009-05-28 08:42:24 +00:00
|
|
|
fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() );
|
2009-01-05 05:21:35 +00:00
|
|
|
fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-12-03 06:54:19 +00:00
|
|
|
/* Write Bounding box info */
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->ComputeBoundaryBox();
|
2007-08-06 02:02:39 +00:00
|
|
|
fprintf( File, "Di %d %d %d %d\n",
|
2009-11-14 22:15:22 +00:00
|
|
|
GetBoard()->m_BoundaryBox.GetX(),
|
|
|
|
GetBoard()->m_BoundaryBox.GetY(),
|
|
|
|
GetBoard()->m_BoundaryBox.GetRight(),
|
|
|
|
GetBoard()->m_BoundaryBox.GetBottom() );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-12-03 06:54:19 +00:00
|
|
|
/* Write segment count for footprints, drawings, track and zones */
|
|
|
|
/* Calculate the footprint count */
|
2008-11-24 06:53:43 +00:00
|
|
|
for( NbModules = 0; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
2007-12-03 06:54:19 +00:00
|
|
|
NbModules++;
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
PtStruct = GetBoard()->m_Drawings; NbDrawItem = 0;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
2007-08-06 02:02:39 +00:00
|
|
|
NbDrawItem++;
|
|
|
|
|
|
|
|
fprintf( File, "Ndraw %d\n", NbDrawItem );
|
2009-01-05 05:21:35 +00:00
|
|
|
fprintf( File, "Ntrack %d\n", GetBoard()->GetNumSegmTrack() );
|
|
|
|
fprintf( File, "Nzone %d\n", GetBoard()->GetNumSegmZone() );
|
2010-01-31 20:01:46 +00:00
|
|
|
fprintf( File, "BoardThickness %d\n",
|
|
|
|
GetBoard()->GetBoardDesignSettings()->m_BoardThickness );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
fprintf( File, "Nmodule %d\n", NbModules );
|
2009-08-17 02:59:38 +00:00
|
|
|
fprintf( File, "Nnets %d\n", GetBoard()->m_NetInfo->GetCount() );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
fprintf( File, "$EndGENERAL\n\n" );
|
|
|
|
return TRUE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-12-03 06:54:19 +00:00
|
|
|
/** Function WriteSheetDescr
|
2009-11-14 22:15:22 +00:00
|
|
|
* Save the page information (size, texts, date ..)
|
|
|
|
* @param screen BASE_SCREEN to save
|
|
|
|
* @param File = an open FILE to write info
|
|
|
|
*/
|
|
|
|
bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
Ki_PageDescr* sheet = screen->m_CurrentSheetDesc;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
fprintf( File, "$SHEETDESCR\n" );
|
|
|
|
fprintf( File, "Sheet %s %d %d\n",
|
|
|
|
CONV_TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y );
|
|
|
|
fprintf( File, "Title \"%s\"\n", CONV_TO_UTF8( screen->m_Title ) );
|
|
|
|
fprintf( File, "Date \"%s\"\n", CONV_TO_UTF8( screen->m_Date ) );
|
|
|
|
fprintf( File, "Rev \"%s\"\n", CONV_TO_UTF8( screen->m_Revision ) );
|
|
|
|
fprintf( File, "Comp \"%s\"\n", CONV_TO_UTF8( screen->m_Company ) );
|
|
|
|
fprintf( File, "Comment1 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire1 ) );
|
|
|
|
fprintf( File, "Comment2 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire2 ) );
|
|
|
|
fprintf( File, "Comment3 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire3 ) );
|
|
|
|
fprintf( File, "Comment4 \"%s\"\n", CONV_TO_UTF8( screen->m_Commentaire4 ) );
|
|
|
|
|
|
|
|
fprintf( File, "$EndSHEETDESCR\n\n" );
|
|
|
|
return TRUE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
static bool ReadSheetDescr( BASE_SCREEN* screen, FILE* File, int* LineNum )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-06 02:02:39 +00:00
|
|
|
char Line[1024], buf[1024], * text;
|
|
|
|
|
|
|
|
while( GetLine( File, Line, LineNum ) != NULL )
|
|
|
|
{
|
|
|
|
if( strnicmp( Line, "$End", 4 ) == 0 )
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Sheet", 4 ) == 0 )
|
|
|
|
{
|
|
|
|
text = strtok( Line, " \t\n\r" );
|
|
|
|
text = strtok( NULL, " \t\n\r" );
|
2009-04-05 20:49:15 +00:00
|
|
|
Ki_PageDescr* sheet = g_SheetSizeList[0];
|
2007-08-06 02:02:39 +00:00
|
|
|
int ii;
|
2009-04-05 20:49:15 +00:00
|
|
|
for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
|
|
|
if( stricmp( CONV_TO_UTF8( sheet->m_Name ), text ) == 0 )
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
screen->m_CurrentSheetDesc = sheet;
|
2007-08-06 02:02:39 +00:00
|
|
|
if( sheet == &g_Sheet_user )
|
|
|
|
{
|
|
|
|
text = strtok( NULL, " \t\n\r" );
|
|
|
|
if( text )
|
|
|
|
sheet->m_Size.x = atoi( text );
|
|
|
|
text = strtok( NULL, " \t\n\r" );
|
|
|
|
if( text )
|
|
|
|
sheet->m_Size.y = atoi( text );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Title", 2 ) == 0 )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( buf, Line, 256 );
|
|
|
|
screen->m_Title = CONV_FROM_UTF8( buf );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Date", 2 ) == 0 )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( buf, Line, 256 );
|
|
|
|
screen->m_Date = CONV_FROM_UTF8( buf );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Rev", 2 ) == 0 )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( buf, Line, 256 );
|
|
|
|
screen->m_Revision = CONV_FROM_UTF8( buf );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Comp", 4 ) == 0 )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( buf, Line, 256 );
|
|
|
|
screen->m_Company = CONV_FROM_UTF8( buf );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Comment1", 8 ) == 0 )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( buf, Line, 256 );
|
|
|
|
screen->m_Commentaire1 = CONV_FROM_UTF8( buf );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Comment2", 8 ) == 0 )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( buf, Line, 256 );
|
|
|
|
screen->m_Commentaire2 = CONV_FROM_UTF8( buf );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Comment3", 8 ) == 0 )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( buf, Line, 256 );
|
|
|
|
screen->m_Commentaire3 = CONV_FROM_UTF8( buf );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( strnicmp( Line, "Comment4", 8 ) == 0 )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( buf, Line, 256 );
|
|
|
|
screen->m_Commentaire4 = CONV_FROM_UTF8( buf );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
char Line[1024];
|
|
|
|
int LineNum = 0;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
wxBusyCursor dummy;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// Switch the locale to standard C (needed to read floating point numbers
|
|
|
|
// like 1.3)
|
2009-08-17 02:59:38 +00:00
|
|
|
SetLocaleTo_C_standard();
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
BOARD* board = GetBoard();
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
NbDraw = NbTrack = NbZone = NbMod = NbNets = -1;
|
2009-08-17 02:59:38 +00:00
|
|
|
|
|
|
|
board->m_Status_Pcb = 0;
|
|
|
|
board->m_NetClasses.Clear();
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// Put a dollar sign in front, and test for a specific length of characters
|
2009-11-14 22:15:22 +00:00
|
|
|
// The -1 is to omit the trailing \0 which is included in sizeof() on a
|
|
|
|
// string.
|
|
|
|
#define TESTLINE( x ) (strncmp( Line, "$" x, sizeof("$" x) - 1 ) == 0)
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
while( GetLine( File, Line, &LineNum ) != NULL )
|
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
// put the more frequent ones at the top
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "MODULE" ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
MODULE* Module = new MODULE( board );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( Module == NULL )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
board->Add( Module, ADD_APPEND );
|
|
|
|
Module->ReadDescr( File, &LineNum );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "DRAWSEGMENT" ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
DRAWSEGMENT* DrawSegm = new DRAWSEGMENT( board );
|
|
|
|
board->Add( DrawSegm, ADD_APPEND );
|
|
|
|
DrawSegm->ReadDrawSegmentDescr( File, &LineNum );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "EQUIPOT" ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-08-17 02:59:38 +00:00
|
|
|
NETINFO_ITEM* net = new NETINFO_ITEM( board );
|
|
|
|
board->m_NetInfo->AppendNet( net );
|
2009-05-24 18:28:36 +00:00
|
|
|
net->ReadDescr( File, &LineNum );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "TEXTPCB" ) )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
TEXTE_PCB* pcbtxt = new TEXTE_PCB( board );
|
|
|
|
board->Add( pcbtxt, ADD_APPEND );
|
|
|
|
pcbtxt->ReadTextePcbDescr( File, &LineNum );
|
2009-07-18 11:44:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "TRACK" ) )
|
2007-12-29 19:15:58 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
#ifdef PCBNEW
|
|
|
|
TRACK* insertBeforeMe = Append ? NULL : board->m_Track.GetFirst();
|
|
|
|
ReadListeSegmentDescr( File, insertBeforeMe, TYPE_TRACK,
|
2009-11-14 22:15:22 +00:00
|
|
|
&LineNum, NbTrack );
|
2009-09-10 15:22:26 +00:00
|
|
|
#endif
|
2008-02-07 06:49:16 +00:00
|
|
|
continue;
|
2008-03-01 13:15:41 +00:00
|
|
|
}
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( BRD_NETCLASS ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
// create an empty NETCLASS without a name.
|
|
|
|
NETCLASS* netclass = new NETCLASS( board, wxEmptyString );
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// fill it from the *.brd file, and establish its name.
|
|
|
|
netclass->ReadDescr( File, &LineNum );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( !board->m_NetClasses.Add( netclass ) )
|
|
|
|
{
|
|
|
|
// Must have been a name conflict, this is a bad board file.
|
|
|
|
// User may have done a hand edit to the file.
|
|
|
|
// Delete netclass if board could not take ownership of it.
|
|
|
|
delete netclass;
|
|
|
|
|
|
|
|
// @todo: throw an exception here, this is a bad board file.
|
|
|
|
}
|
2007-08-06 02:02:39 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "CZONE_OUTLINE" ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
ZONE_CONTAINER* zone_descr = new ZONE_CONTAINER( board );
|
2009-09-10 15:22:26 +00:00
|
|
|
zone_descr->ReadDescr( File, &LineNum );
|
2009-11-14 22:15:22 +00:00
|
|
|
if( zone_descr->GetNumCorners() > 2 ) // should always occur
|
|
|
|
board->Add( zone_descr );
|
|
|
|
else
|
|
|
|
delete zone_descr;
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "COTATION" ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2010-04-23 09:54:40 +00:00
|
|
|
DIMENSION* Dimension = new DIMENSION( board );
|
|
|
|
board->Add( Dimension, ADD_APPEND );
|
|
|
|
Dimension->ReadDimensionDescr( File, &LineNum );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "MIREPCB" ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-08-17 02:59:38 +00:00
|
|
|
MIREPCB* Mire = new MIREPCB( board );
|
|
|
|
board->Add( Mire, ADD_APPEND );
|
2007-08-06 02:02:39 +00:00
|
|
|
Mire->ReadMirePcbDescr( File, &LineNum );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "ZONE" ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef PCBNEW
|
2009-09-10 15:22:26 +00:00
|
|
|
SEGZONE* insertBeforeMe = Append ? NULL : board->m_Zone.GetFirst();
|
|
|
|
|
|
|
|
ReadListeSegmentDescr( File, insertBeforeMe, TYPE_ZONE,
|
2009-11-14 22:15:22 +00:00
|
|
|
&LineNum, NbZone );
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "GENERAL" ) )
|
2007-08-06 02:02:39 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
ReadGeneralDescrPcb( File, &LineNum );
|
|
|
|
continue;
|
|
|
|
}
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( TESTLINE( "SHEETDESCR" ) )
|
|
|
|
{
|
|
|
|
ReadSheetDescr( GetScreen(), File, &LineNum );
|
2007-08-06 02:02:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-09-10 15:22:26 +00:00
|
|
|
|
|
|
|
if( TESTLINE( "SETUP" ) )
|
|
|
|
{
|
|
|
|
if( !Append )
|
|
|
|
{
|
|
|
|
ReadSetup( File, &LineNum );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while( GetLine( File, Line, &LineNum ) != NULL )
|
|
|
|
if( TESTLINE( "EndSETUP" ) )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( TESTLINE( "EndPCB" ) )
|
|
|
|
break;
|
2007-08-06 02:02:39 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
SetLocaleTo_Default(); // revert to the current locale
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-10-13 16:29:02 +00:00
|
|
|
GetBoard()->m_Status_Pcb = 0;
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2009-10-13 16:29:02 +00:00
|
|
|
// Build the net info list
|
|
|
|
GetBoard()->m_NetInfo->BuildListOfNets();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
board->SynchronizeNetsAndNetClasses();
|
2009-10-13 16:29:02 +00:00
|
|
|
|
2009-10-07 17:10:37 +00:00
|
|
|
m_TrackAndViasSizesList_Changed = true;
|
2009-10-13 16:29:02 +00:00
|
|
|
Affiche_Message( wxEmptyString );
|
|
|
|
BestZoom();
|
2009-09-27 11:00:21 +00:00
|
|
|
SetToolbars();
|
2007-08-06 02:02:39 +00:00
|
|
|
return 1;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PCBNEW
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Save the current PCB in ASCII format
|
|
|
|
* Returns
|
|
|
|
* 1 if OK
|
|
|
|
* 0 if error occurs saving file.
|
2007-08-06 02:02:39 +00:00
|
|
|
*/
|
2009-11-14 22:15:22 +00:00
|
|
|
int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
bool rc;
|
|
|
|
char line[256];
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->m_Status_Pcb &= ~CONNEXION_OK;
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
wxBeginBusyCursor();
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// Switch the locale to standard C (needed to print floating point numbers
|
|
|
|
// like 1.3)
|
|
|
|
SetLocaleTo_C_standard();
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Writing file header. */
|
2007-10-30 21:30:58 +00:00
|
|
|
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
|
2009-11-14 22:15:22 +00:00
|
|
|
DateAndTime( line ) );
|
|
|
|
fprintf( aFile, "# Created by Pcbnew%s\n\n",
|
|
|
|
CONV_TO_UTF8( GetBuildVersion() ) );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-10-06 13:19:40 +00:00
|
|
|
GetBoard()->SynchronizeNetsAndNetClasses();
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2009-10-13 16:29:02 +00:00
|
|
|
// Select default Netclass before writing file.
|
|
|
|
// Useful to save default values in headers
|
2009-11-14 22:15:22 +00:00
|
|
|
GetBoard()->SetCurrentNetClass(
|
|
|
|
GetBoard()->m_NetClasses.GetDefault()->GetName() );
|
2009-10-06 13:19:40 +00:00
|
|
|
m_TrackAndViasSizesList_Changed = true;
|
|
|
|
AuxiliaryToolBar_Update_UI();
|
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
WriteGeneralDescrPcb( aFile );
|
2008-04-17 16:25:29 +00:00
|
|
|
WriteSheetDescr( GetScreen(), aFile );
|
2009-01-05 05:21:35 +00:00
|
|
|
WriteSetup( aFile, this, GetBoard() );
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
rc = GetBoard()->Save( aFile );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
SetLocaleTo_Default(); // revert to the current locale
|
2007-10-30 21:30:58 +00:00
|
|
|
wxEndBusyCursor();
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
if( !rc )
|
|
|
|
DisplayError( this, wxT( "Unable to save PCB file" ) );
|
|
|
|
else
|
|
|
|
Affiche_Message( wxEmptyString );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
return rc;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
#endif
|