Compare commits

...

9 Commits

18 changed files with 925 additions and 7 deletions

View File

@ -0,0 +1,40 @@
//
// MiniFocusTest.ls
//
// Draw a scale of -10..0..+10 focus lines.
//
// (c) 2016, juergen@fabmail.org
// Distribute under GPL-2.0 or ask.
//
scale=2.0
x_off=2.0
y_off=2.0
function move_s(x, y) { move(x*scale+x_off, y*scale+y_off); }
function line_s(x, y) { line(x*scale+x_off, y*scale+y_off); }
function set_mark()
{
set("power", 5);
set("speed", 100); // marking text
}
// hor. focus_test (left hand side)
for (var f = -10; f < 11; f++)
{
set("focus", f);
var h = 0; if (f % 5) h += 3;
move_s(10+f,h); line_s(10+f,7);
}
set("focus", 0);
move_s(2.5-1, 1.5); line_s(2.5+1, 1.5); // -
move_s(2.5+1.5, 1.5); line_s(2.5,0); line_s(2.5-1.5, 1.5);
for (var i = 1; i < 6; i++)
{
move_s(10-i, 0); line_s(10, 3); line_s(10+i, 0); // <<<<
}
move_s(17.5-1, 1.5); line_s(17.5+1, 1.5); move_s(17.5,0.5); line_s(17.5,2.5); // +
move_s(17.5+1.5, 1.5); line_s(17.5+0, 3); line_s(17.5-1.5, 1.5);

View File

