blender CAM/CNC

Hello, I made a very first version of this script, it could be called version 0.001.
It is not for real use!!!
This version is ONLY for other people interested in development. Also, I don’t recommend using the exported Mach3 files yet, although I allready did some real tests.

How to install:
you need python 3 and the polygon library installed, so that blender python finds it:


download version for your distribution, install it, then copy the library from your python installation to blenders python libraries(on win it’s e.g. yourblender/2.63/python/lib/)

then you can download and install the addon:
http://plant.ffa.vutbr.cz/~novak/dwnflz/cam/cam.zip

How to use:
all controls are in render tab(the logic behind this is that it is sort of an output from blender).
after generating the path, a Mach3 file is automatically exported to your blender file folder.
Beware- all units are 1 blender unit = 1m. so 1 mm is 0.001 when writing any values e.t.c.

Features:
lots of props are unsupported and are placeholders, they have a # before their name in the UI.
It is really more a basis or foundation for a future application, although it allready can do several milling strategies:
-Parallel, Cross, Cutout(Outline), Block, Spiral, Waterline(currently broken), Outlinefill(strategy I invented)
-It has preset system for Cutters, Machines.
-It can (and will) position your object, when autonest is enabled.
-some optimisation for paths

-Path computation can take a while, be patient. It’s quite slow actually…
-3d paths are done with raytracing, that takes a while… a bitmap approach would be better, but blenders access to pixels is terribly slow, I would have to use an external image library
-2d paths work best with curves(I mean Cutout only), these actually seem to work best now of all .

Future :
-postprocessors - exporters for different machines. Don’t know what the standards are. My machine doesn’t e.g control spindle at all. The simple Mach 3 export works, although gives only 2 G-code commands, G00 and G01. Some universal system would be nice.
-I would like to improve performance a lot. I am especially interested in paths that would save machining time. Everything is very slow with bigger meshes
-more strategies
-maybe replace Polygon library, currently it is used only for offsetting curves(any ideas anybody?) - Some solid algo for Minkowski sum of polygons would be awesome, this is currently one of the bigger time-stealers.

What I am not personally interested in(because i have a 3 axis machine), but would be nice if someone else can do:
4 and more axes machines
lasercutters e.t.c.
3d printers(this is completely different thing, but a frontend for Skeinforge in Blender would be nice)

This is original post starting this thread:
I thought recently about starting a CAM tool fro generating gcodes for cnc machines and similar from blender.
There is currently no good solution for this in the opensource world, regarding 3d milling.

Is there interest in such a tool? are there more developers who would be interested in this?

these tools are allready available:
inkscape has a gcode generation plugin in 2.49, which seems to be good for various 2d operations, not only for milling but also for laser e.t.c.
there is a script for blender 2.49, but to me it didn’t seem developed enough.
HeeksCAM, which isn’t developed actively, seems to have some good algorithms.
these are all in Python, so some code might be reused.

I am would be interested in this, I haven’t done much CNC work as my field is more construction based but I did some while studying and I want to get back into more Engineering design based stuff and inventing.

Awesome. I just had a discussion about this last week in the FabLab here in Amsterdam. They’d love to be able to use Blender for their CNC machine. Please let me know how it goes!

These people are very much interested in open source CAD-CAM: http://opensourceecology.org/wiki/CAD-CAM_Problem_Statement
I suggest you get it touch with them, maybe register on the forum and post in this topic: http://forum.opensourceecology.org/discussion/739/professional-level-open-source-cadcam-system-freecad-evaluation
They have managed to raise quite a bit of funds, too…

Last year alone there was a few request on how to make blender model ready for CNC

so don’t know if this is part of your goals also?

and as 3D Laser, printing and CNC are becoming more affodable it would be interesting to see a script for doing this!
this would also help blender to become more user friendly

hope you can make one

happy blendering

i

I am interested! I have some technical skills, I want to take part in the proyect.

Well such responses are quite motivating.
I’ve started something, so will upload it somewhere in a few days.
It doesn’t do nothing yet except 3d parallel paths, without any export, but I would like to create a ‘skeleton’ which can be then filled with features.

Tonttu, thanks for information. As far as I’ve seen there isn’t any real CAM code for freecad yet, and I have to say, HeeksCAM handles bigger 3d meshes super-slowly, since it doesn’t obviously have any raytracing optimisation… but various 2d operations and adaptive roughing seem very interesting.

after doing some more tests, I discovered Skeinforge, which is used for reprap, has also some support for milling and is all in python. Will test it and let everybody here know more later.

I’ve been milling Blender models through MasterCAM but I’d be interested in an open-source alternative…

in my humble opinion, if someone thinks about creating a good CAM solution, he should look at delcam powermill. They have modular software that has two main layers. As far as I know one layer generates inner representation of the 3d paths and the other layer is for g-code generation. Separating these tasks to use an api is a good plus as it will allow creating more complex configurable paths.

It would be super if someone had started to work on this seriously. I don’t think python is good solution for this as it’s slow. C/C++ open source core libraries (3d path generator + G-code generator) will be killer :slight_smile:

Generating G-code for Emc2 directly from blender is my old dream. And I would be happy to help as a tester…

ygs, by these 2 layers, you mean the standard paths + postprocessors approach?
I started something like that allready.
I will try to explore Skeinforge, I think it is built allready for doing such tasks - I actually have well working generation of parallel paths over model surface, but I would like to include at least outline and waterline paths too in an initial release, that’s why I am trying to search for good python lib to do the job. By the way, since python mostly uses C libraries(e.g. in blender), it isn’t that slow at all…

Pildanovak, good luck with it and do keep us updated! I have no experience with the coding side of things but am watching this with great interest.

I always dreamed to be able to export models from Blender directly to CNC machines! One guy made a wonderful 5-axis CAM script for 3DMax and GMax that can do this http://cnc-toolkit.com/. Unfortunately 3DMax and GMax are proprietary software and available only for Windows platform. I have no experience with programming and wondered how difficult will be to translate cnc-toolkit script to Blender? I have experience with professional CNC routers and also preparing to build my own 5-axis router.

are you thinking of back/forth raster style 3d milling?

I wrote a 2.5d milling program in flash a while ago: http://www.cnczone.com/forums/opensource_software/106198-partkam_-_free_crossplatform_2_a.html
it even has GA auto-nesting. I don’t know if anyone ended up using it…

the main challenge is the offset algorithm. Blender may have apis that can help with this though. I wouldn’t re-invent the wheel, just use an existing library like libarea to do the offsets.

Jack000 thanks for info, I didn’t find out that that Heeks library can be used separately, seems very interesting. You’re definitely right that offsets are hard to do / I am just hacking around :slight_smile: and the maths for this is allready quite hard.
I somehow couldn’t reach your site to test PartKAM, is it currently down?
I am now 2 weeks without computer(moving stuff to new studio, where in a month I will also have a CNC machine for testing), but that’s good, at least I have time to do more exploration in what is allready available for python.

@pildanovak: Will be your CAM implementation a 3-axis system or you are thinking to make a more complex 5-axis one? I can find some 3-axis opensource CAM software but none is working with 4-5 axis.

artisanicview:
i will have a 3 axis machine myself soon, but I would hope that more people join the effort and extend the functionality with time…

Hello, I made some progress on this project, info in first post.

Also, I had very little time in the past time for coding. Do you think people would be willing to donate for such project?

This would be amazing, I am getting a CNC router in 2 - 3 years and hope this project gets completed in time. Nothing is worse than having to use CAD