# New To CNC Programming.. Can anyone guide me



## 0625272 (Jun 24, 2011)

Hi guys, Sorry if the question sounds silly but I am new to CNC programming. 

I just took heidenhain programming courses and Now I am able to create/code various designs using its own controller however If I want to make a complex 3d shape then I have to use a CAD/CAM package which converts the image/file into g code automatically. So I am confused that why I took heidenhain control programming lesson instead I should have taken CAD/CAM training which does the job easily and automatically. Furthermore, to write a code on heidenhain controller manually takes like ages. Or Is there any other benefit I am not aware of heidenhain control programming?

And If I want to learn CAD/CAM, Which package do you guys suggest I should learn. I already know some CAD (UGS NX and Solidworks only).

I am really confused about this any help would be appreciated.


----------



## willburrrr2003 (Jun 24, 2011)

From my friends that are machinists, and friends that are amature machinists I have been told that while the cad/cam programs generate all the g-code and tool changes...etc, that they make mistakes and you need to be able to read over the code as well as understand it to find and edit them. Also, I have found that g-coding with subroutines and if then else statements, while loops, and such is way nice (with a lot less lines of code to write too  ) , and that my Emc2 software had an add on for "plugging the numbers into a pre-made subroutines" I can generate g-code for parts way fast with it  

Regards,

  Will R. Everett, WA.


----------



## 0625272 (Jun 24, 2011)

willburrrr2003  said:
			
		

> From my friends that are machinists, and friends that are amature machinists I have been told that while the cad/cam programs generate all the g-code and tool changes...etc, that they make mistakes and you need to be able to read over the code as well as understand it to find and edit them. Also, I have found that g-coding with subroutines and if then else statements, while loops, and such is way nice (with a lot less lines of code to write too  ) , and that my Emc2 software had an add on for "plugging the numbers into a pre-made subroutines" I can generate g-code for parts way fast with it
> 
> Regards,
> 
> Will R. Everett, WA.



Thank you very much for replying Will. 
It clears up a lot. Can you please also tell me that does all controls use the G code or only some of them such as Fanuc. Cause When I was learning HiedenHain, I was using M codes only. Or is g code something else?


----------



## blighty (Jun 24, 2011)

M codes tend to be operation, turn coolant on, turn on spindle, change tool ect etc. G-code would be the instructions, go here go there, do a rad cw or acw, feed and rapid and so on...... but i dont see how you was only using M code.

list of M codes
M00 	Program Stop
M01 	Optional (Planned) Stop
M02 	End of program
M03 	Spindle CW
M04 	Spindle CCW
M05 	Spindle OFF
M06 	Tool change
M07 	Coolant #2 ON
M08 	Coolant #1 ON
M09 	Coolant OFF
M10 	Clamp
M11 	Unclamp
M12 	Unassigned
M13 	Spindle CW & Coolant ON
M14 	Spindle CCW & Coolant ON
M15 	Motion +
M16 	Motion -
M17 	Unassigned
M18 	Unassigned
M19 	Oriented spindle stop
M20-M29 	Permanently unassigned
M30 	End of tape
M31 	Interlock bypass
M32-M35 	Unassigned
M36-M39 	Permanently unassigned
M40-M45 	Gear changes if used, otherwise unassigned
M46-M47 	Unassigned
M48 	Cancel M49
M49 	Bypass override
M50-M89 	Unassigned
M90-M99 	Reserved for user

and here's a link for G-codes... http://www.mmattera.com/g-code/gcodes.html

i don't think you have wasted you time ether about learning what you have. it can be very useful to be able to read g code. so if you have a tool crash in the Zaxis and you look at the tool paths in your cam software and find nothing wrong..... now what? if you know G-code you would of seen a line in the beginning of the code (the set up bit) that reads G91 G28 Z0. as you have been on a course you should know what G91 G28 Z0 is ....... i hope i got that line right :-\

as for cad/cam stuff......
unless your loaded forget solidworks at $4'000 a go and probably another $4'000 for solidcam, you'll have to go with bob cad, Dolphin, cam bam and many more.


----------



## willburrrr2003 (Jun 24, 2011)

I believe that M codes are for machine functions, and G codes are for programming the movements, and canned cycles, and general control of your machines functions. example M6t2 tells my machine to issue a tool change to tool number 2 , g0 x1.0 z-1.5 tells my machine to move to x1.0 and z-1.5 at the same time.  As far as I know all cnc controllersuses this type of setup, Fanuc...Siemens...Haas, MACH3, EMC2, etc....

Regards,

  Will R.


----------



## kvom (Jun 24, 2011)

A few comments on the above posts:

1) Conversational controls are very useful for lots of machining that can be defined simply at the mill without doing any external drawing or programming. Machines with these controls also accept g-code programs as well.

2) CAM programs do not generate g-code from CAD files "automatically". They require human inputs to define what do based on the drawings. The programmer defines a sequence of "machine operations", with each such operation related to one or more drawing elements. The elements are typically points or polylines for 2.5D machining. 3D machining use files that define surfaces.

3) For each operation, the programmer needs to supply tool diameter, spindle speed, feed rate, target depth, and depth of cut at a minimum. He/she must also decide on conventional or climb milling.

4) Typically 2.5D machine operations will one of the following classes: drilling, pocketing, profiling. For drilling, information on whether to peck would be supplied along with the other information.

5) The programmer also needs to define a "clearance height" that will be used to ensure that the tool will not collide with any clamps or fixtures when moving laterally.

6) While it's possible to rely completely on the CAM program to generate good g-code, the ability to read and understand code is very useful in detecting problems caused by human error in entering the data. CNC controls allow editing of the code at the machine, which can be a great timesaver.


----------



## 0625272 (Jun 24, 2011)

kvom  said:
			
		

> A few comments on the above posts:
> 
> 1) Conversational controls are very useful for lots of machining that can be defined simply at the mill without doing any external drawing or programming. Machines with these controls also accept g-code programs as well.
> 
> ...



Thanks for clearing my concept. Your post helped me a lot.

And my first question was That I can write a program in Heidenhain controller which does not use g code, it only uses m code and direction are given like this:


