Merge pull request #1071 from abdullahtahiriyo/restore_carbon_copy_interbody

Sketcher: Restore inter-body expression engine links in Carbon Copy
This commit is contained in:
Yorik van Havre
2017-11-03 11:40:48 -02:00
committed by GitHub
3 changed files with 16 additions and 3 deletions

View File

@@ -99,6 +99,7 @@ SketchObject::SketchObject()
ADD_PROPERTY_TYPE(Constraints, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch constraints");
ADD_PROPERTY_TYPE(ExternalGeometry,(0,0),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry");
allowOtherBody = true;
allowUnaligned = true;
for (std::vector<Part::Geometry *>::iterator it=ExternalGeo.begin(); it != ExternalGeo.end(); ++it)
@@ -2090,14 +2091,14 @@ bool SketchObject::isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject
App::Part* part_obj = App::Part::getPartOfObject(pObj);
if (part_this == part_obj){ //either in the same part, or in the root of document
if (body_this != NULL) {
if (body_this != body_obj) {
if ((body_this != body_obj) && !this->allowOtherBody) {
if (rsn)
*rsn = rlOtherBody;
return false;
}
}
} else {
// cross-part link. Disallow, should be done via shapebinders only
// cross-part relation. Disallow, should be done via shapebinders only
if (rsn)
*rsn = rlOtherPart;
return false;

View File

@@ -305,6 +305,14 @@ public:
/// gets the solved sketch as a reference
inline Sketch &getSolvedSketch(void) {return solvedSketch;}
/// Flag to allow external geometry from other bodies than the one this sketch belongs to
bool isAllowedOtherBody() const {
return allowOtherBody;
}
void setAllowOtherBody(bool on) {
allowOtherBody = on;
}
/// Flag to allow carbon copy from misaligned geometry
bool isAllowedUnaligned() const {
return allowUnaligned;
@@ -349,6 +357,9 @@ protected:
std::vector<Part::Geometry *> supportedGeometry(const std::vector<Part::Geometry *> &geoList) const;
private:
/// Flag to allow external geometry from other bodies than the one this sketch belongs to
bool allowOtherBody;
/// Flag to allow carbon copy from misaligned geometry
bool allowUnaligned;

View File

@@ -6535,6 +6535,7 @@ namespace SketcherGui {
Q_UNUSED(sSubName);
Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(object);
sketch->setAllowOtherBody(QApplication::keyboardModifiers() == Qt::ControlModifier || QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier));
sketch->setAllowUnaligned(QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier));
this->notAllowedReason = "";
@@ -6550,7 +6551,7 @@ namespace SketcherGui {
this->notAllowedReason = QT_TR_NOOP("This object is in another document.");
break;
case Sketcher::SketchObject::rlOtherBody:
this->notAllowedReason = QT_TR_NOOP("This object belongs to another body.");
this->notAllowedReason = QT_TR_NOOP("This object belongs to another body. Hold Ctrl to allow crossreferences.");
break;
case Sketcher::SketchObject::rlOtherPart:
this->notAllowedReason = QT_TR_NOOP("This object belongs to another part.");