Sketcher: New Setting for improved dragging mode

This commit is contained in:
Abdullah Tahiri
2017-12-11 16:05:30 +01:00
committed by wmayer
parent 023e319b84
commit ad855c99e3
5 changed files with 38 additions and 19 deletions

View File

@@ -67,7 +67,7 @@ using namespace Part;
TYPESYSTEM_SOURCE(Sketcher::Sketch, Base::Persistence)
Sketch::Sketch()
: SolveTime(0), GCSsys(), ConstraintsCounter(0), isInitMove(false), isFine(true),
: SolveTime(0), RecalculateInitialSolutionWhileMovingPoint(false), GCSsys(), ConstraintsCounter(0), isInitMove(false), isFine(true),
defaultSolver(GCS::DogLeg),defaultSolverRedundant(GCS::DogLeg),debugMode(GCS::Minimal)
{
}
@@ -3199,7 +3199,7 @@ int Sketch::movePoint(int geoId, PointPos pos, Base::Vector3d toPoint, bool rela
moveStep = 0;
}
else {
if(!relative) {
if(!relative && RecalculateInitialSolutionWhileMovingPoint) {
if (moveStep == 0) {
moveStep = (toPoint-initToPoint).Length();
}

View File

@@ -348,6 +348,7 @@ public:
};
float SolveTime;
bool RecalculateInitialSolutionWhileMovingPoint;
protected:
/// container element to store and work with the geometric elements of this sketch

View File

@@ -101,6 +101,7 @@ void SketcherSettings::saveSettings()
ui->continueMode->onSave();
ui->constraintMode->onSave();
ui->checkBoxAdvancedSolverTaskBox->onSave();
ui->checkBoxRecalculateInitialSolutionWhileDragging->onSave();
ui->checkBoxTVHideDependent->onSave();
ui->checkBoxTVShowLinks->onSave();
ui->checkBoxTVShowSupport->onSave();
@@ -126,6 +127,7 @@ void SketcherSettings::loadSettings()
ui->continueMode->onRestore();
ui->constraintMode->onRestore();
ui->checkBoxAdvancedSolverTaskBox->onRestore();
ui->checkBoxRecalculateInitialSolutionWhileDragging->onRestore();
ui->checkBoxTVHideDependent->onRestore();
ui->checkBoxTVShowLinks->onRestore();
ui->checkBoxTVShowSupport->onRestore();

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>427</width>
<height>492</height>
<width>602</width>
<height>653</height>
</rect>
</property>
<property name="windowTitle">
@@ -306,23 +306,10 @@
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Sketch Solver</string>
<string>Sketcher Solver</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
@@ -341,6 +328,31 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Dragging Performance</string>
</property>
<layout class="QGridLayout" name="gridLayout_5" rowstretch="0,0" columnstretch="0,0">
<item row="1" column="0" colspan="2">
<widget class="Gui::PrefCheckBox" name="checkBoxRecalculateInitialSolutionWhileDragging">
<property name="text">
<string>Improve solving while dragging (requires to re-enter edit mode to take effect)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>RecalculateInitialSolutionWhileDragging</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View File

@@ -334,7 +334,6 @@ ViewProviderSketch::ViewProviderSketch()
//rubberband selection
rubberband = new Gui::Rubberband();
}
ViewProviderSketch::~ViewProviderSketch()
@@ -5257,6 +5256,11 @@ bool ViewProviderSketch::setEdit(int ModNum)
connectRedoDocument = Gui::Application::Instance->activeDocument()
->signalRedoDocument.connect(boost::bind(&ViewProviderSketch::slotRedoDocument, this, _1));
// Enable solver initial solution update while dragging.
ParameterGrp::handle hGrp2 = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
getSketchObject()->getSolvedSketch().RecalculateInitialSolutionWhileMovingPoint = hGrp2->GetBool("RecalculateInitialSolutionWhileDragging",true);
return true;
}