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:
@@ -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"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user