Sketcher Bug fix: External geometry shown after reorient
======================================================================== Reported here: http://forum.freecadweb.org/viewtopic.php?f=10&t=12517&p=100388#p100429 Solution: When a sketch loses support, all external geometry is deleted right away.
This commit is contained in:
parent
56c29e27f7
commit
94851bc14f
|
@ -2737,6 +2737,48 @@ int SketchObject::delExternal(int ExtGeoId)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SketchObject::delAllExternal()
|
||||
{
|
||||
// get the actual lists of the externals
|
||||
std::vector<DocumentObject*> Objects = ExternalGeometry.getValues();
|
||||
std::vector<std::string> SubElements = ExternalGeometry.getSubValues();
|
||||
|
||||
const std::vector<DocumentObject*> originalObjects = Objects;
|
||||
const std::vector<std::string> originalSubElements = SubElements;
|
||||
|
||||
Objects.clear();
|
||||
|
||||
SubElements.clear();
|
||||
|
||||
const std::vector< Constraint * > &constraints = Constraints.getValues();
|
||||
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) {
|
||||
Constraint *copiedConstr = (*it)->clone();
|
||||
|
||||
newConstraints.push_back(copiedConstr);
|
||||
}
|
||||
}
|
||||
|
||||
ExternalGeometry.setValues(Objects,SubElements);
|
||||
try {
|
||||
rebuildExternalGeometry();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
// revert to original values
|
||||
ExternalGeometry.setValues(originalObjects,originalSubElements);
|
||||
return -1;
|
||||
}
|
||||
|
||||
solverNeedsUpdate=true;
|
||||
Constraints.setValues(newConstraints);
|
||||
Constraints.acceptGeometry(getCompleteGeometry());
|
||||
rebuildVertexIndex();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SketchObject::delConstraintsToExternal()
|
||||
{
|
||||
const std::vector< Constraint * > &constraints = Constraints.getValuesForce();
|
||||
|
|
|
@ -97,6 +97,9 @@ public:
|
|||
* external geometry
|
||||
*/
|
||||
int delExternal(int ExtGeoId);
|
||||
|
||||
/** deletes all external geometry */
|
||||
int delAllExternal();
|
||||
|
||||
/** returns a pointer to a given Geometry index, possible indexes are:
|
||||
* id>=0 for user defined geometries,
|
||||
|
|
|
@ -277,6 +277,7 @@ void CmdSketcherReorientSketch::activated(int iMsg)
|
|||
if (ret == QMessageBox::No)
|
||||
return;
|
||||
sketch->Support.setValue(0);
|
||||
sketch->delAllExternal();
|
||||
}
|
||||
|
||||
// ask user for orientation
|
||||
|
|
Loading…
Reference in New Issue
Block a user