Fix rotation of piece label when export to DXF AAMA/ASTM.

This commit is contained in:
Roman Telezhynskyi 2024-01-31 18:07:54 +02:00
parent 2a3970559d
commit 4e05c704cc

View file

@ -1151,21 +1151,26 @@ void VDxfEngine::ExportPieceText(const QSharedPointer<dx_ifaceBlock> &detailBloc
textLine->text = tl.m_qsText.toStdString(); textLine->text = tl.m_qsText.toStdString();
textLine->style = m_input->AddFont(fnt); 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()) if (detail.IsVerticallyFlipped() && detail.IsHorizontallyFlipped())
{ {
textLine->angle = angle + 180; textLine->angle = labelAngle + 180;
} }
else if (detail.IsVerticallyFlipped()) else if (detail.IsVerticallyFlipped())
{ {
textLine->angle = -angle; textLine->angle = -labelAngle;
} }
else if (detail.IsHorizontallyFlipped()) else if (detail.IsHorizontallyFlipped())
{ {
textLine->angle = -angle - 180; textLine->angle = -labelAngle - 180;
} }
else else
{ {
textLine->angle = angle; textLine->angle = labelAngle;
} }
detailBlock->ent.push_back(textLine); detailBlock->ent.push_back(textLine);