does anyone know if I can run a Inch sub-program in a machine set up in metric, by only specifying G20 in the program, then G21 to switch back to metric at the end of sub?
does anyone know if I can run a Inch sub-program in a machine set up in metric, by only specifying G20 in the program, then G21 to switch back to metric at the end of sub?
It would depend on the control, most machines when turned on have a set startup gcode default, this can be change by gcode g20 or g21 (my bridgeport is G70 and G71) from this point on, the units are in which-ever system is applied, to revert back you must Gcode again.
Which control and machine are we talking about?
You would be asking for a disaster IMO if you did.
And the G20/G21 Vs G70 and G71 is not truly What control it is on the Fanucs, Its a parameter setting for A,B,C type codes. Found that one the hard way trying to run a G71 cycle on a lathe.
I believe, you cannot switch G20/G21 inside a program.
You can change in a program but I would strongly suggest you don't which is why the FANUC manuals say you can't......
The main problems you will have is with tool compensations, work offset zero points, tool data/comp page function values (which can behave differently be a parameter for G20/21 as a conversion), and some parameters.
So, you're best to start out one way or the other from the get go...... or reprogram your sub. Not something you'll want to randomly toggle in a program....
You might be able to a scaling command if you can work out the positional issues (if you have to use this sub) and some arc cutting funks. But this also has a number of rules and some cycle/shape limitations....
...... I'd simply program a new sub....
It's just a part..... cutter still goes round and round....
I've always had to zero return the machine after a g20/g21 change. as far as I can tell, the controls I've worked on, fanuc 0m, 21, 16, 18, pretty much just move the decimal over one place to the right. I.E. it wont convert your inch or metric height offset or stored work coordinates over to metric or inch. probably wont crash going from inch to metric if your height offsets are positive, not negative, tho i've seen it happen in a program and that resulted in a crash.
Work offsets are not converted, only decimal is shifted.
However, I have heard, though not tried, that tool offsets (geometry and wear) may/may not be converted depending on a parameter. Somebody may try and report the result for the benefit of all.