```
0 BEGIN PGM Example INCH
1 BLK FORM 0.1 Z X-2 Y-3 Z-0.5
2 BLK FORM 0.2 X+2 Y+3 Z+0 ; Defines a blank form for the test run graphics
3 TOOL CALL 1 Z S3500 ; Call up tool 1 , set spindle speed
4 M6 ; Do the tool change
5 TOOL DEF 2 ; Preload tool 2 into the staging position(your machine may not even do this or need it)
6 CYCL DEF 200 DRILLING ~
Q200=+0.05 ;SET-UP CLEARANCE ~ ; this is your R value from G81
Q201=-0.25 ;DEPTH ~ ; Depth....
Q206=+2.5 ;FEED RATE FOR PLNGNG ~ ; Feed rate
Q202=+0.25 ;PLUNGING DEPTH ~ Cycle 200 is used for 1 shot drilling and G83 peck drilling, this value is your peck.
Q210=+0 ;DWELL TIME AT TOP ~
Q203=+0 ;SURFACE COORDINATE ~ ; This is the face where your start drilling from.
Q204=+0.5 ;2ND SET-UP CLEARANCE ~ , This is the I value, if its different from the setup clearance then its the same as using G98, if its the same, then its the same as using G99
Q211=+0 ;DWELL TIME AT DEPTH ; You want dwell at the bottom of the hole?
7 L X+1.250 Y0.0 Z+0.5 R0 FMAX M3 M8 ; Move the machine to the start position in rapid, start spindle and coolant
8 CYCL CALL ; Executes the drill cycle
9 L X-1.250 Y0 R0 FMAX ; move to next position
10 CYCL CALL ; execute the drill cycle
11 L Z+2 R0 FMAX M9 M5 ; Z retract and spindle/coolant stop
12 L Y0 Z0 R0 FMAX M91 ; Move to Y0 Z0 as measured from the machine datum not the work datum, its the same as G28 G91 Y0 Z0
13 END PGM EXAMPLE IN
```

And G code is something like this:


```
O0001
G40G80G49
G54G00X0Y0Z0
T1M6(.125,EM)
S3500M3
G90G00X1.250Y0.0
G43Z.5H1
M08
G81G98Z-.250F2.5R.05
X-1.250Y0.0
G80M09
G91G28Z0M5
G49
G91G28X0Y0
M01
M99
```

Now What I am asking is that many CAM programs can convert it to g code but can it also convert it to Heidenhain coding as shown above (first coding)?
And the g code I posted is from Fanuc controller I guess. Should I also learn Fanuc Controller?


----------



## blighty (Jun 24, 2011)

whats your end goal?

to make you own cnc or to get a job in cnc?


----------



## Tin Falcon (Jun 24, 2011)

Ultimately you will need G code and m code to run your program. 
for a simple program you can write it by hand.
you can use a conversational plug in the info program what Mach 3 calls wizards and Southwest industries calls conversational programming.
or you can use a Computer automated machining program. 
this Usually involves cad either a seperate program or part of the cam program then you guide the program through the process of converting a drawing to cam then it goes through a post processor to get g-code. 
I use Mach 3 as a machine contol software will likely go with cam bam for cam and have alibre Cad. 
tin


----------



## kvom (Jun 24, 2011)

G-code is reasonably generic, but details vary from control to control. Some examples:

1) Number format
2) spaces between codes
3) the code itself. e.g., some want G00 and G01 vs G0 or G1.

Also, not all codes are supported on every control.

It can be a useful learning experience to hand-code programs at first. Say that you want to mill an outside profile around a rectangle. The first method might be to code moves on a path that is offset from the rectange by the radius of the tool. Then you'd learn about compensation (G41, G42) so that you could just follow the rectangle itself.  That's the progression my votech school course takes, as well as the textbook we used. A result of such exercises is that you'll learn the most common G and M codes by heart.


----------



## 0625272 (Jun 25, 2011)

kvom  said:
			
		

> G-code is reasonably generic, but details vary from control to control. Some examples:
> 
> 1) Number format
> 2) spaces between codes
> ...



I am sorry if i am asking too many questions. ???
I still don't understand. Is here anyone who has done Heidenhain programming? the problem is that I never learned g code before. I only learned Heidenhain programming which I also gave an example:


```
0 BEGIN PGM Example INCH
1 BLK FORM 0.1 Z X-2 Y-3 Z-0.5
2 BLK FORM 0.2 X+2 Y+3 Z+0 ; Defines a blank form for the test run graphics
3 TOOL CALL 1 Z S3500 ; Call up tool 1 , set spindle speed
4 M6 ; Do the tool change
5 TOOL DEF 2 ; Preload tool 2 into the staging position(your machine may not even do this or need it)
6 CYCL DEF 200 DRILLING ~
Q200=+0.05 ;SET-UP CLEARANCE ~ ; this is your R value from G81
Q201=-0.25 ;DEPTH ~ ; Depth....
Q206=+2.5 ;FEED RATE FOR PLNGNG ~ ; Feed rate
Q202=+0.25 ;PLUNGING DEPTH ~ Cycle 200 is used for 1 shot drilling and G83 peck drilling, this value is your peck.
Q210=+0 ;DWELL TIME AT TOP ~
Q203=+0 ;SURFACE COORDINATE ~ ; This is the face where your start drilling from.
Q204=+0.5 ;2ND SET-UP CLEARANCE ~ , This is the I value, if its different from the setup clearance then its the same as using G98, if its the same, then its the same as using G99
Q211=+0 ;DWELL TIME AT DEPTH ; You want dwell at the bottom of the hole?
7 L X+1.250 Y0.0 Z+0.5 R0 FMAX M3 M8 ; Move the machine to the start position in rapid, start spindle and coolant
8 CYCL CALL ; Executes the drill cycle
9 L X-1.250 Y0 R0 FMAX ; move to next position
10 CYCL CALL ; execute the drill cycle
11 L Z+2 R0 FMAX M9 M5 ; Z retract and spindle/coolant stop
12 L Y0 Z0 R0 FMAX M91 ; Move to Y0 Z0 as measured from the machine datum not the work datum, its the same as G28 G91 Y0 Z0
13 END PGM EXAMPLE IN
```

