Initial infrastructure documentation - comprehensive homelab reference
This commit is contained in:
1
Printing/Key caps/.claude/commands
Normal file
1
Printing/Key caps/.claude/commands
Normal file
@@ -0,0 +1 @@
|
||||
C:/Users/Fred/claude-shared/commands
|
||||
16
Printing/Key caps/.claude/index.html
Normal file
16
Printing/Key caps/.claude/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Directory listing for /Printing/Key caps/.claude/</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Directory listing for /Printing/Key caps/.claude/</h1>
|
||||
<hr>
|
||||
<ul>
|
||||
<li><a href="commands">commands</a></li>
|
||||
<li><a href="settings.local.json">settings.local.json</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
23
Printing/Key caps/.claude/settings.local.json
Normal file
23
Printing/Key caps/.claude/settings.local.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(where:*)",
|
||||
"Bash(if exist \"C:\\Program Files\\OpenSCAD\\openscad.exe\" echo Found at C:Program FilesOpenSCADopenscad.exe)",
|
||||
"Bash(\"/c/Program Files/OpenSCAD/openscad.exe\" -o \"Body5_scaled_98percent.stl\" \"Body5_scaled.scad\")",
|
||||
"Bash(\"/c/Program Files/OpenSCAD/openscad.exe\" --clear-cache -o \"Body5_scaled_98percent.stl\" \"Body5_scaled.scad\")",
|
||||
"Bash(\"/c/Program Files/OpenSCAD/openscad.exe\" -o \"Body5_TEST_circle.stl\" \"Body5_test_circle.scad\")",
|
||||
"Bash(\"/c/Program Files/OpenSCAD/openscad.exe\" -o \"test_cylinder.stl\" \"test_cylinder.scad\")",
|
||||
"Bash(\"/c/Program Files/OpenSCAD/openscad.exe\" -o \"Body5_scaled_FIXED_98percent.stl\" \"Body5_scaled_FIXED.scad\")",
|
||||
"Bash(\"/c/Program Files/OpenSCAD/openscad.exe\" --clear-cache -o \"Body5(1)_scaled_98percent.stl\" \"Body5(1)_scaled.scad\")",
|
||||
"Bash(\"/c/Program Files/OpenSCAD/openscad.exe\" -o \"Body5(1)_scaled_98percent.stl\" \"Body5(1)_scaled.scad\")",
|
||||
"Bash(ls:*)",
|
||||
"Bash(\"/c/Program Files/OpenSCAD/openscad.exe\" -D number_to_generate=1 -o \"Body5_num1.stl\" \"generate_numbered_keycaps.scad\")",
|
||||
"Bash(cmd /c generate_all_numbered_keycaps.bat)",
|
||||
"Bash(for i in {2..20})",
|
||||
"Bash(do \"/c/Program Files/OpenSCAD/openscad.exe\" -D number_to_generate=$i -o \"Body5_num$i.stl\" \"generate_numbered_keycaps.scad\")",
|
||||
"Bash(done)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
}
|
||||
}
|
||||
55
Printing/Key caps/Body5(1)_scaled.scad
Normal file
55
Printing/Key caps/Body5(1)_scaled.scad
Normal file
@@ -0,0 +1,55 @@
|
||||
// =====================================================
|
||||
// Keycap Body Scaling Script - FIXED VERSION
|
||||
// =====================================================
|
||||
// This script scales down the keycap body while preserving
|
||||
// the Cherry MX stem at its original 4mm x 4mm dimensions
|
||||
//
|
||||
// FIX: Centers the model first so cylinder operations work correctly
|
||||
// =====================================================
|
||||
|
||||
// ----- ADJUSTABLE PARAMETERS -----
|
||||
|
||||
body_scale_xy = 0.98; // 98% of original (2% smaller)
|
||||
body_scale_z = 1.00; // Keep height at 100%
|
||||
|
||||
stem_diameter = 4.8; // Diameter of circular stem preservation region (4.8mm to preserve 4mm x 4mm cross)
|
||||
stem_height = 10.0; // Height of stem region to preserve (tall enough to capture entire stem)
|
||||
stem_z_offset = -1.0; // Z offset to position cylinder on the stem
|
||||
$fn = 128; // Circle smoothness
|
||||
|
||||
stl_filename = "Body5(1).stl";
|
||||
|
||||
// =====================================================
|
||||
// MAIN MODEL - CENTERED APPROACH
|
||||
// =====================================================
|
||||
|
||||
// Center the imported model at origin
|
||||
// The stem cross should be centered at X=209, Y=223.5 in the original STL
|
||||
module centered_import() {
|
||||
translate([-209, -223.5, 0]) // Center X and Y on the stem
|
||||
import(stl_filename);
|
||||
}
|
||||
|
||||
union() {
|
||||
// Part 1: Scaled body WITHOUT the circular stem region
|
||||
difference() {
|
||||
scale([body_scale_xy, body_scale_xy, body_scale_z]) {
|
||||
centered_import();
|
||||
}
|
||||
|
||||
// Cut out a cylinder where the stem is
|
||||
translate([0, 0, stem_z_offset]) {
|
||||
cylinder(h = stem_height, d = stem_diameter + 0.5, center = true);
|
||||
}
|
||||
}
|
||||
|
||||
// Part 2: Original UNSCALED stem region (circular)
|
||||
intersection() {
|
||||
centered_import(); // NOT scaled - preserves original 4mm x 4mm cross
|
||||
|
||||
// Cylinder defines the 4.8mm circular stem region to keep at 100% scale
|
||||
translate([0, 0, stem_z_offset]) {
|
||||
cylinder(h = stem_height, d = stem_diameter, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
98
Printing/Key caps/Body5_scaled.scad
Normal file
98
Printing/Key caps/Body5_scaled.scad
Normal file
@@ -0,0 +1,98 @@
|
||||
// =====================================================
|
||||
// Keycap Body Scaling Script
|
||||
// =====================================================
|
||||
// This script scales down the keycap body while preserving
|
||||
// the Cherry MX stem at its original 4mm x 4mm dimensions
|
||||
// within a CIRCULAR region (for off-brand switches)
|
||||
//
|
||||
// Usage:
|
||||
// 1. Adjust body_scale_xy below (start with 0.98 = 98%)
|
||||
// 2. Adjust stem_x and stem_y to position circle on the cross
|
||||
// 3. Press F5 to preview, F6 to render
|
||||
// 4. Export STL: File > Export > Export as STL
|
||||
// =====================================================
|
||||
|
||||
// ----- ADJUSTABLE PARAMETERS -----
|
||||
|
||||
// Body scaling factor for X and Y axes
|
||||
body_scale_xy = 0.98; // 98% of original (2% smaller)
|
||||
body_scale_z = 1.00; // Keep height at 100%
|
||||
|
||||
// ----- STEM DIMENSIONS -----
|
||||
// Position the circular preservation region on the stem cross
|
||||
|
||||
stem_x = 209; // X position of stem center (adjust to align with cross)
|
||||
stem_y = 223.5; // Y position of stem center (adjust to align with cross)
|
||||
stem_z = 3.85; // Z position of stem center (adjust if needed)
|
||||
|
||||
stem_diameter = 5.5; // Diameter of circular region around the stem
|
||||
stem_height = 8.0; // Height of stem region to preserve
|
||||
|
||||
$fn = 128; // Circle smoothness (128 = very smooth, 64 = balanced)
|
||||
|
||||
stl_filename = "Body5.stl";
|
||||
|
||||
// =====================================================
|
||||
// MAIN MODEL
|
||||
// =====================================================
|
||||
|
||||
union() {
|
||||
// Part 1: Scaled body WITHOUT the circular stem region
|
||||
difference() {
|
||||
// The scaled keycap body (scaled around origin, then positioned)
|
||||
translate([stem_x * (1 - body_scale_xy), stem_y * (1 - body_scale_xy), 0]) {
|
||||
scale([body_scale_xy, body_scale_xy, body_scale_z]) {
|
||||
import(stl_filename);
|
||||
}
|
||||
}
|
||||
|
||||
// Cut out a cylinder where the stem is
|
||||
translate([stem_x, stem_y, stem_z]) {
|
||||
cylinder(
|
||||
h = stem_height,
|
||||
d = stem_diameter + 0.5,
|
||||
center = true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Part 2: Original stem at 100% scale in CIRCULAR region
|
||||
intersection() {
|
||||
// The original unscaled model
|
||||
import(stl_filename);
|
||||
|
||||
// A cylinder that defines the CIRCULAR stem region to keep
|
||||
translate([stem_x, stem_y, stem_z]) {
|
||||
cylinder(
|
||||
h = stem_height,
|
||||
d = stem_diameter,
|
||||
center = true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
// NOTES
|
||||
// =====================================================
|
||||
//
|
||||
// ADJUSTING THE CIRCULAR REGION POSITION:
|
||||
// If the circle is not centered on the cross stem:
|
||||
// 1. Open in OpenSCAD and press F5 to preview
|
||||
// 2. Rotate the view to see the stem from below
|
||||
// 3. Adjust stem_x and stem_y values until circle is centered on cross
|
||||
// 4. Typical adjustment: try values between 208-210 for X, 222-225 for Y
|
||||
//
|
||||
// ITERATIVE TESTING WORKFLOW:
|
||||
// 1. Start with body_scale_xy = 0.98 (98%)
|
||||
// 2. Export STL and test print
|
||||
// 3. If keycap is still too tight, decrease to 0.97
|
||||
// 4. If keycap is too loose, increase to 0.99
|
||||
// 5. Fine-tune in 0.005 increments (e.g., 0.975, 0.985)
|
||||
//
|
||||
// STEM DIAMETER ADJUSTMENT:
|
||||
// - Increase stem_diameter if you need more clearance around the cross
|
||||
// - Decrease stem_diameter for tighter tolerance
|
||||
// - Typical range: 4.5mm to 6.0mm
|
||||
//
|
||||
// =====================================================
|
||||
53
Printing/Key caps/Body5_scaled_FIXED.scad
Normal file
53
Printing/Key caps/Body5_scaled_FIXED.scad
Normal file
@@ -0,0 +1,53 @@
|
||||
// =====================================================
|
||||
// Keycap Body Scaling Script - FIXED VERSION
|
||||
// =====================================================
|
||||
// This script scales down the keycap body while preserving
|
||||
// the Cherry MX stem at its original 4mm x 4mm dimensions
|
||||
//
|
||||
// FIX: Centers the model first so cylinder operations work correctly
|
||||
// =====================================================
|
||||
|
||||
// ----- ADJUSTABLE PARAMETERS -----
|
||||
|
||||
body_scale_xy = 0.98; // 98% of original (2% smaller)
|
||||
body_scale_z = 1.00; // Keep height at 100%
|
||||
|
||||
stem_diameter = 5.5; // Diameter of circular stem preservation region
|
||||
stem_height = 8.0; // Height of stem region to preserve
|
||||
$fn = 128; // Circle smoothness
|
||||
|
||||
stl_filename = "Body5.stl";
|
||||
|
||||
// =====================================================
|
||||
// MAIN MODEL - CENTERED APPROACH
|
||||
// =====================================================
|
||||
|
||||
// First, we need to center the imported model
|
||||
// The original STL is positioned around x≈209, y≈220
|
||||
// We'll measure the bounding box and center it
|
||||
|
||||
module centered_import() {
|
||||
// Import and center the model at origin
|
||||
translate([-209, -223.5, -4.9]) // Approximate center based on STL coordinates
|
||||
import(stl_filename);
|
||||
}
|
||||
|
||||
union() {
|
||||
// Part 1: Scaled body WITHOUT the circular stem region
|
||||
difference() {
|
||||
scale([body_scale_xy, body_scale_xy, body_scale_z]) {
|
||||
centered_import();
|
||||
}
|
||||
|
||||
// Cut out a cylinder where the stem is (now centered at origin)
|
||||
cylinder(h = stem_height, d = stem_diameter + 0.5, center = true);
|
||||
}
|
||||
|
||||
// Part 2: Original unscaled stem region (circular)
|
||||
intersection() {
|
||||
centered_import();
|
||||
|
||||
// Cylinder defines the circular stem region to keep
|
||||
cylinder(h = stem_height, d = stem_diameter, center = true);
|
||||
}
|
||||
}
|
||||
31
Printing/Key caps/Body5_test_circle.scad
Normal file
31
Printing/Key caps/Body5_test_circle.scad
Normal file
@@ -0,0 +1,31 @@
|
||||
// TEST VERSION - Exaggerated circular cutout to verify it's working
|
||||
|
||||
body_scale_xy = 0.98;
|
||||
body_scale_z = 1.00;
|
||||
|
||||
stem_diameter = 8.0; // MUCH larger to make the circle obvious
|
||||
stem_height = 10.0; // Taller to ensure we capture everything
|
||||
stem_z_position = 0;
|
||||
$fn = 128;
|
||||
|
||||
stl_filename = "Body5.stl";
|
||||
|
||||
union() {
|
||||
difference() {
|
||||
scale([body_scale_xy, body_scale_xy, body_scale_z]) {
|
||||
import(stl_filename);
|
||||
}
|
||||
// Large obvious cylinder
|
||||
translate([0, 0, stem_z_position]) {
|
||||
cylinder(h = 20, d = stem_diameter + 0.5, center = true);
|
||||
}
|
||||
}
|
||||
|
||||
intersection() {
|
||||
import(stl_filename);
|
||||
// Large obvious cylinder
|
||||
translate([0, 0, stem_z_position]) {
|
||||
cylinder(h = 20, d = stem_diameter, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
80
Printing/Key caps/CLAUDE.md
Normal file
80
Printing/Key caps/CLAUDE.md
Normal file
@@ -0,0 +1,80 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
This is an OpenSCAD project for scaling 3D-printed mechanical keyboard keycaps while preserving the Cherry MX stem dimensions. The project contains scripts to reduce keycap body dimensions for better socket fit while maintaining the exact 4mm × 4mm stem cross dimensions required for Cherry MX switches.
|
||||
|
||||
## Key Commands
|
||||
|
||||
### Rendering STL Files
|
||||
|
||||
On Windows, OpenSCAD is typically installed at `C:\Program Files\OpenSCAD\openscad.exe`. Use Git Bash path format:
|
||||
|
||||
```bash
|
||||
# Render a SCAD file to STL
|
||||
"/c/Program Files/OpenSCAD/openscad.exe" -o "output.stl" "input.scad"
|
||||
|
||||
# Clear cache and render (recommended when changing imports)
|
||||
"/c/Program Files/OpenSCAD/openscad.exe" --clear-cache -o "output.stl" "input.scad"
|
||||
```
|
||||
|
||||
### Verify OpenSCAD Installation
|
||||
|
||||
```bash
|
||||
# Check if OpenSCAD is installed
|
||||
if exist "C:\Program Files\OpenSCAD\openscad.exe" echo Found at C:\Program Files\OpenSCAD\openscad.exe
|
||||
```
|
||||
|
||||
## Project Architecture
|
||||
|
||||
### Main Scripts
|
||||
|
||||
- **`Body5_scaled_FIXED.scad`**: The primary working script that uses a centered-import approach. This is the recommended version for scaling keycaps.
|
||||
- **`Body5_scaled.scad`**: Earlier version that manually positions the stem preservation cylinder using explicit X/Y coordinates.
|
||||
- **`Body5_test_circle.scad`**: Test script with exaggerated parameters (larger cylinder) to verify the circular stem preservation is working.
|
||||
- **`test_cylinder.scad`**: Simple cylinder rendering test for OpenSCAD verification.
|
||||
|
||||
### STL Files
|
||||
|
||||
- **`Body5.stl`**: The original keycap model that gets imported and processed by the SCAD scripts.
|
||||
- **`Body2.stl`**: Alternative keycap model.
|
||||
- **Generated STL files**: Output from rendering the SCAD scripts (e.g., `Body5_scaled_98percent.stl`).
|
||||
|
||||
### Scaling Algorithm
|
||||
|
||||
The scripts use a two-part union approach:
|
||||
|
||||
1. **Scaled Body with Cutout**: The entire keycap is scaled down by `body_scale_xy`, then a cylinder is subtracted where the stem should be
|
||||
2. **Unscaled Stem Region**: A cylinder intersection preserves the original stem region at 100% scale
|
||||
3. **Union**: Both parts are merged, creating a keycap with scaled body but original stem dimensions
|
||||
|
||||
The `_FIXED` version centers the model at the origin before operations, making cylinder placement simpler. The non-FIXED version requires manual positioning of the preservation cylinder using `stem_x` and `stem_y` coordinates.
|
||||
|
||||
### Critical Parameters
|
||||
|
||||
- **`body_scale_xy`**: X/Y scaling factor (typically 0.97-0.99 for 1-3% reduction)
|
||||
- **`body_scale_z`**: Z scaling factor (keep at 1.00 to maintain keycap height)
|
||||
- **`stem_diameter`**: Diameter of circular preservation region (default: 5.5mm)
|
||||
- **`stem_height`**: Height of stem region (default: 8.0mm)
|
||||
- **`$fn`**: OpenSCAD circle resolution (64-128, higher = smoother but slower)
|
||||
|
||||
### Centering Approach (FIXED version)
|
||||
|
||||
The `centered_import()` module translates the imported STL by `[-209, -223.5, -4.9]` to center it at the origin. These values were determined by analyzing the original STL's bounding box. This allows stem operations to use simple `cylinder()` calls at the origin rather than calculating offsets.
|
||||
|
||||
## Development Workflow
|
||||
|
||||
1. Modify SCAD script parameters (typically just `body_scale_xy`)
|
||||
2. Render to STL using OpenSCAD command line or GUI (F5 preview, F6 full render in GUI)
|
||||
3. Import STL into slicer and print test keycap
|
||||
4. Measure fit and iterate on scaling factor
|
||||
5. Typical iteration: start at 0.98, adjust by 0.01 increments based on fit testing
|
||||
|
||||
## Important Notes
|
||||
|
||||
- The Cherry MX stem cross is exactly 4mm × 4mm by specification and must not be scaled
|
||||
- The circular preservation region accommodates off-brand switches that may have slightly different tolerances
|
||||
- All SCAD scripts expect `Body5.stl` (or specified STL file) to be in the same directory
|
||||
- Rendering is computationally intensive due to importing the STL twice (once for scaling, once for stem preservation)
|
||||
109
Printing/Key caps/README_scaling.md
Normal file
109
Printing/Key caps/README_scaling.md
Normal file
@@ -0,0 +1,109 @@
|
||||
# Keycap Scaling Guide
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Open the script**: Open `Body5_scaled.scad` in OpenSCAD
|
||||
2. **Adjust scaling**: Edit the `body_scale_xy` parameter at the top (default: 0.98 = 98%)
|
||||
3. **Preview**: Press `F5` to see a quick preview
|
||||
4. **Render**: Press `F6` to fully render (required before export)
|
||||
5. **Export**: Go to `File > Export > Export as STL`
|
||||
6. **Test print**: Print and check the fit
|
||||
7. **Iterate**: Adjust the scale parameter and repeat if needed
|
||||
|
||||
## Key Parameters
|
||||
|
||||
### `body_scale_xy`
|
||||
- **Default**: `0.98` (98% of original size)
|
||||
- **Purpose**: Scales the X and Y dimensions of the keycap body
|
||||
- **Recommendations**:
|
||||
- Start with `0.98` for a 2% reduction
|
||||
- If too tight: try `0.97` (3% reduction)
|
||||
- If too loose: try `0.99` (1% reduction)
|
||||
- Fine-tune: use `0.975`, `0.985`, etc.
|
||||
|
||||
### `body_scale_z`
|
||||
- **Default**: `1.00` (no scaling)
|
||||
- **Purpose**: Scales the Z (height) dimension
|
||||
- **Recommendation**: Keep at `1.00` to maintain keycap height
|
||||
|
||||
### Stem Parameters (Advanced)
|
||||
Only adjust these if the stem preservation isn't working correctly:
|
||||
|
||||
- `stem_diameter`: Diameter of the circular preservation region (default: 5.5mm)
|
||||
- `stem_height`: Height of the stem (default: 4.0mm)
|
||||
- `stem_z_position`: Vertical position offset (default: -2.0mm)
|
||||
- `$fn`: Circle smoothness (default: 64, range: 32-128)
|
||||
|
||||
## How It Works
|
||||
|
||||
The script uses a two-part approach:
|
||||
|
||||
1. **Scaled Body**: The entire keycap is scaled down by your chosen percentage, BUT a circular region around the stem is cut out
|
||||
2. **Original Stem**: The circular stem region is preserved at 100% scale (keeping the 4mm × 4mm Cherry MX cross dimensions)
|
||||
3. **Combined**: Both parts are merged together
|
||||
|
||||
This ensures:
|
||||
- ✅ The outer keycap body fits better in sockets (scaled down)
|
||||
- ✅ The Cherry MX stem remains exactly 4mm × 4mm (unscaled)
|
||||
- ✅ The circular region around the stem is preserved (for off-brand switches)
|
||||
- ✅ The stem stays centered and properly positioned
|
||||
|
||||
## Workflow for Iterative Testing
|
||||
|
||||
1. Export STL with `body_scale_xy = 0.98`
|
||||
2. Slice and print the keycap
|
||||
3. Test fit on your keyboard
|
||||
4. **If too tight**: Decrease scale (try 0.97)
|
||||
5. **If too loose**: Increase scale (try 0.99)
|
||||
6. **If just right**: You're done!
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### The stem looks wrong or is scaled
|
||||
- The circular stem region might not be positioned correctly
|
||||
- Measure your stem in the original STL
|
||||
- Adjust `stem_z_position`, `stem_diameter`, or `stem_height`
|
||||
- If the circle is too jagged, increase `$fn` to 128
|
||||
|
||||
### The keycap won't render
|
||||
- Make sure `Body5.stl` is in the same folder as the `.scad` file
|
||||
- Check for errors in the OpenSCAD console (bottom of window)
|
||||
|
||||
### Rendering is slow
|
||||
- This is normal! The script imports the STL twice
|
||||
- `F5` preview is fast but lower quality
|
||||
- `F6` render is slow but required for STL export
|
||||
- Consider reducing the preview quality in OpenSCAD preferences
|
||||
|
||||
### The seam between body and stem is visible
|
||||
- This is usually not noticeable in the printed part
|
||||
- If needed, increase `stem_diameter` by 0.5mm increments (try 6.0mm or 6.5mm)
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
Key caps/
|
||||
├── Body5.stl # Original keycap STL
|
||||
├── Body5_scaled.scad # OpenSCAD scaling script
|
||||
└── README_scaling.md # This guide
|
||||
```
|
||||
|
||||
## Export Settings
|
||||
|
||||
When exporting STL from OpenSCAD:
|
||||
- File format: STL (binary is smaller, ASCII is more compatible)
|
||||
- Units: millimeters (mm)
|
||||
|
||||
## Next Steps
|
||||
|
||||
After exporting your scaled STL:
|
||||
1. Import into your slicer (Cura, PrusaSlicer, etc.)
|
||||
2. Use typical keycap print settings:
|
||||
- Layer height: 0.1-0.2mm
|
||||
- Infill: 15-20%
|
||||
- Supports: Probably not needed for most keycaps
|
||||
3. Print and test!
|
||||
|
||||
---
|
||||
|
||||
**Note**: The Cherry MX stem dimensions (4mm × 4mm) are standardized. The script is designed to preserve these exactly, so you should only need to adjust the `body_scale_xy` parameter for tolerance testing.
|
||||
34
Printing/Key caps/generate_all_numbered_keycaps.bat
Normal file
34
Printing/Key caps/generate_all_numbered_keycaps.bat
Normal file
@@ -0,0 +1,34 @@
|
||||
@echo off
|
||||
REM =====================================================
|
||||
REM Batch Script to Generate All 20 Numbered Keycaps
|
||||
REM =====================================================
|
||||
REM This script uses OpenSCAD command line to generate
|
||||
REM all 20 numbered keycap STL files automatically
|
||||
REM =====================================================
|
||||
|
||||
echo Starting generation of 20 numbered keycap STL files...
|
||||
echo.
|
||||
|
||||
set OPENSCAD="C:\Program Files\OpenSCAD\openscad.exe"
|
||||
set SCRIPT=generate_numbered_keycaps.scad
|
||||
|
||||
REM Loop through numbers 1-20
|
||||
for /L %%i in (1,1,20) do (
|
||||
echo Generating Body5_num%%i.stl...
|
||||
%OPENSCAD% -D number_to_generate=%%i -o Body5_num%%i.stl %SCRIPT%
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Failed to generate Body5_num%%i.stl
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo Completed Body5_num%%i.stl
|
||||
echo.
|
||||
)
|
||||
|
||||
echo.
|
||||
echo =====================================================
|
||||
echo All 20 numbered keycap STL files generated successfully!
|
||||
echo Files created: Body5_num1.stl through Body5_num20.stl
|
||||
echo =====================================================
|
||||
echo.
|
||||
pause
|
||||
102
Printing/Key caps/generate_numbered_keycaps.scad
Normal file
102
Printing/Key caps/generate_numbered_keycaps.scad
Normal file
@@ -0,0 +1,102 @@
|
||||
// =====================================================
|
||||
// Numbered Keycap Generator - Multi-Color Printing
|
||||
// =====================================================
|
||||
// This script generates 20 numbered keycap STL files
|
||||
// with recessed numbers for multi-material printing
|
||||
//
|
||||
// Numbers are 14mm tall, recessed 0.6mm deep
|
||||
// Positioned on triangular top face, centered on apex-to-midpoint line
|
||||
// Apex oriented as "up" (aligned with Cherry MX cross arm)
|
||||
// =====================================================
|
||||
|
||||
// ----- ADJUSTABLE PARAMETERS -----
|
||||
|
||||
number_to_generate = 1; // Change this value (1-20) to generate different numbers
|
||||
|
||||
number_height = 14; // Height of numbers in mm
|
||||
number_depth = 0.6; // Recess depth for color saturation
|
||||
text_font = "Liberation Sans:style=Bold"; // Font (use bold for visibility)
|
||||
text_thickness = number_depth; // Same as recess depth
|
||||
|
||||
// Triangular face positioning
|
||||
// The top face is opposite the stem pocket
|
||||
// One apex aligns with a Cherry MX cross arm
|
||||
face_z_position = 8.0; // Approximate Z height of top triangular face
|
||||
face_rotation = 0; // Rotation to align apex with cross arm
|
||||
text_y_offset = 0; // Offset along apex-to-midpoint centerline
|
||||
|
||||
$fn = 128; // Circle smoothness
|
||||
|
||||
base_stl_filename = "Body5(1)_scaled_98percent.stl";
|
||||
|
||||
// =====================================================
|
||||
// CENTERED IMPORT MODULE
|
||||
// =====================================================
|
||||
|
||||
module centered_base() {
|
||||
// Import the scaled keycap base
|
||||
// Already centered from the previous scaling script
|
||||
import(base_stl_filename);
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
// NUMBERED TEXT MODULE
|
||||
// =====================================================
|
||||
|
||||
module recessed_number(num) {
|
||||
// Create text for the number
|
||||
rotate([0, 0, face_rotation]) {
|
||||
translate([0, text_y_offset, face_z_position]) {
|
||||
rotate([0, 0, 0]) { // Text faces up
|
||||
linear_extrude(height = text_thickness + 1) { // +1 to ensure clean cut
|
||||
text(
|
||||
str(num),
|
||||
size = number_height,
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
font = text_font
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
// MAIN MODEL
|
||||
// =====================================================
|
||||
|
||||
difference() {
|
||||
// The base keycap
|
||||
centered_base();
|
||||
|
||||
// Subtract the recessed number
|
||||
recessed_number(number_to_generate);
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
// USAGE INSTRUCTIONS
|
||||
// =====================================================
|
||||
//
|
||||
// MANUAL GENERATION (one at a time):
|
||||
// 1. Change number_to_generate value (1-20)
|
||||
// 2. Render with F6
|
||||
// 3. Export as STL with desired filename
|
||||
//
|
||||
// COMMAND LINE GENERATION (all 20 files):
|
||||
// Use the companion batch script or run:
|
||||
// openscad -D number_to_generate=N -o Body5_numN.stl generate_numbered_keycaps.scad
|
||||
//
|
||||
// ADJUSTING POSITION:
|
||||
// - face_z_position: Move numbers up/down on the keycap
|
||||
// - face_rotation: Rotate around Z axis to align with cross arm
|
||||
// - text_y_offset: Move along the apex-to-midpoint centerline
|
||||
//
|
||||
// MULTI-MATERIAL PRINTING:
|
||||
// 1. Slice the numbered STL normally
|
||||
// 2. At layer with recess (approx 0.6mm from top), insert material change
|
||||
// 3. Printer will pause, swap filament for number color
|
||||
// 4. Resume printing - number will be filled with new color
|
||||
// 5. At end of recess depth, change back to original material
|
||||
//
|
||||
// =====================================================
|
||||
24
Printing/Key caps/index.html
Normal file
24
Printing/Key caps/index.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Directory listing for /Printing/Key caps/</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Directory listing for /Printing/Key caps/</h1>
|
||||
<hr>
|
||||
<ul>
|
||||
<li><a href=".claude/">.claude/</a></li>
|
||||
<li><a href="Body5%281%29_scaled.scad">Body5(1)_scaled.scad</a></li>
|
||||
<li><a href="Body5_scaled.scad">Body5_scaled.scad</a></li>
|
||||
<li><a href="Body5_scaled_FIXED.scad">Body5_scaled_FIXED.scad</a></li>
|
||||
<li><a href="Body5_test_circle.scad">Body5_test_circle.scad</a></li>
|
||||
<li><a href="CLAUDE.md">CLAUDE.md</a></li>
|
||||
<li><a href="generate_all_numbered_keycaps.bat">generate_all_numbered_keycaps.bat</a></li>
|
||||
<li><a href="generate_numbered_keycaps.scad">generate_numbered_keycaps.scad</a></li>
|
||||
<li><a href="README_scaling.md">README_scaling.md</a></li>
|
||||
<li><a href="test_cylinder.scad">test_cylinder.scad</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
3
Printing/Key caps/test_cylinder.scad
Normal file
3
Printing/Key caps/test_cylinder.scad
Normal file
@@ -0,0 +1,3 @@
|
||||
// Simple cylinder test
|
||||
$fn = 128;
|
||||
cylinder(h = 10, d = 5.0, center = true);
|
||||
Reference in New Issue
Block a user