How do I add spindle control (Laser Power)

Use this forum to ask questions about how to do things in CAM Expert.

Moderator: andrew

qharley
Junior Member
Posts: 15
Joined: Sun Nov 16, 2014 11:53 am

How do I add spindle control (Laser Power)

Postby qharley » Sun Nov 16, 2014 12:40 pm

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

User avatar
andrew
Site Admin
Posts: 5123
Joined: Fri Mar 30, 2007 6:07 am

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

Postby andrew » Mon Nov 17, 2014 3:50 pm

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);

qharley
Junior Member
Posts: 15
Joined: Sun Nov 16, 2014 11:53 am

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

Postby qharley » Mon Mar 14, 2016 2:13 pm

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.

User avatar
andrew
Site Admin
Posts: 5123
Joined: Fri Mar 30, 2007 6:07 am

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

Postby andrew » Tue Mar 15, 2016 1:08 pm

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.


Return to “CAM Expert 'How Do I' Questions”

Who is online

Users browsing this forum: No registered users and 1 guest