Forums » Software development »
CodeCutter
Added by peteruithoven almost 12 years ago
A brainstorm on a dead simple program in which you can execute a simple script in a simple language that generates simplecode which you can send directly to your lasercutter. Great for test patterns for example.
A rough sketch:
Left is the code textfield. First fase might just be simplecode a LAOSLaser understands directly. You could generate this script using a separate tool or script. Next step would be to support a simple, java or lua like language with support for basic variables, for loops etc.
Preview shows you a preview of the effect. I'm not sure how to preview power and speed. But a preview of the paths would be a very good start. Then you could use black lines for cutting and green for moving.
The Preview button will execute the script and update the preview. The send button will send it to your LOASLaser.
All suggestions are welcome. I also added the original Libreoffice Spreadsheet so you can easily design alternatives.
CodeCutter00.png (53.5 KB) CodeCutter00.png | |||
CodeCutter00.ods (52.8 KB) CodeCutter00.ods | |||
CodeCutter01.ods (52.9 KB) CodeCutter01.ods | |||
CodeCutter01.png (61.6 KB) CodeCutter01.png |
Replies (12)
RE: CodeCutter - Added by t-oster almost 12 years ago
Hi,
I would strongly recommend NOT implementing simple-code directly, but use LibLaserCut (http://github.com/t-oster/LibLaserCut), so you can use the program with other Lasercutters, too. Also any update on the
laos-firmare will only result in an updated LibLaserCut... no need to touch this tool.
RE: CodeCutter - Added by KalleP almost 12 years ago
Looks lovely,
How about using Postscript as the language, the PStoEDIT can already translate to SVG and Simplecode for display and testing?
Never used it myself byt PostScript should have the power to handle the code part.
Kalle
--
Johannesburg, South Africa
RE: CodeCutter - Added by peteruithoven almost 12 years ago
You have a good point Thomas, the only benefit of simplecode is that it would be really simple to implement. Also simplecode itself is very simple.
But looking at examples like:
https://github.com/t-oster/LibLaserCut/blob/develop/src/com/t_oster/liblasercut/examples/PhotoPrint.java
Seeing scripts like:vp = new VectorPart(new PowerSpeedFocusFrequencyProperty(), dpi);
vp.moveto(0, 0);
vp.lineto(outImg.getWidth(), 0);
vp.lineto(outImg.getWidth(), outImg.getHeight());
vp.lineto(0, outImg.getHeight());
vp.lineto(0, 0);
LaserJob job = new LaserJob("PhotoPrint", "123", "bla");
job.addPart(vp);
instance.sendJob(job);
That should be easy enough to learn. I'm not sure about setting power and speed yet.
A downside of LibLaserCut might be that it will be harder to get a preview.
Is it possible to have a Java program compile Java code like this from a textarea kind of widget?
RE: CodeCutter - Added by jaap almost 12 years ago
I like the OpenSCAD-like programming language!
Using LibLaserCut sounds like a good option, but does that mean CodeCutter must be java too?
RE: CodeCutter - Added by t-oster almost 12 years ago
Well.... there are projects like gcj (see https://github.com/t-oster/VisiCut/issues/36), which would allow accessing the java library through c++, but I think it would be more easy to
just output a textfile with simple commands like
MOVE X Y Z
LINE X Y Z
SET <KEY>=<VALUE>
and write a small LibLaserCut/Java application which creates an according LaserJob and sends such code to the cutter.
It would be similar to simple code (but i would not restrict the code to things like "power,speed" etc, because drivers for other machines may have other properties),
and one could even use an existing VisiCut instance for sending the job, so the laser-cutter does not have to be configured.
RE: CodeCutter - Added by t-oster almost 12 years ago
Well.... thanks to Java I think I might provide a solution in the near future:
http://docs.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html
Seems as Java comes with a complete java-script interpreter which can also invoke java methods.
My plan: In VisiCut, I add a button "execute custom script", which will open the UI suggested by peter. The scripting language
will be JavaScript, which proviedes everyhting necessary (loops, if, functions etc) and i will provide the functions move, line and get/set.
This will be interpreted and then be either rendered or executed on the laser-cutter.....
Of cause the scripts can be saved...well.... it gets interesting ;)
RE: CodeCutter - Added by peteruithoven almost 12 years ago
And when this custom code can invoke custom methods the preview would become possible again, great stuff!
I can't wait to see what kind of things coders/hackers will try with with that tool.
RE: CodeCutter - Added by t-oster almost 12 years ago
I have it basically working. You can write javascript and use move,line,get,set and the result is a VectorJob, which can then be either executed or simulated on a preview. But the Code-Editor and the preview is not finished. I will have time tomorrow, I guess...
RE: CodeCutter - Added by peteruithoven almost 12 years ago
Nooo Thomas, you're crazy (a very appreciated kind of crazy).
Do you have some big exam coming up and this is a way to procrastinate or something? :P
RE: CodeCutter - Added by t-oster over 11 years ago
Hmm... I couldn't sleep.
So here it is: http://137.226.142.25:5080/wwwshare/VisiCutNightly/Experimental/
Please try the following:
Just open a "LaserScript" file (e.g.: https://github.com/t-oster/VisiCut/blob/feature-laserscript/distribute/files/examples/LaserScriptExample.ls) into VisiCut.
It will first just render the executed script, ignoring any calls to "set" methods. You can drag, resize and rotate the file like any other. You can even raster-engrave it.
However, if you select a Vector-Profile (e.g. cut or mark) for this file and send it to the laser-cutter, the file gets executed. All coordinates in the script are considered to be in mm.
But if you dragged the file around, the transformation will be respected. Initially, the laser-properties of the currently selected material are selected, but you can change them via set methods.
Discussion here:
https://github.com/t-oster/VisiCut/pull/78
RE: CodeCutter - Added by DaveStyles over 11 years ago
Morning, I'm not near a laser, but the software appears to work / is great !
I can't believe I persevered with moshidraw for so long when my life could have been so easy. I love visicut.
Everyone in the land will shortly own a laser with visicut on it, for those of us who are a bit older, we can remember when having a printer was unusual, but now everyone has one.
I have a feeling that the same will soon happen with lasers and 3D printers,
cheers,
Dave.
RE: CodeCutter - Added by peteruithoven over 11 years ago
First test:
More info:
https://github.com/t-oster/VisiCut/pull/78#issuecomment-13966509