Fixed bug that did not allow selecting datum planes as external references in sketches

This commit is contained in:
Jan Rheinländer 2013-12-04 20:40:37 +01:00 committed by Stefan Tröger
parent 0b28a757ab
commit 273e0f0b71
2 changed files with 9 additions and 5 deletions

View File

@ -1707,10 +1707,11 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p
{
// Externals outside of the Document are NOT allowed
if (this->getDocument() != pDoc)
return false;
return false;
// Note: Checking for the body of the support doesn't work when the support are the three base planes
App::DocumentObject *support = this->Support.getValue();
Part::BodyBase* body = Part::BodyBase::findBodyOf(support);
Part::BodyBase* body = Part::BodyBase::findBodyOf(this);
if (body != NULL) {
if (Part::BodyBase::findBodyOf(pObj) != body) {
// Selection outside of body not allowed if flag is not set

View File

@ -4478,8 +4478,8 @@ namespace SketcherGui {
if (!sketch->isExternalAllowed(pDoc, pObj))
return false;
App::DocumentObject *support = sketch->Support.getValue();
Part::BodyBase* body = Part::BodyBase::findBodyOf(support);
// Note: its better to search the support of the sketch in case the sketch support is a base plane
Part::BodyBase* body = Part::BodyBase::findBodyOf(sketch);
if ((body != NULL) && (Part::BodyBase::findBodyOf(pObj) == body) && body->isAfterTip(pObj))
// Don't allow selection after the Tip feature in the same body
return false;
@ -4491,7 +4491,10 @@ namespace SketcherGui {
(element.size() > 6 && element.substr(0,6) == "Vertex") ||
(element.size() > 4 && element.substr(0,4) == "Face")) {
return true;
}
}
if (pObj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) ||
pObj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId()))
return true;
return false;
}
};