@ -0,0 +1,241 @@
//
// PowerSpeedTest.ls
//
// Draw a row of rectangles, and adjacent text (from a 7 segment font)
// ramping up power from 5 to 100 %, then ramping down speed from 100 to 5%
//
// (c) 2016, juergen@fabmail.org
// Distribute under GPL-2.0 or ask.
//
scale=1/1.5
x_off=2.0
y_off=2.0
// use twolines_break=0 to render all in one line.
twolines_break=0 // 152
twolines_stride=28
// 0 1 2 3 4 5 6
// --------------------
s7__ = [ 0, 0, 0, 0, 0, 0, 0 ]
s7_0 = [ 1, 1, 0, 1, 1, 1, 1 ]
s7_1 = [ 0, 1, 0, 1, 0, 0, 0 ]
s7_2 = [ 1, 1, 1, 0, 1, 1, 0 ]
s7_3 = [ 1, 1, 1, 1, 1, 0, 0 ]
s7_4 = [ 0, 1, 1, 1, 0, 0, 1 ]
s7_5 = [ 1, 0, 1, 1, 1, 0, 1 ]
s7_6 = [ 0, 0, 1, 1, 1, 1, 1 ]
s7_7 = [ 1, 1, 0, 1, 0, 0, 0 ]
s7_8 = [ 1, 1, 1, 1, 1, 1, 1 ]
s7_9 = [ 1, 1, 1, 1, 0, 0, 1 ]
s7_A = [ 1, 1, 1, 1, 0, 1, 1 ]
s7_C = [ 1, 0, 0, 0, 1, 1, 1 ]
s7_E = [ 1, 0, 1, 0, 1, 1, 1 ]
s7_F = [ 1, 0, 1, 0, 0, 1, 1 ]
s7_J = [ 0, 1, 0, 1, 1, 1, 0 ] // L+J => W
s7_L = [ 0, 0, 0, 0, 1, 1, 1 ]
s7_P = [ 1, 1, 1, 0, 0, 5, 1 ]
s7_U = [ 0, 1, 0, 1, 1, 1, 1 ]
s7_D = s7_0
s7_R = s7_A
s7_S = s7_5
s7_O = s7_0
// segment order
// 0
// 6 1
// 2
// 5 3
// 4
pow = [ 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 ]
spe = [ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 90, 80, 70, 60, 50, 40, 30, 20, 15, 10, 5 ]
pow_text = [ s7__, s7__, s7_5, s7__,
s7__, s7_1, s7_0, s7__,
s7__, s7_1, s7_5, s7__,
s7__, s7_2, s7_0, s7__,
s7__, s7_3, s7_0, s7__,
s7__, s7_4, s7_0, s7__,
s7__, s7_5, s7_0, s7__,
s7__, s7_6, s7_0, s7__,
s7__, s7_7, s7_0, s7__,
s7__, s7_8, s7_0, s7__,
s7__, s7_9, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__ ]
spe_text = [ s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7__, s7_9, s7_0, s7__,
s7__, s7_8, s7_0, s7__,
s7__, s7_7, s7_0, s7__,
s7__, s7_6, s7_0, s7__,
s7__, s7_5, s7_0, s7__,
s7__, s7_4, s7_0, s7__,
s7__, s7_3, s7_0, s7__,
s7__, s7_2, s7_0, s7__,
s7__, s7_1, s7_5, s7__,
s7__, s7_1, s7_0, s7__,
s7__, s7__, s7_5, s7__ ]
if (twolines_break)
{
function move_s(x, y)
{
if (x > twolines_break)
move((x-twolines_break)*scale+x_off, (y+twolines_stride)*scale+y_off);
else
move(x*scale+x_off, y*scale+y_off);
}
function line_s(x, y)
{
if (x > twolines_break)
line((x-twolines_break)*scale+x_off, (y+twolines_stride)*scale+y_off);
else
line(x*scale+x_off, y*scale+y_off);
}
}
else
{
function move_s(x, y) { move(x*scale+x_off, y*scale+y_off); }
function line_s(x, y) { line(x*scale+x_off, y*scale+y_off); }
}
// top left corner is 0,0.
function seg7(x, y, w, h, a)
{
if (a[0]) { move_s(x, y); line_s(x+w,y); }
if (a[1]) { move_s(x+w,y); line_s(x+w,y+0.5*h); }
if (a[2]) { move_s(x, y+0.5*h); line_s(x+w,y+0.5*h); }
if (a[3]) { move_s(x+w,y+0.5*h); line_s(x+w,y+h); }
if (a[4]) { move_s(x, y+h); line_s(x+w,y+h); }
if (a[5]) { move_s(x, y+0.5*h); line_s(x, y+h); }
if (a[6]) { move_s(x, y); line_s(x, y+0.5*h); }
}
function rect(x, y, width, height)
{
move_s(x, y);
line_s(x+width, y);
line_s(x+width, y+height);
line_s(x, y+height);
line_s(x, y);
}
function set_mark()
{
set("power", 5);
set("speed", 100); // marking text
}
// start of code execution here.
// the border rectangle is without prior seting of speed or power
// this makes the settings of the cut dialog effective for the border.
if (twolines_break)
{
xend = (2*x_off + 1*twolines_break + 3 ) * scale;
yend = (2*y_off + 2*twolines_stride - 2 ) * scale;
}
else
{
xend = (2*x_off + 304 + 3 ) * scale;
yend = (2*y_off + 1*twolines_stride - 2 ) * scale;
}
move(0,0);
line(xend, 0);
line(xend, yend);
line(0, yend);
line(0,0);
set_mark();
seg7(0,0, 3,5, s7_P); // POWER
seg7(4,0, 3,5, s7_O);
seg7(8,0, 3,5, s7_L);
seg7(11,0, 3,5, s7_J);
// seg7(15,0, 3,5, s7_E); // ugly
// seg7(19,0, 3,5, s7_R); // ugly
seg7(0,7, 3,5, s7_S); // SPEED
seg7(4,7, 3,5, s7_P);
seg7(8,7, 3,5, s7_E);
seg7(12,7, 3,5, s7_E);
// seg7(16,7, 3,5, s7_D); // ugly
// hor. focus_test (left hand side)
for (var f = -10; f < 11; f++)
{
set("focus", f);
var h = 14; if (f % 5) h += 3;
move_s(10+f,h); line_s(10+f,20);
}
set("focus", 0);
move_s(2.5-1, 14+1); line_s(2.5+1, 14+1); // -
line_s(2.5, 14+2.5); line_s(2.5-1, 14+1);
move_s(10-1, 22+0); line_s(10, 22-2); line_s(10+1, 22+0); // ^
move_s(17.5-1, 14+1); line_s(17.5+1, 14+1); move_s(17.5,14+0); line_s(17.5,14+2); // +
move_s(17.5+1, 14+1); line_s(17.5+0, 14-.5); line_s(17.5-1, 14+1);
seg7( 0,21, 2,3, s7_F);
seg7( 3,21, 2,3, s7_O);
seg7( 6,21, 2,3, s7_C);
seg7(12,21, 2,3, s7_U);
seg7(15,21, 2,3, s7_S);
// squares and percentage values
for (var i = 0; i < 23; i++)
{
set_mark();
for (var j = 0; j < 4; j++)
{
seg7(19+12*i+4*j, 0, 3, 5, pow_text[4*i+j]);
seg7(19+12*i+4*j, 7, 3, 5, spe_text[4*i+j]);
}
set("power", pow[i]);
set("speed", spe[i]);
rect(21+12*i, 14, 10, 10);
}
// vert. focus_test (right hand side)
set_mark();
var xr = 21+23*12
for (var f = -10; f < 11; f++)
{
set("focus", f);
var h = xr; if (f % 5) h += 3;
move_s(h,10+f); line_s(xr+6,10+f);
}
set("focus", 0);
move_s(xr+8, 5-1); line_s(xr+8,5+1); // -
move_s(xr+9, 10-2); line_s(xr+6, 10); line_s(xr+9,10+2); // <
move_s(xr+8, 15-1); line_s(xr+8, 15+1); move_s(xr+7,15); line_s(xr+9,15); // +

