Welcome to 7th and 8th day of 31 days of Raspberry PI 400.
Today is CAD day. What CAD can run on Raspberry PI OS , if any ? Spoiler alert - FreeCAD can be installed with success. Read everything .
FreeCAD
I've finally configured my PIJuice . Have one since the kickstarter, but never really really had used it. Now, I'm going to do a project and I need to power a Raspbery PI Zero W with the sun to take pictures every 10m or so for about 3 weeks. Yes, I could use a solar power bank (for example - and I have one, from the 1 meter of PI design challenge. Everyone that made at least 10 posts got one) but what's the fun in that ?
Now that it is configured, I need to design a box to put it there, but with a Raspberry PI camera support.
I've read that there was almost none CAD software for Raspberry PI. I use FreeCAD. I just love it. being a long, long, long, long time Linux user, I don't have Fusion 360 or any other more popular really available to me, so I never bother to learn those, but did bother to learn FreeCAD.
In my mind, I was already set to learn a bit more Tinkercad. I've used it before and love their support to import STL files. It is really good - more than of FreeCAD - but I know that the end is not the same .
Reading on the Internet, after all, there's a FreeCAD package available for Raspberry PI OS. Let's install it
Since Python3 is the default Python on my Raspberry PI OS, let's install that package:
sudo apt-get install freecad-python3
And here is a screenshot of all the packages that will be installed (I need to check my free space )
Everything is installed.
A new item on the menu is present:
Let's start FreeCAD and see.
Hurray, FreeCAD splash screen:
And FreeCAD main window:
and it crashes when I try to create a new document... What????
And here's the cause (starting FreeCAD from CLI):
After some careful reading, there's a problem with FreeCAD 0.18 and libcoin.
You can see more information here, and here.
Fortunately, there's a solution: Install from source.
Compile the latest version. It works with Python3 and QT5 . The downside: It will take hours on the Raspberry PI 4, so, I will do it at night.
The FreeCAD WIKI has all the information needed and some folks over at the Raspberry PI forum already did some work to install all the dependencies needed for this.
But, you probably also could do it, using the build-dep command from APT. You need to add the source repositories to APT.
sudo apt build-dep freecad
We're going with the Raspberry PI Forum for the dependencies installation.
First, clone the FreeCAD repository.
pi@raspberrypi:~/Downloads $ git clone https://github.com/FreeCAD/FreeCAD.git freecad-source Cloning into 'freecad-source'... remote: Enumerating objects: 535, done. remote: Counting objects: 100% (535/535), done. remote: Compressing objects: 100% (322/322), done. remote: Total 268821 (delta 283), reused 412 (delta 213), pack-reused 268286 Receiving objects: 100% (268821/268821), 1.24 GiB | 10.83 MiB/s, done. Resolving deltas: 100% (227242/227242), done. Checking out files: 100% (10772/10772), done. pi@raspberrypi:~/Downloads $
Install all the dependencies for FreeCAD
sudo apt install cmake cmake-gui libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-signals-dev libboost-thread-dev libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libocct-data-exchange-dev libocct-ocaf-dev libocct-visualization-dev libopencv-dev libproj-dev libpyside2-dev libqt5opengl5-dev libqt5svg5-dev libqt5webkit5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev libshiboken2-dev libspnav-dev libvtk7-dev libx11-dev libxerces-c-dev libzipios++-dev occt-draw pyside2-tools python3-dev python3-matplotlib python3-pivy python3-ply python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtsvg python3-pyside2.qtwidgets python3-pyside2uic qtbase5-dev qttools5-dev swig
Acording to FreeCAD WIKI, there will be some issues with Pyside tools. Issue the following commands to prevent that:
sudo apt-get install pyqt5-dev sudo apt-get install pyqt5-dev-tools cd /usr/bin/ sudo ln -s pyrcc5 pyside2-rcc sudo ln -s pyuic5 pyside2-uic
Now, go back to the folder where you cloned the FreeCAD repository. create a directory to build the FreeCAD. Still on the Downloads folder
mkdir freecad-build
Enter the directory
cd freecad-build
Configure it
pi@raspberrypi:~/Downloads/freecad-build $ cmake ../freecad-source -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DUSE_PYBIND11=ON
After a while, some summary should appear:
============== Summary report ============== -- Build type: -- Compiler: /usr/bin/c++ (8.3.0) -- Flags: -Wall -Wextra -Wno-write-strings -- Standard: Requires C++17 -- Python: 3.7.3 [/usr/bin/python3.7] [.cpython-37m-arm-linux-gnueabihf] -- PCL: not enabled -- pybind11: not enabled -- Boost: 1.67.0 (106700) -- XercesC: 3.2.2 [/usr/lib/arm-linux-gnueabihf/libxerces-c.so] [/usr/include] -- ZLIB: 1.2.11 -- PyCXX: 6.2.8 [/home/pi/Downloads/freecad-source/src] -- OCC: 7.3.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [/usr/lib/arm-linux-gnueabihf] [/usr/include/opencascade] -- SMESH: build internal -- MEDFile: 4.0.0 [/usr/lib/arm-linux-gnueabihf/libmedC.so] [/usr/include] -- HDF5: 1.10.4 -- VTK: 7.1.1 -- NETGEN: not enabled -- SWIG: 3.0.12 -- Eigen3 3.3.7 -- Qt5Core: 5.11.3 -- Qt5Network: 5.11.3 -- Qt5Xml: 5.11.3 -- Qt5XmlPatterns: 5.11.3 -- Qt5Widgets: 5.11.3 -- Qt5PrintSupport: 5.11.3 -- Qt5OpenGL: 5.11.3 -- Qt5Svg: 5.11.3 -- Qt5UiTools: 5.11.3 -- Qt5Concurrent: 5.11.3 -- Qt5WebKitWidgets: 5.212.0 -- Shiboken2: 5.11.2 [/usr/lib/arm-linux-gnueabihf/cmake/Shiboken2-5.11.2] [/usr/include/shiboken2] -- PySide2: 5.11.2 [/usr/include/PySide2] -- PySide2Tools: [/usr/bin/pyside2-uic] [/usr/bin/pyside2-rcc] -- Freetype: 2.9.1 -- OpenGL: /usr/lib/arm-linux-gnueabihf/libGL.so -- OpenGLU: [/usr/lib/arm-linux-gnueabihf/libGLU.so][/usr/include] -- Coin3D: 4.0.0 [/usr/lib/arm-linux-gnueabihf/libCoin.so] [/usr/include] -- Pivy: 0.6.5a0 -- SPNAV: [/usr/lib/libspnav.so] [/usr/include] -- Matplotlib: 3.0.2 -- Rift: not enabled (BUILD_VR) -- Doxygen: not found ================================================= Now run 'cmake --build /home/pi/Downloads/freecad-build' to build FreeCAD ================================================= -- Configuring done -- Generating done -- Build files have been written to: /home/pi/Downloads/freecad-build
Build it and go to sleep
make -j2
GO TO SLEEP
08/04/2021
Good morning. Well, it did compile without any errors...
It's version 0.20
and still the same error. It's a freaking bug that is still not corrected.
But - there's always a but - because I was keen to have this installed and running, I didn't read (typical) the all thread (5 pages). It was late and I was sleepy. There's one way this will compile, but is an older version (well, not that older - just one release behind). No worries. Let's try it.
This is from the Raspberry PI forums, but the user scruss made a tutorial. Yes, it's going to be build with Python2
sudo apt install cmake build-essential libtool lsb-release swig libboost-dev libboost-date-time-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-serialization-dev libboost-signals-dev libboost-thread-dev libcoin-dev libeigen3-dev libgts-bin libgts-dev libkdtree++-dev libmedc-dev libopencv-dev libproj-dev libvtk6-dev libx11-dev libxerces-c-dev libzipios++-dev qt4-dev-tools libqt4-dev libqt4-opengl-dev libqtwebkit-dev libshiboken-dev libpyside-dev pyside-tools python-dev python-matplotlib python-pivy python-ply python-pyside libocct*-dev occt-draw libsimage-dev doxygen libcoin-doc dh-exec libspnav-dev
MULTITASKING - At the same time it is installing all those above packages, it's dding a ISO to a USB Pen ! Wonderful and without any delays whatsoever that I can see.
wget https://github.com/FreeCAD/FreeCAD/archive/refs/tags/0.19.1.tar.gz tar -zxvf FreeCAD-0.19.1.tar.gz rm -f FreeCAD-0.19.1.tar.gz mkdir freecad-build cd freecad-build cmake -DPYTHON_EXECUTABLE=/usr/bin/python2.7 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython2.7.so -DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/dist-packages/ ../FreeCAD-0.19.1/
and here's the summary:
============== Summary report ============== -- Build type: -- Compiler: /usr/bin/c++ (8.3.0) -- Flags: -Wall -Wextra -Wno-write-strings -- Standard: Requires C++11 -- Python: [/usr/bin/python2.7] [-python2.7] -- PCL: not enabled -- pybind11: not enabled -- Boost: 1.67.0 (106700) -- XercesC: [/usr/lib/arm-linux-gnueabihf/libxerces-c.so] [/usr/include] -- ZLIB: 1.2.11 -- PyCXX: [/home/pi/Downloads/FreeCAD-0.19.1/src] -- OCC: 7.3.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [/usr/lib/arm-linux-gnueabihf] [/usr/include/opencascade] -- SMESH: build internal -- MEDFile: [/usr/lib/arm-linux-gnueabihf/libmedC.so] [/usr/include] -- HDF5: 1.10.4 -- VTK: 6.3.0 -- NETGEN: not enabled -- SWIG: 3.0.12 -- Eigen3 3.3.7 -- Qt4: 4.8.7 -- QtWebKit: found -- Shiboken: 1.2.2 [/usr/include/shiboken] -- PySide: 1.2.2 [/usr/include/PySide] -- PySideTools: [/usr/bin/pyside-uic] [/usr/bin/pyside-rcc] -- Freetype: 2.9.1 -- OpenGL: /usr/lib/arm-linux-gnueabihf/libGL.so -- OpenGLU: /usr/lib/arm-linux-gnueabihf/libGLU.so [/usr/lib/arm-linux-gnueabihf/libGLU.so][/usr/include] -- Coin3D: [/usr/lib/arm-linux-gnueabihf/libCoin.so] [/usr/include] -- SPNAV: [/usr/lib/libspnav.so] [/usr/include] -- Matplotlib: 2.2.3 -- Rift: not enabled (BUILD_VR) -- Doxygen: 1.8.13 -- Language: English -- Coin3D_DOC: not found ================================================= Now run 'cmake --build /home/pi/Downloads/freecad-build' to build FreeCAD ================================================= -- Configuring done -- Generating done -- Build files have been written to: /home/pi/Downloads/freecad-build
Let's build it. According to the tutorial, with 4 threads will take 95 minutes in a Raspberry PI 4 with 4GB of RAM. The time is 10:57 (AM for those of 12h clocks)
make -j4
While this is compiling, I'm still working and there's a small delay in doing things, but that was expected.
I'm working on a Raspberry PI, remotely connected to another Raspberry PI (a zero W) . I feel I'm in Christopher Nolan's Inception.
Here's a screenshot of TOP:
And is now 13:00 (1 PM) and the build is complete. Let's try it before installing it.
Running from the command line
Window open. Let's try and create a new document - this was were it crashed
And success !
FreeCAD is running after almost 3h compiling
Now that it's running, let's install it
Don't install it. It will not run because of a library. But running it from the freecad-build/bin/FreeCAD will work just fine.
Let's create a piece.
FreeCAD for the Raspberry PI is not slow. It really moves well and it's smooth.
Granted, I didn't create any complicated piece and I know I've done some really complicated that in my desktop was slow. But still, for the first one, not bad.
Let's print it !
I have some news regarding the VPN, but that will have to stay to next time. Still had to turn on the Big Sur to connect to my work VPN.