Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to make SCAD files more modular #139

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 3d/28byj-48.scad
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

28byj48_chassis_radius = 28/2;
28byj48_chassis_height = 19;
// Clearance between the motor chassis and the outside right wall of the previous module
28byj48_chassis_height_clearance = 1.4;

28byj48_shaft_offset = 8;
28byj48_mount_outer_radius = 3.5;
28byj48_mount_hole_radius = 4.2/2;
Expand Down
29 changes: 29 additions & 0 deletions 3d/common.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// MDF, .120in nominal
// https://www.ponoko.com/materials/mdf-fiberboard
thickness = 3.0;

etch_depth = 0.1; // for render
eps=.01;
num_flaps = 40;

// Rendering Colors
assembly_color = [0.76, 0.60, 0.42]; // MDF, "c1996b"
etch_color = [0, 0, 0]; // black, "000000"


assembly_color1 = color_multiply(assembly_color, [1.161, 1.157, 1.157, 1.0]); // "e1b17c" with MDF
assembly_color2 = color_multiply(assembly_color, [0.897, 0.895, 0.895, 1.0]); // "ae8960" with MDF
assembly_color3 = color_multiply(assembly_color, [0.547, 0.542, 0.540, 1.0]); // "6a533a" with MDF
assembly_color4 = color_multiply(assembly_color, [0.268, 0.268, 0.271, 1.0]); // "34291d" with MDF

// multiply two equal matricies by each element, limiting to a max of 1.0
function color_multiply(x, y) =
[ for(j=[0:len(x) - 1]) min(x[j] * y[j], 1.0) ];


module enclosure_etch_style() {
color(etch_color)
translate([0, 0, thickness])
linear_extrude(height=etch_depth)
children();
}
1 change: 0 additions & 1 deletion 3d/flap_fonts.scad
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

use<roboto/RobotoCondensed-Regular.ttf>;
include<flap_dimensions.scad>;

letter_font = "RobotoCondensed";
letter_height = 0.75; // aspect, 0-1
Expand Down
2 changes: 1 addition & 1 deletion 3d/font_generator.scad
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

include<flap_dimensions.scad>;
include<parts/flap.scad>;
use<projection_renderer.scad>;
use<splitflap.scad>;

Expand Down
10 changes: 0 additions & 10 deletions 3d/m4_dimensions.scad
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,4 @@
limitations under the License.
*/

// M4 bolts
m4_hole_diameter = 4.5;
m4_bolt_length = 12;
m4_button_head_diameter = 7.6 + .2;
m4_button_head_length = 2.2 + .2;
m4_nut_width_flats = 7 + .2;
m4_nut_width_corners = 7/cos(180/6);
m4_nut_width_corners_padded = m4_nut_width_corners + .2;
m4_nut_length = 3.2;
m4_nut_length_padded = m4_nut_length + .2;

57 changes: 57 additions & 0 deletions 3d/parts/connector.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
Copyright 2015-2020 Scott Bezek and the splitflap contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

include<enclosure.scad>;
include<hardware.scad>;
include<../common.scad>;

connector_bracket_length_outer = 14;
connector_bracket_length_inner = side_tab_width * 2 - m4_button_head_diameter/2;
connector_bracket_thickness = captive_nut_inset - thickness - 0.2;
connector_bracket_width = enclosure_width - enclosure_wall_to_wall_width + thickness*2 + connector_bracket_thickness*2;
connector_bracket_overlap = 4;
connector_bracket_clearance = 0.40;
connector_bracket_depth_clearance = 0.20;


module connector_bracket_2d() {
difference() {
square([connector_bracket_width, connector_bracket_length_outer]);
translate([connector_bracket_thickness, -eps]) {
square([connector_bracket_width - connector_bracket_thickness*2, connector_bracket_length_outer - connector_bracket_length_inner + eps]);
}
translate([connector_bracket_thickness - connector_bracket_clearance/2, -eps]) {
square([thickness + connector_bracket_clearance, connector_bracket_length_outer - connector_bracket_overlap + connector_bracket_depth_clearance + eps]);
}
translate([connector_bracket_width - connector_bracket_thickness - thickness - connector_bracket_clearance/2, -eps]) {
square([thickness + connector_bracket_clearance, connector_bracket_length_outer - connector_bracket_overlap + connector_bracket_depth_clearance + eps]);
}
}
}

module connector_bracket() {
linear_extrude(height=thickness) {
connector_bracket_2d();
}
}

module connector_bracket_side_holes() {
// overlap slot
translate([enclosure_vertical_inset - thickness - connector_bracket_clearance/2, -connector_bracket_overlap]) {
square([thickness + connector_bracket_clearance, connector_bracket_overlap + eps]);
}
}

Loading