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

@ -1709,8 +1709,9 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p
if (this->getDocument() != pDoc) 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(); App::DocumentObject *support = this->Support.getValue();
Part::BodyBase* body = Part::BodyBase::findBodyOf(support); Part::BodyBase* body = Part::BodyBase::findBodyOf(this);
if (body != NULL) { if (body != NULL) {
if (Part::BodyBase::findBodyOf(pObj) != body) { if (Part::BodyBase::findBodyOf(pObj) != body) {
// Selection outside of body not allowed if flag is not set // Selection outside of body not allowed if flag is not set

View File

@ -4478,8 +4478,8 @@ namespace SketcherGui {
if (!sketch->isExternalAllowed(pDoc, pObj)) if (!sketch->isExternalAllowed(pDoc, pObj))
return false; return false;
App::DocumentObject *support = sketch->Support.getValue(); // 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(support); Part::BodyBase* body = Part::BodyBase::findBodyOf(sketch);
if ((body != NULL) && (Part::BodyBase::findBodyOf(pObj) == body) && body->isAfterTip(pObj)) if ((body != NULL) && (Part::BodyBase::findBodyOf(pObj) == body) && body->isAfterTip(pObj))
// Don't allow selection after the Tip feature in the same body // Don't allow selection after the Tip feature in the same body
return false; return false;
@ -4492,6 +4492,9 @@ namespace SketcherGui {
(element.size() > 4 && element.substr(0,4) == "Face")) { (element.size() > 4 && element.substr(0,4) == "Face")) {
return true; return true;
} }
if (pObj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) ||
pObj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId()))
return true;
return false; return false;
} }
}; };