New paste Repaste Download
// Parameters
rack_length = 152.4; // 6 inches in mm
rack_height = 10; // Height of the rack
rack_thickness = 2; // Thickness of the rack
plate_thickness = 1; // Thickness of the plate connecting racks
module = 1; // Gear module (metric)
num_teeth_pinion = 20; // Number of teeth in the pinion
pitch_diameter = num_teeth_pinion * module; // Pitch diameter of the pinion
tooth_height = 2 * module; // Tooth height for the rack
// Function to create a single tooth for the rack
module tooth() {
    difference() {
        // Rack tooth profile (basic trapezoidal shape)
        polygon(points=[[0,0], [module, 0], [module/2, tooth_height], [-module/2, tooth_height]]);
    }
}
// Rack
module rack() {
    union() {
        for (i = [0 : (rack_length / module) - 1]) {
            translate([i * module, 0, 0])
                tooth();
        }
    }
}
// Pinion Gear
module pinion() {
    difference() {
        // Gear body (cylinder)
        cylinder(h = 10, d = pitch_diameter);
        
        // Inner hole of the pinion (optional, if needed)
        translate([0, 0, -1])
            cylinder(h = 12, d = module * 2);
    }
}
// Plate to join two racks
module connecting_plate() {
    union() {
        // The plate will be centered between two racks
        translate([0, 0, -plate_thickness / 2])
            cube([rack_length * 2 + 10, rack_height + 10, plate_thickness]);
    }
}
// Create the assembly of two racks and a pinion
module assembly() {
    union() {
        // First rack
        translate([0, 0, 0])
            rack();
        
        // Second rack
        translate([rack_length + 10, 0, 0])
            rack();
        
        // Connecting plate
        translate([rack_length / 2, 0, -plate_thickness / 2])
            connecting_plate();
        
        // Pinion positioned in the middle of the racks
        translate([rack_length / 2, rack_height + 20, 0])
            pinion();
    }
}
// Render the assembly
assembly();
Filename: None. Size: 2kb. View raw, , hex, or download this file.

This paste expires on 2025-01-25 06:05:05.426478. Pasted through web.