← Back to team overview

kicad-developers team mailing list archive

[Patch] Units for DXF plotting output

 

The attached patch set allows the user to set the units of the exported DXF
in pcbnew (options are inches or millimeters).

It also cleans up the tooltip and name for the DXF outline plotting mode to
try to make it more understandable for users (see
https://bugs.launchpad.net/kicad/+bug/1832595 for the discussion that
prompted this. I changed it so the option for the box says: "Plot graphic
items using their contours" and the tooltip now says "Uncheck to plot
graphic items using their center lines"

The third patch makes the DXF plotter only output the BLACK layer if
monochrome is selected, since the other layers are empty because they
correspond to the other unused colors.

Seth/Wayne, can you give the exported DXFs a try? I have tested them using
LibreCAD and QCAD, but I don't have access to any commercial software right
now to see how they work.

-Ian
From c5f903e381c13da55677fa26a39163924deee830 Mon Sep 17 00:00:00 2001
From: Ian McInerney <Ian.S.McInerney@xxxxxxxx>
Date: Thu, 13 Jun 2019 17:45:24 +0100
Subject: [PATCH 3/3] Make DXF monochrome output only contain Black layer

Fixes: lp:1832359
* https://bugs.launchpad.net/kicad/+bug/1832359
---
 common/plotters/DXF_plotter.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp
index 3981a16b7..222389a86 100644
--- a/common/plotters/DXF_plotter.cpp
+++ b/common/plotters/DXF_plotter.cpp
@@ -330,6 +330,11 @@ bool DXF_PLOTTER::StartPlot()
                  style_name[i], i < 2 ? 0 : DXF_OBLIQUE_ANGLE );
     }
 
+    EDA_COLOR_T numLayers = NBCOLORS;
+
+    // If printing in monochrome, only output the black layer
+    if( !GetColorMode() )
+        numLayers = static_cast<EDA_COLOR_T>( 1 );
 
     // Layer table - one layer per color
     fprintf( outputFile,
@@ -340,7 +345,7 @@ bool DXF_PLOTTER::StartPlot()
              "  2\n"
              "LAYER\n"
              "  70\n"
-             "%d\n", NBCOLORS );
+             "%d\n", numLayers );
 
     /* The layer/colors palette. The acad/DXF palette is divided in 3 zones:
 
@@ -349,7 +354,7 @@ bool DXF_PLOTTER::StartPlot()
        - Greys (251 - 255)
      */
 
