What's new
What's new

Heidenhain programming help.


Sep 8, 2009
Manchester England
Hi, I am looking to program this spiral toolpath to create a spiral groove in the face of a part.
Without access to CAM at the moment I was wondering if anyone could help me do this using Q parameters?
Here is a photo of what I need to do and a sample of the program I tried to write, however I cannot get it to work and I think I'm close.
Can anyone help please or guide me??

1 FN 0: Q1 = +50 Center in X axis
2 FN 0: Q2 = +50 Center in Y axis
3 FN 0: Q3 = +50 Starting radius
4 FN 0: Q4 = +10 Increment in radius per step
5 FN 0: Q5 = +0 Starting angle in the plane
6 FN 0: Q6 = +1440 End angle in the plane (for 4 full rotations)
7 FN 0: Q7 = +360 Number of calculation steps
8 FN 0: Q8 = +0 Rotational position of the spiral
9 FN 0: Q9 = +5 Milling depth
10 FN 0: Q10 = +100 Feed rate for plunging
11 FN 0: Q11 = +350 Feed rate for milling
12 FN 0: Q12 = +2 Set-up clearance for pre-positioning
13 BLK FORM 0.1 Z X+0 Y+0 Z-20 Workpiece blank definition
14 BLK FORM 0.2 X+100 Y+100 Z+0
15 TOOL CALL 1 Z S4000 Tool call
16 L Z+250 R0 FMAX Retract the tool
17 CALL LBL 10 Call machining operation
18 L Z+100 R0 FMAX M2 Retract the tool, end program
19 LBL 10 Subprogram 10: Machining operation
20 CYCL DEF 7.0 DATUM SHIFT Shift datum to center of spiral
21 CYCL DEF 7.1 X+Q1
22 CYCL DEF 7.2 Y+Q2
23 CYCL DEF 10.0 ROTATION Account for rotational position in the plane
24 CYCL DEF 10.1 ROT+Q8
25 Q35 = (Q6 - Q5) / Q7 Calculate angle increment
26 Q36 = Q5 Copy starting angle
27 Q37 = 0 Set counter
28 L X+Q1 Y+Q2 R0 FMAX M3 Move to the center of the spiral
29 L Z+Q12 R0 FMAX Pre-position in spindle axis to set-up clearance
30 L Z-Q9 R0 FQ10 Move to working depth
31 LBL 1
32 Q36 = Q36 + Q35 Update the angle
33 Q37 = Q37 + 1 Update the counter
34 Q38 = Q3 + Q4 * Q37 Calculate the current radius
35 Q21 = Q38 * COS Q36 Calculate the current X coordinate
36 Q22 = Q38 * SIN Q36 Calculate the current Y coordinate
37 L X+Q21 Y+Q22 R0 FQ11 Move to the next point
38 FN 12: IF +Q37 LT +Q7 GOTO LBL 1 Unfinished? If not finished, return to LBL 1
39 CYCL DEF 10.0 ROTATION Reset the rotation
40 CYCL DEF 10.1 ROT+0
41 CYCL DEF 7.0 DATUM SHIFT Reset the datum shift
42 CYCL DEF 7.1 X+0
43 CYCL DEF 7.2 Y+0
44 L Z+Q12 R0 FMAX Move to set-up clearance
45 LBL 0 End of subprogram


  • spiral-out.jpg
    63 KB · Views: 10
What exactly is the problem you have?

I fixed some problems i found but in general it works. The biggest problem i found is the fact that in it's current state it is not possible to input the pitch as a parameter.


Here is a link to another example of a simple spiral program with a detailed description how it works: https://www.klartext-portal.com/en/tips/nc-solutions/solution/2d-spirale/


  • test.h.txt
    2.1 KB · Views: 5
  • Love
Reactions: mkd
Thanks FMAX.. yes I see it works now, and as you say altering the PITCH, rotational angle, or calculation steps all effect the outcome.. more work needed, thanks for your input, I am learning slowly how to use Q parameters.
I will do neither. I pay good money for cam. Welcome to 2023
the best CAM posts can output HH cycles to save time and increase performance instead of point to point. Welcome to 2023, indeed. And i'm not talking drill cycles either.