Gerbview: add parsing of optional Aperture Macro parameter. AMP_CIRCLE primitive has 4 or 5 parameters (last is optional) Reading the optional parameter was missing.
Fixes: lp:1852924 https://bugs.launchpad.net/kicad/+bug/1852924
This commit is contained in:
parent
36acadbd52
commit
9cda16220e
|
@ -1049,7 +1049,8 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize,
|
|||
break;
|
||||
|
||||
case AMP_OUTLINE:
|
||||
paramCount = 4;
|
||||
paramCount = 4; // partial count. other parameters are vertices and rotation
|
||||
// Second parameter is vertice (coordinate pairs) count.
|
||||
break;
|
||||
|
||||
case AMP_POLYGON:
|
||||
|
@ -1095,10 +1096,11 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize,
|
|||
if( ii < paramCount )
|
||||
{
|
||||
// maybe some day we can throw an exception and track a line number
|
||||
msg.Printf( wxT( "RS274X: read macro descr type %d: read %d parameters, insufficient parameters\n" ),
|
||||
msg.Printf( "RS274X: read macro descr type %d: read %d parameters, insufficient parameters\n",
|
||||
prim.primitive_id, ii );
|
||||
AddMessageToList( msg );
|
||||
}
|
||||
|
||||
// there are more parameters to read if this is an AMP_OUTLINE
|
||||
if( prim.primitive_id == AMP_OUTLINE )
|
||||
{
|
||||
|
@ -1126,6 +1128,14 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize,
|
|||
}
|
||||
}
|
||||
|
||||
// AMP_CIRCLE can have a optional parameter (rotation)
|
||||
if( prim.primitive_id == AMP_CIRCLE && aText && *aText != '*' )
|
||||
{
|
||||
prim.params.push_back( AM_PARAM() );
|
||||
AM_PARAM& param = prim.params.back();
|
||||
param.ReadParam( aText );
|
||||
}
|
||||
|
||||
am.primitives.push_back( prim );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue