Subtractively pass a solid through another in python (or c ++)
I am trying to put together a simple program that will allow me to visualize a series of sequential cuts on a wood panel using a router with a specific cutting head. I am trying to find a geometry library that is capable of subtractively modifying 3D shapes or solids by sweeping other 3D solids.
Specifically, I would like to be able to define a rectangular body (wood panel) and then define a small profile shape and cut through the rectangular body (sometimes in a straight line, sometimes in a circular arc) Does anyone know anything that will do this?
source to share
Moving to C ++ is the way to go, if you have Direct3D / OpenGL experience you can trick TetGen and GTS into putting something together.
WARNING: Very long learning curve.
UPDATE: I recently experimented with Carve CSG and am happy with the results so far. You can easily subtract the cut from the wood panel to get the results you want.
source to share
CGAL looks like it can perform 3D unfolding using 3D Minkowski Sums . (See the "Glide" section further down the page.)
The only limitation I can see so far using Minkowski sums is that if you move an object along a 3D path, you can't seem to rotate the object at the same time. (I could be wrong about this). Sweeping rotation would be useful, for example, if you are trying to simulate a thinning path using a milling or milling bit on the outer surface of a rotating cylinder, for example for the 4th or 5th axis on a milling machine. But the original question was that 3D objects were moved around the 3D objects mimicking plane cuts, such as a tree block, so this limitation might be important to me, but not to the OP.
CGAL is used by OpenSCAD . OpenSCAD has a minkowski () primitive that appears to use the CGAL 3D Minkowski function. OpenSCAD can provide a fast feasibility test as well as possibly a long term trajectory visualization solution. (The last time I looked at this, I didn't think so, but it might have been an earlier version of OpenSCAD.)
CGAL is C ++, open source, with two licenses. So far I have found two python bindings:
- http://cgal-python.gforge.inria.fr/ - unsupported
- http://code.google.com/p/cgal-bindings/ - experimental, incomplete, not sure if it still includes 3D Minkowski
source to share
While it's not really a library, one way to do it might be to build on top of the 2D-to-3D extrusion feature that most of these libraries support. A preliminary algorithm for this could be:
- Get a bit profile as a 2D shape (you probably already have this).
- Extrude this profile along a line or arc that is the toolpath, creating a 3D solid that is the cut shape.
- At each vertex (say where the straight path connects to the curved path), do a "extrusion rotation" or "extrusion rotation" of the bit profile to generate the corner radius - most libraries should support this operation as well.
- Repeat from 2 until all trajectories have been completed.
- Do logical subtraction of CSG (workpiece - set_of_toolpaths).
This algorithm seems to be fraught with edge cases, but I couldn't guess at this yet. I'm wondering why, if it's that simple, the packages are gone.
source to share