## Basic Cutter Location Studies

Wednesday, March 22nd, 2006 at 10:34 am

Neel D asked in an email about how to do cutter location for a 3-axis tool. He’d read:

http://dimacs.rutgers.edu/Workshops/CompAided/slides/lee2.pdf

The interesting thing about all the academic publications of cutter location (using offset surfaces) is that it bears no relation whatsoever to how it is done in the real world. I’ve had conversations with the academics who publish these books and papers and they absolutely refuse to get it, since they don’t accept the fact that no CAM system does it their standard way is evidence of something important. Ten years of writing and selling this software in the field does not qualify me as having a valid point of view, whereas writing a few papers about a technique that doesn’t actually work somehow does.

The evidence that it doesn’t work is in the academic papers themselves, in the fact that they keep running into the same insoluble problems, while not accepting that considering a method where those problems don’t exist is the way forward.

It’s all very unfortunate for the science because it means a great deal of work that is done in academia is utterly wasted due to not getting the foundamentals right, and running aground at a lower level as a consequence. Had they got it right, there’s a chance they’d be making many contributions to the state of the art today. As it is, most journal articles on CAM are not even worth reading.

Someone could write a very interesting study of how the disconnect between industrial CAM software and academic CAM research came about and has persisted for so long, and everyone could learn a lot about how to adjust the scientific method to account for the general category of engineering science, but there is no way it would get published in a respectable scientific journal (ie one that influences people). Perhaps this is the crux of the problem.

Very very briefly, the cutter location function used everywhere in the CAM industry is as follows.

You have a function which takes a point `(x, y)`, a tool definition T, and a single triangle tr, and returns z:

`z = cl(x, y, T, tr),`

where (x,y,z) is the position you need to put T at in order for it to just touch but not interfere with triangle tr.

If you have a surface S, which is just a set of triangles, then the full cutter location against that is simply:

`z = cl(x, y, T, S) = max { cl(x, y, T, tr) for all tr in S }`

(1) Is the point(x,y) on the model or is it above the model and then a Z value is found such that the tool T doesnot gouge triangle tr.

(2) So we are dropping the tool down incrementally and verifying gouge for each Z value till we just touch but not interfere with triangle tr?

(3) Do we provide a set of triangles that are below point(x,y) and under the tool shadow ?

(4) How do we do it for constant Z slices, do we calculate the slices directly on model and then find cutter location points using this slices ?
How do we generate single closed non gouging slice having same Z value?

(1) The point (x,y) is on the clearance plane. Many types of toolpath are made from curves defined in this flat clearance plane whose points are sampled and projected down as cutter locations by giving them their z-coordinates.

(2) That would be one way to imagine it. In practice you can just as easily calculate the point of contact by using reams of tedious code that runs each different toolshape and against the seven components you have for each triangle (3 points, 3 edges, one face).

For a ballnosed tool of radius r at position (x,y) against a corner point of a triangle at `(px, py, pz)`, you first work out the horizontal distance

`d = sqrt((px - x)^2 + (py - y)^2)`

If `d > r` the tool misses it entirely, so you set the result as z-lo, the height of the base plane. Otherwise, the result is:

`z = pz + sqrt(r^2 - d^2) - r`

And so on, for dozens of other cases for all different toolshapes. It takes several weeks to write out if you go at it, and is about as entertaining as replastering a four storey house on your own.

(3) It’s not necessary, because whenever the tool misses the triangle the value you get is z-lo, the base plane. However, if you write a module that does this it will run faster. It’s important always to keep in mind the distinction between the fundamental algorithm, which is usually very simple, and the optimizing code which is where the real complexity usually lies. The optimizing is not important for understanding.

(4) That’s a different problem which I won’t go into right now. But a good way to imagine it is you turn the model on its side and do one straight toolpath from the top to the bottom, and then turn it back upright again. You’ve now got a piece of Z-slice. What remains is to do it from several different directions and link them up.

• 1. Freesteel » Blog Ar&hellip replies at 13th April 2006, 10:04 pm :

[…] the toolspace by setting the appropriate Z values for a series of XY points along the path according to my previous post. The sample rate is set according to the toolsize and the machining tolera […]

• 2. Anders Wallin replies at 21st July 2006, 8:02 am :

Hi,

first, thanks for the great blog and informative posts.

I’m wondering about toolpath generation algorithms. If I understand what you write above, this results in many many small linear moves.

So if I want to generate a toolpath for a circle or a straight line of length 10mm with tolerance 0.001mm with this approach the toolpath generator will output about 10k of small linear segments.

What, if any, post-processing is then done on these small segments in order to recongize straight lines (G1) and circular arcs (G2/G3) ?

Or, is there some magic done to recongize lines and arcs beforehand and then only applying the brute-force cl-method described above for complex surfaces ?

TIA,

AW

• 3. Julian replies at 21st July 2006, 4:12 pm :

The adaptive roughing algorithm at the moment works by sampling lots of little line segments. The post-processor can filter them together crudely at the moment.

The next version of the algorithm will be able to model circular arcs properly, and probe the stock with them. This should even improve the speed. I’m just leaving it out for now to keep the system as robust as possible.

In general circular arcs are not derived from surface machining since they would come only from very special cases. For example, a parallel pass perpendicularly across a horizontal cylinder with a ballnosed cutter will produce a vertical arc in the toolpath. But change one aspect of this picture slightly, by tilting the cylinder, changing the machining angle, or not use a ballnosed cutter, and you lose the circularity. The special case is so rare that it is not worth pursuing.

• 4. Anders replies at 13th March 2007, 10:43 pm :

Hi Julian,

just found one more of those largely useless academic papers:
http://dx.doi.org/10.1016/S0010-4485(00)00136-6

ðŸ™‚

Can you comment on how the freesteel adaptive algorithm is similar or different in comparison to what is published in that paper ? Just browsed through the paper and it seems a stock-model (‘match-stick’ as you describe elsewhere?) is used, but the machining strategies in the paper seem to be conventional geometry based ?

regards,

Anders

• 5. Julian replies at 14th March 2007, 10:18 am :

Hey, you’ve found it! That paper took two years to be rejected, then Arthur Flutter rewrote it, taking everything of any possible interest out of it, and put his name at the front. The experience taught me never to waste my time like that again. I’ll stick to writing code that does stuff. In programming, theory follows practice by a long margin.

I only thought up (read: worked out how to implement) the adaptive algorithm after 2004. But the concept is already there.

In that paper example you take the previous machining operation and build up a match-stick stock model. This model then remains static and is used to determine the subsequent machining operation. (It determines the area in which it operates.)

The big idea is to do that for every single tool movement: Make the first 1mm of the toolpath, calculate a stock model, use the stock model to determine the second 1mm of toolpath, and so on.

You need to use something a bit smarter than the match-stick model, but not much. I’ve tried to explain it a couple of times, but it doesn’t make sense to most people because it doesn’t sound very hot. Theory follows practice. I’ll say that the trick is to go for a direct calculation that misses out the intermediate and intuitively easier to understand step along the way.

• 6. Freesteel » Blog Ar&hellip replies at 16th January 2008, 12:13 pm :

[…] tures on which everything else is built can be counted on the fingers of one hand (even if the most fundamental one is generally overlooked by academic study). 5- […]

• 7. Freesteel&hellip replies at 8th October 2008, 3:58 pm :

[…] lowered along its axis towards a triangulated surface until it makes contact. I have discussed this here, where I also add my usual complaint about how almost all of published academic literature on […]