Versioning FreeCAD Files with Git (2021)
blog.lambda.cx
blog.lambda.cx
(I think it's called linkstage3, but it's been a long time, I keep trying and failing to get on with FreeCAD, always end up back using Fusion360. Not that that works well with git of course, I just can manage to actually design stuff.)
I'd like to switch 5 FreeCAD just because then I can save the files to my computer, but the UI is too different from Fusion/OnShape.
Now I usually use solvespace, though that only does 3D modeling, no CAM, ...
This is an area I'd like to improve a lot when I get back to working on it!
Maybe I should spin up a Windows qube, just for old time's sake...
I don't know the FC format. But I'm still willing to bet large sums of money that if you happen to change the same version in different ways and merge the changes that you'll wreck the file.
Maybe I'm just weird, I like the GIMP's UI too.
Highly recommend MangoJelly's tutorials if you're interested in learning it.
I differ on recommending MangoJelly though; video can be good for learning CAD, but I got real tired of having to sit through a 15-40 minute video before getting to the point of what was being demonstrated. I would much prefer written tutorials or pages describing the specific feature I'm trying to use/learn. The FreeCAD wiki was more useful to me than MangoJelly's stuff and I hope people don't forget that it's there. But many folks like his approach, so do what works for you.
There is also no visual preview of any of the operations and 99% of the action is manually entering numbers into the left pane instead of using visual tools to drag an extrusion, for example.
- auto-constraints. If you select a line and click "constrain", it automatically chooses a length constraint. If you select 2 lines, you get an angle constraint. A circle, a radius constraint.
- constraining on drawing. When you draw a rectangle, you can immediately type one dimension, press tab, type the other dimensions. You don't need to manually select constraints.
There are definitely problems with FC (but then even expensive CADs have problems). One of the biggest problem I think was lack of good learning material. MangoJelly does an excellent work on that.
I made the change and I did a few decent sized projects and a major project. Obviously its no Catia/NX from a feature POV, but it can do everything I needed.
- chamfer - easy wall thickness - draft angle - bosses - vents
Probably about 10 more of those operations that are easy in Fusion360 and very difficult in FreeCAD.
Great that it could do everything you needed but for many people the second you need to do adult things FreeCAD unfortunately falls apart.
Chamfers are a weakness, but not entirely a lost cause.
But I won't be like those linux users that pretend 'the problem doesnt exist'.
I just personally havent run into the issue. Curious, what is your experience level? I'm wondering if you are building a house of cards with CAD and not realizing it. Even solidworks will break if you do things in the wrong order.
The use case was designing injection molds for electronics enclosures. Something I would say requires subtle and precise nuances at low tolerances but not remotely a jet engine level of complex design at all.
I don’t doubt I was probably doing things “the wrong way” in FreeCAD. But it was very difficult to figure out the right way in FreeCAD oftentimes.
But in 0.22-dev there is a good sketch offset/sketch frame tool that would let you make an outline wall in 2D that you can then pocket.
Another approach is to make a SubshapeBinder of a face, offset that and pocket it directly.
Fillets and chamfers work but they have OCC bugs and limitations; there are ways to work around them but whereas in Fusion360 you might place geometry on a chamfer, with anything built around OCC it is better to treat chamfers and fillets as “dress-up” only, and do them last. Anything structural is definitely better done in a sketch or with a subtractive sweep on an edge.
Bosses: you can taper pads/extrudes easily enough, and there are some tricks involving copying external geometry of sketches and face/shape binders that can help you match them up across bodies.
None of this is to suggest that FreeCAD is easier than Fusion360. It’s not, and it’s definitely something of a lifestyle choice. (You won’t hear me telling you that you should use GIMP over Photoshop, though).
But it also doesn’t have Fusion360’s limitations: ten or five projects or whatever at a time, reapplying for the license every year, STEP support that could get taken away from you again when Autodesk decides to reassess the free tier, etc.; and I can share FreeCAD as easily as I can share my designs.
Don’t get me wrong, I don’t think Fusion360 is bad or Autodesk is a particularly unusually bad actor. I just don’t want to be dependent on the whims of closed source free tiers in cloud software until I absolutely have to be.
So far, my limitations in CAD have nothing to do with FreeCAD, and my 3D printer isn’t the slowest part of the puzzle. In both cases the issue is me.
The problem of the “right way” is definitely FreeCAD’s primary issue; it’s not as easy to mix the guided flow of Part Design with the more generalised tools in the other workbenches as it should be. (Sketches on curved surfaces are a classic example of this.)
But there is an increasingly broad range of tutorial materials out there now, and the major changes around Ondsel and FreeCAD 1.0 will only improve things.
The crashes, by and large, are freecad/qt rather than OCC.
FreeCAD 0.20.2 almost never crashes; I had maybe three in eight weeks of daily struggles with a complex design problem.
If these people like "coding", then you would expect them to work on things like previews or visual manipulators. Lots of things to "code".
The recommended approach in the article is not a good one, though. What you'll end up with is worse than just running unzip by hand—so just do that instead. Programmers thinking that they need Git itself (or some plugin for it) to support the file format is just a weird mental block, anyway.
Unzip the files. Check in the necessary changes. It's not hard or a hard concept to grasp.
Git supporting the file format has several advantages. For one thing, changing a single word in a 37 MiB file won't add 37 MiB to the repo. For another, one could use the Git log to review the changes across commits and branches.
This could be supported with a short bash script that did unzip and git commit (I’d call it unzit as the name makes me laugh).
And then do builds as the last step, either storing the original zip file or having a way to zip things back up.
A script to sort of ‘package to git’ and one to ‘unpackaged from hit’ would allow the text files to be more easily managed within git.
Is there a diff tool for FreeCAD?
nbdime: https://nbdime.readthedocs.io/en/latest/#git-integration-qui... :
> Git doesn’t handle diffing and merging notebooks very well by default, but you can configure git to use nbdime:
nbdime config-git --enable --global
Oh, zippey, for zip archives of text files in git: https://bitbucket.org/sippey/zippey/src/master/Are there tools to test/validate a FreeCAD model to check for regressions over a range of commits?
git bisect might then be useful with FreeCAD models; https://www.git-scm.com/docs/git-bisect :
> This command uses a binary search algorithm to find which commit in your project’s history introduced a bug. You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced. Then git bisect picks a commit between those two endpoints and asks you whether the selected commit is "good" or "bad". It continues narrowing down the range until it finds the exact commit that introduced the change.
FWIW, LEGO Bricktales does automated design validation as part of the game. Similarly, what CI job(s) run when commits are pushed to a Pull Request git branch?
If [FreeCAD] files are text-diffable, is there a way to topologically sort (with secondary insertion order) before git committing with e.g. precommit?
python has a sort_keys parameter for serialization, in order to alphabetically sort sibling nodes in nested datastructures; which makes it easier to diff json documents that have different key orderings but otherwise equal content.
basically every other creative field has unmatched collaboration tools to us
That said, depending on the model you want to make, it may be much more challenging. Adding fillets, for example, may be not trivial.
cuboid([5,5,5], fillet=2);
Fillets and chamfers are bespoke each time, and any kind of reflection on the structure of the resulting model is essentially impossible because it is a declarative language as well as a mesh modeller, STEP export is impossible. With anything complex you will drown in variable declarations and various bodges, and there is essentially no help for multi-body projects or assemblies.
The Python/OpenCascade-based CadQuery and Build123D are bRep systems with many programmatic advantages, and because they are bRep you have generalised fillet and chamfer operations (within OpenCascade’s limitations). You also get face, wire and vertex operations on generated geometry, even some assembly support.
On the JS side of things, CascadeStudio and replicad both use the emscripten cross-compilation of OpenCascade.
Personally, I really like FreeCAD, and I’ve used it for complex things. But I am not going to suggest everyone should use it.
> Working-copy-as-a-commit: Changes to files are recorded automatically as normal commits, and amended on every subsequent change. This "snapshot" design simplifies the user-facing data model (commits are the only visible object), simplifies internal algorithms, and completely subsumes features like Git's stashes or the index/staging-area.
I know one day I'll have to adress it, and probably rewrite all commits.
I would hope that better revision control options eventually arrive in core thanks to collaboration tools like Ondsel’s Lens, but the solution in this blog post might work in the meantime.
Another commenter suggested FreeCAD would be better if it just worked with rich directories natively. That would be nice.
You are comparing apples and oranges.