-    for( EDA_COLOR_T i = BLACK; i < NBCOLORS; i = NextColor(i) )
+    for( EDA_COLOR_T i = BLACK; i < numLayers; i = NextColor(i) )
     {
         fprintf( outputFile,
                  "  0\n"
-- 
2.17.2

From 29cd4c8f7f40cf387628a427b480faf96baebd36 Mon Sep 17 00:00:00 2001
From: Ian McInerney <Ian.S.McInerney@xxxxxxxx>
Date: Thu, 13 Jun 2019 01:28:22 +0100
Subject: [PATCH 2/3] Allow DXF to be exported in either inches or millimeters

Fixes: lp:1832188
* https://bugs.launchpad.net/kicad/+bug/1832188
---
 common/plotters/DXF_plotter.cpp | 245 +++++++++++++++++---------------
 include/plotter.h               |  51 +++++++
 pcbnew/dialogs/dialog_plot.cpp  |   2 +
 pcbnew/pcb_plot_params.cpp      |   5 +-
 pcbnew/pcb_plot_params.h        |  22 +++
 pcbnew/plot_board_layers.cpp    |   6 +-
 6 files changed, 217 insertions(+), 114 deletions(-)

diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp
index d125746a2..3981a16b7 100644
--- a/common/plotters/DXF_plotter.cpp
+++ b/common/plotters/DXF_plotter.cpp
@@ -121,6 +121,26 @@ static wxString getDXFColorName( COLOR4D aColor )
     return cname;
 }
 
+
+void DXF_PLOTTER::SetUnits( Units aUnit )
+{
+    m_plotUnits = aUnit;
+
+    switch( aUnit )
+    {
+    case MILIMETERS:
+        m_unitScalingFactor = 0.00254;
+        m_measurementDirective = 1;
+        break;
+
+    case INCHES:
+    default:
+        m_unitScalingFactor = 0.0001;
+        m_measurementDirective = 0;
+    }
+}
+
+
 /**
  * Set the scale/position for the DXF plot
  * The DXF engine doesn't support line widths and mirroring. The output
@@ -143,7 +163,7 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
      * english units */
     m_IUsPerDecimil = aIusPerDecimil;
     iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
-    iuPerDeviceUnit *= 0.0001;              // ... now in inches
+    iuPerDeviceUnit *= GetUnitScaling();    // Get the scaling factor for the current units
 
     SetDefaultLineWidth( 0 );               // No line width on DXF
     m_plotMirror = false;                   // No mirroring on DXF
@@ -160,117 +180,118 @@ bool DXF_PLOTTER::StartPlot()
     // DXF HEADER - Boilerplate
     // Defines the minimum for drawing i.e. the angle system and the
     // 4 linetypes (CONTINUOUS, DOTDASH, DASHED and DOTTED)
-    fputs( "  0\n"
-           "SECTION\n"
-           "  2\n"
-           "HEADER\n"
-           "  9\n"
-           "$ANGBASE\n"
-           "  50\n"
-           "0.0\n"
-           "  9\n"
-           "$ANGDIR\n"
-           "  70\n"
-           "  1\n"
-           "  9\n"
-           "$MEASUREMENT\n"
-           "  70\n"
-           "0\n"
-           "  0\n"              // This means 'english units'
-           "ENDSEC\n"
-           "  0\n"
-           "SECTION\n"
-           "  2\n"
-           "TABLES\n"
-           "  0\n"
-           "TABLE\n"
-           "  2\n"
-           "LTYPE\n"
-           "  70\n"
-           "4\n"
-           "  0\n"
-           "LTYPE\n"
-           "  5\n"
-           "40F\n"
-           "  2\n"
-           "CONTINUOUS\n"
-           "  70\n"
-           "0\n"
-           "  3\n"
-           "Solid line\n"
-           "  72\n"
-           "65\n"
-           "  73\n"
-           "0\n"
-           "  40\n"
-           "0.0\n"
-           "  0\n"
-           "LTYPE\n"
-           "  5\n"
-           "410\n"
-           "  2\n"
-           "DASHDOT\n"
-           " 70\n"
-           "0\n"
-           "  3\n"
-           "Dash Dot ____ _ ____ _\n"
-           " 72\n"
-           "65\n"
-           " 73\n"
-           "4\n"
-           " 40\n"
-           "2.0\n"
-           " 49\n"
-           "1.25\n"
-           " 49\n"
-           "-0.25\n"
-           " 49\n"
-           "0.25\n"
-           " 49\n"
-           "-0.25\n"
-           "  0\n"
-           "LTYPE\n"
-           "  5\n"
-           "411\n"
-           "  2\n"
-           "DASHED\n"
-           " 70\n"
-           "0\n"
-           "  3\n"
-           "Dashed __ __ __ __ __\n"
-           " 72\n"
-           "65\n"
-           " 73\n"
-           "2\n"
-           " 40\n"
-           "0.75\n"
-           " 49\n"
-           "0.5\n"
-           " 49\n"
-           "-0.25\n"
-           "  0\n"
-           "LTYPE\n"
-           "  5\n"
-           "43B\n"
-           "  2\n"
-           "DOTTED\n"
-           " 70\n"
-           "0\n"
-           "  3\n"
-           "Dotted .  .  .  .\n"
-           " 72\n"
-           "65\n"
-           " 73\n"
-           "2\n"
-           " 40\n"
-           "0.2\n"
-           " 49\n"
-           "0.0\n"
-           " 49\n"
-           "-0.2\n"
-           "  0\n"
-           "ENDTAB\n",
-            outputFile );
+    fprintf( outputFile,
+            "  0\n"
+            "SECTION\n"
+            "  2\n"
+            "HEADER\n"
+            "  9\n"
+            "$ANGBASE\n"
+            "  50\n"
+            "0.0\n"
+            "  9\n"
+            "$ANGDIR\n"
+            "  70\n"
+            "1\n"
+            "  9\n"
+            "$MEASUREMENT\n"
+            "  70\n"
+            "%u\n"
+            "  0\n"
+            "ENDSEC\n"
+            "  0\n"
+            "SECTION\n"
+            "  2\n"
+            "TABLES\n"
+            "  0\n"
+            "TABLE\n"
+            "  2\n"
+            "LTYPE\n"
+            "  70\n"
+            "4\n"
+            "  0\n"
+            "LTYPE\n"
+            "  5\n"
+            "40F\n"
+            "  2\n"
+            "CONTINUOUS\n"
+            "  70\n"
+            "0\n"
+            "  3\n"
+            "Solid line\n"
+            "  72\n"
+            "65\n"
+            "  73\n"
+            "0\n"
+            "  40\n"
+            "0.0\n"
+            "  0\n"
+            "LTYPE\n"
+            "  5\n"
+            "410\n"
+            "  2\n"
+            "DASHDOT\n"
+            " 70\n"
+            "0\n"
+            "  3\n"
+            "Dash Dot ____ _ ____ _\n"
+            " 72\n"
+            "65\n"
+            " 73\n"
+            "4\n"
+            " 40\n"
+            "2.0\n"
+            " 49\n"
+            "1.25\n"
+            " 49\n"
+            "-0.25\n"
+            " 49\n"
+            "0.25\n"
+            " 49\n"
+            "-0.25\n"
+            "  0\n"
+            "LTYPE\n"
+            "  5\n"
+            "411\n"
+            "  2\n"
+            "DASHED\n"
+            " 70\n"
+            "0\n"
+            "  3\n"
+            "Dashed __ __ __ __ __\n"
+            " 72\n"
+            "65\n"
+            " 73\n"
+            "2\n"
+            " 40\n"
+            "0.75\n"
+            " 49\n"
+            "0.5\n"
+            " 49\n"
+            "-0.25\n"
+            "  0\n"
+            "LTYPE\n"
+            "  5\n"
+            "43B\n"
+            "  2\n"
+            "DOTTED\n"
+            " 70\n"
+            "0\n"
+            "  3\n"
+            "Dotted .  .  .  .\n"
+            " 72\n"
+            "65\n"
+            " 73\n"
+            "2\n"
+            " 40\n"
+            "0.2\n"
+            " 49\n"
+            "0.0\n"
+            " 49\n"
+            "-0.2\n"
+            "  0\n"
+            "ENDTAB\n",
+            GetMeasurementDirective() );
 
     // Text styles table
     // Defines 4 text styles, one for each bold/italic combination
diff --git a/include/plotter.h b/include/plotter.h
index 46353d58c..ac0658786 100644
--- a/include/plotter.h
+++ b/include/plotter.h
@@ -1256,6 +1256,7 @@ public:
         textAsLines = true;
         m_currentColor = COLOR4D::BLACK;
         m_currentLineType = 0;
+        SetUnits( DXF_PLOTTER::INCHES );
     }
 
     virtual PlotFormat GetPlotterType() const override
