├── README.md ├── demo.scad ├── dovetail.scad └── example.png /README.md: -------------------------------------------------------------------------------- 1 | # Dovetail parametric generator for OpenSCAD / Générateur de queue d'aronde pour OpenSCAD 2 | 3 | You want to print a OpenSCAD design too large for your 3D printer ? 4 | 5 | Try to cut them with a dovetail ! 6 | 7 | ![Dovetail](https://github.com/hugokernel/OpenSCAD_Dovetail/blob/master/example.png?raw=true) 8 | 9 | ## Use 10 | 11 | Open the demo.scad file with OpenSCAD to see the cut in action. 12 | 13 | With OpenSCAD version higher than 2019.05, you can use customizer to apply some settings. 14 | 15 | ## Example 16 | 17 | ```OpenSCAD 18 | use ; 19 | 20 | // Your amazing design you want to cut 21 | module amazing_design() { 22 | cube(size=[50, 50, 10], center=true); 23 | } 24 | 25 | // First, setup the cutting position: middle cut 26 | position = [0, 0, 0]; 27 | 28 | // Next, setup the dimension of the cut: use the bounding box of your design 29 | dimension = [50, 50, 10]; 30 | 31 | // Finally, setup the dovetail: 32 | // - Teeth count 33 | // - Teeth height 34 | // - Teeth Clearance 35 | teeth = [5, 8, 0.5]; 36 | 37 | // Now, cut ! 38 | 39 | // Extract the first part... 40 | intersection() { 41 | amazing_design(); 42 | cutter(position=[0, 0, 0], dimension=dimension, teeths=teeth, male=true); 43 | } 44 | 45 | // ... and the second part 46 | intersection() { 47 | amazing_design(); 48 | cutter(position=[0, 0, 0], dimension=dimension, teeths=teeth, male=false); 49 | } 50 | ``` 51 | -------------------------------------------------------------------------------- /demo.scad: -------------------------------------------------------------------------------- 1 | /* This demo cut a 50x50x10 cube in 2 parts */ 2 | use ; 3 | 4 | /* [Teeth] */ 5 | 6 | // Teeth count 7 | Teeth_count = 5; // [2:10] 8 | 9 | // Teeth height 10 | Teeth_height = 8; // [2:20] 11 | 12 | // Teeth clearance 13 | Teeth_clearance = 4; // [1:10] 14 | 15 | /* [General] */ 16 | 17 | // Displayed element choice 18 | Debug_flag = false; // [true:Active, false:Unactive] 19 | 20 | // Cube dimension 21 | Cube_dimension = [50, 50, 10]; 22 | 23 | /** 24 | * [x, y, z] 25 | * - x : Teeth count 26 | * - y : Teeth height 27 | * - z : Teeth Clearance 28 | */ 29 | teeth = [Teeth_count, Teeth_height, Teeth_clearance / 10]; 30 | 31 | module amazing_design() { 32 | cube(size=Cube_dimension, center=true); 33 | } 34 | 35 | intersection() { 36 | amazing_design(); 37 | cutter([0, 0, 0], Cube_dimension, teeth, true, Debug_flag); 38 | } 39 | 40 | intersection() { 41 | amazing_design(); 42 | cutter([0, 0, 0], Cube_dimension, teeth, false, Debug_flag); 43 | } 44 | -------------------------------------------------------------------------------- /dovetail.scad: -------------------------------------------------------------------------------- 1 | /** 2 | * Dovetail parametric generator for OpenScad 3 | * Générateur de queue d'aronde pour OpenScad 4 | * 5 | * Copyright (c) 2012 Charles Rincheval. All rights reserved. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | * Last update : 22 | * https://github.com/hugokernel/OpenSCAD_Dovetail 23 | * 24 | * http://www.digitalspirit.org/ 25 | */ 26 | 27 | /** 28 | * Create one teeth 29 | * @param int width Teeth width 30 | * @param int height Teeth height 31 | * @param int thickness Teeth thickness 32 | */ 33 | module dovetail_teeth(width, height, thickness) { 34 | offset = width / 3; 35 | translate([- width / 2, - height / 2, 0]) { 36 | linear_extrude(height = thickness) { 37 | polygon([[0, 0], [width, 0], [width - offset, height], [offset, height]]); 38 | } 39 | } 40 | } 41 | 42 | 43 | /** 44 | * Dovetail 45 | * @param int width Dovetail width 46 | * @param int teeth_count Teeth count 47 | * @param int teeth_height Teeth height 48 | * @param int teeth_thickness Teeth thickness 49 | * @param int clear Teeth clear 50 | * @param bool male Get male (true) or female (false) 51 | */ 52 | module dovetail(width, teeth_count, teeth_height, teeth_thickness, clear=0.1, male=true, debug=false) { 53 | 54 | /** 55 | * 4 sections : 56 | * 57 | * |1/2 1/2| 58 | * |--+ <- 3 -> +--|--+ +-- 59 | * | \1 1 1/ | \ / 60 | * | \_____/ | \_____/ 61 | */ 62 | 63 | y = ((width - teeth_count * 2 * clear) / teeth_count) / 4; 64 | 65 | compensation = - 0.1; 66 | teeth_width = y * 3; 67 | 68 | // Always width / 3 (ref. dovetail_teeth()) 69 | offset = teeth_width / 3; 70 | start_at = clear * 2 + teeth_width / 2 - width / 2 - clear; 71 | 72 | translate([0, 0, - teeth_thickness / 2]) { 73 | 74 | // Debug purpose only 75 | if (debug) { 76 | translate([- width / 2, 0, - width / 2]) { 77 | %cube(size = [width, 0.01, width]); 78 | } 79 | } 80 | 81 | for (i = [-1 : teeth_count * 2 - 1] ) { 82 | x = start_at + y / 2 + (teeth_width - offset + clear) * i; 83 | if (i % 2) { 84 | x = x + 0.1; 85 | translate([x + compensation, - clear, 0]) { 86 | rotate([0, 0, 180]) { 87 | if (male == true) { 88 | dovetail_teeth(teeth_width - clear, teeth_height - clear, teeth_thickness); 89 | } 90 | } 91 | } 92 | } else { 93 | translate([x, clear, 0]) { 94 | if (male == false) { 95 | dovetail_teeth(teeth_width - clear, teeth_height - clear, teeth_thickness); 96 | } 97 | } 98 | } 99 | } 100 | } 101 | } 102 | 103 | /** 104 | * Cut piece 105 | * @param vector position Cut position ([x, y, z]) 106 | * @param vector dimension Dimension of bounding box ([w, l, h]) 107 | * @param vector teeths Teeths parameters ([count, height, clearance]) 108 | * @param bool male Get male (true) or female (false) 109 | */ 110 | module cutter(position, dimension, teeths, male=true, debug=false) { 111 | translate(position) { 112 | dovetail(dimension[0], teeths[0], teeths[1], dimension[2], teeths[2], male, debug); 113 | 114 | if (male) { 115 | translate([- dimension[0] / 2, - (teeths[1] / 2 - 0.1) - dimension[1], - dimension[2] / 2]) { 116 | cube(size = dimension); 117 | } 118 | } else { 119 | translate([- dimension[0] / 2, teeths[1] / 2 - 0.1, - dimension[2] / 2]) { 120 | cube(size = dimension); 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugokernel/OpenSCAD_Dovetail/fdf304b9abf96b1a9bc67cc79a0c1371f831b086/example.png --------------------------------------------------------------------------------