My question is should I also get lessons/training for g codes or its not necessary if I am going to use a CNC VMC lets say Doosan DMN 500 3 axis with Heidenhain controller. And is there any CAM program which can convert the iges or other 3d files into Heidenhain instructions as shown above.


----------



## rcfreak177 (Jun 25, 2011)

Hi,

I believe Desk Proto will post process codes for the Heidenhain system,
maybe have a look at the website, They offer a good deal at the moment with version 4.2 hobby for 250 euro or so with a free upgrade to version 6 later in the year when it is released.
they also offer a 30 day fully functional trial.
Desk Proto will work best by importing stl files and can produce 2.5d, 3d, tool paths
as well as fourth axis indexed and continuous rotary machining.
The only down side is that it is a stand alone cam package so you will need different cad software to produce the drawing. I use this software combined with Bob Cad/Cam Pro mill and lathe then on to Mach 3.

Here is the link to the download page. 
Well worth checking out the whole site to get a grip on the software.

http://www.deskproto.com/download/trialversion.htm

If you like send me a simple STL of a part you would like to make, with tools to be used feeds and speeds and I will write the program through Desk Proto in Hiedenhain format then send it back to you as an example with start point instructions etc.

Baz.


----------



## 0625272 (Jun 25, 2011)

rcfreak177  said:
			
		

> Hi,
> 
> I believe Desk Proto will post process codes for the Heidenhain system,
> maybe have a look at the website, They offer a good deal at the moment with version 4.2 hobby for 250 euro or so with a free upgrade to version 6 later in the year when it is released.
> ...



Baz, Thank you very much for taking some time out to help me. And I dont have the STL file yet but if you already have any simple STL file (3D). Can you show me the example for that? Any simple 3d would do. I just want to see how it works. Thank again. Regards,


----------



## kvom (Jun 25, 2011)

AFAIK, most users of conversational controls do not need/want to convert g-code from CAM into conversational.


----------



## rcfreak177 (Jun 25, 2011)

Well here we go,

below is a file written by Desk Proto in both Heidenhain and iso g code format (mach 3)
please note I have no Heidenhain programming skills what so ever, I am simply trying to help a fellow member understand the differences between the format. I hope it helps a little.

Firstly Heidenhain.

