KeyV2
KeyV2 copied to clipboard
Spacebar is always 6.25u, despite trying to change its u-size
What version of OpenSCAD are you on? 2021.01
Describe the bug
The following OpenSCAD script produces a 6.25u spacebar, no matter what the u(u=XX) part is set to.
cherry_row() u(u=6.5) spacebar() key();
To Reproduce Run this script:
include <./includes.scad>
cherry_row() u(u=6.5) spacebar() key();
Try changing 6.5 to any other number, and it doesn't change the size of the spacebar, because it's always made u=6.25.
Additional context Making a keycap for the weird Logiteck G710+ keyboard with a 6.5u spacebar.
Found the solution: translate([0,0,0]) cherry_row() spacebar() u(u=6.5) key();
Swapped the u(u=XX) and the spacebar() functions.
Perhaps this could be better explained, or it could be changed so that it works in either order so others don't encounter this problem.
I think a cursory explanation of this has been omitted from the readme over time. This library works by manipulating "special variables" that are then used to generate the keycap's shape; every lexical scope gets to override the value of the special functions, but a parent scope can't override a child's scope. All special variables have defaults so that a bare call to key() will still generate something, so there isn't a good way to tell when a special variable has already been modified.
I'll try and think of a better way to say that and add it to the readme