openscad-models/avocado-nameplate/test-avocado.scad
Cal Corum 53c5f279ac Initial commit: Avocado nameplate for Ry
- OpenSCAD model with recessed avocado cross-section and pit
- Recessed text "#99 Ry" / "Avocado"
- Keychain hole at top
- Exported STL ready for 3D printing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 11:27:10 -06:00

185 lines
6.0 KiB
OpenSCAD

// Avocado Nameplate for Ry
// A rectangular plate with recessed avocado cross-section and raised text
/* [Plate Dimensions] */
plate_width = 50; // mm
plate_height = 85; // mm
plate_thickness = 5; // mm
/* [Avocado Settings] */
avocado_recess_depth = 2; // mm - how deep the avocado is recessed
avocado_scale = 0.65; // scale factor for avocado size relative to plate
avocado_y_offset = 2; // mm - how far up from center the avocado is positioned
/* [Pit Settings] */
pit_width = 15; // mm
pit_height = 16; // mm
pit_recess_depth = 1; // mm - how deep the pit is recessed into plate
/* [Text Settings] */
text_line1 = "#99 Ry";
text_line2 = "\"Avocado\"";
text_size = 7; // mm - font size
text_bump = 1; // mm - how high text rises above plate
text_line_spacing = 9; // mm - vertical spacing between lines
text_y_position = 5; // mm - distance from bottom of plate to bottom line baseline
text_font = "Liberation Sans:style=Bold";
/* [Keychain Hole] */
keychain_hole_diameter = 4; // mm - diameter of the hole
keychain_hole_y_offset = 6; // mm - distance from top edge of plate to hole center
/* [Resolution] */
$fn = 64; // smoothness for curves
// ============================================
// MODULES
// ============================================
// 2D avocado outline (pear/teardrop shape)
module avocado_outline_2d(scale_factor = 1) {
// Create pear shape using hull of circles
// Wider bottom, narrower top with slight point
scale([scale_factor, scale_factor, 1]) {
hull() {
// Bottom bulge (wider part)
translate([0, -8, 0])
circle(r = 22);
// Middle section
translate([0, 15, 0])
circle(r = 16);
// Top narrow part
translate([0, 28, 0])
circle(r = 12);
// Tip/stem area
translate([0, 30, 0])
circle(r = 2);
}
}
}
// 2D pit outline (oval)
module pit_outline_2d() {
// Offset slightly down from center since avocado pit sits in lower half
translate([0, -2, 0])
scale([pit_width/2, pit_height/2, 1])
circle(r = 1);
}
// 2D avocado cross-section (outer minus pit)
module avocado_cross_section_2d(scale_factor = 1) {
difference() {
avocado_outline_2d(scale_factor);
pit_outline_2d();
}
}
// 3D avocado recess (for subtracting from plate)
module avocado_recess_3d() {
// Position avocado in upper portion of plate
translate([plate_width/2, plate_height/2 + avocado_y_offset, plate_thickness - avocado_recess_depth])
linear_extrude(height = avocado_recess_depth + 0.1) // +0.1 to ensure clean cut
avocado_cross_section_2d(avocado_scale);
}
// 3D pit recess (for subtracting from plate surface)
module pit_recess_3d() {
translate([plate_width/2, plate_height/2 + avocado_y_offset, plate_thickness - pit_recess_depth])
linear_extrude(height = pit_recess_depth + 0.1)
translate([0, -2, 0]) // Match pit_outline_2d offset
scale([pit_width/2, pit_height/2, 1])
circle(r = 1);
}
// 3D raised text (two lines, centered) - COMMENTED OUT FOR TESTING
// module text_3d_raised() {
// // Bottom line (line 2 - "Avocado")
// translate([plate_width/2, text_y_position, plate_thickness])
// linear_extrude(height = text_bump)
// text(text_line2,
// size = text_size,
// font = text_font,
// halign = "center",
// valign = "baseline");
//
// // Top line (line 1 - "#99 Ry")
// translate([plate_width/2, text_y_position + text_line_spacing, plate_thickness])
// linear_extrude(height = text_bump)
// text(text_line1,
// size = text_size,
// font = text_font,
// halign = "center",
// valign = "baseline");
// }
// 3D recessed text (two lines, centered) - matches avocado recess depth
module text_recess_3d() {
// Bottom line (line 2 - "Avocado")
translate([plate_width/2, text_y_position, plate_thickness - avocado_recess_depth])
linear_extrude(height = avocado_recess_depth + 0.1) // +0.1 for clean cut
text(text_line2,
size = text_size,
font = text_font,
halign = "center",
valign = "baseline");
// Top line (line 1 - "#99 Ry")
translate([plate_width/2, text_y_position + text_line_spacing, plate_thickness - avocado_recess_depth])
linear_extrude(height = avocado_recess_depth + 0.1)
text(text_line1,
size = text_size,
font = text_font,
halign = "center",
valign = "baseline");
}
// Base plate
module plate_base() {
cube([plate_width, plate_height, plate_thickness]);
}
// Keychain hole (for subtracting from plate)
module keychain_hole_3d() {
translate([plate_width/2, plate_height - keychain_hole_y_offset, -0.1])
cylinder(h = plate_thickness + 0.2, d = keychain_hole_diameter);
}
// ============================================
// MAIN ASSEMBLY
// ============================================
module avocado_nameplate() {
difference() {
plate_base();
avocado_recess_3d();
pit_recess_3d(); // Pit recessed into plate surface
text_recess_3d(); // Recessed text (same depth as avocado)
keychain_hole_3d(); // Hole at top for keychain ring
}
// COMMENTED OUT: Raised text version
// union() {
// difference() {
// plate_base();
// avocado_recess_3d();
// }
// text_3d_raised();
// }
}
// Render the nameplate
avocado_nameplate();
// ============================================
// PREVIEW HELPERS (uncomment to debug)
// ============================================
// Preview just the 2D avocado shape:
// avocado_cross_section_2d(avocado_scale);
// Preview avocado position on plate:
// #avocado_recess_3d();