/************************************************************************************* * * Simple Box with Cover * ************************************************************************************* * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT * HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * IT IS NOT PERMITTED TO MODIFY THIS COMMENT BLOCK. * * (c)2022, Claude "Tryphon" Theroux, Montreal, Quebec, Canada * http://www.ctheroux.com/ * ************************************************************************************/ // Object selector: body, cover or both ObjectSelector = "both"; // Internal width in mm Width = 73; // Internal length in mm Length = 160; // Internal height in mm Height = 70; // Wall tickness in mm WallTickness = 1.6; // Handle diameter in mm HandleDiameter = 15; // Handle height in mm HandleHeight = 4; // Cover lip height in mm CoverLipHeight = 4; // Cover tolerance in mm CoverTolerance = 0.1; // Display important values in the console EnableDebug = true; //////////////////////////////////////////////////////////////// // // Computed values. Nothing should be modified below this line. // module Body() { difference() { cube([Width + 2 * WallTickness, Length + 2 * WallTickness, Height + WallTickness]); translate([ WallTickness, WallTickness, WallTickness ]) cube([Width, Length, Height]); translate([ (Width + 2 * WallTickness) / 2, 0, Height + WallTickness + (HandleDiameter / 2 - HandleHeight) ]) rotate([ -90, 0, 0 ]) cylinder( d = HandleDiameter, h = Length + 2 * WallTickness); } } module Cover() { union() { cube([Width + 2 * WallTickness, Length + 2 * WallTickness, WallTickness]); translate([ WallTickness + CoverTolerance / 2, WallTickness + CoverTolerance / 2, WallTickness ]) difference() { cube([Width - CoverTolerance, Length - CoverTolerance, CoverLipHeight]); translate([ WallTickness, WallTickness, 0 ]) cube([Width - 2 * WallTickness - CoverTolerance, Length - 2 * WallTickness - CoverTolerance, CoverLipHeight ]); } } } if( ObjectSelector == "body" ) { Body(); } else if( ObjectSelector == "cover" ) { Cover(); } else if( ObjectSelector == "both" ) { Body(); translate([Width + 15, 0, 0]) Cover(); }