Plot pad outlines on Fab files: fix many issues.
Depending on plotter type and pad type, the plotted shapes were not always the outlines, but a outline inside the pad shape (due to legacy reasons). In many cases the plotted shape was in fact incorrect. (only noticeable for very small pads) Now the actual pad outlines are plotted without modification. Fixes #11484 https://gitlab.com/kicad/code/kicad/issues/11484
This commit is contained in:
parent
37aa42d1e3
commit
91dfa79a67
|
@ -1290,7 +1290,7 @@ void GERBER_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre, OUTLINE_
|
||||||
|
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
|
|
||||||
Circle( pos, diametre - m_currentPenWidth, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
|
Circle( pos, diametre, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1411,10 +1411,8 @@ void GERBER_PLOTTER::FlashPadRect( const VECTOR2I& pos, const VECTOR2I& aSize,
|
||||||
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
|
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
|
||||||
|
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
Rect( VECTOR2I( pos.x - ( size.x - GetCurrentLineWidth() ) / 2,
|
Rect( VECTOR2I( pos.x - ( size.x / 2 ), pos.y - (size.y / 2 ) ),
|
||||||
pos.y - (size.y - GetCurrentLineWidth()) / 2 ),
|
VECTOR2I( pos.x + ( size.x / 2 ), pos.y + (size.y / 2 ) ),
|
||||||
VECTOR2I( pos.x + ( size.x - GetCurrentLineWidth() ) / 2,
|
|
||||||
pos.y + (size.y - GetCurrentLineWidth()) / 2 ),
|
|
||||||
FILL_T::NO_FILL, GetCurrentLineWidth() );
|
FILL_T::NO_FILL, GetCurrentLineWidth() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1483,7 +1481,6 @@ void GERBER_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I&
|
||||||
0, 0, GetPlotterArcHighDef(), ERROR_INSIDE );
|
0, 0, GetPlotterArcHighDef(), ERROR_INSIDE );
|
||||||
|
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
|
||||||
outline.Inflate( -GetCurrentLineWidth()/2, 16 );
|
|
||||||
|
|
||||||
std::vector<VECTOR2I> cornerList;
|
std::vector<VECTOR2I> cornerList;
|
||||||
// TransformRoundRectToPolygon creates only one convex polygon
|
// TransformRoundRectToPolygon creates only one convex polygon
|
||||||
|
@ -1695,7 +1692,6 @@ void GERBER_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aS
|
||||||
if( aTraceMode != FILLED )
|
if( aTraceMode != FILLED )
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
|
||||||
polyshape.Inflate( -GetCurrentLineWidth()/2, 16 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<VECTOR2I> cornerList;
|
std::vector<VECTOR2I> cornerList;
|
||||||
|
|
|
@ -491,7 +491,7 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aF
|
||||||
m_current_item->content << hpgl_end_polygon_cmd; // Close, fill polygon and draw outlines
|
m_current_item->content << hpgl_end_polygon_cmd; // Close, fill polygon and draw outlines
|
||||||
m_current_item->pen_returns = true;
|
m_current_item->pen_returns = true;
|
||||||
}
|
}
|
||||||
else if( aWidth > 0 )
|
else if( aWidth != 0 )
|
||||||
{
|
{
|
||||||
// Plot only the polygon outline.
|
// Plot only the polygon outline.
|
||||||
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
||||||
|
@ -670,10 +670,10 @@ void HPGL_PLOTTER::FlashPadCircle( const VECTOR2I& pos, int diametre,
|
||||||
// if filled mode, the pen diameter is removed from diameter
|
// if filled mode, the pen diameter is removed from diameter
|
||||||
// to keep the pad size
|
// to keep the pad size
|
||||||
radius -= KiROUND( penDiameter ) / 2;
|
radius -= KiROUND( penDiameter ) / 2;
|
||||||
}
|
|
||||||
|
|
||||||
if( radius < 0 )
|
if( radius < 0 )
|
||||||
radius = 0;
|
radius = 0;
|
||||||
|
}
|
||||||
|
|
||||||
double rsize = userToDeviceSize( radius );
|
double rsize = userToDeviceSize( radius );
|
||||||
|
|
||||||
|
|
|
@ -127,13 +127,7 @@ void PSLIKE_PLOTTER::FlashPadCircle( const VECTOR2I& aPadPos, int aDiameter,
|
||||||
else // Plot a ring:
|
else // Plot a ring:
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
int linewidth = GetCurrentLineWidth();
|
Circle( aPadPos, aDiameter, FILL_T::NO_FILL, GetCurrentLineWidth() );
|
||||||
|
|
||||||
// avoid aDiameter <= 1 )
|
|
||||||
if( linewidth > aDiameter-2 )
|
|
||||||
linewidth = aDiameter-2;
|
|
||||||
|
|
||||||
Circle( aPadPos, aDiameter - linewidth, FILL_T::NO_FILL, linewidth );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
|
@ -153,15 +147,6 @@ void PSLIKE_PLOTTER::FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSiz
|
||||||
else
|
else
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
|
|
||||||
size.x -= GetCurrentLineWidth();
|
|
||||||
size.y -= GetCurrentLineWidth();
|
|
||||||
|
|
||||||
if( size.x < 1 )
|
|
||||||
size.x = 1;
|
|
||||||
|
|
||||||
if( size.y < 1 )
|
|
||||||
size.y = 1;
|
|
||||||
|
|
||||||
int dx = size.x / 2;
|
int dx = size.x / 2;
|
||||||
int dy = size.y / 2;
|
int dy = size.y / 2;
|
||||||
|
|
||||||
|
@ -202,8 +187,6 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const VECTOR2I& aPadPos, const VECTOR2I&
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
size.x -= GetCurrentLineWidth();
|
|
||||||
size.y -= GetCurrentLineWidth();
|
|
||||||
aCornerRadius -= GetCurrentLineWidth() / 2;
|
aCornerRadius -= GetCurrentLineWidth() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,8 +225,6 @@ void PSLIKE_PLOTTER::FlashPadCustom( const VECTOR2I& aPadPos, const VECTOR2I& aS
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
size.x -= GetCurrentLineWidth();
|
|
||||||
size.y -= GetCurrentLineWidth();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -283,23 +264,6 @@ void PSLIKE_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aC
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||||
int w = GetCurrentLineWidth();
|
|
||||||
|
|
||||||
// offset polygon by w
|
|
||||||
// coord[0] is assumed the lower left
|
|
||||||
// coord[1] is assumed the upper left
|
|
||||||
// coord[2] is assumed the upper right
|
|
||||||
// coord[3] is assumed the lower right
|
|
||||||
|
|
||||||
/* Trace the outline. */
|
|
||||||
cornerList[0].x += w;
|
|
||||||
cornerList[0].y -= w;
|
|
||||||
cornerList[1].x += w;
|
|
||||||
cornerList[1].y += w;
|
|
||||||
cornerList[2].x -= w;
|
|
||||||
cornerList[2].y += w;
|
|
||||||
cornerList[3].x -= w;
|
|
||||||
cornerList[3].y -= w;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int ii = 0; ii < 4; ii++ )
|
for( int ii = 0; ii < 4; ii++ )
|
||||||
|
|
|
@ -549,7 +549,7 @@ void PLOTTER::sketchOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA
|
||||||
}
|
}
|
||||||
|
|
||||||
int deltaxy = size.y - size.x; /* distance between centers of the oval */
|
int deltaxy = size.y - size.x; /* distance between centers of the oval */
|
||||||
int radius = ( size.x - m_currentPenWidth ) / 2;
|
int radius = size.x / 2;
|
||||||
|
|
||||||
pt.x = -radius;
|
pt.x = -radius;
|
||||||
pt.y = -deltaxy / 2;
|
pt.y = -deltaxy / 2;
|
||||||
|
|
Loading…
Reference in New Issue