Hello Guest it is April 18, 2024, 05:19:30 AM

Author Topic: Incrementing with macros and G52  (Read 2903 times)

0 Members and 1 Guest are viewing this topic.

Incrementing with macros and G52
« on: October 17, 2015, 05:48:17 PM »
Hello all,

We have a Machmotion, Apollo, Hicon retrofit on a grinder. Part of the G-code Macros are by hand and some by cam.
We are trying to get the dressing to increment in toward the wheel as we dress multiple passes. The numbers increment if we do multiple passes but then reset and the dresser redresses in the exact same coordinates (G-code part of program only). The first move at start increments in (cannot yet find this move in program, Machmotion gives no single block function. Moves are referenced by a dial indicator on the machine.) So can someone steer us in the correct direction?

%:THR PROFILE 1-1 SCALE
( DATE: 04/01/2015)
      (Part Variables)     Y axis = infeed of dresser+-
%
M11
#1010=.03         (Diamond Tool Radius)
#1001=.01         (increment into grind wheel distance each pass "inches")
#1002=1            (number of passes = Total Cut Depth / increment, must be integer)

#1003=1            (Reset Current pass counter to 1 at Start)  (If commented out 1/2 of comp works
                  for all but actual G code)

#1004=[#1010]      (Y Axis Start machine position Inches)
#1005=0            (X Axis Start machine position inches)   
#1006=0            (Current Pass Y Index Distance = 0)
#1007=50         (Cut Feed Rate Set Point)
#1008=400         (Rapid Feed Rate Set Point)
#1009=1200         (Dress Spindle R.P.M. Set Point)
T1M6
G21
G90S[#1009]M03      (G90 = Absolute Position)(S=Spindle Speed)(M3=DRESS Spindle Run)
G54Y[#1004]F[#1007]   (G54 = Use Fixture Y Offset)
G54X[#1005]         (G54 = Use Fixture X Offset)
G43H1            (Retract Tool Length Plus Offset)
M14               (M14 = CR8 Output Rotation of the Grinding Wheel Output Command)
M13               (M13 = CR7 Output Unlock Output Command)
M8               (M8 = Flood Coolant On)
G17               (G17 = X Y Plane Select)
G40               (G40 = Turn Cutter Radius Compensation Off)
G49               (G49 = Use no Tool length offset)
G80               (G80 = Cancel motion, ensure not axis motion will occur)
G90               (G90 = Absolute Positioning, absolute distance mode)
G01Y[#1004]         (G01 = command Y axis to this position)
G01X0            (G01 = command X axis to 0 position)
G52Y0            (G52 = remove Y coordinate offset)

M98P123L#1002      (M98 = call subroutine)(P=subroutine number)(L=Number of Passes)

O0001      (Subroutine 1)

M9         (M9 = All Coolant Off)
M5         (M5 = Spindle Stop)
M12         (M12 = Reset M13 and 14, turn off the rotation and unlock commands)
G91         (G91 = Incremental Distance Mode)
G4P3.5
G49         (G49 = Use No Tool Length Offset)
G90         (G90 = Absolute Positioning, absolute distance mode)
M30         (M30 = Ends the program and rewinds the G-code file)

O123      (Subroutine 123)

      (Start of Profile)
G01Y0.0F20
G01X0.0
G01X0.0Y0.0
G01X0.02579Y0.0
G03X0.02933Y0.00205I0.0J0.0041
G01X0.04076Y0.02183
G02X0.05767Y0.02183I0.0085J-0.0049
G01X0.06968Y0.00102
G03X0.07677Y0.00102I0.0035J0.002
G01X0.09229Y0.02789
G02X0.10456Y0.02789I0.0061J-0.0035       ( G-code abreviated, it is a thread form)
G01X0.11949Y0.00205
G03X0.12658Y0.00205I0.0035J0.002
G01X0.1415Y0.02789
G02X0.15377Y0.02789I0.0061J-0.0035
G01X0.75807Y0.021
G03X0.76161Y0.0I0.0035J0.002
G01X1Y0.0
 
       (End of Profile)
 
#1006=[#1001*#1003]         (#1006 = Current Index Distance, Grind wheel inc. x current pass count)
G54Y[#1004-#1006]            (Select Work Offset #1 - Start Machine Position minus Current Index Distance)
G54X[#1005]F[#1008]         (Select Work Offset #1 - X axis start position Fast feed rate setpoint)
G52Y[#1006]F[#1007]         (Offset Current Point by given distance without motion)
#1003=[#1003+1]            (Increment Current Subroutine Pass Count)
M99                     (Return from subroutine)
%M9                  (Stop coolant and grind disk)

Thanks much, Jim.

Offline Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Incrementing with macros and G52
« Reply #1 on: November 19, 2015, 10:41:58 AM »
It looks like you need to adjust the G54 fixture offset so it reflects the amount it has removed from the wheel at the end of the re-profile.

This can be done using #2601=[#2601+#1006] or #2601=[#2601-#1006] depending on which way you machine is set and placed after the M98P123L#1002 line.

I take no responsibility if there is a BANG!!! so take care.

Without engineers the world stops
Re: Incrementing with macros and G52
« Reply #2 on: November 22, 2015, 09:36:26 PM »
Thank you Graham, that works and no BANG!! Fwiw we are cutting air right now.

Thanks again, Jim.