Gerber plotter: Non horiz or vertical oval pads: better plot output:

These pads were plotted as a segment. This is not the right way.
Pads must be flashed or plotted as regions, not painted.
They are now plotted as Gerber regions round rectangle pads.
These regions are similar to flashed pads.
This commit is contained in:
jean-pierre charras 2020-03-27 09:56:07 +01:00
parent e46e2e4e79
commit de7154e8e9
1 changed files with 21 additions and 26 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -794,33 +794,28 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
else // Plot pad as region. else // Plot pad as region.
// Only regions and flashed items accept a object attribute TO.P for the pin name // Only regions and flashed items accept a object attribute TO.P for the pin name
{ {
if( size.x > size.y )
{
std::swap( size.x, size.y );
if( orient < 2700 )
orient += 900;
else
orient -= 2700;
}
if( trace_mode == FILLED ) if( trace_mode == FILLED )
{ {
// TODO: use an aperture macro to declare the rotated pad // Draw the oval as round rect pad with a radius = 50% min size)
// to be able to flash the shape // In gerber file, it will be drawn as a region with arcs, and can be
// For now, the pad is drawn as thick segment (painted with only one segment) // detected as pads (similar to a flashed pad)
FlashPadRoundRect( pos, aSize, std::min( aSize.x, aSize.y ) /2,
// The pad is reduced to an segment with dy > dx orient, FILLED, aData );
int delta = size.y - size.x;
wxPoint p0( 0, -delta / 2 );
wxPoint p1( 0, delta / 2 );
RotatePoint( &p0.x, &p0.y, orient );
RotatePoint( &p1.x, &p1.y, orient );
ThickSegment( pos + p0, pos + p1, size.x, trace_mode, gbr_metadata );
} }
else else // Non filled shape: plot outlines:
{
if( size.x > size.y )
{
std::swap( size.x, size.y );
if( orient < 2700 )
orient += 900;
else
orient -= 2700;
}
sketchOval( pos, size, orient, -1 ); sketchOval( pos, size, orient, -1 );
}
} }
} }
@ -869,7 +864,7 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
break; break;
default: // plot pad shape as Gerber region default: // plot pad shape as Gerber region
{ {
wxPoint coord[4]; wxPoint coord[4];
// coord[0] is assumed the lower left // coord[0] is assumed the lower left
// coord[1] is assumed the upper left // coord[1] is assumed the upper left
@ -886,7 +881,7 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
coord[3].y = size.y/2; coord[3].y = size.y/2;
FlashPadTrapez( pos, coord, orient, trace_mode, aData ); FlashPadTrapez( pos, coord, orient, trace_mode, aData );
} }
break; break;
} }
} }