```
0 BEGIN PGM NCPROG MM
1 M6
2 M3
3 R0
4 TOOL CALL 1 Z S2000
5 L X-3.222 Y-3.222 Z+5.000 F6000
6 L X-3.000 Y+20.333 Z+5.000
7 L X-3.000 Y+20.333 Z-9.000 F300
8 L X-2.778 Y+18.778 Z-9.000
9 L X-2.556 Y+17.222 Z-9.000
10 L X-1.889 Y+14.778 Z-9.000
11 L X-1.222 Y+12.778 Z-9.000
12 L X-0.556 Y+11.222 Z-9.000
13 L X+0.111 Y+9.889 Z-9.000
14 L X+0.778 Y+8.778 Z-9.000
15 L X+1.444 Y+7.889 Z-9.000
16 L X+2.111 Y+6.778 Z-9.000
17 L X+2.778 Y+6.111 Z-9.000
18 L X+3.444 Y+5.222 Z-9.000
19 L X+4.111 Y+4.556 Z-9.000
20 L X+4.778 Y+3.889 Z-9.000
21 L X+5.667 Y+3.222 Z-9.000
22 L X+6.333 Y+2.556 Z-9.000
23 L X+7.222 Y+1.889 Z-9.000
24 L X+8.111 Y+1.222 Z-9.000
25 L X+9.222 Y+0.556 Z-9.000
26 L X+10.556 Y-0.111 Z-9.000
27 L X+11.667 Y-0.778 Z-9.000
28 L X+13.444 Y-1.444 Z-9.000
29 L X+15.444 Y-2.111 Z-9.000
30 L X+18.556 Y-2.778 Z-9.000
31 L X+19.889 Y-3.000 Z-9.000
32 L X+24.333 Y-3.000 Z-9.000
33 L X+26.111 Y-2.778 Z-9.000
34 L X+27.889 Y-2.556 Z-9.000
35 L X+30.111 Y-1.889 Z-9.000
36 L X+32.333 Y-1.222 Z-9.000
37 L X+33.667 Y-0.556 Z-9.000
38 L X+35.000 Y+0.111 Z-9.000
39 L X+36.111 Y+0.778 Z-9.000
40 L X+37.222 Y+1.444 Z-9.000
41 L X+38.111 Y+2.111 Z-9.000
42 L X+39.000 Y+2.778 Z-9.000
43 L X+39.667 Y+3.444 Z-9.000
44 L X+40.556 Y+4.111 Z-9.000
45 L X+41.222 Y+4.778 Z-9.000
46 L X+41.889 Y+5.667 Z-9.000
47 L X+42.556 Y+6.556 Z-9.000
48 L X+43.222 Y+7.444 Z-9.000
49 L X+44.333 Y+8.111 Z-9.000
50 L X+45.667 Y+8.333 Z-9.000
51 L X+47.222 Y+8.556 Z-9.000
52 L X+49.889 Y+9.000 Z-9.000
53 L X+52.556 Y+9.222 Z-9.000
54 L X+55.222 Y+9.444 Z-9.000
55 L X+64.778 Y+9.444 Z-9.000
56 L X+67.667 Y+9.222 Z-9.000
57 L X+69.222 Y+9.000 Z-9.000
58 L X+69.889 Y+8.111 Z-9.000
59 L X+70.556 Y+7.444 Z-9.000
60 L X+71.222 Y+6.778 Z-9.000
61 L X+72.111 Y+6.111 Z-9.000
62 L X+73.000 Y+5.444 Z-9.000
63 L X+73.889 Y+4.778 Z-9.000
64 L X+75.000 Y+4.111 Z-9.000
65 L X+76.333 Y+3.444 Z-9.000
66 L X+77.889 Y+2.778 Z-9.000
67 L X+80.111 Y+2.111 Z-9.000
68 L X+81.000 Y+1.889 Z-9.000
69 L X+82.556 Y+1.667 Z-9.000
70 L X+84.111 Y+1.444 Z-9.000
71 L X+87.000 Y+1.444 Z-9.000
72 L X+88.556 Y+1.667 Z-9.000
73 L X+90.111 Y+1.889 Z-9.000
74 L X+92.556 Y+2.556 Z-9.000
75 L X+94.333 Y+3.222 Z-9.000
76 L X+95.667 Y+3.889 Z-9.000
77 L X+96.778 Y+4.556 Z-9.000
78 L X+97.667 Y+5.222 Z-9.000
79 L X+98.556 Y+5.889 Z-9.000
80 L X+99.444 Y+6.556 Z-9.000
81 L X+100.111 Y+7.222 Z-9.000
82 L X+101.000 Y+8.111 Z-9.000
83 L X+101.667 Y+8.778 Z-9.000
84 L X+102.333 Y+9.667 Z-9.000
85 L X+103.000 Y+10.556 Z-9.000
86 L X+103.667 Y+11.667 Z-9.000
87 L X+104.333 Y+12.778 Z-9.000
88 L X+105.000 Y+14.333 Z-9.000
89 L X+105.667 Y+16.333 Z-9.000
90 L X+106.111 Y+17.889 Z-9.000
91 L X+106.333 Y+19.444 Z-9.000
92 L X+106.500 Y+21.000 Z-9.000
93 L X+106.500 Y+23.889 Z-9.000
94 L X+106.333 Y+25.444 Z-9.000
95 L X+106.111 Y+27.000 Z-9.000
96 L X+105.444 Y+29.444 Z-9.000
97 L X+104.778 Y+31.222 Z-9.000
98 L X+104.111 Y+32.556 Z-9.000
99 L X+103.444 Y+33.667 Z-9.000
100 L X+102.778 Y+34.778 Z-9.000
101 L X+102.111 Y+35.667 Z-9.000
102 L X+101.444 Y+36.333 Z-9.000
103 L X+100.778 Y+37.222 Z-9.000
104 L X+100.111 Y+37.889 Z-9.000
105 L X+99.222 Y+38.556 Z-9.000
106 L X+98.556 Y+39.222 Z-9.000
107 L X+97.667 Y+39.889 Z-9.000
108 L X+96.556 Y+40.556 Z-9.000
109 L X+95.444 Y+41.222 Z-9.000
110 L X+93.889 Y+41.889 Z-9.000
111 L X+92.111 Y+42.556 Z-9.000
112 L X+89.444 Y+43.222 Z-9.000
113 L X+87.222 Y+43.444 Z-9.000
114 L X+85.635 Y+43.603 Z-9.000
115 L X+83.889 Y+43.444 Z-9.000
116 L X+81.444 Y+43.222 Z-9.000
117 L X+78.778 Y+42.556 Z-9.000
118 L X+77.000 Y+41.889 Z-9.000
119 L X+75.667 Y+41.222 Z-9.000
120 L X+74.556 Y+40.556 Z-9.000
121 L X+73.444 Y+39.889 Z-9.000
122 L X+72.556 Y+39.222 Z-9.000
123 L X+71.667 Y+38.556 Z-9.000
124 L X+71.000 Y+37.889 Z-9.000
125 L X+70.111 Y+37.000 Z-9.000
126 L X+69.444 Y+36.333 Z-9.000
127 L X+69.000 Y+35.889 Z-9.000
128 L X+66.111 Y+35.667 Z-9.000
129 L X+63.444 Y+35.444 Z-9.000
130 L X+56.556 Y+35.444 Z-9.000
131 L X+53.889 Y+35.667 Z-9.000
132 L X+51.222 Y+35.889 Z-9.000
133 L X+49.222 Y+36.111 Z-9.000
134 L X+46.556 Y+36.556 Z-9.000
135 L X+45.000 Y+36.778 Z-9.000
136 L X+43.667 Y+37.000 Z-9.000
137 L X+43.000 Y+37.889 Z-9.000
138 L X+42.333 Y+38.778 Z-9.000
139 L X+41.667 Y+39.667 Z-9.000
140 L X+41.000 Y+40.333 Z-9.000
141 L X+40.333 Y+41.000 Z-9.000
142 L X+39.667 Y+41.667 Z-9.000
143 L X+38.778 Y+42.333 Z-9.000
144 L X+37.889 Y+43.000 Z-9.000
145 L X+37.000 Y+43.667 Z-9.000
146 L X+36.111 Y+44.333 Z-9.000
147 L X+34.778 Y+45.000 Z-9.000
148 L X+33.444 Y+45.667 Z-9.000
149 L X+31.889 Y+46.333 Z-9.000
150 L X+29.667 Y+47.000 Z-9.000
151 L X+27.000 Y+47.667 Z-9.000
152 L X+25.222 Y+47.889 Z-9.000
153 L X+23.444 Y+48.000 Z-9.000
154 L X+21.444 Y+48.000 Z-9.000
155 L X+19.667 Y+47.889 Z-9.000
156 L X+17.889 Y+47.667 Z-9.000
157 L X+15.000 Y+47.000 Z-9.000
158 L X+13.000 Y+46.333 Z-9.000
159 L X+11.444 Y+45.667 Z-9.000
160 L X+10.333 Y+45.000 Z-9.000
161 L X+9.000 Y+44.333 Z-9.000
162 L X+8.111 Y+43.667 Z-9.000
163 L X+7.000 Y+43.000 Z-9.000
164 L X+6.333 Y+42.333 Z-9.000
165 L X+5.444 Y+41.667 Z-9.000
166 L X+4.556 Y+41.000 Z-9.000
167 L X+3.889 Y+40.111 Z-9.000
168 L X+3.222 Y+39.444 Z-9.000
169 L X+2.556 Y+38.778 Z-9.000
170 L X+1.889 Y+37.889 Z-9.000
171 L X+1.222 Y+36.778 Z-9.000
172 L X+0.556 Y+35.889 Z-9.000
173 L X-0.111 Y+34.778 Z-9.000
174 L X-0.778 Y+33.222 Z-9.000
175 L X-1.444 Y+31.667 Z-9.000
176 L X-2.111 Y+29.444 Z-9.000
177 L X-2.556 Y+27.889 Z-9.000
178 L X-2.778 Y+26.111 Z-9.000
179 L X-3.000 Y+24.333 Z-9.000
180 L X-3.000 Y+20.333 Z-9.000
181 L X-3.000 Y+20.333 Z+5.000 F6000
182 L X+7.667 Y+21.667 Z+5.000
183 L X+7.667 Y+21.667 Z-9.000 F300
184 L X+7.667 Y+23.222 Z-9.000
185 L X+7.889 Y+25.222 Z-9.000
186 L X+8.556 Y+27.444 Z-9.000
187 L X+9.222 Y+29.000 Z-9.000
188 L X+9.889 Y+30.111 Z-9.000
189 L X+10.556 Y+31.222 Z-9.000
190 L X+11.222 Y+31.889 Z-9.000
191 L X+11.889 Y+32.778 Z-9.000
192 L X+12.556 Y+33.444 Z-9.000
193 L X+13.444 Y+34.111 Z-9.000
194 L X+14.333 Y+34.778 Z-9.000
195 L X+15.444 Y+35.444 Z-9.000
196 L X+16.778 Y+36.111 Z-9.000
197 L X+18.556 Y+36.778 Z-9.000
198 L X+20.556 Y+37.222 Z-9.000
199 L X+24.333 Y+37.222 Z-9.000
200 L X+27.000 Y+36.556 Z-9.000
201 L X+28.778 Y+35.889 Z-9.000
202 L X+29.889 Y+35.222 Z-9.000
203 L X+31.000 Y+34.556 Z-9.000
204 L X+31.889 Y+33.889 Z-9.000
205 L X+32.556 Y+33.222 Z-9.000
206 L X+33.222 Y+32.556 Z-9.000
207 L X+33.889 Y+31.889 Z-9.000
208 L X+34.556 Y+31.000 Z-9.000
209 L X+35.222 Y+29.889 Z-9.000
210 L X+35.889 Y+28.778 Z-9.000
211 L X+36.556 Y+27.000 Z-9.000
212 L X+37.222 Y+24.333 Z-9.000
213 L X+37.222 Y+20.556 Z-9.000
214 L X+36.556 Y+17.889 Z-9.000
215 L X+35.889 Y+16.333 Z-9.000
216 L X+35.222 Y+15.000 Z-9.000
217 L X+34.556 Y+14.111 Z-9.000
218 L X+33.889 Y+13.222 Z-9.000
219 L X+33.222 Y+12.333 Z-9.000
220 L X+32.556 Y+11.667 Z-9.000
221 L X+31.667 Y+11.000 Z-9.000
222 L X+30.778 Y+10.333 Z-9.000
223 L X+29.667 Y+9.667 Z-9.000
224 L X+28.556 Y+9.000 Z-9.000
225 L X+26.778 Y+8.333 Z-9.000
226 L X+25.222 Y+7.889 Z-9.000
227 L X+23.222 Y+7.667 Z-9.000
228 L X+21.667 Y+7.667 Z-9.000
229 L X+19.667 Y+7.889 Z-9.000
230 L X+17.444 Y+8.556 Z-9.000
231 L X+16.111 Y+9.222 Z-9.000
232 L X+14.778 Y+9.889 Z-9.000
233 L X+13.889 Y+10.556 Z-9.000
234 L X+13.000 Y+11.222 Z-9.000
235 L X+12.333 Y+11.889 Z-9.000
236 L X+11.667 Y+12.556 Z-9.000
237 L X+11.000 Y+13.444 Z-9.000
238 L X+10.333 Y+14.111 Z-9.000
239 L X+9.667 Y+15.222 Z-9.000
240 L X+9.000 Y+16.556 Z-9.000
241 L X+8.333 Y+18.333 Z-9.000
242 L X+7.889 Y+19.667 Z-9.000
243 L X+7.667 Y+21.667 Z-9.000
244 L X+7.667 Y+21.667 Z+5.000 F6000
245 L X+47.889 Y+19.667 Z+5.000
246 L X+47.889 Y+19.667 Z-9.000 F300
247 L X+47.889 Y+20.111 Z-9.000
248 L X+48.111 Y+20.111 Z-9.000
249 L X+48.111 Y+24.778 Z-9.000
250 L X+47.889 Y+24.778 Z-9.000
251 L X+47.889 Y+25.444 Z-9.000
252 L X+48.333 Y+25.444 Z-9.000
253 L X+50.778 Y+25.222 Z-9.000
254 L X+53.889 Y+25.000 Z-9.000
255 L X+64.556 Y+24.778 Z-9.000
256 L X+64.556 Y+24.111 Z-9.000
257 L X+64.333 Y+24.111 Z-9.000
258 L X+64.333 Y+21.000 Z-9.000
259 L X+64.556 Y+21.000 Z-9.000
260 L X+64.556 Y+20.111 Z-9.000
261 L X+64.111 Y+20.111 Z-9.000
262 L X+64.111 Y+20.333 Z-9.000
263 L X+58.556 Y+20.333 Z-9.000
264 L X+55.444 Y+20.111 Z-9.000
265 L X+52.333 Y+19.889 Z-9.000
266 L X+49.222 Y+19.667 Z-9.000
267 L X+47.889 Y+19.667 Z-9.000
268 L X+47.889 Y+19.667 Z+5.000 F6000
269 L X+75.222 Y+21.222 Z+5.000
270 L X+75.222 Y+21.222 Z-9.000 F300
271 L X+75.222 Y+23.889 Z-9.000
272 L X+75.889 Y+26.333 Z-9.000
273 L X+76.556 Y+27.444 Z-9.000
274 L X+77.222 Y+28.556 Z-9.000
275 L X+77.889 Y+29.444 Z-9.000
276 L X+78.556 Y+30.111 Z-9.000
277 L X+79.444 Y+30.778 Z-9.000
278 L X+80.556 Y+31.444 Z-9.000
279 L X+81.667 Y+32.111 Z-9.000
280 L X+84.111 Y+32.778 Z-9.000
281 L X+86.778 Y+32.778 Z-9.000
282 L X+89.222 Y+32.111 Z-9.000
283 L X+90.556 Y+31.444 Z-9.000
284 L X+91.444 Y+30.778 Z-9.000
285 L X+92.333 Y+30.111 Z-9.000
286 L X+93.000 Y+29.444 Z-9.000
287 L X+93.667 Y+28.556 Z-9.000
288 L X+94.333 Y+27.667 Z-9.000
289 L X+95.000 Y+26.556 Z-9.000
290 L X+95.667 Y+24.556 Z-9.000
291 L X+95.889 Y+22.778 Z-9.000
292 L X+95.889 Y+22.333 Z-9.000
293 L X+95.667 Y+20.556 Z-9.000
294 L X+95.000 Y+18.556 Z-9.000
295 L X+94.333 Y+17.222 Z-9.000
296 L X+93.667 Y+16.333 Z-9.000
297 L X+93.000 Y+15.444 Z-9.000
298 L X+92.111 Y+14.778 Z-9.000
299 L X+91.444 Y+14.111 Z-9.000
300 L X+90.333 Y+13.444 Z-9.000
301 L X+89.000 Y+12.778 Z-9.000
302 L X+87.444 Y+12.333 Z-9.000
303 L X+85.667 Y+12.111 Z-9.000
304 L X+85.222 Y+12.111 Z-9.000
305 L X+83.444 Y+12.333 Z-9.000
306 L X+81.444 Y+13.000 Z-9.000
307 L X+80.333 Y+13.667 Z-9.000
308 L X+79.444 Y+14.333 Z-9.000
309 L X+78.556 Y+15.000 Z-9.000
310 L X+77.889 Y+15.667 Z-9.000
311 L X+77.222 Y+16.556 Z-9.000
312 L X+76.556 Y+17.444 Z-9.000
313 L X+75.889 Y+18.778 Z-9.000
314 L X+75.222 Y+21.222 Z-9.000
315 L X+75.222 Y+21.222 Z+5.000 F6000
316 L X-3.222 Y-3.222 Z+5.000
317 M2
318 END PGM NCPROG MM
```






