/************** BEST VIEWED IN A CODE EDITOR 80 COLUMNS WIDE ******************* * * Packout Compact Toolbox Secret Storage * Benjamen Johnson * 20200227 * Version 1 * openSCAD Version: 2019.05 * Licesnse: Creative Commons - Attribution - Share Alike * https://creativecommons.org/licenses/by-sa/4.0/ *******************************************************************************/ /*[Edit Me!]*/ // Left or right side box (front view) part = 0;//[0:Right, 1:Left] // Lip on bottom of cup for easy grabbing (won't be hidden) bottom_lip = 0; //[0:No, 1:Yes] // Make the cup slightly smaller than the hole cup_fit = 0.99; // Inside height of the cup cup_height = 80; /*[Advanced]*/ /******************************************************************************* * Advanced parameters *******************************************************************************/ // Thickness of the bottom bottom_thickness = 2; // Thickness of the walls wall_thickness = 2; // Taper percent per mm height taper = 0.0005; /*[Fine Tune Shape(see code)]*/ /******************************************************************************* * Upside down upper left octagon * * F----------- E ------ * / \ | * G / \ D | * | | | * |<------ L ------>| W * | | | * H \ / C | * \ / | * [0,0]. A-----------B ------ * * *******************************************************************************/ L = 38; W =37.5; AX= 11.25; BX= 26; CY= 12; DY= 31; EX= 29.5; FX= 14; GY= 25; HY= 10; // define the shape of the hole in the compact toolbox octogon = [[AX,0],[BX,0],[L,CY],[L,DY],[EX,W],[FX,W],[0,GY],[0,HY]]; // if there is a bottom lip requested, modify the shape octogon_lip = [[AX,0],[BX,0],[L,CY],[L,DY],[EX,W],[FX-7,W],[0,GY+6.3],[0,HY]]; /******************************************************************************* * Calculations *******************************************************************************/ // shrink the shape to make a cup that can slide in the hole cup = cup_fit*octogon; // shrink the special bottom so it matches the cup special_bottom = cup_fit*octogon_lip; // calulate how much to scale the cup from top to bottom cup_scale = (1 - taper*cup_height); /******************************************************************************* * Main "program" to make the parts *******************************************************************************/ print_part(); /******************************************************************************* * decide which part to create *******************************************************************************/ module print_part(){ if(part ==0) // make right side box make_cup(); else // make left side box mirror([1,0,0])make_cup(); } // end module print_part /******************************************************************************* * Make the cup *******************************************************************************/ module make_cup(){ union(){ // make the bottom if(bottom_lip == 1) linear_extrude(height = bottom_thickness)translate([-L/2,-W/2,0])polygon(special_bottom); else linear_extrude(height = bottom_thickness)translate([-L/2,-W/2,0])polygon(cup); //make the walls translate([-L/2,-W/2,2]) linear_extrude(height = cup_height,scale=cup_scale) difference(){ polygon(cup); offset(r=-wall_thickness)polygon(cup); }// end difference } //end union } // end module