From a39992357552812a951f12249e68ac67a8380990 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sun, 27 Sep 2026 20:51:37 +1300 Subject: [PATCH] DXF export: keep the wires' colours Every wire was written in the default colour, whatever its colour on the folio: 723 of the 3,190 wires in the example projects (23 %, in 10 projects) lost theirs. The wire outline now takes the wire's colour, and its number the wire's text colour, mapped to the nearest DXF colour as the free texts already are. Black still comes out as BYLAYER. A two-colour wire gets its main colour, and dashed wires (46 in the examples) stay continuous: DXF line types are not written yet. Checked on the 24 example projects, 133 folios: exactly 723 wire outlines now carry a colour of their own, the only change from the previous commit; ezdxf reads all files with no audit errors. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G2d2Zi8BfrYRPX88zhaoFG --- sources/dxfexport.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sources/dxfexport.cpp b/sources/dxfexport.cpp index 0ac1182b8..182634f38 100644 --- a/sources/dxfexport.cpp +++ b/sources/dxfexport.cpp @@ -282,7 +282,10 @@ void DxfExport::write(Diagram *diagram, int width, int height, poly << cond->pos()+segment->secondPoint(); } Createdxf::layer = Layer::Wires; - Createdxf::drawPolyline(file_path,poly,0); + //The wire's own colour, as on the folio (a two-colour wire gets + //its main one). Black comes out as BYLAYER, see Createdxf. + const ConductorProperties wire_properties = cond -> properties(); + Createdxf::drawPolyline(file_path, poly, Createdxf::dxfColor(wire_properties.color)); //Draw conductor text item Createdxf::layer = Layer::WireNumbers; ConductorTextItem *textItem = cond -> textItem(); @@ -306,7 +309,8 @@ void DxfExport::write(Diagram *diagram, int width, int height, qreal offset = fontSize * 1.6; foreach (QString line, lines) { if (line.size() > 0 && line != "_" ) - Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, 0, 0.72 ); + Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, + Createdxf::dxfColor(wire_properties.text_color), 0.72 ); x += offset * xdir; y -= offset * ydir; }