Export pattern to DXF-ASTM.

This commit is contained in:
Roman Telezhynskyi 2020-03-15 13:35:31 +02:00
parent 3429e5ae11
commit 1b663bb5e1
17 changed files with 551 additions and 31 deletions

View File

@ -42,6 +42,7 @@
- Call Piece Options and Delete Piece from the piece list context menu.
- Change default values for grainline length and pattern label size to 10 cm.
- Tool Point at distance and angle now allows negative length.
- Export pattern to DXF-ASTM.
# Version 0.6.2 (unreleased)
- [#903] Bug in tool Cut Spline path.

View File

@ -102,6 +102,33 @@ The path to output destination folder. By default the directory at which the app
.BR "*" " AutoCAD DXF 2013 AAMA files (*.dxf) = 23,"
.RE
.RS
.BR "*" " AutoCAD DXF R10 ASTM файли (*.dxf) = 24,"
.RE
.RS
.BR "*" " AutoCAD DXF R11/12 ASTM файли (*.dxf) = 25,"
.RE
.RS
.BR "*" " AutoCAD DXF R13 ASTM файли (*.dxf) = 26,"
.RE
.RS
.BR "*" " AutoCAD DXF R14 ASTM файли (*.dxf) = 27,"
.RE
.RS
.BR "*" " AutoCAD DXF 2000 ASTM файли (*.dxf) = 28,"
.RE
.RS
.BR "*" " AutoCAD DXF 2004 ASTM файли (*.dxf) = 29,"
.RE
.RS
.BR "*" " AutoCAD DXF 2007 ASTM файли (*.dxf) = 30,"
.RE
.RS
.BR "*" " AutoCAD DXF 2010 ASTM файли (*.dxf) = 31,"
.RE
.RS
.BR "*" " AutoCAD DXF 2013 ASTM файли (*.dxf) = 32,"
.RE
.RS
.BR "*" " PDF tiled files (*.pdf) = 33."
.RE
.IP "--bdxf"

View File

@ -810,16 +810,15 @@ QVector<std::pair<QString, LayoutExportFormats> > DialogSaveLayout::InitFormats(
InitFormat(LayoutExportFormats::DXF_AC1021_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1024_AAMA);
InitFormat(LayoutExportFormats::DXF_AC1027_AAMA);
// We will support them anyway
// InitFormat(LayoutExportFormats::DXF_AC1006_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1009_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1012_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1014_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1015_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1018_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1021_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1024_ASTM);
// InitFormat(LayoutExportFormats::DXF_AC1027_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1006_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1009_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1012_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1014_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1015_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1018_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1021_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1024_ASTM);
InitFormat(LayoutExportFormats::DXF_AC1027_ASTM);
InitFormat(LayoutExportFormats::PDFTiled);
// InitFormat(LayoutExportFormats::NC);

View File

@ -510,7 +510,16 @@ void MainWindowsNoGUI::ExportData(const QVector<VLayoutPiece> &listDetails)
format == LayoutExportFormats::DXF_AC1018_AAMA ||
format == LayoutExportFormats::DXF_AC1021_AAMA ||
format == LayoutExportFormats::DXF_AC1024_AAMA ||
format == LayoutExportFormats::DXF_AC1027_AAMA)
format == LayoutExportFormats::DXF_AC1027_AAMA ||
format == LayoutExportFormats::DXF_AC1006_ASTM ||
format == LayoutExportFormats::DXF_AC1009_ASTM ||
format == LayoutExportFormats::DXF_AC1012_ASTM ||
format == LayoutExportFormats::DXF_AC1014_ASTM ||
format == LayoutExportFormats::DXF_AC1015_ASTM ||
format == LayoutExportFormats::DXF_AC1018_ASTM ||
format == LayoutExportFormats::DXF_AC1021_ASTM ||
format == LayoutExportFormats::DXF_AC1024_ASTM ||
format == LayoutExportFormats::DXF_AC1027_ASTM)
{
if (m_dialogSaveLayout->Mode() == Draw::Layout)
{
@ -665,15 +674,31 @@ void MainWindowsNoGUI::ExportApparelLayout(const QVector<VLayoutPiece> &details,
switch (format)
{
case LayoutExportFormats::DXF_AC1006_ASTM:
ASTMDxfFile(name, DRW::AC1006, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1009_ASTM:
ASTMDxfFile(name, DRW::AC1009, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1012_ASTM:
ASTMDxfFile(name, DRW::AC1012, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1014_ASTM:
ASTMDxfFile(name, DRW::AC1014, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1015_ASTM:
ASTMDxfFile(name, DRW::AC1015, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1018_ASTM:
ASTMDxfFile(name, DRW::AC1018, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1021_ASTM:
ASTMDxfFile(name, DRW::AC1021, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1024_ASTM:
ASTMDxfFile(name, DRW::AC1024, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1027_ASTM:
Q_UNREACHABLE(); // For now not supported
ASTMDxfFile(name, DRW::AC1027, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
break;
case LayoutExportFormats::DXF_AC1006_AAMA:
AAMADxfFile(name, DRW::AC1006, m_dialogSaveLayout->IsBinaryDXFFormat(), size, details);
@ -1424,6 +1449,20 @@ void MainWindowsNoGUI::AAMADxfFile(const QString &name, int version, bool binary
generator.ExportToAAMA(details);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::ASTMDxfFile(const QString &name, int version, bool binary, const QSize &size,
const QVector<VLayoutPiece> &details) const
{
VDxfPaintDevice generator;
generator.setFileName(name);
generator.setSize(size);
generator.setResolution(PrintDPI);
generator.SetVersion(static_cast<DRW::Version>(version));
generator.SetBinaryFormat(binary);
generator.setInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745
generator.ExportToASTM(details);
}
QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------

View File

@ -182,6 +182,8 @@ private:
const QList<QList<QGraphicsItem *> > &details)const;
void AAMADxfFile(const QString &name, int version, bool binary, const QSize &size,
const QVector<VLayoutPiece> &details) const;
void ASTMDxfFile(const QString &name, int version, bool binary, const QSize &size,
const QVector<VLayoutPiece> &details) const;
void PreparePaper(int index) const;
void RestorePaper(int index) const;

View File

@ -46,6 +46,9 @@ void dx_iface::writeEntity(DRW_Entity* e){
case DRW::POINT:
dxfW->writePoint(static_cast<DRW_Point*>(e));
break;
case DRW::ASTMNOTCH:
dxfW->writeASTMNotch(static_cast<DRW_ASTMNotch*>(e));
break;
case DRW::LINE:
dxfW->writeLine(static_cast<DRW_Line*>(e));
break;
@ -283,6 +286,107 @@ void dx_iface::AddAAMAHeaderData()
cData.headerC.addStr("$CLAYER", "1", 8); // Current layer name
}
void dx_iface::AddASTMLayers()
{
DRW_Layer layer;
layer.name = '1';// piece boundary
layer.color = DRW::black;
cData.layers.push_back(layer);
// Do not support
// layer.name = '2';// turn points
// layer.color = DRW::black;
// cData.layers.push_back(layer);
// Do not support
// layer.name = '3';// curve points
// layer.color = DRW::black;
// cData.layers.push_back(layer);
layer.name = '4';// V-notch and slit notch
layer.color = DRW::black;
cData.layers.push_back(layer);
// Do not support
// layer.name = '5';// grade reference and alternate grade reference line(s)
// layer.color = DRW::black;
// cData.layers.push_back(layer);
// Do not support
// layer.name = '6';// mirror line
// layer.color = DRW::black;
// cData.layers.push_back(layer);
layer.name = '7';// grainline
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = '8';// internal line(s)
layer.color = DRW::black;
cData.layers.push_back(layer);
// Do not support
// layer.name = '9';// stripe reference line(s)
// layer.color = DRW::black;
// cData.layers.push_back(layer);
// Do not support
// layer.name = '10';// plaid reference line(s)
// layer.color = DRW::black;
// cData.layers.push_back(layer);
layer.name = "11";// internal cutout(s)
layer.color = DRW::black;
cData.layers.push_back(layer);
// Layer 12 intentionally left blank by the standard
layer.name = "13";// drill holes
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "14";// sew line(s)
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "15";// annotation text
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "80";// T-notch
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "81";// castle notch
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "82";// check notch
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "83";// U-notch
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "84";// piece boundary quality validation curves
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "85";// internal lines quality validation curves
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "86";// internal cutouts quality validation curves
layer.color = DRW::black;
cData.layers.push_back(layer);
layer.name = "87";// sew lines quality validation curves
layer.color = DRW::black;
cData.layers.push_back(layer);
}
void dx_iface::AddDefLayers()
{
DRW_Layer defLayer;

View File

@ -124,6 +124,7 @@ public:
void AddDefLayers();
void AddAAMALayers();
void AddAAMAHeaderData();
void AddASTMLayers();
private:
Q_DISABLE_COPY(dx_iface)

View File

@ -224,6 +224,18 @@ void DRW_Point::parseCode(int code, dxfReader *reader){
}
}
void DRW_ASTMNotch::parseCode(int code, dxfReader *reader)
{
switch (code) {
case 50:
angle = reader->getDouble();
break;
default:
DRW_Point::parseCode(code, reader);
break;
}
}
void DRW_Line::parseCode(int code, dxfReader *reader){
switch (code) {
case 11:

View File

@ -80,6 +80,7 @@ namespace DRW {
VIEWPORT,
// WIPEOUT, //WIPEOUTVARIABLE
XLINE,
ASTMNOTCH, // ASTM NOTCH
UNKNOWN
};
@ -251,6 +252,22 @@ public:
// the UCS in effect when the point was drawn
};
class DRW_ASTMNotch : public DRW_Point {
SETENTFRIENDS
public:
DRW_ASTMNotch()
{
eType = DRW::ASTMNOTCH;
}
protected:
void parseCode(int code, dxfReader *reader);
public:
double angle{0}; /*!< angle, code 50 */
};
//! Class to handle line entity
/*!
* Class to handle line entity

View File

@ -62,6 +62,9 @@ public:
/** Called for every point */
virtual void addPoint(const DRW_Point &) { }
/** Called for every ASTM notch */
virtual void addASTMNotch(const DRW_ASTMNotch &) { }
/** Called for every line */
virtual void addLine(const DRW_Line &) { }

View File

@ -553,6 +553,15 @@ bool dxfRW::writePoint(DRW_Point *ent) {
return true;
}
bool dxfRW::writeASTMNotch(DRW_ASTMNotch *ent)
{
writePoint(ent);
writer->writeDouble(50, ent->angle);
writer->writeDouble(39, ent->thickness); // Defined, but not used in point
return true;
}
bool dxfRW::writeLine(DRW_Line *ent) {
writer->writeString(0, "LINE");
writeEntity(ent);
@ -2360,6 +2369,28 @@ bool dxfRW::processPoint() {
return true;
}
bool dxfRW::processASTMNotch()
{
DRW_DBG("dxfRW::processASTMNotch\n");
int code;
DRW_ASTMNotch notch;
while (reader->readRec(&code)) {
DRW_DBG(code); DRW_DBG("\n");
switch (code) {
case 0: {
nextentity = reader->getString();
DRW_DBG(nextentity); DRW_DBG("\n");
iface->addASTMNotch(notch);
return true; //found new entity or ENDSEC, terminate
}
default:
notch.parseCode(code, reader);
break;
}
}
return true;
}
bool dxfRW::processLine() {
DRW_DBG("dxfRW::processLine\n");
int code;

View File

@ -47,6 +47,7 @@ public:
bool writeVport(DRW_Vport *ent);
bool writeAppId(DRW_AppId *ent);
bool writePoint(DRW_Point *ent);
bool writeASTMNotch(DRW_ASTMNotch *ent);
bool writeLine(DRW_Line *ent);
bool writeRay(DRW_Ray *ent);
bool writeXline(DRW_Xline *ent);
@ -90,6 +91,7 @@ private:
bool processAppId();
bool processPoint();
bool processASTMNotch();
bool processLine();
bool processRay();
bool processXline();

View File

@ -55,6 +55,23 @@
static const qreal AAMATextHeight = 2.5;
namespace
{
QVector<QPointF> PieceOutline(const VLayoutPiece &detail)
{
QVector<QPointF> outline;
if (detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn())
{
outline = detail.GetMappedSeamAllowancePoints();
}
else
{
outline = detail.GetMappedContourPoints();
}
return outline;
}
}
//---------------------------------------------------------------------------------------------------------------------
static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
{
@ -623,7 +640,7 @@ bool VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details)
}
input->AddAAMALayers();
ExportAAMAGlobalText(input, details);
ExportStyleSystemText(input, details);
for(auto &detail : details)
{
@ -643,7 +660,7 @@ bool VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details)
ExportAAMAIntcut(detailBlock, detail);
ExportAAMANotch(detailBlock, detail);
ExportAAMAGrainline(detailBlock, detail);
ExportAAMAText(detailBlock, detail);
ExportPieceText(detailBlock, detail);
ExportAAMADrill(detailBlock, detail);
input->AddBlock(detailBlock);
@ -661,17 +678,7 @@ bool VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details)
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportAAMAOutline(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
QVector<QPointF> outline;
if (detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn())
{
outline = detail.GetMappedSeamAllowancePoints();
}
else
{
outline = detail.GetMappedContourPoints();
}
DRW_Entity *e = AAMAPolygon(outline, QChar('1'), true);
DRW_Entity *e = AAMAPolygon(PieceOutline(detail), QChar('1'), true);
if (e)
{
detailBlock->ent.push_back(e);
@ -761,7 +768,7 @@ void VDxfEngine::ExportAAMAGrainline(dx_ifaceBlock *detailBlock, const VLayoutPi
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportAAMAText(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
void VDxfEngine::ExportPieceText(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
const QStringList list = detail.GetPieceText();
const QPointF startPos = detail.GetPieceTextPosition();
@ -774,7 +781,7 @@ void VDxfEngine::ExportAAMAText(dx_ifaceBlock *detailBlock, const VLayoutPiece &
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportAAMAGlobalText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details)
void VDxfEngine::ExportStyleSystemText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details)
{
for(auto &detail : details)
{
@ -812,6 +819,261 @@ void VDxfEngine::ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece
}
}
//---------------------------------------------------------------------------------------------------------------------
bool VDxfEngine::ExportToASTM(const QVector<VLayoutPiece> &details)
{
if (size.isValid() == false)
{
qWarning()<<"VDxfEngine::begin(), size is not valid";
return false;
}
input = QSharedPointer<dx_iface>(new dx_iface(getFileNameForLocale(), m_version, varMeasurement,
varInsunits));
input->AddAAMAHeaderData();
if (m_version > DRW::AC1009)
{
input->AddDefLayers();
}
input->AddASTMLayers();
ExportStyleSystemText(input, details);
for(auto &detail : details)
{
dx_ifaceBlock *detailBlock = new dx_ifaceBlock();
QString blockName = detail.GetName();
if (m_version <= DRW::AC1009)
{
blockName.replace(' ', '_');
}
detailBlock->name = blockName.toStdString();
detailBlock->layer = '1';
ExportASTMPieceBoundary(detailBlock, detail);
ExportASTMSewLine(detailBlock, detail);
ExportASTMInternalLine(detailBlock, detail);
ExportASTMInternalCutout(detailBlock, detail);
ExportASTMNotch(detailBlock, detail);
ExportAAMAGrainline(detailBlock, detail);
ExportPieceText(detailBlock, detail);
ExportASTMDrill(detailBlock, detail);
ExportASTMAnnotationText(detailBlock, detail);
input->AddBlock(detailBlock);
DRW_Insert *insert = new DRW_Insert();
insert->name = blockName.toStdString();
insert->layer = '1';
input->AddEntity(insert);
}
return input->fileExport(m_binary);
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportASTMPieceBoundary(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
QVector<QPointF> pieceBoundary = PieceOutline(detail);
// Piece boundary
DRW_Entity *e = AAMAPolygon(PieceOutline(detail), QChar('1'), true);
if (e)
{
detailBlock->ent.push_back(e);
}
// Piece boundary quality validation curves
DRW_Entity *q = AAMAPolygon(PieceOutline(detail), "84", true);
if (q)
{
detailBlock->ent.push_back(q);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportASTMSewLine(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
if (not detail.IsHideMainPath() && not detail.IsSeamAllowanceBuiltIn())
{
QVector<QPointF> sewLine = detail.GetMappedContourPoints();
// Sew lines
if (DRW_Entity *e = AAMAPolygon(sewLine, "14", true))
{
detailBlock->ent.push_back(e);
}
// Sew lines quality validation curves
if (DRW_Entity *e = AAMAPolygon(sewLine, "87", true))
{
detailBlock->ent.push_back(e);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportASTMInternalLine(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
const QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(false);
for(auto &intCut : drawIntCut)
{
// Internal line
if (DRW_Entity *e = AAMAPolygon(intCut, QChar('8'), false))
{
detailBlock->ent.push_back(e);
}
// Internal lines quality validation curves
if (DRW_Entity *e = AAMAPolygon(intCut, "85", false))
{
detailBlock->ent.push_back(e);
}
}
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
for(auto &label : labels)
{
if (label.type != PlaceLabelType::Doubletree && label.type != PlaceLabelType::Button
&& label.type != PlaceLabelType::Circle)
{
for(auto &p : qAsConst(label.shape))
{
// Internal line (placelabel)
if (DRW_Entity *e = AAMAPolygon(p, QChar('8'), false))
{
detailBlock->ent.push_back(e);
}
// Internal lines quality validation curves
if (DRW_Entity *e = AAMAPolygon(p, "85", false))
{
detailBlock->ent.push_back(e);
}
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportASTMInternalCutout(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(true);
for(auto &intCut : drawIntCut)
{
// Internal cutout
if (DRW_Entity *e = AAMAPolygon(intCut, "11", false))
{
detailBlock->ent.push_back(e);
}
// Internal cutouts quality validation curves
if (DRW_Entity *e = AAMAPolygon(intCut, "86", false))
{
detailBlock->ent.push_back(e);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportASTMAnnotationText(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
QString name = detail.GetName();
QPointF textPos = detail.VLayoutPiece::DetailBoundingRect().center();
QPointF pos(textPos.x(), textPos.y() - ToPixel(AAMATextHeight, varInsunits));
detailBlock->ent.push_back(AAMAText(pos, name, "15"));
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportASTMDrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
for(auto &label : labels)
{
if (label.type == PlaceLabelType::Doubletree || label.type == PlaceLabelType::Button
|| label.type == PlaceLabelType::Circle)
{
const QPointF center = detail.GetMatrix().map(label.center);
DRW_Point *point = new DRW_Point();
point->basePoint = DRW_Coord(FromPixel(center.x(), varInsunits),
FromPixel(getSize().height() - center.y(), varInsunits), 0);
point->layer = "13";
detailBlock->ent.push_back(point);
// TODO. Investigate drill category
// QPointF pos(center.x(), center.y() - ToPixel(AAMATextHeight, varInsunits));
// detailBlock->ent.push_back(AAMAText(pos, category, "13"));
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::ExportASTMNotch(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
{
if (detail.IsSeamAllowance())
{
const QVector<VLayoutPassmark> passmarks = detail.GetPassmarks();
for(auto &passmark : passmarks)
{
DRW_ASTMNotch *notch = new DRW_ASTMNotch();
const QPointF center = passmark.baseLine.p1();
notch->basePoint = DRW_Coord(FromPixel(center.x(), varInsunits),
FromPixel(getSize().height() - center.y(), varInsunits),
FromPixel(passmark.baseLine.length(), varInsunits));
notch->angle = passmark.baseLine.angle();
if (passmark.type == PassmarkLineType::OneLine || passmark.type == PassmarkLineType::TwoLines
|| passmark.type == PassmarkLineType::ThreeLines)
{ // Slit notch
notch->layer = "4";
}
else if (passmark.type == PassmarkLineType::VMark || passmark.type == PassmarkLineType::VMark2)
{
QLineF boundaryLine = QLineF(passmark.lines.first().p2(), passmark.lines.last().p2());
notch->thickness = FromPixel(boundaryLine.length(), varInsunits); // width
notch->layer = "4";
}
else if (passmark.type == PassmarkLineType::TMark)
{
qreal width = FromPixel(passmark.lines.last().length(), varInsunits);
notch->thickness = FromPixel(width, varInsunits);
notch->layer = "80";
}
else if (passmark.type == PassmarkLineType::BoxMark)
{
QPointF start = passmark.lines.first().p1();
QPointF end = passmark.lines.last().p2();
notch->layer = "81";
notch->thickness = FromPixel(QLineF(start, end).length(), varInsunits);
}
else if (passmark.type == PassmarkLineType::UMark)
{
QPointF start = passmark.lines.first().p1();
QPointF end = passmark.lines.last().p2();
notch->thickness = FromPixel(QLineF(start, end).length(), varInsunits);
notch->layer = "83";
}
detailBlock->ent.push_back(notch);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
DRW_Entity *VDxfEngine::AAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed)
{

View File

@ -114,10 +114,19 @@ private:
void ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportAAMANotch(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportAAMAGrainline(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportAAMAText(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportAAMAGlobalText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details);
void ExportPieceText(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportStyleSystemText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details);
void ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
bool ExportToASTM(const QVector<VLayoutPiece> &details);
void ExportASTMPieceBoundary(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMSewLine(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMInternalLine(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMInternalCutout(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMAnnotationText(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMDrill(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
void ExportASTMNotch(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail);
Q_REQUIRED_RESULT DRW_Entity *AAMAPolygon(const QVector<QPointF> &polygon, const QString &layer, bool forceClosed);
Q_REQUIRED_RESULT DRW_Entity *AAMALine(const QLineF &line, const QString &layer);
Q_REQUIRED_RESULT DRW_Entity *AAMAText(const QPointF &pos, const QString &text, const QString &layer);

View File

@ -171,7 +171,16 @@ bool VDxfPaintDevice::ExportToAAMA(const QVector<VLayoutPiece> &details) const
return res;
}
//---------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------
bool VDxfPaintDevice::ExportToASTM(const QVector<VLayoutPiece> &details) const
{
engine->setActive(true);
const bool res = engine->ExportToASTM(details);
engine->setActive(false);
return res;
}
//---------------------------------------------------------------------------------------------------------------------
int VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
{
switch (metric)

View File

@ -67,6 +67,7 @@ public:
void setInsunits(const VarInsunits &var);
bool ExportToAAMA(const QVector<VLayoutPiece> &details) const;
bool ExportToASTM(const QVector<VLayoutPiece> &details) const;
protected:
virtual int metric(PaintDeviceMetric metric) const override;

View File

@ -544,6 +544,7 @@ QVector<VLayoutPassmark> VLayoutPiece::Map<VLayoutPassmark>(QVector<VLayoutPassm
for (int i = 0; i < passmarks.size(); ++i)
{
passmarks[i].lines = Map(passmarks.at(i).lines);
passmarks[i].baseLine = d->matrix.map(passmarks.at(i).baseLine);
}
return passmarks;