Skip to content

Commit

Permalink
Parser arc approximation degree mode added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Denvi committed Nov 27, 2015
1 parent 944d4fa commit 8b0b8f2
Show file tree
Hide file tree
Showing 15 changed files with 681 additions and 467 deletions.
14 changes: 9 additions & 5 deletions frmmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ void frmMain::loadSettings()
ui->sliSpindleSpeed->setValue(set.value("spindleSpeed", 0).toInt());
m_programSpeed = false;
m_settings.setLineWidth(set.value("lineWidth", 1).toDouble());
m_settings.setArcPrecision(set.value("arcPrecision", 0).toDouble());
m_settings.setArcLength(set.value("arcLength", 0).toDouble());
m_settings.setArcDegree(set.value("arcDegree", 0).toDouble());
m_settings.setArcDegreeMode(set.value("arcDegreeMode", true).toBool());
m_settings.setShowProgramCommands(set.value("showProgramCommands", 0).toBool());
m_settings.setShowUICommands(set.value("showUICommands", 0).toBool());
m_settings.setSafeZ(set.value("safeZ", 0).toDouble());
Expand Down Expand Up @@ -321,7 +323,9 @@ void frmMain::saveSettings()
set.setValue("jogStep", ui->txtJogStep->value());
set.setValue("spindleSpeed", ui->txtSpindleSpeed->text());
set.setValue("lineWidth", m_settings.lineWidth());
set.setValue("arcPrecision", m_settings.arcPrecision());
set.setValue("arcLength", m_settings.arcLength());
set.setValue("arcDegree", m_settings.arcDegree());
set.setValue("arcDegreeMode", m_settings.arcDegreeMode());
set.setValue("showProgramCommands", m_settings.showProgramCommands());
set.setValue("showUICommands", m_settings.showUICommands());
set.setValue("safeZ", m_settings.safeZ());
Expand Down Expand Up @@ -1424,7 +1428,7 @@ void frmMain::loadFile(QList<QString> data)
m_programModel.setData(m_programModel.index(m_programModel.rowCount() - 2, 5), QVariant(args));
}

updateProgramEstimatedTime(m_viewParser.getLinesFromParser(&gp, m_arcPrecision));
updateProgramEstimatedTime(m_viewParser.getLinesFromParser(&gp, m_settings.arcPrecision(), m_settings.arcDegreeMode()));

qDebug() << "model filled:" << time.elapsed();
time.start();
Expand Down Expand Up @@ -1746,7 +1750,7 @@ void frmMain::applySettings() {
m_heightMapBorderDrawer.setLineWidth(m_settings.lineWidth());
m_heightMapGridDrawer.setLineWidth(0.1);
m_heightMapInterpolationDrawer.setLineWidth(m_settings.lineWidth());
m_arcPrecision = m_settings.arcPrecision();
m_arcPrecision = m_settings.arcLength();
ui->glwVisualizer->setLineWidth(m_settings.lineWidth());
m_showAllCommands = m_settings.showProgramCommands();
m_safeZ = m_settings.safeZ();
Expand Down Expand Up @@ -1833,7 +1837,7 @@ void frmMain::updateParser()

parser->reset();

updateProgramEstimatedTime(parser->getLinesFromParser(&gp, m_arcPrecision));
updateProgramEstimatedTime(parser->getLinesFromParser(&gp, m_settings.arcPrecision(), m_settings.arcDegreeMode()));
m_currentDrawer->update();
ui->glwVisualizer->updateExtremes(m_currentDrawer);
updateControlsState();
Expand Down
33 changes: 29 additions & 4 deletions frmsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,39 @@ void frmSettings::setLineWidth(double lineWidth)
ui->txtLineWidth->setValue(lineWidth);
}

double frmSettings::arcLength()
{
return ui->txtArcLength->value();
}

void frmSettings::setArcLength(double arcPrecision)
{
ui->txtArcLength->setValue(arcPrecision);
}

double frmSettings::arcDegree()
{
return ui->txtArcDegree->value();
}

void frmSettings::setArcDegree(double arcDegree)
{
ui->txtArcDegree->setValue(arcDegree);
}

double frmSettings::arcPrecision()
{
return ui->txtArcPrecision->value();
return ui->radArcDegreeMode->isChecked() ? ui->txtArcDegree->value() : ui->txtArcLength->value();
}

bool frmSettings::arcDegreeMode()
{
return ui->radArcDegreeMode->isChecked();
}

void frmSettings::setArcPrecision(double arcPrecision)
void frmSettings::setArcDegreeMode(bool arcDegreeMode)
{
ui->txtArcPrecision->setValue(arcPrecision);
ui->radArcDegreeMode->setChecked(arcDegreeMode);
}

bool frmSettings::showProgramCommands()
Expand Down Expand Up @@ -485,7 +510,7 @@ void frmSettings::on_cmdDefaults_clicked()
setHeightmapProbingFeed(10);
setUnits(0);

setArcPrecision(0.0);
setArcLength(0.0);