And also Mach 3 G code

```
G17 G21 G40 G49 G64 G90 G94
G0 X-3.222 Y-3.222 Z5.000
G0 X-3.000 Y20.333
G1 Y20.333 Z-9.000 F25 S5000
G1 X-2.778 Y18.778
G1 X-2.556 Y17.222
G1 X-1.889 Y14.778
G1 X-1.222 Y12.778
G1 X-0.556 Y11.222
G1 X0.111 Y9.889
G1 X0.778 Y8.778
G1 X1.444 Y7.889
G1 X2.111 Y6.778
G1 X2.778 Y6.111
G1 X3.444 Y5.222
G1 X4.111 Y4.556
G1 X4.778 Y3.889
G1 X5.667 Y3.222
G1 X6.333 Y2.556
G1 X7.222 Y1.889
G1 X8.111 Y1.222
G1 X9.222 Y0.556
G1 X10.556 Y-0.111
G1 X11.667 Y-0.778
G1 X13.444 Y-1.444
G1 X15.444 Y-2.111
G1 X18.556 Y-2.778
G1 X19.889 Y-3.000
G1 X24.333
G1 X26.111 Y-2.778
G1 X27.889 Y-2.556
G1 X30.111 Y-1.889
G1 X32.333 Y-1.222
G1 X33.667 Y-0.556
G1 X35.000 Y0.111
G1 X36.111 Y0.778
G1 X37.222 Y1.444
G1 X38.111 Y2.111
G1 X39.000 Y2.778
G1 X39.667 Y3.444
G1 X40.556 Y4.111
G1 X41.222 Y4.778
G1 X41.889 Y5.667
G1 X42.556 Y6.556
G1 X43.222 Y7.444
G1 X44.333 Y8.111
G1 X45.667 Y8.333
G1 X47.222 Y8.556
G1 X49.889 Y9.000
G1 X52.556 Y9.222
G1 X55.222 Y9.444
G1 X64.778
G1 X67.667 Y9.222
G1 X69.222 Y9.000
G1 X69.889 Y8.111
G1 X70.556 Y7.444
G1 X71.222 Y6.778
G1 X72.111 Y6.111
G1 X73.000 Y5.444
G1 X73.889 Y4.778
G1 X75.000 Y4.111
G1 X76.333 Y3.444
G1 X77.889 Y2.778
G1 X80.111 Y2.111
G1 X81.000 Y1.889
G1 X82.556 Y1.667
G1 X84.111 Y1.444
G1 X87.000
G1 X88.556 Y1.667
G1 X90.111 Y1.889
G1 X92.556 Y2.556
G1 X94.333 Y3.222
G1 X95.667 Y3.889
G1 X96.778 Y4.556
G1 X97.667 Y5.222
G1 X98.556 Y5.889
G1 X99.444 Y6.556
G1 X100.111 Y7.222
G1 X101.000 Y8.111
G1 X101.667 Y8.778
G1 X102.333 Y9.667
G1 X103.000 Y10.556
G1 X103.667 Y11.667
G1 X104.333 Y12.778
G1 X105.000 Y14.333
G1 X105.667 Y16.333
G1 X106.111 Y17.889
G1 X106.333 Y19.444
G1 X106.500 Y21.000
G1 Y23.889
G1 X106.333 Y25.444
G1 X106.111 Y27.000
G1 X105.444 Y29.444
G1 X104.778 Y31.222
G1 X104.111 Y32.556
G1 X103.444 Y33.667
G1 X102.778 Y34.778
G1 X102.111 Y35.667
G1 X101.444 Y36.333
G1 X100.778 Y37.222
G1 X100.111 Y37.889
G1 X99.222 Y38.556
G1 X98.556 Y39.222
G1 X97.667 Y39.889
G1 X96.556 Y40.556
G1 X95.444 Y41.222
G1 X93.889 Y41.889
G1 X92.111 Y42.556
G1 X89.444 Y43.222
G1 X87.222 Y43.444
G1 X85.635 Y43.603
G1 X83.889 Y43.444
G1 X81.444 Y43.222
G1 X78.778 Y42.556
G1 X77.000 Y41.889
G1 X75.667 Y41.222
G1 X74.556 Y40.556
G1 X73.444 Y39.889
G1 X72.556 Y39.222
G1 X71.667 Y38.556
G1 X71.000 Y37.889
G1 X70.111 Y37.000
G1 X69.444 Y36.333
G1 X69.000 Y35.889
G1 X66.111 Y35.667
G1 X63.444 Y35.444
G1 X56.556
G1 X53.889 Y35.667
G1 X51.222 Y35.889
G1 X49.222 Y36.111
G1 X46.556 Y36.556
G1 X45.000 Y36.778
G1 X43.667 Y37.000
G1 X43.000 Y37.889
G1 X42.333 Y38.778
G1 X41.667 Y39.667
G1 X41.000 Y40.333
G1 X40.333 Y41.000
G1 X39.667 Y41.667
G1 X38.778 Y42.333
G1 X37.889 Y43.000
G1 X37.000 Y43.667
G1 X36.111 Y44.333
G1 X34.778 Y45.000
G1 X33.444 Y45.667
G1 X31.889 Y46.333
G1 X29.667 Y47.000
G1 X27.000 Y47.667
G1 X25.222 Y47.889
G1 X23.444 Y48.000
G1 X21.444
G1 X19.667 Y47.889
G1 X17.889 Y47.667
G1 X15.000 Y47.000
G1 X13.000 Y46.333
G1 X11.444 Y45.667
G1 X10.333 Y45.000
G1 X9.000 Y44.333
G1 X8.111 Y43.667
G1 X7.000 Y43.000
G1 X6.333 Y42.333
G1 X5.444 Y41.667
G1 X4.556 Y41.000
G1 X3.889 Y40.111
G1 X3.222 Y39.444
G1 X2.556 Y38.778
G1 X1.889 Y37.889
G1 X1.222 Y36.778
G1 X0.556 Y35.889
G1 X-0.111 Y34.778
G1 X-0.778 Y33.222
G1 X-1.444 Y31.667
G1 X-2.111 Y29.444
G1 X-2.556 Y27.889
G1 X-2.778 Y26.111
G1 X-3.000 Y24.333
G1 Y20.333
G0 Y20.333 Z5.000
G0 X7.667 Y21.667
G1 Y21.667 Z-9.000
G1 Y23.222
G1 X7.889 Y25.222
G1 X8.556 Y27.444
G1 X9.222 Y29.000
G1 X9.889 Y30.111
G1 X10.556 Y31.222
G1 X11.222 Y31.889
G1 X11.889 Y32.778
G1 X12.556 Y33.444
G1 X13.444 Y34.111
G1 X14.333 Y34.778
G1 X15.444 Y35.444
G1 X16.778 Y36.111
G1 X18.556 Y36.778
G1 X20.556 Y37.222
G1 X24.333
G1 X27.000 Y36.556
G1 X28.778 Y35.889
G1 X29.889 Y35.222
G1 X31.000 Y34.556
G1 X31.889 Y33.889
G1 X32.556 Y33.222
G1 X33.222 Y32.556
G1 X33.889 Y31.889
G1 X34.556 Y31.000
G1 X35.222 Y29.889
G1 X35.889 Y28.778
G1 X36.556 Y27.000
G1 X37.222 Y24.333
G1 Y20.556
G1 X36.556 Y17.889
G1 X35.889 Y16.333
G1 X35.222 Y15.000
G1 X34.556 Y14.111
G1 X33.889 Y13.222
G1 X33.222 Y12.333
G1 X32.556 Y11.667
G1 X31.667 Y11.000
G1 X30.778 Y10.333
G1 X29.667 Y9.667
G1 X28.556 Y9.000
G1 X26.778 Y8.333
G1 X25.222 Y7.889
G1 X23.222 Y7.667
G1 X21.667
G1 X19.667 Y7.889
G1 X17.444 Y8.556
G1 X16.111 Y9.222
G1 X14.778 Y9.889
G1 X13.889 Y10.556
G1 X13.000 Y11.222
G1 X12.333 Y11.889
G1 X11.667 Y12.556
G1 X11.000 Y13.444
G1 X10.333 Y14.111
G1 X9.667 Y15.222
G1 X9.000 Y16.556
G1 X8.333 Y18.333
G1 X7.889 Y19.667
G1 X7.667 Y21.667
G0 Y21.667 Z5.000
G0 X47.889 Y19.667
G1 Y19.667 Z-9.000
G1 Y20.111
G1 X48.111
G1 Y24.778
G1 X47.889
G1 Y25.444
G1 X48.333
G1 X50.778 Y25.222
G1 X53.889 Y25.000
G1 X64.556 Y24.778
G1 Y24.111
G1 X64.333
G1 Y21.000
G1 X64.556
G1 Y20.111
G1 X64.111
G1 Y20.333
G1 X58.556
G1 X55.444 Y20.111
G1 X52.333 Y19.889
G1 X49.222 Y19.667
G1 X47.889
G0 Y19.667 Z5.000
G0 X75.222 Y21.222
G1 Y21.222 Z-9.000
G1 Y23.889
G1 X75.889 Y26.333
G1 X76.556 Y27.444
G1 X77.222 Y28.556
G1 X77.889 Y29.444
G1 X78.556 Y30.111
G1 X79.444 Y30.778
G1 X80.556 Y31.444
G1 X81.667 Y32.111
G1 X84.111 Y32.778
G1 X86.778
G1 X89.222 Y32.111
G1 X90.556 Y31.444
G1 X91.444 Y30.778
G1 X92.333 Y30.111
G1 X93.000 Y29.444
G1 X93.667 Y28.556
G1 X94.333 Y27.667
G1 X95.000 Y26.556
G1 X95.667 Y24.556
G1 X95.889 Y22.778
G1 Y22.333
G1 X95.667 Y20.556
G1 X95.000 Y18.556
G1 X94.333 Y17.222
G1 X93.667 Y16.333
G1 X93.000 Y15.444
G1 X92.111 Y14.778
G1 X91.444 Y14.111
G1 X90.333 Y13.444
G1 X89.000 Y12.778
G1 X87.444 Y12.333
G1 X85.667 Y12.111
G1 X85.222
G1 X83.444 Y12.333
G1 X81.444 Y13.000
G1 X80.333 Y13.667
G1 X79.444 Y14.333
G1 X78.556 Y15.000
G1 X77.889 Y15.667
G1 X77.222 Y16.556
G1 X76.556 Y17.444
G1 X75.889 Y18.778
G1 X75.222 Y21.222
G0 Y21.222 Z5.000
G0 X-3.222 Y-3.222
M30
```


