Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ <h1>p5.fab</h1>
<div class="menu-item" onclick="evaluateJs('_fab.serial.requestPort();')">connect</div>
<div class="menu-item" onclick="evaluateJs('_fab.print();')">start print</div>
<div class="menu-item" onclick="evaluateJs('_fab.stopPrint();')">stop print</div>
<div class="menu-item" onclick="evaluateJs('_fab.exportGcode();')">export gcode</div>
<a href="https://github.com/machineagency/p5.fab" target="_blank" rel="noopener noreferrer"
id="top-bar-link">source</a>
<div class="menu-item" onclick="showInfoModal()">info</div>
Expand Down
17 changes: 12 additions & 5 deletions examples/2.5D-sketching/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@ function setup() {
fab.serial.requestPort(); // choose the serial port to connect to
});

let printButton = createButton("print!");
printButton.position(20, 60);
printButton.mousePressed(function () {
fab.print(); // start streaming the commands to printer
let startButton = createButton('start!');
startButton.position(20, 60);
startButton.mousePressed(function () {
fab.print(); // start streaming commands to printer
});

let stopButton = createButton("stop!");
let stopButton = createButton('stop!');
stopButton.position(20, 100);
stopButton.mousePressed(function () {
fab.stopPrint(); // stop streaming the commands to printer
});

let exportButton = createButton('export!');
exportButton.position(20, 140);
exportButton.mousePressed(function () {
fab.exportGcode(); // export gcode to a file.
});
}

function fabDraw() {
Expand Down Expand Up @@ -52,6 +58,7 @@ function fabDraw() {
r -= 0.1;
}
fab.presentPart();
//console.log(fab.commands);
}

function draw() {
Expand Down
2 changes: 1 addition & 1 deletion examples/control-panel/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function fabDraw() {
}

function connectPrinter() {
fab.serial.requestPort();
fab.connectPrinter();
}

function bSend(dir) {
Expand Down
6 changes: 6 additions & 0 deletions examples/hollow-cube/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ function setup() {
stopButton.mousePressed(function() {
fab.stopPrint(); // stop streaming the commands to printer
});

let exportButton = createButton('export!');
exportButton.position(20, 140);
exportButton.mousePressed(function() {
fab.exportGcode(); // export gcode to a file.
});
}

function fabDraw() {
Expand Down
7 changes: 7 additions & 0 deletions examples/line-vase/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ function setup() {
stopButton.mousePressed(function() {
fab.stopPrint(); // stop streaming the commands to printer
});

let exportButton = createButton('export!');
exportButton.position(20, 140);
exportButton.mousePressed(function() {
fab.exportGcode(); // export gcode to a file.
});

}


Expand Down
6 changes: 6 additions & 0 deletions examples/template/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ function setup() {
fab.stopPrint(); // stop streaming the commands to printer.
});

let exportButton = createButton('export!');
exportButton.position(20, 140);
exportButton.mousePressed(function() {
fab.exportGcode(); // export gcode to a file.
});

}


Expand Down
16 changes: 14 additions & 2 deletions examples/vase/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,29 @@ function setup() {
fab = createFab();

// add a buttons to connect to the printer & to print!
connectButton = createButton('connect!');
let connectButton = createButton('connect!');
connectButton.position(20, 20);
connectButton.mousePressed(function() {
fab.serial.requestPort();
});

printButton = createButton('print!');
let printButton = createButton('print!');
printButton.position(20, 60);
printButton.mousePressed(function() {
fab.print();
});

let stopButton = createButton('stop!');
stopButton.position(20, 100);
stopButton.mousePressed(function() {
fab.stopPrint(); // stop streaming the commands to printer.
});

let exportButton = createButton('export!');
exportButton.position(20, 140);
exportButton.mousePressed(function() {
fab.exportGcode(); // export gcode to a file.
});
}

function draw() {
Expand Down
Loading