View File

@ -0,0 +1,241 @@
//
// PowerSpeedTest.ls
//
// Draw a row of rectangles, and adjacent text (from a 7 segment font)
// ramping up power from 5 to 100 %, then ramping down speed from 100 to 5%
//
// (c) 2016, juergen@fabmail.org
// Distribute under GPL-2.0 or ask.
//
scale=1/1.5
x_off=2.0
y_off=2.0
// use twolines_break=0 to render all in one line.
twolines_break=152
twolines_stride=28
// 0 1 2 3 4 5 6
// --------------------
s7__ = [ 0, 0, 0, 0, 0, 0, 0 ]
s7_0 = [ 1, 1, 0, 1, 1, 1, 1 ]
s7_1 = [ 0, 1, 0, 1, 0, 0, 0 ]
s7_2 = [ 1, 1, 1, 0, 1, 1, 0 ]
s7_3 = [ 1, 1, 1, 1, 1, 0, 0 ]
s7_4 = [ 0, 1, 1, 1, 0, 0, 1 ]
s7_5 = [ 1, 0, 1, 1, 1, 0, 1 ]
s7_6 = [ 0, 0, 1, 1, 1, 1, 1 ]
s7_7 = [ 1, 1, 0, 1, 0, 0, 0 ]
s7_8 = [ 1, 1, 1, 1, 1, 1, 1 ]
s7_9 = [ 1, 1, 1, 1, 0, 0, 1 ]
s7_A = [ 1, 1, 1, 1, 0, 1, 1 ]
s7_C = [ 1, 0, 0, 0, 1, 1, 1 ]
s7_E = [ 1, 0, 1, 0, 1, 1, 1 ]
s7_F = [ 1, 0, 1, 0, 0, 1, 1 ]
s7_J = [ 0, 1, 0, 1, 1, 1, 0 ] // L+J => W
s7_L = [ 0, 0, 0, 0, 1, 1, 1 ]
s7_P = [ 1, 1, 1, 0, 0, 5, 1 ]
s7_U = [ 0, 1, 0, 1, 1, 1, 1 ]
s7_D = s7_0
s7_R = s7_A
s7_S = s7_5
s7_O = s7_0
// segment order
// 0
// 6 1
// 2
// 5 3
// 4
pow = [ 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 ]
spe = [ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 90, 80, 70, 60, 50, 40, 30, 20, 15, 10, 5 ]
pow_text = [ s7__, s7__, s7_5, s7__,
s7__, s7_1, s7_0, s7__,
s7__, s7_1, s7_5, s7__,
s7__, s7_2, s7_0, s7__,
s7__, s7_3, s7_0, s7__,
s7__, s7_4, s7_0, s7__,
s7__, s7_5, s7_0, s7__,
s7__, s7_6, s7_0, s7__,
s7__, s7_7, s7_0, s7__,
s7__, s7_8, s7_0, s7__,
s7__, s7_9, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__ ]
spe_text = [ s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7_1, s7_0, s7_0, s7__,
s7__, s7_9, s7_0, s7__,
s7__, s7_8, s7_0, s7__,
s7__, s7_7, s7_0, s7__,
s7__, s7_6, s7_0, s7__,
s7__, s7_5, s7_0, s7__,
s7__, s7_4, s7_0, s7__,
s7__, s7_3, s7_0, s7__,
s7__, s7_2, s7_0, s7__,
s7__, s7_1, s7_5, s7__,
s7__, s7_1, s7_0, s7__,
s7__, s7__, s7_5, s7__ ]
if (twolines_break)
{
function move_s(x, y)
{
if (x > twolines_break)
move((x-twolines_break)*scale+x_off, (y+twolines_stride)*scale+y_off);
else
move(x*scale+x_off, y*scale+y_off);
}
function line_s(x, y)
{
if (x > twolines_break)
line((x-twolines_break)*scale+x_off, (y+twolines_stride)*scale+y_off);
else
line(x*scale+x_off, y*scale+y_off);
}
}
else
{
function move_s(x, y) { move(x*scale+x_off, y*scale+y_off); }
function line_s(x, y) { line(x*scale+x_off, y*scale+y_off); }
}
// top left corner is 0,0.
function seg7(x, y, w, h, a)
{
if (a[0]) { move_s(x, y); line_s(x+w,y); }
if (a[1]) { move_s(x+w,y); line_s(x+w,y+0.5*h); }
if (a[2]) { move_s(x, y+0.5*h); line_s(x+w,y+0.5*h); }
if (a[3]) { move_s(x+w,y+0.5*h); line_s(x+w,y+h); }
if (a[4]) { move_s(x, y+h); line_s(x+w,y+h); }
if (a[5]) { move_s(x, y+0.5*h); line_s(x, y+h); }
if (a[6]) { move_s(x, y); line_s(x, y+0.5*h); }
}
function rect(x, y, width, height)
{
move_s(x, y);
line_s(x+width, y);
line_s(x+width, y+height);
line_s(x, y+height);
line_s(x, y);
}
function set_mark()
{
set("power", 5);
set("speed", 100); // marking text
}
// start of code execution here.
// the border rectangle is without prior seting of speed or power
// this makes the settings of the cut dialog effective for the border.
if (twolines_break)
{
xend = (2*x_off + 1*twolines_break + 3 ) * scale;
yend = (2*y_off + 2*twolines_stride - 2 ) * scale;
}
else
{
xend = (2*x_off + 304 + 3 ) * scale;
yend = (2*y_off + 1*twolines_stride - 2 ) * scale;
}
move(0,0);
line(xend, 0);
line(xend, yend);
line(0, yend);
line(0,0);
set_mark();
seg7(0,0, 3,5, s7_P); // POWER
seg7(4,0, 3,5, s7_O);
seg7(8,0, 3,5, s7_L);
seg7(11,0, 3,5, s7_J);
// seg7(15,0, 3,5, s7_E); // ugly
// seg7(19,0, 3,5, s7_R); // ugly
seg7(0,7, 3,5, s7_S); // SPEED
seg7(4,7, 3,5, s7_P);
seg7(8,7, 3,5, s7_E);
seg7(12,7, 3,5, s7_E);
// seg7(16,7, 3,5, s7_D); // ugly
// hor. focus_test (left hand side)
for (var f = -10; f < 11; f++)
{
set("focus", f);
var h = 14; if (f % 5) h += 3;
move_s(10+f,h); line_s(10+f,20);
}
set("focus", 0);
move_s(2.5-1, 14+1); line_s(2.5+1, 14+1); // -
line_s(2.5, 14+2.5); line_s(2.5-1, 14+1);
move_s(10-1, 22+0); line_s(10, 22-2); line_s(10+1, 22+0); // ^
move_s(17.5-1, 14+1); line_s(17.5+1, 14+1); move_s(17.5,14+0); line_s(17.5,14+2); // +
move_s(17.5+1, 14+1); line_s(17.5+0, 14-.5); line_s(17.5-1, 14+1);
seg7( 0,21, 2,3, s7_F);
seg7( 3,21, 2,3, s7_O);
seg7( 6,21, 2,3, s7_C);
seg7(12,21, 2,3, s7_U);
seg7(15,21, 2,3, s7_S);
// squares and percentage values
for (var i = 0; i < 23; i++)
{
set_mark();
for (var j = 0; j < 4; j++)
{
seg7(19+12*i+4*j, 0, 3, 5, pow_text[4*i+j]);
seg7(19+12*i+4*j, 7, 3, 5, spe_text[4*i+j]);
}
set("power", pow[i]);
set("speed", spe[i]);
rect(21+12*i, 14, 10, 10);
}
// vert. focus_test (right hand side)
set_mark();
var xr = 21+23*12
for (var f = -10; f < 11; f++)
{
set("focus", f);
var h = xr; if (f % 5) h += 3;
move_s(h,10+f); line_s(xr+6,10+f);
}
set("focus", 0);
move_s(xr+8, 5-1); line_s(xr+8,5+1); // -
move_s(xr+9, 10-2); line_s(xr+6, 10); line_s(xr+9,10+2); // <
move_s(xr+8, 15-1); line_s(xr+8, 15+1); move_s(xr+7,15); line_s(xr+9,15); // +