@@ -1338,10 +1339,60 @@ public:
                        bool                        aMultilineAllowed = false,
                        void* aData = NULL ) override;
 
+
+    // Should be the same order as in the PCB_PLOT_PARAMS class
+    enum Units
+    {
+        INCHES = 0,
+        MILIMETERS = 1
+    };
+
+    /**
+     * Set the units to use for plotting the DXF file.
+     *
+     * @param aUnit - The units to use
+     */
+    void SetUnits( Units aUnit );
+
+    /**
+     * The units currently enabled for plotting
+     *
+     * @return The currently configured units
+     */
+    Units GetUnits() const
+    {
+        return m_plotUnits;
+    }
+
+    /**
+     * Get the scale factor to apply to convert the device units to be in the
+     * currently set units.
+     *
+     * @return Scaling factor to apply for unit conversion
+     */
+    double GetUnitScaling() const
+    {
+        return m_unitScalingFactor;
+    }
+
+    /**
+     * Get the correct value for the $MEASUREMENT field given the current units
+     *
+     * @return the $MEASUREMENT directive field value
+     */
+    unsigned int GetMeasurementDirective() const
+    {
+        return m_measurementDirective;
+    }
+
 protected:
     bool textAsLines;
     COLOR4D m_currentColor;
     int m_currentLineType;
+
+    Units        m_plotUnits;
+    double       m_unitScalingFactor;
+    unsigned int m_measurementDirective;
 };
 
 class TITLE_BLOCK;
diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp
index 2daea0062..036f61bf7 100644
--- a/pcbnew/dialogs/dialog_plot.cpp
+++ b/pcbnew/dialogs/dialog_plot.cpp
@@ -572,6 +572,8 @@ void DIALOG_PLOT::applyPlotSettings()
     tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
     tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
     tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() );
