Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $fn = 30;
- // from openscad, export amf, then import in prusaslicer and detect thin walls
- //headband_file="empty_test.stl";
- // start with visor for north america, convert to amf using prusaslicer
- // then import that amf here.
- // without this step, prusaslicer gcode consistently missed support walls
- headband_file="Visor_Frame_NORTH_AMERICA_letter_6-hole_v5-repair.zip.amf";
- number_of_headbands = 29;
- headband_height = 5;
- layer_height = 0.35;
- extend_for_testing = 0; //Set to 10 to see supports
- extrusion_width = 0.6;
- cylinder_size = extrusion_width;
- support_width = extrusion_width * 1.5;
- visor_height = layer_height * 4;
- intra_headband_gap = layer_height * 1;
- //Supports on just one side, get mirror_copied to other side
- support_locs=[
- [12.5,31],
- [12.5,18.3],
- [48.3,5.5],
- [48,20.3],
- [54.3,12],
- [62,1.5],
- [69.5,-1],
- [76.5,-13],
- [76, -38.2],
- [71.5, -45],
- [62.7,-80],
- [47.2,-110],
- [26.3,-135],
- [29, -147.1],
- [37.8, -146],
- [38.3, -134.5],
- [73,-28],
- [68.5,-62],
- [56,-95],
- [35.8,-125]
- ];
- stack_height =
- number_of_headbands * headband_height
- + (number_of_headbands - 1) * intra_headband_gap;
- module original_stl(){
- translate([0, -58, headband_height / 2]){
- import(headband_file, convexity = 10);}}
- module upside_down_original_stl(){
- translate([0, -58, headband_height / 2]){
- rotate([0, 180, 0]){
- import(headband_file, convexity = 10);}}}
- module bottom_2d(){
- projection(cut = true){
- original_stl();}}
- module middle(){
- projection(cut = true){
- translate([0, 0, -headband_height / 2]){
- original_stl();}}}
- module visor_infill_2d(){
- difference(){
- bottom_2d();
- middle();}}
- module bottom_2d_outline(){
- difference(){
- bottom_2d();
- offset(-support_width){
- bottom_2d();}}}
- module visor(){
- linear_extrude(height = visor_height){
- bottom_2d();}}
- module visor_support_walls_2d(){
- intersection(){
- bottom_2d();
- union(){
- mirror_copy(){
- translate([10.3, -50]){
- square([support_width, 200], center = true);}
- translate([15.1, -50]){
- square([support_width, 200], center = true);}
- translate([50, -50]){
- square([support_width, 200], center = true);}
- translate([50, -50]){
- square([support_width, 200], center = true);}}}}}
- module walls_2d(){
- intersection(){
- bottom_2d();
- union(){
- translate([0, -50]){
- arms = 12;
- for(index = [0 : arms - 1]){
- rotate(index * 360 / arms){
- square([support_width, 200], center = true);}}}
- translate([0, -10.7]){
- square([200, support_width], center = true);}
- translate([0, -15.4]){
- square([200, support_width], center = true);}
- translate([0, -36]){
- square([200, support_width], center = true);}
- translate([0, -40.4]){
- square([200, support_width + 1], center = true);}
- mirror_copy(){
- small_arms = 6;
- translate([-32.5, -140]){
- for(index = [0 : small_arms - 1]){
- rotate(index * 360 / small_arms){
- square([support_width, 200], center = true);}}}
- translate([-60, 10]){
- for(index = [0 : small_arms - 1]){
- rotate(index * 360 / small_arms){
- square([support_width, 20], center = true);}}}
- translate([-65, -5]){
- for(index = [0 : small_arms - 1]){
- rotate(index * 360 / small_arms){
- square([support_width, 20], center = true);}}}}}}}
- module circle_supports(){
- mirror_copy(){
- for(index = [0 : len(support_locs) - 1]){
- translate(support_locs[index]){
- color("#FF00"){
- circle(cylinder_size);}}}}}
- module support(){
- if(number_of_headbands > 1){
- for(index = [0 : number_of_headbands - 1 - 1]){
- translate([0, 0, index * (headband_height + intra_headband_gap)
- + headband_height]){
- linear_extrude(height = intra_headband_gap + extend_for_testing){
- circle_supports();
- visor_support_walls_2d();
- walls_2d();}}}}}
- module single_headband(){
- difference(){
- original_stl();
- translate([0, 0, -1]){
- linear_extrude(height = headband_height + 1){
- visor_infill_2d();}}}
- translate([0, 0, headband_height - visor_height]){
- visor();}}
- module stack(number_of_headbands = number_of_headbands){
- for(x=[0:number_of_headbands - 1]){
- translate([0, 0, x * (headband_height + intra_headband_gap)]){
- single_headband();}}
- support();}
- module cylinder_supports() {
- mirror_copy(){
- for(y = [0:len(support_locs) - 1]){
- translate(support_locs[y]){
- color("#FF0000"){
- cylinder(stack_height + 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();
- }
- module test_support_area(){
- // use this to quickly print out the joining section
- intersection(){
- stack(2);
- translate([0, 0, headband_height - layer_height * 3]){
- // 3 + 2 + 3 = layers before, layers during, layers after
- linear_extrude(height = layer_height * (3 + 2 + 3)){
- square(500, center = true);}}}}
- stack(number_of_headbands);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement