Search in sources :

Example 6 with Units

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);
    }
}
Also used : AutoLevelSettings(com.willwinder.universalgcodesender.utils.Settings.AutoLevelSettings) Units(com.willwinder.universalgcodesender.model.UnitUtils.Units) AutoLevelSettings(com.willwinder.universalgcodesender.utils.Settings.AutoLevelSettings) Settings(com.willwinder.universalgcodesender.utils.Settings)

Example 7 with Units

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);
}
Also used : Position(com.willwinder.universalgcodesender.model.Position) FileStats(com.willwinder.universalgcodesender.utils.Settings.FileStats) Units(com.willwinder.universalgcodesender.model.UnitUtils.Units)

Aggregations

Units (com.willwinder.universalgcodesender.model.UnitUtils.Units)7 Position (com.willwinder.universalgcodesender.model.Position)5 AutoLevelSettings (com.willwinder.universalgcodesender.utils.Settings.AutoLevelSettings)3 ImmutableList (com.google.common.collect.ImmutableList)1 GL2 (com.jogamp.opengl.GL2)1 ControlState (com.willwinder.universalgcodesender.model.UGSEvent.ControlState)1 Settings (com.willwinder.universalgcodesender.utils.Settings)1 FileStats (com.willwinder.universalgcodesender.utils.Settings.FileStats)1