+    tempOptions.SetDXFPlotUnits(
+            static_cast<PCB_PLOT_PARAMS::Units>( m_DXF_plotUnits->GetSelection() ) );
     tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
 
     if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() )     // Currently, only DXF supports this option
diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp
index 3d7856cf9..077935259 100644
--- a/pcbnew/pcb_plot_params.cpp
+++ b/pcbnew/pcb_plot_params.cpp
@@ -103,6 +103,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
     m_plotViaOnMaskLayer         = false;
     m_plotMode                   = FILLED;
     m_DXFplotPolygonMode         = true;
+    m_DXFplotUnits               = INCHES;
     m_useAuxOrigin               = false;
     m_HPGLPenNum                 = 1;
     m_HPGLPenSpeed               = 20;        // this param is always in cm/s
@@ -260,7 +261,9 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCom
     if( !aCompareOnlySavedPrms )
     {
         if( m_DXFplotPolygonMode != aPcbPlotParams.m_DXFplotPolygonMode )
-        return false;
+            return false;
+        if( m_DXFplotUnits != aPcbPlotParams.m_DXFplotUnits )
+            return false;
     }
     if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
         return false;
diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h
index f9ab3c21c..cd92a8081 100644
--- a/pcbnew/pcb_plot_params.h
+++ b/pcbnew/pcb_plot_params.h
@@ -44,6 +44,13 @@ public:
         FULL_DRILL_SHAPE  = 2
     };
 
+    // Must be in the same order as the drop-down list in the plot dialog
+    enum Units
+    {
+        INCHES = 0,
+        MILIMETERS = 1,
+    };
+
 private:
     // If true, do not plot NPTH pads
     // (mainly used to disable NPTH pads plotting on copper layers)
@@ -60,6 +67,11 @@ private:
      */
     bool        m_DXFplotPolygonMode;
 
+    /**
+     * DXF format: Units to use when plotting the DXF
+     */
+    Units       m_DXFplotUnits;
+
     /// Plot format type (chooses the driver to be used)
     PlotFormat  m_format;
 
@@ -196,6 +208,16 @@ public:
     void        SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
     bool        GetDXFPlotPolygonMode() const { return m_DXFplotPolygonMode; }
 
+    void SetDXFPlotUnits( Units aUnit )
+    {
+        m_DXFplotUnits = aUnit;
+    }
+
+    Units GetDXFPlotUnits() const
+    {
+        return m_DXFplotUnits;
+    }
+
     void        SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; }
     DrillMarksType GetDrillMarksType() const { return m_drillMarks; }
 
diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp
index 9cc071c34..488fc7d12 100644
--- a/pcbnew/plot_board_layers.cpp
+++ b/pcbnew/plot_board_layers.cpp
@@ -1058,7 +1058,11 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
     switch( aPlotOpts->GetFormat() )
     {
     case PLOT_FORMAT_DXF:
-        plotter = new DXF_PLOTTER();
+        DXF_PLOTTER* DXF_plotter;
+        DXF_plotter = new DXF_PLOTTER();
+        DXF_plotter->SetUnits( static_cast<DXF_PLOTTER::Units>( aPlotOpts->GetDXFPlotUnits() ) );
+
+        plotter = DXF_plotter;
         break;
 
     case PLOT_FORMAT_POST:
-- 
2.17.2

From adaeeecff1c2d433ee6c080e08b850a2da48010b Mon Sep 17 00:00:00 2001
From: Ian McInerney <Ian.S.McInerney@xxxxxxxx>
Date: Thu, 13 Jun 2019 01:17:47 +0100
Subject: [PATCH 1/3] pcbnew: Update plot dialog to contain a unit selector for
 DXF

---
 pcbnew/dialogs/dialog_plot_base.cpp |  24 ++++-
 pcbnew/dialogs/dialog_plot_base.fbp | 154 ++++++++++++++++++++++++++--
 pcbnew/dialogs/dialog_plot_base.h   |   4 +-
 3 files changed, 169 insertions(+), 13 deletions(-)

diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp
index d60ef19a8..7e14300cc 100644
--- a/pcbnew/dialogs/dialog_plot_base.cpp
+++ b/pcbnew/dialogs/dialog_plot_base.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Dec  1 2018)
+// C++ code generated with wxFormBuilder (version Oct 26 2018)
 // http://www.wxformbuilder.org/
 //
 // PLEASE DO *NOT* EDIT THIS FILE!
