Improve compatibility with Richpeace CAD.

This commit is contained in:
Roman Telezhynskyi 2024-03-16 15:32:23 +02:00
parent 4d849163fb
commit 6ebd9e7033
29 changed files with 502 additions and 27 deletions

View File

@ -65,6 +65,7 @@
- Minimal Qt version increased to Qt 5.15. Minimal C++ standard to C++17. - Minimal Qt version increased to Qt 5.15. Minimal C++ standard to C++17.
- Updated Windows installer. - Updated Windows installer.
- Automatic crash reports. - Automatic crash reports.
- Improve compatibility with Richpeace CAD.
# Valentina 0.7.52 September 12, 2022 # Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru. - Fix crash when default locale is ru.

View File

@ -97,6 +97,20 @@ The path to output destination folder. By default the directory at which the app
.RE .RE
.IP "--bdxf" .IP "--bdxf"
.RB "Export dxf in binary form." .RB "Export dxf in binary form."
.IP "--dxfApparelComp <Mode number>"
.RB "Number corresponding to compatibility mode for DXF AAMA/ASTM format (default = 0, " "export mode" "):
.RS
.BR "*" " By standard = 0,"
.RE
.RS
.BR "*" " Richpeace CAD V8 = 1,"
.RE
.RS
.BR "*" " Richpeace CAD V9 = 2,"
.RE
.RS
.BR "*" " Richpeace CAD V10 = 3."
.RE
.IP "--noGrainline" .IP "--noGrainline"
.RB "Show/hide grainline when export layout." .RB "Show/hide grainline when export layout."
.IP "--text2paths" .IP "--text2paths"

View File

@ -97,6 +97,20 @@ The path to output destination folder. By default the directory at which the app
.RE .RE
.IP "--bdxf" .IP "--bdxf"
.RB "Export dxf in binary form." .RB "Export dxf in binary form."
.IP "--dxfApparelComp <Mode number>"
.RB "Number corresponding to compatibility mode for DXF AAMA/ASTM format (default = 0, " "export mode" "):
.RS
.BR "*" " By standard = 0,"
.RE
.RS
.BR "*" " Richpeace CAD V8 = 1,"
.RE
.RS
.BR "*" " Richpeace CAD V9 = 2,"
.RE
.RS
.BR "*" " Richpeace CAD V10 = 3."
.RE
.IP "--noGrainline" .IP "--noGrainline"
.RB "Show/hide grainline when export layout." .RB "Show/hide grainline when export layout."
.IP "--text2paths" .IP "--text2paths"

View File

