diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 000cdbf41f..eb2c85f135 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -1000,6 +1000,31 @@ void GERBER_PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, } +void GERBER_PLOTTER::FilledCircle( const wxPoint& pos, int diametre, + EDA_DRAW_MODE_T tracemode, void* aData ) +{ + // A filled circle is a graphic item, not a pad. + // So it is drawn, not flashed. + GBR_METADATA *gbr_metadata = static_cast( aData ); + + if( gbr_metadata ) + formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); + + if( tracemode == FILLED ) + { + // Draw a circle of diameter = diametre/2 with a line thickness = radius, + // To create a filled circle + SetCurrentLineWidth( diametre/2, gbr_metadata ); + Circle( pos, diametre/2, NO_FILL, DO_NOT_SET_LINE_WIDTH ); + } + else + { + SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, gbr_metadata ); + Circle( pos, diametre, NO_FILL, DO_NOT_SET_LINE_WIDTH ); + } +} + + void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode, void* aData ) { wxSize size( diametre, diametre ); diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp index b15256238a..4bd5fd69de 100644 --- a/common/plotters/plotter.cpp +++ b/common/plotters/plotter.cpp @@ -578,6 +578,19 @@ void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, } +void PLOTTER::FilledCircle( const wxPoint& pos, int diametre, + EDA_DRAW_MODE_T tracemode, void* aData ) +{ + if( tracemode == FILLED ) + Circle( pos, diametre, FILLED_SHAPE, 0 ); + else + { + SetCurrentLineWidth( -1 ); + Circle( pos, diametre, NO_FILL, -1 ); + } +} + + void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill, int aWidth, void * aData ) { diff --git a/common/plotters/plotter_gerber.h b/common/plotters/plotter_gerber.h index bece1713d5..240e542667 100644 --- a/common/plotters/plotter_gerber.h +++ b/common/plotters/plotter_gerber.h @@ -67,6 +67,8 @@ public: // Currently, aScale and aMirror are not used in gerber plotter virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil, double aScale, bool aMirror ) override; + + // Basic plot primitives virtual void Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width = USE_DEFAULT_LINE_WIDTH ) override; virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, @@ -74,6 +76,7 @@ public: virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override; + // These functions plot an item and manage X2 gerber attributes virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width, EDA_DRAW_MODE_T tracemode, void* aData ) override; @@ -83,6 +86,9 @@ public: EDA_DRAW_MODE_T tracemode, void* aData ) override; virtual void ThickCircle( const wxPoint& pos, int diametre, int width, EDA_DRAW_MODE_T tracemode, void* aData ) override; + virtual void FilledCircle( const wxPoint& pos, int diametre, + EDA_DRAW_MODE_T tracemode, void* aData ) override; + /** * Gerber polygon: they can (and *should*) be filled with the * appropriate G36/G37 sequence diff --git a/include/plotter.h b/include/plotter.h index 97fe9a530b..b3f54115a1 100644 --- a/include/plotter.h +++ b/include/plotter.h @@ -321,6 +321,9 @@ public: EDA_DRAW_MODE_T tracemode, void* aData ); virtual void ThickCircle( const wxPoint& pos, int diametre, int width, EDA_DRAW_MODE_T tracemode, void* aData ); + virtual void FilledCircle( const wxPoint& pos, int diametre, + EDA_DRAW_MODE_T tracemode, void* aData ); + // Flash primitives diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index a9f8a0c1a6..8a8aa78b4e 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -578,7 +578,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape ) if( aShape->GetWidth() > 0 ) m_plotter->ThickCircle( pos, radius * 2, thickness, GetPlotMode(), &gbr_metadata ); else - m_plotter->Circle( pos, radius * 2, FILLED_SHAPE, -1 ); + m_plotter->FilledCircle( pos, radius * 2, GetPlotMode(), &gbr_metadata ); break; @@ -859,7 +859,11 @@ void BRDITEMS_PLOTTER::PlotPcbShape( PCB_SHAPE* aShape ) case S_CIRCLE: radius = KiROUND( GetLineLength( end, start ) ); - m_plotter->ThickCircle( start, radius * 2, thickness, GetPlotMode(), &gbr_metadata ); + + if( thickness > 0 ) + m_plotter->ThickCircle( start, radius * 2, thickness, GetPlotMode(), &gbr_metadata ); + else + m_plotter->FilledCircle( start, radius * 2, GetPlotMode(), &gbr_metadata ); break; case S_ARC: