We've looked at this 2d shape long enough, we can give it some depth by extruding it,
linear_extrudeing to be precise, let's add a new variable
We do have a bit of a problem though because while want the base to go the full length of the hinge, the pivot should only go half that to make room for the other part of the hinge. Red scribbles shows what we want to remove.
The best way around this problem is to extrude the base again separately so to stretch further than the pivot.
Great, starting to take shape, couple things to go over, first you may have noticed that we just did some inline math with
This works fine, normal math operations can be preformed and it's fine to mix variables with numbers (also
2 here doesn't count as a magic number since
hingeLength/2 is easy to read as "half of
You may notice that we've included the code that forms the hinge base:
within both of the
linear_extrudes, at first it might seem like we could remove it from first
linear_extrude since it only goes half the
hingeLength but this would cause us to loose our internal fillet.
As it needs to be within
offset group for this fillet to work.
Okay so we leave it in both
linear_extrudes but this leaves us in a situation similar to before we introduced variables, in that we have repeated code that would be difficult to determine why to someone reading our code.
Well similar to variables we can solve this with