@ -111,6 +111,8 @@ DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExpo
// RemoveFormatFromList(LayoutExportFormats::NC); // No support for now // RemoveFormatFromList(LayoutExportFormats::NC); // No support for now
InitDxfCompatibility();
connect(bOk, &QPushButton::clicked, this, &DialogSaveManualLayout::Save); connect(bOk, &QPushButton::clicked, this, &DialogSaveManualLayout::Save);
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveManualLayout::ShowExample); connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveManualLayout::ShowExample);
connect(ui->comboBoxFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(ui->comboBoxFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
@ -224,6 +226,45 @@ auto DialogSaveManualLayout::IsBinaryDXFFormat() const -> bool
} }
} }
//---------------------------------------------------------------------------------------------------------------------
auto DialogSaveManualLayout::DxfCompatibility() const -> DXFApparelCompatibility
{
switch (Format())
{
case LayoutExportFormats::DXF_AAMA:
case LayoutExportFormats::DXF_ASTM:
return static_cast<DXFApparelCompatibility>(ui->comboBoxDxfCompatibility->currentData().toInt());
default:
return DXFApparelCompatibility::STANDARD;
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveManualLayout::SetDxfCompatibility(DXFApparelCompatibility type)
{
switch (Format())
{
case LayoutExportFormats::DXF_AAMA:
case LayoutExportFormats::DXF_ASTM:
{
if (static_cast<int>(type) < 0 || type >= DXFApparelCompatibility::COUNT)
{
break;
}
const int i = ui->comboBoxDxfCompatibility->findData(static_cast<int>(type));
if (i < 0)
{
break;
}
ui->comboBoxDxfCompatibility->setCurrentIndex(i);
break;
}
default:
break;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSaveManualLayout::SetShowGrainline(bool show) void DialogSaveManualLayout::SetShowGrainline(bool show)
{ {
@ -491,6 +532,8 @@ void DialogSaveManualLayout::ShowExample()
ui->checkBoxExportUnified->setVisible(false); ui->checkBoxExportUnified->setVisible(false);
ui->checkBoxTilesScheme->setVisible(false); ui->checkBoxTilesScheme->setVisible(false);
ui->checkBoxShowGrainline->setVisible(false); ui->checkBoxShowGrainline->setVisible(false);
ui->labelDxfCompatibility->setVisible(false);
ui->comboBoxDxfCompatibility->setVisible(false);
const bool editableTextAsPaths = !settings->GetSingleLineFonts() && !settings->GetSingleStrokeOutlineFont(); const bool editableTextAsPaths = !settings->GetSingleLineFonts() && !settings->GetSingleStrokeOutlineFont();
@ -499,6 +542,8 @@ void DialogSaveManualLayout::ShowExample()
case LayoutExportFormats::DXF_AAMA: case LayoutExportFormats::DXF_AAMA:
case LayoutExportFormats::DXF_ASTM: case LayoutExportFormats::DXF_ASTM:
ui->checkBoxBinaryDXF->setVisible(true); ui->checkBoxBinaryDXF->setVisible(true);
ui->labelDxfCompatibility->setVisible(true);
ui->comboBoxDxfCompatibility->setVisible(true);
break; break;
case LayoutExportFormats::PDFTiled: case LayoutExportFormats::PDFTiled:
ui->checkBoxTextAsPaths->setVisible(editableTextAsPaths); ui->checkBoxTextAsPaths->setVisible(editableTextAsPaths);
@ -616,6 +661,8 @@ void DialogSaveManualLayout::ReadSettings()
qDebug() << qUtf8Printable(e.ErrorMessage()); qDebug() << qUtf8Printable(e.ErrorMessage());
} }
SetShowGrainline(settings->GetShowGrainline()); SetShowGrainline(settings->GetShowGrainline());
SetDxfCompatibility(static_cast<DXFApparelCompatibility>(settings->GetDxfCompatibility()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -629,4 +676,19 @@ void DialogSaveManualLayout::WriteSettings() const
VPSettings *settings = VPApplication::VApp()->PuzzleSettings(); VPSettings *settings = VPApplication::VApp()->PuzzleSettings();
settings->SetLayoutExportFormat(static_cast<qint8>(Format())); settings->SetLayoutExportFormat(static_cast<qint8>(Format()));
settings->SetShowGrainline(IsShowGrainline()); settings->SetShowGrainline(IsShowGrainline());
settings->SetDxfCompatibility(static_cast<qint8>(DxfCompatibility()));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveManualLayout::InitDxfCompatibility()
{
ui->comboBoxDxfCompatibility->addItem(tr("By standard"),
QVariant(static_cast<int>(DXFApparelCompatibility::STANDARD)));
ui->comboBoxDxfCompatibility->addItem("Richpeace CAD V8"_L1,
QVariant(static_cast<int>(DXFApparelCompatibility::RPCADV08)));
ui->comboBoxDxfCompatibility->addItem("Richpeace CAD V9"_L1,
QVariant(static_cast<int>(DXFApparelCompatibility::RPCADV09)));
ui->comboBoxDxfCompatibility->addItem("Richpeace CAD V10"_L1,
QVariant(static_cast<int>(DXFApparelCompatibility::RPCADV10)));
} }

View File

@ -30,6 +30,7 @@
#include <memory> #include <memory>
#include "../vdxf/dxfdef.h"
#include "../vlayout/dialogs/vabstractlayoutdialog.h" #include "../vlayout/dialogs/vabstractlayoutdialog.h"
#include "../vlayout/vlayoutdef.h" #include "../vlayout/vlayoutdef.h"
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
@ -57,6 +58,9 @@ public:
void SetBinaryDXFFormat(bool binary); void SetBinaryDXFFormat(bool binary);
auto IsBinaryDXFFormat() const -> bool; auto IsBinaryDXFFormat() const -> bool;
auto DxfCompatibility() const -> DXFApparelCompatibility;
void SetDxfCompatibility(DXFApparelCompatibility type);
void SetShowGrainline(bool show); void SetShowGrainline(bool show);
auto IsShowGrainline() const -> bool; auto IsShowGrainline() const -> bool;
@ -95,6 +99,8 @@ private:
void ReadSettings(); void ReadSettings();
void WriteSettings() const; void WriteSettings() const;
void InitDxfCompatibility();
}; };
#endif // DIALOGSAVEMANUALLAYOUT_H #endif // DIALOGSAVEMANUALLAYOUT_H

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>390</width> <width>464</width>
<height>283</height> <height>287</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -111,7 +111,7 @@
<property name="title"> <property name="title">
<string>Options</string> <string>Options</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="labelOptionsNotAvailable"> <widget class="QLabel" name="labelOptionsNotAvailable">
<property name="text"> <property name="text">
@ -178,6 +178,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelDxfCompatibility">
<property name="text">
<string>Compatibility:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxDxfCompatibility"/>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@ -313,6 +313,7 @@ struct VPExportData
QString fileName{}; QString fileName{};
qreal xScale{1.}; qreal xScale{1.};
qreal yScale{1.}; qreal yScale{1.};
DXFApparelCompatibility dxfCompatibility{DXFApparelCompatibility::STANDARD};
bool isBinaryDXF{false}; bool isBinaryDXF{false};
bool textAsPaths{false}; bool textAsPaths{false};
bool exportUnified{true}; bool exportUnified{true};
@ -2323,10 +2324,12 @@ void VPMainWindow::ExportApparelLayout(const VPExportData &data, const QVector<V
{ {
case LayoutExportFormats::DXF_ASTM: case LayoutExportFormats::DXF_ASTM:
exporter.SetDxfVersion(DRW::AC1009); exporter.SetDxfVersion(DRW::AC1009);
exporter.SetDxfApparelCompatibility(data.dxfCompatibility);
exporter.ExportToASTMDXF(details); exporter.ExportToASTMDXF(details);
break; break;
case LayoutExportFormats::DXF_AAMA: case LayoutExportFormats::DXF_AAMA:
exporter.SetDxfVersion(DRW::AC1009); exporter.SetDxfVersion(DRW::AC1009);
exporter.SetDxfApparelCompatibility(data.dxfCompatibility);
exporter.ExportToAAMADXF(details); exporter.ExportToAAMADXF(details);
break; break;
case LayoutExportFormats::RLD: case LayoutExportFormats::RLD:
@ -4217,6 +4220,7 @@ void VPMainWindow::on_ExportLayout()
data.exportUnified = dialog.IsExportUnified(); data.exportUnified = dialog.IsExportUnified();
data.showTilesScheme = dialog.IsTilesScheme(); data.showTilesScheme = dialog.IsTilesScheme();
data.showGrainline = dialog.IsShowGrainline(); data.showGrainline = dialog.IsShowGrainline();
data.dxfCompatibility = dialog.DxfCompatibility();
ExportData(data); ExportData(data);
} }
@ -4268,6 +4272,7 @@ void VPMainWindow::on_ExportSheet()
data.exportUnified = dialog.IsExportUnified(); data.exportUnified = dialog.IsExportUnified();
data.showTilesScheme = dialog.IsTilesScheme(); data.showTilesScheme = dialog.IsTilesScheme();
data.showGrainline = dialog.IsShowGrainline(); data.showGrainline = dialog.IsShowGrainline();
data.dxfCompatibility = dialog.DxfCompatibility();
ExportData(data); ExportData(data);
} }

View File

@ -70,6 +70,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWarningPiecesOutOfBound, (
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, ("layout/followGrainline"_L1)) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, ("layout/followGrainline"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, ("layout/pieceGap"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, ("layout/pieceGap"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, ("layout/exportFormat"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, ("layout/exportFormat"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDxfCompatibility, ("layout/dxfCompatibility"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, ("layout/lineWidth"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, ("layout/lineWidth"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, ("layout/showGrainline"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, ("layout/showGrainline"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsRawLayoutData, ("paths/rawLatoutData"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsRawLayoutData, ("paths/rawLatoutData"_L1)) // NOLINT
@ -357,6 +358,18 @@ void VPSettings::SetLayoutExportFormat(qint8 format)
setValue(*settingLayoutExportFormat, format); setValue(*settingLayoutExportFormat, format);
} }
//---------------------------------------------------------------------------------------------------------------------
auto VPSettings::GetDxfCompatibility() const -> qint8
{
return CastToLayoutExportFormat(qvariant_cast<qint8>(value(*settingDxfCompatibility, 0)));
}
//---------------------------------------------------------------------------------------------------------------------
void VPSettings::SetDxfCompatibility(qint8 type)
{
setValue(*settingDxfCompatibility, type);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPSettings::GetLayoutLineWidth() const -> int auto VPSettings::GetLayoutLineWidth() const -> int
{ {

View File

@ -105,6 +105,9 @@ public:
auto GetLayoutExportFormat() const -> qint8; auto GetLayoutExportFormat() const -> qint8;
void SetLayoutExportFormat(qint8 format); void SetLayoutExportFormat(qint8 format);
auto GetDxfCompatibility() const -> qint8;
void SetDxfCompatibility(qint8 type);
auto GetLayoutLineWidth() const -> int; auto GetLayoutLineWidth() const -> int;
void SetLayoutLineWidth(int width); void SetLayoutLineWidth(int width);

View File

@ -322,6 +322,17 @@ auto VCommandLine::OptExportType() const -> int
return r; return r;
} }
//---------------------------------------------------------------------------------------------------------------------
int VCommandLine::DXFApparelCompatibilityType() const
{
int r = 0;
if (IsOptionSet(LONG_OPTION_DXF_APPAREL_COMP))
{
r = OptionValue(LONG_OPTION_DXF_APPAREL_COMP).toInt();
}
return r;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCommandLine::IsBinaryDXF() const -> bool auto VCommandLine::IsBinaryDXF() const -> bool
{ {
@ -631,6 +642,11 @@ void VCommandLine::InitCommandLineOptions()
translate("VCommandLine", "Format number"), translate("VCommandLine", "Format number"),
QChar('0')}, QChar('0')},
{LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form.")}, {LONG_OPTION_BINARYDXF, translate("VCommandLine", "Export dxf in binary form.")},
{LONG_OPTION_DXF_APPAREL_COMP,
translate("VCommandLine",
"Number corresponding to compatibility mode for DXF AAMA/ASTM format (default = 0, export mode):") +
DialogSaveLayout::MakeHelpDxfApparelCompatibilityList(),
translate("VCommandLine", "Mode number"), QChar('0')},
{LONG_OPTION_NOGRAINLINE, translate("VCommandLine", "Show/hide grainline when export layout.")}, {LONG_OPTION_NOGRAINLINE, translate("VCommandLine", "Show/hide grainline when export layout.")},
{LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths.")}, {LONG_OPTION_TEXT2PATHS, translate("VCommandLine", "Export text as paths.")},
{LONG_OPTION_EXPORTONLYDETAILS, {LONG_OPTION_EXPORTONLYDETAILS,

View File

@ -82,6 +82,8 @@ public:
//@brief returns export type set, defaults 0 - svg //@brief returns export type set, defaults 0 - svg
auto OptExportType() const -> int; auto OptExportType() const -> int;
auto DXFApparelCompatibilityType() const -> int;
auto IsBinaryDXF() const -> bool; auto IsBinaryDXF() const -> bool;
auto IsNoGrainline() const -> bool; auto IsNoGrainline() const -> bool;
auto IsTextAsPaths() const -> bool; auto IsTextAsPaths() const -> bool;

View File

@ -124,6 +124,8 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
RemoveFormatFromList(LayoutExportFormats::RLD); RemoveFormatFromList(LayoutExportFormats::RLD);
} }
InitDxfCompatibility();
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save); connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample); connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
connect(ui->comboBoxFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(ui->comboBoxFormat, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
@ -226,6 +228,45 @@ auto DialogSaveLayout::IsBinaryDXFFormat() const -> bool
} }
} }
//---------------------------------------------------------------------------------------------------------------------
auto DialogSaveLayout::DxfCompatibility() const -> DXFApparelCompatibility
{
switch (Format())
{
case LayoutExportFormats::DXF_AAMA:
case LayoutExportFormats::DXF_ASTM:
return static_cast<DXFApparelCompatibility>(ui->comboBoxDxfCompatibility->currentData().toInt());
default:
return DXFApparelCompatibility::STANDARD;
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::SetDxfCompatibility(DXFApparelCompatibility type)
{
switch (Format())
{
case LayoutExportFormats::DXF_AAMA:
case LayoutExportFormats::DXF_ASTM:
{
if (static_cast<int>(type) < 0 || type >= DXFApparelCompatibility::COUNT)
{
break;
}
const int i = ui->comboBoxDxfCompatibility->findData(static_cast<int>(type));
if (i < 0)
{
break;
}
ui->comboBoxDxfCompatibility->setCurrentIndex(i);
break;
}
default:
break;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::SetShowGrainline(bool show) void DialogSaveLayout::SetShowGrainline(bool show)
{ {
@ -293,8 +334,7 @@ auto DialogSaveLayout::MakeHelpFormatList() -> QString
const auto formats = InitFormats(); const auto formats = InitFormats();
for (int i = 0; i < formats.size(); ++i) for (int i = 0; i < formats.size(); ++i)
{ {
out += QStringLiteral("\t* ") + formats.at(i).first + QStringLiteral(" = ") + out += "\t* "_L1 + formats.at(i).first + " = "_L1 + QString::number(static_cast<int>(formats.at(i).second));
QString::number(static_cast<int>(formats.at(i).second));
if (i < formats.size() - 1) if (i < formats.size() - 1)
{ {
@ -308,6 +348,20 @@ auto DialogSaveLayout::MakeHelpFormatList() -> QString
return out; return out;
} }
//---------------------------------------------------------------------------------------------------------------------
auto DialogSaveLayout::MakeHelpDxfApparelCompatibilityList() -> QString
{
QString out("\n"_L1);
out += QStringLiteral("\t* %1 = %2,\n")
.arg(tr("By standard"))
.arg(static_cast<int>(DXFApparelCompatibility::STANDARD));
out += QStringLiteral("\t* Richpeace CAD V8 = %1,\n").arg(static_cast<int>(DXFApparelCompatibility::RPCADV08));
out += QStringLiteral("\t* Richpeace CAD V9 = %1,\n").arg(static_cast<int>(DXFApparelCompatibility::RPCADV09));
out += QStringLiteral("\t* Richpeace CAD V10 = %1.\n").arg(static_cast<int>(DXFApparelCompatibility::RPCADV10));
return out;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::SetDestinationPath(const QString &cmdDestinationPath) void DialogSaveLayout::SetDestinationPath(const QString &cmdDestinationPath)
{ {
@ -437,6 +491,8 @@ void DialogSaveLayout::ShowExample()
ui->checkBoxTextAsPaths->setEnabled(true); ui->checkBoxTextAsPaths->setEnabled(true);
ui->checkBoxShowGrainline->setVisible(false); ui->checkBoxShowGrainline->setVisible(false);
ui->checkBoxTogetherWithNotches->setVisible(false); ui->checkBoxTogetherWithNotches->setVisible(false);
ui->labelDxfCompatibility->setVisible(false);
ui->comboBoxDxfCompatibility->setVisible(false);
VCommonSettings *settings = VAbstractApplication::VApp()->Settings(); VCommonSettings *settings = VAbstractApplication::VApp()->Settings();
@ -446,6 +502,8 @@ void DialogSaveLayout::ShowExample()
case LayoutExportFormats::DXF_ASTM: case LayoutExportFormats::DXF_ASTM:
ui->checkBoxBinaryDXF->setVisible(true); ui->checkBoxBinaryDXF->setVisible(true);
ui->checkBoxTogetherWithNotches->setVisible(m_mode != Draw::Layout); ui->checkBoxTogetherWithNotches->setVisible(m_mode != Draw::Layout);
ui->labelDxfCompatibility->setVisible(true);
ui->comboBoxDxfCompatibility->setVisible(true);
break; break;
case LayoutExportFormats::PDFTiled: case LayoutExportFormats::PDFTiled:
ui->groupBoxPaperFormat->setEnabled(true); ui->groupBoxPaperFormat->setEnabled(true);
@ -808,6 +866,8 @@ void DialogSaveLayout::ReadSettings()
} }
SetShowGrainline(settings->GetShowGrainline()); SetShowGrainline(settings->GetShowGrainline());
} }
SetDxfCompatibility(static_cast<DXFApparelCompatibility>(settings->GetDxfCompatibility()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -856,4 +916,19 @@ void DialogSaveLayout::WriteSettings() const
settings->SetLayoutExportFormat(static_cast<qint8>(Format())); settings->SetLayoutExportFormat(static_cast<qint8>(Format()));
settings->SetShowGrainline(IsShowGrainline()); settings->SetShowGrainline(IsShowGrainline());
} }
settings->SetDxfCompatibility(static_cast<qint8>(DxfCompatibility()));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::InitDxfCompatibility()
{
ui->comboBoxDxfCompatibility->addItem(tr("By standard"),
QVariant(static_cast<int>(DXFApparelCompatibility::STANDARD)));
ui->comboBoxDxfCompatibility->addItem("Richpeace CAD V8"_L1,
QVariant(static_cast<int>(DXFApparelCompatibility::RPCADV08)));
ui->comboBoxDxfCompatibility->addItem("Richpeace CAD V9"_L1,
QVariant(static_cast<int>(DXFApparelCompatibility::RPCADV09)));
ui->comboBoxDxfCompatibility->addItem("Richpeace CAD V10"_L1,
QVariant(static_cast<int>(DXFApparelCompatibility::RPCADV10)));
} }

View File

@ -29,6 +29,7 @@
#ifndef DIALOGSAVELAYOUT_H #ifndef DIALOGSAVELAYOUT_H
#define DIALOGSAVELAYOUT_H #define DIALOGSAVELAYOUT_H
#include "../vdxf/dxfdef.h"
#include "../vlayout/dialogs/vabstractlayoutdialog.h" #include "../vlayout/dialogs/vabstractlayoutdialog.h"
#include "../vlayout/vlayoutdef.h" #include "../vlayout/vlayoutdef.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
@ -56,10 +57,15 @@ public:
void SetBinaryDXFFormat(bool binary); void SetBinaryDXFFormat(bool binary);
auto IsBinaryDXFFormat() const -> bool; auto IsBinaryDXFFormat() const -> bool;
auto DxfCompatibility() const -> DXFApparelCompatibility;
void SetDxfCompatibility(DXFApparelCompatibility type);
void SetShowGrainline(bool show); void SetShowGrainline(bool show);
auto IsShowGrainline() const -> bool; auto IsShowGrainline() const -> bool;
static auto MakeHelpFormatList() -> QString; static auto MakeHelpFormatList() -> QString;
static auto MakeHelpDxfApparelCompatibilityList() -> QString;
void SetDestinationPath(const QString &cmdDestinationPath); void SetDestinationPath(const QString &cmdDestinationPath);
auto Mode() const -> Draw; auto Mode() const -> Draw;
@ -117,6 +123,8 @@ private:
void ReadSettings(); void ReadSettings();
void WriteSettings() const; void WriteSettings() const;
void InitDxfCompatibility();
}; };
#endif // DIALOGSAVELAYOUT_H #endif // DIALOGSAVELAYOUT_H

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>544</width> <width>544</width>
<height>439</height> <height>472</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -149,6 +149,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="labelDxfCompatibility">
<property name="text">
<string>Compatibility:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxDxfCompatibility"/>
</item>
</layout>
</item>
<item> <item>
<widget class="QLabel" name="labelOptionsNotAvailable"> <widget class="QLabel" name="labelOptionsNotAvailable">
<property name="text"> <property name="text">

View File

@ -7227,6 +7227,8 @@ auto MainWindow::DoExport(const VCommandLinePtr &expParams) -> bool
m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath()); m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath());
m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType())); m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF()); m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF());
m_dialogSaveLayout->SetDxfCompatibility(
static_cast<DXFApparelCompatibility>(expParams->DXFApparelCompatibilityType()));
m_dialogSaveLayout->SetShowGrainline(!expParams->IsNoGrainline()); m_dialogSaveLayout->SetShowGrainline(!expParams->IsNoGrainline());
m_dialogSaveLayout->SetTextAsPaths(expParams->IsTextAsPaths()); m_dialogSaveLayout->SetTextAsPaths(expParams->IsTextAsPaths());
m_dialogSaveLayout->SetXScale(expParams->ExportXScale()); m_dialogSaveLayout->SetXScale(expParams->ExportXScale());
@ -7266,6 +7268,8 @@ auto MainWindow::DoExport(const VCommandLinePtr &expParams) -> bool
m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath()); m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath());
m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType())); m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF()); m_dialogSaveLayout->SetBinaryDXFFormat(expParams->IsBinaryDXF());
m_dialogSaveLayout->SetDxfCompatibility(
static_cast<DXFApparelCompatibility>(expParams->DXFApparelCompatibilityType()));
m_dialogSaveLayout->SetShowGrainline(!expParams->IsNoGrainline()); m_dialogSaveLayout->SetShowGrainline(!expParams->IsNoGrainline());
m_dialogSaveLayout->SetXScale(expParams->ExportXScale()); m_dialogSaveLayout->SetXScale(expParams->ExportXScale());
m_dialogSaveLayout->SetYScale(expParams->ExportYScale()); m_dialogSaveLayout->SetYScale(expParams->ExportYScale());

View File

@ -680,10 +680,12 @@ void MainWindowsNoGUI::ExportApparelLayout(const QVector<VLayoutPiece> &details,
{ {
case LayoutExportFormats::DXF_ASTM: case LayoutExportFormats::DXF_ASTM:
exporter.SetDxfVersion(DRW::AC1009); exporter.SetDxfVersion(DRW::AC1009);
exporter.SetDxfApparelCompatibility(m_dialogSaveLayout->DxfCompatibility());
exporter.ExportToASTMDXF(details); exporter.ExportToASTMDXF(details);
break; break;
case LayoutExportFormats::DXF_AAMA: case LayoutExportFormats::DXF_AAMA:
exporter.SetDxfVersion(DRW::AC1009); exporter.SetDxfVersion(DRW::AC1009);
exporter.SetDxfApparelCompatibility(m_dialogSaveLayout->DxfCompatibility());
exporter.ExportToAAMADXF(details); exporter.ExportToAAMADXF(details);
break; break;
case LayoutExportFormats::RLD: case LayoutExportFormats::RLD:

View File

@ -51,6 +51,15 @@ enum class VarInsunits : quint8
Centimeters = 5 Centimeters = 5
}; };
enum class DXFApparelCompatibility : qint8
{
STANDARD = 0, // According to specification AAMA/ASTM
RPCADV08 = 1, // Richpeace CAD V8
RPCADV09 = 2, // Richpeace CAD V9
RPCADV10 = 3, // Richpeace CAD V10
COUNT /*Use only for validation*/
};
// Helps mark end of string. See VDxfEngine::drawTextItem for more details // Helps mark end of string. See VDxfEngine::drawTextItem for more details
extern const QString endStringPlaceholder; extern const QString endStringPlaceholder;

View File

@ -346,15 +346,13 @@ void dx_iface::AddASTMLayers()
layer.color = DRW::black; layer.color = DRW::black;
cData.layers.push_back(layer); cData.layers.push_back(layer);
// Do not support layer.name = '2'; // turn points
// layer.name = '2';// turn points layer.color = DRW::black;
// layer.color = DRW::black; cData.layers.push_back(layer);
// cData.layers.push_back(layer);
// Do not support layer.name = '3'; // curve points
// layer.name = '3';// curve points layer.color = DRW::black;
// layer.color = DRW::black; cData.layers.push_back(layer);
// cData.layers.push_back(layer);
layer.name = '4'; // V-notch and slit notch layer.name = '4'; // V-notch and slit notch
layer.color = DRW::black; layer.color = DRW::black;
@ -365,10 +363,9 @@ void dx_iface::AddASTMLayers()
// layer.color = DRW::black; // layer.color = DRW::black;
// cData.layers.push_back(layer); // cData.layers.push_back(layer);
// Do not support layer.name = '6'; // mirror line
// layer.name = '6';// mirror line layer.color = DRW::black;
// layer.color = DRW::black; cData.layers.push_back(layer);
// cData.layers.push_back(layer);
layer.name = '7'; // grainline layer.name = '7'; // grainline
layer.color = DRW::black; layer.color = DRW::black;

View File

@ -223,8 +223,12 @@ auto dxfRW::writeEntity(DRW_Entity *ent) -> bool
{ {
writer->writeString(100, "AcDbEntity"); writer->writeString(100, "AcDbEntity");
} }
if (ent->space == 1) if (ent->space == 1)
{
writer->writeInt16(67, 1); writer->writeInt16(67, 1);
}
if (version > DRW::AC1009) if (version > DRW::AC1009)
{ {
writer->writeUtf8String(8, ent->layer); writer->writeUtf8String(8, ent->layer);
@ -1062,7 +1066,9 @@ auto dxfRW::writePolyline(DRW_Polyline *ent) -> bool
} }
} }
else else
{
writer->writeInt16(66, 1); writer->writeInt16(66, 1);
}
writer->writeDouble(10, 0.0); writer->writeDouble(10, 0.0);
writer->writeDouble(20, 0.0); writer->writeDouble(20, 0.0);
writer->writeDouble(30, ent->basePoint.z); writer->writeDouble(30, ent->basePoint.z);
@ -1514,7 +1520,9 @@ auto dxfRW::writeInsert(DRW_Insert *ent) -> bool
writer->writeUtf8String(2, ent->name); writer->writeUtf8String(2, ent->name);
} }
else else
{
writer->writeUtf8Caps(2, ent->name); writer->writeUtf8Caps(2, ent->name);
}
writer->writeDouble(10, ent->basePoint.x); writer->writeDouble(10, ent->basePoint.x);
writer->writeDouble(20, ent->basePoint.y); writer->writeDouble(20, ent->basePoint.y);
writer->writeDouble(30, ent->basePoint.z); writer->writeDouble(30, ent->basePoint.z);
@ -1751,7 +1759,9 @@ auto dxfRW::writeBlock(DRW_Block *bk) -> bool
writer->writeUtf8String(2, bk->name); writer->writeUtf8String(2, bk->name);
} }
else else
{
writer->writeUtf8Caps(2, bk->name); writer->writeUtf8Caps(2, bk->name);
}
writer->writeInt16(70, bk->flags); writer->writeInt16(70, bk->flags);
writer->writeDouble(10, bk->basePoint.x); writer->writeDouble(10, bk->basePoint.x);
writer->writeDouble(20, bk->basePoint.y); writer->writeDouble(20, bk->basePoint.y);
@ -1760,9 +1770,13 @@ auto dxfRW::writeBlock(DRW_Block *bk) -> bool
writer->writeDouble(30, bk->basePoint.z); writer->writeDouble(30, bk->basePoint.z);
} }
if (version > DRW::AC1009) if (version > DRW::AC1009)
{
writer->writeUtf8String(3, bk->name); writer->writeUtf8String(3, bk->name);
}
else else
{
writer->writeUtf8Caps(3, bk->name); writer->writeUtf8Caps(3, bk->name);
}
writer->writeString(1, ""); writer->writeString(1, "");
return true; return true;

