Gcode for swapping X and Y axis

Hi,

I am experimenting with something and wondered is there a string I can place at the start o Gcode to swap the X and Y axis, and then another code to swap it back at the end?

There’s no gcode command to do it, but you could use a text editor with a find and replace all function, such as Notepad++ on windows. Search and replace X with a random letter as an intermediary, replace Y with X, then replace whatever letter to Y. Effectively swapping X and Y.

Is there a reason you just don’t rotate and/or mirror the object before slicing? Swapping the X and Y axis in GCode seems like more work.

As Skreelink says, GCode is just a text file, and the G0 / G1 commands take X, Y, Z, E, and F arguments. Search and replace should work fine.

Thanks, I’m trying to overcome a limitation of lightburn when using the roatry attachment. Lightburn have a flawed assumption that all rotary devices run left to right, but the sm won’t fit in that direction and had to be placed top to bottom.

I have flagged this issue to them but they seem reluctant to allow for this

Oho, you’re messing with the rotary in lightburn! I went through this not long ago, lemme quote what I did.

So only modifications necessary are to make sure mirror is ticked in rotary settings, rotate the image 90 degrees (so the top is facing right) and on the origin, select the center left. This puts your origin at the center bottom (toward the tailstock). Open gcode, replace A with B, and X with Y.

2 Likes

Thanks that is a great help.

FYI don’t need to do the A & B replace as they have added a B axis in rotary set up for us. I am trying to get them to do the rest of your config for us too so we just click a snapmaker 2.0 config button or similar

~WRD0000.jpg

That’s neat to know, if it’s in a new update I’ll have to grab it.