Loading pcbnew/specctra_export.cpp +122 −106 Original line number Original line Diff line number Diff line Loading @@ -855,6 +855,38 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia ) } } /** * Function makeCircle * does a line segmented circle into aPath. */ static void makeCircle( PATH* aPath, DRAWSEGMENT* aGraphic ) { // do a circle segmentation const int STEPS = 2 * 36; wxPoint start; wxPoint center = aGraphic->GetCenter(); int radius = aGraphic->GetRadius(); double angle = 3600.0; start = center; start.x += radius; wxPoint nextPt; for( int step = 0; step<STEPS; ++step ) { double rotation = ( angle * step ) / STEPS; nextPt = start; RotatePoint( &nextPt.x, &nextPt.y, center.x, center.y, rotation ); aPath->AppendPoint( mapPt( nextPt ) ); } } void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ERROR ) void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ERROR ) { { TYPE_COLLECTOR items; TYPE_COLLECTOR items; Loading Loading @@ -948,10 +980,18 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER break; break; case S_CIRCLE: case S_CIRCLE: // Freerouter does not understand circles. { // This might be a mounting hole or something, ignore it without error wxPoint pt = graphic->GetCenter(); // because some of our demo boards have used the edges pcb layer to // hold islanded circles, rather than simply using holes. // pt has minimum x point pt.x -= graphic->GetRadius(); if( pt.x < xmin.x ) { xmin = pt; xmini = i; } } break; break; default: default: Loading @@ -974,6 +1014,17 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER // The first DRAWSEGMENT is in 'graphic', ok to remove it from 'items' // The first DRAWSEGMENT is in 'graphic', ok to remove it from 'items' items.Remove( xmini ); items.Remove( xmini ); // Set maximum proximity threshold for point to point nearness metric for // board perimeter only, not interior keepouts yet. prox = Mils2iu( 0 ); // Output the Edge.Cuts perimeter as circle or polygon. if( graphic->GetShape() == S_CIRCLE ) { makeCircle( path, graphic ); } else { wxPoint startPt = wxPoint( graphic->GetEnd() ); wxPoint startPt = wxPoint( graphic->GetEnd() ); prevPt = graphic->GetEnd(); prevPt = graphic->GetEnd(); Loading @@ -982,11 +1033,6 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER // Do not append the other end point yet of this 'graphic', this first // Do not append the other end point yet of this 'graphic', this first // 'graphic' might be an arc. // 'graphic' might be an arc. // Set maximum proximity threshold for point to point nearness metric for // board perimeter only, not interior keepouts yet. prox = Mils2iu( 0 ); // Output the Edge.Cuts perimeter polygon. for(;;) for(;;) { { switch( graphic->GetShape() ) switch( graphic->GetShape() ) Loading Loading @@ -1048,15 +1094,6 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER } } break; break; case S_CIRCLE: // Freerouter does not understand circles. And although we can mimic // a circle for it by line segments, we'd have to ensure that the circle // was the only graphic on the board's edge. @todo that. // // Tell user his board has a problem, this is better than silently // ignoring the error. // fall thru here to report the error. default: default: { { wxString error = wxString::Format( _( "Unsupported DRAWSEGMENT type %s" ), wxString error = wxString::Format( _( "Unsupported DRAWSEGMENT type %s" ), Loading @@ -1082,6 +1119,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER ThrowIOError( error ); ThrowIOError( error ); } } } } } // Output the interior Edge.Cuts graphics as keepouts, using nearness metric // Output the interior Edge.Cuts graphics as keepouts, using nearness metric // for sloppy graphical items. // for sloppy graphical items. Loading @@ -1101,29 +1139,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER if( graphic->GetShape() == S_CIRCLE ) if( graphic->GetShape() == S_CIRCLE ) { { // do a circle segmentation makeCircle( poly_ko, graphic ); const int STEPS = 36; wxPoint start; wxPoint center = graphic->GetCenter(); int radius = graphic->GetRadius(); double angle = 3600.0; start = center; start.x += radius; wxPoint nextPt; for( int step = 0; step<STEPS; ++step ) { double rotation = ( angle * step ) / STEPS; nextPt = start; RotatePoint( &nextPt.x, &nextPt.y, center.x, center.y, rotation ); poly_ko->AppendPoint( mapPt( nextPt ) ); } } } else else { { Loading Loading
pcbnew/specctra_export.cpp +122 −106 Original line number Original line Diff line number Diff line Loading @@ -855,6 +855,38 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia ) } } /** * Function makeCircle * does a line segmented circle into aPath. */ static void makeCircle( PATH* aPath, DRAWSEGMENT* aGraphic ) { // do a circle segmentation const int STEPS = 2 * 36; wxPoint start; wxPoint center = aGraphic->GetCenter(); int radius = aGraphic->GetRadius(); double angle = 3600.0; start = center; start.x += radius; wxPoint nextPt; for( int step = 0; step<STEPS; ++step ) { double rotation = ( angle * step ) / STEPS; nextPt = start; RotatePoint( &nextPt.x, &nextPt.y, center.x, center.y, rotation ); aPath->AppendPoint( mapPt( nextPt ) ); } } void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ERROR ) void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ERROR ) { { TYPE_COLLECTOR items; TYPE_COLLECTOR items; Loading Loading @@ -948,10 +980,18 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER break; break; case S_CIRCLE: case S_CIRCLE: // Freerouter does not understand circles. { // This might be a mounting hole or something, ignore it without error wxPoint pt = graphic->GetCenter(); // because some of our demo boards have used the edges pcb layer to // hold islanded circles, rather than simply using holes. // pt has minimum x point pt.x -= graphic->GetRadius(); if( pt.x < xmin.x ) { xmin = pt; xmini = i; } } break; break; default: default: Loading @@ -974,6 +1014,17 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER // The first DRAWSEGMENT is in 'graphic', ok to remove it from 'items' // The first DRAWSEGMENT is in 'graphic', ok to remove it from 'items' items.Remove( xmini ); items.Remove( xmini ); // Set maximum proximity threshold for point to point nearness metric for // board perimeter only, not interior keepouts yet. prox = Mils2iu( 0 ); // Output the Edge.Cuts perimeter as circle or polygon. if( graphic->GetShape() == S_CIRCLE ) { makeCircle( path, graphic ); } else { wxPoint startPt = wxPoint( graphic->GetEnd() ); wxPoint startPt = wxPoint( graphic->GetEnd() ); prevPt = graphic->GetEnd(); prevPt = graphic->GetEnd(); Loading @@ -982,11 +1033,6 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER // Do not append the other end point yet of this 'graphic', this first // Do not append the other end point yet of this 'graphic', this first // 'graphic' might be an arc. // 'graphic' might be an arc. // Set maximum proximity threshold for point to point nearness metric for // board perimeter only, not interior keepouts yet. prox = Mils2iu( 0 ); // Output the Edge.Cuts perimeter polygon. for(;;) for(;;) { { switch( graphic->GetShape() ) switch( graphic->GetShape() ) Loading Loading @@ -1048,15 +1094,6 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER } } break; break; case S_CIRCLE: // Freerouter does not understand circles. And although we can mimic // a circle for it by line segments, we'd have to ensure that the circle // was the only graphic on the board's edge. @todo that. // // Tell user his board has a problem, this is better than silently // ignoring the error. // fall thru here to report the error. default: default: { { wxString error = wxString::Format( _( "Unsupported DRAWSEGMENT type %s" ), wxString error = wxString::Format( _( "Unsupported DRAWSEGMENT type %s" ), Loading @@ -1082,6 +1119,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER ThrowIOError( error ); ThrowIOError( error ); } } } } } // Output the interior Edge.Cuts graphics as keepouts, using nearness metric // Output the interior Edge.Cuts graphics as keepouts, using nearness metric // for sloppy graphical items. // for sloppy graphical items. Loading @@ -1101,29 +1139,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER if( graphic->GetShape() == S_CIRCLE ) if( graphic->GetShape() == S_CIRCLE ) { { // do a circle segmentation makeCircle( poly_ko, graphic ); const int STEPS = 36; wxPoint start; wxPoint center = graphic->GetCenter(); int radius = graphic->GetRadius(); double angle = 3600.0; start = center; start.x += radius; wxPoint nextPt; for( int step = 0; step<STEPS; ++step ) { double rotation = ( angle * step ) / STEPS; nextPt = start; RotatePoint( &nextPt.x, &nextPt.y, center.x, center.y, rotation ); poly_ko->AppendPoint( mapPt( nextPt ) ); } } } else else { { Loading