Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
With Squares
$fn=100;
headband_file="Prusa_RC3_PETG.stl";
num=4;
adjust_base=12.5;
adjust_base_x=7.8;
support_thickness=1.2;
support_bridge=1.5;
heigth=20;
bump=0.30;
cylinder_size=0.4;
extend_for_testing=0; //Set to 10 to see cylinders
//Supports on just one side
support_locs=[
[86.25,-68,0],//inner edge
[90.95,7.2,23], //outer edge
[0,27.2,90], //center inner band
[84.5,-29.5,11],//inner Y
[66.25,.25,223], //inner 2 from Y
[69.5,35.9,44], //outer Y
[41,57.7,64],//outer 2 from y
[86.25,-49,2],//second from inner edge
[36,20.5,68],//second from inner center
[82.75,5,16],//middle split middle pin
[10.8,66.8,-97],// first from outer center
[18,25.5,80],//first from inner center
[52,12.3,55],//third from inner center
[76,-13.5,31],//first from inner Y (inner band)
[86,-11,5],//first from inner Y (middle band)
[77,20,25],//first from outer Y (middle band)
[82,23.5,33],//first from edge outer band
[0,67.55,90],//center outer band
[57,48,52],//first from outer Y (towards center)
[26,63.8,74]//second from center outer band
];
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([1.5,3.5], 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
You can’t perform that action at this time.