Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: nyholku on October 08, 2017, 05:18:38 AM

Title: G10 L20 or setting DROs to zero from G-code
Post by: nyholku on October 08, 2017, 05:18:38 AM
I would like to set DROs to zero (or any other value) from G-code without touching the G54/G92 offsets.

I've not tried this but from reading the LinuxCNC documentation it seems to me that this can be done with:

G10 L20 P1 X0 Y0 Z0

But reading the Mach documentation this does not seem to be supported.

Is there a G-code in Mach dialect that allows me to do that?

Also I note that Fanuc and other seem to interpret L20 differently from LinuxCNC so
I'm awarding extra points for answers that are 'platform' indendent ;)

cheers Kusti


Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: Tweakie.CNC on October 08, 2017, 06:07:46 AM
Hi Kusti,

Easiest way to set a DRO from within Gcode is…

#99aaa = bbb

Where aaa is the DRO number and bbb the value you want to set.

DRO numbers can found in the OEM code list here; http://www.machsupport.com/forum/index.php/topic,9312.0.html

This method is totally Mach3 specific.

Tweakie.
Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: nyholku on October 08, 2017, 07:24:27 AM
Thanks Tweakie!

This is all new territory for me.

I downloaded the spread sheet and google a bit about OEM DROs but the penny did not drop,
can you give a concrete example please?

Say may abs machine position X=100, supposing my current work offset set is 1 (G54),
the if I press ZERO this will set X of work offset 1 to 100 and the X DRO reads now 0, correct?

So exactly how would I do this in G-code?

wbr Kusti


Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: Tweakie.CNC on October 08, 2017, 08:06:21 AM
Quote
Say may abs machine position X=100, supposing my current work offset set is 1 (G54),
the if I press ZERO this will set X of work offset 1 to 100 and the X DRO reads now 0, correct?

So exactly how would I do this in G-code?


Hi Kusti,

Within your Gcode the line

#99800=0

would set the X axis DRO to zero.

Unfortunately I never use offsets so Roger's guide may be the place for you to look;

http://www.machsupport.com/forum/index.php/topic,33595.0.html

Tweakie.
Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: nyholku on October 08, 2017, 01:03:07 PM
Thanks for the example and Roger's guide.

I guess I need to experiment a bit to see what really happens, looks like this is somewhat uncharted even if Roger has done a good write up.

wbr Kusti
Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: RICH on October 09, 2017, 08:52:33 AM
The G10 command in Mach3 is / can be used to set a fixture coordinate system.
You will find info on the command in the Mach manuals. You need to understand that
there are different "dialects" of Gcode commands and Mach has it's owne dialect for the commands. Read the Mach manual! Linux, Fanuc, Hauss, etc have additional commands
and variations / dialects of the commands, so, again quit getting confused and read / use Mach3  gcode as defined.

What DRO's are you talking about?
Machine coordinates? Part coordinates? Program Coordinates?
See commands G53, G54, G52, G92
You need to understand the different coordinate systems and how they relate to each other. Read the Mach3 Manual.

Roger introduces "his" concept of "space", which is fine.BUT
To get grounded in terminology of CNC Peter Smid's books are an excellent
industry accepted standard.

fwiw,
RICH
Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: nyholku on October 09, 2017, 01:42:46 PM
Thanks Rich,

I think I'm have a fair (I hope) understanding of the  coordinate systems.
And I've read both Mach3 and Mach4 manuals and I do not see how G10
can be used to get the same effect as pressing ZERO button that is next to the DROs.

Like I tried to explain, this is what I thing happens when you press ZERO:
"Assume abs machine position X=100, suppose my current work offset set is 1 (G54),
the if I press ZERO this will set X of work offset 1 to 100 and the X DRO reads now 0, correct?"

If that is not what happens I'd be happy to be educated (of course above assumes all
other offsets are zero).

So to get that effect what should I do?