View File

@ -0,0 +1,349 @@
//
// Schnitttest-Skript des FabLab Altmühlfranken e.V.
//
// Basiert auf den Testskripten aus dem FabLab Nürnberg.
//
// (c) 2016, juergen@fabmail.org
// (c) 2024, fabian@fablab-altmuehlfranken.de
//
// Distributed under the terms of the GPL v2.0
/**** copied from VisiCut example scripts ****/
function rectangle(x, y, width, height)
{
move(x, y);
line(x+width, y);
line(x+width, y+height);
line(x, y+height);
line(x, y);
}
function segmentLine(x1, y1, x2, y2)
{
move(x1, y1);
line(x2, y2);
}
function segment7draw (x,y,w,h,values)
{
var xw = x+w;
var yh = y+h;
var yh2 = y+h/2;
if (values[0] === 1) //A
{
segmentLine(x, y, xw, y);
}
if (values[1] === 1) //B
{
segmentLine(xw, y, xw, yh2);
}
if (values[2] === 1) //C
{
segmentLine(xw, yh2, xw, yh);
}
if (values[3] === 1) //D
{
segmentLine(xw, yh, x, yh);
}
if (values[4] === 1) //E
{
segmentLine(x, yh, x, yh2);
}
if (values[6] === 1) //G
{
segmentLine(x, yh2, xw, yh2);
}
if (values[5] === 1) //F
{
segmentLine(x, yh2, x, y);
}
}
function drawPlus(x,y,w) {
move(x,y+w/2);
line(x+w,y+w/2);
move(x+w/2,y);
line(x+w/2,y+w);
}
function segment7write (x,y,w,string)
{
var characterMap =
{
'0': [1, 1, 1, 1, 1, 1, 0],
'1': [0, 1, 1, 0, 0, 0, 0],
'2': [1, 1, 0, 1, 1, 0, 1],
'3': [1, 1, 1, 1, 0, 0, 1],
'4': [0, 1, 1, 0, 0, 1, 1],
'5': [1, 0, 1, 1, 0, 1, 1],
'6': [1, 0, 1, 1, 1, 1, 1],
'7': [1, 1, 1, 0, 0, 0, 0],
'8': [1, 1, 1, 1, 1, 1, 1],
'9': [1, 1, 1, 1, 0, 1, 1],
'A': [1, 1, 1, 0, 1, 1, 1],
'B': [0, 0, 1, 1, 1, 1, 1],
'C': [1, 0, 0, 1, 1, 1, 0],
'D': [0, 1, 1, 1, 1, 0, 1],
'E': [1, 0, 0, 1, 1, 1, 1],
'F': [1, 0, 0, 0, 1, 1, 1],
'G': [1, 1, 1, 1, 0, 1, 1],
'H': [0, 1, 1, 0, 1, 1, 1],
'I': [0, 0, 0, 0, 1, 1, 0],
'J': [0, 1, 1, 1, 1, 0, 0],
'K': [0, 1, 1, 0, 1, 1, 1],
'L': [0, 0, 0, 1, 1, 1, 0],
'M': [1, 0, 1, 0, 1, 0, 0],
'N': [0, 0, 1, 0, 1, 0, 1],
'O': [1, 1, 1, 1, 1, 1, 0],
'P': [1, 1, 0, 0, 1, 1, 1],
'Q': [1, 1, 1, 0, 0, 1, 1],
'R': [0, 0, 0, 0, 1, 0, 1],
'S': [1, 0, 1, 1, 0, 1, 1],
'T': [0, 0, 0, 1, 1, 1, 1],
'U': [0, 1, 1, 1, 1, 1, 0],
'V': [0, 0, 1, 1, 1, 0, 0],
'W': [0, 1, 0, 1, 0, 1, 0],
'X': [0, 1, 1, 0, 1, 1, 1],
'Y': [0, 1, 1, 1, 0, 1, 1],
'Z': [1, 1, 0, 1, 1, 0, 1],
' ': [0, 0, 0, 0, 0, 0, 0],
'_': [0, 0, 0, 1, 0, 0, 0],
'-': [0, 0, 0, 0, 0, 0, 1],
',': [0, 0, 1, 0, 0, 0, 0]
};
string=string.toUpperCase();
for (var i = 0; i < string.length; i++)
{
segment7draw(x, y, w, 2*w, characterMap[string[i]]);
x += 1.5*w;
}
}
/**** end of copied data ****/
/*
* global data; copy this script and adjust these values to suit your needs
*/
// each sample we test will be a square of this width in mm
var squareSize = 8;
// spacing between the squares, both horizontally and vertically
var squareSpacing = 2;
// if this is set, an outline close to the remaining content will be cut
var cutOutline = true;
// once enabled, the script will prompt the user for a max/min and step interval for both power and speed
// it's not necessary to adjust the max/min/interval every time, therefore it's handy to use a fixed map to save some time
var promptUserForMaxMinIntervals = false;
// our goal is to find the fastest setting with the lowest available power that cuts the material as quickly as possible
// therefore, the samples will be layed out in a grid with the available speeds as rows and the available powers as columns
// while the speeds decrease from the available maximum to the minimum, the powers will increase from the minimum to the maximum
/*
* end of global data
*/
function setMarkProfile() {
// "generic" mark profile
set("power", 10);
set("speed", 100);
}
// perform a focus test from -10 to +10 mm around the set focus (uses some generic mark profile that should work for the majority of materials)
// this is extremely useful to ensure your test sample is cut with the appropriate focus
// note: this only works when the device itself is focused on the material surface
// TODO: is the set (negative) cut focus used at all later on? It looks like the tests run without that value, which could possibly be annoying
function focusTest(x, y) {
setMarkProfile();
// store to reset
var oldFocus = get("focus");
// focus on the material surface
set("focus", 0);
// move to set origin
move(x, y);
// some definitions
var maxLineHeight = 10;
var smallLineHeight = maxLineHeight * 0.75;
var spacing = 1.5;
var minFocus = -10;
var maxFocus = 10;
var fontWidth = 1.2;
// create a list of items so we can use an integer counter below
var samples = [];
// TODO: consider making these values configurable (note: this will make drawing the "arrow" etc. a lot harder)
for (var focus = minFocus; focus <= maxFocus; ++focus) {
samples.push(focus);
}
// first, let's draw the word "focus" above the soon-to-be focus test
segment7write(x, y, fontWidth, "FOCUS");
y += fontWidth * 3;
// next up: the actual focus test
for (var i = 0; i < samples.length; ++i)
{
currentFocus = samples[i];
set("focus", currentFocus);
// every number divisable by 5 will be drawn a little taller to make the scale more readable
var currentLineHeight = smallLineHeight;
if (currentFocus % 5 == 0) {
currentLineHeight = maxLineHeight;
}
// mark the actual vertical line
xCoord = x + i * spacing;
move(xCoord, y + maxLineHeight);
line(xCoord, y + maxLineHeight - currentLineHeight);
}
// draw minimum and maximum values on the edges as well as a zero marker
var yTextOffset = maxLineHeight + 1 * spacing;
var leftText = minFocus.toString();
var leftXOffset = 0;
var rightText = maxFocus.toString();
// we can subtract the number of characters to align the text properly
// the 1.5 is a correctional factor we need to apply, it is used for some reason (...?) in the 7-segment font code
var rightXOffset = samples.length * spacing - rightText.length * fontWidth * 1.5;
// draw the texts
segment7write(x + leftXOffset, y + yTextOffset, fontWidth, leftText);
segment7write(x + rightXOffset, y + yTextOffset, fontWidth, rightText);
// draw a 0 marker, a "roof" with a 45° "slope"
for (var sign = -1; sign <= 1; sign += 2) {
var roofX = x + minFocus * spacing * -1;
move(roofX, y + yTextOffset);
line(roofX + sign * fontWidth * 1.5, y + yTextOffset + fontWidth * 1.5);
}
// finally, restore focus
// for our marks, the negative focus won't have much of an impact, and I really don't feel like setting and resetting it for every single rectangle
// it's most relevant for the focus test
var oldFocus = set("focus", oldFocus);
}
function cutSpeedTest(contentXOffset, contentYOffset, powersToTest, speedsToTest) {
var fontWidth = 2;
contentYOffset += 20;
var firstPowerRowOffset = fontWidth * 3 + squareSpacing;
// TODO: improve
var speedsText = "speeds";
for (var i = 0; i < speedsText.length; ++i) {
var currentCharYOffset = i * (fontWidth * 3) + firstPowerRowOffset;
segment7write(contentXOffset, contentYOffset + currentCharYOffset, fontWidth, speedsText.slice(i, i+1));
}
// move to the right to make room for speedsText
contentXOffset += fontWidth * 1.5 + 2 * squareSpacing;
// TODO: improve
// this text will be aligned centrally above the X axis
var firstColumnOffset = 3 * fontWidth * 1.5;
var powersText = "powers";
segment7write(contentXOffset + firstColumnOffset + powersToTest.length / 2 * (squareSize + squareSpacing - 0) - (powersText.length / 2) * fontWidth * 1.5, 15, fontWidth, powersText);
// write column texts in the first ever row
for (var i = 0; i < powersToTest.length; ++i) {
var currentPower = powersToTest[i];
var currentPowerText = currentPower.toString();
var rowY = contentYOffset;
var firstColumnOffset = 3 * fontWidth * 1.5;
var currentColumnXOffset = i * (squareSize + squareSpacing) + (3 - currentPowerText.length) / 2;
setMarkProfile();
segment7write(contentXOffset + firstColumnOffset + currentColumnXOffset, contentYOffset, fontWidth, currentPowerText);
}
contentYOffset += firstPowerRowOffset;
// write row texts and cut series of rectangles
for (var i = 0; i < speedsToTest.length; ++i) {
var currentSpeed = speedsToTest[i];
var currentSpeedText = currentSpeed.toString();
var rowY = contentYOffset + i * (squareSize + squareSpacing);
// 3 is the maximum number of characters to expect (100 is the max value for either setting)
var alignXOffset = (3 - currentSpeedText.length - 1) * fontWidth * 1.5;
setMarkProfile();
segment7write(contentXOffset + alignXOffset, rowY, fontWidth, currentSpeedText);
// now that we're done writing the text, we can configure the actual cut profile we want to test
set("speed", currentSpeed);
var textWidth = 3 * fontWidth * 1.5;
for (var j = 0; j < powersToTest.length; ++j) {
var currentPower = powersToTest[j];
set("power", currentPower);
var currentColumnXOffset = j * (squareSize + squareSpacing);
rectangle(contentXOffset + textWidth + currentColumnXOffset, rowY, squareSize, squareSize);
}
}
}
// could render at (0, 0), but then again, why not add some spacing right away?
var xOffset = 25;
var yOffset = 5;
if (cutOutline) {
// TODO
// contentXOffset +=
// contentYOffset +=
}
//segment7write(2, 2, 3, "HALLO WELT");
focusTest(xOffset, yOffset, -10, 10);
var powersToTest = [];
var speedsToTest = [];
if (!promptUserForMaxMinIntervals) {
// these are some good values for general testing, you can always use more fine grained tests
powersToTest = [5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
speedsToTest = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 5];
} else {
var minPower = parseFloat(prompt("Min power", 10));
var maxPower = parseFloat(prompt("Max power", 100));
var powerInterval = parseFloat(prompt("Power interval", 10));
for (var i = minPower; i <= maxPower; i += powerInterval) {
powersToTest.push(i);
}
var maxSpeed = parseFloat(prompt("Max speed", 100));
var minSpeed = parseFloat(prompt("Min speed", 10));
var speedInterval = parseFloat(prompt("Speed interval", 10));
for (var i = maxSpeed; i >= minSpeed; i -= speedInterval) {
speedsToTest.push(i);
}
}
cutSpeedTest(xOffset, yOffset, powersToTest, speedsToTest);

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>75</power>
<speed>100</speed>
<focus>-1.0</focus>
<hideFocus>false</hideFocus>
<frequency>5000</frequency>
</PowerSpeedFocusFrequencyProperty>
</linked-list>

