Loading gerbview/rs274d.cpp +233 −212 Original line number Diff line number Diff line Loading @@ -1388,9 +1388,30 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, } break; case AMP_EOF: case AMP_OUTLINE: #if defined(DEBUG) { int numPoints = (int) p->params[1].GetValue( tool ); printf( "AMP_OUTLINE:\n" ); printf( " exposure: %g\n", p->params[0].GetValue( tool ) ); printf( " # points: %d\n", numPoints ); // numPoints does not include the starting point, so add 1. for( int i=0; i<numPoints+1; ++i ) { printf( " [%d]: X=%g Y=%g\n", i, p->params[i*2+2+0].GetValue( tool ), p->params[i*2+2+1].GetValue( tool ) ); } printf( " rotation: %g\n", p->params[numPoints*2+4].GetValue( tool ) ); } #endif break; case AMP_POLYGON: case AMP_EOF: default: // not yet supported, waiting for you. Loading gerbview/rs274x.cpp +33 −11 Original line number Diff line number Diff line Loading @@ -535,6 +535,26 @@ bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file ) } static bool CheckForLineEnd( char buff[GERBER_BUFZ], char*& text, FILE* fp ) { while( *text == '\n' || !*text ) { if( *text == '\n' ) ++text; if( !*text ) { if( fgets( buff, GERBER_BUFZ, fp ) == NULL ) return false; text = buff; } } return true; } bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file ) Loading Loading @@ -563,15 +583,8 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], if( *text == '*' ) ++text; if( *text == '\n' ) ++text; if( !*text ) { text = buff; if( fgets( buff, GERBER_BUFZ, gerber_file ) == NULL ) if( !CheckForLineEnd( buff, text, gerber_file ) ) return false; } if( *text == '%' ) break; // exit with text still pointing at % Loading Loading @@ -625,12 +638,15 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], } int i; for( i = 0; i < paramCount && *text && *text != '*'; ++i ) for( i = 0; i < paramCount && *text != '*'; ++i ) { prim.params.push_back( DCODE_PARAM() ); DCODE_PARAM& param = prim.params.back(); if( !CheckForLineEnd( buff, text, gerber_file ) ) return false; if( *text == '$' ) { ++text; Loading @@ -647,18 +663,24 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], // there are more parameters to read if this is an AMP_OUTLINE if( prim.primitive_id == AMP_OUTLINE ) { // so far we have read [0]:exposure, [1]:#points, [2]:X start, [3]: Y start // Now read all the points, plus trailing rotation in degrees. // params[1] is a count of polygon points, so it must be given // in advance, i.e. be immediate. wxASSERT( prim.params[1].IsImmediate() ); paramCount = (int) prim.params[1].GetValue( 0 ) * 2 + 1; for( int i = 0; i < paramCount && *text && *text != '*'; ++i ) for( int i = 0; i < paramCount && *text != '*'; ++i ) { prim.params.push_back( DCODE_PARAM() ); DCODE_PARAM& param = prim.params.back(); if( !CheckForLineEnd( buff, text, gerber_file ) ) return false; if( *text == '$' ) { ++text; Loading Loading
gerbview/rs274d.cpp +233 −212 Original line number Diff line number Diff line Loading @@ -1388,9 +1388,30 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, } break; case AMP_EOF: case AMP_OUTLINE: #if defined(DEBUG) { int numPoints = (int) p->params[1].GetValue( tool ); printf( "AMP_OUTLINE:\n" ); printf( " exposure: %g\n", p->params[0].GetValue( tool ) ); printf( " # points: %d\n", numPoints ); // numPoints does not include the starting point, so add 1. for( int i=0; i<numPoints+1; ++i ) { printf( " [%d]: X=%g Y=%g\n", i, p->params[i*2+2+0].GetValue( tool ), p->params[i*2+2+1].GetValue( tool ) ); } printf( " rotation: %g\n", p->params[numPoints*2+4].GetValue( tool ) ); } #endif break; case AMP_POLYGON: case AMP_EOF: default: // not yet supported, waiting for you. Loading
gerbview/rs274x.cpp +33 −11 Original line number Diff line number Diff line Loading @@ -535,6 +535,26 @@ bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file ) } static bool CheckForLineEnd( char buff[GERBER_BUFZ], char*& text, FILE* fp ) { while( *text == '\n' || !*text ) { if( *text == '\n' ) ++text; if( !*text ) { if( fgets( buff, GERBER_BUFZ, fp ) == NULL ) return false; text = buff; } } return true; } bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file ) Loading Loading @@ -563,15 +583,8 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], if( *text == '*' ) ++text; if( *text == '\n' ) ++text; if( !*text ) { text = buff; if( fgets( buff, GERBER_BUFZ, gerber_file ) == NULL ) if( !CheckForLineEnd( buff, text, gerber_file ) ) return false; } if( *text == '%' ) break; // exit with text still pointing at % Loading Loading @@ -625,12 +638,15 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], } int i; for( i = 0; i < paramCount && *text && *text != '*'; ++i ) for( i = 0; i < paramCount && *text != '*'; ++i ) { prim.params.push_back( DCODE_PARAM() ); DCODE_PARAM& param = prim.params.back(); if( !CheckForLineEnd( buff, text, gerber_file ) ) return false; if( *text == '$' ) { ++text; Loading @@ -647,18 +663,24 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], // there are more parameters to read if this is an AMP_OUTLINE if( prim.primitive_id == AMP_OUTLINE ) { // so far we have read [0]:exposure, [1]:#points, [2]:X start, [3]: Y start // Now read all the points, plus trailing rotation in degrees. // params[1] is a count of polygon points, so it must be given // in advance, i.e. be immediate. wxASSERT( prim.params[1].IsImmediate() ); paramCount = (int) prim.params[1].GetValue( 0 ) * 2 + 1; for( int i = 0; i < paramCount && *text && *text != '*'; ++i ) for( int i = 0; i < paramCount && *text != '*'; ++i ) { prim.params.push_back( DCODE_PARAM() ); DCODE_PARAM& param = prim.params.back(); if( !CheckForLineEnd( buff, text, gerber_file ) ) return false; if( *text == '$' ) { ++text; Loading