Merge branch 'master' into bugfix/path-tag-dressup-issue
This commit is contained in:
@@ -38,7 +38,7 @@ using namespace Gui::TaskView;
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
TaskDialog::TaskDialog()
|
||||
: QObject(0), pos(North)
|
||||
: QObject(0), pos(North), escapeButton(true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -67,6 +67,14 @@ public:
|
||||
virtual void modifyStandardButtons(QDialogButtonBox*)
|
||||
{}
|
||||
|
||||
/// Defines whether a task dialog can be rejected by pressing Esc
|
||||
void setEscapeButtonEnabled(bool on) {
|
||||
escapeButton = on;
|
||||
}
|
||||
bool isEscapeButtonEnabled() const {
|
||||
return escapeButton;
|
||||
}
|
||||
|
||||
const std::string& getDocumentName() const
|
||||
{ return documentName; }
|
||||
void setDocumentName(const std::string& doc)
|
||||
@@ -118,6 +126,7 @@ protected:
|
||||
|
||||
private:
|
||||
std::string documentName;
|
||||
bool escapeButton;
|
||||
};
|
||||
|
||||
} //namespace TaskView
|
||||
|
||||
@@ -477,7 +477,7 @@ void TaskView::keyPressEvent(QKeyEvent* ke)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ke->key() == Qt::Key_Escape) {
|
||||
else if (ke->key() == Qt::Key_Escape && ActiveDialog->isEscapeButtonEnabled()) {
|
||||
// get only the buttons of the button box
|
||||
QDialogButtonBox* box = ActiveCtrl->standardButtons();
|
||||
QList<QAbstractButton*> list = box->buttons();
|
||||
|
||||
@@ -150,7 +150,7 @@ class DressupPathBoundary(object):
|
||||
commands.extend(self.boundaryCommands(obj, lastExit, pos, tc.VertFeed.Value))
|
||||
lastExit = None
|
||||
PathLog.track(e, flip)
|
||||
commands.extend(PathGeom.cmdsForEdge(e, flip, False))
|
||||
commands.extend(PathGeom.cmdsForEdge(e, flip, False,50,tc.HorizFeed.Value,tc.VertFeed.Value)) # add missing HorizFeed to G2 paths
|
||||
inside.remove(e)
|
||||
pos = newPos
|
||||
lastExit = newPos
|
||||
|
||||
@@ -59,6 +59,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
'''initPocketOp(obj) ... create facing specific properties'''
|
||||
obj.addProperty("App::PropertyEnumeration", "BoundaryShape", "Face", QtCore.QT_TRANSLATE_NOOP("App::Property", "Shape to use for calculating Boundary"))
|
||||
obj.BoundaryShape = ['Perimeter', 'Boundbox', 'Stock']
|
||||
obj.addProperty("App::PropertyBool", "ClearEdges", "Face", QtCore.QT_TRANSLATE_NOOP("App::Property", "Clear edges"))
|
||||
|
||||
if not hasattr(obj, 'ExcludeRaisedAreas'):
|
||||
obj.addProperty("App::PropertyBool", "ExcludeRaisedAreas", "Face", QtCore.QT_TRANSLATE_NOOP("App::Property", "Exclude milling raised areas inside the face."))
|
||||
@@ -98,7 +99,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
'''areaOpShapes(obj) ... return top face'''
|
||||
# Facing is done either against base objects
|
||||
holeShape = None
|
||||
|
||||
|
||||
if obj.Base:
|
||||
PathLog.debug("obj.Base: {}".format(obj.Base))
|
||||
faces = []
|
||||
@@ -146,6 +147,17 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
# Find the correct shape depending on Boundary shape.
|
||||
PathLog.debug("Boundary Shape: {}".format(obj.BoundaryShape))
|
||||
bb = planeshape.BoundBox
|
||||
|
||||
# Apply offset for clearing edges
|
||||
offset = 0;
|
||||
if obj.ClearEdges == True:
|
||||
offset = self.radius + 0.1
|
||||
|
||||
bb.XMin = bb.XMin - offset
|
||||
bb.YMin = bb.YMin - offset
|
||||
bb.XMax = bb.XMax + offset
|
||||
bb.YMax = bb.YMax + offset
|
||||
|
||||
if obj.BoundaryShape == 'Boundbox':
|
||||
bbperim = Part.makeBox(bb.XLength, bb.YLength, 1, FreeCAD.Vector(bb.XMin, bb.YMin, bb.ZMin), FreeCAD.Vector(0, 0, 1))
|
||||
env = PathUtils.getEnvelope(partshape=bbperim, depthparams=self.depthparams)
|
||||
@@ -158,6 +170,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
elif obj.BoundaryShape == 'Stock':
|
||||
stock = PathUtils.findParentJob(obj).Stock.Shape
|
||||
env = stock
|
||||
|
||||
if obj.ExcludeRaisedAreas is True and oneBase[1] is True:
|
||||
includedFaces = self.getAllIncludedFaces(oneBase[0], stock, faceZ=minHeight)
|
||||
if len(includedFaces) > 0:
|
||||
@@ -181,6 +194,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
obj.StepOver = 50
|
||||
obj.ZigZagAngle = 45.0
|
||||
obj.ExcludeRaisedAreas = False
|
||||
obj.ClearEdges = False
|
||||
|
||||
# need to overwrite the default depth calculations for facing
|
||||
if job and len(job.Model.Group) > 0:
|
||||
@@ -209,6 +223,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
|
||||
def getAllIncludedFaces(self, base, env, faceZ):
|
||||
included = []
|
||||
|
||||
eXMin = env.BoundBox.XMin
|
||||
eXMax = env.BoundBox.XMax
|
||||
eYMin = env.BoundBox.YMin
|
||||
@@ -239,6 +254,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
|
||||
fYMax = face.BoundBox.YMax
|
||||
# fZMin = face.BoundBox.ZMin
|
||||
fZMax = face.BoundBox.ZMax
|
||||
|
||||
if fZMax > eZMin:
|
||||
if isOverlap(fXMin, fXMax, eXMin, eXMax) is True:
|
||||
if isOverlap(fYMin, fYMax, eYMin, eYMax) is True:
|
||||
@@ -252,6 +268,8 @@ def SetupProperties():
|
||||
setup = PathPocketBase.SetupProperties()
|
||||
setup.append("BoundaryShape")
|
||||
setup.append("ExcludeRaisedAreas")
|
||||
setup.append("ClearEdges")
|
||||
|
||||
return setup
|
||||
|
||||
|
||||
@@ -260,4 +278,5 @@ def Create(name, obj=None):
|
||||
if obj is None:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
|
||||
obj.Proxy = ObjectFace(obj, name)
|
||||
|
||||
return obj
|
||||
|
||||
@@ -70,6 +70,7 @@ void SketcherSettings::saveSettings()
|
||||
// Sketch editing
|
||||
ui->checkBoxAdvancedSolverTaskBox->onSave();
|
||||
ui->checkBoxRecalculateInitialSolutionWhileDragging->onSave();
|
||||
ui->checkBoxEnableEscape->onSave();
|
||||
ui->checkBoxNotifyConstraintSubstitutions->onSave();
|
||||
form->saveSettings();
|
||||
}
|
||||
@@ -79,6 +80,7 @@ void SketcherSettings::loadSettings()
|
||||
// Sketch editing
|
||||
ui->checkBoxAdvancedSolverTaskBox->onRestore();
|
||||
ui->checkBoxRecalculateInitialSolutionWhileDragging->onRestore();
|
||||
ui->checkBoxEnableEscape->onRestore();
|
||||
ui->checkBoxNotifyConstraintSubstitutions->onRestore();
|
||||
form->loadSettings();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ private Q_SLOTS:
|
||||
|
||||
private:
|
||||
Ui_SketcherSettingsDisplay* ui;
|
||||
SketcherGeneralWidget* form;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,9 +106,28 @@ Requires to re-enter edit mode to take effect.</string>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Notifications</string>
|
||||
<string>General</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxEnableEscape">
|
||||
<property name="toolTip">
|
||||
<string>Allow to leave sketch edit mode when pressing Esc button</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Esc can leave sketch edit mode</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>LeaveSketchWithEscape</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Sketcher</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxNotifyConstraintSubstitutions">
|
||||
<property name="toolTip">
|
||||
|
||||
@@ -50,6 +50,7 @@ TaskDlgEditSketch::TaskDlgEditSketch(ViewProviderSketch *sketchView)
|
||||
SolverAdvanced = new TaskSketcherSolverAdvanced(sketchView);
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
setEscapeButtonEnabled(hGrp->GetBool("LeaveSketchWithEscape", true));
|
||||
|
||||
Content.push_back(Messages);
|
||||
|
||||
|
||||
@@ -204,6 +204,7 @@ struct EditData {
|
||||
DrawSketchHandler *sketchHandler;
|
||||
bool editDatumDialog;
|
||||
bool buttonPress;
|
||||
bool handleEscapeButton;
|
||||
|
||||
// dragged point
|
||||
int DragPoint;
|
||||
@@ -486,6 +487,10 @@ bool ViewProviderSketch::keyPressed(bool pressed, int key)
|
||||
if (!pressed && !edit->buttonPress)
|
||||
return true;
|
||||
edit->buttonPress = pressed;
|
||||
|
||||
// More control over Sketcher edit mode Esc key behavior
|
||||
// https://forum.freecadweb.org/viewtopic.php?f=3&t=42207
|
||||
return edit->handleEscapeButton;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -5651,6 +5656,9 @@ bool ViewProviderSketch::setEdit(int ModNum)
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
edit->MarkerSize = hGrp->GetInt("MarkerSize", 7);
|
||||
|
||||
ParameterGrp::handle hSketch = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
edit->handleEscapeButton = !hSketch->GetBool("LeaveSketchWithEscape", true);
|
||||
|
||||
createEditInventorNodes();
|
||||
|
||||
auto editDoc = Gui::Application::Instance->editDocument();
|
||||
|
||||
Reference in New Issue
Block a user