switch to generating the customizer file via a script
This commit is contained in:
parent
410f25c88e
commit
16b7ec4a25
1493
customizer.scad
1493
customizer.scad
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,27 @@
|
|||
|
||||
def expand(filename)
|
||||
lines = File.readlines(filename)
|
||||
old_dir = Dir.getwd
|
||||
|
||||
Dir.chdir File.dirname(filename)
|
||||
lines = lines.flat_map do |line|
|
||||
if line =~ /(include|use)\s*<(.*)>/
|
||||
# File.readlines("./#{$2}")
|
||||
expand("./#{$2}")
|
||||
# in lieu of actually implementing `use`, we can just cull this final line from key.scad
|
||||
elsif line =~ /example\_key\(\);/
|
||||
""
|
||||
else
|
||||
line
|
||||
end
|
||||
end
|
||||
|
||||
Dir.chdir old_dir
|
||||
|
||||
lines
|
||||
end
|
||||
|
||||
lines = expand(ARGV[1] || 'keys.scad')
|
||||
|
||||
f = File.open('customizer.scad', 'w')
|
||||
f.write lines.join
|
|
@ -4,11 +4,11 @@ include <supports/bars.scad>
|
|||
|
||||
module supports(type, stem_type, loft, height) {
|
||||
if (type == "flared") {
|
||||
flared_support(stem_type, loft, height);
|
||||
flared(stem_type, loft, height);
|
||||
} else if (type == "flat") {
|
||||
flat_support(stem_type, loft, height);
|
||||
flat(stem_type, loft, height);
|
||||
} else if (type == "bars") {
|
||||
bars_support(stem_type, loft, height);
|
||||
bars(stem_type, loft, height);
|
||||
} else {
|
||||
echo("Warning: unsupported $support_type");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module bars_support(stem_type, loft, height) {
|
||||
module bars(stem_type, loft, height) {
|
||||
translate([0,0,loft + height / 2]){
|
||||
cube([2, 100, height], center = true);
|
||||
cube([100, 2, height], center = true);
|
||||
|
|
|
@ -7,7 +7,7 @@ function scale_for_45(height, starting_size) = (height * 2 + starting_size) / st
|
|||
|
||||
// complicated since we want the different stems to work well
|
||||
// also kind of messy... oh well
|
||||
module flared_support(stem_type, loft, height) {
|
||||
module flared(stem_type, loft, height) {
|
||||
translate([0,0,loft]){
|
||||
if (stem_type == "cherry_rounded") {
|
||||
linear_extrude(height=height, scale = scale_for_45(height, $rounded_cherry_stem_d)){
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module flat_support(stem_type, loft, height) {
|
||||
module flat(stem_type, loft, height) {
|
||||
translate([0,0,loft + 500]){
|
||||
cube(1000, center=true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue