The original builder which powered http://builder.swillkb.com
kb_builder is the original engine that ran builder.swillkb.com. That service has been completely rewritten in Golang, but this project is still a useful environment to hack on.
This tool uses the JSON layout generated by the Keyboard Layout Editor. There are a lot of hidden features that you can do when building plates. Check the ? next to the Plate Layout text field in the UI for more details.
Here are some examples of the types of features that are exposed. The following features can be applied by modifying the source copied from the keyboard layout editor. All of these features are applied to individual keys by adding or modifying the object before the key. EG: rotate switch for “Enter” would be done by entering {_r:90},"Enter".
{_t:<cutout>}: Change switch cutout type. mx, alpsmx, mx-open, mx-open-rotatable, or alps. EG: {_t:"mx"},""{_s:<stab>}: Change stabilizer cutout type. cherry, costar, cherry-costar, alps, or matias. EG: {_s:"costar"},""{_k:<mm>}: Specify a kerf value for this specific switch/stabilizer cutout which overrides the default. Values are in mm (without the * unit). EG: {_k:0.05},""{_r:<degrees>}: Rotate the switch cutout independent of the stabilizer cutout (assuming there is one). EG: {_r:90},""{_rs:<degrees>}: Rotate the stabilizer cutout independent of the switch cutout. EG: {_rs:180},""{_co:<mm>}: Specify that this switch is offset {_co:9.525},""This tool is implemented as both a webserver which exposes a UI to be consumed in the browser and a CLI that can be run from the shell. The web server is not fit for actual web traffic because it can not handle drawing more than one layout at a time. This however should not be a limitiation for personal use.
At this time the CLI is more fully-featured than the Web UI. That is considered a bug and is being worked on. If you think you can help submit a pull request. :)
Install this one a Ubuntu VM on your laptop with either VirtualBox or VMware Fusion. I have had trouble getting the FreeCAD lib to work correctly on Mac OSX, so if you get it working, please contribute some documentation. For now I only describe Ubuntu install instructions.
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:freecad-maintainers/freecad-daily
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get -y install unzip build-essential freecad git python-pip python-dev python-flask
$ sudo pip install cadquery hjson
This is a quick start guide. Review the full docs here
$ cd ~/
$ freecad
# note the version number
# download the appropriate version from here:
# https://github.com/yorikvanhavre/Draft-dxf-importer
# i will assume freecad version v16 and the latest importer (v15)
$ wget https://github.com/yorikvanhavre/Draft-dxf-importer/archive/1.38.zip
$ unzip 1.38.zip
# this will create the 'Draft-dxf-importer-1.38/' directory
$ cp Draft-dxf-importer-1.38/* /root/.FreeCAD/
# Note: we are putting this import into the 'root' users '.FreeCAD'
# not your users because we are running with 'sudo'
$ git clone https://github.com/swill/kb_builder.git ~/kb_builder
There are two ways to use the tool. You can use the Web UI through your
browser, or the CLI in Terminal.
$ cd ~/kb_builder
$ ./kb_web
I am assuming most people will be using VirtualBox, so here are some additional details for viewing the UI from the host machine as well as instructions for how to SSH into the box.
# Power off the VM.
# Set: VM > Settings > Network > Attached to: => Bridged Adapter
# Power on the VM.
$ ifconfig
# record the <IP> address
# The web UI will be available on: http://<IP>
# You can SSH to the VM with: ssh your_user@<IP>
If you don’t want to fire up the web interface you can generate files locally
using the CLI. There are lots of options for tweaking your plate and generating
cases, please review “./kb_cli -h” to see all the options you can set.
In the simplest case you simply run “./kb_cli -f
zwhite@ubuntu:~/kb_builder$ ./kb_cli -f cnc_pad.kle
FreeCAD 0.16, Libs: 0.16R5701 (Git)
...
Writing STEP file......
Face...
*******************************************************************
****** Statistics on Transfer (Write) ******
*******************************************************************
****** Transfer Mode = 0 I.E. As Is ******
****** Transferring Shape, ShapeType = 0 ******
** WorkSession : Sending all data
Step File Name : /home/zwhite/kb_builder/static/exports/switch_cnc_pad.kle.stp(15006 ents) Write Done
saving......
processing Shape (99.0 %)
successfully exported /home/zwhite/kb_builder/static/exports/switch_cnc_pad.kle.dxf
**** Overall plate size: 103.25 x 103.25 mm
*** Files exported for plate switch
* static/exports/switch_cnc_pad.kle.js
* static/exports/switch_cnc_pad.kle.brp
* static/exports/switch_cnc_pad.kle.stp
* static/exports/switch_cnc_pad.kle.stl
* static/exports/switch_cnc_pad.kle.dxf
* static/exports/switch_cnc_pad.kle.json
kb_builder builts keyboard plate and case CAD files using JSON(-like) input.
Copyright (C) 2015 Will Stevens (swill)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.