Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Lather on December 26, 2018, 12:45:26 PM

Title: Variable offset in Mach4
Post by: Lather on December 26, 2018, 12:45:26 PM
Hi, I am new to CNC but want to retrofit a 30 year old lathe. I would like to know if Mach4 can do the following:

I want to build a shaft with a diameter 200.01mm. The bed of the lathe ist worn out and so the shaft will be 200.10 at one end, 199.90 in the middle and 200.15 at the other end. (Just an example, no real measure).
Programm #1 says X=200.01 all the way and Programm #2 has an X- value which changes and that not even constantly. So there would be two active programs at one time with different values in X.

Is there a solution?

Cheers   Frank
Title: Re: Variable offset in Mach4
Post by: MN300 on December 27, 2018, 07:59:25 AM
Hi Frank,

If there is too much backlash on the cross slide leadscrew and nut it may not be possible to compensate for that error.
Also, typically a leadscrew is more worn in the middle so the amount of backlash changes with position.

John
Title: Re: Variable offset in Mach4
Post by: Lather on December 27, 2018, 03:52:48 PM
Hi John,

thanks for Your answer but in my case it is clearly the worn out bed.

Since that error is always the same I would like to write a program which compensates that error. And that program should be an appendix to the "real" program. E.g. If the "real" program says: Make a diameter 200.01 at z=100 and the appenix-program says: Go 0.1mm smaller in diameter at z=100, then the "real" programm should do an 199.91mm and the finished part will be 200.01mm.

But I don't know if that is possible with Mach4.

Frank
Title: Re: Variable offset in Mach4
Post by: joeaverage on December 27, 2018, 11:36:44 PM
Hi,
yes you could write a correction program. The way I am thinking is that if you run your Gcode file through the
correction program it would rewrite the code with the X axis 'corrected' with a figure (plus or minus) from a table
with vertical ordinate in Z.

As an example, lets say you measure your lathe to get this table:

Z Axis    Correction
0             0
50           0
60            0.005
70            0.006
80            0.01
90            0.01
100          0.012
110          0.01
130          0.009
140          0.008
150          0.005
160          0.004
170          0


With Gcode like this:

G1 X50 Z170
G1 X50 Z160
G1 X50 Z150


would become:
G1 X50 Z170
G1 X50.004 Z160
G1 X50.005 Z150

etc.
The program you write would have to apply the correction. There are a number of points that would require some careful programming.
For instance, let say your machine is at X=50 Z=200 and you wish to take a cut to X=50 Z=75, ie a cylindrical cut of 125mm from Z=200
to Z=75. That could be coded:
G1 X50 Z75.

But the code you would have to run would be:
G1 X50 Z170
G1 X50.004 Z160
G1 X50.005 Z150
G1 X50.008 Z140

etc. That is that one move (G1 X50 Z75) would be required to be split into smaller moves so that a varying correction can be applied.

It would require some serious programming on your behalf. Are you up for it?

Craig
Title: Re: Variable offset in Mach4
Post by: Lather on December 28, 2018, 04:12:04 PM
Hi Craig,
thanks a lot for that good example!
Quote
It would require some serious programming on your behalf. Are you up for it?
Well, not yet but I'll learn!

Frank
Title: Re: Variable offset in Mach4
Post by: joeaverage on December 28, 2018, 06:54:54 PM
Hi Frank,
I use a software utility called Autoleveller. It is primarily designed for use when isolation routing of circuit boards.

Any variation in Z height due to either machine inaccuracy or PCB blank warp/bow/twist causes a very great loss of quality of the
finished job. Autoleveller causes the PCB blank to be probed at close intervals AND THEN uses that height variation data to modify
the Gcode, in particular introduces small variations in Z to match the bow/warp of the blank. It breaks large linear moves into smaller
moves to apply a varying correction, much like I have suggested your lathe correction program would be required to work.

There are some similarities between Autoleveller and what you want to do.

Autoleveller is open source so you can easily see how they have done it. It is written in Java.

http://www.autoleveller.co.uk/ (http://www.autoleveller.co.uk/)

Craig
Title: Re: Variable offset in Mach4
Post by: Lather on January 12, 2019, 10:08:03 AM
Hi Craig,
thanks again! A lathe-autoleveller might be exactly what I want. I asked in his forum but did not receive an answer yet.

