Techdraw: Smart Dimension: Fixes and simplifies code
This commit is contained in:
@@ -91,9 +91,6 @@ std::string DimensionFormatter::formatValue(const qreal value,
|
||||
|
||||
QString qMultiValueStr;
|
||||
QString qBasicUnit = Base::Tools::fromStdString(Base::UnitsApi::getBasicLengthUnit());
|
||||
if (areaMeasure) {
|
||||
qBasicUnit = qBasicUnit + QString::fromUtf8("²");
|
||||
}
|
||||
|
||||
QString formattedValue;
|
||||
if (isMultiValueSchema() && partial == 0) {
|
||||
@@ -138,6 +135,10 @@ std::string DimensionFormatter::formatValue(const qreal value,
|
||||
else {
|
||||
double convertValue = Base::Quantity::parse(QString::fromLatin1("1") + qBasicUnit).getValue();
|
||||
userVal = asQuantity.getValue() / convertValue;
|
||||
if (areaMeasure) {
|
||||
userVal = userVal / convertValue; // divide again as area is length²
|
||||
qBasicUnit = qBasicUnit + QString::fromUtf8("²");
|
||||
}
|
||||
}
|
||||
|
||||
if (isTooSmall(userVal, formatSpecifier)) {
|
||||
|
||||
@@ -265,15 +265,7 @@ Part::TopoShape ReferenceEntry::asTopoShapeEdge(const TopoDS_Edge &edge)
|
||||
|
||||
Part::TopoShape ReferenceEntry::asTopoShapeFace(const TopoDS_Face &face)
|
||||
{
|
||||
// Base::Console().Message("RE::asTopoShapeFace()\n");
|
||||
TopoDS_Face unscaledFace = face;
|
||||
if (!is3d()) {
|
||||
// 2d reference - projected and scaled. scale might have changed, so we need to unscale
|
||||
auto dvp = static_cast<TechDraw::DrawViewPart*>(getObject());
|
||||
TopoDS_Shape unscaledShape = ShapeUtils::scaleShape(face, 1.0 / dvp->getScale());
|
||||
unscaledFace = TopoDS::Face(unscaledShape);
|
||||
}
|
||||
return { unscaledFace };
|
||||
return { face };
|
||||
}
|
||||
|
||||
std::string ReferenceEntry::geomType() const
|
||||
|
||||
Reference in New Issue
Block a user