View Issue Details

IDProjectCategoryView StatusLast Update
0000101FreeCADFeaturepublic2015-08-28 20:58
Reporterchrisb123 Assigned Toyorik  
Status closedResolutionfixed 
Product Version0.10 
Fixed in Version0.16 
Summary0000101: Feature to generate NC code
DescriptionI would like to propose the following feature, to have the ability to generate NC code such as gcode for use in programs such as EMC
Additional InformationHeeksCNC uses the libraries kurve, libarea, libactp and opencamlib
kurve appears to be under the BSD license and the remaining three are under GPLv3
TagsNo tags attached.
FreeCAD Information



2010-06-01 18:13

administrator   ~0000232

OK thanks for the detailed info. However, the GPLv3 is a big problem because we also have the Coin3d library which is under GPLv2 only _without_ the option of any later version. Thus, we're definitely incompatible to GPLv3. This means as long as we don't have a replacement for these libs we cannot upload any binaries. I think we can only write the code binding but it's up to you to build the binaries on your own.


2010-06-02 05:45

viewer   ~0000233

I've played with HeeksCAD but havnt worked out how to generate 3D NC code, I can only get the simple 2D profile and pocketing to work which isnt very useful to me.
So the libraries must be installed by the user, that's easy enough
Freecad just needs to generate code to use these libraries in a similar fashion to the way its done in HeeksCAD...
HeeksCAD generates a python script which is then run to generate the NC code so once I have some example python scripts it shouldn't be too difficult to work out what information is required from freecad in order to create the python script


2010-06-02 05:47

reporter   ~0000234

Can you change the reporter to myself?


2010-06-02 09:40

viewer   ~0000236

The two 3D NC code generation libraries are located here:

libactp is actually GPLv2


2010-06-05 08:44

viewer   ~0000239

PyCAM: generates gcode for 3-Axis CNC machining. , GPLv3+, python. (More like me than the HeeksCNC).

GcodeTools: Inkscape plug-in for 2..2.5d engraving, GPLV2+, python.

>Freecad just needs to generate code to use these libraries in a similar fashion to the way its done in HeeksCAD...

Simple macro like "Export as /temp/blahblah.stl -> "PycamGUI /temp/blahblah.stl" may be more powerful.


2010-09-03 11:47

administrator   ~0000316


2011-10-14 14:01

reporter   ~0001151

I am interested in helping with this. I have worked on HeeksCNC quite a lot and have a good understanding of how things are done there.
On the issue of the GPL3 license and the opencamlib- we might be able to convince Anders to change his license to make it compatible with FreeCAD.


2011-10-14 18:09

viewer   ~0001155

Progress has stalled on this issue


2011-10-15 07:51

administrator   ~0001157

It would be fine to work together on this topic since I have actually no experience on this field


2011-10-15 13:14

reporter   ~0001160

That would be great. There are actually several of us, from the HeeksCNC group, who are interested in doing this.
I am working on getting familiar with FreeCAD and what can be done with it, using the python console.
The first thing I want to work on is dealing with selecting and sorting edges, with python. We can do quite a bit with the HeeksCNC libraries, if we can get primitive 'sketch' (as Dan calls them- lines and arcs in order) elements out to be processed.


2011-10-15 13:45

administrator   ~0001161

In the Part module you'll find the method __sortEdges__ which accepts a list of edge objects and returns the sorted list provided that the edges build a closed wire.

To work with the selection:
E.g. you have selected edges from several objects.

for i in s:
    for e in i.SubElementNames:

# proceed with edges ...


2011-10-15 19:20

viewer   ~0001163

Normally I export the finished model as an stl. Load it up in visualcam and process to get the required g-code I use to put into emc2 to control my cnc mill

Ive used a few cam programs and I prefer this one


2011-10-15 19:22

reporter   ~0001164

