[TD]correct retrieval of dim text for DXF export

This commit is contained in:
Wanderer Fan
2022-02-11 13:19:21 -05:00
committed by WandererFan
parent 29b940fb66
commit 1f1012f7a9
2 changed files with 16 additions and 2 deletions

View File

@@ -709,7 +709,18 @@ private:
double parentX = dvp->X.getValue() + grandParentX;
double parentY = dvp->Y.getValue() + grandParentY;
Base::Vector3d parentPos(parentX,parentY,0.0);
std::string sDimText = dvd->getFormattedDimensionValue();
std::string sDimText;
//this is the same code as in QGIViewDimension::updateDim
if (dvd->isMultiValueSchema()) {
sDimText = dvd->getFormattedDimensionValue(0); //don't format multis
} else {
sDimText = dvd->getFormattedDimensionValue(1); //just the number pref/spec/suf
if (dvd->showUnits()) {
std::string unitText = dvd->getFormattedDimensionValue(
2);
sDimText += " " + unitText;
}
}
char* dimText = &sDimText[0u]; //hack for const-ness
float gap = 5.0; //hack. don't know font size here.
layerName = dvd->getNameInDocument();

View File

@@ -780,7 +780,7 @@ std::string DrawViewDimension::formatValue(qreal value, QString qFormatSpec, int
qMultiValueStr = formatPrefix + qUserString + formatSuffix;
}
return qMultiValueStr.toStdString();
} else {
} else { //not multivalue schema
if (formatSpecifier.isEmpty()) {
Base::Console().Warning("Warning - no numeric format in Format Spec %s - %s\n",
qPrintable(qFormatSpec), getNameInDocument());
@@ -937,6 +937,9 @@ std::pair<std::string, std::string> DrawViewDimension::getFormattedToleranceValu
return tolerances;
}
//partial = 0 full text for multi-value schemas
//partial = 1 value only
//partial = 2 unit only
std::string DrawViewDimension::getFormattedDimensionValue(int partial)
{
QString qFormatSpec = QString::fromUtf8(FormatSpec.getStrValue().data());