From b924c85f808fec7c9d11a8038c2aeff4c2e3c9ec Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Tue, 22 Jun 2021 07:34:15 -0400 Subject: [PATCH] Start recording the precision of dxf imports --- pcbnew/import_gfx/dxf_import_plugin.cpp | 14 ++++++++++++++ pcbnew/import_gfx/dxf_import_plugin.h | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pcbnew/import_gfx/dxf_import_plugin.cpp b/pcbnew/import_gfx/dxf_import_plugin.cpp index 50d67c0956..feb5999fed 100644 --- a/pcbnew/import_gfx/dxf_import_plugin.cpp +++ b/pcbnew/import_gfx/dxf_import_plugin.cpp @@ -99,6 +99,8 @@ DXF_IMPORT_PLUGIN::DXF_IMPORT_PLUGIN() : DL_CreationAdapter() m_minX = m_minY = std::numeric_limits::max(); m_maxX = m_maxY = std::numeric_limits::min(); m_currentUnit = DXF_IMPORT_UNITS::DEFAULT; + m_importCoordinatePrecision = 4; // initial value per dxf spec + m_importAnglePrecision = 0; // initial value per dxf spec // placeholder layer so we can fallback to something later std::unique_ptr layer0 = @@ -943,6 +945,18 @@ void DXF_IMPORT_PLUGIN::setVariableInt( const std::string& key, int value, int c return; } + if( key == "$AUPREC" ) + { + m_importAnglePrecision = value; + return; + } + + if( key == "$LUPREC" ) + { + m_importCoordinatePrecision = value; + return; + } + if( key == "$INSUNITS" ) // Drawing units { switch( value ) diff --git a/pcbnew/import_gfx/dxf_import_plugin.h b/pcbnew/import_gfx/dxf_import_plugin.h index fcca4ae5df..a01cf088c4 100644 --- a/pcbnew/import_gfx/dxf_import_plugin.h +++ b/pcbnew/import_gfx/dxf_import_plugin.h @@ -558,7 +558,9 @@ private: double m_minX, m_maxX; // handles image size in mm double m_minY, m_maxY; // handles image size in mm - DXF_IMPORT_UNITS m_currentUnit; // current unit during import + DXF_IMPORT_UNITS m_currentUnit; // current unit during import + int m_importCoordinatePrecision; // current precision for linear units (points) + int m_importAnglePrecision; // current precision for angles GRAPHICS_IMPORTER_BUFFER m_internalImporter;