Sunday 25 November 2012

Further Progress on CAM Module API

It's been over a month since the last post. We are making good progress on the CAM Module. Andrew Robinson has being putting his great coding skills to creating a very powerful API for creating Tool Path Plugins - considerably better than what I had already achieved. It's great to reflect on the different perspective on approaching a given problem. Our greatest difficulty is probably the time zone difference, when he is awake, I am a sleep. It's made communication interesting at times, especially the late nights.

With major rewriting of the API and being quite busy on my own project recently, I haven't been involved as much other than discussion.

New Github branch:

To collaborate better and remove old code, following a manual merge we had to also create a new Git-hub branch titled cam-py to push our work to.

Taking a step back to take big steps ahead!

From working together, it was clearly obvious that using Boost::Python was not the most elegant of solutions and having no experience with python it was not the most elegant method of approaching the loading and registering plugins.

Over the course of the past month, Andrew has been developing the python plugin loading and re factoring some of the factory methods lower down, so that Python plugins can be searched and loaded at run time. This essentially means you can rewrite and edit your scripts whilst FreeCAD is running. Potentially we could explore the idea of having a script window. What would be interesting in the long term is having an online plugin repository that allows individual developers / users to tweak the scripts and share these with everyone online.

Dynamic Loading of Library Plugins:

Most applications allow library plugins or extensions to be dynamically loaded at run time. Having compiled library plugins creates an interface to allow proprietary plugins to work with the FreeCAD cam module. It could be argued that we should promote openness but it gives freedom and flexibility for commercial developers to offer their solution using FreeCAD. 

Also we have decided that for the Cam Module, all c++ TPGs will be loaded dynamically like this. Since each plugin is loaded on demand, memory consumption should be reduced and loading times when switching to this work bench should be improved.

Building up GUI interface:

Andrew did some work on the GUI using a separate dock interface - which currently scans and loads python plugins into the application. Below is a screenshot demonstrating that Cam Module loading two python based plugins. 

The design of our API aims to have no discrete distinction when loading and using c++ and python TPG plugins inside the CAM Module. 

Next steps:

Work will continue on getting the API working and building the plugin infrastructure into the FreeCAD document structure so that we can allow geometry to be extracted and used by the plugins in their algorithms. Also how data is stored permanently needs to be implemented too.