I got an idea and am currently implementing it.
It's a very simple 4 (and 5) axis CAM software to generate G-Code from STL models.
Well, I have an affordable 4 axis CNC milling machine. The 4th axis "A" is commonly a rotational axis along Y or X.
But aparently all free software you can get only does 3 axis milling.
The only affordable software I that claims to support 4 axis milling was DeskProto. A fine piece of software and using it with the 4th axis works very well but it only does 3 Axis milling using X,A,Z and keeping Y stationary.
All "real" 4 axis software costs an arm and a leg. Any 5 axis software I could find is completely and utterly out of every hobbyists budget.
Now what I'm implementing won't work for every type of geometry.
I'm trying to but there will always be cases that don't fit my algorithm.
The idea is as follows:
- Run along the A axis from 0 to 360 and along the Y axis, determine the location of the surface (classic pseudo-4-axis milling up to now)
- Then determine the surface normal at that collision point.
- Now calculate the inverse kinematic required to turn the part until the surface normal of that collision point points straight up.
- Determine if this new orientation creates collisions of the tool with other parts of the part or the machine, is outside the movement ranges of the axis or otherwise impossible.
- If it is impossible or if there is a cave beneth the surface, find the start and end of the region that has this property, put a plane through these 2 points that is normal to the A axis and do classic 3 axis milling in these planes.
Why this strategy?
The idea of following the surface normal is that this works like cutting along a contour. You get a surface without any visible steps.
Dents in the surface that can only be reached from certain directions are one problem. The fallback strategy of 3 axis milling takes care of many such cases but cannot work for all cases.
Optimizing the collision detection for finding the surface is much more difficult then in 3 axis milling since you cannot partition your model in advance to only test the triangles that actually can be below the cutter.
I haven't yet thought of any proper algorithms to deal with the fact that the tool has a shape.
Currently it assumes a ball cutter of diameter 0 that can cut with the side just as well as with the tip.
The details of the collision detection of tool and collet with the part are still not clear.
As you see, I need a lot of help with thinking about the proper algorithms, implementing them correctly and a ton of testing.