@@ -304,9 +304,9 @@ 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 graphic items using their contours"), 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)") );
+	m_DXF_plotModeOpt->SetToolTip( _("Uncheck to plot graphic items using their center lines") );
 
 	m_SizerDXF_options->Add( m_DXF_plotModeOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
 
@@ -315,6 +315,24 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
 
 	m_SizerDXF_options->Add( m_DXF_plotTextStrokeFontOpt, 0, wxALL, 5 );
 
+	wxBoxSizer* dxfSizer1;
+	dxfSizer1 = new wxBoxSizer( wxHORIZONTAL );
+
+	DXF_exportUnitsLabel = new wxStaticText( m_SizerDXF_options->GetStaticBox(), wxID_ANY, _("Export units:"), wxDefaultPosition, wxDefaultSize, 0 );
+	DXF_exportUnitsLabel->Wrap( -1 );
+	dxfSizer1->Add( DXF_exportUnitsLabel, 0, wxALIGN_CENTER|wxALIGN_LEFT|wxALL, 5 );
+
+	wxString m_DXF_plotUnitsChoices[] = { _("Inches"), _("Millimeters") };
+	int m_DXF_plotUnitsNChoices = sizeof( m_DXF_plotUnitsChoices ) / sizeof( wxString );
+	m_DXF_plotUnits = new wxChoice( m_SizerDXF_options->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_DXF_plotUnitsNChoices, m_DXF_plotUnitsChoices, 0 );
+	m_DXF_plotUnits->SetSelection( 0 );
+	m_DXF_plotUnits->SetToolTip( _("The units to use for the exported DXF file") );
+
+	dxfSizer1->Add( m_DXF_plotUnits, 0, wxALIGN_CENTER|wxALL, 5 );
+
+
+	m_SizerDXF_options->Add( dxfSizer1, 1, wxEXPAND, 5 );
+
 
 	m_PlotOptionsSizer->Add( m_SizerDXF_options, 0, wxEXPAND|wxALL, 5 );
 
diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp
index 1368bb541..cbbe0e962 100644
--- a/pcbnew/dialogs/dialog_plot_base.fbp
+++ b/pcbnew/dialogs/dialog_plot_base.fbp
@@ -1862,7 +1862,7 @@
                                     <property name="border">5</property>
                                     <property name="flag">wxALL|wxEXPAND</property>
                                     <property name="proportion">0</property>
-                                    <object class="wxStaticBoxSizer" expanded="0">
+                                    <object class="wxStaticBoxSizer" expanded="1">
                                         <property name="id">wxID_ANY</property>
                                         <property name="label">Gerber Options</property>
                                         <property name="minimum_size"></property>
@@ -1870,11 +1870,11 @@
                                         <property name="orient">wxHORIZONTAL</property>
                                         <property name="parent">1</property>
                                         <property name="permission">protected</property>
-                                        <object class="sizeritem" expanded="0">
+                                        <object class="sizeritem" expanded="1">
                                             <property name="border">5</property>
                                             <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
                                             <property name="proportion">1</property>
-                                            <object class="wxGridBagSizer" expanded="0">
+                                            <object class="wxGridBagSizer" expanded="1">
                                                 <property name="empty_cell_size"></property>
                                                 <property name="flexible_direction">wxHORIZONTAL</property>
                                                 <property name="growablecols">2</property>
@@ -2493,11 +2493,11 @@
                                                 <property name="window_style"></property>
                                             </object>
                                         </object>
-                                        <object class="sizeritem" expanded="1">
+                                        <object class="sizeritem" expanded="0">
                                             <property name="border">5</property>
                                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
                                             <property name="proportion">0</property>
-                                            <object class="wxStaticText" expanded="1">
+                                            <object class="wxStaticText" expanded="0">
                                                 <property name="BottomDockable">1</property>
                                                 <property name="LeftDockable">1</property>
                                                 <property name="RightDockable">1</property>
@@ -2554,11 +2554,11 @@
                                                 <property name="wrap">-1</property>
                                             </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">11</property>
-                                            <object class="spacer" expanded="1">
+                                            <object class="spacer" expanded="0">
                                                 <property name="height">0</property>
                                                 <property name="permission">protected</property>
                                                 <property name="width">0</property>
@@ -3163,7 +3163,7 @@
                                                 <property name="gripper">0</property>
                                                 <property name="hidden">0</property>
                                                 <property name="id">wxID_ANY</property>
-                                                <property name="label">Plot all layers in outline (polygon) mode</property>
+                                                <property name="label">Plot graphic items using their contours</property>
                                                 <property name="max_size"></property>
                                                 <property name="maximize_button">0</property>
                                                 <property name="maximum_size"></property>
@@ -3184,7 +3184,7 @@
                                                 <property name="style"></property>
                                                 <property name="subclass"></property>
                                                 <property name="toolbar_pane">0</property>
-                                                <property name="tooltip">DXF only:&#x0A;Check to plot all layers in polygon mode.&#x0A;Uncheck to plot in sketch mode layers that don&apos;t support polygons (*.SilkS, *_User, Edge.Cuts, Margin, *.CrtYd, *.Fab)&#x0A;and plot in polygon mode other layers (*.Cu, *.Adhes, *.Paste, *.Mask)</property>
+                                                <property name="tooltip">Uncheck to plot graphic items using their center lines</property>
                                                 <property name="validator_data_type"></property>
                                                 <property name="validator_style">wxFILTER_NONE</property>
                                                 <property name="validator_type">wxDefaultValidator</property>
@@ -3259,6 +3259,142 @@
                                                 <property name="window_style"></property>
                                             </object>
                                         </object>
+                                        <object class="sizeritem" expanded="1">
+                                            <property name="border">5</property>
+                                            <property name="flag">wxEXPAND</property>
+                                            <property name="proportion">1</property>
+                                            <object class="wxBoxSizer" expanded="1">
+                                                <property name="minimum_size"></property>
+                                                <property name="name">dxfSizer1</property>
+                                                <property name="orient">wxHORIZONTAL</property>
+                                                <property name="permission">none</property>
+                                                <object class="sizeritem" expanded="1">
+                                                    <property name="border">5</property>
+                                                    <property name="flag">wxALIGN_CENTER|wxALIGN_LEFT|wxALL</property>
+                                                    <property name="proportion">0</property>
+                                                    <object class="wxStaticText" expanded="1">
+                                                        <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="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">Export units:</property>
+                                                        <property name="markup">0</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">DXF_exportUnitsLabel</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">; ; forward_declare</property>
+                                                        <property name="toolbar_pane">0</property>
+                                                        <property name="tooltip"></property>
+                                                        <property name="window_extra_style"></property>
+                                                        <property name="window_name"></property>
+                                                        <property name="window_style"></property>
+                                                        <property name="wrap">-1</property>
+                                                    </object>
+                                                </object>
+                                                <object class="sizeritem" expanded="1">
+                                                    <property name="border">5</property>
+                                                    <property name="flag">wxALIGN_CENTER|wxALL</property>
+                                                    <property name="proportion">0</property>
+                                                    <object class="wxChoice" expanded="1">
+                                                        <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="choices">&quot;Inches&quot; &quot;Millimeters&quot;</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="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_DXF_plotUnits</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="selection">0</property>
+                                                        <property name="show">1</property>
+                                                        <property name="size"></property>
+                                                        <property name="style"></property>
+                                                        <property name="subclass">; ; forward_declare</property>
+                                                        <property name="toolbar_pane">0</property>
+                                                        <property name="tooltip">The units to use for the exported DXF file</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>
+                                                    </object>
+                                                </object>
+                                            </object>
+                                        </object>
                                     </object>
                                 </object>
                             </object>
diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h
index f4cf8b3bf..063d26352 100644
--- a/pcbnew/dialogs/dialog_plot_base.h
+++ b/pcbnew/dialogs/dialog_plot_base.h
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Dec  1 2018)
+// C++ code generated with wxFormBuilder (version Oct 26 2018)
 // http://www.wxformbuilder.org/
 //
 // PLEASE DO *NOT* EDIT THIS FILE!
@@ -110,6 +110,8 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
 		wxStaticBoxSizer* m_SizerDXF_options;
 		wxCheckBox* m_DXF_plotModeOpt;
 		wxCheckBox* m_DXF_plotTextStrokeFontOpt;
+		wxStaticText* DXF_exportUnitsLabel;
+		wxChoice* m_DXF_plotUnits;
 		WX_HTML_REPORT_PANEL* m_messagesPanel;
 		wxBoxSizer* m_sizerButtons;
 		wxButton* m_buttonDRC;
-- 
2.17.2


Follow ups