Add support of AP macro for chamfered round rect pads.

This commit is contained in:
jean-pierre charras 2020-10-11 12:53:45 +02:00
parent 558f4b4b51
commit 34f47b3806
2 changed files with 56 additions and 2 deletions

View File

@ -44,6 +44,7 @@
// Note also: setting m_gerberDisableApertMacros to true disable all aperture macros
// in Gerber files
//
#define GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT
#define GBR_USE_MACROS_FOR_CHAMFERED_RECT
#define GBR_USE_MACROS_FOR_ROUNDRECT
#define GBR_USE_MACROS_FOR_TRAPEZOID
@ -678,6 +679,34 @@ void GERBER_PLOTTER::writeApertureList()
end.x * fscale, -end.y * fscale ); // X,Y cornerend pos
}
break;
case APERTURE::AM_FREE_POLYGON:
{
// Write aperture header
fprintf( outputFile, "%%%s%d*\n", "AMFp", tool.m_DCode );
fprintf( outputFile, "4,1,%d,", (int)tool.m_Corners.size() );
for( size_t ii = 0; ii <= tool.m_Corners.size(); ii++ )
{
int jj = ii;
if( ii >= tool.m_Corners.size() )
jj = 0;
fprintf( outputFile, "%#f,%#f,",
tool.m_Corners[jj].x * fscale, -tool.m_Corners[jj].y * fscale );
}
// output rotation parameter
fputs( "$1*%\n", outputFile );
// Create specialized macro
sprintf( cbuf, "%s%d,", "Fp", tool.m_DCode );
buffer += cbuf;
// close outline and output rotation
sprintf( cbuf, "%#f*%%\n", tool.m_Rotation );
}
break;
}
buffer += cbuf;
@ -1451,8 +1480,31 @@ void GERBER_PLOTTER::FlashPadChamferRoundRect( const wxPoint& aShapePos, const w
if( aPlotMode == SKETCH )
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
else // round rect shapes shapes are plot as region (a AP Macro is not obvious)
else
{
#ifdef GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT
if( m_gerberDisableApertMacros )
PlotGerberRegion( cornerList, &gbr_metadata );
else
{
// An AM will be created. the shape must be in position 0,0 and orientation 0
// to be able to reuse the same AM for pads having the same shape
for( size_t ii = 0; ii < cornerList.size(); ii++ )
{
cornerList[ii] -= aShapePos;
RotatePoint( &cornerList[ii], -aPadOrient );
}
selectAperture( cornerList, aPadOrient/10.0,
APERTURE::AM_FREE_POLYGON, gbr_metadata.GetApertureAttrib() );
formatNetAttribute( &gbr_metadata.m_NetlistMetadata );
emitDcode( pos_dev, 3 );
}
#else
PlotGerberRegion( cornerList, &gbr_metadata );
#endif
}
return;
}

View File

@ -67,8 +67,10 @@ public:
APER_MACRO_OUTLINE6P, // Aperture macro for pad polygons with 6 corners (chamfered pads)
APER_MACRO_OUTLINE7P, // Aperture macro for pad polygons with 7 corners (chamfered pads)
APER_MACRO_OUTLINE8P, // Aperture macro for pad polygons with 8 corners (chamfered pads)
AM_ROTATED_OVAL // Aperture macro for rotated oval pads
AM_ROTATED_OVAL, // Aperture macro for rotated oval pads
// (not rotated uses a primitive)
AM_FREE_POLYGON // Aperture macro to create on the fly a free polygon, with
// only one parameter: rotation
};
void SetSize( const wxSize& aSize )