from what I can see Heidenhain eliminates g codes using linear positioning only and the difference between feed and rapid is stated within the feed rate.


----------



## Tin Falcon (Jun 25, 2011)

HMM yeah looks like you controller does not even use g code. so unless you are uning a more common G-code controler not a lot of point in learning g- code. 
Tin


----------



## mklotz (Jun 25, 2011)

"If someone could tell me how to compress all this info into a paragraph which you can scroll down with i would appreciate it, maybe i could save some space that way."

Enclose your material between html 'code' markers, e.g.


```
[code]
your material here
[*/code]
Leave out the asterisk. It's there so the line won't be interpreted as html.
```
[/code]


----------



## 0625272 (Jun 25, 2011)

@ Baz

Thank you.. Yeah thats write there is no g code in Hiedenhain Controller. So did you used that program to convert this file? Cause now I can input this code into the machine and it will work. Also Do you have the image of what the part looked like?


----------



## kvom (Jun 25, 2011)

The mach3 program has no M3 or M5 to control the spindle, so that could cause problems for a mach3 mill.

I loaded the program into mach3, and the toolpaths show a "dogbone" shape. An issue with this code is that the arcs are generated with many small linear moves rather than allowing the control to interpolate the arcs. That is why the programs are long and why there are no G2/G3 g-codes. The programs would be considerably shorter if the arc paths were replaced by a few G2 moves. Perhaps there's some setting in the CAM program that causes this issue.

