Advertisement
Guest User

3dverkstan upside down stack

a guest
Apr 9th, 2020
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $fn = 30;
  2.  
  3. // from openscad, export amf, then import in prusaslicer and detect thin walls
  4.  
  5. //headband_file="empty_test.stl";
  6. // start with visor for north america, convert to amf using prusaslicer
  7. // then import that amf here.
  8. // without this step, prusaslicer gcode consistently missed support walls
  9. headband_file="Visor_Frame_NORTH_AMERICA_letter_6-hole_v5-repair.zip.amf";
  10.  
  11. number_of_headbands = 29;
  12. headband_height = 5;
  13. layer_height = 0.35;
  14. extend_for_testing = 0; //Set to 10 to see supports
  15. extrusion_width = 0.6;
  16. cylinder_size = extrusion_width;
  17. support_width = extrusion_width * 1.5;
  18.  
  19. visor_height = layer_height * 4;
  20. intra_headband_gap = layer_height * 1;
  21.  
  22. //Supports on just one side, get mirror_copied to other side
  23. support_locs=[
  24.   [12.5,31],
  25.   [12.5,18.3],
  26.   [48.3,5.5],
  27.   [48,20.3],
  28.   [54.3,12],
  29.   [62,1.5],
  30.   [69.5,-1],
  31.   [76.5,-13],
  32.   [76, -38.2],
  33.   [71.5, -45],
  34.   [62.7,-80],
  35.   [47.2,-110],
  36.   [26.3,-135],
  37.   [29, -147.1],
  38.   [37.8, -146],
  39.   [38.3, -134.5],
  40.   [73,-28],
  41.   [68.5,-62],
  42.   [56,-95],
  43.   [35.8,-125]
  44.   ];
  45.  
  46. stack_height =
  47.   number_of_headbands * headband_height
  48.   + (number_of_headbands - 1) * intra_headband_gap;
  49.  
  50. module original_stl(){
  51.   translate([0, -58, headband_height / 2]){
  52.     import(headband_file, convexity = 10);}}
  53.  
  54. module upside_down_original_stl(){
  55.   translate([0, -58, headband_height / 2]){
  56.     rotate([0, 180, 0]){
  57.       import(headband_file, convexity = 10);}}}
  58.  
  59. module bottom_2d(){
  60.   projection(cut = true){
  61.     original_stl();}}
  62.  
  63. module middle(){
  64.   projection(cut = true){
  65.     translate([0, 0, -headband_height / 2]){
  66.       original_stl();}}}
  67.  
  68. module visor_infill_2d(){
  69.   difference(){
  70.     bottom_2d();
  71.     middle();}}
  72.  
  73. module bottom_2d_outline(){
  74.   difference(){
  75.     bottom_2d();
  76.     offset(-support_width){
  77.       bottom_2d();}}}
  78.  
  79. module visor(){
  80.   linear_extrude(height = visor_height){
  81.     bottom_2d();}}
  82.  
  83. module visor_support_walls_2d(){
  84.   intersection(){
  85.     bottom_2d();
  86.     union(){
  87.       mirror_copy(){
  88.         translate([10.3, -50]){
  89.           square([support_width, 200], center = true);}
  90.         translate([15.1, -50]){
  91.           square([support_width, 200], center = true);}
  92.         translate([50, -50]){
  93.           square([support_width, 200], center = true);}
  94.         translate([50, -50]){
  95.           square([support_width, 200], center = true);}}}}}
  96.  
  97. module walls_2d(){
  98.   intersection(){
  99.     bottom_2d();
  100.     union(){
  101.       translate([0, -50]){
  102.         arms = 12;
  103.         for(index = [0 : arms - 1]){
  104.           rotate(index * 360 / arms){
  105.             square([support_width, 200], center = true);}}}
  106.       translate([0, -10.7]){
  107.         square([200, support_width], center = true);}
  108.       translate([0, -15.4]){
  109.         square([200, support_width], center = true);}
  110.       translate([0, -36]){
  111.         square([200, support_width], center = true);}
  112.       translate([0, -40.4]){
  113.         square([200, support_width + 1], center = true);}
  114.       mirror_copy(){
  115.         small_arms = 6;
  116.         translate([-32.5, -140]){
  117.           for(index = [0 : small_arms - 1]){
  118.             rotate(index * 360 / small_arms){
  119.               square([support_width, 200], center = true);}}}
  120.         translate([-60, 10]){
  121.           for(index = [0 : small_arms - 1]){
  122.             rotate(index * 360 / small_arms){
  123.               square([support_width, 20], center = true);}}}
  124.         translate([-65, -5]){
  125.           for(index = [0 : small_arms - 1]){
  126.             rotate(index * 360 / small_arms){
  127.               square([support_width, 20], center = true);}}}}}}}
  128.  
  129. module circle_supports(){
  130.   mirror_copy(){
  131.     for(index = [0 : len(support_locs) - 1]){
  132.       translate(support_locs[index]){
  133.         color("#FF00"){
  134.           circle(cylinder_size);}}}}}
  135.  
  136. module support(){
  137.   if(number_of_headbands > 1){
  138.     for(index = [0 : number_of_headbands - 1 - 1]){
  139.       translate([0, 0, index * (headband_height + intra_headband_gap)
  140.                  + headband_height]){
  141.         linear_extrude(height = intra_headband_gap + extend_for_testing){
  142.           circle_supports();
  143.           visor_support_walls_2d();
  144.           walls_2d();}}}}}
  145.  
  146. module single_headband(){
  147.   difference(){
  148.     original_stl();
  149.     translate([0, 0, -1]){
  150.       linear_extrude(height = headband_height + 1){
  151.         visor_infill_2d();}}}
  152.   translate([0, 0, headband_height - visor_height]){
  153.     visor();}}
  154.  
  155. module stack(number_of_headbands = number_of_headbands){
  156.     for(x=[0:number_of_headbands - 1]){
  157.       translate([0, 0, x * (headband_height + intra_headband_gap)]){
  158.         single_headband();}}
  159.     support();}
  160.  
  161. module cylinder_supports() {
  162.   mirror_copy(){
  163.     for(y = [0:len(support_locs) - 1]){
  164.       translate(support_locs[y]){
  165.         color("#FF0000"){
  166.           cylinder(stack_height + extend_for_testing,
  167.                    cylinder_size, cylinder_size);}}}}}
  168.  
  169. //See https://en.wikibooks.org/
  170. // wiki/OpenSCAD_User_Manual/Tips_and_Tricks
  171. // #Create_a_mirrored_object_while_retaining_the_original
  172. module mirror_copy(v = [1, 0, 0]) {
  173.   children();
  174.   mirror(v) children();
  175. }
  176.  
  177. module test_support_area(){
  178.   // use this to quickly print out the joining section
  179.   intersection(){
  180.     stack(2);
  181.     translate([0, 0, headband_height - layer_height * 3]){
  182.       // 3 + 2 + 3 = layers before, layers during, layers after
  183.       linear_extrude(height = layer_height * (3 + 2 + 3)){
  184.         square(500, center = true);}}}}
  185.  
  186. stack(number_of_headbands);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement