gerberview & pcbnew fixes
This commit is contained in:
parent
9c5b539e04
commit
afedb36134
|
@ -7,15 +7,17 @@ email address.
|
||||||
2007-Sep-25 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2007-Sep-25 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ pcbnew
|
+ pcbnew
|
||||||
* got rid of reference to global display options DisplayOpt.DisplayZones from
|
* removed reference to global display options DisplayOpt.DisplayZones in
|
||||||
collectors.cpp so collectors.cpp can continue to be used in multiple future
|
collectors.cpp so collectors.cpp can continue to be used in multiple future
|
||||||
(non-display related) general contexts.
|
(non-display related) general contexts. I don't want unnecessary dependencies
|
||||||
|
in there. The way to completely ignore a type is to exclude it from scanList.
|
||||||
|
The way to sometimes ignore a type is to add support for this in COLLECTORS_GUIDE.
|
||||||
* Moved TYPEZONE to end of AllBoardItems, added GENERAL_COLLECTOR::AllButZones to
|
* Moved TYPEZONE to end of AllBoardItems, added GENERAL_COLLECTOR::AllButZones to
|
||||||
provide support of DisplayOpt.DisplayZones.
|
provide support for DisplayOpt.DisplayZones.
|
||||||
* Added aHotKeyCode to PcbGeneralLocateAndDisplay()
|
* Added aHotKeyCode to PcbGeneralLocateAndDisplay()
|
||||||
+ gerbview
|
+ gerbview
|
||||||
* viewer was getting stuck in a loop when loading a bad gerber file. Fixed
|
* viewer was getting stuck in a loop when loading a bad gerber file. Fixed
|
||||||
the bug, but line 223 through 225 of readgerb.cpp need review.
|
the bug, but line 223 through 225 of readgerb.cpp needs review.
|
||||||
* beautified a few files with uncrustify, (any I had to look at).
|
* beautified a few files with uncrustify, (any I had to look at).
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,59 +10,60 @@
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#define IsNumber(x) ( ( ((x) >= '0') && ((x) <='9') ) ||\
|
#define IsNumber( x ) ( ( ( (x) >= '0' ) && ( (x) <='9' ) ) \
|
||||||
((x) == '-') || ((x) == '+') || ((x) == '.'))
|
|| ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) )
|
||||||
|
|
||||||
/* Format Gerber : NOTES :
|
/* Format Gerber : NOTES :
|
||||||
Fonctions preparatoires:
|
* Fonctions preparatoires:
|
||||||
Gn =
|
* Gn =
|
||||||
G01 interpolation lineaire ( trace de droites )
|
* G01 interpolation lineaire ( trace de droites )
|
||||||
G02,G20,G21 Interpolation circulaire , sens trigo < 0
|
* G02,G20,G21 Interpolation circulaire , sens trigo < 0
|
||||||
G03,G30,G31 Interpolation circulaire , sens trigo > 0
|
* G03,G30,G31 Interpolation circulaire , sens trigo > 0
|
||||||
G04 commentaire
|
* G04 commentaire
|
||||||
G06 Interpolation parabolique
|
* G06 Interpolation parabolique
|
||||||
G07 Interpolation cubique
|
* G07 Interpolation cubique
|
||||||
G10 interpolation lineaire ( echelle 10x )
|
* G10 interpolation lineaire ( echelle 10x )
|
||||||
G11 interpolation lineaire ( echelle 0.1x )
|
* G11 interpolation lineaire ( echelle 0.1x )
|
||||||
G12 interpolation lineaire ( echelle 0.01x )
|
* G12 interpolation lineaire ( echelle 0.01x )
|
||||||
G52 plot symbole reference par Dnn code
|
* G52 plot symbole reference par Dnn code
|
||||||
G53 plot symbole reference par Dnn ; symbole tourne de -90 degres
|
* G53 plot symbole reference par Dnn ; symbole tourne de -90 degres
|
||||||
G54 Selection d'outil
|
* G54 Selection d'outil
|
||||||
G55 Mode exposition photo
|
* G55 Mode exposition photo
|
||||||
G56 plot symbole reference par Dnn A code
|
* G56 plot symbole reference par Dnn A code
|
||||||
G57 affiche le symbole reference sur la console
|
* G57 affiche le symbole reference sur la console
|
||||||
G58 plot et affiche le symbole reference sur la console
|
* G58 plot et affiche le symbole reference sur la console
|
||||||
G60 interpolation lineaire ( echelle 100x )
|
* G60 interpolation lineaire ( echelle 100x )
|
||||||
G70 Unites = Inches
|
* G70 Unites = Inches
|
||||||
G71 Unites = Millimetres
|
* G71 Unites = Millimetres
|
||||||
G74 supprime interpolation circulaire sur 360 degre, revient a G01
|
* G74 supprime interpolation circulaire sur 360 degre, revient a G01
|
||||||
G75 Active interpolation circulaire sur 360 degre
|
* G75 Active interpolation circulaire sur 360 degre
|
||||||
G90 Mode Coordonnees absolues
|
* G90 Mode Coordonnees absolues
|
||||||
G91 Mode Coordonnees Relatives
|
* G91 Mode Coordonnees Relatives
|
||||||
|
*
|
||||||
Coordonnees X,Y
|
* Coordonnees X,Y
|
||||||
X,Y sont suivies de + ou - et de m+n chiffres (non separes)
|
* X,Y sont suivies de + ou - et de m+n chiffres (non separes)
|
||||||
m = partie entiere
|
* m = partie entiere
|
||||||
n = partie apres la virgule
|
* n = partie apres la virgule
|
||||||
formats classiques : m = 2, n = 3 (format 2.3)
|
* formats classiques : m = 2, n = 3 (format 2.3)
|
||||||
m = 3, n = 4 (format 3.4)
|
* m = 3, n = 4 (format 3.4)
|
||||||
ex:
|
* ex:
|
||||||
G__ X00345Y-06123 D__*
|
* G__ X00345Y-06123 D__*
|
||||||
|
*
|
||||||
Outils et D_CODES
|
* Outils et D_CODES
|
||||||
numero d'outil ( identification des formes )
|
* numero d'outil ( identification des formes )
|
||||||
1 a 99 (classique)
|
* 1 a 99 (classique)
|
||||||
1 a 999
|
* 1 a 999
|
||||||
D_CODES:
|
* D_CODES:
|
||||||
|
*
|
||||||
D01 ... D9 = codes d'action:
|
* D01 ... D9 = codes d'action:
|
||||||
D01 = activation de lumiere (baisser de plume) lors du déplacement
|
* D01 = activation de lumiere (baisser de plume) lors du déplacement
|
||||||
D02 = extinction de lumiere (lever de plume) lors du déplacement
|
* D02 = extinction de lumiere (lever de plume) lors du déplacement
|
||||||
D03 = Flash
|
* D03 = Flash
|
||||||
D09 = VAPE Flash
|
* D09 = VAPE Flash
|
||||||
D51 = precede par G54 -> Select VAPE
|
* D51 = precede par G54 -> Select VAPE
|
||||||
|
*
|
||||||
D10 ... D255 = Indentification d'outils ( d'ouvertures )
|
* D10 ... D255 = Indentification d'outils ( d'ouvertures )
|
||||||
Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H)
|
* Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Type d'action du phototraceur:
|
// Type d'action du phototraceur:
|
||||||
|
@ -91,18 +92,19 @@ static void Append_1_SEG_ARC_GERBER(int Dcode_index,
|
||||||
bool trigo_sens, bool multiquadrant );
|
bool trigo_sens, bool multiquadrant );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
static void Append_1_Flash_ROND_GERBER( int Dcode_tool,
|
static void Append_1_Flash_ROND_GERBER( int Dcode_tool,
|
||||||
WinEDA_GerberFrame* frame,
|
WinEDA_GerberFrame* frame,
|
||||||
wxDC* DC, const wxPoint& pos, int diametre )
|
wxDC* DC, const wxPoint& pos, int diametre )
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
/* Trace 1 flash ROND en position pos
|
/* Trace 1 flash ROND en position pos
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
|
|
||||||
track = new TRACK( frame->m_Pcb );
|
track = new TRACK( frame->m_Pcb );
|
||||||
|
|
||||||
track->Insert( frame->m_Pcb, NULL );
|
track->Insert( frame->m_Pcb, NULL );
|
||||||
|
|
||||||
track->SetLayer( frame->GetScreen()->m_Active_Layer );
|
track->SetLayer( frame->GetScreen()->m_Active_Layer );
|
||||||
|
@ -116,14 +118,16 @@ TRACK * track;
|
||||||
Trace_Segment( frame->DrawPanel, DC, track, GR_OR );
|
Trace_Segment( frame->DrawPanel, DC, track, GR_OR );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
static void Append_1_Flash_GERBER( int Dcode_index,
|
static void Append_1_Flash_GERBER( int Dcode_index,
|
||||||
WinEDA_GerberFrame* frame, wxDC* DC,
|
WinEDA_GerberFrame* frame, wxDC* DC,
|
||||||
const wxPoint& pos, const wxSize& size, int forme )
|
const wxPoint& pos, const wxSize& size, int forme )
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Trace 1 flash rectangulaire ou ovale vertical ou horizontal
|
* Trace 1 flash rectangulaire ou ovale vertical ou horizontal
|
||||||
donne par son centre et ses dimensions X et Y
|
* donne par son centre et ses dimensions X et Y
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
|
@ -133,6 +137,7 @@ int width, len;
|
||||||
len = MAX( size.x, size.y ) - width;
|
len = MAX( size.x, size.y ) - width;
|
||||||
|
|
||||||
track = new TRACK( frame->m_Pcb );
|
track = new TRACK( frame->m_Pcb );
|
||||||
|
|
||||||
track->Insert( frame->m_Pcb, NULL );
|
track->Insert( frame->m_Pcb, NULL );
|
||||||
|
|
||||||
track->SetLayer( frame->GetScreen()->m_Active_Layer );
|
track->SetLayer( frame->GetScreen()->m_Active_Layer );
|
||||||
|
@ -153,7 +158,6 @@ int width, len;
|
||||||
track->m_Start.x -= len;
|
track->m_Start.x -= len;
|
||||||
track->m_End.x += len;
|
track->m_End.x += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
else // ovale / rect vertical
|
else // ovale / rect vertical
|
||||||
{
|
{
|
||||||
track->m_Start.y -= len;
|
track->m_Start.y -= len;
|
||||||
|
@ -174,6 +178,7 @@ static void Append_1_Line_GERBER(int Dcode_index,
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
|
|
||||||
track = new TRACK( frame->m_Pcb );
|
track = new TRACK( frame->m_Pcb );
|
||||||
|
|
||||||
track->Insert( frame->m_Pcb, NULL );
|
track->Insert( frame->m_Pcb, NULL );
|
||||||
|
|
||||||
track->SetLayer( frame->GetScreen()->m_Active_Layer );
|
track->SetLayer( frame->GetScreen()->m_Active_Layer );
|
||||||
|
@ -187,6 +192,7 @@ TRACK * track;
|
||||||
Trace_Segment( frame->DrawPanel, DC, track, GR_OR );
|
Trace_Segment( frame->DrawPanel, DC, track, GR_OR );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
static void Append_1_SEG_ARC_GERBER( int Dcode_index,
|
static void Append_1_SEG_ARC_GERBER( int Dcode_index,
|
||||||
WinEDA_GerberFrame* frame, wxDC* DC,
|
WinEDA_GerberFrame* frame, wxDC* DC,
|
||||||
|
@ -196,20 +202,21 @@ static void Append_1_SEG_ARC_GERBER(int Dcode_index,
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
/* creation d'un arc:
|
/* creation d'un arc:
|
||||||
si multiquadrant == TRUE arc de 0 a 360 degres
|
* si multiquadrant == TRUE arc de 0 a 360 degres
|
||||||
et rel_center est la coordonnée du centre relativement au startpoint
|
* et rel_center est la coordonnée du centre relativement au startpoint
|
||||||
|
*
|
||||||
si multiquadrant == FALSE arc de 0 à 90 entierement contenu dans le meme quadrant
|
* si multiquadrant == FALSE arc de 0 à 90 entierement contenu dans le meme quadrant
|
||||||
et rel_center est la coordonnée du centre relativement au startpoint,
|
* et rel_center est la coordonnée du centre relativement au startpoint,
|
||||||
mais en VALEUR ABSOLUE et le signe des valeurs x et y de rel_center doit
|
* mais en VALEUR ABSOLUE et le signe des valeurs x et y de rel_center doit
|
||||||
etre deduit de cette limite de 90 degres
|
* etre deduit de cette limite de 90 degres
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
wxPoint center, delta;
|
wxPoint center, delta;
|
||||||
|
|
||||||
track = new TRACK( frame->m_Pcb );
|
track = new TRACK( frame->m_Pcb );
|
||||||
|
|
||||||
track->Insert( frame->m_Pcb, NULL );
|
track->Insert( frame->m_Pcb, NULL );
|
||||||
|
|
||||||
track->m_Shape = S_ARC;
|
track->m_Shape = S_ARC;
|
||||||
|
@ -237,19 +244,18 @@ wxPoint center, delta;
|
||||||
center = rel_center;
|
center = rel_center;
|
||||||
delta.x = endpoint.x - startpoint.x;
|
delta.x = endpoint.x - startpoint.x;
|
||||||
delta.y = endpoint.y - startpoint.y;
|
delta.y = endpoint.y - startpoint.y;
|
||||||
|
|
||||||
// il faut corriger de signe de rel_center.x et rel_center.y
|
// il faut corriger de signe de rel_center.x et rel_center.y
|
||||||
// selon le quadrant ou on se trouve
|
// selon le quadrant ou on se trouve
|
||||||
if( (delta.x >= 0) && (delta.y >= 0) ) // 1er quadrant
|
if( (delta.x >= 0) && (delta.y >= 0) ) // 1er quadrant
|
||||||
{
|
{
|
||||||
center.x = -center.x;
|
center.x = -center.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( (delta.x < 0) && (delta.y >= 0) ) // 2eme quadrant
|
else if( (delta.x < 0) && (delta.y >= 0) ) // 2eme quadrant
|
||||||
{
|
{
|
||||||
center.x = -center.x;
|
center.x = -center.x;
|
||||||
center.y = -center.y;
|
center.y = -center.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( (delta.x < 0) && (delta.y < 0) ) // 3eme quadrant
|
else if( (delta.x < 0) && (delta.y < 0) ) // 3eme quadrant
|
||||||
{
|
{
|
||||||
center.y = -center.y;
|
center.y = -center.y;
|
||||||
|
@ -288,13 +294,15 @@ wxPoint center, delta;
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Routines utilisées en lecture de ficher gerber */
|
/* Routines utilisées en lecture de ficher gerber */
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
|
|
||||||
/* ces routines lisent la chaine de texte pointée par Text.
|
/* ces routines lisent la chaine de texte pointée par Text.
|
||||||
Apres appel, Text pointe le debut de la sequence non lue
|
* Apres appel, Text pointe le debut de la sequence non lue
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
wxPoint GERBER_Descr::ReadXYCoord( char*& Text )
|
wxPoint GERBER_Descr::ReadXYCoord( char*& Text )
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
|
|
||||||
/* Retourne la coord courante pointee par Text (XnnnnYmmmm)
|
/* Retourne la coord courante pointee par Text (XnnnnYmmmm)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -305,10 +313,13 @@ char * text;
|
||||||
char line[256];
|
char line[256];
|
||||||
|
|
||||||
|
|
||||||
if ( m_Relative ) pos.x = pos.y = 0;
|
if( m_Relative )
|
||||||
else pos = m_CurrentPos;
|
pos.x = pos.y = 0;
|
||||||
|
else
|
||||||
|
pos = m_CurrentPos;
|
||||||
|
|
||||||
if ( Text == NULL ) return pos;
|
if( Text == NULL )
|
||||||
|
return pos;
|
||||||
|
|
||||||
text = line;
|
text = line;
|
||||||
while( *Text )
|
while( *Text )
|
||||||
|
@ -320,10 +331,13 @@ char line[256];
|
||||||
text = line; nbchar = 0;
|
text = line; nbchar = 0;
|
||||||
while( IsNumber( *Text ) )
|
while( IsNumber( *Text ) )
|
||||||
{
|
{
|
||||||
if ( *Text == '.' ) is_float = TRUE;
|
if( *Text == '.' )
|
||||||
|
is_float = TRUE;
|
||||||
*(text++) = *(Text++);
|
*(text++) = *(Text++);
|
||||||
if ( (*Text >= '0') && (*Text <='9') ) nbchar++;
|
if( (*Text >= '0') && (*Text <='9') )
|
||||||
|
nbchar++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*text = 0;
|
*text = 0;
|
||||||
if( is_float )
|
if( is_float )
|
||||||
{
|
{
|
||||||
|
@ -338,42 +352,70 @@ char line[256];
|
||||||
if( m_NoTrailingZeros )
|
if( m_NoTrailingZeros )
|
||||||
{
|
{
|
||||||
int min_digit = (type_coord == 'X') ? m_FmtLen.x : m_FmtLen.y;
|
int min_digit = (type_coord == 'X') ? m_FmtLen.x : m_FmtLen.y;
|
||||||
while (nbchar < min_digit) { *(text++) ='0'; nbchar++; }
|
while( nbchar < min_digit )
|
||||||
|
{
|
||||||
|
*(text++) = '0'; nbchar++;
|
||||||
|
}
|
||||||
|
|
||||||
*text = 0;
|
*text = 0;
|
||||||
}
|
}
|
||||||
current_coord = atoi( line );
|
current_coord = atoi( line );
|
||||||
double real_scale = 1.0;
|
double real_scale = 1.0;
|
||||||
|
|
||||||
switch( fmt_scale )
|
switch( fmt_scale )
|
||||||
{
|
{
|
||||||
case 0: real_scale = 10000.0;
|
case 0:
|
||||||
|
real_scale = 10000.0;
|
||||||
break;
|
break;
|
||||||
case 1: real_scale = 1000.0;
|
|
||||||
|
case 1:
|
||||||
|
real_scale = 1000.0;
|
||||||
break;
|
break;
|
||||||
case 2: real_scale = 100.0;
|
|
||||||
|
case 2:
|
||||||
|
real_scale = 100.0;
|
||||||
break;
|
break;
|
||||||
case 3: real_scale = 10.0;
|
|
||||||
|
case 3:
|
||||||
|
real_scale = 10.0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
break;
|
break;
|
||||||
case 5: real_scale = 0.1;
|
|
||||||
|
case 5:
|
||||||
|
real_scale = 0.1;
|
||||||
break;
|
break;
|
||||||
case 6: real_scale = 0.01;
|
|
||||||
|
case 6:
|
||||||
|
real_scale = 0.01;
|
||||||
break;
|
break;
|
||||||
case 7: real_scale = 0.001;
|
|
||||||
|
case 7:
|
||||||
|
real_scale = 0.001;
|
||||||
break;
|
break;
|
||||||
case 8: real_scale = 0.0001;
|
|
||||||
|
case 8:
|
||||||
|
real_scale = 0.0001;
|
||||||
break;
|
break;
|
||||||
case 9: real_scale = 0.00001;
|
|
||||||
|
case 9:
|
||||||
|
real_scale = 0.00001;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( m_GerbMetric ) real_scale = real_scale / 25.4;
|
|
||||||
|
if( m_GerbMetric )
|
||||||
|
real_scale = real_scale / 25.4;
|
||||||
current_coord = (int) round( current_coord * real_scale );
|
current_coord = (int) round( current_coord * real_scale );
|
||||||
}
|
}
|
||||||
if ( type_coord == 'X' ) pos.x = current_coord;
|
if( type_coord == 'X' )
|
||||||
else if ( type_coord == 'Y' ) pos.y = current_coord;
|
pos.x = current_coord;
|
||||||
|
else if( type_coord == 'Y' )
|
||||||
|
pos.y = current_coord;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else break;
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_Relative )
|
if( m_Relative )
|
||||||
|
@ -386,21 +428,25 @@ char line[256];
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
wxPoint GERBER_Descr::ReadIJCoord( char*& Text )
|
wxPoint GERBER_Descr::ReadIJCoord( char*& Text )
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
/* Retourne la coord type InnJnn courante pointee par Text (InnnnJmmmm)
|
/* Retourne la coord type InnJnn courante pointee par Text (InnnnJmmmm)
|
||||||
Ces coordonnées sont relatives, donc si une coord est absente, sa valeur
|
* Ces coordonnées sont relatives, donc si une coord est absente, sa valeur
|
||||||
par defaut est 0
|
* par defaut est 0
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint pos( 0, 0 );
|
wxPoint pos( 0, 0 );
|
||||||
|
|
||||||
int type_coord = 0, current_coord, nbchar;
|
int type_coord = 0, current_coord, nbchar;
|
||||||
bool is_float = FALSE;
|
bool is_float = FALSE;
|
||||||
char* text;
|
char* text;
|
||||||
char line[256];
|
char line[256];
|
||||||
|
|
||||||
if ( Text == NULL ) return pos;
|
if( Text == NULL )
|
||||||
|
return pos;
|
||||||
|
|
||||||
text = line;
|
text = line;
|
||||||
while( *Text )
|
while( *Text )
|
||||||
|
@ -412,10 +458,13 @@ char line[256];
|
||||||
text = line; nbchar = 0;
|
text = line; nbchar = 0;
|
||||||
while( IsNumber( *Text ) )
|
while( IsNumber( *Text ) )
|
||||||
{
|
{
|
||||||
if ( *Text == '.' ) is_float = TRUE;
|
if( *Text == '.' )
|
||||||
|
is_float = TRUE;
|
||||||
*(text++) = *(Text++);
|
*(text++) = *(Text++);
|
||||||
if ( (*Text >= '0') && (*Text <='9') ) nbchar++;
|
if( (*Text >= '0') && (*Text <='9') )
|
||||||
|
nbchar++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*text = 0;
|
*text = 0;
|
||||||
if( is_float )
|
if( is_float )
|
||||||
{
|
{
|
||||||
|
@ -430,50 +479,81 @@ char line[256];
|
||||||
if( m_NoTrailingZeros )
|
if( m_NoTrailingZeros )
|
||||||
{
|
{
|
||||||
int min_digit = (type_coord == 'I') ? m_FmtLen.x : m_FmtLen.y;
|
int min_digit = (type_coord == 'I') ? m_FmtLen.x : m_FmtLen.y;
|
||||||
while (nbchar < min_digit) { *(text++) ='0'; nbchar++; }
|
while( nbchar < min_digit )
|
||||||
|
{
|
||||||
|
*(text++) = '0'; nbchar++;
|
||||||
|
}
|
||||||
|
|
||||||
*text = 0;
|
*text = 0;
|
||||||
}
|
}
|
||||||
current_coord = atoi( line );
|
current_coord = atoi( line );
|
||||||
double real_scale = 1.0;
|
double real_scale = 1.0;
|
||||||
|
|
||||||
switch( fmt_scale )
|
switch( fmt_scale )
|
||||||
{
|
{
|
||||||
case 0: real_scale = 10000.0;
|
case 0:
|
||||||
|
real_scale = 10000.0;
|
||||||
break;
|
break;
|
||||||
case 1: real_scale = 1000.0;
|
|
||||||
|
case 1:
|
||||||
|
real_scale = 1000.0;
|
||||||
break;
|
break;
|
||||||
case 2: real_scale = 100.0;
|
|
||||||
|
case 2:
|
||||||
|
real_scale = 100.0;
|
||||||
break;
|
break;
|
||||||
case 3: real_scale = 10.0;
|
|
||||||
|
case 3:
|
||||||
|
real_scale = 10.0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
break;
|
break;
|
||||||
case 5: real_scale = 0.1;
|
|
||||||
|
case 5:
|
||||||
|
real_scale = 0.1;
|
||||||
break;
|
break;
|
||||||
case 6: real_scale = 0.01;
|
|
||||||
|
case 6:
|
||||||
|
real_scale = 0.01;
|
||||||
break;
|
break;
|
||||||
case 7: real_scale = 0.001;
|
|
||||||
|
case 7:
|
||||||
|
real_scale = 0.001;
|
||||||
break;
|
break;
|
||||||
case 8: real_scale = 0.0001;
|
|
||||||
|
case 8:
|
||||||
|
real_scale = 0.0001;
|
||||||
break;
|
break;
|
||||||
case 9: real_scale = 0.00001;
|
|
||||||
|
case 9:
|
||||||
|
real_scale = 0.00001;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( m_GerbMetric ) real_scale = real_scale / 25.4;
|
|
||||||
|
if( m_GerbMetric )
|
||||||
|
real_scale = real_scale / 25.4;
|
||||||
current_coord = (int) round( current_coord * real_scale );
|
current_coord = (int) round( current_coord * real_scale );
|
||||||
}
|
}
|
||||||
if ( type_coord == 'I' ) pos.x = current_coord;
|
if( type_coord == 'I' )
|
||||||
else if ( type_coord == 'J' ) pos.y = current_coord;
|
pos.x = current_coord;
|
||||||
|
else if( type_coord == 'J' )
|
||||||
|
pos.y = current_coord;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else break;
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_IJPos = pos;
|
m_IJPos = pos;
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
int GERBER_Descr::ReturnGCodeNumber( char*& Text )
|
int GERBER_Descr::ReturnGCodeNumber( char*& Text )
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
|
|
||||||
/* Lit la sequence Gnn et retourne la valeur nn
|
/* Lit la sequence Gnn et retourne la valeur nn
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -481,23 +561,25 @@ int ii = 0;
|
||||||
char* text;
|
char* text;
|
||||||
char line[1024];
|
char line[1024];
|
||||||
|
|
||||||
if ( Text == NULL ) return 0;
|
if( Text == NULL )
|
||||||
|
return 0;
|
||||||
Text++;
|
Text++;
|
||||||
text = line;
|
text = line;
|
||||||
while( IsNumber( *Text ) )
|
while( IsNumber( *Text ) )
|
||||||
{
|
{
|
||||||
*(text++) = *(Text++);
|
*(text++) = *(Text++);
|
||||||
}
|
}
|
||||||
|
|
||||||
*text = 0;
|
*text = 0;
|
||||||
ii = atoi( line );
|
ii = atoi( line );
|
||||||
return ii;
|
return ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
int GERBER_Descr::ReturnDCodeNumber( char*& Text )
|
int GERBER_Descr::ReturnDCodeNumber( char*& Text )
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
|
|
||||||
/* Lit la sequence Dnn et retourne la valeur nn
|
/* Lit la sequence Dnn et retourne la valeur nn
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -505,15 +587,19 @@ int ii = 0;
|
||||||
char* text;
|
char* text;
|
||||||
char line[1024];
|
char line[1024];
|
||||||
|
|
||||||
if ( Text == NULL ) return 0;
|
if( Text == NULL )
|
||||||
|
return 0;
|
||||||
Text++;
|
Text++;
|
||||||
text = line;
|
text = line;
|
||||||
while( IsNumber(*Text) ) *(text++) = *(Text++);
|
while( IsNumber( *Text ) )
|
||||||
|
*(text++) = *(Text++);
|
||||||
|
|
||||||
*text = 0;
|
*text = 0;
|
||||||
ii = atoi( line );
|
ii = atoi( line );
|
||||||
return ii;
|
return ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool GERBER_Descr::Execute_G_Command( char*& text, int G_commande )
|
bool GERBER_Descr::Execute_G_Command( char*& text, int G_commande )
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
@ -552,11 +638,14 @@ bool GERBER_Descr::Execute_G_Command(char * &text, int G_commande)
|
||||||
case GC_SELECT_TOOL:
|
case GC_SELECT_TOOL:
|
||||||
{
|
{
|
||||||
int D_commande = ReturnDCodeNumber( text );
|
int D_commande = ReturnDCodeNumber( text );
|
||||||
if ( D_commande < FIRST_DCODE) return FALSE;
|
if( D_commande < FIRST_DCODE )
|
||||||
if (D_commande > (MAX_TOOLS-1)) D_commande = MAX_TOOLS-1;
|
return FALSE;
|
||||||
|
if( D_commande > (MAX_TOOLS - 1) )
|
||||||
|
D_commande = MAX_TOOLS - 1;
|
||||||
m_Current_Tool = D_commande;
|
m_Current_Tool = D_commande;
|
||||||
D_CODE* pt_Dcode = ReturnToolDescr( m_Layer, D_commande );
|
D_CODE* pt_Dcode = ReturnToolDescr( m_Layer, D_commande );
|
||||||
if ( pt_Dcode ) pt_Dcode->m_InUse = TRUE;
|
if( pt_Dcode )
|
||||||
|
pt_Dcode->m_InUse = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,25 +695,28 @@ bool GERBER_Descr::Execute_G_Command(char * &text, int G_commande)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool GERBER_Descr::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
bool GERBER_Descr::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
||||||
char*& text, int D_commande )
|
char*& text, int D_commande )
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
{
|
{
|
||||||
wxSize size( 15, 15 );
|
wxSize size( 15, 15 );
|
||||||
|
|
||||||
int shape = 1, dcode = 0;
|
int shape = 1, dcode = 0;
|
||||||
D_CODE* pt_Tool = NULL;
|
D_CODE* pt_Tool = NULL;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
|
if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
|
||||||
{
|
{
|
||||||
if (D_commande > (MAX_TOOLS-1)) D_commande = MAX_TOOLS-1;
|
if( D_commande > (MAX_TOOLS - 1) )
|
||||||
|
D_commande = MAX_TOOLS - 1;
|
||||||
m_Current_Tool = D_commande;
|
m_Current_Tool = D_commande;
|
||||||
D_CODE* pt_Dcode = ReturnToolDescr( m_Layer, D_commande );
|
D_CODE* pt_Dcode = ReturnToolDescr( m_Layer, D_commande );
|
||||||
if ( pt_Dcode ) pt_Dcode->m_InUse = TRUE;
|
if( pt_Dcode )
|
||||||
|
pt_Dcode->m_InUse = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else // D_commande = 0..9: this is a pen command (usualy D1, D2 or D3)
|
else // D_commande = 0..9: this is a pen command (usualy D1, D2 or D3)
|
||||||
{
|
{
|
||||||
m_Last_Pen_Command = D_commande;
|
m_Last_Pen_Command = D_commande;
|
||||||
|
@ -639,8 +731,12 @@ wxString msg;
|
||||||
SEGZONE* edge_poly, * last;
|
SEGZONE* edge_poly, * last;
|
||||||
|
|
||||||
edge_poly = new SEGZONE( frame->m_Pcb );
|
edge_poly = new SEGZONE( frame->m_Pcb );
|
||||||
|
|
||||||
last = (SEGZONE*) frame->m_Pcb->m_Zone;
|
last = (SEGZONE*) frame->m_Pcb->m_Zone;
|
||||||
if ( last ) while (last->Pnext ) last = (SEGZONE*)last->Pnext;
|
if( last )
|
||||||
|
while( last->Pnext )
|
||||||
|
last = (SEGZONE*) last->Pnext;
|
||||||
|
|
||||||
edge_poly->Insert( frame->m_Pcb, last );
|
edge_poly->Insert( frame->m_Pcb, last );
|
||||||
|
|
||||||
edge_poly->SetLayer( frame->GetScreen()->m_Active_Layer );
|
edge_poly->SetLayer( frame->GetScreen()->m_Active_Layer );
|
||||||
|
@ -664,9 +760,8 @@ wxString msg;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
switch( D_commande )
|
||||||
else switch ( D_commande )
|
|
||||||
{
|
{
|
||||||
case 1: //code D01 Draw line, exposure ON
|
case 1: //code D01 Draw line, exposure ON
|
||||||
pt_Tool = ReturnToolDescr( m_Layer, m_Current_Tool );
|
pt_Tool = ReturnToolDescr( m_Layer, m_Current_Tool );
|
||||||
|
@ -676,6 +771,7 @@ wxString msg;
|
||||||
dcode = pt_Tool->m_Num_Dcode;
|
dcode = pt_Tool->m_Num_Dcode;
|
||||||
shape = pt_Tool->m_Shape;
|
shape = pt_Tool->m_Shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_Iterpolation )
|
switch( m_Iterpolation )
|
||||||
{
|
{
|
||||||
case GERB_INTERPOL_LINEAR_1X:
|
case GERB_INTERPOL_LINEAR_1X:
|
||||||
|
@ -711,6 +807,7 @@ wxString msg;
|
||||||
DisplayError( frame, msg );
|
DisplayError( frame, msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PreviousPos = m_CurrentPos;
|
m_PreviousPos = m_CurrentPos;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -753,8 +850,8 @@ wxString msg;
|
||||||
|
|
||||||
default: // Special (Macro) : Non implanté
|
default: // Special (Macro) : Non implanté
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PreviousPos = m_CurrentPos;
|
m_PreviousPos = m_CurrentPos;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -764,4 +861,3 @@ wxString msg;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,8 @@ void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
|
||||||
|
|
||||||
if( via_type == VIA_NORMALE )
|
if( via_type == VIA_NORMALE )
|
||||||
{
|
{
|
||||||
top_layer = LAYER_CMP_N; bottom_layer = LAYER_CUIVRE_N;
|
top_layer = LAYER_CMP_N;
|
||||||
|
bottom_layer = LAYER_CUIVRE_N;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bottom_layer > top_layer )
|
if( bottom_layer > top_layer )
|
||||||
|
@ -695,12 +696,12 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
|
||||||
|| Type() == TYPEVIA )
|
|| Type() == TYPEVIA )
|
||||||
{
|
{
|
||||||
EQUIPOT* equipot = ((WinEDA_PcbFrame*)frame)->m_Pcb->FindNet( m_NetCode );
|
EQUIPOT* equipot = ((WinEDA_PcbFrame*)frame)->m_Pcb->FindNet( m_NetCode );
|
||||||
|
|
||||||
if( equipot )
|
if( equipot )
|
||||||
{
|
|
||||||
msg = equipot->m_Netname;
|
msg = equipot->m_Netname;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
msg = wxT( "<noname>" );
|
msg = wxT( "<noname>" );
|
||||||
|
|
||||||
Affiche_1_Parametre( frame, text_pos, _( "NetName" ), msg, RED );
|
Affiche_1_Parametre( frame, text_pos, _( "NetName" ), msg, RED );
|
||||||
|
|
||||||
/* Affiche net code :*/
|
/* Affiche net code :*/
|
||||||
|
|
Loading…
Reference in New Issue