mirror of
https://github.com/euphy/polargraphcontroller
synced 2024-11-15 02:37:56 +01:00
v1.2 Added g-code importing. And that weird cord offset thing
This commit is contained in:
parent
111a9b9478
commit
7aba28e403
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
|
||||||
|
|
||||||
|
*/
|
||||||
class DisplayMachine extends Machine
|
class DisplayMachine extends Machine
|
||||||
{
|
{
|
||||||
private Rectangle outline = null;
|
private Rectangle outline = null;
|
||||||
|
10
Machine.pde
10
Machine.pde
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,12 +24,8 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class Machine
|
class Machine
|
||||||
{
|
{
|
||||||
|
5
Misc.pde
5
Misc.pde
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Scaler
|
class Scaler
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class Panel
|
class Panel
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class Rectangle
|
class Rectangle
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
void button_mode_begin()
|
void button_mode_begin()
|
||||||
{
|
{
|
||||||
@ -719,4 +720,10 @@ void button_mode_sendButtonDeactivate()
|
|||||||
addToCommandQueue(CMD_DEACTIVATE_MACHINE_BUTTON+",END");
|
addToCommandQueue(CMD_DEACTIVATE_MACHINE_BUTTON+",END");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void numberbox_mode_previewCordOffsetValue(int value)
|
||||||
|
{
|
||||||
|
previewCordOffset = value;
|
||||||
|
lastCommandQueueHash = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,8 +24,10 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Set<String> getPanelNames()
|
Set<String> getPanelNames()
|
||||||
{
|
{
|
||||||
if (this.panelNames == null)
|
if (this.panelNames == null)
|
||||||
@ -500,6 +502,12 @@ Map<String, Controller> initialiseNumberboxValues(Map<String, Controller> map)
|
|||||||
n.setMax(PATH_LENGTH_HIGHPASS_CUTOFF_MAX);
|
n.setMax(PATH_LENGTH_HIGHPASS_CUTOFF_MAX);
|
||||||
n.setMultiplier(0.5);
|
n.setMultiplier(0.5);
|
||||||
}
|
}
|
||||||
|
else if (MODE_ADJUST_PREVIEW_CORD_OFFSET.equals(key))
|
||||||
|
{
|
||||||
|
n.setDecimalPrecision(1);
|
||||||
|
n.setValue(0);
|
||||||
|
n.setMultiplier(0.5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@ -689,6 +697,8 @@ List<String> getControlNamesForInputPanel()
|
|||||||
//controlNames.add(MODE_VECTOR_PATH_LENGTH_HIGHPASS_CUTOFF);
|
//controlNames.add(MODE_VECTOR_PATH_LENGTH_HIGHPASS_CUTOFF);
|
||||||
controlNames.add(MODE_RENDER_VECTORS);
|
controlNames.add(MODE_RENDER_VECTORS);
|
||||||
|
|
||||||
|
controlNames.add(MODE_ADJUST_PREVIEW_CORD_OFFSET);
|
||||||
|
|
||||||
controlNames.add(MODE_SHOW_IMAGE);
|
controlNames.add(MODE_SHOW_IMAGE);
|
||||||
controlNames.add(MODE_SHOW_VECTOR);
|
controlNames.add(MODE_SHOW_VECTOR);
|
||||||
controlNames.add(MODE_SHOW_QUEUE_PREVIEW);
|
controlNames.add(MODE_SHOW_QUEUE_PREVIEW);
|
||||||
@ -960,6 +970,8 @@ Map<String, String> buildControlLabels()
|
|||||||
result.put(MODE_SEND_BUTTON_ACTIVATE, "Activate button");
|
result.put(MODE_SEND_BUTTON_ACTIVATE, "Activate button");
|
||||||
result.put(MODE_SEND_BUTTON_DEACTIVATE, "Deactivate button");
|
result.put(MODE_SEND_BUTTON_DEACTIVATE, "Deactivate button");
|
||||||
|
|
||||||
|
result.put(MODE_ADJUST_PREVIEW_CORD_OFFSET, "Preview cord offset");
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1103,6 +1115,7 @@ Set<String> buildControlNames()
|
|||||||
result.add(MODE_SEND_BUTTON_ACTIVATE);
|
result.add(MODE_SEND_BUTTON_ACTIVATE);
|
||||||
result.add(MODE_SEND_BUTTON_DEACTIVATE);
|
result.add(MODE_SEND_BUTTON_DEACTIVATE);
|
||||||
|
|
||||||
|
result.add(MODE_ADJUST_PREVIEW_CORD_OFFSET);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static final String CMD_CHANGELENGTH = "C01,";
|
static final String CMD_CHANGELENGTH = "C01,";
|
||||||
static final String CMD_CHANGEPENWIDTH = "C02,";
|
static final String CMD_CHANGEPENWIDTH = "C02,";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2014.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
//import processing.video.*;
|
//import processing.video.*;
|
||||||
@ -51,8 +51,8 @@ import java.awt.event.KeyEvent;
|
|||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
int majorVersionNo = 1;
|
int majorVersionNo = 1;
|
||||||
int minorVersionNo = 10;
|
int minorVersionNo = 2;
|
||||||
int buildNo = 2;
|
int buildNo = 1;
|
||||||
|
|
||||||
String programTitle = "Polargraph Controller v" + majorVersionNo + "." + minorVersionNo + " build " + buildNo;
|
String programTitle = "Polargraph Controller v" + majorVersionNo + "." + minorVersionNo + " build " + buildNo;
|
||||||
ControlP5 cp5;
|
ControlP5 cp5;
|
||||||
@ -329,6 +329,8 @@ static final String MODE_ROTATE_WEBCAM_INPUT = "toggle_mode_rotateWebcam";
|
|||||||
static final String MODE_SEND_BUTTON_ACTIVATE = "button_mode_sendButtonActivate";
|
static final String MODE_SEND_BUTTON_ACTIVATE = "button_mode_sendButtonActivate";
|
||||||
static final String MODE_SEND_BUTTON_DEACTIVATE = "button_mode_sendButtonDeactivate";
|
static final String MODE_SEND_BUTTON_DEACTIVATE = "button_mode_sendButtonDeactivate";
|
||||||
|
|
||||||
|
static final String MODE_ADJUST_PREVIEW_CORD_OFFSET = "numberbox_mode_previewCordOffsetValue";
|
||||||
|
|
||||||
|
|
||||||
PVector statusTextPosition = new PVector(300.0, 12.0);
|
PVector statusTextPosition = new PVector(300.0, 12.0);
|
||||||
|
|
||||||
@ -395,6 +397,8 @@ public color guideColour = color(255);
|
|||||||
public color backgroundColour = color(100);
|
public color backgroundColour = color(100);
|
||||||
public color densityPreviewColour = color(0);
|
public color densityPreviewColour = color(0);
|
||||||
|
|
||||||
|
public Integer previewCordOffset = 0;
|
||||||
|
|
||||||
|
|
||||||
public boolean showingSummaryOverlay = true;
|
public boolean showingSummaryOverlay = true;
|
||||||
public boolean showingDialogBox = false;
|
public boolean showingDialogBox = false;
|
||||||
@ -505,14 +509,7 @@ String shapeSavePath = "../../savedcaptures/";
|
|||||||
String shapeSavePrefix = "shape-";
|
String shapeSavePrefix = "shape-";
|
||||||
String shapeSaveExtension = ".svg";
|
String shapeSaveExtension = ".svg";
|
||||||
|
|
||||||
//boolean displayGamepadOverlay = false;
|
static Float gcodeZAxisDrawingHeight = 1.0; //-0.125000;
|
||||||
//PImage yButtonImage = null;
|
|
||||||
//PImage xButtonImage = null;
|
|
||||||
//PImage aButtonImage = null;
|
|
||||||
//PImage bButtonImage = null;
|
|
||||||
//
|
|
||||||
//PImage dpadXImage = null;
|
|
||||||
//PImage dpadYImage = null;
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@ -627,7 +624,6 @@ void windowResized()
|
|||||||
Panel p = getPanels().get(key);
|
Panel p = getPanels().get(key);
|
||||||
p.setHeight(frame.getHeight() - p.getOutline().getTop() - (DEFAULT_CONTROL_SIZE.y*2));
|
p.setHeight(frame.getHeight() - p.getOutline().getTop() - (DEFAULT_CONTROL_SIZE.y*2));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
@ -670,7 +666,6 @@ void draw()
|
|||||||
{
|
{
|
||||||
dispatchCommandQueue();
|
dispatchCommandQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getCurrentTab()
|
String getCurrentTab()
|
||||||
@ -691,7 +686,6 @@ boolean isShowingDialogBox()
|
|||||||
}
|
}
|
||||||
void drawDialogBox()
|
void drawDialogBox()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
String getVectorFilename()
|
String getVectorFilename()
|
||||||
{
|
{
|
||||||
@ -890,7 +884,6 @@ void drawCommandQueuePage()
|
|||||||
showCommandQueue(right, (int)mainPanelPosition.y);
|
showCommandQueue(right, (int)mainPanelPosition.y);
|
||||||
|
|
||||||
drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y);
|
drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawImageLoadPage()
|
void drawImageLoadPage()
|
||||||
@ -1004,7 +997,6 @@ void showGroupBox()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadImageWithFileChooser()
|
void loadImageWithFileChooser()
|
||||||
@ -1034,7 +1026,8 @@ void loadImageWithFileChooser()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImageFileFilter extends javax.swing.filechooser.FileFilter
|
class ImageFileFilter extends javax.swing.filechooser.FileFilter
|
||||||
@ -1068,7 +1061,7 @@ void loadVectorWithFileChooser()
|
|||||||
File file = fc.getSelectedFile();
|
File file = fc.getSelectedFile();
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
RShape shape = RG.loadShape(file.getPath());
|
RShape shape = loadShapeFromFile(file.getPath());
|
||||||
if (shape != null)
|
if (shape != null)
|
||||||
{
|
{
|
||||||
setVectorFilename(file.getPath());
|
setVectorFilename(file.getPath());
|
||||||
@ -1081,23 +1074,25 @@ void loadVectorWithFileChooser()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
class VectorFileFilter extends javax.swing.filechooser.FileFilter
|
class VectorFileFilter extends javax.swing.filechooser.FileFilter
|
||||||
{
|
{
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
String filename = file.getName();
|
String filename = file.getName();
|
||||||
filename.toLowerCase();
|
filename.toLowerCase();
|
||||||
if (file.isDirectory() || filename.endsWith(".svg"))
|
if (file.isDirectory() || filename.endsWith(".svg") || filename.endsWith(".gco") || filename.endsWith(".g"))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "Vector graphic files (SVG)";
|
return "Vector graphic files (SVG, GCode)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loadNewPropertiesFilenameWithFileChooser()
|
void loadNewPropertiesFilenameWithFileChooser()
|
||||||
{
|
{
|
||||||
SwingUtilities.invokeLater(new Runnable()
|
SwingUtilities.invokeLater(new Runnable()
|
||||||
@ -1128,7 +1123,8 @@ void loadNewPropertiesFilenameWithFileChooser()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PropertiesFileFilter extends javax.swing.filechooser.FileFilter
|
class PropertiesFileFilter extends javax.swing.filechooser.FileFilter
|
||||||
@ -1174,9 +1170,145 @@ void saveNewPropertiesFileWithFileChooser()
|
|||||||
loadFromPropertiesFile();
|
loadFromPropertiesFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RShape loadShapeFromFile(String filename) {
|
||||||
|
RShape sh = null;
|
||||||
|
if (filename.toLowerCase().endsWith(".svg")) {
|
||||||
|
sh = RG.loadShape(filename);
|
||||||
|
}
|
||||||
|
else if (filename.toLowerCase().endsWith(".gco") || filename.toLowerCase().endsWith(".g")) {
|
||||||
|
sh = loadShapeFromGCodeFile(filename);
|
||||||
|
}
|
||||||
|
return sh;
|
||||||
|
}
|
||||||
|
|
||||||
|
RShape loadShapeFromGCodeFile(String filename) {
|
||||||
|
RShape parent = null;
|
||||||
|
BufferedReader reader = null;
|
||||||
|
RShape child = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
reader = createReader(filename);
|
||||||
|
parent = new RShape();
|
||||||
|
String line;
|
||||||
|
boolean drawLine = false;
|
||||||
|
int gCodeZAxisChanges = 0;
|
||||||
|
|
||||||
|
long lineNo = 0;
|
||||||
|
while ((line = reader.readLine ()) != null) {
|
||||||
|
lineNo++;
|
||||||
|
if (line.toUpperCase().startsWith("G")) {
|
||||||
|
println("" + lineNo + ": " + line);
|
||||||
|
Map<String, Float> ins = null;
|
||||||
|
try {
|
||||||
|
ins = unpackGCodeInstruction(line);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
println("Exception while unpacking a gcode line " + line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Integer code = Math.round(ins.get("G"));
|
||||||
|
if (code >= 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Float z = ins.get("Z");
|
||||||
|
if (z != null) {
|
||||||
|
gCodeZAxisChanges++;
|
||||||
|
if (gCodeZAxisChanges == 2) {
|
||||||
|
println("Assume second z axis change is to drop the pen to start drawing " + z);
|
||||||
|
gcodeZAxisDrawingHeight = z;
|
||||||
|
drawLine = true;
|
||||||
|
}
|
||||||
|
else if (gCodeZAxisChanges > 2) {
|
||||||
|
drawLine = isGCodeZAxisForDrawing(z);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
println("Assume first z axis change is to RAISE the pen " + z);
|
||||||
|
drawLine = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Float x = ins.get("X");
|
||||||
|
Float y = ins.get("Y");
|
||||||
|
RPoint[][] points = parent.getPointsInPaths();
|
||||||
|
if (points != null) {
|
||||||
|
for (int i = 0; i<points.length; i++) {
|
||||||
|
if (points[i] != null) {
|
||||||
|
for (int j = 0; j<points[i].length; j++) {
|
||||||
|
//println("..." + i + "-" + j + ". Point: " + points[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x != null && y == null) {
|
||||||
|
// move x axis only, use y of last
|
||||||
|
RPoint rp = points[points.length-1][points[points.length-1].length-1];
|
||||||
|
y = rp.y;
|
||||||
|
}
|
||||||
|
else if (x == null && y != null) {
|
||||||
|
// move y axis only, use x of last
|
||||||
|
RPoint rp = points[points.length-1][points[points.length-1].length-1];
|
||||||
|
x = rp.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x != null && y != null) {
|
||||||
|
// move both x and y axis
|
||||||
|
if (drawLine) {
|
||||||
|
parent.addLineTo(x, y);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
parent.addMoveTo(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
println("Execption reading lines from the gcode file " + filename);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
println("Exception closing the gcode file " + filename);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isGCodeZAxisForDrawing(float z) {
|
||||||
|
return gcodeZAxisDrawingHeight.compareTo(z) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Float> unpackGCodeInstruction(String line) throws NumberFormatException {
|
||||||
|
Map<String, Float> instruction = new HashMap<String, Float>();
|
||||||
|
try {
|
||||||
|
String[] splitted = line.trim().split(" ");
|
||||||
|
for (int i = 0; i < splitted.length; i++) {
|
||||||
|
String axis = splitted[i].substring(0, 1);
|
||||||
|
Float value = Float.parseFloat(splitted[i].substring(1));
|
||||||
|
if ("X".equalsIgnoreCase(axis) || "Y".equalsIgnoreCase(axis) || "Z".equalsIgnoreCase(axis) || "G".equalsIgnoreCase(axis)) {
|
||||||
|
instruction.put(axis, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// println("instruction: " + instruction);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
println("Exception while reading the lines from a gcode file: " + line);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
return instruction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void setPictureFrameDimensionsToBox()
|
void setPictureFrameDimensionsToBox()
|
||||||
@ -1201,7 +1333,6 @@ void setBoxToPictureframeDimensions()
|
|||||||
t = (Toggle) getAllControls().get(MODE_SHOW_DENSITY_PREVIEW);
|
t = (Toggle) getAllControls().get(MODE_SHOW_DENSITY_PREVIEW);
|
||||||
t.setValue(1);
|
t.setValue(1);
|
||||||
t.update();
|
t.update();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1246,7 +1377,6 @@ void controlEvent(ControlEvent controlEvent)
|
|||||||
}
|
}
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeTab(String from, String to)
|
void changeTab(String from, String to)
|
||||||
@ -1262,7 +1392,6 @@ void changeTab(String from, String to)
|
|||||||
c.show();
|
c.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1689,7 +1818,6 @@ void leftButtonMachineClick()
|
|||||||
setChromaKey(getMouseVector());
|
setChromaKey(getMouseVector());
|
||||||
else if (currentMode.equals(MODE_SEND_START_TEXT))
|
else if (currentMode.equals(MODE_SEND_START_TEXT))
|
||||||
sendStartTextAtPoint();
|
sendStartTextAtPoint();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseWheel(int delta)
|
void mouseWheel(int delta)
|
||||||
@ -1745,7 +1873,7 @@ void previewQueue()
|
|||||||
String aLenStr = splitted[1];
|
String aLenStr = splitted[1];
|
||||||
String bLenStr = splitted[2];
|
String bLenStr = splitted[2];
|
||||||
|
|
||||||
PVector endPoint = new PVector(Integer.parseInt(aLenStr), Integer.parseInt(bLenStr));
|
PVector endPoint = new PVector(Integer.parseInt(aLenStr)+previewCordOffset, Integer.parseInt(bLenStr)+previewCordOffset);
|
||||||
endPoint = getDisplayMachine().asCartesianCoords(endPoint);
|
endPoint = getDisplayMachine().asCartesianCoords(endPoint);
|
||||||
endPoint = getDisplayMachine().inMM(endPoint);
|
endPoint = getDisplayMachine().inMM(endPoint);
|
||||||
|
|
||||||
@ -1793,7 +1921,6 @@ void previewQueue()
|
|||||||
ellipse(p.x, p.y, 5, 5);
|
ellipse(p.x, p.y, 5, 5);
|
||||||
noFill();
|
noFill();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startPoint != null)
|
if (startPoint != null)
|
||||||
@ -1803,7 +1930,6 @@ void previewQueue()
|
|||||||
ellipse(startPoint.x, startPoint.y, 15, 15);
|
ellipse(startPoint.x, startPoint.y, 15, 15);
|
||||||
noFill();
|
noFill();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isHiddenPixel(PVector p)
|
boolean isHiddenPixel(PVector p)
|
||||||
@ -2185,7 +2311,6 @@ void showCommandQueue(int xPos, int yPos)
|
|||||||
println("Caught the pesky ConcurrentModificationException: " + cme.getMessage());
|
println("Caught the pesky ConcurrentModificationException: " + cme.getMessage());
|
||||||
}
|
}
|
||||||
showmachineMessageLog(rightEdgeOfQueue, 20);
|
showmachineMessageLog(rightEdgeOfQueue, 20);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawCommandQueueStatus(int x, int y, int tSize)
|
void drawCommandQueueStatus(int x, int y, int tSize)
|
||||||
@ -2611,7 +2736,6 @@ void readMachineName(String sync)
|
|||||||
if (splitted.length == 3)
|
if (splitted.length == 3)
|
||||||
{
|
{
|
||||||
String name = splitted[1];
|
String name = splitted[1];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2853,8 +2977,6 @@ void loadFromPropertiesFile()
|
|||||||
getVectorPosition().y = getFloatProperty("controller.vector.position.y", 0.0);
|
getVectorPosition().y = getFloatProperty("controller.vector.position.y", 0.0);
|
||||||
this.minimumVectorLineLength = getIntProperty("controller.vector.minLineLength", 0);
|
this.minimumVectorLineLength = getIntProperty("controller.vector.minLineLength", 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("Finished loading configuration from properties file.");
|
println("Finished loading configuration from properties file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2927,7 +3049,6 @@ void savePropertiesFile()
|
|||||||
props.setProperty("controller.vector.position.y", df.format(getVectorPosition().y));
|
props.setProperty("controller.vector.position.y", df.format(getVectorPosition().y));
|
||||||
props.setProperty("controller.vector.minLineLength", new Integer(this.minimumVectorLineLength).toString());
|
props.setProperty("controller.vector.minLineLength", new Integer(this.minimumVectorLineLength).toString());
|
||||||
|
|
||||||
|
|
||||||
FileOutputStream propertiesOutput = null;
|
FileOutputStream propertiesOutput = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -2964,7 +3085,9 @@ void savePropertiesFile()
|
|||||||
{
|
{
|
||||||
propertiesOutput.close();
|
propertiesOutput.close();
|
||||||
}
|
}
|
||||||
catch (Exception e2) {println("what now!"+e2.getMessage());}
|
catch (Exception e2) {
|
||||||
|
println("what now!"+e2.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3137,3 +3260,4 @@ PImage makeColourImage(int w, int h, int colour)
|
|||||||
}
|
}
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Set<Panel> getPanelsForTab(String tabName)
|
Set<Panel> getPanelsForTab(String tabName)
|
||||||
|
Loading…
Reference in New Issue
Block a user