re-enable sketcher to reference elements of other body

This commit is contained in:
wmayer
2017-10-05 15:20:39 +02:00
parent 67b990c2b5
commit 1d17c043eb
3 changed files with 22 additions and 6 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");
ExternalGeometry.setScope(App::LinkScope::Global);
allowOtherBody = true;
allowUnaligned = true;

View File

@@ -306,9 +306,19 @@ public:
inline Sketch &getSolvedSketch(void) {return solvedSketch;}
/// Flag to allow external geometry from other bodies than the one this sketch belongs to
bool allowOtherBody;
bool isAllowedOtherBody() const {
return allowOtherBody;
}
void setAllowOtherBody(bool on) {
allowOtherBody = on;
}
/// Flag to allow carbon copy from misaligned geometry
bool allowUnaligned;
bool isAllowedUnaligned() const {
return allowUnaligned;
}
void setAllowUnaligned(bool on) {
allowUnaligned = on;
}
enum eReasonList{
rlAllowed,
@@ -346,6 +356,11 @@ 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;
std::vector<Part::Geometry *> ExternalGeo;
std::vector<int> VertexId2GeoId;

View File

@@ -6308,7 +6308,7 @@ namespace SketcherGui {
bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName)
{
Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(object);
sketch->allowOtherBody = (QApplication::keyboardModifiers() == Qt::ControlModifier);
sketch->setAllowOtherBody(QApplication::keyboardModifiers() == Qt::ControlModifier);
this->notAllowedReason = "";
Sketcher::SketchObject::eReasonList msg;
@@ -6536,9 +6536,9 @@ namespace SketcherGui {
Q_UNUSED(sSubName);
Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(object);
sketch->allowOtherBody = (QApplication::keyboardModifiers() == Qt::ControlModifier || QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier));
sketch->allowUnaligned = QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier);
sketch->setAllowOtherBody(QApplication::keyboardModifiers() == Qt::ControlModifier || QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier));
sketch->setAllowUnaligned(QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier));
this->notAllowedReason = "";
Sketcher::SketchObject::eReasonList msg;
// Reusing code: All good reasons not to allow a carbon copy