Plot Gerber format: ensure all attributes are added to polygon items.

Especially, TA.AperFunction,EtchedComponent for net tie footprints using polygons.
This commit is contained in:
jean-pierre charras
2023-02-25 19:06:46 +01:00
parent 4b427b2d0c
commit ece34e1a0c
3 changed files with 70 additions and 24 deletions
+22 -12
View File
@@ -902,18 +902,16 @@ void GERBER_PLOTTER::plotArc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAn
}
void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, void* aData )
void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, GBR_METADATA* aGbrMetadata )
{
if( aPoly.PointCount() <= 2 )
return;
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
if( gbr_metadata )
if( aGbrMetadata )
{
std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
std::string attrib = aGbrMetadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
if( !attrib.empty() )
{
@@ -922,7 +920,7 @@ void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, void* aDat
}
}
PlotPoly( aPoly, FILL_T::FILLED_SHAPE, 0 , gbr_metadata );
PlotPoly( aPoly, FILL_T::FILLED_SHAPE, 0 , aGbrMetadata );
// Clear the TA attribute, to avoid the next item to inherit it:
if( clearTA_AperFunction )
@@ -939,18 +937,17 @@ void GERBER_PLOTTER::PlotGerberRegion( const SHAPE_LINE_CHAIN& aPoly, void* aDat
}
void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList, void* aData )
void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList,
GBR_METADATA* aGbrMetadata )
{
if( aCornerList.size() <= 2 )
return;
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
if( gbr_metadata )
if( aGbrMetadata )
{
std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
std::string attrib = aGbrMetadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
if( !attrib.empty() )
{
@@ -959,7 +956,7 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList,
}
}
PlotPoly( aCornerList, FILL_T::FILLED_SHAPE, 0, gbr_metadata );
PlotPoly( aCornerList, FILL_T::FILLED_SHAPE, 0, aGbrMetadata );
// Clear the TA attribute, to avoid the next item to inherit it:
if( clearTA_AperFunction )
@@ -976,6 +973,19 @@ void GERBER_PLOTTER::PlotGerberRegion( const std::vector<VECTOR2I>& aCornerList,
}
void GERBER_PLOTTER::PlotPolyAsRegion( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill,
int aWidth, GBR_METADATA* aGbrMetadata )
{
// plot a filled polygon using Gerber region, therefore adding X2 attributes
// to the solid polygon
if( aWidth )
PlotPoly( aPoly, FILL_T::NO_FILL, aWidth, aGbrMetadata );
if( aFill != FILL_T::NO_FILL )
PlotGerberRegion( aPoly, aGbrMetadata );
}
void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int aWidth,
void* aData )
{