Skip to content
peteruithoven edited this page Mar 19, 2013 · 25 revisions

Besides reading design files like eps, svg etc. VisiCut can now also read and execute a javascript like language from a .ls file. This gives people a very flexible way to make lots of variation in things like speed and power.

As this currently still under development you'll have to install a NightlyBuild version of Visicut: http://137.226.142.25:5080/wwwshare/VisiCutNightly/

Usage

You can open a .ls file just like you do other files. For mapping you can select the Everything cut profile. You could position and/or resize it. Press execute.

If the order in which parts are lasercutted is important you can alter the cut profile's Optimization setting from NEAREST to file. You can find this under: Edit > Settings > Manage Laserprofiles... > cut.
You could also add a new Line Profile for this.

Laserscript

Methods

move(x,y);

Move to a x, y coordinate.

line(x,y);

Lasercut a line from the previous position (set with line or move) to a new x,y coordinate.

set(property, value);

Use for setting properties like speed and power e.g.:

set("power",50);
set("speed",50);

Which settings are available depends on the lasercutter. If you are using a LAOS driver, you can set power,speed,focus,ventilation and purge, where power and speed are in % but you can e.g. use 55.3, whereas in the epilog driver, you can only use power,speed,frequency and focus, where the values are integers in %, meaning you can only use values like 50 and 33, but not 33.3.

This gives you full control of the driver, but of cause makes the scripts somewhat not portable between devices. If laser-drivers are added, the properties like power,speed,frequency and focus, if available, will always called like that. They should be kept in percentages and mm (focus is in mm), but if a e.g nitting or a milling machine is added, they will have totally different properties.

You can check which values you can set, if you look at the "Laser Settings" panel while the right laser-cutter is selected and a vector-profile (like cut) is selected. (E.g. the epilog does not have a frequency setting in engrave mode, but right now laser-script is always working in vector/cut-mode)

echo(message);

Create a alert like message for debugging purposes. E.g.:

echo("somevalue: "+somevalue);

Sandbox

For security reasons you can only use a subset of Java. The Math class is accessible, so you do for example:

var five = Math.abs(-5);

In the future it will be posible to disable this limit in preferences.

##Example

var space      	= 5;
var lineHeight 	= 5;
var numLines	= 5;
var x 		= 0;
var speedStep	= 100/(numLines-1);

set("power",100);
for (var i = 0; i < numLines; i++)
{
	set("speed",i*speedStep);
	line(x,lineHeight);
	move(x+=space,0);
}

#LaserScripts LaserScript: Test pattern

#Future Go at it! Pull requests and suggestions are welcome!
Keep an eye on the issue queue for further developments.