I tried to make a 3D printable holder using only open-source CAD tools: FreeCAD and OpenSCAD. While the model is simple, the tools are not easy to use, but I finally made it, and I think it's quite interesting how to do 3D modeling without needing paid tools. In this post, I will share how to use FreeCAD and OpenSCAD, using their strong sides and avoiding their weak ones.
First, OpenSCAD: it's a programming language to create 3D models. Everything starts from simple 2D shapes like rectangles and circles. They can be added, subtracted, or moved to create more complex shapes. Then, those shapes can be extruded (we give them size in the Z-axis), and the resulting 3D shapes can again be added, subtracted, or moved to create even more complex shapes. Because it's a programming language, it's easy to parametrize the design - like any language, it has variables.
It's a great tool but has its limitations and weird behaviors. By default, if a variable is not initialized, the compiler will try to ignore it and continue, but this leads to incorrect models (if the variable was there, it had some purpose, like shifting the shape a bit in some direction, etc.). Fortunately, this can be changed in the settings.
Another thing I found is that it's easy to make messy models with a lot of duplication - it's a language so it's easy to write bad code. Fortunately, the project can be split into separate files and linked later using the include directive. Also, it's good to use the module directive to split the design into separate parts instead of doing everything directly with built-in primitives like rectangles and circles.
Other limitations is that it's impossible to add dimensions to rendered objects, so it's hard to visually check if everything is modeled correctly. In FreeCAD, it's simple - all you need to do is select an edge, click the dimension tool, and the length is visualized.
Last but very annoying: it's hard to model fillets (rounded corners), while in FreeCAD, again, it's trivial.
My idea was then to make a model in OpenSCAD and import it to FreeCAD, and that's what I did. Why not do everything in FreeCAD? Well, FreeCAD's user interface is horrible. There are so many weird things in it that I could make an entirely new post just about it, but I’ll just mention a bit of what annoys me the most.
FreeCAD’s GUI is bad regarding how it handles parametrization. I will add that the idea of parametrization is that instead of hardcoding dimensions in designs, a parameter can be used - one parameter can be used in many places, making changes easier to make. It’s a great idea but poorly implemented. It’s not possible to add comments explaining what the parameter represents, no option to link to a datasheet where it comes from, etc.
But let's get back, once the model in OpenSCAD is done, even if it renders perfectly in OpenSCAD, it can fail to import into FreeCAD. I found that FreeCAD doesn’t like it when the OpenSCAD "mirror" directive is used on 2D objects. FreeCAD, of course, won’t say where the problem is during the import. Again, horrible software! By the way that also when it's a good to split the OpenSCAD design into separate files/modules, each file split into modules, to be able to temporarily comment out the code and see where the problem is.
The import of the OpenSCAD project has a trap, too. FreeCAD has workbenches (kind of like perspectives in Eclipse), and there is a workbench dedicated to OpenSCAD, but the import fails if an OpenSCAD file includes other OpenSCAD files. However, it works when importing by File -> Import. No need for OpenSCAD workbench.
Then, the fillets. Some are impossible because FreeCAD will crash :) But most are possible. Fillets can be added either in the "Part" or "Part Design" workbenches. The "Part Design" workbench can’t directly work with imported OpenSCAD projects, so the fillets don’t work (at least not easily). Fortunately, the "Part" workbench works. Also, the "Part" workbench has a dimension tool to measure edge lengths, although I wasn’t able to measure hole radii.
So that’s it: we have a project done in OpenSCAD and then imported into FreeCAD to add fillets and check dimensions. It should be good. If the OpenSCAD project is modified, it needs to be reimported into FreeCAD, and the fillets need to be reapplied, but I found it can be done quickly (at least for a simple project).
I finally made my design and learned a lot. It’s my first one, so probably not the best, but I’m happy.
What are your experiences with OpenSCAD and FreeCAD?

Robert Gawron
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.