If the goal of converting CAM output g-code to Heidenhahn is to avoid learning g-code I suggest you're going about things the wrong way. YMMV.


----------



## 0625272 (Jun 25, 2011)

kvom  said:
			
		

> The mach3 program has no M3 or M5 to control the spindle, so that could cause problems for a mach3 mill.
> 
> I loaded the program into mach3, and the toolpaths show a "dogbone" shape. An issue with this code is that the arcs are generated with many small linear moves rather than allowing the control to interpolate the arcs. That is why the programs are long and why there are no G2/G3 g-codes. *The programs would be considerably shorter if the arc paths were replaced by a few G2 moves*. Perhaps there's some setting in the CAM program that causes this issue.
> 
> If the goal of converting CAM output g-code to Heidenhahn is to avoid learning g-code I suggest you're going about things the wrong way. YMMV.



You may be wrong there my friend. Just like g code there are advance functions to make arcs, tangent spiral etc. But you are right about the part that the program should be using those commands instead of the linear movements.


----------



## woodchip85 (Jun 25, 2011)

I program Heidenhain nearly every day, both using cam and the machine control, for simple programs like drilling a few holes and the odd pocket i tend to use the machine control, for a more complex part like 3d work IE mold work id use my cam package (Delcam Powermill), the main difference programing conversational compared to using a cam package is the way the code is generated, Heidenhain will generate a circular movement from a circle centre and a x/y position, a cam package will create code with liner moves tiny lines moving around the arc/circle. You can switch the heidenhain to ISO/G code programming or to conversational.