View File

@ -28,6 +28,7 @@
#include "vdxfengine.h" #include "vdxfengine.h"
#include <QApplication>
#include <QByteArray> #include <QByteArray>
#include <QColor> #include <QColor>
#include <QDateTime> #include <QDateTime>
@ -36,6 +37,7 @@
#include <QFont> #include <QFont>
#include <QLineF> #include <QLineF>
#include <QList> #include <QList>
#include <QLoggingCategory>
#include <QMessageLogger> #include <QMessageLogger>
#include <QPaintEngineState> #include <QPaintEngineState>
#include <QPainterPath> #include <QPainterPath>
@ -70,6 +72,14 @@
using namespace Qt::Literals::StringLiterals; using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
QT_WARNING_DISABLE_INTEL(1418)
Q_LOGGING_CATEGORY(vDxf, "v.undo") // NOLINT
QT_WARNING_POP
namespace namespace
{ {
const qreal AAMATextHeight = 2.5; const qreal AAMATextHeight = 2.5;
@ -214,13 +224,13 @@ auto VDxfEngine::begin(QPaintDevice *pdev) -> bool
if (isActive()) if (isActive())
{ {
qWarning("VDxfEngine::begin(), the engine was alredy activated"); qCWarning(vDxf) << qUtf8Printable("VDxfEngine::begin(), the engine was alredy activated"_L1);
return false; return false;
} }
if (not m_size.isValid()) if (not m_size.isValid())
{ {
qWarning() << "VDxfEngine::begin(), size is not valid"; qCWarning(vDxf) << qUtf8Printable("VDxfEngine::begin(), size is not valid"_L1);
return false; return false;
} }
@ -735,6 +745,18 @@ auto VDxfEngine::IsBoundaryTogetherWithNotches() const -> bool
return m_togetherWithNotches; return m_togetherWithNotches;
} }
//---------------------------------------------------------------------------------------------------------------------
auto VDxfEngine::DxfApparelCompatibility() const -> DXFApparelCompatibility
{
return m_compatibilityMode;
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::SetDxfApparelCompatibility(DXFApparelCompatibility mode)
{
m_compatibilityMode = mode;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VDxfEngine::ErrorString() const -> QString auto VDxfEngine::ErrorString() const -> QString
{ {
@ -778,7 +800,7 @@ auto VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details) -> bool
{ {
if (not m_size.isValid()) if (not m_size.isValid())
{ {
qWarning() << "VDxfEngine::begin(), size is not valid"; qCWarning(vDxf) << qUtf8Printable("VDxfEngine::ExportToAAMA(), size is not valid"_L1);
return false; return false;
} }
@ -1111,9 +1133,24 @@ void VDxfEngine::ExportPieceText(const QSharedPointer<dx_ifaceBlock> &detailBloc
QVector<QPointF> const labelShape = detail.GetPieceLabelRect(); QVector<QPointF> const labelShape = detail.GetPieceLabelRect();
if (labelShape.count() != 4) if (labelShape.count() != 4)
{ {
if (m_compatibilityMode == DXFApparelCompatibility::STANDARD)
{
qCWarning(vDxf) << qUtf8Printable(
QApplication::translate("VDxfEngine", "Piece '%1'. Piece System Text is missing.")
.arg(detail.GetName()));
}
return; return;
} }
if (m_compatibilityMode == DXFApparelCompatibility::RPCADV08)
{
CheckLabelCompatibilityRPCADV08(detail);
}
else if (m_compatibilityMode == DXFApparelCompatibility::RPCADV09)
{
CheckLabelCompatibilityRPCADV09(detail);
}
const qreal scale = qMin(detail.GetXScale(), detail.GetYScale()); const qreal scale = qMin(detail.GetXScale(), detail.GetYScale());
const qreal dW = QLineF(labelShape.at(0), labelShape.at(1)).length(); const qreal dW = QLineF(labelShape.at(0), labelShape.at(1)).length();
const qreal dH = QLineF(labelShape.at(1), labelShape.at(2)).length(); const qreal dH = QLineF(labelShape.at(1), labelShape.at(2)).length();
@ -1251,6 +1288,13 @@ void VDxfEngine::ExportStyleSystemText(const QSharedPointer<dx_iface> &input, co
return; return;
} }
} }
if (m_compatibilityMode == DXFApparelCompatibility::STANDARD)
{
// According to ASTM standard Style System Text is mandatory.
// Some applications may refuse file without Style System Text.
qCWarning(vDxf) << qUtf8Printable(QApplication::translate("VDxfEngine", "Style System Text is missing."));
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1315,7 +1359,7 @@ auto VDxfEngine::ExportToASTM(const QVector<VLayoutPiece> &details) -> bool
{ {
if (not m_size.isValid()) if (not m_size.isValid())
{ {
qWarning() << "VDxfEngine::begin(), size is not valid"; qCWarning(vDxf) << qUtf8Printable("VDxfEngine::ExportToASTM(), size is not valid"_L1);
return false; return false;
} }
@ -1786,7 +1830,18 @@ auto VDxfEngine::ExportASTMNotch(const VLayoutPassmark &passmark) -> DRW_ASTMNot
notch->angle = passmark.baseLine.angle(); notch->angle = passmark.baseLine.angle();
switch (passmark.type) PassmarkLineType type = passmark.type;
if (m_compatibilityMode == DXFApparelCompatibility::RPCADV08 ||
m_compatibilityMode == DXFApparelCompatibility::RPCADV09 ||
m_compatibilityMode == DXFApparelCompatibility::RPCADV10)
{
if (type == PassmarkLineType::ExternalVMark || type == PassmarkLineType::InternalVMark)
{
type = PassmarkLineType::CheckMark;
}
}
switch (type)
{ {
case PassmarkLineType::OneLine: case PassmarkLineType::OneLine:
case PassmarkLineType::TwoLines: case PassmarkLineType::TwoLines:
@ -1876,7 +1931,7 @@ auto VDxfEngine::ExportASTMNotchDataDependecy(const VLayoutPassmark &passmark, c
attdef->height = 3.0; attdef->height = 3.0;
attdef->text = "Link:" + notchLayer; attdef->text = "Link:" + notchLayer;
attdef->name = "Dependency"; attdef->name = "Dependency";
attdef->flags = 2; // this is a constant attribute attdef->flags |= 0x2; // this is a constant attribute
attdef->horizontalAdjustment = 3; // aligned (if vertical alignment = 0) attdef->horizontalAdjustment = 3; // aligned (if vertical alignment = 0)
return attdef; return attdef;
@ -2135,6 +2190,77 @@ void VDxfEngine::ASTMDrawFoldLineTwoArrows(const QVector<QVector<QPointF>> &poin
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::CheckLabelCompatibilityRPCADV09(const VLayoutPiece &detail)
{
// According to ASTM standard Piece System Text is mandatory.
// Richpeace CAD V9. At least 'Piece Name:' or 'Size:' identifiers must be present.
const QStringList strings = detail.GetPieceText();
bool pieceNameFound = false;
bool sizeFound = false;
for (const QString &line : strings)
{
if (line.startsWith("Piece Name:"_L1))
{
pieceNameFound = true;
}
else if (line.startsWith("Size:"_L1))
{
sizeFound = true;
}
// Break the loop early if both conditions are met
if (pieceNameFound || sizeFound)
{
break;
}
}
if (!pieceNameFound && !sizeFound)
{
qCWarning(vDxf) << qUtf8Printable(
QApplication::translate("VDxfEngine", "Piece '%1'. 'Piece Name:' or 'Size:' identifier is missing.")
.arg(detail.GetName()));
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::CheckLabelCompatibilityRPCADV08(const VLayoutPiece &detail)
{
// According to ASTM standard Piece System Text is mandatory.
// Richpeace CAD V8. If present 'Piece Name:' identifier, 'Size:' identifier must also be present.
const QStringList strings = detail.GetPieceText();
bool pieceNameFound = false;
bool sizeFound = false;
for (const QString &line : strings)
{
if (line.startsWith("Piece Name:"_L1))
{
pieceNameFound = true;
}
else if (line.startsWith("Size:"_L1))
{
sizeFound = true;
}
// Break the loop early if both conditions are met
if (pieceNameFound && sizeFound)
{
break;
}
}
if (pieceNameFound && !sizeFound)
{
qCWarning(vDxf) << qUtf8Printable(
QApplication::translate("VDxfEngine",
"Piece '%1'. 'Piece Name:' identifier requires 'Size:' identifier to be present.")
.arg(detail.GetName()));
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template <class P, class V, class C> template <class P, class V, class C>
auto VDxfEngine::CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &layer, bool forceClosed) -> P * auto VDxfEngine::CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &layer, bool forceClosed) -> P *
@ -2156,7 +2282,17 @@ auto VDxfEngine::CreateAAMAPolygon(const QVector<C> &polygon, const UTF8STRING &
for (const auto &p : polygon) for (const auto &p : polygon)
{ {
poly->addVertex(V(FromPixel(p.x(), m_varInsunits), FromPixel(GetSize().height() - p.y(), m_varInsunits))); V vertex(FromPixel(p.x(), m_varInsunits), FromPixel(GetSize().height() - p.y(), m_varInsunits));
if constexpr (std::is_same_v<V, DRW_Vertex>)
{
if (p.CurvePoint())
{
vertex.flags |= 0x1;
}
}
poly->addVertex(vertex);
} }
return poly; return poly;

View File

@ -117,6 +117,9 @@ public:
void SetBoundaryTogetherWithNotches(bool value); void SetBoundaryTogetherWithNotches(bool value);
auto IsBoundaryTogetherWithNotches() const -> bool; auto IsBoundaryTogetherWithNotches() const -> bool;
auto DxfApparelCompatibility() const -> DXFApparelCompatibility;
void SetDxfApparelCompatibility(DXFApparelCompatibility mode);
auto ErrorString() const -> QString; auto ErrorString() const -> QString;
private: private:
@ -135,6 +138,7 @@ private:
qreal m_xscale{1}; qreal m_xscale{1};
qreal m_yscale{1}; qreal m_yscale{1};
bool m_togetherWithNotches{false}; bool m_togetherWithNotches{false};
DXFApparelCompatibility m_compatibilityMode{DXFApparelCompatibility::STANDARD};
Q_REQUIRED_RESULT auto FromPixel(double pix, const VarInsunits &unit) const -> double; Q_REQUIRED_RESULT auto FromPixel(double pix, const VarInsunits &unit) const -> double;
Q_REQUIRED_RESULT auto ToPixel(double val, const VarInsunits &unit) const -> double; Q_REQUIRED_RESULT auto ToPixel(double val, const VarInsunits &unit) const -> double;
@ -200,6 +204,9 @@ private:
void ASTMDrawFoldLineTwoArrows(const QVector<QVector<QPointF>> &points, void ASTMDrawFoldLineTwoArrows(const QVector<QVector<QPointF>> &points,
const QSharedPointer<dx_ifaceBlock> &detailBlock); const QSharedPointer<dx_ifaceBlock> &detailBlock);
static void CheckLabelCompatibilityRPCADV09(const VLayoutPiece &detail);
static void CheckLabelCompatibilityRPCADV08(const VLayoutPiece &detail);
}; };
#endif // VDXFENGINE_H #endif // VDXFENGINE_H

View File

@ -214,6 +214,24 @@ auto VDxfPaintDevice::IsBoundaryTogetherWithNotches() const -> bool
return m_engine->IsBoundaryTogetherWithNotches(); return m_engine->IsBoundaryTogetherWithNotches();
} }
//---------------------------------------------------------------------------------------------------------------------
auto VDxfPaintDevice::DxfApparelCompatibility() const -> DXFApparelCompatibility
{
return m_engine->DxfApparelCompatibility();
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::SetDxfApparelCompatibility(DXFApparelCompatibility mode)
{
if (m_engine->isActive())
{
qWarning("VDxfPaintDevice::SetDxfApparelCompatibility(), cannot set compatibility mode while Dxf is being "
"generated");
return;
}
m_engine->SetDxfApparelCompatibility(mode);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VDxfPaintDevice::ExportToAAMA(const QVector<VLayoutPiece> &details) const -> bool auto VDxfPaintDevice::ExportToAAMA(const QVector<VLayoutPiece> &details) const -> bool
{ {

View File

@ -75,6 +75,9 @@ public:
void SetBoundaryTogetherWithNotches(bool value); void SetBoundaryTogetherWithNotches(bool value);
auto IsBoundaryTogetherWithNotches() const -> bool; auto IsBoundaryTogetherWithNotches() const -> bool;
auto DxfApparelCompatibility() const -> DXFApparelCompatibility;
void SetDxfApparelCompatibility(DXFApparelCompatibility mode);
auto ExportToAAMA(const QVector<VLayoutPiece> &details) const -> bool; auto ExportToAAMA(const QVector<VLayoutPiece> &details) const -> bool;
auto ExportToASTM(const QVector<VLayoutPiece> &details) const -> bool; auto ExportToASTM(const QVector<VLayoutPiece> &details) const -> bool;

View File

@ -128,6 +128,18 @@ void RestoreDetailsAfterDXF(const QString &placeholder, const QList<QGraphicsIte
} }
} // namespace } // namespace
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutExporter::DxfApparelCompatibility() const -> DXFApparelCompatibility
{
return m_dxfCompatibility;
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutExporter::SetDxfApparelCompatibility(DXFApparelCompatibility mode)
{
m_dxfCompatibility = mode;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutExporter::IsShowGrainline() const -> bool auto VLayoutExporter::IsShowGrainline() const -> bool
{ {
@ -325,6 +337,7 @@ void VLayoutExporter::ExportToAAMADXF(const QVector<VLayoutPiece> &details) cons
generator.SetXScale(m_xScale); generator.SetXScale(m_xScale);
generator.SetYScale(m_yScale); generator.SetYScale(m_yScale);
generator.SetBoundaryTogetherWithNotches(m_togetherWithNotches); generator.SetBoundaryTogetherWithNotches(m_togetherWithNotches);
generator.SetDxfApparelCompatibility(m_dxfCompatibility);
if (not generator.ExportToAAMA(details)) if (not generator.ExportToAAMA(details))
{ {
qCritical() << tr("Can't create an AAMA dxf file.") << generator.ErrorString(); qCritical() << tr("Can't create an AAMA dxf file.") << generator.ErrorString();
@ -344,6 +357,7 @@ void VLayoutExporter::ExportToASTMDXF(const QVector<VLayoutPiece> &details) cons
generator.SetXScale(m_xScale); generator.SetXScale(m_xScale);
generator.SetYScale(m_yScale); generator.SetYScale(m_yScale);
generator.SetBoundaryTogetherWithNotches(m_togetherWithNotches); generator.SetBoundaryTogetherWithNotches(m_togetherWithNotches);
generator.SetDxfApparelCompatibility(m_dxfCompatibility);
if (not generator.ExportToASTM(details)) if (not generator.ExportToASTM(details))
{ {
qCritical() << tr("Can't create an ASTM dxf file.") << generator.ErrorString(); qCritical() << tr("Can't create an ASTM dxf file.") << generator.ErrorString();

View File

@ -34,6 +34,7 @@
#include <QRectF> #include <QRectF>
#include <QString> #include <QString>
#include "../vdxf/dxfdef.h"
#include "../vlayout/vlayoutdef.h" #include "../vlayout/vlayoutdef.h"
class QGraphicsScene; class QGraphicsScene;
@ -77,6 +78,9 @@ public:
auto BinaryDxfFormat() const -> bool; auto BinaryDxfFormat() const -> bool;
void SetBinaryDxfFormat(bool binaryFormat); void SetBinaryDxfFormat(bool binaryFormat);
auto DxfApparelCompatibility() const -> DXFApparelCompatibility;
void SetDxfApparelCompatibility(DXFApparelCompatibility mode);
auto IsShowGrainline() const -> bool; auto IsShowGrainline() const -> bool;
void SetShowGrainline(bool show); void SetShowGrainline(bool show);
@ -138,6 +142,7 @@ private:
bool m_singleStrokeOutlineFont{false}; bool m_singleStrokeOutlineFont{false};
int m_penWidth{1}; int m_penWidth{1};
bool m_togetherWithNotches{false}; bool m_togetherWithNotches{false};
DXFApparelCompatibility m_dxfCompatibility{DXFApparelCompatibility::STANDARD};
void ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details, const QString &filename) const; void ExportToPDF(QGraphicsScene *scene, const QList<QGraphicsItem *> &details, const QString &filename) const;
}; };

View File

@ -46,6 +46,7 @@ const QString SINGLE_OPTION_PAGETEMPLATE = QStringLiteral("p");
const QString LONG_OPTION_EXP2FORMAT = QStringLiteral("format"); const QString LONG_OPTION_EXP2FORMAT = QStringLiteral("format");
const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f"); const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f");
const QString LONG_OPTION_DXF_APPAREL_COMP = QStringLiteral("dxfApparelComp");
const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf"); const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf");
const QString LONG_OPTION_NOGRAINLINE = QStringLiteral("noGrainline"); // NOLINT const QString LONG_OPTION_NOGRAINLINE = QStringLiteral("noGrainline"); // NOLINT
const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths"); const QString LONG_OPTION_TEXT2PATHS = QStringLiteral("text2paths");
@ -152,6 +153,7 @@ auto AllKeys() -> QStringList
SINGLE_OPTION_PAGETEMPLATE, SINGLE_OPTION_PAGETEMPLATE,
LONG_OPTION_EXP2FORMAT, LONG_OPTION_EXP2FORMAT,
SINGLE_OPTION_EXP2FORMAT, SINGLE_OPTION_EXP2FORMAT,
LONG_OPTION_DXF_APPAREL_COMP,
LONG_OPTION_BINARYDXF, LONG_OPTION_BINARYDXF,
LONG_OPTION_NOGRAINLINE, LONG_OPTION_NOGRAINLINE,
LONG_OPTION_TEXT2PATHS, LONG_OPTION_TEXT2PATHS,

View File

@ -46,6 +46,7 @@ extern const QString SINGLE_OPTION_PAGETEMPLATE;
extern const QString LONG_OPTION_EXP2FORMAT; extern const QString LONG_OPTION_EXP2FORMAT;
extern const QString SINGLE_OPTION_EXP2FORMAT; extern const QString SINGLE_OPTION_EXP2FORMAT;
extern const QString LONG_OPTION_DXF_APPAREL_COMP;
extern const QString LONG_OPTION_BINARYDXF; extern const QString LONG_OPTION_BINARYDXF;
extern const QString LONG_OPTION_NOGRAINLINE; extern const QString LONG_OPTION_NOGRAINLINE;
extern const QString LONG_OPTION_TEXT2PATHS; extern const QString LONG_OPTION_TEXT2PATHS;

View File

@ -109,6 +109,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingNestingTime, ("layout/time"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingEfficiencyCoefficient, ("layout/efficiencyCoefficient"_L1)) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingEfficiencyCoefficient, ("layout/efficiencyCoefficient"_L1))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, ("layout/exportFormat"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, ("layout/exportFormat"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDetailExportFormat, ("detail/exportFormat"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDetailExportFormat, ("detail/exportFormat"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDxfCompatibility, ("layout/dxfCompatibility"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, ("tiledPDF/paperHeight"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, ("tiledPDF/paperHeight"_L1)) // NOLINT
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, ("tiledPDF/paperWidth"_L1)) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, ("tiledPDF/paperWidth"_L1)) // NOLINT
@ -774,6 +775,18 @@ void VValentinaSettings::SetDetailExportFormat(qint8 format)
setValue(*settingDetailExportFormat, format); setValue(*settingDetailExportFormat, format);
} }
//---------------------------------------------------------------------------------------------------------------------
auto VValentinaSettings::GetDxfCompatibility() const -> qint8
{
return CastToLayoutExportFormat(qvariant_cast<qint8>(value(*settingDxfCompatibility, 0)));
}
//---------------------------------------------------------------------------------------------------------------------
void VValentinaSettings::SetDxfCompatibility(qint8 type)
{
setValue(*settingDxfCompatibility, type);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VValentinaSettings::GetHistorySearchHistory() const -> QStringList auto VValentinaSettings::GetHistorySearchHistory() const -> QStringList
{ {

View File

@ -182,6 +182,9 @@ public:
auto GetDetailExportFormat() const -> qint8; auto GetDetailExportFormat() const -> qint8;
void SetDetailExportFormat(qint8 format); void SetDetailExportFormat(qint8 format);
auto GetDxfCompatibility() const -> qint8;
void SetDxfCompatibility(qint8 type);
auto GetHistorySearchHistory() const -> QStringList; auto GetHistorySearchHistory() const -> QStringList;
void SetHistorySearchHistory(const QStringList &history); void SetHistorySearchHistory(const QStringList &history);