FreeCAD Foray: Good Practices

Last time, we built a case for a PCB that handles 100 W of USB-C power, an old project that I’ve long been aiming to revive. It went well, and I’d like to believe you that the article will give you a much-needed easy-to-grasp FreeCAD introduction, Matrix knowledge upload style, having you designing stuff in no time.

Apart from my firm belief in the power of open-source software, I also do believe in social responsibilities, and I think I have a responsibility to teach you some decent FreeCAD design practices I’ve learned along the way. Some of them are going to protect your behind from mistakes, and some of them will do that while also making your project way easier to work with, for you and others.

You might not think the last part about “others” matters, but for a start, it matters in the ideal world that we’re collectively striving towards, and also, let’s be real, things like documentation are half intended for external contributors, half for you a year later. So, here’s the first FreeCAD tip that will unquestionably protect you while helping whoever else might work with the model later.

Okay, we’re all hackers, so I’ll start with zero-th FreeCAD tip – press Ctrl+S often. That’ll help a ton. Thankfully, FreeCAD’s autorecovery system has made big leaps, and it’s pretty great in case FreeCAD does crash, but the less you have to recover, the better. Now, onto the first tip.

Name Your Bodies, Always

The button is F2. That’s it. Click on your models in the tree view and give them a name. Do it for all extrudes, cuts, and even fillets/chamfers. You don’t have to do it for sketches, since those are always contained within an extrusion. If at all possible, do it immediately, make it a habit.

Why? Because names make it clear what the extrusion/cut/fillet is for, and you’ll be thankful for it multiple times over when modifying your model or even just looking at it the next morning. Also, it makes it way easier to avoid accidentally sending the wrong 3D model to your printer.

They’re the same picture.

How to make naming easier? I’ve figured out an easy and apt naming scheme, that you’ve seen in action in the previous article. For Fusions, I do “primary object +addition” or “with addition”, mentioning just the last addition. So, “Bottom case +cutouts” is a cut that contains “Bottom case +logo” and “Cutouts”, “Bottom case +logo” is a cut that contains “Bottom case” and “Logo”, and “Bottom case” contains “Bottom floor” and “Bottom walls”.

It’s not a perfect scheme, but it avoids verbosity and you have to barely think of the names. Don’t shy away from using words like “pip” and “doohickey” if the word just doesn’t come to your mind at the moment – you’re choosing between a project that’s vaguely endearing and one that’s incomprehensible, so the choice is obvious. Naming your models lets you avoid them becoming arcane magic, which might sound fun at a glance until you realize there’s already an object of arcane magic in your house, it’s called a “3D printer”, and you’ve had enough arcane magic in your life.

Last but not least, to hack something is know learn its true name, and whatever your feature is, there’s no truth in “Cut034”. By the way, about FreeCAD and many CAD packages before it, they’ve been having a problem with true names, actually, it’s a whole thing called Topological Naming Problem.

Naming Is Hard, Topology Is Harder

How do you know where a feature really is? For instance, you take a cube, and you cut two slots into the same side. How does the CAD package ensure that the slots are on the same side? One of the most popular options for it is topological naming. So, a cube gets its faces named Face1 through Face6, and as you slowly turn that cube into, say, a Minecraft-style hand showing a middle finger, each sketch remembers the name of the side you wanted it attached to.

Now, imagine the middle finger hand requires a hole inside of it, and it has to be done at from very start, which means you might need to go back to the base cube and add that hole. All of a sudden, there will be four new faces to the internal cube that holds the finger sketches, and these new faces will need names, too. Best case, they’ll be named Face7 through Face10 – but that’s a best case and the CAD engine needs to ensure to always implement it properly, whereas real world models aren’t as welcoming. Worst case, the faces will be renumbered anew, the sketch-to-face mapping will change which faces get which names, and the model of the hand will turn into a spider. Spooky!

It’s not Halloween just yet, and most regretfully, people don’t tend to appreciate spiders in unexpected places. Even more sadly, this retrospective renaming typically just results in your sketches breaking in a “red exclamation mark” way, since it’s not just sketch-to-face mappings that get names, it’s also all the little bits of external geometry that you’ll definitely invoke if you want to avoid suffering. Every line in your sketch has an invisible name and a number, and external geometry lines will store – otherwise, they couldn’t get updated when you change the base model under their feet, as one inevitably does.

Before FreeCAD v1.0, I sometimes had to make “plug” solids instead of removing cutouts. Nowadays, I have to do that way less often.

This used to be a big problem with FreeCAD, and it still kind of is, but it’s by no means exclusive to FreeCAD. Hell, I remember dealing with something similar back when my CAD (computer-aided despair) suite of choice was SolidWorks. It’s not an easy problem to solve, because of the innumerable ways you can create and then modify a 3D object; every time you think you’ll have figured out a solution to the horrors, your users will come up with new and more intricate horrors beyond your comprehension.

