mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 21:34:12 +02:00
20a3e4f636
Everything in an exported DXF was on layer 0, and the file had no LAYER table: in a CAD program the border, title block, symbols, wires and texts could not be hidden, printed or recoloured separately. Each kind of content now has its own layer, declared in a LAYER table (white/black, continuous, so the file looks the same on opening): QET_BORDER, QET_TITLEBLOCK, QET_SYMBOLS, QET_SYMBOL_TEXTS, QET_TERMINALS, QET_WIRES, QET_WIRE_NUMBERS, QET_JUNCTIONS, QET_TEXTS, QET_XREFS, QET_SHAPES, QET_TABLES, QET_IMAGES Fixed, untranslated names, so layer filters and scripts work in any language. Createdxf gets a current layer beside its xScale/yScale; DxfExport sets it before each kind of content, and BorderTitleBlock switches to the title block layer itself. No DXF version change: layers exist in R10. Checked on the 24 example projects, 133 folios: with the layer values set back to 0 and the LAYER table removed, every file is byte-identical to before; no entity is on an undeclared layer or left on 0; ezdxf reads all of them with no audit errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G2d2Zi8BfrYRPX88zhaoFG
72 lines
2.7 KiB
C++
72 lines
2.7 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef DXFEXPORT_H
|
|
#define DXFEXPORT_H
|
|
|
|
#include <QPointF>
|
|
#include <QSize>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
|
|
class Diagram;
|
|
class ExportProperties;
|
|
|
|
/**
|
|
Writes a folio as a DXF file. Used by the export dialog and by
|
|
--export-dxf (discussion #1072), so both write the same file for the
|
|
same options.
|
|
*/
|
|
namespace DxfExport
|
|
{
|
|
/// The layers of an exported folio (discussion #1071). Fixed and
|
|
/// untranslated, so a CAD user's layer filters and scripts work
|
|
/// whatever language QElectroTech runs in; prefixed so they sort
|
|
/// together and do not clash with the recipient's own layers.
|
|
namespace Layer
|
|
{
|
|
inline const QString Border = QStringLiteral("QET_BORDER");
|
|
inline const QString TitleBlock = QStringLiteral("QET_TITLEBLOCK");
|
|
inline const QString Symbols = QStringLiteral("QET_SYMBOLS");
|
|
inline const QString SymbolTexts = QStringLiteral("QET_SYMBOL_TEXTS");
|
|
inline const QString Terminals = QStringLiteral("QET_TERMINALS");
|
|
inline const QString Wires = QStringLiteral("QET_WIRES");
|
|
inline const QString WireNumbers = QStringLiteral("QET_WIRE_NUMBERS");
|
|
inline const QString Junctions = QStringLiteral("QET_JUNCTIONS");
|
|
inline const QString Texts = QStringLiteral("QET_TEXTS");
|
|
inline const QString Xrefs = QStringLiteral("QET_XREFS");
|
|
inline const QString Shapes = QStringLiteral("QET_SHAPES");
|
|
inline const QString Tables = QStringLiteral("QET_TABLES");
|
|
inline const QString Images = QStringLiteral("QET_IMAGES");
|
|
|
|
inline QStringList all()
|
|
{
|
|
return {Border, TitleBlock, Symbols, SymbolTexts, Terminals,
|
|
Wires, WireNumbers, Junctions, Texts, Xrefs, Shapes,
|
|
Tables, Images};
|
|
}
|
|
}
|
|
|
|
QSize folioSize(Diagram *diagram, const ExportProperties &properties);
|
|
void write(Diagram *diagram, int width, int height,
|
|
const QString &path, const ExportProperties &properties);
|
|
QPointF rotation_transformed(qreal px, qreal py,
|
|
qreal origin_x, qreal origin_y, qreal angle);
|
|
}
|
|
|
|
#endif // DXFEXPORT_H
|