For calculating area a formula needs CurrentSeamAllowance variable.

This commit is contained in:
Roman Telezhynskyi 2023-03-30 15:41:37 +03:00
parent 69397c1404
commit e1e3a5106e

View File

@ -27,8 +27,9 @@
*************************************************************************/ *************************************************************************/
#include "vpiecearea.h" #include "vpiecearea.h"
#include "vpiecearea_p.h" #include "vpiecearea_p.h"
#include "../vpatterndb/vpiece.h" #include "../vpiece.h"
#include "../vpatterndb/vcontainer.h" #include "../vcontainer.h"
#include "vincrement.h"
#include <QRegularExpression> #include <QRegularExpression>
@ -48,17 +49,23 @@ VPieceArea::VPieceArea(PieceAreaType type, quint32 pieceId, const VPiece &piece,
QString shortName = PieceShortName(piece); QString shortName = PieceShortName(piece);
VContainer tempData = *data;
auto currentSA = new VIncrement(&tempData, currentSeamAllowance);
currentSA->SetFormula(piece.GetSAWidth(), QString().setNum(piece.GetSAWidth()), true);
tempData.AddVariable(currentSA);
if (type == PieceAreaType::External) if (type == PieceAreaType::External)
{ {
SetType(VarType::PieceExternalArea); SetType(VarType::PieceExternalArea);
SetName(pieceArea_ + shortName); SetName(pieceArea_ + shortName);
VInternalVariable::SetValue(FromPixel2(piece.ExternalArea(data), unit)); VInternalVariable::SetValue(FromPixel2(piece.ExternalArea(&tempData), unit));
} }
else else
{ {
SetType(VarType::PieceSeamLineArea); SetType(VarType::PieceSeamLineArea);
SetName(pieceSeamLineArea_ + shortName); SetName(pieceSeamLineArea_ + shortName);
VInternalVariable::SetValue(FromPixel2(piece.SeamLineArea(data), unit)); VInternalVariable::SetValue(FromPixel2(piece.SeamLineArea(&tempData), unit));
} }
} }