Put the DXF export on named layers (#1071)

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
This commit is contained in:
ispyisail
2026-09-27 19:29:15 +13:00
parent 4278ef864e
commit 20a3e4f636
5 changed files with 99 additions and 12 deletions
+2
View File
@@ -19,6 +19,7 @@
#include "bordercelllabels.h"
#include "createdxf.h"
#include "dxfexport.h"
#include "diagram.h"
#include "diagramposition.h"
#include "math.h"
@@ -706,6 +707,7 @@ void BorderTitleBlock::drawDxf(
// render the titleblock, using the TitleBlockTemplate object
if (display_titleblock_) {
Createdxf::layer = DxfExport::Layer::TitleBlock;
//qp -> translate(titleblock_rect_.topLeft());
QRectF rect = titleBlockRect();
m_titleblock_template_renderer -> renderDxf(rect,