Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

G51 Scaling error #27

Closed
engineer-singh opened this issue Jun 10, 2021 · 1 comment
Closed

G51 Scaling error #27

engineer-singh opened this issue Jun 10, 2021 · 1 comment

Comments

@engineer-singh
Copy link

In General, G51 scaling requires a scaling centre defined by X, Y, Z and scaling factors for each axis defined by I, J, K.
(According to: https://cnc-programming-tips.blogspot.com/2014/12/g50-and-g51-scaling-and-mirroring.html#:~:text=G51%20scales%20program%20G%2Dcodes,%2C%20Y%2C%20and%20Z).&text=A%20G51%20applies%20scaling%2Fmirror,value%20I%2C%20J%2C%20K.)

I tested this in grblHal (stm32f103) and it is not working that way.
After some experiments, here are my observations:
The G51 command with X,Y, I, J parameters results in error:36 (Unused value words found in block.)
After hit and trial I found that I,J are not supported, but X,Y are used to scale axis (Maybe the center point is always 0,0)
This means that "G51 X0 Y0 I1.5 J0.5" should be written as "G51 X1.5 Y0.5"

This not a very bad news, but real big problem is that the arcs (G2 and G3) are not scaled. (only G2 was tested)
(To be more specific, the X,Y,I,J parameters of arc are only scaled. Considering unequal scaling of X and Y, If it was a semicircle, (means starting, center, and ending points are collinear) then the arc is made circular but not elliptical as it should be. if not a semicircle, then program gives error complaining that the centre is not correct. (error:33))

So, Scaling does work if G code does not has Circular arcs (G2 or G3)

Otherwise, it will only work if scaling is equal in All axes.

Although I have not tested G5 cubic splines, but they should be fine as the control points will also be scaled. (Maybe, but I dont know)

@terjeio
Copy link
Contributor

terjeio commented Jun 10, 2021

Default scaling mode is Mach3 style:

"10.7.15 Scale factors G50 and G51
To define a scale factor which will be applied to an X, Y, Z, A, B, C, I & J word before it is
used program G51 X~ Y~ Z~ A~ B~ C~ where the X, Y, Z etc. words are the scale
factors for the given axes. These values are, of course, never themselves scaled.
It is not permitted to use unequal scale factors to produce elliptical arcs with G2 or G3.
To reset the scale factors of all axes to 1.0 program G50"

It can be switched off by commenting out #define MACH3_SCALING in gcode.c (line 43). IIRC that mode is the same as described in the link above, which has the following note:

"NOTE: In no case can an ellipse be generated using scaling."

Otherwise, it will only work if scaling is equal in All axes.

So this is, AFAIKT, the expected behaviour. If you have any example files which should work please share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants