Building the CAM workbench

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Building the CAM workbench

Post by sliptonic »

A number of people have asked about CAM on G+ and IRC lately. I know the workbench isn't complete but people, myself included, want to play with it anyway and understand where it's going. I've tried to build David's nightly github repo and haven't been able to do it yet. I thought I'd start this thread to collect build notes and share my own findings.

The CAM workbench nightly branch hasn't been rebased for quite a while so if you do an in-source build and switch back and forth, compiling takes a long time. I've pulled the repo into a different directory from my main FreeCAD build so I don't have to recompile everything every time I switch. I just launch freecad directly from the bin directory.

My regular FreeCAD git master branch builds fine. Here's the 'About' info:
OS: Linux Mint 16 Petra
Platform: 32-bit
Version: 0.14.0275 (Git)
Branch: master
Hash: 93fc937bd1422efabbd8ed8d2ad2ebe5c15d8d1d
Python version: 2.7.5+
Qt version: 4.8.4
Coin version: 4.0.0a
SoQt version: 1.5.0
OCC version: 6.7.0

I'm building on Linux Mint and the PIVY install isn't compatible with freecad's internal PIVY so I've edited CMakeLists.txt and changed one line to read:
OPTION(FREECAD_USE_EXTERNAL_PIVY "Use system installed python-pivy instead of the bundled." ON)

Now it compiles to about 52% before failing. That's where I'm at so far.

Code: Select all

[ 52%] Building CXX object src/Mod/Part/App/CMakeFiles/Part.dir/TopoShapeShellPyImp.cpp.o
[ 52%] Building CXX object src/Mod/Part/App/CMakeFiles/Part.dir/TopoShapeSolidPyImp.cpp.o
[ 52%] Building CXX object src/Mod/Part/App/CMakeFiles/Part.dir/TopoShapeVertexPyImp.cpp.o
[ 52%] Building CXX object src/Mod/Part/App/CMakeFiles/Part.dir/TopoShapeWirePyImp.cpp.o
[ 52%] Building CXX object src/Mod/Part/App/CMakeFiles/Part.dir/BRepOffsetAPI_MakePipeShellPyImp.cpp.o
/home/brad/freecam/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp: In member function ‘PyObject* Part::BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject*)’:
/home/brad/freecam/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp:124:116: error: invalid conversion from ‘int’ to ‘BRepFill_TypeOfContact’ [-fpermissive]
     this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(TopoDS::Wire(s), PyObject_IsTrue(curv), PyObject_IsTrue(keep));
                                                                                                                    ^
In file included from /home/brad/freecam/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp:31:0:
/usr/local/lib/oce-0.16-dev/../../include/oce/BRepOffsetAPI_MakePipeShell.hxx:124:28: error:   initializing argument 3 of ‘void BRepOffsetAPI_MakePipeShell::SetMode(const TopoDS_Wire&, Standard_Boolean, BRepFill_TypeOfContact)’ [-fpermissive]
   Standard_EXPORT     void SetMode(const TopoDS_Wire& AuxiliarySpine,const Standard_Boolean CurvilinearEquivalence,const BRepFill_TypeOfContact KeepContact = BRepFill_NoContact) ;
                            ^
make[2]: *** [src/Mod/Part/App/CMakeFiles/Part.dir/BRepOffsetAPI_MakePipeShellPyImp.cpp.o] Error 1
make[1]: *** [src/Mod/Part/App/CMakeFiles/Part.dir/all] Error 2
make: *** [all] Error 2
brad@hairball ~/freecam $ 
User avatar
tanderson69
Veteran
Posts: 1626
Joined: Thu Feb 18, 2010 1:07 am

Re: Building the CAM workbench

Post by tanderson69 »

sliptonic wrote:I'm building on Linux Mint and the PIVY install isn't compatible with freecad's internal PIVY so I've edited CMakeLists.txt and changed one line to read:
OPTION(FREECAD_USE_EXTERNAL_PIVY "Use system installed python-pivy instead of the bundled." ON)
This has been true for a couple of the past releases of ubuntu. Instead of editing the cmakelists file and possibly causing some source control problems, simply pass the needed variable to the cmake command. Like:

Code: Select all

cmake -DFREECAD_BUILD_DEBIAN=ON
You can see what this does in the cmakelists.txt file.

Code: Select all

# if this is set override some options
if (FREECAD_BUILD_DEBIAN)
    set(FREECAD_USE_EXTERNAL_ZIPIOS ON)
    set(FREECAD_USE_EXTERNAL_PIVY ON)
endif (FREECAD_BUILD_DEBIAN)
wmayer
Founder
Posts: 20302
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Building the CAM workbench

Post by wmayer »

[ 52%] Building CXX object src/Mod/Part/App/CMakeFiles/Part.dir/BRepOffsetAPI_MakePipeShellPyImp.cpp.o
This fails because the CAM branch hasn't been updated for a long time and in the meantime the new OCC version changed its interface slightly here and there. The easiest would be to copy over the file from master because this contains the fixes for the OCC API change.
DavidNicholls
Posts: 20
Joined: Sat Feb 22, 2014 10:11 pm

Re: Building the CAM workbench

Post by DavidNicholls »

I've finally been able to merge the master (http://github.com/FreeCAD/FreeCAD_sf_master.git) into my 'nightly' branch and compile on both Windows and Ubuntu 13.10. The resultant version is in the 'nightly' branch of http://github.com/DavidNicholls/FreeCAD_sf_master.git.

The steps I followed were;

Create a new VBox machine for Ubuntu 13.10
Tick the 'install 3rd party drivers'
Tick the 'install udpates'

