Sketcher: Bug fix: Constraints dissapear after a sketch loses support

=====================================================================

Issue:
http://freecadweb.org/tracker/view.php?id=2292

Constraints dissapear after a sketch loses support

Steps To Reproduce:
1. Make a sketch on a face.
2. Constrain it
3. Select "reorient sketch"
4. Do you want to lose support? Yes
5. Click cancel on the reorientation dialog.
6. Enter edit mode: No constraints...

Why?
GeoUndef not checked when deleting all external geometry (on dettaching from the support).

Solution:
Check for GeoUndef.
This commit is contained in:
Abdullah Tahiri 2015-10-13 14:13:21 +02:00 committed by wmayer
parent 1d04ce9ea0
commit dc224265fa

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2008 *
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2008 *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@ -2754,7 +2754,9 @@ int SketchObject::delAllExternal()
std::vector< Constraint * > newConstraints(0);
for (std::vector<Constraint *>::const_iterator it = constraints.begin(); it != constraints.end(); ++it) {
if ((*it)->First > -3 && (*it)->Second > -3 && (*it)->Third > -3) {
if ((*it)->First > -3 &&
((*it)->Second > -3 || (*it)->Second == Constraint::GeoUndef ) &&
((*it)->Third > -3 || (*it)->Third == Constraint::GeoUndef) ) {
Constraint *copiedConstr = (*it)->clone();
newConstraints.push_back(copiedConstr);