Page 1 of 1

How do I add spindle control (Laser Power)

Posted: Sun Nov 16, 2014 12:40 pm
by qharley
I hacked together a CAM config file for my laser cutter, but need to control the following individually for each layer in the DXF:

1. Feedrate (F)
2. Laser Power (S)
3. Focus height (Z)

I managed to add layer controls to the interface, but have no idea how to implement it so that each layer get processed using those parameters.

A common workflow would be:
Engrave 2D
Engrave 3D
Cut

Any help appreciated.
Q

Re: How do I add spindle control (Laser Power)

Posted: Mon Nov 17, 2014 3:50 pm
by andrew
Please have a look at the example configuration GCode.js.

It allows the user to choose different Z cutting levels per layer.

The crucial bits are:
GCode.prototype.initLayerOptionWidget (called for every widget in GCodeLayer.ui or YourConfigurationLayer.ui)

The user entered values can then be used anywhere in your configuration. In GCode.js for example in GCode.prototype.getToolDownLevel:
// get the entity that is currently being exported:
var entity = this.getEntity();

// get layer the entity is on:
var layerId = entity.getLayerId();
var layer = this.document.queryLayer(layerId);

// get value user entered for that layer or default to -2.0:
var layerValue = layer.getCustomProperty("QCADCAM", "Cam/ZCutting", -2.0);

Re: How do I add spindle control (Laser Power)

Posted: Mon Mar 14, 2016 2:13 pm
by qharley
Hi Andrew,

It is more than a year since I tried last, and I finally got it working after rewriting my module from scratch this weekend. I now have Z, feedrates and laser power on each layer.

One question though...
How do I force it to do rapid Z moves before X and Y moves? This is for a laser that does not need to cut into material, but should clear material before it moves in to cut. As is it is still a bit dangerous to the focus head to let loose in my workshop.

Re: How do I add spindle control (Laser Power)

Posted: Tue Mar 15, 2016 1:08 pm
by andrew
The default GCode configuration calls writeToolUp before a rapid move and writeToolDown before starting to cut. The Z levels used are returned by calling getToolUpLevel() and getToolDownLevel() which return the values defined for ZClear and ZCutting by default. So this is something that should automatically happen already if your configuration is derived from the 'GCode' configuration.

Perhaps you can attach your current configuration file, so I can be more helpful.