Merge pull request #20105 from PaddleStroke/patch-15
Sketcher: DSH: add OVP constraints before AutoConstraints.
This commit is contained in:
@@ -491,10 +491,10 @@ protected:
|
||||
executeCommands();
|
||||
|
||||
if (sugConstraints.size() > 0) {
|
||||
generateAutoConstraints();
|
||||
|
||||
beforeCreateAutoConstraints();
|
||||
|
||||
generateAutoConstraints();
|
||||
|
||||
createAutoConstraints();
|
||||
}
|
||||
}
|
||||
@@ -988,13 +988,20 @@ protected:
|
||||
// redundants anymore
|
||||
}
|
||||
|
||||
// This is an awful situation. It should not be possible if the DSH works properly. It is
|
||||
// just a safeguard.
|
||||
// This can happen if OVP generated constraints and autoconstraints are conflicting
|
||||
// For instance : https://github.com/FreeCAD/FreeCAD/issues/17722
|
||||
if (sketchobject->getLastHasConflicts()) {
|
||||
THROWM(Base::RuntimeError,
|
||||
QT_TRANSLATE_NOOP(
|
||||
"Notifications",
|
||||
"Autoconstraints cause conflicting constraints - Please report!") "\n");
|
||||
auto lastsketchconstraintindex = sketchobject->Constraints.getSize() - 1;
|
||||
|
||||
auto conflicting = sketchobject->getLastConflicting();
|
||||
|
||||
for (int index = conflicting.size() - 1; index >= 0; index--) {
|
||||
int conflictingIndex = conflicting[index] - 1;
|
||||
if (conflictingIndex > lastsketchconstraintindex) {
|
||||
int removeindex = conflictingIndex - lastsketchconstraintindex - 1;
|
||||
AutoConstraints.erase(std::next(AutoConstraints.begin(), removeindex));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user