use of com.willwinder.ugs.nbp.designer.io.gcode.GcodeDesignWriter in project Universal-G-Code-Sender by winder.
the class DesignerTopComponent method generateGcode.
private void generateGcode() {
DesignWriter designWriter = new GcodeDesignWriter();
try {
File file = new File(Files.createTempDir(), dataObject.getName() + ".gcode");
designWriter.write(file, controller);
backend.setGcodeFile(file);
} catch (Exception e) {
throw new RuntimeException("Could not generate gcode");
}
}
use of com.willwinder.ugs.nbp.designer.io.gcode.GcodeDesignWriter in project Universal-G-Code-Sender by winder.
the class ExportGcodeAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
Optional<File> fileOptional = SwingHelpers.createFile("");
if (fileOptional.isPresent()) {
String path = fileOptional.get().getAbsolutePath();
boolean hasGcodeFileEnding = path.endsWith(".gcode") || path.endsWith(".nc") || path.endsWith(".txt");
if (!hasGcodeFileEnding) {
path = path + ".gcode";
}
Controller controller = CentralLookup.getDefault().lookup(Controller.class);
DesignWriter designWriter = new GcodeDesignWriter();
designWriter.write(new File(path), controller);
}
}
Aggregations