View Full Version : HSM Constant Z profile - G Code

06-28-2010, 03:15 AM
Simple profile (triangle/square with rounded corners) and I want to use HSM CZ strategy.

All I'm doing is finishing the outside profile of some parts. I usually use 2D profile but want to use HSM 'cos I like the toolpaths where it jumps from profile to profile, and I've got 6 parts on the jig so I want it all nice and smooth.

Getting the code is not a problem and essentially the toolpaths are fine, but what annoys me is that the code is so long compared to a 2D profile generated code which is using G2/3 to round the corners. HSM is generating the corners as point to point.

For the 2D profile the code is generated using @line for the straight bits and @arc for the corners, but the HSM uses @line for it all, including the corners. Can I change this or am I stuck with it? I would like to see G2/3 in the corners.

06-29-2010, 12:42 AM
I take it you have "Fit arcs" turned on in HSM. This will add G2/3 moves into the code to replace line moves if its possible.

06-29-2010, 02:17 AM
Hi Dan,

Yes, I tried it with and without 'fit arcs'.

Must be something else as it's using G3 on the lead in/out moves.

Hang on, just tried messing with the tolerances and we seem to be getting somewhere.

However, in the 2D profile I get very exact G2/3 moves with a R15 or whatever, but the HSM is giving R15, R15.1, R14.9 etc around the same curve, with maybe a very short (0.1~0.2mm) linear move splitting the curve into parts.

I'll keep playing.

Brakeman Bob
06-29-2010, 02:53 AM
Hi Matt,

Have you played with the parameters on the "smoothing" tab? I have never had cause to use it myself but on reading the User Guide, it looks promising.

All the best


06-29-2010, 03:11 AM
don't have solidCAM, but I asked myself the same question with other CAM system and had played with the parameter no luck. the only thing I see you can try is force the post output G2/G3.

06-29-2010, 03:28 AM
This isn't going well. I don't understand what's going on. Check this out.

I made a block, 50mm wide x 100mm long x 20mm thick, with R10 fillets on the corners. Then use a 10mm endmill with no compensation around the outside, finish cut only.

The first lot of code is simple 2D profile. As you can see the points are nice and crisp, no decimal places.

N8 (----------------------)
N10 (----------------------)
N11 X90. Y-7. Z10.
N12 Z2.
N13 G1 Z-20. F33
N14 X92. F100
N15 G3 X90. Y-5. R2.
N16 G1 X10.
N17 G2 X-5. Y10. R15.
N18 G1 Y40.
N19 G2 X10. Y55. R15.
N20 G1 X90.
N21 G2 X105. Y40. R15.
N22 G1 Y10.
N23 G2 X90. Y-5. R15.
N24 G3 X88. Y-7. R2.
N25 G1 X90.
N26 G0 Z10.
N27 M5
N28 M9
N29 G91 G28 Z0.

Now, the code below is the same part but using HSM constant Z. Note that wheras example above has a point, let's say this line: N17 G2 X-5. Y10. R15.

The same point in HSM CZ comes out as: N16 G2 X-4.978 Y9.183 R15.0022, which as far as I can work out is 0.04mm to the outside of the intended toolpath.

N11 X92.4766 Y-6.8403 Z10.
N12 Z-20.
N13 G3 X90.3437 Y-4.9827 R2. F33
N14 G1 X90.0928 Y-5. F100
N15 X9.9073
N16 G2 X-4.978 Y9.183 R15.0022
N17 G1 X-4.999 Y40.1915
N18 G2 X9.9073 Y55. R15.0017
N19 G1 X90.0928
N20 G2 X105. Y40.1021 R15.0019
N21 G1 X104.9989 Y9.8085
N22 G2 X91.97 Y-4.8705 R15.0025
N23 G1 X90.3437 Y-4.9827
N24 G3 X88.4861 Y-7.1156 R2. F200
N25 G1 Z10. F20000
N26 M5
N27 M9
N28 G91 G28 Z0.

On the HSM I have the following settings:

Part Setting, facet tolerance - 0.0001mm
Geometry, facet tolerance - 0.0001mm
Passes, tolerance - 0.0001mm
Passes, Point reduction, tolerance - 0.03mm

Now I had to spend about an hours messing about with these to come up with this code, and is the closest I can get to resembling the 2D profile code.

If I go tighter on the point reduction tolerance then I just get long code again and the G2 codes become replaced with linear moves, and even then it doesn't look as if the toolpath is any tighter on the intended tool path than before. And the point: X-4.978 Y9.183 still exists in the code, so apart from a lot of G code it doesn't appear that different.

Maybe I just being finicky but if I want the cutter to go to a point then I want it to go there, not somewhere near.

Using a bigger tolerance in Passes, tolerance such as 0.1mm gives different results again, some accurate some not.

What's going on!!!!

06-29-2010, 04:03 AM

Smoothing doesn't seem to affect anything in this case.

I must be missing something in the .mac or .gpp files, but nothing I've played with seems to make any difference.

The annoying thing is that I use HSM a lot, and find it very swift and fun to use and watch while it's cutting, but this would be the first real shot at a simple profile with it and I can't get my head around the difference between the 2D profile toolpath and the (all over the place) HSM profile.