setLineWidth(1.5);
setAntialiasing(true);
Expand Down
7 changes: 6 additions & 1 deletion frmsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ class frmSettings : public QDialog
void setZBuffer(bool zBuffer);
double lineWidth();
void setLineWidth(double lineWidth);
double arcLength();
void setArcLength(double arcLength);
double arcDegree();
void setArcDegree(double arcDegree);
double arcPrecision();
void setArcPrecision(double arcPrecision);
bool arcDegreeMode();
void setArcDegreeMode(bool arcDegreeMode);
bool showProgramCommands();
void setShowProgramCommands(bool showProgramCommands);
bool showUICommands();
Expand Down
175 changes: 144 additions & 31 deletions frmsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>582</width>
<width>578</width>
<height>490</height>
</rect>
</property>
Expand Down Expand Up @@ -83,9 +83,9 @@ QGroupBox {
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>361</width>
<height>1130</height>
<y>-274</y>
<width>386</width>
<height>1184</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
Expand Down Expand Up @@ -448,31 +448,87 @@ padding-top: 3;</string>
<string>Parser</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLabel" name="label_32">
<property name="text">
<string>Arc approximation segment size:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_6">
<widget class="QRadioButton" name="radArcLengthMode">
<property name="text">
<string>Arc approximation segment length:</string>
<string>by length</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="txtArcPrecision">
<widget class="QDoubleSpinBox" name="txtArcLength">
<property name="enabled">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="decimals">
<number>1</number>
<number>2</number>
</property>
<property name="maximum">
<double>99.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radArcDegreeMode">
<property name="text">
<string>by angle (deg.)</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="txtArcDegree">
<property name="enabled">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_11">
<property name="orientation">
Expand All @@ -488,6 +544,23 @@ padding-top: 3;</string>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_35">
<property name="styleSheet">
<string notr="true">color: blue;</string>
</property>
<property name="text">
<string>(used in visualizer and heightmap modification procedure)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -617,7 +690,7 @@ padding-top: 3;</string>
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="decimals">
<number>1</number>
<number>2</number>
</property>
<property name="maximum">
<double>99.000000000000000</double>
Expand Down Expand Up @@ -1256,7 +1329,17 @@ padding-top: 3;</string>
<tabstop>cboPort</tabstop>
<tabstop>cmdRefresh</tabstop>
<tabstop>cboBaud</tabstop>
<tabstop>txtArcPrecision</tabstop>
<tabstop>txtQueryStateTime</tabstop>
<tabstop>txtSafeZ</tabstop>
<tabstop>txtRapidSpeed</tabstop>
<tabstop>txtAcceleration</tabstop>
<tabstop>txtSpindleSpeedMin</tabstop>
<tabstop>txtSpindleSpeedMax</tabstop>
<tabstop>txtTouchCommand</tabstop>
<tabstop>txtHeightMapProbingFeed</tabstop>
<tabstop>cboUnits</tabstop>
<tabstop>radArcDegreeMode</tabstop>
<tabstop>txtArcDegree</tabstop>
<tabstop>txtLineWidth</tabstop>
<tabstop>chkAntialiasing</tabstop>
<tabstop>radMSAA</tabstop>
Expand All @@ -1268,19 +1351,17 @@ padding-top: 3;</string>
<tabstop>txtToolAngle</tabstop>
<tabstop>txtToolDiameter</tabstop>
<tabstop>txtToolLength</tabstop>
<tabstop>txtQueryStateTime</tabstop>
<tabstop>txtSafeZ</tabstop>
<tabstop>txtRapidSpeed</tabstop>
<tabstop>txtAcceleration</tabstop>
<tabstop>txtSpindleSpeedMin</tabstop>
<tabstop>txtSpindleSpeedMax</tabstop>
<tabstop>txtTouchCommand</tabstop>
<tabstop>txtHeightMapProbingFeed</tabstop>
<tabstop>cboUnits</tabstop>
<tabstop>chkShowProgramCommands</tabstop>
<tabstop>chkShowUICommands</tabstop>
<tabstop>chkAutocompletion</tabstop>
<tabstop>chkPanelHeightmap</tabstop>
<tabstop>chkPanelFeed</tabstop>
<tabstop>chkPanelSpindle</tabstop>
<tabstop>chkPanelJog</tabstop>
<tabstop>cboFontSize</tabstop>
<tabstop>cmdOK</tabstop>
<tabstop>cmdCancel</tabstop>
<tabstop>cmdDefaults</tabstop>
</tabstops>
<resources>
<include location="images.qrc"/>
Expand All @@ -1293,12 +1374,12 @@ padding-top: 3;</string>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>343</x>
<y>200</y>
<x>257</x>
<y>364</y>
</hint>
<hint type="destinationlabel">
<x>458</x>
<y>199</y>
<x>372</x>
<y>363</y>
</hint>
</hints>
</connection>
Expand All @@ -1309,12 +1390,12 @@ padding-top: 3;</string>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>343</x>
<y>200</y>
<x>257</x>
<y>364</y>
</hint>
<hint type="destinationlabel">
<x>514</x>
<y>199</y>
<x>428</x>
<y>363</y>
</hint>
</hints>
</connection>
Expand All @@ -1325,12 +1406,44 @@ padding-top: 3;</string>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>301</x>
<y>261</y>
<x>347</x>
<y>333</y>
</hint>
<hint type="destinationlabel">
<x>415</x>
<y>333</y>
</hint>
</hints>
</connection>
<connection>
<sender>radArcDegreeMode</sender>
<signal>toggled(bool)</signal>
<receiver>txtArcDegree</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>211</x>
<y>270</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>271</y>
</hint>
</hints>
</connection>
<connection>
<sender>radArcLengthMode</sender>
<signal>toggled(bool)</signal>
<receiver>txtArcLength</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>402</x>
<y>277</y>
</hint>
<hint type="destinationlabel">
<x>494</x>
<y>261</y>
<x>475</x>
<y>277</y>
</hint>
</hints>
</connection>
Expand Down
Loading

0 comments on commit 8b0b8f2

Please sign in to comment.