Sketcher: Disable autoscale if new constraint value is below precision

As the title says - we can get into a scenario where user can specify
constraint equal to 0.0, or similar small value and the scale factor
will become 0 as well, resulting in all geometry trying to be rescaled
to degenerate geometry.

So this patch filters those values out, and bails out from auto-scaling
leaving only solver to handle this value.
This commit is contained in:
tetektoza
2025-08-24 20:46:41 +02:00
committed by Chris Hennes
parent 5287e3f4a6
commit 7c4131c4ef

View File

@@ -102,6 +102,14 @@ public:
public:
void executeCommands() override
{
// validate scale factor to prevent geometric collapse and crashes
if (scaleFactor <= Precision::Confusion() || !std::isfinite(scaleFactor)) {
THROWM(
Base::ValueError,
QT_TRANSLATE_NOOP("Notifications",
"Invalid scale factor. Scale factor must be a positive number."));
}
try {
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Scale geometries"));