In LinuxCNC  (according to manual, have no experience there) this would be achieved
for X-DRO with:

G54 G10 L20 P1 X0

Mach3 manual does not mentio G10 L20, Mach4 manual says G10 L20 is used to:
"Additional fixture offsets, G54.1 Pxx, can also be set using G10.
"Setting of these offsets is the same, except it is done using L20."
so I conclude that it cannot be used to zero the DROs.

wbr Kusti



Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: RICH on October 09, 2017, 07:01:55 PM
Mach 4 is Fanuc based, Mach 3 is different.
So only read the Mach3 manual for definition of the G10.  G10 L2  is used to set a work offset / fixture offset.
The fixture offset is from  machine coordinate datum to the fixture datum. G52 is a temporary offset relative to the fixture offset.


Quote
if I press ZERO this will set X of work offset 1 to 100 and the X DRO reads now 0, correct
?"

Yes, because that creates a fixture offset. so when you do that change between MC and PC coordinates and see what the DRO's
displays. Better yet, go to diagnostics and look at the values for the different coordinates.

Quote
Mach3 manual does not mention G10 L20

Because it doesn't exist in Mach3, the L20 part!

Try this for testing your understanding of things ........
Make machine coordinate and part coordinate the same and also be the  home position........

RICH



Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: nyholku on October 09, 2017, 11:04:25 PM
Thanks Rick,

I'm not really making myself clear.

My question is simply how: how can I do the equivalent of pressing the ZERO button with G-code?

wbr Kusti


Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: Tweakie.CNC on October 10, 2017, 01:24:17 AM
Quote
My question is simply how: how can I do the equivalent of pressing the ZERO button with G-code?

Thought I already covered that  :-\

Tweakie.
Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: nyholku on October 10, 2017, 02:09:29 AM
Hi Tweakie,

yes you did and I believe you and appreciate that but since Rich volunteered I thought maybe he had something to add/contribute but I seem to have difficulty in getting through to him with my original question.

wbr Kusti
Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: Tweakie.CNC on October 10, 2017, 02:27:06 AM
My apologies.

Tweakie.
Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: RICH on October 10, 2017, 08:59:39 AM
Quote
I thought maybe RICH had something to add/contribute


My apologies  for attempting to help you and will not waste your time with any more replies from me.

My answer to your questions are as follows:

Quote
I would like to set DROs to zero (or any other value) from G-code without touching the G54/G92 offsets

Simplisticaly can't do it.

Quote
how can I do the equivalent of pressing the ZERO button with G-code?

Simplisticaly  can't do it.


NOTE: Your configuration and  active coordinate system has an influence on  what the Zero button will do and what is shown in the DRO.

RICH  
Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: nyholku on October 10, 2017, 09:28:35 AM
Thanks Rich,

I do not understand why the annoyed tone in your response.
I think I've been courteous  and not a bit disrespectful towards any one.
Sorry about my lack of communication skills, English is not my native language.

And thank you very much for the confirmation that this cannot be done with G-code,
this is what Tweakie's answer implied and what I guessed from lot of reading
and googling. Just wanted to know if I had missed anything.

Fair point that ZERO button can do different things, I just used that as an example
to explain (poorly it seems) what it was I wanted to know.

Thanks again, Kusti


Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: Graham Waterworth on January 02, 2018, 06:27:46 PM
Depending on what you need to do with the DRO set to zero you could look at the G52 command that sets a Local zero point as an offset from the current fixture point.

So you can move to any position, read the current location using the #vars and then use them to set the G52.

E.g.

G00 X100. Y50. Z25.
G52 X#5001 Y#5002 (Make current point zero)
(do your local work)
G52 X0 Y0 (cancel local offset)
G00 Z25.
M30

Your G54 and G92 are left unchanged but you can work at zero.

Title: Re: G10 L20 or setting DROs to zero from G-code
Post by: nyholku on January 03, 2018, 02:57:58 AM
Thanks, that was a new idea to me!