Interface to LightBurn (is pylib a better choice).

More
14 Nov 2024 22:10 #314495 by jtrantow
LightBurn(Commercial Laser Software) has functionality to generate LinuxCNC gode. It also has an interface that can home, frame, jog, frame, load programs, run programs etc. This UI works very well for laser cutting and it can communicate using serial over TCP.Recently, LightBurn added a "custom g-code device" that allows you to configure much of the gcode. With some help from the LightBurn forum I have a custom gcode device that can communicate with linuxcncrsh.

I have written a small C++ program that acts as a TCP server to LightBurn and as a client to linuxcncrsh. I have the basics working where I pass the majority of gcode commands through using the "set MDI <gcode command>" and special case a few commands *M114" to run linuxcncrsh get commands to fill in responses sent back to LightBurn.

Working with linuxcncrsh I'm seeing a few problems. github.com/LinuxCNC/linuxcnc/issues/3180
This isn't a deal breaker for what I'm trying to do, but going through some of the unit tests, I noticed tests/toolchanger/test-ui.py uses python as the ui. I'm wondering if python might be a better option???

Is the python interface more complete/better supported than linuxcncrsh?
I'm assuming opening the sockets and translating some strings wouldn't be a problem?
linuxcncrsh documentation indicates it can run in conjunction with another UI. (not sure if this is true in practice?)
Can a python interface run at the same time as another(GMOCCAPY) ui?

I'm trying to decide whether to continue on with linuxcncrsh or start over with python.

Please Log in or Create an account to join the conversation.

More
15 Nov 2024 17:36 #314543 by Aciera
The python interface is the solution of choice for GUI development and easier to get support. linuxcncrsh is a bit of an exotic solution that few users have experience with.
You can run multiple python scripts that interface with the python API but you need to be aware that having more than one interface sending commands to linuxcnc can lead to race conditions, particularly when sending MDI commands (This is independent of what languages those interfaces use though).
With python you also need to be careful as one python script can block all the others (eg if you wait for an MDI command to finish execution) which can lead to problems like these :
github.com/LinuxCNC/linuxcnc/issues/3120
github.com/LinuxCNC/linuxcnc/issues/3129

Please Log in or Create an account to join the conversation.

More
16 Nov 2024 20:20 #314620 by jtrantow
Thanks, that's consistent with what I'm slowly deciding. (Old dog reluctant to tackle learning python.) I have Lightburn talking to LaserSpoof 

LightBurn <----(serial/TCP) ---> LaserSpoof application <--->linuxcncrsh controlling Linuxcnc.

I will take a look at rewriting this as a python (non-GUI) interface. Once I have that working, I will consider adding it to gmoccapy, which is what I normally use but never got into the python code. My immediate goal is the non-GUI interface as the impetus for this effort is to leverage the LightBurn UI when I have the laser module mounted on my router.
 

Please Log in or Create an account to join the conversation.

  • poesel
  • Away
  • Senior Member
  • Senior Member
More
08 Jun 2025 14:55 #329952 by poesel
@jtrantow - how's your project going? I'm interested, and maybe I can help you out?

Please Log in or Create an account to join the conversation.

More
08 Jun 2025 19:40 #329965 by jtrantow
My router(laser) is currently torn apart undergoing an epoxy leveling upgrade to be followed with motor belt gearing change for plasma cutting. So weeks or end of summer away from any laser work.

I think linuxcncrc should be treated as a dead end as python has more support.  

What would be nice is a linuxcnc python TCP server that can communicate with Lightburn for laser cutting operations.
  • TCP because that's supported by LightBurn running on a Windows PC to LCNC.
  • Python as that seems best supported for LCNC interfaces.
  • Lightburn interface as it works very well for laser operations. (outline cuts, laser offset, home, zero, etc.)

Getting Gcode across was easy using linuxcncrc and some string substitutions.
What takes a little more work is the extra commands to home and things like getting position. The Lightburn GUI has a serial terminal where you can see some of the extra commands. They use a lot of 3d printer Gcode extensions (M114 to get position).

What is your interest/focus?
 

Please Log in or Create an account to join the conversation.

  • poesel
  • Away
  • Senior Member
  • Senior Member
More
09 Jun 2025 09:35 #330002 by poesel
  • ...
    What is your interest/focus?
I have a laser, lcnc & lightburn.    
I'm an engineer, PLC programmer and know a bit of python. I'm new to lasering and came to understand that I had to export g code from lightburn into lcnc. That works but is a bit clumsy. Then I found your post and here we are.

As I understand it, you wrote a program that on one side pretends to be a laser cutter towards lightburn. On the other side, it controls lcnc remotely. For this you used lcncrc which is deprecated. And now you want to switch over to pylib.

My interest is to make it work for me and then make it available to everyone. I have no financial interests.

As a first step, I suggest putting this on github (or something similar) and work from there.

 

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum