From 80f36ce264a58ee176dde1ad724caa482112b41f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 16 Feb 2018 14:25:38 +0000 Subject: [PATCH] Scale up number of segments per polygon for larger features. Also fixes a typo in the plot dialog. --- pcbnew/board_items_to_polygon_shape_transform.cpp | 15 +++++++++++++++ pcbnew/dialogs/dialog_plot_base.cpp | 2 +- pcbnew/dialogs/dialog_plot_base.fbp | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 4d5200e613..d4df42149f 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -33,6 +33,7 @@ #include #include +#include // for IU_PER_MM #include #include #include @@ -501,6 +502,20 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB // The full width of the lines to create: int linewidth = m_Width + (2 * aClearanceValue); + // The aCircleSegmentsCount parameter is intended for use with small features such as + // pads and vias. It can be way too coarse for larger draw items, such as silkscreen + // drawings, which use this routine for DXF-specific sketch-mode plotting. Scale the + // number of segments by the size of the circle/arc. + if( m_Shape == S_CIRCLE || m_Shape == S_ARC ) + { + double multiple = (double) GetRadius() / IU_PER_MM; + if( multiple > 1 ) + { + aCircleToSegmentsCount = int( aCircleToSegmentsCount * multiple ); + aCorrectionFactor = 1.0 / cos( M_PI / (aCircleToSegmentsCount * 2) ); + } + } + switch( m_Shape ) { case S_CIRCLE: diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index 26ca0af2a9..7b0c6a14a5 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -343,7 +343,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_SizerDXF_options = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("DXF options") ), wxVERTICAL ); - m_DXF_plotModeOpt = new wxCheckBox( m_SizerDXF_options->GetStaticBox(), wxID_ANY, _("Plot all layers in outline (polygon) mode"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DXF_plotModeOpt = new wxCheckBox( m_SizerDXF_options->GetStaticBox(), wxID_ANY, _("Plot all layers in outline (polygon) mode"), wxDefaultPosition, wxDefaultSize, 0 ); m_DXF_plotModeOpt->SetValue(true); m_DXF_plotModeOpt->SetToolTip( _("DXF only:\nCheck to plot all layers in polygon mode.\nUncheck to plot in sketch mode layers that don't support polygons (*.SilkS, *_User, Edge.Cuts, Margin, *.CrtYd, *.Fab)\nand plot in polygon mode other layers (*.Cu, *.Adhes, *.Paste, *.Mask)") ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index 38c04bf1d3..ef694bd6d6 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -4148,7 +4148,7 @@ 0 0 wxID_ANY - Plot all layers in outline (polygon) mode + Plot all layers in outline (polygon) mode 0