Author Topic: Post processsor for lathe facing operation  (Read 1847 times)

Offline TurboTux

  • Ewok
  • *
  • Posts: 3
    • View Profile
Post processsor for lathe facing operation
« on: February 25, 2019, 19:13:04 pm »
After some years of using CamBam for my mill I have recently extended my lathe with two stepper motors and used CamBam successfully for some profiling work.
As already known CamBam's lathe MOP does not support facing operations yet.So I tried to find a solution/workarround for this problem. I modified the post processor and it seems to be working reasonably well but there are still (small?) problems
that an expert might have a solution for.

This are the changes to a standard lathe post processor:
1. Change the move operations to swap x and z coordinates and the arc parameters i and k as follows
   Arc CCW:   {$g3} {$_f} X{$move.z} Z{$move.x} I{$arc.k} {$j} K{$arc.i}
   Arc CW:    {$g2} {$_f} X{$move.z} Z{$move.x} I{$arc.k} {$j} K{$arc.i}
   Feed Move: {$g1} {$_f} X{$move.z} Z{$move.x} {$_a} {$_b} {$_c}
   Rapid:     {$g0} {$_f} Z{$move.x} {$_a} {$_b} {$_c}
              {$g0} {$_f} X{$move.z} {$_a} {$_b} {$_c}
   (the rapid move must be separated into a Z move and a X move. Otherwise the retraction will be diagonal to the next
    start position)
2. Insert the following line into the Main Header just before the first toolchange line:
     {$g0} xZ{$mop.clearanceplane}
   (without this line the X coordinate seems to be uninitialized and once generates a "G0 XNaN Z..." line in the G-code)
3. In addition set the Options/Invert Arcs value to "True"
4. As workarround for the mentioned problem below I inserted the following lines into the Main/MOP operation before the
    {$toolchange} line:
     {$g0} Z{$mop.clearanceplane}
     {$g0} X{$mop.stocksurface}
   Unfortunatelly this has the side effect to produces additional/unnecessary moves to the clearance plane.

My modified "LinuxCNC-Turn-Face" post processor can be found in the attachment.

How to draw the facing profiles:
The facing profile can be drawn nearly like a normal profile but not the front side (+x) of the face must be drawn but the back side. That means the part which would have physically negative x values have to be drawn in the positive z direction (it's somewhat difficult to explain but it should be easy to understand looking at the attachted example or screenshot). Of course the coordinates will be automatically mapped to the postive x axis in the G-code so the result is OK.
With other words: If you look at the face of the stock you need to draw the profile to the right of the middle.

Unfortunately there are the following problems for which I haven't found a solution yet:

- At the beginning of the finishing MOP a rapid Z move to nearly 0 (depending on the radius offset) is inserted and I don't
  know where it comes from. You can correct this manually by editing the G-code and deleting the 4th and 5th line of the
  finishing MOP or use the workarround.
  Hint: The problem seems to occur after the first MOP is finished regardless if this is a roughing or finishing MOP.
        Even worse if you do not use the the workarround: If you have two roughing MOPs (e.g. by  simply duplicating the   
        MOP) the first one will be executed correctly but all the clearance moves in the second MOP goes to the wrong position
        - so be warned! Looks like CamBam resets the Clearance plane even if it is set correctly in the MOP. 
  As a workarround for this problem the post processor can be modified as described in point 4 above but a better solution   
  would be appreciated.

- The stock surface value in the MOP must be set to the Z coordinate of the stock instead of the radius/diameter in order to
  create the complete depth. This might cause problems if the stock is longer than the travel distance of your X support. If
  you use the facing operation separately you might also touch off the right position.
Please use the facing post processor with caution because I haven't tested it completely. Nevertheless the resulting G-code should be checked in any case (e.g. by the LinuxCNC preview window). All changes belongs to the CamBam Linux versions 0.9.8P and 1.0 Rel16 but Windows should work too (not tested).

I hope this changes are helpful for creating facing operations and maybe a specialist finds a solution for the remaining