FreeCAD v1.0 has clamped down on a large amount of topological naming errors. They still exist; one simple way I can trigger it is to make a cutout in a cube, make a sketch that external-geometry-exports the cut-in-half outwards-facing line of the cube, and then go back and delete the cutout. It makes sense that it happens, but oh do I wish it didn’t, and it makes for unfun sketch fixing sessions.

How To Stay Well Away

Now, I’m no stranger to problems caused by name changes, and I’m eager to share some of what I’ve learned dealing with FreeCAD’s names in particular.

The first solution concerns cutouts, as they specifically might become the bane of your model. If you have a ton of features planned, just delay doing the cutouts up until you’ve done all the basics of the case that you might ever want to rely on. Cutouts might and often will change, and if your board changes connector or button positions, you want to be able to remake them without ever touching the rest of the sketch. So, build up most of your model, and closer to the end, do the case cutouts, so that external geometry can rely on walls and sides that will never change.

Next, minimize the number of models you’re dealing with, so that you have less places where external geometry has to be involved. If you need to make a block with a hole all the way through, do it in one sketch instead of doing two extrudes and a cut. You’ll thank yourself, both because you’ll have less opportunity for topo naming errors, but also because you have fewer model names to think up.

In case you wondered what the “bad naming” example was about, it’s from this part. It’s a perfectly fine part because no external geometry relies on it in practice, but it’s also absolutely a good example of a part you can instead do in a single sketch-extrude and a (not shown) fillet.

The third thing is what I call the cockroach rule. If you see a cockroach in your house, you back off slowly, set the house on fire, and then you get yourself a different house, making sure you don’t bring the cockroach into the new house while at it. Same can apply here – if you remove a feature in the base model and you see the entire tree view light up with red exclamation marks, click “Close” on the document, press “Discard changes”, open the document again, and do whatever you wanted to do but in a different way.

Why reload? Because Ctrl+Z does not always help with such problems, as much as it’s supposed to. This does require that you follow the 0th rule – press Ctrl+S often, and it also requires that you don’t press Ctrl+S right after making those changes, so, change-verify-enter. Thankfully, FreeCAD will unroll objects in the model tree when one of the inner object starts to, so just look over the model tree after doing changes deep inside the model, and you’ll be fine. This is also where keeping your models in a Git repo is super helpful – that way, you can always have known-good model states to go back to.

Good Habits Create Good Models

So, to recap. Save often, give your models names, understand topo naming, create cutouts last if at all possible, keep your models simple, and when all fails, nuke it from orbit and let your good habits cushion the fall. Simple enough.

I’ll be on the lookout for further tips for you all, as I’ve got a fair few complex models going on, and the more I work with them, the more I learn. Until then, I hope you can greatly benefit from these tips, and may your models behave well through your diligent treatment.

5 thoughts on “FreeCAD Foray: Good Practices

  1. In short, prefer using PartDesign to Part workbench. If you think in boolean operation too much (Cut / Union / Intersect), you’ll end up with unsolvable and unmodifiable mess. Make the most you can in PartDesign (with sketches) and only reserve the most complex task to Part workbench.

    1. I’m with you on this one! Because the CSG workflow is comfy for me (OpenSCAD), I tried to use Part like this a lot when I was starting out in FreeCAD.

      But in the name of simplicity of defining the specs, and making things easily alterable later, I learned the Part Design / Sketch workflow. It seems like FreeCAD really wants you to go that way.

    2. I will have to agree. Even if its a quirk of FreeCAD, I think its still worthwhile building a mental model and workflow where everything is based on modifying the original sketch. This lets you think about the model in a systematic way, which is an important part of planning anyway

      The “adding/subtracting primitives until it looks like you want” is quite akin to how CAD was done in the past. It makes sense for OpenSCAD but for FreeCAD you don’t want to do that…

  2. haha yeah i try to make projects readable for other people because the other people are always me a year later. i’ve got build diaries up into the tens of thousands of words so i can look back and figure out what that stranger who sits in my chair was thinking a decade ago.

    i don’t use freecad, and the ctrl-z discourse in this article makes me really glad for it! i want robust change management for everything i do on the computer. i am always checking things into git, and i need the diffs to be intelligible. that’s why i could only use a script-based cad, and for me that’s openscad. i do break the whole model for a simple change, but i always can see exactly how that happened and i never have to superstitiously kill the program just in case its own change management has side effects and can’t unroll the past with veracity.

  3. Learning FreeCAD now. Fully agree with the need to name things. You will be thankful when, not if, a tiny change breaks any or all fillets/chamfers.

    If I’ve only learned one thing about FreeCAD, it’s that you do chamfers and fillets last. (Oh, and look carefully after using them because they have a habit of making parts of your model disappear.)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.