From 4e05c704cc0a8917a4c0d9dfcd91787620e4c422 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 31 Jan 2024 18:07:54 +0200 Subject: [PATCH] Fix rotation of piece label when export to DXF AAMA/ASTM. --- src/libs/vdxf/vdxfengine.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libs/vdxf/vdxfengine.cpp b/src/libs/vdxf/vdxfengine.cpp index b56b50727..70a1eea19 100644 --- a/src/libs/vdxf/vdxfengine.cpp +++ b/src/libs/vdxf/vdxfengine.cpp @@ -1151,21 +1151,26 @@ void VDxfEngine::ExportPieceText(const QSharedPointer &detailBloc textLine->text = tl.m_qsText.toStdString(); textLine->style = m_input->AddFont(fnt); + QLineF string(0, 0, 100, 0); + string.setAngle(angle); + string = lineMatrix.map(string); + const qreal labelAngle = string.angle(); + if (detail.IsVerticallyFlipped() && detail.IsHorizontallyFlipped()) { - textLine->angle = angle + 180; + textLine->angle = labelAngle + 180; } else if (detail.IsVerticallyFlipped()) { - textLine->angle = -angle; + textLine->angle = -labelAngle; } else if (detail.IsHorizontallyFlipped()) { - textLine->angle = -angle - 180; + textLine->angle = -labelAngle - 180; } else { - textLine->angle = angle; + textLine->angle = labelAngle; } detailBlock->ent.push_back(textLine);