FreeCAD Notes: Midpoint
In between musing about VR projects and other random ideas, I've been returning to FreeCAD and learning my way bit by bit. After my initial introduction to Part Design workbench I've been gradually gaining proficiency with it. Learning FreeCAD required changing some patterns I've developed while working in Onshape. Such changes were expected for adopting a different software package, so this is not a surprise, but adjustment takes time. The first "that took longer than it should" switchover example was replacing Onshape's midpoint constraint.
When sketching my design in Onshape, I frequently use the midpoint constraint to keep something in between two other things. Most commonly, I would place a point on a construction line and then select the midpoint constraint. FreeCAD doesn't have a dedicated "Midpoint" constraint but, for putting a point in the midpoint of a line, I should be able to use the "Symmetrical" constraint to accomplish the same thing. But as soon as I impose the "Symmetrical" constraint on my point and line, everything turns orange indicating some kind of an error. I pressed "Undo" so I could figure out a different way that wouldn't cause an error. But no matter what I tried, things would turn orange.
After several attempts all ending in orange lines, I thought "Self, go understand the error message!" It took me a minute to figure out where the error was shown in FreeCAD's interface, but once I did, I saw the error was "Redundant constraints: (61)" This was confusing to me because the point I had placed on the line was definitely not the midpoint, so the "Symmetrical" constraint was definitely required. What was the redundant constraint? FreeCAD's list of problematic constraint was a single number 61, which told me nothing. Fortunately, the (61) was a link I could click to take me to a "Constrain point onto object" linking the point and line.
How did this happen? When I clicked to place a point on the line, FreeCAD tried to be helpful and automatically added a "Constrain point onto object" between the two. Not knowing this had happened, I blissfully proceeded to add "Constrain symmetrical". Doing so made "Constrain point onto object" redundant because a line's midpoint is by definition always on that line.
In other words: FreeCAD implicitly added a constraint and, when I made my wish explicit, complained that my explicit specification collided with its implicit inference. That was annoying, I had nothing to do with that implicit constraint but now I have to deal with it. Or do I? Looking at FreeCAD's user interface immediately below where "Redundant constraints (61)" was shown, I saw a checkbox for "Auto remove redundants". Hey, that sounded promising!
Except it was not useful. I checked that option and tried again. When I clicked to add a point on the line, it still added "Constrain point onto object" as before. Then when I added "Constrain symmetrical", FreeCAD looked at the two conflicting constraints and automatically removed the more recent one: "Constrain symmetrical". Which is to say, FreeCAD deleted my explicit wish in favor of its own incorrect guess. Bah.
Once I understood what happened, I could devise a workaround. When adding the point, I have to be careful to click in the empty space near the line but not on the line. Doing this meant FreeCAD would not add "Constrain point onto object" so when I explicitly specify "Constrain symmetrical" afterwards there would be no redundancy to cause problems. This would be a minor change in my behavior, and I think I'll get the hang of it quickly like FreeCAD's distance constraint feature.