Sketcher: Fix Freeze in Offset with too large negative value (#23467)

* Sketcher: Fix Freeze in Offset with too large negative value

* Remove ErrorMessages when offsetting circles with too large negative value

* fix linting comment

* Add Error feedback

---------

Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
This commit is contained in:
matthiasdanner
2025-09-12 17:52:33 +02:00
committed by GitHub
parent 34f4f16383
commit 5d76be01e1

View File

@@ -259,7 +259,7 @@ private:
TopoDS_Shape offsetShape = mkOffset.Shape();
if (offsetShape.IsNull()) {
throw Base::CADKernelError("makeOffset2D: result of offsetting is null!");
return offsetShape;
}
// Copying shape to fix strange orientation behavior, OCC7.0.0. See bug #2699
@@ -344,6 +344,9 @@ private:
std::vector<int>& listOfOffsetGeoIds)
{
TopoDS_Shape offsetShape = makeOffsetShape();
if (offsetShape.IsNull()) {
return;
}
TopExp_Explorer expl(offsetShape, TopAbs_EDGE);
int geoIdToAdd = firstCurveCreated;
@@ -383,6 +386,15 @@ private:
getOffsetGeos(geometriesToAdd, listOfOffsetGeoIds);
SketchObject* Obj = sketchgui->getSketchObject();
if (listOfOffsetGeoIds.empty()) {
Gui::NotifyUserError(
Obj,
QT_TRANSLATE_NOOP("Notifications", "Offset Error"),
QT_TRANSLATE_NOOP("Notifications", "Offset could not be created."));
return;
}
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Offset"));
// Create geos
@@ -403,6 +415,9 @@ private:
void jointOffsetCurves(std::vector<int>& listOfOffsetGeoIds)
{
if (listOfOffsetGeoIds.empty()) {
return;
}
std::stringstream stream;
stream << "conList = []\n";
for (size_t i = 0; i < listOfOffsetGeoIds.size() - 1; i++) {