Hi Terry,
I didn't really care it being slow. Sometimes it's better leaving it for 15 minutes to do its job than switching for a second operation on the mill.
Here is what I had:
%
G0 G49 G40 G17 G80 G50 G90
(A axis is in revolution mode)
(Program in Diameter mode)
#1 = 6 (number of sides)
#2 = 10 (distance across flats)
#3 = 120 (feed: mm/min)
#4 = 0.1 (Z feed per revolution)
#9 = 10 (length along Z)
#17 = 10 (resolution - number of segments in half flat size)
#5 = [360/#1] (root angle)
#6 = [2*[0.5*#2]/cos[0.5*#5]] (distance across corners)
#7 = [[0.5*#2]*tan[0.5*#5]] (half side length)
#10 = [[0.5*#5]/360] (single segment revolution amount of A axis)
#11 = [#10/#17] (single rotation fraction of A)
#16 = #11
#12 = [[-1*[#4/[#1*2]]]/#17] (Z advance per segment)
#13 = #12
G0 X[#2+1] A0
G0 Z1
G1 X#2 Z.1 F#3
#14 = [-1*[#4/#1]] (Z advance per main subroutine execution)
#15 = FIX[#9/#14] (Number of subroutine executions required - 'L')
M98 P100 L#15
M30
O100
M98 P101 L#17
#16 = #11
M98 P102 L#17
M99
O101
G1 X[2*[0.5*#2]/cos[#16*360]] A#16 Z#13
#16 = [#16 + #11]
#13 = [#13 + #12]
M99
O102
G1 X[2*[0.5*#2]/cos[0.5*#5-#16*360]] A#16 Z#13
#16 = [#16 + #11]
#13 = [#13 + #12]
M99
%
See if you can read it. It has been sometime since I wrote it and it will take me sometime to understand what I meant myself
Dan