# Coordinate system: How to rotate about X axis?

02 Jul 2014 00:37 #48370
Sadly I think this answers my question and I cannot easily do what I want, but let me post this anyway:

Hi, I've got a 3 axis homebuilt CNC router. I have built a head adapter that can be manually indexed to "simulate" a 4th and 5th axis. The main reason I've done this is to get access to undercut areas on parts.

My additional "4th axis" is around the Z and can be indexed to 0,45,90,135,180,225,270,315 (45 degree increments). The "5th axis" is a bracket that tips the spindle to 60 degrees from the Z axis. Imagine if the 5th is at zero (spindle straight down) the 4th axis really won't do anything but index the spindle around the Z.

What I would like to be able to do is rotate the whole G-code program to a new coordinate system that represents the new angle and rotation of the head.

So if I manually tip my head -60 degrees (around the x) my cutter will be pointed at a vector of x0 y-.866 z-.500.

So I now want the "controller" to think the whole coordinate system has shifted and/or rotated. Maybe something like this:

G92 X0 Y0 Z0 A-60 B0 C0 This would just rotate around the X maybe?

Then starting from X0Y0Z0 I would expect a command like:

G1Z-1F50

would result in both Y and Z moving in sync to actual location y-.866 z-.500 (sin and cos of tipped angle -60)

I'm using Linuxcnc for a controller and it doesn't like the A, B or C if I try that. I assume because the machine is only set-up as "3-axis". I don't really understand what U,V and W mean either (in a G92 context)

Other solutions are to tip the entire part, say on a sine plate, which would work for some items, but I only have 10" of z travel so that gets eaten up pretty quick if you try to tip the part. Or I could write a translator that could "rotate" g-code around a point using some trig, not easy but doable.

It would be neat if it could also account for G2, G3 moves in any plane, but I would settle for just G0 and G1.

02 Jul 2014 01:09 - 02 Jul 2014 01:10 #48372 by BigJohnT
It's always better to create a new topic. Your question doesn't seem to have any relevance to the thread that you hijacked.

You can set up fake axes to fool the control to think you have a 5 axis machine. Of course you will have to run each bit of G code then manually rotate the axis then in the G code or the MDI give the correct G code to tell the control your new position.

www.linuxcnc.org/docs/html/gcode/machini..._and_data_components

JT
Last edit: 02 Jul 2014 01:10 by BigJohnT.

02 Jul 2014 01:31 #48373
Yes, that sounds like what I want to do, I'll look into it.

Thanks.

02 Jul 2014 23:51 #48390
So it talks about "rotational axis" but not really any details. Should I be looking to change my machine config to make a "5 axis" machine even though it's only a 3 axis in reality? And then, like you say, manually tip and rotate the head (and probably have to locate new offsets), then run the code and let it think it's tipped and rotated the head? Or am I way over thinking this.

Thanks

03 Jul 2014 04:11 #48396 by BigJohnT
That's pretty much what you would have to do is to "fool" the control into thinking it has moved the tool with a rotational axis. This means at the least the "phantom" axes will need to added to the ini file so the control "thinks" the axes are there. You will also need to add the axes to your hal file to provide feedback as to axis position. For example if you put G0 A60 in the MDI and execute the code then the feedback needs to show that. Take a look at the Axis sim to see how the feedback is done.

JT

12 Jul 2014 13:24 #48684
Got it figured out. My solution was to learn Python and write a program to rotate the g-code. Python code attached.

05 May 2024 05:38 - 05 May 2024 19:47 #299779
you can try G10 L2 R
Last edit: 05 May 2024 19:47 by woai312742.