[PD] prevent invalid helix geometry

in the height-turns-growth model height and growth must not be equally zero
This commit is contained in:
Uwe
2021-11-29 01:34:03 +01:00
parent c302582823
commit 4a3d211378

View File

@@ -128,11 +128,14 @@ App::DocumentObjectExecReturn *Helix::execute(void)
if (Height.getValue() < Precision::Confusion())
return new App::DocumentObjectExecReturn("Error: height too small!");
if (Turns.getValue() < Precision::Confusion())
return new App::DocumentObjectExecReturn("Error turns too small!");
return new App::DocumentObjectExecReturn("Error: turns too small!");
Pitch.setValue(Height.getValue()/Turns.getValue());
} else if (mode == HelixMode::height_turns_growth) {
if (Turns.getValue() < Precision::Confusion())
return new App::DocumentObjectExecReturn("Error turns too small!");
return new App::DocumentObjectExecReturn("Error: turns too small!");
if ((Height.getValue() < Precision::Confusion())
&& (Growth.getValue() < Precision::Confusion()))
return new App::DocumentObjectExecReturn("Error: either height or growth must not be zero!");
Pitch.setValue(Height.getValue()/Turns.getValue());
} else {
return new App::DocumentObjectExecReturn("Error: unsupported mode");