How to call LaserCAD functions from script?

Hi,

(1) Let’s say the shape created by running a script in FreeCAD, Fusion or openscad.

(2) Is it possible to set LaserCAD parameters (speed, power, etc.) of the file in a script (google doesn’t say much).

(3) Preferred: Python, C/C++, JavaScript & Visual Basic (don’t know C#, Powershell, etc. unless the modification is trivial).

Thank you!

(openscad and scripting reference - OpenSCAD script for Sick of Beige case templates on the laser cutter)

Are you talking about using Gcode?

1 Like

Script call the section where the Max. and Min. Power and the Speed are assigned to each “Cut” (area):
(1) The closed contours are defined by a list of data points;
(2) A given area where the Power and Speed are to be assigned is defined as the area that is the INTERSECTION , UNION , etc. of the two (or multiple) lists [This defines the desired area];
(3) The Power and Speed assignment functions (or classes) are called with the Power and Speed parameters;
(4) The “Download” and the “Start” can be done manually;

If the Laser can be controlled by user written G code (do we need to bypass LaserCAD?), generating G code automatically (is there “Laser Power” equivalent of “F(eed speed)xy.z”?) seems to be the option with more control?

Thanks!

P.S.: 8bit engraving with a CO2 laser
http://www.instructables.com/id/Hacking-LaserCAD/

from my understanding LaserCAD is just pipeing gcode to the serial port. I think laser power would be defined by G50 which is spindle speed.

You could always install lasercad on your home machine and listen to the serial port and see what is coming out of it and see if you can reverse engineer it.

1 Like

Keep in mind that unlike many of the tools in the space, the laser cutter is designated as ‘not hackable’. While it has its limitations, LaserCAD imposes constraints on the parameters that prevent the machine and the laser tube from being damaged. This probably rules out directly interfacing with the machine with G-Code or bypassing LaserCAD. (At least without ample testing and LCC approval.)

Depending on what you’re trying to accomplish, there might be a few other approaches:

  • A script that automatically/semi-automatically interacts with LaserCAD interface. (This could be done using the Python PyAutoGUI package to control the mouse and keyboard, for example.)
  • A script/program that imports geometry and outputs a LaserCAD project file (e.g. .pwj5)

If you provide a little bit more information on what you’re trying to accomplish or what limitations you are running into, that would be helpful.

4 Likes

Also, the laser doesn’t just do G-code… any efforts that have been taken in the past (by members or with approval of the LCC) have so far not resulted in anything.

@Rebel_without_Clause; what’s the problem that you’re trying to solve?

1 Like

Before you guys jump on him about hacking; note he’s talking about the saved files form LaserCAD.

@Rebel_without_Clause
I’ve never opened one of their files, but is it ascii?

1 Like

Hey Rahul,

I think the best / safest / most approachable method is to try and figure
out the format of the PWJ5 files.

You should try to open it up in a hex editor and see if you can google
header strings to see if it’s some sort of standard packing method.

Here is a good example of someone reverse engineering Altium files:

(Based on this work, I have written some of my own unpacking tools and
successfully built some tools that are useful to me)

4 Likes

We made a lot of “Engraved” Greeting Cards for Christmas on LaserCAD on home PC and opened the .pwj5 files at the Space (LaserCAD files are not even LaserCAD compatible!). We saw nothing (zoom, zoom to objects, etc. did nothing), which provided the motivation to understand .pwj5 file data.
(@mike , the .pwj5 files are ASCII and special characters)

There is no plan to “hack” the Space’s Laser, but just “monitor” (Bus Analyze) the communication between the Cutter and the PC.

Thank you @Jarrett for awesome Altium hack, that’s seems a real good ‘data scraping’ tool!

The aim(s) is-are:
(1) To edit LaserCAD files either in LaserCAD format (seems many have tried to do that);
(2) Control the laser from G-Code (needs to be safety approved);
(3) “PWM” (Pulse Width Modulate) the Laser safely;
(4) See if a Fiber Laser (it is not procured) can be mounted on Luke Brooks’ wood router and controlled from LaserCAD or G-Code (to cut sheet metal possibly? if the enclosure seals off the cutter);

Thanks for your inputs!

I’m still not clear if this is the main problem you’re trying to solve or not, but I would have started with this:

This is helpful information. Getting members to use LaserCAD on the own machines was thought to be a good idea to reduce setup time, but only if the project files are compatible. Attempting to sort this out would be a good starting point.

e.g.:

  • What version of LaserCAD do you have at home?
  • Which version of LaserCAD was running at the time at the space?

The other approach would be to look at your workflow:

  • How many different designs are we talking here? 10’s? 100’s?
  • Do you maintain your design in a ‘neutral’ / compatible format ? e.g. svg, dxf?
  • Do you use color in the design to indicate different operations (power/speed)?

For example, you can import a first design (with properly setup color), setup the cutting parameters, then save the project. Importing a second design with the first still open retains the cutting parameters of the first. You can then remove the first design, save the project, and repeat.

Yet another option may be to (work with the LCC to?) modify the default cutting parameters of different colors.

As far as I understand, LaserCAD transmits an intermediate file to the Laser controller (e.g. a .ud5 file) over an ethernet connection when you ‘download’ a file and doesn’t stream commands. You can save a copy of this (binary) file from the download dialog box and attempt to analyze/reverse engineer it as above.

3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.