Generate gcode for lasers/machines which do not support laser intensity.
Rabter1 opened this issue ยท 12 comments
Right now the software cant control lasers without intensity regulation. (Laser raster)
It would be very easy to add support for these lasers.
Background
I am using Mach3 with a very weak laser.
Because of this i have no intensity hooked up to control the laser.
There is only Laser ON
and Laser OFF
. The laser is not listening to intensity values (S X.XXX).
Because i have no analog / PWM output left, i cant even hook up the intensity to my laser.
Right now i am using a custom Mach3 postprocessor to engrave contours.
I wanted to use this software to engrave surfaces aswell.
In Mach3 i can control the laser in two ways.
Possibility one:
Use custom M commands to turn on a digitalOutputs (Turn On or Turn Off Laser)
The code would look something like this.
G1 X10 Y10
M303 ; Turn on Laser
X20
M505; Turn off Laser
X10 Y10.2
...
The issue
The problem with LaserWeb is, that i can define custom commands in macros in Tool ON
and Tool OFF
for turning laser on and off, but these get not triggert in between the lines when using laser raster
.
The code looks something like this.
M303
G1 X10 Y10
S1.0 ; Turn on Laser
X20
S0.0 ; Turn off Laser
X10 Y10.2
...
M505
The software expects the machine to turn off the laser when settings S0
but this is not the case when a machine has no intensity control.
This would be an easy fix because everytime the software outputs S0.0 we could just output Tool OFF
Macro. And everytime the intensity is >0 or >0.5 we could output Tool ON
Macro.
The second way to control a laser in Mach3 is by using the commands M67 and M68.
This is the prefered way becasue mach3 only turns on the laser when the axis is moving.
See also #334
The Code would look something like this:
G1 X10 Y10
M67 E(PWMSigNo) Q(LaserPower) ; Turn on Laser
X20
M68 E(PWMSigNo) Q(PWMMinPow) ; Turn off Laser
X10 Y10.2
...
Because I have no PWM control i just leave the Q value out.
This is basically the same code as above with just another custom macro set for Tool ON
and Tool OFF
The issue is, that the Macros are not beeing called as mentioned.
There is also an awkward bug in mach3 with some controllers, that cause the machine to wait a tiny amount (maybe 1ms) when executing an S Command
. This can lead to a burning spot.
Thats why it would be awesome to have an checkmark option to disable intensity values completely. (Btw. this bug is one of the reasons M67 and M68 exist in the first place)
So for Mach3 there needs to be an output ideally like this:
M67 E(PWMSigNo) Q(LaserPower) ; Turn on Laser
G1 Move
And for lasers without intensity settings, there needs to be a checkmark like Use Intensity
which is checked by default but can be deactivated.
If intensity it deactivated the Mach3 G Code would look like this:
M67 E(PWMSigNo) ; Turn on Laser
G1 Move
M68 E(PWMSigNo) ; Turn off Laser
But if Mach3 would be supportet with M67 and M68. I think it would not harm to have the Power value there. So the checkmark for leaving the power values out might not even be necessary.
But it is very important to turn the laser off by calling M68 or by the Tool OFF Macro
and not by calling Laser ON with Power 0
thats basically the logic right now.
I might be able to help programm these changes and submit a pull request but i dont know if this software is still maintained.
Try this:
- TOOL_ON = M67 E(PWMSigNo)
- TOOL_OFF = M68 E(PWMSigNo)
- LASER_INTENSITY = ;S
- INTENSITY_SEPARATE_LINE = on
Hi @cprezzi thanks for the tip.
This indeed works partially for me if i delete the S lines manually.
But this only works in Laser Fill Path
but not in Laser Raster
or Laser Raster Merge
When using Laser Raster
the logic is always Laser ON and only S value is changed even when laser is supposed to be off.
Also i noticed, that the letter i can set for Laser intensity (Settings->GCode->Laser Intensity) is ignored in Laser Raster
it is always the letter S
(but this is another bug)
Like i said.
I can program the desired changes by maybe add a Machine profile for Mach3 machines and add the settings and bugfixes needed for machines without intensity control.
But i dont want to go through the hustle when nobody is looking at the pull request. Is this project still maintained?
Is this project still maintained?
Yes: and a new release is in the planning. but there is a way to go. And it focuses more on UI changes and updating to 2022 web standards, no substantial changes to gcode generation.
@Rabter1 Raster operations use a different library than vector operations and this library never supported the configuration options from the gcode tab. If you like to add this, start @ https://github.com/LaserWeb/LaserWeb4/blob/dev-es6/src/lib/lw.raster2gcode/raster-to-gcode.js.
@Rabter1 ,
as @cprezzi says, LW4 actually has (for historical reasons) several independent generators for different operation types, the raster generator has a different heritage than the path cutting generator, and the various mill generators also have their own code. The individual generators are run as web-workers and all live in the src/lib
folder, along with their glue logic.
- I now know the code quite well, but I still struggle to remember which operations are associated with the various generators, and which settings they use. If you need any help navigating around this code please ask.
Also watch out for the v4.1 changes as they arrive; there are changes to the default machine profile list (it is expanded and some additional info fields are added).
Since I need to add probably one UI elemt in the settings for Mach3 machines, I will wait with my changes until i have 4.1.
This will most likely make things easier because this avoids merge conflicts.
The 4.1 branch is rebased and renamed; and I'm doing some testing on it here and hope to have it in the main repo soon; I'm still feeling my way with releasing.
Okay thank you!
I will follow this guide and fork branch 4.1. Merge conflicts should be minimal then.
Okidoki; I'm currently doing some testing, documenting and working out how the electron/appimage bundling works.
That guide is good, but the list of npm commands has now been changed; I have a new FRONTEND-DEVELOPMENT.md
document (a practical guide, not a style/architecture guide) that supersedes the commands listed there
Today I had a little bit of time to code the changes.
I created a Pull Request
@easytarget could you give me a hint on how to create a .exe file?
I would like to test my changes on my machine but there is no internet / nodejs installed on the machine.
@easytarget could you give me a hint on how to create a .exe file?
I dont really know that myself yet; I have not yet got round to bundling my changes into the electron appimage. I am a bit stalled in the release process.
The EXE is built from the electron_bundler branch of lw.comm-server (https://github.com/LaserWeb/lw.comm-server/tree/electron_bundler). Check out the scripts in package.json. The "nightlywindows64" tells you all the steps.