Work Origin changes after loading a gcode file

Hi,
I have the problem that the Work Origin changes in laser mode when loading a gcode file.

I have set the Work Origin on my Snapmaker 2.0 A350 to the middle of the laser bed via Cotrol - Set Work origin. This setting remains even after startup. I control this via Control - go to Workorigin. This works.

Now I load the machine from Luban with a laser gcode file via WiFi. At the machine I confirm the loading of the file, start the process and select Auto Focus via the material height. Then the laser moves to the workorigin.

However, this is now not the one generally set, but offset by a few milimeters in x and y axis. Of course, I can now correct this again.

However, I would like it to keep the generally set workorigin.

Where does the new work origin come from?
Is it transferred and set with the gcode file?
Or is it set via the connection of Luban with the machine?
Can I set the work origin in Luban to the same coordinates as in the machine, so that it always remains?

thanks a lot for your help

Josef

I ran into the same issue today. I thought I had set the work origin at the center of the bed. I meticulously placed the material on the bed and secured it. I then ran the loaded G code file for the project from the touch screen. Thankfully, I remembered to Run Boundary again to verify the engraving area which, like Josef, found that the origin was off by several centimeters in both the X and Y-axis. I backed out of the project, reset work origin, reloaded the file and sure enough, the origin was off again. I think the work origin is embedded in the project’s G Code file and I can’t override-it prior to beginning of project. The problem is that I thought when I set up the project, the work origin was already at the center of the laser bed. Can someone please tell me if the work origin is related to the initial project setup and is saved with the project before G Codes are generated?

Hi ddayue,
I have been testing for days on this problem and gave up in the end because I could not find a solution.

In the meantime I have noted the position of the center of the laser bed and set the Work Origin to this point every time after loading the G-code.

This is especially annoying because for my purposes and my objects to be lasered in series I have built a centering platform including holders.

Not satisfactory, but must be enough for the moment.

Maybe someone from Snapmaker will read this at some point and give us a tip. Or I’ll report an issue again. The first time I reported it, I only got a link to the manual, which doesn’t help here.

Greetings
Sepp

I just googled again. There are (at least) 6 G-code codes to set a coordinate system: G54 - G59. Each coordinate system has its own work origin.

see Nullpunktverschiebung (only in German)

Apparently the shifting of the work origin in the G-Code can also be switched off with the codes G53 and G500.

I have to do more research on this …

However, I would not like to work on the G-code every time in the future …

my G-Code for laser engraving starts with this sequence:

; G-code for laser engraving
; Generated by Snapmaker Luban
; Sun Mar 07 2021 9:58:26
 
G90
G21
; G-code START <<<
M106 P0 S255
G1 F2500
G1 X-7.40 Y4.30
M3 P25 S63
G4 P5
M5
G1 X-7.30 Y4.70

G90 = All coordinates from now on are absolute relative to the origin of the machine.
G21 = Units from now on are in millimeters.
M106 = Fan on / P0 = Fan 0 / S255 = Fan Speed max
G1 = Move / F = Feed rate / X and Y coordinates
M3 spindle / laser on
G4 Pause the machine for a period of time
M5 spindle / laser off

and so on

Seems the G-Code ist OK …

I always send my G-codes to Snapmaker via WiFi. When connecting Luban to Snapmaker, the following codes are sent from Luban to the mashine:
snapmaker-luban 3.14.0
Connected via Wi-Fi
G54 = Select Coordinate System 1
G53 = Machine coordinates
G28 = Move to Origin
G54 = Select Coordinate System 1

@spitzlbergerj

Once you send the file to the machine and then start to use the Laser engraving module, the machine will always as you to complete the auto-calibration process and select the work origin.

While the coordinates of the work origin and the start point are not the same, the laser module will go to the work origin and then move to the start point.

I am not sure about your Laser file, and what pattern you are going to engrave. As you can see in the picture below, you set the work origin on the touchscreen. The Laser module will move to the start point and then run the boundary. After that, it will come back to the work origin. The path that it goes on depends on the pattern you generated to a large extend.


Hi,

I have since communicated with snapmaker support who got back to me super quickly.

According to support:
The work origin is ALWAYS to be set after loading a new file.

“After loading the file, you will be required to set the work origin.
In this step, you set the work origin and save it.
Then run the project.”

This makes it hard to make a pre-made mounting plate for the parts to be lasered. Series production is somewhat difficult

I’ll have to try setting the work origin via the G code. Otherwise I will have to set the work origin to the origin of my mounting plate every time.

Not yet optimal …

@Snapmaker-Edwin, thank you for your explanation. I had already understood that.

My point is that I have printed out a mounting plate for little round wooden disks. The wooden discs can be clamped into this and thus always sit in the same place. I have made the mounting plate so that the center of the disk is centered on the aluminum laser platform of the Snapmaker. The Work Origin after loading the G-code is not centered on the platform. It must be set manually nue with each process with it.

Josef

Sure… if you use their workflow.

Since it sounds like you don’t want to set the origin manually each time (which I’ll agree is a cumbersome task for certain workflows) I’ll mention that there’s no hardware requirement you do so, as long as you are careful and take into account required positions.

For example playback the gcode file over serial, possibly from Luban, or from Lightburn or any other gcode playback software. Then there is no touchscreen forcing you to set the origin. I don’t use Luban, so if it forces you to set an origin as well then I’d use something else. Strongly recommend Lightburn.

Setting the origin does need to be done though, however it can be just a couple lines of gcode. Let’s say you need the work origin to be at machine coordinates X150 Y150, your laser focus is 30mm, and your material thickness is 10mm (total Z of 40mm).

G28 O ; Home if unhomed
G90 ; Absolute
G53 ; Use native space
G0 X150 Y150 Z40 ; Move to desired location
G54 ; Use workspace coordinate
G92 X0 Y0 Z0 ; Set origin here

I have a variety of macros configured in Lightburn to do common tasks, such as set the origin to the center of the board at the laser focal length, moving around, etc. Works great, although of course you won’t have power loss recovery.

Hi brent113,

thanks a lot for your detailed answer, especially for the gcodes. these help a lot

i am still in contact with support who has now sent me a video of how the settings work there. I “actually” do it the same way, yet my Snapmaker reacts differently. I stay tuned and report here.

Nevertheless, I will also have a look at Lightburn. At first glance, it looks really interesting.

Many greetings

Sepp

Hi all,

first must now praise the support of Snapmaker. Zero Zhao has worked through this issue with me in quite an email ping-pong and many videos from his side and mine. We exchanged a lot of things, I learned a lot about the machine (e.g. how to get into developer mode :wink:

In the end the problem was easy to solve. It is a security feature.

Here is the original answer from Zero Zhao to the solution:

I have confirmed it with our engineer.
The work origin will change if you select the auto mode after you load the file.
For safety concerns, it will rewrite the work origin.
If you need to change the work origin, you need to change it after you load the file.

But if you select the manual mode, you have to manually set up the laser height.