October 27, 2024

OpenScad Cookie Cutter Edits

WIP - Journal Notes

The scale of the top wall is making ghosty bits when I set it to the nozzle of .4mm I get .~38mm or some variant while it uses the cone module. It needs to be exact so that there are no lumps on the cutting edge.

Need to somehow replace the wall function with the below. 

Left off on Test8.

Found module bevel edges. 
https://github.com/hraftery/prism-chamfer

1. Copy prism-chamfer into OpenSCAD libraries
Ex: C:\Users\emily\Documents\OpenSCAD\libraries


//==============================================================================

// Include the prism-chamfer library for creating chamfers in OpenSCAD

//==============================================================================


include <prism-chamfer.scad>;


// Define parameters

scale = 1;             // Scaling factor for SVG coordinates

minWallThickness = 1;  // Minimum wall thickness

wallHeight = 11;       // Total height of the object

nozzle = 0.4;          // Desired flat edge thickness at the top after chamfer


// SVG coordinates for the outer wall (scaled)

outerWall_0 = scale * [[-0.200, 99.800], [-99.800, 99.800], [-99.800, 0.200], [-0.200, 0.200], [-0.200, 99.800]];


// Chamfer parameters

Start_edge = 0;                // First edge to be chamfered (adjust as needed)

End_edge = len(outerWall_0) - 2; // Last edge to be chamfered (one less than total vertices)

Top = true;                    // Chamfer the top edges


// Side lengths for the chamfer

Side_length = minWallThickness - nozzle; // Calculate side length to achieve 0.4mm flat top

Enable_side2 = true;           // Enable two different chamfer side lengths

Side2_length = wallHeight - 2; // Side length for the start of the taper at height-2

Corner_slope = "medium";       // Chamfer slope (adjust as needed)


// Module to create the 2D base shape from SVG points

module base_shape() {

    difference() {

        // Outer path

        polygon(points = outerWall_0);

        

        // Inner path (offset by thickness for wall)

        offset(r = -minWallThickness) {

            polygon(points = outerWall_0);

        }

    }

}


// Main extrusion and chamfer application

difference() {

    // Extrude the base shape to the full height

    linear_extrude(height = wallHeight) {

        base_shape();

    }

    // Apply the chamfer to taper from height-2 down to the nozzle

    translate([0, 0, wallHeight - 2]) {

        prism_chamfer_mask(

            outerWall_0,

            Start_edge,

            End_edge,

            Top ? wallHeight - (wallHeight - 2) : wallHeight,    // Chamfer starting point

            Side_length,

            Enable_side2 ? Side2_length : Side_length, // Dual side length for taper

            Corner_slope

        );

    }

}