add gulp files and an explanation of build process options

This commit is contained in:
Robert Sheldon 2018-06-03 16:14:17 -04:00
parent 4f56815cc6
commit 5247b4bcdd
6 changed files with 4482 additions and 2 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
*.scad.stl

1
.node-version Normal file
View File

@ -0,0 +1 @@
10.3.0

View File

@ -6,6 +6,20 @@ Relevant links:
* Thingiverse: https://www.thingiverse.com/thing:468651 * Thingiverse: https://www.thingiverse.com/thing:468651
* Shapeways: https://www.shapeways.com/designer/rsheldiii/creations * Shapeways: https://www.shapeways.com/designer/rsheldiii/creations
## How to run
To run this project, you will need openSCAD. you can download it here: http://www.openscad.org/downloads.html. I highly recommend installing the development snapshot, as they are much further along than the current stable release (as of writing, 2015.03-3). However, this library has been tested down to 2015.03-3 and works well.
After you have openSCAD installed, you need to download the code and run it. running `git clone https://github.com/rsheldiii/openSCAD-projects.git` or downloading [this zip](https://github.com/rsheldiii/openSCAD-projects/archive/master.zip) and extracting the code should do it. Then all you need to do is open `keys.scad` with openSCAD and you are set!
#### Development considerations
While developing can be done wholly in openSCAD (and is a great place to start if you just want to play around with the library), if you're used to more featureful editors and are doing a lot of changes, you might want to look into other alternatives.
OpenSCAD has a watch mode, 'Automatic Reload and Preview', in the Design menu. With this enabled, OpenSCAD will watch for changes to the file and re-load the preview (F5) automatically. This allows you to minimize the code panel and use your own editor.
If you want to forego OpenSCAD (almost) altogether, I've rigged up a gulpfile to run openscad on any changed `.scad` files at the base level of this folder, exporting their rendered object to `{filename}.scad.stl`. With this, you can skip using OpenSCAD entirely by setting up an STL viewer to watch the output file. I use [fstl](https://github.com/mkeeter/fstl) which required me to [coment out these lines](https://github.com/mkeeter/fstl/blob/master/src/window.cpp#L123-L126) before building to get rid of an error message that would pop up on load. For some reason the gulp task never renders the first time, so if that happens to you just save again and it should work fine.
## Let's Go! I wanna make a keycap! ## Let's Go! I wanna make a keycap!
At the highest level this library supports Cherry and Alps switches, and has pre-defined key profiles for SA, DSA, DCS, and (some form of) OEM keycaps. `keys.scad` is meant as an entry point for everything but the most technical use; there should already be an example at the bottom to get you started! Pre-programmed key profiles can be found at the `key_profiles` directory. At the highest level this library supports Cherry and Alps switches, and has pre-defined key profiles for SA, DSA, DCS, and (some form of) OEM keycaps. `keys.scad` is meant as an entry point for everything but the most technical use; there should already be an example at the bottom to get you started! Pre-programmed key profiles can be found at the `key_profiles` directory.
@ -122,8 +136,7 @@ Prints from this library are still challenging, despite all efforts to the contr
That's it, if you have any questions feel free to open an issue or leave a comment on thingiverse! That's it, if you have any questions feel free to open an issue or leave a comment on thingiverse!
## TODO: ## TODO:
* replace linear_extrude_shape_hull with skin_extrude_shape_hull or something * replace linear_extrude_shape_hull with skin_extrude_shape_hull or something, to enable concave extrusions
* replace current ISO enter shape with one that works for `skin()` * replace current ISO enter shape with one that works for `skin()`
* generate dishes via math? kind of hard, maybe later * generate dishes via math? kind of hard, maybe later

23
gulpfile.js Executable file
View File

@ -0,0 +1,23 @@
var gulp = require('gulp');
const shell = require('gulp-shell');
const changedInPlace = require('gulp-changed-in-place');
const changed = require('gulp-changed');
// var del = require('del');
var paths = {
compile: ['*.scad'], // '**/*.scad',
};
gulp.task('compile', function() {
// recompile any changed openscad files
return gulp.src(paths.compile)
.pipe(changedInPlace({howToDetermineDifference: "modification-time"})) // TODO doesnt work for literally no reason
.pipe(shell([
// 'openscad compile/compile.scad -o compile/out.stl > 1'
'openscad <%= file.relative %> -o <%= file.relative %>.stl'
], { verbose: true, shell: '/bin/bash'}))
});
gulp.task('default', function() {
gulp.watch(paths.compile, gulp.series('compile'));
});

4410
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

31
package.json Normal file
View File

@ -0,0 +1,31 @@
{
"name": "keyv2",
"version": "1.0.0",
"description": "automated stl build platform for KeyV2",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/rsheldiii/openSCAD-projects.git"
},
"keywords": [
"mechanical",
"keyboard"
],
"author": "rsheldiii",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/rsheldiii/openSCAD-projects/issues"
},
"homepage": "https://github.com/rsheldiii/openSCAD-projects#readme",
"dependencies": {
"gulp-changed": "^3.2.0",
"gulp-changed-in-place": "^2.3.0",
"gulp-shell": "^0.6.5"
},
"devDependencies": {
"gulp": "github:gulpjs/gulp#4.0"
}
}