Here's an OpenSCAD script for a parametric rocket model:
// Parametric Rocket Model
// Adjust these parameters to customize your rocket
// Main body parameters
body_height = 100;
body_diameter = 20;
wall_thickness = 2;
// Nose cone parameters
nose_height = 30;
nose_tip_diameter = 2;
// Fin parameters
fin_count = 4;
fin_height = 25;
fin_width = 15;
fin_thickness = 3;
fin_sweep_angle = 15; // degrees
// Engine nozzle parameters
nozzle_height = 15;
nozzle_top_diameter = 12;
nozzle_bottom_diameter = 8;
// Recovery bay parameters
recovery_bay_height = 20;
recovery_bay_diameter = body_diameter - 2;
module nose_cone() {
translate([0, 0, body_height]) {
cylinder(h = nose_height,
d1 = body_diameter,
d2 = nose_tip_diameter,
$fn = 50);
}
}
module body_tube() {
difference() {
cylinder(h = body_height, d = body_diameter, $fn = 50);
translate([0, 0, -0.1]) {
cylinder(h = body_height + 0.2,
d = body_diameter - wall_thickness * 2,
$fn = 50);
}
}
}
module recovery_bay() {
translate([0, 0, body_height - recovery_bay_height]) {
difference() {
cylinder(h = recovery_bay_height,
d = recovery_bay_diameter,
$fn = 50);
translate([0, 0, -0.1]) {
cylinder(h = recovery_bay_height + 0.2,
d = recovery_bay_diameter - wall_thickness,
$fn = 50);
}
}
}
}
module fin() {
hull() {
// Root chord
translate([0, body_diameter/2, 0]) {
cube([fin_thickness, 0.1, fin_height]);
}
// Tip chord
translate([tan(fin_sweep_angle) * fin_width,
body_diameter/2 + fin_width,
fin_height * 0.3]) {
cube([fin_thickness, 0.1, fin_height * 0.4]);
}
}
}
module fins() {
for (i = [0 : fin_count - 1]) {
rotate([0, 0, i * 360 / fin_count]) {
fin();
}
}
}
module engine_nozzle() {
translate([0, 0, -nozzle_height]) {
cylinder(h = nozzle_height,
d1 = nozzle_bottom_diameter,
d2 = nozzle_top_diameter,
$fn = 50);
}
}
module engine_mount() {
translate([0, 0, -5]) {
difference() {
cylinder(h = 10, d = body_diameter, $fn = 50);
translate([0, 0, -0.1]) {
cylinder(h = 10.2, d = nozzle_top_diameter + 2, $fn = 50);
}
}
}
}
// Assembly
module rocket() {
color("lightblue") body_tube();
color("red") nose_cone();
color("orange") recovery_bay();
color("yellow") fins();
color("gray") engine_nozzle();
color("darkgray") engine_mount();
}
// Render the complete rocket
rocket();
// Optional: Add launch lugs
module launch_lug() {
difference() {
cylinder(h = 20, d = 6, $fn = 20);
translate([0, 0, -0.1]) {
cylinder(h = 20.2, d = 3, $fn = 20);
}
}
}
// Uncomment to add launch lugs
/*
translate([body_diameter/2 + 3, 0, 20]) {
rotate([0, 90, 0]) launch_lug();
}
translate([body_diameter/2 + 3, 0, 60]) {
rotate([0, 90, 0]) launch_lug();
}
*/
This script creates a detailed parametric rocket with the following features:
Main Components:
- Hollow body tube with adjustable wall thickness
- Tapered nose cone
- Engine nozzle with flared design
- Recovery bay section
- Swept fins with customizable count and geometry
Key Parameters to Customize:
body_height and body_diameter for overall size
fin_count to change number of fins (3, 4, or 6 work well)
nose_height and tip diameter for different nose cone shapes
fin_sweep_angle for aerodynamic fin design
- All dimensions are easily adjustable at the top of the script
Optional Features:
- Launch lugs (uncomment the code at the bottom)
- Color coding for different components
- Hollow construction for realistic weight distribution
You can modify any of the parameters at the top to create different rocket designs, from small model rockets to larger scale versions. The script uses proper OpenSCAD techniques like modules for reusability and hull() operations for smooth fin shapes.