When started, select the 'Insert Guest Additions CD image' menu option from the Devices menu.
Press enter to allow the guest additions CD image to be installed.

Restart the virtual machine

sudo apt-get install build-essential checkinstall cmake cmake-qt-gui doxygen freecad-dev \
g++ gfortran git libboost-all-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev \
libboost-regex-dev libboost-signals-dev libboost-thread-dev libcoin80-dev libcoin80-doc \
libcoin80-runtime libeigen3-dev libfreetype6 libfreetype6-dev liboce-foundation-dev \
liboce-modeling-dev liboce-ocaf-dev liboce-visualization-dev libode-dev libpyside-dev \
libqt4-dev libqt4-opengl-dev libqtwebkit-dev libshiboken-dev libsimage-dev libsoqt4-dev \
libspnav-dev libtool libxerces-c-dev libzipios++-dev oce-draw python python-dev python-matplotlib \
python-pivy python-pyside python-qt4 qt4-dev-tools swig synaptic zlib1g-dev

Also see 'http://www.freecadweb.org/wiki/index.ph ... and_Ubuntu' for other packages

Fetch the source code from
git clone https://github.com/DavidNicholls/FreeCAD_sf_master.git
cd FreeCAD_sf_master
git checkout nightly
cmake-gui
Browse source and build to /home/david/src/FreeCAD_sf_master and /home/david/src/FreeCAD_sf_master/build respectively.
Press the 'Configure' button
Select 'Yes' to create the non-existent build directory
Select 'Unix Makefiles' as well as 'Use default native compilers'
Press the 'Finish' button
Press 'OK' to the 'error in configuration process, project files may be invalid' warning.
Tick the 'FREECAD_BUILD_DEBIAN' option.
Tick the 'FREECAD_USE_EXTERNAL_PIVY' option.
Press the 'Configure' button again.
Press the 'Add Entry' button to add Name: CMAKE_Fortran_COMPILER Type: FILEPATH Value: /usr/bin/gfortran
Set the 'COIN3D_DOC_PATH' to /usr/share/doc/libcoin80-doc
Set the 'COIN3D_DOC_TAGFILE' to /usr/share/doc/libcoin80-doc/html/coin.tag.gz
Set the 'OCC_INCLUDE_DIR' to /usr/include/oce

cd build
make

And then the resultant executable can be found at build/bin/FreeCAD

In the case of the Windows build, I used the FreeCADLibs_8.2_x86_VC9 library pack. I had tried to use the LibPack_Win64 but failed misserably (aparently due to the 64-bit build). I really don't care about that. As long as I can compile on Windows and Linux and make it run on each then I'm happy. Perhaps now I will be more motivated to keep developing.
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Building the CAM workbench

Post by sliptonic »

I can confirm that it built for me as well (Linux Mint 16)

I just used cmake from the command line like:

Code: Select all

cmake -DFREECAD_BUILD_DEBIAN=ON -DFREECAD_BUILD_CAM=ON
make
It's great to see it building again. Are you going to merge back to Andrew's cam-py branch so we can stay in sync with master going forward?

What's next?
DavidNicholls
Posts: 20
Joined: Sat Feb 22, 2014 10:11 pm

Re: Building the CAM workbench

Post by DavidNicholls »

I will ask Andrew to merge it back into his branch. I think the next move is to simplify our design considerably. I've spent a lot of time working on this module but I still don't understand it. It's too complicated. I would love to move back to be more inline with other FreeCAD modules but it would require us to change the way we load plugins (I think). I won't go into it properly yet because I don't have a good idea as to what needs doing.

I was going to create a new branch and call it 'redesign' so I could demonstrate some of the ideas but I found the whole process daunting. I find the disconnect between TPGs, their data and their settings to be confusing. As I said, I can't backup what I'm suggesting because I don't have a good understanding of it yet but one of the reasons I'm so slow at developing in this framework is that I still don't understand the framework well enough. I realized that the Geometry setting, that is currently stored in the TPG itself, is not being written to the data file. When I looked into why I couldn't think where to move that setting to so that it made sense.
aj5robinson
Posts: 40
Joined: Sat Apr 28, 2012 10:41 am
Location: Melbourne, Australia

Re: Building the CAM workbench

Post by aj5robinson »

Great to see you getting it all compiling again; well done. I have finished off the project that was taking all my time now so will get back into the source and try to remember everything about its design. After that we can have a discussion about simplification as I too agree that it is hindering our progress of getting something working.
DavidNicholls
Posts: 20
Joined: Sat Feb 22, 2014 10:11 pm

Re: Building the CAM workbench

Post by DavidNicholls »

Andrew, that would be great. Once you've had a chance to review the existing code (me too) can I suggest we arrange a design session. We can either do that with just the two of us again or we could arrange some sort of webcam conference (assuming of course that someone knows how to do such a thing). As much as anything I'd like to ask people questions about how FreeCAD does other stuff so that the results can guide our design.

Anyone interested in such a session? Of course we (in Australia) would have to allow for the fact that most of the participants seem to want to sleep during our daytime hours.
User avatar
Chris_G
Veteran
Posts: 2598
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Building the CAM workbench

Post by Chris_G »

Hi,
I follow the Cam workbench developement, although I have no coding skills to help.
This may be useful for your video conference ( I have not tried it yet, but it looks great ) :
https://appear.in/
Christophe
DavidNicholls
Posts: 20
Joined: Sat Feb 22, 2014 10:11 pm

Re: Building the CAM workbench

Post by DavidNicholls »

Thanks very much for the suggestion. I hadn't heard of it before but it looks perfect for our needs.
Post Reply