Skip to content

Instantly share code, notes, and snippets.

@patmandenver
Created April 5, 2020 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patmandenver/c8bd15f527b7dfa2ea587d419d5f374b to your computer and use it in GitHub Desktop.
Save patmandenver/c8bd15f527b7dfa2ea587d419d5f374b to your computer and use it in GitHub Desktop.
$fn=100;
headband_file="headband-15-mm-height-no-hex_pla.stl";
num=5;
adjust_base_z=3.28;
adjust_base_x=0;
adjust_base_y=-8.95;
support_thickness=1.2;
support_bridge=1.5;
heigth=15;
bump=0.30;
cylinder_size=0.4;
extend_for_testing=00; //Set to 10 to see cylinders
//Supports on just one side
support_locs=[
[0,67.55],
[90.95,7.1],
[0,27.2],
[84.5,-29],
[86.25,-68],
];
rotate(180){
color("OrangeRed"){
for(x=[0:num-1]){
translate([adjust_base_x,adjust_base_y,x*(heigth+bump)+adjust_base_z]){
import(headband_file, convexity=3);
}
}
}
mirror_copy()
cylinder_supports();
//Supports
mirror_copy(){
support_front();
support_side();
}
}
module support_front(){
color("#00FF00"){
translate([0,0.5]){
union(){
//Supports
linear_extrude(2*bump){
translate([29.55,67.5]){
difference(){
difference(){
union(){
circle(10);
}
translate([5,-30.8]){
rotate(73){
square(25);
}
}
}
circle(4-support_thickness);
translate([0,-4+support_thickness,0]){
square(8-2*support_thickness, center=true);
}
}
}
}
linear_extrude((num-1)*(heigth+bump)){
translate([29.55,67.5]){
difference(){
difference(){
union(){
circle(4);
translate([0,-4,0]){
square(8, center=true);
}
}
translate([0,-24]){
rotate(73){
square(20);
}
}
}
circle(4-support_thickness);
translate([0,-4+support_thickness,0]){
square(8-2*support_thickness, center=true);
}
}
}
}
for(y = [1:num-1]){
translate([0,0,y*(heigth+bump)-support_bridge-bump]){
//support_bridge
linear_extrude(support_bridge){
translate([29.55,67.5]){
difference(){
union(){
circle(4);
translate([0,-4,0]){
square(8, center=true);
}
}
translate([0,-24]){
rotate(73){
square(20);
}
}
}
}
}
}
}
}
}
}
}
module support_side(){
color("#00FFFF"){
//supports
linear_extrude(2*bump){
translate([93.05,13.9]){
rotate(-3){
difference(){
difference(){
union(){
circle(10);
}
translate([-17.7,-25]){
rotate(27){
square(24);
}
}
}
circle(4-support_thickness);
translate([-4+support_thickness,0,0]){
square(8-2*support_thickness, center=true);
}
}
}
}
}
//union(){
linear_extrude((num-1)*(heigth+bump)){
translate([93.05,13.9]){
rotate(-3){
difference(){
difference(){
union(){
circle(4);
translate([-4,0,0]){
square(8, center=true);
}
}
translate([-18.3,-14.9]){
rotate(25){
square(20);
}
}
}
circle(4-support_thickness);
translate([-4+support_thickness,0,0]){
square(8-2*support_thickness, center=true);
}
}
}
}
}
for(y = [1:num-1]){
translate([0,0,y*(heigth+bump)-support_bridge-bump]){
//support_bridge
linear_extrude(support_bridge){
translate([93.05,13.9]){
rotate(-3){
difference(){
union(){
circle(4);
translate([-4,0,0]){
square(8, center=true);
}
}
translate([-18.3,-14.4]){
rotate(27){
square(20);
}
}
}
}
}
}
}
}
}
}
module cylinder_supports() {
for(y = [0:len(support_locs)-1]){
translate(support_locs[y]){
color("#FFAA00"){
cylinder(num*heigth+(num-1)*bump+extend_for_testing,
cylinder_size, cylinder_size);
}
}
}
}
//See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Tips_and_Tricks#Create_a_mirrored_object_while_retaining_the_original
module mirror_copy(v = [1, 0, 0]) {
children();
mirror(v) children();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment