Skip to content

Instantly share code, notes, and snippets.

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/785af731421e27d395a18681726e3985 to your computer and use it in GitHub Desktop.
Save patmandenver/785af731421e27d395a18681726e3985 to your computer and use it in GitHub Desktop.
$fn=100;
headband_file="Prusa_RC3_PLA.stl";
num=2;
adjust_base=12.5;
adjust_base_x=7.8;
support_thickness=1.2;
support_bridge=1.5;
heigth=20;
bump=0.30;
support_size=0.8;
extend_for_testing=00; //Set to 10 to see cylinders
//Supports on just one side
support_locs=[
//[X, Y,Rotate]
[0,67.55,0],
[90.95,7.1,30],
[0,27.2,0],
[84.5,-29,13],
[86.25,-68,0],
];
rotate(180){
color("OrangeRed"){
for(x=[0:num-1]){
translate([adjust_base_x,0,x*(heigth+bump)+adjust_base]){
import(headband_file, convexity=3);
}
}
}
mirror_copy()
cylinder_supports();
//Supports
mirror_copy(){
support_front();
support_side();
}
}
module support_front(){
color("#00FF00"){
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][0],support_locs[y][1]]){
color("#FFAA00"){
rotate(support_locs[y][2]){
linear_extrude(num*heigth+(num-1)*bump+extend_for_testing){
square(support_size, center=true);
}
}
}
}
}
}
//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