View File

@ -3,7 +3,7 @@
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>100</power>
<speed>30</speed>
<speed>70</speed>
<focus>-1.5</focus>
<hideFocus>false</hideFocus>
<frequency>5000</frequency>

View File

@ -3,7 +3,7 @@
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>100</power>
<speed>22</speed>
<speed>50</speed>
<focus>-2.0</focus>
<hideFocus>false</hideFocus>
<frequency>5000</frequency>

View File

@ -3,7 +3,7 @@
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>100</power>
<speed>80</speed>
<speed>65</speed>
<focus>-2.0</focus>
<hideFocus>false</hideFocus>
<frequency>5000</frequency>

View File

@ -2,7 +2,7 @@
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>70</power>
<power>75</power>
<speed>100</speed>
<focus>-1.5</focus>
<hideFocus>false</hideFocus>

View File

@ -3,7 +3,7 @@
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>100</power>
<speed>70</speed>
<speed>80</speed>
<focus>-2.0</focus>
<hideFocus>false</hideFocus>
<frequency>5000</frequency>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>100</power>
<speed>60</speed>
<focus>-3.0</focus>
<hideFocus>false</hideFocus>
<frequency>5000</frequency>
</PowerSpeedFocusFrequencyProperty>
</linked-list>

View File

@ -2,7 +2,7 @@
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>40</power>
<power>35</power>
<speed>100</speed>
<focus>-1.5</focus>
<hideFocus>false</hideFocus>

View File

@ -2,7 +2,7 @@
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>50</power>
<power>60</power>
<speed>100</speed>
<focus>-2.0</focus>
<hideFocus>false</hideFocus>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<linked-list version="0.0.0.0">
<PowerSpeedFocusFrequencyProperty>
<power>100</power>
<speed>35</speed>
<focus>-4.0</focus>
<hideFocus>false</hideFocus>
<frequency>5000</frequency>
</PowerSpeedFocusFrequencyProperty>
</linked-list>

View File

@ -7,6 +7,7 @@
<color>#4ab5ff</color>
<name>Acrylglas (Plexiglas, PMMA)</name>
<materialThicknesses>
<float>2.0</float>
<float>3.0</float>
<float>4.0</float>
</materialThicknesses>

View File

@ -6,6 +6,7 @@
<color>#e3b67a</color>
<name>Sperrholz Birke</name>
<materialThicknesses>
<float>3.0</float>
<float>4.0</float>
</materialThicknesses>
</material>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<material version="0">
<engraveColor>#000000</engraveColor>
<cutColor>#ff0000</cutColor>
<color>#eebf44</color>
<name>Sperrholz Kiefer</name>
<materialThicknesses>
<float>6.0</float>
</materialThicknesses>
</material>

View File

@ -8,5 +8,6 @@
<materialThicknesses>
<float>3.0</float>
<float>4.0</float>
<float>8.0</float>
</materialThicknesses>
</material>