Creating NC files from Blender 3d Bezier CurvesBlender has lots of potential as a cad-cam system but until now I've been unable to create toolpaths with blender.It is beyond comphrension the amount of info about Blender on the www. These pages are some of my favorites: Robert Burke's Precision Modelling PDF Guide An introduction to architecture modeling with Blender by Yorik van Havre Greybeard's Video Tutorials Eugene's Blender Video Tutorials at Geneome.net BackgroundI've been making jewelry for over 35 years and for the last 12 years have been machining wax models on cnc mills. Examples of my work are here: www.5xj.com.I wrote the mill program and built the cnc mills so I have a fairly good understanding on the cnc side of the problem. While surfing the web this month I found two web pages that enabled me to write BezierNC.exe. Matt Ebb's Exporting Blender's 3D Curves script: export_curves_fcollada-1.1.py Nils Pipenbrinck's description of using the DeCasteljau Algorithm to calculate bezier-curves Getting Bezier Curves out of Blender and writting NC filesI edited Matt's script so it writes only the info I need and named it export_curves_xyz.py.Now that I have the curve points and translation, scale, rotation object modifiers I was able to write a routine that creates nc files. Nils wrote about his 'c' code: I think there is not much to say about this simple c-code... it's easy, and with the explanations above you should be able to understand how it works. Feel free to rip/modify/rape this code... Well - I did and I feel good! The most interesting thing I did with Nil's code was to add a variable number of points to the curve routine. I measure the distance between the four Bezier curve points (handles) - divide this length by a min_seg variable and use this number in the 'for' loop which creates the bezier points. This means I get uniform high resolultion *.nc curves without adding vertex's in blender. What exactly is BezierNC.exe?BezierNC.exe is a routine that reads Bezier curve points exported from Blender 3d with ExportBezierCurveXYZ.py and writes Cartesian frame (3x) and Cylindrical frame (4x) toolpaths for cnc mills .I run my mills in DOS and do all my programming in 'C' (watcom). Dos is the perfect operating system for real time applications. (sorry - windows just doesn't cut it here) So I wrote BezierNC.exe as a dos program (that will also run in windows) - no fancy interfaces but it gets the job done. If I were an experencied python programmer I'd do the whole thing in the python script (but you have to use the tools you know how to use). I've tried to add sufficent comments in the BezierNC source files to explain what's going on. BezierNC_ver103.ZIP 7-7-08BezierNC_Ver105a.zip 7/23/08BezierNC_Ver104_Test_Files.zip 7/19/08CNC MillsI Love You Chinese Character ExampleI Love You Chinese Pocketed Paths - First Draft 7/14/08This is a work in progress, last update: 7/07/08 Roy Goodell |