Frank
Title: Re: Variable offset in Mach4
Post by: joeaverage on January 12, 2019, 12:46:49 PM
Hi,
ye I noticed that you had posted a question on the Autoleveller site. The Autoleveller software utility is meant for a mill,
I doubt you will get much assistance trying to apply it to a lathe.

The software is open source so you can download it and see how it works. It might give you some idea on how to implement
something similar on your machine.

Craig
Title: Re: Variable offset in Mach4
Post by: Lather on January 13, 2019, 02:52:09 AM
Hi Craig,
I'm sorry but that exceeds my abilities.

Frank
Title: Re: Variable offset in Mach4
Post by: smurph on January 13, 2019, 09:43:27 PM
When the next release comes out, we will have that capability.  We call it table mapping.  I should do the same for the lathe.  You can have a map for a table that isn't level.  Or a bed that isn't straight.  And then also layer maps on top of that if you need them!  Say a warped PCB on top of a table that isn't level.  The sky is the limit! 

Steve
Title: Re: Variable offset in Mach4
Post by: joeaverage on January 13, 2019, 11:01:02 PM
Hi Steve,
best wishes for the coming year. Sounds like it has started with a bit of a rush what with the forum serach issues etc.
I am delighted you have been able to fix it all, please pass on my compliments to all those who worked up the solution.

This 'Table Mapping' idea sounds great. How does it work?

As I replied earlier in this post I use Autoleveller, a software utility that probes a PCB blank and THEN re-writes the
Gcode to include subtle variations in Z (due to the machine or the PCB warp/bow). When the modified code runs instead
of a Z cut depth of -0.06mm (60um nominal) the Z DRO will show a cut depth of -0.07mm say when the PCB blank is low
or -0.05 mm when the PCB blank bows upward by 0.01mm.

The variations in Z (from nominal) are explicitly programmed by Autoleveller re-writing the code.

I wondered about having an 'over-ride axis'. Thus the Z DRO would continue to show a cut depth of -0.06mm
but a secondary Z axis stepper or actuator would vary this up and down slightly. I cannot conceive however that the
Z DRO would track the combination of the programmed Z height (-0.06mm) plus a correction of 0.01mm say for a total
Z height of -0.05mm.

I remember Steve Stallings saying something towards the end of last year about using an override axis to enact THC.
It would avoid the motion controller having to make real-time corrections to the Z axis which would have to be reflected
BACK to Mach or risk losing accurate Z reference.

Craig
Title: Re: Variable offset in Mach4
Post by: smurph on January 13, 2019, 11:30:06 PM
Well...  It is pretty much doing the same thing as the Autoleveler program is doing.  Only it is compensating for the table error at the output (motors), not the input (G code).

The map file can be created manually.  But what a pain in the rear!  So Brett wrote a Wizard that generates a G code probing routine to automate the mapping.  Of course this requires the use of a touch probe though.  You can specify the resolution required and the area of the table you wish to map.  For the base table map, one would obviously do the whole table area.  As for the resolution, you need to make is fine enough for your application.  The error map is interpolated between the map points.  This is what I would call the base table map. 

After you have the base table map (or your table is flat and you don't need base table map compensation), you can just load a map for a particular part.  This is almost exactly as you describe with the Autoleveler process with the exception that the G code is not modified and instead, the produced map file is loaded. 

For warped/bowed PCBs, one would necessarily have to "map" the board each time a new board is done.  But for getting rid of table error, the base table map only needs to be done once.  So this will work perfect for the OP's issue. 

This table mapping isn't using the override axes.  However, the THC control does indeed use that.  THC control will also be front and center in the next release. 

Steve
Title: Re: Variable offset in Mach4
Post by: smurph on January 13, 2019, 11:40:44 PM
I forgot to mention that this stuff is in our current development version, build 4026.  The mapping wizard is mcMapSurface.mcc in the wizards directory.  Right now, the only way to load a map is with the surface map plugin configuration dialog.  In the future, there is a way to load maps via the register interface making it possible to totally automate mapping a warped/bowed PBC scenario without having to load files manually, etc...

Steve
Title: Re: Variable offset in Mach4
Post by: Lather on January 14, 2019, 11:26:15 AM
That sounds too good to be true! Now Mach4 is not worth considering to buy, with "Table Mapping" buying is a must. (At least for me).

Frank