check out my blog and see what we have been able to do with HeeksCNC (at least what I've been doing with it):

using opencamlib, we are able to do surfacing and waterline machining
using libarea, we do simpler 2.5D machining


2011-10-15 19:42

reporter   ~0001165

The above 'unauthenticated' post was me

What material were you machining? What did it do for entry especially on the 2nd lower part


2011-10-15 19:49

reporter   ~0001166

On that top post, I was machining 6061 aluminum, using my old Bridgeport mill with a Centroid control. I did a bunch of different operations to get that part to the stage of surface machining. I started with a larger block of aluminum and milled out the outside profile and roughed out around the shape that eventually got 3D surfacing done to it. I used had to do some mods to the then current waterline machining operation to get it to enter the way I wanted. HeeksCNC and opencamlib are diamonds in the rough. I'm very impressed with what is under the hood. The reason to move over to and adapt to FreeCAD is that there is much more momentum going on over here. HeeksCAD doesn't have near the size of the community that FreeCAD does.


2011-10-15 20:12

reporter   ~0001167

It was a finishing pass, can it do roughing?

I too make parts on a cnc machine


2011-10-15 20:19

reporter   ~0001168

I did a lot of the roughing using 2.5D machining. The surfacing on the back of that part was a 20 degree draft angle in aluminum, so I didn't have to worry too much about the finishing pass taking too much of a cut.


2011-10-15 20:50

reporter   ~0001169

roughing is also a reqired feature especially for complex parts and guys with small mills that cant do big passes


2011-10-30 14:27

reporter   ~0001193

I have made some tiny progress on this- I can backplot g-code into FreeCAD and I can extract profile info out of it for processing with HeeksCNC libs.


2012-05-26 23:39

reporter   ~0002084

I see this is nearly a year old but was looking to work on this if it hasn't been completed already.

The brief idea I have is for an interface in FreeCAD to create a python script that does the interaction with libactp (GPLv3 as of source code today).


2012-05-27 21:15

reporter   ~0002093

Go for it, I can help by testing on a CNC mill


2012-05-28 02:05

reporter   ~0002094

I've been looking into the libactp and it looks to be worthless for ideal cnc g-code generation.

The library is extremely limited to the variables that can be adjusted.

With the GPLv2/v3 issue I think it would be best off to build this as a module of FreeCAD. This will eliminate the issue and use what is already available.

I have found the reason for slice not working (does not work with 'compounds').

As soon as the tree finishes building the latest updates I'll start working on the interface and update this with the view. Get your feed back before I work too far into the coding.

Ideas I currently have:
- Two modes
  - mill (cut down a blank to desired part
  - extrude (create a part from nothing, ie: plastic prototyping)

- tool table reference
- tool change script file reference
- spindle speed
- feed rate
- traverse rate
- plunge rate
- direction of cut (conventional/climbing)
- final part selection
- blank part selection
- rough in proximity
- rough in tool
- enable setup comments
  - text tags used as mill points to rapidly place/clamp blank in correct location
- no entry part selection (clamp locations)
- 1,2,4 stage mill
  - 1: mill only what is possible around no entry
  - 2: mill all that can be done, pause for no entry's to be moved, mill remaining
  - 4: rough in, move no entry's, rough in, move no entry's, finish cut, move no entry's, finish cut

- feed rate
- traverse rate
- final part selection
- ??

Let me know what you think about these.



2012-06-02 14:18

reporter   ~0002109

wmayer- I set up the 'New BSD' licensed version of libarea for profile and pocket milling here:

feel free to use it.
I started a half baked cnc workbench here:

I would suggest using PySide for gui code because of licensing issues. It does work too, although I think I have used PyQt4 in that repo.


2012-10-13 18:12

reporter   ~0002451

There is now a CAM sub section in the forum (thanks Werner!).
Luke Parry is helping us out now and will be adding some infrastructure to allow us to add machining operations. He is working on things related to the Document Object and Project Tree right now.
Anders Wallin (OpenCAMLib writer) is interested in helping. Things are starting to move along.


2015-01-01 21:41

administrator   ~0005480

Coming along...


2015-01-24 18:09

administrator   ~0005713

This will be merged after 0.15 release.


2015-08-28 20:58

administrator   ~0006302

This is now done since the Path module merge.

Issue History

Date Modified Username Field Change
2010-06-01 05:56 unauthenticated New Issue
2010-06-01 18:13 wmayer Note Added: 0000232
2010-06-01 18:13 wmayer Assigned To => wmayer
2010-06-01 18:13 wmayer Status new => assigned
2010-06-02 05:45 unauthenticated Note Added: 0000233
2010-06-02 05:47 chrisb123 Note Added: 0000234
2010-06-02 09:35 wmayer Reporter unauthenticated => chrisb123
2010-06-02 09:40 unauthenticated Note Added: 0000236
2010-06-05 08:44 unauthenticated Note Added: 0000239
2010-09-03 11:47 wmayer Note Added: 0000316
2011-10-14 14:01 danielfalck Note Added: 0001151
2011-10-14 18:09 unauthenticated Note Added: 0001155
2011-10-15 07:51 wmayer Note Added: 0001157
2011-10-15 13:14 danielfalck Note Added: 0001160
2011-10-15 13:45 wmayer Note Added: 0001161
2011-10-15 19:20 unauthenticated Note Added: 0001163
2011-10-15 19:22 danielfalck Note Added: 0001164
2011-10-15 19:42 chrisb123 Note Added: 0001165
2011-10-15 19:49 danielfalck Note Added: 0001166
2011-10-15 20:12 chrisb123 Note Added: 0001167
2011-10-15 20:19 danielfalck Note Added: 0001168
2011-10-15 20:50 chrisb123 Note Added: 0001169
2011-10-30 14:27 danielfalck Note Added: 0001193
2012-05-26 23:39 itzdrone Note Added: 0002084
2012-05-27 21:15 chrisb123 Note Added: 0002093
2012-05-28 02:05 itzdrone Note Added: 0002094
2012-06-02 13:48 wmayer Assigned To wmayer =>
2012-06-02 14:18 danielfalck Note Added: 0002109
2012-06-02 14:56 wmayer Status assigned => new
2012-10-13 18:12 danielfalck Note Added: 0002451
2015-01-01 21:40 yorik Assigned To => yorik
2015-01-01 21:40 yorik Status new => assigned
2015-01-01 21:41 yorik Note Added: 0005480
2015-01-24 18:09 yorik Note Added: 0005713
2015-08-28 20:58 yorik Note Added: 0006302
2015-08-28 20:58 yorik Status assigned => closed
2015-08-28 20:58 yorik Resolution open => fixed
2015-08-28 20:58 yorik Fixed in Version => 0.16