/************************************************************************************* * * Parametric Stamp Handle * ************************************************************************************* * * 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)2023, Claude "Tryphon" Theroux, Montreal, Quebec, Canada * http://www.ctheroux.com/ * ************************************************************************************/ //////////////////////////////////////////////////////////////////////////////// // // General parameters // // If true, debug information are display in the console EnableDebug = true; // Label to put on the handle. Leave the string empty if not needed. label = "Sun"; // Stamp width in mm. This value must be greater than stampLength. stampWidth = 38; // Stamp height in mm. This value must be smaller than stampWidth. stampLength = 22; // Base handle thickness in mm stampBaseThickness = 5; // Handle width in mm handleWidth = 15; // Handle thickness in mm handleThickness = 5; // Handle height in mm handleHeight = 10; // Handle corner diameter in mm handleCornerDiameter = 5; // Font size in mm above the baseline fontSize = 5; // Height of the text in mm textHeight = 1.5; // Font name fontName = "Arial"; // Font vertical align verticalAlign = "baseline"; // Font horizontal align horizontalAlign = "left"; // Font direction direction = "ltr"; // Text offset in mm textOffset = 1; //////////////////////////////////////////////////////////////// // // Computed values. Nothing should be modified below this line. // assert(stampWidth >= stampLength, str("The stampWidth must be greater or equal to stampLength")); assert(stampWidth >= handleWidth, str("The stampWidth must be greater or equal to handleWidth")); assert(stampLength >= handleThickness, str("The stampWidth must be greater or equal to handleThickness")); module renderString(pStringDefinition) { if( len(pStringDefinition) > 0 ) { translate([-handleWidth, (stampLength - handleThickness) / 4 - textOffset, stampBaseThickness / 2 + textOffset]) linear_extrude(height = textHeight) text(pStringDefinition, size = fontSize, valign = verticalAlign, halign = horizontalAlign, font = fontName, direction = direction); } } module generateHandle() { $fn = 60; hull() { translate([(handleWidth - handleThickness) / 2, (handleThickness - handleCornerDiameter) / 2, 0]) union() { cylinder(h = handleHeight - handleThickness / 2, d = handleThickness); translate([0, 0, handleHeight - handleThickness / 2]) sphere(d = handleThickness); } translate([-(handleWidth - handleThickness) / 2, (handleThickness - handleCornerDiameter) / 2, 0]) union() { cylinder(h = handleHeight - handleThickness / 2, d = handleThickness); translate([0, 0, handleHeight - handleThickness / 2]) sphere(d = handleThickness); } } } module generateObject() { // Base cube([ stampWidth, stampLength, stampBaseThickness / 2], true); translate([0, 0, stampBaseThickness / 2]) linear_extrude(stampBaseThickness / 2, scale = 0.8, center = true) square([ stampWidth, stampLength], true); // Handle base translate([0, 0, stampBaseThickness / 2 + 1]) generateHandle(); renderString(label); } translate([0, 0, stampBaseThickness / 4]) generateObject();