Skip to content

Instantly share code, notes, and snippets.

@ridercz
Last active February 8, 2022 15:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ridercz/fb9a9a4730ac393cea68e363ddf806ed to your computer and use it in GitHub Desktop.
Save ridercz/fb9a9a4730ac393cea68e363ddf806ed to your computer and use it in GitHub Desktop.
GitHub mount library for OpenSCAD
/****************************************************************************
* Altair's GoPro mounts library for OpenSCAD version: 1.0.0 (2021-04-16) *
* Copyright (c) Michal A. Valasek, 2021 license: CC BY-NC-SA 4.0 *
* ------------------------------------------------------------------------ *
* www.rider.cz * www.altair.blog *
****************************************************************************/
// Demo
$fn = 16;
color("#cc3333") gopro_mount_f();
color("#0099ff") translate([0, 3.25, 25]) mirror([0, 0, 1]) gopro_mount_m();
// Will generate GoPro mount female model:
// * base_height, base_width = dimensions of the base plate, depth is always 19 mm
// * leg_height = height of the legs, do not change unless you really have to
// * nut_diameter, nut depth, nut sides = parameters of the embedded nut, default to M5 square nut
module gopro_mount_f(base_height = 3, base_width = 24, leg_height = 17, nut_diameter = 11.5, nut_sides = 4, nut_depth = 3, $fudge = 1) {
// In general, these values are derived from GoPro mount size and you won't want to change them
diameter = 15;
leg_width = 3;
slit_width = 3.5;
hole_diameter = 5.5;
// Computed values
hole_offset = leg_height - diameter / 2 + base_height;
base_depth = slit_width * 2 + leg_width * 2 + nut_depth;
// Model itself
difference() {
// Outer shape
hull() {
translate([-base_width / 2, 0]) cube([base_width, base_depth + leg_width, base_height]);
translate([0, 0, hole_offset]) rotate([-90, 0, 0]) cylinder(d = diameter, h = base_depth + leg_width);
}
// Leg slits
for(y_offset = [leg_width, 2 * leg_width + slit_width]) translate([-base_width / 2 - $fudge, y_offset, base_height]) cube([base_width + 2 * $fudge, slit_width, leg_height]);
// Screw + nut hole
translate([0, -$fudge, hole_offset]) rotate([-90, 0,0]) {
cylinder(d = hole_diameter, h = base_depth + leg_width + 2 * $fudge);
translate([0, 0, leg_width + base_depth - nut_depth]) cylinder(d = nut_diameter, h = base_depth, $fn = nut_sides);
}
}
}
// Will generate GoPro mount male model:
// * base_height, base_width = dimensions of the base plate, depth is always 9.5 mm
// * leg_height = height of the legs, do not change unless you really have to
module gopro_mount_m(base_height = 3, base_width = 20, leg_height = 17) {
// In general, these values are derived from GoPro mount size and you won't want to change them
diameter = 15;
leg_width = 3;
slit_width = 3.5;
hole_diameter = 5.5;
// Computed values
base_depth = leg_width * 2 + slit_width;
hole_offset = [base_height + leg_height - diameter / 2, base_width / 2];
// Model itself
translate([-base_width / 2, 0]) cube([base_width, leg_width * 2 + slit_width, base_height]);
translate([0, leg_width + slit_width / 2]) rotate(90) translate([base_depth / 2, -hole_offset[1]]) rotate([0, -90, 0]) for(z_offset = [0, leg_width + slit_width]) translate([0, 0, z_offset]) linear_extrude(leg_width) difference() {
hull() {
square([base_height, base_width]);
translate(hole_offset) circle(d = diameter, $fn = $fn * 2);
}
translate(hole_offset) circle(d = hole_diameter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment