543,838 active members*
1,905 visitors online*

1. ## 3d offset algorithm

We are making a self-made program for controlling a CNC machine and we would like to include a general 3d tool offset algorithm (we have the 2D case sorted out as described in Thread: Offset Algorithm). The particular case we are after is a simple cylindrical shaft tool, but need to offset the shape to cut in the general 3D case. Does anyone have any ideas or if there is some useful code around? Your help is greatly appreciated!

Regards
Mark

2. ## Re: 3d offset algorithm

Hi Marksk - Sounds like fun but your going down a tough path to generalise a 3D path. There are many tool end shapes and calculating the locus of these to create an accurate offset for say a bowl tool, then a square tool then a round tool is a mission. You need a good mathematician who is into geometry and jacobians. There are so many CAM systems that are free why do this? I'm not saying you shouldn't but why? Its one thing to have a tool path offset from the surface but then you need a path strategy. A high speed machining strategy is needed these days and that is much more complex then a simple offset zig zag? Then there is the velocity planning. A machine does not follow the exact coordinates of the toolpath, it is modified by the velocity planner to produce a smooth path. Advanced controllers have adaptive planners that run the path several times and control acceleration and jerk to produce very very smooth toolpaths. There are so many layers to this interesting area of manufacture.

Grasshopper would automate a lot of this, have you seen grasshopper? Peter

https://www.rhino3d.com/6/new/grasshopper

3. ## Re: 3d offset algorithm

Hello peteeng, thank you for your tips. Indeed it has been a lot of fun. The point is that we want to change tool size on the fly, then the code should calculate a new g-code as you interactively change the tool size. We have already included accelerations, jerk etc, and also the offset for the 2D case. We just need to expand it. I will check Grasshopper out but what we really need is direct calculation from our own software. Perhaps the book you suggested has some equations (for the moment I cannot open it).

cheers!

4. ## Re: 3d offset algorithm

Hi Marksk - But why on the fly? A machinist does not get half way thru a job and say hey I think I'll change the tool! They have sat down and simulated several toolpaths offline, figured out what is the best one in terms of tooling and time and then goes and sets up the machine with all the decisions made. Its a recipe for disaster to make decisions at the coal face "on the fly!" If by on the fly you mean offline then CAM systems already do that. You change the tool and recalculate the toolpath. Describe a little better what you are trying to achieve? plus how are you handling jerk? adaptively or in one algorithm? Peter

link works for me, seems some links work and others don't in this system.... maybe a security setting. I'll look at our other thread.

5. ## Re: 3d offset algorithm

Hi Peter,

Well on the fly was probably the wrong expression. In reality we want to say, cut the same g-code with 2 or 3 different tools. But while I am cutting, I might decide I need to use at the very end a smaller tool to clean off the sharp corners for example. Then I would like to recalculate the whole program with the new tool radius. As I said we readily do that for 2D, and we operate like this for some time (we make small gears, clockwork mechanisms etc etc for fun). I hope this explains better. About the jerk, sorry we don't do that, I meant we have own algorithms for calculating the accelerations etc. We can change the feed speed on the fly (as with usual CNC machines) and then the accelerations are auto-calculated on the fly during the program. This is standard practice. For the radius correction, you are right, this is NOT on-the-fly.
I hope I have explained better what we need to do, and that someone has some code or some information we can use. We would like to include it in our own software for the simple case of cylindrical tools (not the complex ball-radius tools) and have an easy way to recalculate things, as we already do.

Thanks
Mark

6. ## Re: 3d offset algorithm

Hi Mark - OK I'll leave you to solve that little problem. Have more fun. Peter

7. ## Re: 3d offset algorithm

hy mark, offseting requires a geometrical entity ( segment / arch / bezier / formula / 3d cloud ) and a direction

for example, offseting a circle :
... in plane : will result in a bigger or smaller circle, depending on direction
... in space : will result in a series of circles, that will all be among the surface of a donut ( this was a particular example, but i find it sugestive ... however, generaly speaking, is possible to offset a circle in space, and obtain a shape that is not circular ... maybe it does not make sense, but imagine that is possible to machine a circle, without using a circular toolpath inside the machine )

thus in a plane, offseting generates 2 results, while in space it generates an infinity of results

you have to define the direction among which the geometrical entity has to expand/shift

let's say that you wish to offset a 3d cloud in respect to a tree : you calculate for each point of the cloud the shortest distance to the tree, and voila, this will also give you the direction; each point of the cloud may have associated a different direction

let's say that you wish to offset a random 3d toolpath in respect to a solid : you discretizeze the 3d toolpath into segments, thus you obtain the cloud ... then you offset the cloud, and you may apply a smoothing algorithm among the final result

let's say that you wish to generate the toolpaths for a 2.5d axis cnc : you intersect the solid with a plane paralel to xy, and this will generate at least one closed 2d contour, and from here is basic planar offset

kindly

8. ## Re: 3d offset algorithm

Thanks for the recommendations.

9. ## Re: 3d offset algorithm

I wrote a term paper on a similar topic with algorithms. I never had a talent for writing. Therefore, I decided to read the reviews on the site https://www.topwritersreview.com/reviews/essayedge/ and turn for help to the experts. Thanks to them, I was able to submit my term paper on time. And I didn't have to sit for days on books and materials.