Skip to content

Commit 8f97921

Browse files
committed
Update README.md
1 parent 21e9795 commit 8f97921

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
const Toolpath = require('gcode-toolpath');
1313

1414
const toolpaths = [];
15-
const gcode = new Toolpath({
15+
const toolpath = new Toolpath({
1616
// Initial position (optional)
1717
position: { x: 0, y: 0, z: 0 },
1818

@@ -50,19 +50,26 @@ const gcode = new Toolpath({
5050
}
5151
});
5252

53+
// Position
54+
toolpath.setPosition({ x: 100, y: 10 }); // x=100, y=10, z=0
55+
toolpath.setPosition(10, 20, 30); // x=10, y=20, z=30
56+
57+
// Modal
58+
toolpath.setModal({ tool: 1 });
59+
5360
// Load G-code from file
5461
const file = 'example.nc';
55-
gcode.loadFromFile(file, function(err, data) {
62+
toolpath.loadFromFile(file, function(err, data) {
5663
});
5764

5865
// Load G-code from stream
5966
const stream = fs.createReadStream(file, { encoding: 'utf8' });
60-
gcode.loadFromStream(stream, function(err, data) {
67+
toolpath.loadFromStream(stream, function(err, data) {
6168
});
6269

6370
// Load G-code from string
6471
const str = fs.readFileSync(file, 'utf8');
65-
gcode.loadFromString(str, function(err, data) {
72+
toolpath.loadFromString(str, function(err, data) {
6673
});
6774
```
6875

@@ -87,7 +94,7 @@ const GCODE = [
8794
].join('\n');
8895

8996
const toolpaths = [];
90-
const gcode = new Toolpath({
97+
const toolpath = new Toolpath({
9198
// @param {object} modal The modal object.
9299
// @param {object} v1 A 3D vector of the start point.
93100
// @param {object} v2 A 3D vector of the end point.
@@ -107,7 +114,7 @@ const gcode = new Toolpath({
107114
}
108115
});
109116

110-
gcode
117+
toolpath
111118
.loadFromString(GCODE, (err, results) => {
112119
console.log(toolpaths);
113120
})

0 commit comments

Comments
 (0)