bare/gpt-6-astra / tier-2-offset-handle-mug
success tier 2
bare (gpt 6 astra)
render
$fn = 180;
// 本体寸法(mm)
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;
// 取手寸法(mm)
handle_opening_height = 30;
handle_opening_width = 25;
handle_depth = 10;
handle_tip_thickness = 4;
outer_radius = outer_diameter / 2;
inner_radius = inner_diameter / 2;
// 本体外周へ 2 mm 食い込ませ、面接触ではなく体積で接続する。
handle_base_x = outer_radius - 2;
handle_opening_x = outer_radius + 1;
handle_center_z = mug_height / 2;
opening_offset = handle_opening_x - handle_base_x;
handle_outer_radius =
opening_offset + handle_opening_width + handle_tip_thickness;
epsilon = 0.1;
// 直線辺が x=0、半円が +X 側にある D 字。
module half_disk(radius) {
intersection() {
circle(r = radius);
translate([0, -radius])
square([radius, 2 * radius]);
}
}
module mug_body() {
difference() {
cylinder(h = mug_height, r = outer_radius);
translate([0, 0, bottom_thickness])
cylinder(
h = mug_height - bottom_thickness + epsilon,
r = inner_radius
);
}
}
module handle_profile() {
difference() {
// 外側は真円の半円、本体側は直線。
half_disk(handle_outer_radius);
// 内側の開口:X 方向 25 mm、高さ方向 30 mm。
translate([opening_offset, 0])
scale([
handle_opening_width,
handle_opening_height / 2
])
half_disk(1);
}
}
module handle() {
// 2D の Y を高さ Z に写し、厚みを Y 方向へ付ける。
// 取手全体を本体の +X 側だけに配置する。
translate([handle_base_x, 0, handle_center_z])
rotate([90, 0, 0])
linear_extrude(
height = handle_depth,
center = true,
convexity = 10
)
handle_profile();
}
render(convexity = 10)
union() {
mug_body();
handle();
} パラメータ (9) —
スライダを動かすと openscad-wasm で再レンダリング
prompt
OpenSCAD で、向きが指定されたマグカップを作ってください。 本体: - 外径 80mm、内径 70mm(肉厚 5mm)、高さ 90mm の円筒形マグ - 底面の厚みは 6mm - 内側は飲み物を入れられるよう中空 取手(handle): - マグの **+X 軸方向の側面のみ** に付ける(他の方向には付けない) - 取手は D 字形状(外側が半円、本体側が直線)で、本体外周にしっかり接続する - 取手の内側の空間は高さ 30mm × 幅 25mm(指 3 本ぐらい入る) - 取手はマグの高さ方向の中央付近に付ける - 本体と取手は確実に union され、マニフォールド(隙間や宙吊りなし)を保つ 完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。