Proposed to always use mm as the default DXF export unit. ref #745.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-08-10 16:50:10 +03:00
parent 7fd93eff5b
commit d91f32be02
2 changed files with 3 additions and 36 deletions

View File

@ -1015,23 +1015,7 @@ void MainWindowsNoGUI::FlatDxfFile(const QString &name, int version, bool binary
generator.setResolution(PrintDPI); generator.setResolution(PrintDPI);
generator.SetVersion(static_cast<DRW::Version>(version)); generator.SetVersion(static_cast<DRW::Version>(version));
generator.SetBinaryFormat(binary); generator.SetBinaryFormat(binary);
generator.setInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745
switch (*pattern->GetPatternUnit())
{
case Unit::Cm:
generator.setInsunits(VarInsunits::Centimeters);
break;
case Unit::Mm:
generator.setInsunits(VarInsunits::Millimeters);
break;
case Unit::Inch:
generator.setInsunits(VarInsunits::Inches);
break;
case Unit::Px:
case Unit::LAST_UNIT_DO_NOT_USE:
Q_UNREACHABLE();
break;
}
QPainter painter; QPainter painter;
if (painter.begin(&generator)) if (painter.begin(&generator))
@ -1052,24 +1036,7 @@ void MainWindowsNoGUI::AAMADxfFile(const QString &name, int version, bool binary
generator.setResolution(PrintDPI); generator.setResolution(PrintDPI);
generator.SetVersion(static_cast<DRW::Version>(version)); generator.SetVersion(static_cast<DRW::Version>(version));
generator.SetBinaryFormat(binary); generator.SetBinaryFormat(binary);
generator.setInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745
switch (*pattern->GetPatternUnit())
{
case Unit::Cm:
generator.setInsunits(VarInsunits::Centimeters);
break;
case Unit::Mm:
generator.setInsunits(VarInsunits::Millimeters);
break;
case Unit::Inch:
generator.setInsunits(VarInsunits::Inches);
break;
case Unit::Px:
case Unit::LAST_UNIT_DO_NOT_USE:
Q_UNREACHABLE();
break;
}
generator.ExportToAAMA(details); generator.ExportToAAMA(details);
} }

View File

@ -81,7 +81,7 @@ VDxfEngine::VDxfEngine()
matrix(), matrix(),
input(), input(),
varMeasurement(VarMeasurement::Metric), varMeasurement(VarMeasurement::Metric),
varInsunits(VarInsunits::Centimeters), varInsunits(VarInsunits::Millimeters),
textBuffer(new DRW_Text()) textBuffer(new DRW_Text())
{ {
} }