use of com.willwinder.universalgcodesender.model.UnitUtils.Units in project Universal-G-Code-Sender by winder.
the class AutoLevelerTopComponent method stateChanged.
/**
* The preview parameters were changed.
*/
@Override
public void stateChanged(ChangeEvent e) {
// This state change handler is only for the visualizer.
if (bulkChanges || scanner == null) {
return;
}
Units units = this.unitInch.isSelected() ? Units.INCH : Units.MM;
Settings.AutoLevelSettings autoLevelSettings = updateScanner(units);
autoLevelSettings.zSurface = getValue(this.zSurface);
autoLevelSettings.stepResolution = getValue(this.stepResolution);
// prevent infinite loop, only call when the stateChange event was triggered by a swing component.
if (e != null) {
settings.setAutoLevelSettings(autoLevelSettings);
}
}
use of com.willwinder.universalgcodesender.model.UnitUtils.Units in project Universal-G-Code-Sender by winder.
the class AutoLevelerTopComponent method useLoadedFileActionPerformed.
// GEN-LAST:event_settingsButtonActionPerformed
private void useLoadedFileActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_useLoadedFileActionPerformed
if (backend.getProcessedGcodeFile() == null) {
return;
}
FileStats fs = backend.getSettings().getFileStats();
Units u = this.unitMM.isSelected() ? Units.MM : Units.INCH;
Position min = fs.minCoordinate.getPositionIn(u);
Position max = fs.maxCoordinate.getPositionIn(u);
this.xMin.setValue(min.x);
this.yMin.setValue(min.y);
this.zMin.setValue(min.z);
this.xMax.setValue(max.x);
this.yMax.setValue(max.y);
this.zMax.setValue(max.z);
}
Aggregations