more aperture macro work

This commit is contained in:
dickelbeck 2008-11-10 07:13:37 +00:00
parent 1771bf2078
commit 7457789d0e
2 changed files with 56 additions and 12 deletions

View File

@ -177,8 +177,8 @@ typedef std::vector<DCODE_PARAM> DCODE_PARAMS;
*/ */
struct AM_PRIMITIVE struct AM_PRIMITIVE
{ {
AM_PRIMITIVE_ID primitive_id; AM_PRIMITIVE_ID primitive_id; ///< The primitive type
DCODE_PARAMS params; DCODE_PARAMS params; ///< A sequence of parameters used by the primitive
}; };
@ -190,8 +190,8 @@ typedef std::vector<AM_PRIMITIVE> AM_PRIMITIVES;
*/ */
struct APERTURE_MACRO struct APERTURE_MACRO
{ {
wxString name; wxString name; ///< The name of the aperture macro
AM_PRIMITIVES primitives; AM_PRIMITIVES primitives; ///< A sequence of AM_PRIMITIVEs
}; };
@ -260,6 +260,7 @@ public:
{ {
m_Macro = aMacro; m_Macro = aMacro;
} }
APERTURE_MACRO* GetMacro() { return m_Macro; }
/** /**
* Function ShowApertureType * Function ShowApertureType

View File

@ -330,7 +330,8 @@ wxPoint GERBER::ReadXYCoord( char*& Text )
{ {
type_coord = *Text; type_coord = *Text;
Text++; Text++;
text = line; nbchar = 0; text = line;
nbchar = 0;
while( IsNumber( *Text ) ) while( IsNumber( *Text ) )
{ {
if( *Text == '.' ) if( *Text == '.' )
@ -356,7 +357,8 @@ wxPoint GERBER::ReadXYCoord( char*& Text )
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 ) while( nbchar < min_digit )
{ {
*(text++) = '0'; nbchar++; *(text++) = '0';
nbchar++;
} }
*text = 0; *text = 0;
@ -408,12 +410,15 @@ wxPoint GERBER::ReadXYCoord( char*& Text )
if( m_GerbMetric ) if( m_GerbMetric )
real_scale = real_scale / 25.4; 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' ) if( type_coord == 'X' )
pos.x = current_coord; pos.x = current_coord;
else if( type_coord == 'Y' ) else if( type_coord == 'Y' )
pos.y = current_coord; pos.y = current_coord;
continue; continue;
} }
else else
@ -715,10 +720,12 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
{ {
if( D_commande > (MAX_TOOLS - 1) ) if( D_commande > (MAX_TOOLS - 1) )
D_commande = MAX_TOOLS - 1; D_commande = MAX_TOOLS - 1;
m_Current_Tool = D_commande; m_Current_Tool = D_commande;
D_CODE* pt_Dcode = GetDCODE( D_commande, false ); D_CODE* pt_Dcode = GetDCODE( D_commande, false );
if( pt_Dcode ) if( pt_Dcode )
pt_Dcode->m_InUse = TRUE; 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)
@ -852,7 +859,43 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
PAD_RECT ); PAD_RECT );
break; break;
default: // Special (Macro) : Non implant<6E> case APT_MACRO:
{
APERTURE_MACRO* macro = pt_Tool->GetMacro();
wxASSERT( macro );
// split the macro primitives up into multiple normal TRACK elements
for( AM_PRIMITIVES::iterator i=macro->primitives.begin(); i!=macro->primitives.end(); ++i )
{
switch( i->primitive_id )
{
case AMP_CIRCLE:
/*
Append_1_Flash_ROND_GERBER( dcode,
frame, DC,
m_CurrentPos,
size.x );
*/
break;
case AMP_LINE2:
case AMP_LINE20:
break;
case AMP_LINE_CENTER:
case AMP_LINE_LOWER_LEFT:
case AMP_EOF:
case AMP_OUTLINE:
case AMP_POLYGON:
case AMP_MOIRE:
case AMP_THERMAL:
default:
break;
}
}
}
break;
default:
break; break;
} }