Add an option to export symbols as DXF blocks (#1339)

With "DXF : symboles en blocs" ticked in the export dialog, or
--dxf-blocks on the command line, each symbol definition a folio uses is
written once as a DXF block and every placed symbol as an INSERT of it.
A CAD program then selects, counts and replaces a symbol as one object.

The block is drawn by the same code as a symbol drawn in full, as if
the symbol sat unturned at the folio's origin, which is DXF (0,
sheetHeight): that is the block's base point, so the INSERT carries the
symbol's position and quarter-turn and nothing else. Blocks have to come
before any entity, so the export collects them first and dxfBegin()
writes them in its BLOCKS section. Entities in a block keep their own
layers. Off by default; with it off the file is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-07 09:50:18 +13:00
parent 83f72c95c6
commit c3ed2daca8
12 changed files with 567 additions and 115 deletions
+5
View File
@@ -37,6 +37,7 @@ ExportProperties::ExportProperties() :
draw_terminal_names(false),
draw_bg_transparent(false),
draw_colored_conductors(true),
dxf_blocks(false),
exported_area(QET::BorderArea)
{
}
@@ -77,6 +78,8 @@ void ExportProperties::toSettings(QSettings &settings,
draw_bg_transparent);
settings.setValue(prefix % "drawcoloredconductors",
draw_colored_conductors);
settings.setValue(prefix % "dxfblocks",
dxf_blocks);
settings.setValue(prefix % "area",
QET::diagramAreaToString(exported_area));
}
@@ -115,6 +118,8 @@ void ExportProperties::fromSettings(QSettings &settings,
draw_colored_conductors = settings.value(
prefix % "drawcoloredconductors",
true ).toBool();
dxf_blocks = settings.value(prefix % "dxfblocks",
false).toBool();
exported_area = QET::diagramAreaFromString(
settings.value(