mirror of
https://github.com/braillerap/BrailleRap.git
synced 2025-06-11 03:13:23 +02:00
Tools for NatBraille embossing
This commit is contained in:
6
NatBrailleTools/BrailleLogger/.classpath
Normal file
6
NatBrailleTools/BrailleLogger/.classpath
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
NatBrailleTools/BrailleLogger/.project
Normal file
17
NatBrailleTools/BrailleLogger/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>BrailleLogger</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
BIN
NatBrailleTools/BrailleLogger/bin/Braille2GcodeEncoder.class
Normal file
BIN
NatBrailleTools/BrailleLogger/bin/Braille2GcodeEncoder.class
Normal file
Binary file not shown.
BIN
NatBrailleTools/BrailleLogger/bin/Braille6GcodeEncoding.class
Normal file
BIN
NatBrailleTools/BrailleLogger/bin/Braille6GcodeEncoding.class
Normal file
Binary file not shown.
BIN
NatBrailleTools/BrailleLogger/bin/BrailleGcodeDot.class
Normal file
BIN
NatBrailleTools/BrailleLogger/bin/BrailleGcodeDot.class
Normal file
Binary file not shown.
BIN
NatBrailleTools/BrailleLogger/bin/BrailleGcodeEncoding.class
Normal file
BIN
NatBrailleTools/BrailleLogger/bin/BrailleGcodeEncoding.class
Normal file
Binary file not shown.
BIN
NatBrailleTools/BrailleLogger/bin/BrailleLogger.class
Normal file
BIN
NatBrailleTools/BrailleLogger/bin/BrailleLogger.class
Normal file
Binary file not shown.
BIN
NatBrailleTools/BrailleLogger/bin/GCodeGenerator.class
Normal file
BIN
NatBrailleTools/BrailleLogger/bin/GCodeGenerator.class
Normal file
Binary file not shown.
220
NatBrailleTools/BrailleLogger/src/Braille2GcodeEncoder.java
Normal file
220
NatBrailleTools/BrailleLogger/src/Braille2GcodeEncoder.java
Normal file
@ -0,0 +1,220 @@
|
||||
import java.awt.Point;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Braille encoder class
|
||||
* @author crocsg
|
||||
*
|
||||
*/
|
||||
public class Braille2GcodeEncoder {
|
||||
|
||||
private GCodeGenerator generator = new GCodeGenerator ();
|
||||
private int page_num= 0;
|
||||
private int char_cnt_line = 0;
|
||||
|
||||
private BrailleGcodeEncoding encoder;
|
||||
|
||||
private float position_x;
|
||||
private float position_y;
|
||||
|
||||
private ArrayList <Point2D.Float> pagedot;
|
||||
private ArrayList<ArrayList<Point2D.Float>> linedot;
|
||||
private String bufline = "";
|
||||
private String pagegcode = "";
|
||||
|
||||
private final float Braille_cell_width = 2.3f;
|
||||
private final float Braille_cell_height = 2.3f;
|
||||
private final float Braille_cell_padding = 6.1f;
|
||||
private final float Braille_line_padding = 10f;
|
||||
private boolean pageAvailable = false;
|
||||
private boolean newpage=true;
|
||||
|
||||
/**
|
||||
* @return the pageAvailable
|
||||
*/
|
||||
public boolean isPageAvailable() {
|
||||
return pageAvailable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the pagegcode
|
||||
*/
|
||||
public String getPagegcode() {
|
||||
return pagegcode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
private Braille2GcodeEncoder() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param encoder Braille Encoding
|
||||
*/
|
||||
public Braille2GcodeEncoder(BrailleGcodeEncoding encoder) {
|
||||
this.encoder = encoder;
|
||||
}
|
||||
|
||||
public void startPage ()
|
||||
{
|
||||
pagedot = new ArrayList <Point2D.Float> ();
|
||||
position_y = 2;//TODO avoid magic
|
||||
pageAvailable = false;
|
||||
newpage = false;
|
||||
pagegcode = "";
|
||||
startLine ();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void endPage ()
|
||||
{
|
||||
if ( ! pagedot.isEmpty())
|
||||
{
|
||||
pagegcode = generator.Header();
|
||||
|
||||
for (Point2D.Float p: pagedot)
|
||||
{
|
||||
pagegcode += generator.moveTo(p.getX(),p.getY());
|
||||
pagegcode += generator.printDot();
|
||||
}
|
||||
pagegcode += generator.Footer();
|
||||
|
||||
|
||||
pageAvailable = true;
|
||||
|
||||
int n = JOptionPane.showConfirmDialog(
|
||||
null,
|
||||
"Page " + (page_num+1) + " chargez le papier quand l'embosseuse est disponible",
|
||||
"BrailleRapSP Embosseuse Braille",
|
||||
JOptionPane.OK_CANCEL_OPTION);
|
||||
if (n == JOptionPane.CANCEL_OPTION)
|
||||
{
|
||||
// cancel print
|
||||
System.exit(0);
|
||||
|
||||
}
|
||||
|
||||
page_num++;
|
||||
}
|
||||
}
|
||||
|
||||
public void startLine ()
|
||||
{
|
||||
linedot = new ArrayList <ArrayList <Point2D.Float>> ();
|
||||
for (int i =0; i < encoder.getNline(); i++ )
|
||||
{
|
||||
linedot.add(new ArrayList<Point2D.Float>());
|
||||
}
|
||||
|
||||
position_x = 0; //TODO avoid magic
|
||||
bufline = "";
|
||||
}
|
||||
|
||||
private Point2D.Float getDotAbsolutePosition(Point p)
|
||||
{
|
||||
Point2D.Float absolute = new Point2D.Float();
|
||||
absolute.x = position_x + (float) p.x * Braille_cell_width;
|
||||
absolute.y = position_y + (float) p.y * Braille_cell_height;
|
||||
|
||||
return absolute;
|
||||
}
|
||||
|
||||
private void nextCellPosition ()
|
||||
{
|
||||
this.position_x += Braille_cell_padding;
|
||||
}
|
||||
|
||||
private void nextLinePosition ()
|
||||
{
|
||||
this.position_y += Braille_line_padding;
|
||||
}
|
||||
private void endLine ()
|
||||
{
|
||||
ArrayList<Point> dots;
|
||||
|
||||
// compute braille dots on line
|
||||
for (int i =0; i < bufline.length(); i++)
|
||||
{
|
||||
dots = encoder.GetCharacterDots(bufline.charAt(i));
|
||||
if (dots != null)
|
||||
{
|
||||
for (int d= 0; d < dots.size (); d++)
|
||||
{
|
||||
int x = dots.get(d).x;
|
||||
int y = dots.get(d).y;
|
||||
|
||||
linedot.get(y).add(getDotAbsolutePosition(dots.get(d)));
|
||||
}
|
||||
|
||||
nextCellPosition ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// store braille absolute dot on page
|
||||
for (int l = 0; l < linedot.size(); l++)
|
||||
{
|
||||
pagedot.addAll(linedot.get(l));
|
||||
}
|
||||
|
||||
nextLinePosition();
|
||||
}
|
||||
|
||||
private void addCharToBuffer (char a)
|
||||
{
|
||||
bufline += a;
|
||||
}
|
||||
|
||||
public void Open ()
|
||||
{
|
||||
startPage ();
|
||||
}
|
||||
public void processChar (char a)
|
||||
{
|
||||
if (a == '\n')
|
||||
{
|
||||
endLine ();
|
||||
startLine ();
|
||||
}
|
||||
else if (a == 0x0c)
|
||||
endPage ();
|
||||
|
||||
else
|
||||
{
|
||||
if (newpage)
|
||||
startPage();
|
||||
addCharToBuffer (a);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Close ()
|
||||
{
|
||||
endLine ();
|
||||
endPage ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void requestNewPage() {
|
||||
newpage = true;
|
||||
pageAvailable = false;
|
||||
startPage ();
|
||||
}
|
||||
|
||||
}
|
141
NatBrailleTools/BrailleLogger/src/Braille6GcodeEncoding.java
Normal file
141
NatBrailleTools/BrailleLogger/src/Braille6GcodeEncoding.java
Normal file
@ -0,0 +1,141 @@
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author lenovo
|
||||
*
|
||||
*/
|
||||
public class Braille6GcodeEncoding implements BrailleGodeEncoding {
|
||||
private static final BrailleGcodeDot[] dot = new BrailleGcodeDot[] {
|
||||
new BrailleGcodeDot('a', new int[] {1}),
|
||||
new BrailleGcodeDot('b', new int[] {1,2}),
|
||||
new BrailleGcodeDot('c', new int[] {1,4}),
|
||||
|
||||
|
||||
|
||||
new BrailleGcodeDot('d', new int[]{1,4,5}),
|
||||
new BrailleGcodeDot('e', new int[] {1,5}),
|
||||
new BrailleGcodeDot('f', new int[]{1,2,4}),
|
||||
new BrailleGcodeDot('g', new int[]{1,2,4,5}),
|
||||
new BrailleGcodeDot('h', new int[]{1,2,5}),
|
||||
new BrailleGcodeDot('i', new int[]{2,4}),
|
||||
new BrailleGcodeDot('j', new int[]{2,4,5}),
|
||||
new BrailleGcodeDot('k', new int[]{1,3}),
|
||||
new BrailleGcodeDot('l', new int[]{1,2,3}),
|
||||
new BrailleGcodeDot('m', new int[]{1,3,4}),
|
||||
new BrailleGcodeDot('n', new int[]{1,3,4,5}),
|
||||
new BrailleGcodeDot('o', new int[]{1,3,5}),
|
||||
new BrailleGcodeDot('p', new int[]{1,2,3,4}),
|
||||
new BrailleGcodeDot('q', new int[]{1,2,3,4,5}),
|
||||
new BrailleGcodeDot('r', new int[]{1,2,3,5}),
|
||||
new BrailleGcodeDot('s', new int[]{2,3,4}),
|
||||
new BrailleGcodeDot('t', new int[]{2,3,4,5}),
|
||||
new BrailleGcodeDot('u', new int[]{1,3,6}),
|
||||
new BrailleGcodeDot('v', new int[]{1,2,3,6}),
|
||||
new BrailleGcodeDot('w', new int[]{2,4,5,6}),
|
||||
new BrailleGcodeDot('x', new int[]{1,3,4,6}),
|
||||
new BrailleGcodeDot('y', new int[]{1,3,4,5,6}),
|
||||
new BrailleGcodeDot('z', new int[]{1,3,5,6}),
|
||||
|
||||
new BrailleGcodeDot(' ', new int[]{}),
|
||||
new BrailleGcodeDot('.', new int[]{2,5,6}),
|
||||
new BrailleGcodeDot(',', new int[]{2}),
|
||||
new BrailleGcodeDot('?', new int[]{2,6}),
|
||||
new BrailleGcodeDot(';', new int[]{2,3}),
|
||||
new BrailleGcodeDot(',', new int[]{2,4}),
|
||||
new BrailleGcodeDot('!', new int[]{2,3,5}),
|
||||
new BrailleGcodeDot('(', new int[]{2,3,6}),
|
||||
new BrailleGcodeDot(')', new int[]{3,5,6}),
|
||||
new BrailleGcodeDot('\'', new int[]{3}),
|
||||
new BrailleGcodeDot('-', new int[]{3,6}),
|
||||
new BrailleGcodeDot('/', new int[]{3,4}),
|
||||
new BrailleGcodeDot('*', new int[]{3,5}),
|
||||
new BrailleGcodeDot('+', new int[]{2,3,5}),
|
||||
new BrailleGcodeDot('=', new int[]{2,3,5,6}),
|
||||
new BrailleGcodeDot('0', new int[]{3, 4, 5, 6}),
|
||||
new BrailleGcodeDot('1', new int[]{1, 6}),
|
||||
new BrailleGcodeDot('2', new int[]{1, 2, 6}),
|
||||
new BrailleGcodeDot('3', new int[]{1, 4, 6}),
|
||||
new BrailleGcodeDot('4', new int[]{1, 4, 5, 6}),
|
||||
new BrailleGcodeDot('5', new int[]{1, 5, 6}),
|
||||
new BrailleGcodeDot('6', new int[]{1, 2, 4, 6}),
|
||||
new BrailleGcodeDot('7', new int[]{1, 2, 4, 5, 6}),
|
||||
new BrailleGcodeDot('8', new int[]{1, 2, 5, 6}),
|
||||
new BrailleGcodeDot('9', new int[]{2, 4, 6}),
|
||||
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 2, 3,5, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1,2, 3, 4, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{2, 3, 4, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 2, 3, 4, 5, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 2, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 2, 4, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 4, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1,2, 4, 5, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{2, 3, 4, 5, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 5, 6}),
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 2, 5, 6}),
|
||||
|
||||
new BrailleGcodeDot('<27>', new int[]{1, 3}), // Majuscule NatBraille
|
||||
new BrailleGcodeDot('`', new int[]{3, 4, 5, 6}) // Chiffres NatBraille
|
||||
|
||||
};
|
||||
|
||||
private final int nrow = 2; // number of row in braille encoding
|
||||
private final int nline = 3; // number of line in braille encoding
|
||||
|
||||
|
||||
|
||||
|
||||
public Braille6GcodeEncoding() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see BrailleGodeEncoding#GetCharacterDots(char)
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<Point> GetCharacterDots(char a) {
|
||||
//TODO make this fast
|
||||
|
||||
for (int i =0; i < dot.length;i++)
|
||||
{
|
||||
if (dot[i].getCar() == a)
|
||||
{
|
||||
ArrayList<Point> Braille = new ArrayList<Point>();
|
||||
for (int d = 0; d < dot[i].getPos().length; d++)
|
||||
{
|
||||
int x = dot[i].getPos()[d] <= nline ? 0 : 1;
|
||||
int y = dot[i].getPos()[d] <= nline ? dot[i].getPos()[d] - 1 : dot[i].getPos()[d] - 1 - nline;
|
||||
|
||||
Braille.add(new Point(x,y));
|
||||
}
|
||||
|
||||
return Braille;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see BrailleGodeEncoding#getNRow()
|
||||
*/
|
||||
@Override
|
||||
public int getNRow() {
|
||||
return nrow;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see BrailleGodeEncoding#getNline()
|
||||
*/
|
||||
@Override
|
||||
public int getNline() {
|
||||
return nline;
|
||||
}
|
||||
|
||||
}
|
52
NatBrailleTools/BrailleLogger/src/BrailleGcodeDot.java
Normal file
52
NatBrailleTools/BrailleLogger/src/BrailleGcodeDot.java
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author lenovo
|
||||
*
|
||||
*/
|
||||
public class BrailleGcodeDot {
|
||||
|
||||
|
||||
private char car;
|
||||
|
||||
public char getCar() {
|
||||
return car;
|
||||
}
|
||||
public void setCar(char car) {
|
||||
this.car = car;
|
||||
}
|
||||
|
||||
private int[] pos;
|
||||
|
||||
public int[] getPos() {
|
||||
return pos;
|
||||
}
|
||||
public void setPos(int[] pos) {
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public BrailleGcodeDot() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
/**
|
||||
* @param car
|
||||
* @param position
|
||||
*/
|
||||
public BrailleGcodeDot(char car, int[] position) {
|
||||
this.car = car;
|
||||
this.pos = position;
|
||||
}
|
||||
|
||||
public BrailleGcodeDot(char car) {
|
||||
this.car = car;
|
||||
|
||||
}
|
||||
}
|
18
NatBrailleTools/BrailleLogger/src/BrailleGcodeEncoding.java
Normal file
18
NatBrailleTools/BrailleLogger/src/BrailleGcodeEncoding.java
Normal file
@ -0,0 +1,18 @@
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author lenovo
|
||||
*
|
||||
*/
|
||||
public interface BrailleGcodeEncoding {
|
||||
|
||||
public ArrayList<Point> GetCharacterDots (char a);
|
||||
public int getNRow ();
|
||||
public int getNline ();
|
||||
|
||||
}
|
71
NatBrailleTools/BrailleLogger/src/BrailleLogger.java
Normal file
71
NatBrailleTools/BrailleLogger/src/BrailleLogger.java
Normal file
@ -0,0 +1,71 @@
|
||||
import java.awt.geom.Point2D;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Main program
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author lenovo
|
||||
*
|
||||
*/
|
||||
public class BrailleLogger {
|
||||
|
||||
|
||||
ArrayList <Point2D.Float> braillepoints = new ArrayList <Point2D.Float>();
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println ("; BrailleRapSP GCODE generator");
|
||||
int arg = 0;
|
||||
for (String s: args)
|
||||
{
|
||||
System.out.println(";" + arg);
|
||||
System.out.println(";" + s);
|
||||
}
|
||||
|
||||
if (args[0] != null)
|
||||
{
|
||||
FileReader fr;
|
||||
Braille2GcodeEncoder encoder = new Braille2GcodeEncoder(new Braille6GcodeEncoding());
|
||||
try {
|
||||
fr = new FileReader(args[0]);
|
||||
|
||||
int i;
|
||||
while ((i=fr.read()) != -1)
|
||||
{
|
||||
encoder.processChar((char) i);
|
||||
if (encoder.isPageAvailable())
|
||||
{
|
||||
System.out.println(encoder.getPagegcode());
|
||||
encoder.requestNewPage ();
|
||||
}
|
||||
}
|
||||
|
||||
encoder.Close ();
|
||||
if (encoder.isPageAvailable())
|
||||
{
|
||||
System.out.println(encoder.getPagegcode());
|
||||
|
||||
}
|
||||
fr.close();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
67
NatBrailleTools/BrailleLogger/src/GCodeGenerator.java
Normal file
67
NatBrailleTools/BrailleLogger/src/GCodeGenerator.java
Normal file
@ -0,0 +1,67 @@
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author lenovo
|
||||
*
|
||||
*/
|
||||
public class GCodeGenerator {
|
||||
|
||||
|
||||
public String Home ()
|
||||
{
|
||||
return ("G28 X\nG28 Y\n");
|
||||
}
|
||||
public String Speed()
|
||||
{
|
||||
return ("G1 F8000\n");
|
||||
}
|
||||
|
||||
public String Position()
|
||||
{
|
||||
return ("G90\n");
|
||||
}
|
||||
|
||||
public String Motoroff ()
|
||||
{
|
||||
return "M84\n";
|
||||
}
|
||||
|
||||
public String Header ()
|
||||
{
|
||||
String gcode = "";
|
||||
gcode = Home ();
|
||||
gcode += Speed ();
|
||||
|
||||
return gcode;
|
||||
}
|
||||
|
||||
public String Footer ()
|
||||
{
|
||||
// TODO avoid magic
|
||||
String gcode = "G1 X10.00 Y600.00\n"; // eject page
|
||||
gcode += Motoroff ();
|
||||
|
||||
return gcode;
|
||||
}
|
||||
|
||||
public String moveTo(double x, double y)
|
||||
{
|
||||
DecimalFormatSymbols sym= new DecimalFormatSymbols ();
|
||||
sym.setDecimalSeparator('.');
|
||||
DecimalFormat decimalFormat = new DecimalFormat("##0.000", sym);
|
||||
|
||||
String gcode = "G1 X" + decimalFormat.format(x) + " Y" + decimalFormat.format(y) + "\n";
|
||||
return gcode;
|
||||
}
|
||||
|
||||
public String printDot() {
|
||||
|
||||
return ("M3 S1\nM3 S0\n");
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user