06-29-2010, 08:25 PM
Hey Matt,

The way that I personally look at these jobs is that if I can do a toolpath with a simple 2D operation then I use a simple 2D operation, end of story.
The other thing I do is only worry about the part. If the part looks good then I personally don't care what the code looks like. I guess that's because I didn't start life as a machinist or code programmer so I don't try to read what the code is doing or how it gets me to where I want to be.
But I know exactly what you mean about the size of the code. I played around with a round boss today, 2 toolpaths, HSM & 2D, same speeds feeds and step-down, same tols on part. 2D 53 lines of code, HSM 7260 lines.

Come to think of it, now I'm getting bugged ............................

06-29-2010, 10:16 PM

As I said, I've used HSM a lot for finishing, but never on a 2D profile such as this. And yes, I do agree that using a 2D strategy on a 2D profile is probably the way to go. But my problem is that I'm a tinkerer. I can't leave anything alone and I NEED to know what's going on. It's not desire, it's necessity!

In my situation I basically think of the idea, design the part, CAM the part, buy the material, make the part and test the part, so I'm involved at all stages. As such I want to make sure that it's all going to plan. And seeing G code that looks to be inaccurate is annoying and frustrating, especially when I can't seem to do anything about it.

As it is, the part I would be using this on does not need to be that accurate. In fact when I was getting them made before I had a VMC I generously gave the shop +/- 0.1mm, so wandering off the intended toolpath by 0.04mm is not really a problem, and you'd never see it on the finished part, and it would have no affect in performance of the part. So why the stress?

Well, what if it was a problem and did affect performance?

Maybe I should finish my coffee before going on as I'm getting stress out again :)

Brakeman Bob
06-30-2010, 03:21 AM
Hi Matt,

I have just replicated your test part and program and I have got exactly the same as you. The only thing I can think is that HSM was developed to meet a need on older CNC's that didn't have sophisticated acceleration & deceleration algorithms built into the control (acc 'n dec in machine tool builder speak) and what we are seeing is the software applying some generic algorithm to account for servo lag. Where they got this algorithm from is anyones guess and I doubt SolidCAM can tell you as the HSM module is an adaptation of another CAM package's kernel.

How it affects performance, well all I can say is on the curvy 3D stuff HSM is 15 ~ 40% faster than the standard SolidCAM 3D module on an old Mori Seiki SH400 with Fanuc 16M whilst on our Hermle with Heidenhain iTNC530 the difference between HSM and vanilla 3D is negligible. Only by machining your test part first with 2D, then at different tolerance settings in HSM would find out just what the impact on geometry is.

I share your pain in needing to know what is just going on under the bonnet, what are the rules the software is working to. I am the same.

06-30-2010, 03:44 AM
Phew, I must say that I'm relieved that it isn't me going crazy.

Bob, your idea of acc 'n dec is probably a good one.

Maybe I'll just stick to a nice easy 2D profile for now on this one and sleep easier.

As for speed, I've found the difference between 3D and HSM negligible on most parts. I use HSM more than 3D now as I can find better control with where the tool is going, and I like the sort of continued motion of the tool. Where the HSM gets me is that it feeds over the part (in the air) as opposed to rapiding (as in 3D). I haven't done anything yet, but I'm sure I can change this. My machine has max cutting feed of 20320m/min (800"/min) so I reckon we can speed things up a bit by cheating the .gpp file into throwing up a G0 if it spots a G1 and a F20320 together. Possible?

Anyway, other things to do, thanks everyone for all your help so far.

If anyone does come up with the answer be sure to let us all know!

06-30-2010, 06:09 PM
You can control your rapid feed rate in the Operation Tool Data dialogue box in HSM. You can set feed in and out and also rapid moves. I'm pretty sure HSM has G0 removed deliberately and replaced by G1 moves to allow for machines that have fixed rapid speeds i.e. with a G0 if you rapid from X0.0 Y0.0 to a point X200.0 Y 20.0 then the tool will get to its Y position 10 times faster than in X thus causing an arc in the path and the possibility of a collision. G1 at max feed solves this.
I also like the fact that you can completely control retract moves by either just clearing your part or totally exiting the job, whatever you need, there is just so much more control and its far less likely (?) to do anything silly.

06-30-2010, 09:58 PM

Good call on the max feed as opposed to rapid. Must say I'd not thought about that but you're correct, throwing a G0 in could cause some nasty results in some cases.

Oh yes, HSM offers so many choices for feed in/out, tool movements, etc etc, and that's why I'll continue to use it over 'normal' 3D.


07-29-2010, 04:39 PM
Hi all

I have asked this in another post, but will delete that one. Has anyone actually figured this out, as I have the same issue, 2d to HSM means 20 lines to 50 million!! (over exaggerated I know). I open the fit arcs tolerance and hey, 0.05 0.03 0.1 etc etc radius errors.

Why would anyone design software in this way. Old machines are old, new machines are new, new software, should be for newer technologies, and keep an archive of old software just in case (for those who love and still own the older style machines)!!!!