3D modeling on the Raspberry Pi with FreeCAD

Lead Image © Nastya Bobko, 123RF.com

Building Blocks

FreeCAD makes 3D modeling on the Raspberry Pi easy, even for beginners. A service provider prints the product.

To model and produce 3D objects, you need a 3D printer and, most importantly, a 3D CAD (computer-aided design) program, which lets you construct an object down to the last detail. In the not-too-distant past, 3D modeling applications required powerful workstations and expensive programs. In today's world, a Raspberry Pi and the open source software FreeCAD are all you need. For the practice test described in this article, I developed a case for the Raspberry Pi with a display, and I had a 3D printing provider print the design.

Before embarking on the test, I had professional experience with 2D CAD programs and only rudimentary exposure to 3D CAD, dating back to my days as a mechanical engineering student in the early 1990s. During the course of my research, I tested a number of CAD applications on various systems, including AutoSketch, Blender, 3DScratch, Tinkercad, and others; however, I couldn't get excited about any of these programs.

When it came time to test FreeCAD [1], things clicked right away. This program runs on Linux, Mac OS X, and Windows, and a portable release [2] even works on a Windows system with restricted rights. A number of video tutorials on YouTube can help you familiarize yourself with FreeCAD [3] [4], and the FreeCAD website directs you to a number of offsite tutorial providers [5]. The documentation is very detailed, and it comes with illustrations, so after about 15 minutes, you should be able to complete your first project from a simple metal plate (Figure 1).

Figure 1: Starting out in FreeCAD with a small metal plate.

FreeCAD on the Pi

If you don't have a standard-sized computer, you can perform CAD tasks by equipping the Raspberry Pi with FreeCAD. Putting a CAD program on the Rasp Pi might seem like a futile endeavor because of the unexciting computing power of the Raspberry Pi CPU and GPU. However, the OpenGL support recently introduced in Raspbian [6] lets FreeCAD work sufficiently fast to complete smaller projects on the Rasp Pi. To perform your own tests, you should therefore bring the system installed on your Rasp Pi up to date and then reboot:

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo reboot

The Raspberry Pi Foundation recommends securing the current system on the Rasp Pi before installing the OpenGL drivers since these are still experimental. If necessary, you should make an image of the current installation. However, you can skip this step when starting out on a freshly installed Raspbian without any special settings.

If possible, FreeCAD should be installed simultaneously with the OpenGL drivers on Raspbian (see also the "Activating OpenGL" box):

$ sudo apt-get install xcompmgr libgl1-mesa-dri
$ sudo apt-get install freecad freecad-doc

Activating OpenGL

FreeCAD does not run smoothly on the Rasp Pi, even after installation of the OpenGL drivers, because additional configuration is needed. Hardware acceleration is activated in the computer settings, so you should invoke sudo raspi-config and turn on the GL Driver option in Advanced Options (Figure 2).

When performing this operation, you should note that the function only works with the Raspberry Pi 2 or 3 (RPi2/RPi3). These are the only two versions of the computer possessing the necessary space. Moreover, if you activate this setting on a Pi2 or Pi3 and then insert the SD card into a first-generation Rasp Pi or even a Pi Zero, the computer will refuse to start.

The system proceeds cautiously when activating OpenGL support, turning off existing settings for overclocking. The corresponding sections in the /boot/config.txt are automatically commented out by the routine. When I later enabled overclocking on my RPi2, it resulted in a black display screen. As is known from official announcements, it is not possible to overclock the RPi3.

Concurrently, you should increase the working memory allocated to the graphics chip. In the standard settings, the chip has just 64MB. This small amount of graphics memory results in image artifacts when the FreeCAD zoom function is used. Consequently, you need to specify something like 192, for 192MB of graphics memory, under Advanced Options | Memory Split. After a reboot, FreeCAD should work fluidly.

Figure 2: Activating hardware acceleration in raspi-config.

A DIY Case

Now it is time to call FreeCAD from the application menu under Graphics. Shaping the small metal plate I use in this introduction to FreeCAD worked well on the RPi2. Although FreeCAD felt a little slow, it was still very usable. The RPi3, on the other hand, handled the program without a glitch.

The first product modeled here is a case suitable for the small computer plus the official Raspberry Pi display [7]. The ultimate goal of this undertaking is to create a Rasp Pi tablet running RISC OS. A data sheet [8] containing the measurements for the display has been published by the Raspberry Pi Foundation and serves as the basis for the construction.

Getting oriented before taking the first steps is not exactly easy in FreeCAD. Help notes appear in the status bar at the bottom of the window, providing helpful information as you mouse over an object. If additional space is needed on the display, the status bar can be turned off in the View menu, and you'll still see the help notes beside your cursor as you mouse over an icon.

To begin the project, you should create a new document (File | New) and in the toolbar change the workbench to Part mode in the drop-down menu. Alternatively, you can do this via View | Workbench | Part. The basis for the case will be a cube, for which the dimensions are later adjusted. The cube is the shapeless construction object and is created via the Create a cube solid button. You then select the cube in the overview of the sidebar when performing further work.

The dimensions of the cube are modified to match the measurements of the future case in the Properties pane of the Data tab (Figure 3; Length=196mm, Width=114mm, Height=22mm). Switch to a mesh model with View | Draw Style | Wireframe, then in Part Design mode, choose an edge (lower and shorter edges) and click Fillet in the Task tab. The edges are then rounded off into curves with a radius of your choice.

Figure 3: The case is created step by step from a simple cube.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Welcome

    Just more than four years ago the first Raspberry Pi was released to overwhelming response. Many people had to wait for their first-generation Pi while production was ramped up to meet the demand. Now you have an entire array of Pis from which to choose, and demand is still so high that you might have to wait for your computer on backorder immediately after a new model is released. Moreover, the quad-core Raspberry Pi 3 has broadened the possibilities of what you can accomplish with the little nanocomputer.

  • pi-top: Laptop made from a Raspberry Pi

    The pi-top turns a Raspberry Pi into a mobile computing device that features a high-resolution display and long battery run times. In everyday use, however, this Rasp Pi laptop comes across as stubborn and in need of some fine tuning.

  • Create a customized, 3D-printed case for the Raspberry Pi

    The standard Raspberry Pi cases sold in the marketplace do not include space for accessories and add-ons. A DIY case built using a 3D printing service offers a good solution, but some planning is in order.

  • Up close with the Banana Pi

    The Raspberry Pi has spawned a new generation of imitators. One of the top contenders is the Banana Pi.

  • Introducing Raspberry Pi-Top

    The Pi-Top kit comes with everything you need to build your own Raspberry Pi laptop.