----------



## RonGinger (Jun 25, 2011)

> The mach3 program has no M3 or M5 to control the spindle, so that could cause problems for a mach3 mill.



Mach3 does support M3, M4 and M5 for spindle control if you set it up. It may require a relay of contactor, but it is very simple to do.


----------



## rcfreak177 (Jun 25, 2011)

Hi, 

Yes you can shorten up the code by using G2 and G3 interpolation, I was unsure of the code in Hidenhain format so I used small linear movements in my G code, This is not how I would normally go about it on my machine.

M3 and M5 spindle control is very easy to set up, I use this on my lathe through 2 relays as well as a cnc 4 pc spindle board. I do not use this on my mill as the cnc 4 pc board requires to be wired in as an axis and I do not have one spare. I would love to do this in the near future but i would have to modify my mill controller box to 5 axis. 

Yes you can configure the post processors within Desk Proto, The limitations are virtually endless.

And back to 0625272
 I am having trouble getting my image that the code is produced from to upload, basicly it is a dog bone shape the code is written to contour it in 1 pass, not 3d only 2.5d as the code would have been thousands of lines long. in saying that 3d is not a problem to produce. I haven't converted from g code, I simply produced 2 different codes from my cam package using 2 different post processors. ISO G code seems to be the way of the times, why do you want to learn Heidenhain code? Do you have a machine that uses this type of controller?

And finally it is great to see just how much support is out there in regards to cnc.
The amount of Hobby users going cnc control never ceases to knock my socks off.

AAAAHHHHH" Its Sunday morning in Perth Australia and my brain hurts.

Regards Baz.


----------



## kvom (Jun 25, 2011)

RonGinger  said:
			
		

> Mach3 does support M3, M4 and M5 for spindle control if you set it up. It may require a relay of contactor, but it is very simple to do.



I was just saying that there was no M3 or M5 in the posted program.


----------



## rcfreak177 (Jun 26, 2011)

Hi,

Spindle control via mach 3 lathe is great, I just love the sound of constant surface speed particularly while parting off and threading. I tell you what I have had a few mates near on fall off their chairs watching a small hobby lathe start the spindle out of the blue, speed up to the programmed speed and engage css machine the part then slow down and switch off at the end of the file. Just like the real deal, Really looking forward to incorporating this technology into my SX3 Mill, Planning on scrapping all the SX3 control boards and fitting a VFD.

Cheers Baz.


----------

