Pcbnew: add option to plot DXF lines in outline mode

Add option to plot dialog to plot DXF layers *.Cu, *.Adhes, *.Paste, and
*.Mask in outline mode or line mode.

Fixes lp:1643330

https://bugs.launchpad.net/kicad/+bug/1643330
This commit is contained in:
Eldar Khayrullin 2017-04-22 23:15:08 +03:00 committed by Wayne Stambaugh
parent 4e8a35cb84
commit bfacf02360
8 changed files with 137 additions and 19 deletions

View File

@ -424,7 +424,7 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
// Now, output the final polygon to DXF file:
last = path.PointCount() - 1;
VECTOR2I point = path.CPoint( 0 );
VECTOR2I point = path.CPoint( 0 );
wxPoint startPoint( point.x, point.y );
MoveTo( startPoint );
@ -480,7 +480,8 @@ void DXF_PLOTTER::SetDash( bool dashed )
void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
EDA_DRAW_MODE_T aPlotMode )
{
segmentAsOval( aStart, aEnd, aWidth, aPlotMode );
MoveTo( aStart );
FinishTo( aEnd );
}
/* Plot an arc in DXF format

View File

@ -194,6 +194,9 @@ void DIALOG_PLOT::Init_Dialog()
// Plot mode
setPlotModeChoiceSelection( m_plotOpts.GetPlotMode() );
// Plot outline mode
m_plotOutlineModeOpt->SetValue( m_plotOpts.GetPlotOutlineMode() );
// Plot mirror option
m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
@ -362,6 +365,8 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( false );
setPlotModeChoiceSelection( FILLED );
m_plotOutlineModeOpt->Enable( false );
m_plotOutlineModeOpt->SetValue( false );
m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false );
@ -392,6 +397,8 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
case PLOT_FORMAT_POST:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotOutlineModeOpt->Enable( false );
m_plotOutlineModeOpt->SetValue( false );
m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false );
@ -422,6 +429,8 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
m_drillShapeOpt->SetSelection( 0 );
m_plotModeOpt->Enable( false );
setPlotModeChoiceSelection( FILLED );
m_plotOutlineModeOpt->Enable( false );
m_plotOutlineModeOpt->SetValue( false );
m_plotMirrorOpt->Enable( false );
m_plotMirrorOpt->SetValue( false );
m_useAuxOriginCheckBox->Enable( true );
@ -450,6 +459,8 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
case PLOT_FORMAT_HPGL:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( true );
m_plotOutlineModeOpt->Enable( false );
m_plotOutlineModeOpt->SetValue( false );
m_plotMirrorOpt->Enable( true );
m_useAuxOriginCheckBox->Enable( false );
m_useAuxOriginCheckBox->SetValue( false );
@ -479,6 +490,8 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
case PLOT_FORMAT_DXF:
m_drillShapeOpt->Enable( true );
m_plotModeOpt->Enable( false );
setPlotModeChoiceSelection( FILLED );
m_plotOutlineModeOpt->Enable( true );
m_plotMirrorOpt->Enable( false );
m_plotMirrorOpt->SetValue( false );
m_useAuxOriginCheckBox->Enable( true );
@ -578,6 +591,7 @@ void DIALOG_PLOT::applyPlotSettings()
( m_drillShapeOpt->GetSelection() ) );
tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
tempOptions.SetPlotOutlineMode( m_plotOutlineModeOpt->GetValue() );
tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
// Update settings from text fields. Rewrite values back to the fields,

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Dec 21 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -47,7 +47,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer29 = new wxBoxSizer( wxHORIZONTAL );
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outputDirectoryName->SetMaxLength( 0 );
m_outputDirectoryName->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the board file location.") );
bSizer29->Add( m_outputDirectoryName, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
@ -128,6 +127,12 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizerPlotItems->Add( m_useAuxOriginCheckBox, 0, wxALL, 2 );
m_plotOutlineModeOpt = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Plot lines in outline mode"), wxDefaultPosition, wxDefaultSize, 0 );
m_plotOutlineModeOpt->SetValue(true);
m_plotOutlineModeOpt->SetToolTip( _("Otherwise plot with sketch lines in layers that don't support polygons (*.SilkS, *_User, Edge.Cuts, Margin, *.CrtYd, *.Fab) and plot in outline mode in other layers (*.Cu, *.Adhes, *.Paste, *.Mask)") );
bSizerPlotItems->Add( m_plotOutlineModeOpt, 0, wxALL, 2 );
bSizer192->Add( bSizerPlotItems, 0, wxEXPAND, 5 );
@ -171,7 +176,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer14->Add( m_textDefaultPenSize, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_linesWidth = new wxTextCtrl( sbOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_linesWidth->SetMaxLength( 0 );
m_linesWidth->SetToolTip( _("Line width for, e.g., sheet references.") );
bSizer14->Add( m_linesWidth, 0, wxBOTTOM|wxEXPAND|wxLEFT, 5 );
@ -266,7 +270,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer20->Add( m_textPenSize, 0, wxRIGHT|wxLEFT, 5 );
m_HPGLPenSizeOpt = new wxTextCtrl( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_HPGLPenSizeOpt->SetMaxLength( 0 );
bSizer20->Add( m_HPGLPenSizeOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -280,7 +283,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer21->Add( m_textPenOvr, 0, wxRIGHT|wxLEFT, 5 );
m_HPGLPenOverlayOpt = new wxTextCtrl( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_HPGLPenOverlayOpt->SetMaxLength( 0 );
m_HPGLPenOverlayOpt->SetToolTip( _("Set plot overlay for filling") );
bSizer21->Add( m_HPGLPenOverlayOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
@ -307,7 +309,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer18->Add( m_staticText7, 0, wxRIGHT|wxLEFT, 5 );
m_fineAdjustXscaleOpt = new wxTextCtrl( m_PSOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fineAdjustXscaleOpt->SetMaxLength( 0 );
m_fineAdjustXscaleOpt->SetToolTip( _("Set global X scale adjust for exact scale postscript output.") );
bSizer18->Add( m_fineAdjustXscaleOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -323,7 +324,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer19->Add( m_staticText8, 0, wxRIGHT|wxLEFT, 5 );
m_fineAdjustYscaleOpt = new wxTextCtrl( m_PSOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fineAdjustYscaleOpt->SetMaxLength( 0 );
m_fineAdjustYscaleOpt->SetToolTip( _("Set global Y scale adjust for exact scale postscript output.") );
bSizer19->Add( m_fineAdjustYscaleOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -339,7 +339,6 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer191->Add( m_textPSFineAdjustWidth, 0, wxRIGHT|wxLEFT, 5 );
m_PSFineAdjustWidthOpt = new wxTextCtrl( m_PSOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PSFineAdjustWidthOpt->SetMaxLength( 0 );
m_PSFineAdjustWidthOpt->SetToolTip( _("Set global width correction for exact width postscript output.\nThese width correction is intended to compensate tracks width and also pads and vias size errors.\nThe reasonable width correction value must be in a range of [-(MinTrackWidth-1), +(MinClearanceValue-1)] in decimils.") );
bSizer191->Add( m_PSFineAdjustWidthOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );

View File

@ -44,7 +44,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_PLOT_BASE</property>
<property name="pos"></property>
<property name="size">566,711</property>
<property name="size">733,808</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Plot</property>
@ -88,7 +88,7 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">m_MainSizer</property>
<property name="orient">wxVERTICAL</property>
@ -589,6 +589,7 @@
<property name="minimum_size"></property>
<property name="name">m_LayersSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -701,6 +702,7 @@
<property name="minimum_size"></property>
<property name="name">sbOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
@ -1601,6 +1603,94 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">2</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Plot lines in outline mode</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_plotOutlineModeOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Otherwise plot with sketch lines in layers that don&apos;t support polygons (*.SilkS, *_User, Edge.Cuts, Margin, *.CrtYd, *.Fab) and plot in outline mode in other layers (*.Cu, *.Adhes, *.Paste, *.Mask)</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
@ -2315,6 +2405,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerSoldMaskLayerOpt</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -2679,6 +2770,7 @@
<property name="minimum_size"></property>
<property name="name">m_GerberOptionsSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -3058,6 +3150,7 @@
<property name="minimum_size"></property>
<property name="name">m_HPGLOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -3453,6 +3546,7 @@
<property name="minimum_size"></property>
<property name="name">m_PSOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -4115,7 +4209,7 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
@ -4206,7 +4300,7 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Dec 21 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -78,6 +78,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxCheckBox* m_plotMirrorOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxCheckBox* m_useAuxOriginCheckBox;
wxCheckBox* m_plotOutlineModeOpt;
wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12;
@ -129,7 +130,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
public:
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 566,711 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 733,808 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
void DIALOG_PLOT_BASEOnContextMenu( wxMouseEvent &event )

View File

@ -90,6 +90,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() :
m_plotFrameRef = false;
m_plotViaOnMaskLayer = false;
m_plotMode = FILLED;
m_plotOutlineMode = true;
m_useAuxOrigin = false;
m_HPGLPenNum = 1;
m_HPGLPenSpeed = 20; // this param is always in cm/s
@ -239,6 +240,8 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
return false;
if( m_plotMode != aPcbPlotParams.m_plotMode )
return false;
if( m_plotOutlineMode != aPcbPlotParams.m_plotOutlineMode )
return false;
if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
return false;
if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )

View File

@ -54,6 +54,9 @@ private:
*/
EDA_DRAW_MODE_T m_plotMode;
/// Plot lines in outline mode
bool m_plotOutlineMode;
/// Plot format type (chooses the driver to be used)
PlotFormat m_format;
@ -182,6 +185,9 @@ public:
void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; }
EDA_DRAW_MODE_T GetPlotMode() const { return m_plotMode; }
void SetPlotOutlineMode( bool aFlag ) { m_plotOutlineMode = aFlag; }
bool GetPlotOutlineMode() const { return m_plotOutlineMode; }
void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; }
DrillMarksType GetDrillMarksType() const { return m_drillMarks; }

View File

@ -214,7 +214,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer,
case F_SilkS:
case B_SilkS:
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF )
if ( plotOpt.GetPlotOutlineMode() )
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
else
PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt );
@ -255,7 +255,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer,
plotOpt.SetSkipPlotNPTH_Pads( false );
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF )
if ( plotOpt.GetPlotOutlineMode() )
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
else
PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt );
@ -265,7 +265,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer,
plotOpt.SetSkipPlotNPTH_Pads( false );
plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
if( plotOpt.GetFormat() == PLOT_FORMAT_DXF )
if ( plotOpt.GetPlotOutlineMode() )
PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt );
else
PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt );