mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 05:37:55 +01:00
implement printing to ultimaker2go
This commit is contained in:
parent
cd2b0322d8
commit
0c7f08735f
@ -91,9 +91,10 @@ export function fetchProgress(url, data = {}, onProgress) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onload = () => {
|
||||
const headers = new Headers(xhr.getAllResponseHeaders());
|
||||
const { status, statusText, response, responseText, responseURL: url = headers.get('X-Request-URL') } = xhr;
|
||||
resolve(new Response(response || responseText, { headers, status, statusText, url }));
|
||||
resolve(new Response(xhr.response));
|
||||
// const headers = new Headers(xhr.getAllResponseHeaders() || '');
|
||||
// const { status, statusText, response, responseText, responseURL: url = headers.get('X-Request-URL') } = xhr;
|
||||
// resolve(new Response(response || responseText, { headers, status, statusText, url }));
|
||||
}
|
||||
xhr.onerror = () => reject(new TypeError('Network request failed'));
|
||||
xhr.ontimeout = () => reject(new TypeError('Network request failed'));
|
||||
@ -108,9 +109,7 @@ export function fetchProgress(url, data = {}, onProgress) {
|
||||
if (xhr.upload && onProgress) xhr.upload.onprogress = onProgress;
|
||||
if (xhr.responseType) xhr.responseType = 'blob';
|
||||
|
||||
request.headers.forEach((value, name) => {
|
||||
xhr.setRequestHeader(name, value)
|
||||
});
|
||||
// request.headers.forEach((value, name) => xhr.setRequestHeader(name, value));
|
||||
|
||||
xhr.send(data.body);
|
||||
});
|
||||
@ -223,25 +222,24 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
||||
currentStep ++;
|
||||
} else {
|
||||
// upload G-code file to AWS S3
|
||||
const { data: { reservation, id } } = await fetch(`${GCODE_SERVER_URL}/upload`, { method: 'POST' })
|
||||
const { data: { reservation: { fields, url }, id } } = await fetch(`${GCODE_SERVER_URL}/upload`, { method: 'POST' })
|
||||
.then(response => response.json());
|
||||
|
||||
const body = new FormData();
|
||||
const { fields } = reservation;
|
||||
for (const key in fields) {
|
||||
body.append(key, fields[key]);
|
||||
}
|
||||
|
||||
const file = `;${JSON.stringify({
|
||||
const file = new File([`;${JSON.stringify({
|
||||
...settings,
|
||||
name: `${name}.gcode`,
|
||||
printer: { type: settings.printers, title: printerSettings[settings.printer].title },
|
||||
material: { type: settings.material, title: materialSettings[settings.material].title },
|
||||
quality: { type: settings.quality, title: qualitySettings[settings.quality].title }
|
||||
}).trim()}\n${gcode}`;
|
||||
}).trim()}\n${gcode}`], 'doodle.gcode');
|
||||
body.append('file', file);
|
||||
|
||||
await fetchProgress(reservation.url, { method: 'POST', body }, (progress) => {
|
||||
await fetchProgress(url, { method: 'POST', body }, progress => {
|
||||
updateProgress({
|
||||
action: 'Uploading',
|
||||
percentage: (currentStep + progress.loaded / progress.total) / steps
|
||||
|
@ -1,3 +1,30 @@
|
||||
startCode: |-
|
||||
M109 S{printingTemp} ;set target temperature
|
||||
{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature
|
||||
G21 ;metric values
|
||||
M107 ;start with the fan off
|
||||
G28 X0 Y0 ;move X/Y to min endstops
|
||||
G28 Z0 ;move Z to min endstops
|
||||
G1 Z15 F9000 ;move the platform down 15mm
|
||||
G92 E0 ;zero the extruded length
|
||||
G91 ;relative positioning
|
||||
G1 F200 E10 ;extrude 10mm of feed stock
|
||||
G92 E0 ;zero the extruded length again
|
||||
G92 E0 ;zero the extruded length again
|
||||
G1 F9000
|
||||
G90 ;absolute positioning
|
||||
M117 Printing Doodle...
|
||||
endcode: |-
|
||||
M107 ;fan off
|
||||
G91 ;relative positioning
|
||||
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
|
||||
G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more
|
||||
G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way
|
||||
M84 ;disable axes / steppers
|
||||
G90 ;absolute positioning
|
||||
M104 S0
|
||||
{if heatedBed}M140 S0
|
||||
M117 Done
|
||||
dimensions:
|
||||
x: 200
|
||||
y: 200
|
||||
|
@ -300,6 +300,37 @@ ultimaker2_plus:
|
||||
y: 223
|
||||
z: 305
|
||||
ultimaker2go:
|
||||
startCode: |-
|
||||
M10000
|
||||
M10000
|
||||
M10001 X8 Y28 SDoodle3D heat up...
|
||||
M109 S{temperature} ;set target temperature
|
||||
{if heatedBed}M190 S{bedTemperature} ;set target bed temperature
|
||||
G21 ;metric values
|
||||
G90 ;absolute positioning
|
||||
M107 ;start with the fan off
|
||||
G28 ; home to endstops
|
||||
G1 Z15 F9000 ;move the platform down 15mm
|
||||
G92 E0 ;zero the extruded length
|
||||
G1 F200 E10 ;extrude 10mm of feed stock
|
||||
G92 E0 ;zero the extruded length again
|
||||
G1 F9000
|
||||
M10000
|
||||
M10000
|
||||
M10001 X8 Y28 SDoodle3D printing...
|
||||
endCode: |-
|
||||
M10000
|
||||
M10000
|
||||
M10001 X20 Y28 SDoodle3D done!
|
||||
M107 ;fan off
|
||||
G91 ;relative positioning
|
||||
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure
|
||||
G1 Z+5.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more
|
||||
G28 ;home the printer
|
||||
M84 ;disable axes / steppers
|
||||
G90 ;absolute positioning
|
||||
M104 S0
|
||||
{if heatedBed}M140 S0
|
||||
title: Ultimaker 2 Go
|
||||
heatedBed: false
|
||||
filamentThickness: 2.85
|
||||
|
Loading…
Reference in New Issue
Block a user