[Sketcher] Handle split curve corner case

It is possible to ask for splitting at an end point of the curve. This leads to
a `CADKernelError` and leaves us with a "hanging" clone. This check prevents that.
This commit is contained in:
Ajinkya Dahale
2022-12-13 21:45:06 +05:30
committed by abdullahtahiriyo
parent 7d9b24f2b7
commit ce08cebc1f

View File

@@ -3025,6 +3025,11 @@ int SketchObject::split(int GeoId, const Base::Vector3d &point)
endParam = curve->getLastParameter();
// TODO: Using parameter difference as a poor substitute of length.
// Computing length of an arc of a generic conic would be expensive.
if (endParam - splitParam < Precision::PConfusion() ||
splitParam - startParam < Precision::PConfusion()) {
THROWM(ValueError, "Split point is at one of the end points of the curve.");
return false;
}
if (endParam - splitParam > splitParam - startParam) {
longestPart = 1;
}