Search in sources :

Example 1 with RotateProcessor

use of com.willwinder.universalgcodesender.gcode.processors.RotateProcessor in project Universal-G-Code-Sender by winder.

the class AbstractRotateAction method performAction.

@Override
protected void performAction(Node[] activatedNodes) {
    if (!isEnabled()) {
        return;
    }
    ThreadHelper.invokeLater(() -> {
        try {
            LoaderDialogHelper.showDialog("Rotating model", 1000);
            File gcodeFile = backend.getProcessedGcodeFile();
            Position center = getCenter(gcodeFile);
            RotateProcessor rotateProcessor = new RotateProcessor(center, rotation);
            backend.applyCommandProcessor(rotateProcessor);
        } catch (Exception ex) {
            GUIHelpers.displayErrorDialog(ex.getLocalizedMessage());
        } finally {
            LoaderDialogHelper.closeDialog();
        }
    });
}
Also used : Position(com.willwinder.universalgcodesender.model.Position) PartialPosition(com.willwinder.universalgcodesender.model.PartialPosition) RotateProcessor(com.willwinder.universalgcodesender.gcode.processors.RotateProcessor) File(java.io.File) GcodeParserException(com.willwinder.universalgcodesender.gcode.util.GcodeParserException) IOException(java.io.IOException)

Aggregations

RotateProcessor (com.willwinder.universalgcodesender.gcode.processors.RotateProcessor)1 GcodeParserException (com.willwinder.universalgcodesender.gcode.util.GcodeParserException)1 PartialPosition (com.willwinder.universalgcodesender.model.PartialPosition)1 Position (com.willwinder.universalgcodesender.model.Position)1 File (java.io.File)1 IOException (java.io.IOException)1