iter-png-3/gemini-2.5-flash / tier-2-offset-handle-mug
success tier 2
bare (gemini 2.5 flash)
render
// OpenSCAD Mug with Handle
// Global rendering quality (higher value = smoother curves)
$fn = 64;
// Mug body parameters
mug_outer_radius = 80 / 2; // 40mm
mug_inner_radius = 70 / 2; // 35mm
mug_height = 90;
mug_bottom_thickness = 6;
// Handle parameters
handle_thickness = 10; // Thickness of the handle material
handle_inner_width = 25; // Internal width of the finger hole (X direction)
handle_inner_height = 30; // Internal height of the finger hole (Z direction)
// Overlap for robust union between handle and mug body, and between handle components
// A small positive value ensures parts slightly penetrate each other,
// which helps OpenSCAD create a manifold solid and avoids Z-fighting artifacts.
handle_overlap_epsilon = 0.5; // Example: 0.5mm overlap
module mug_body() {
difference() {
// Outer cylinder of the mug
cylinder(h = mug_height, r = mug_outer_radius);
// Inner hollow part
// Lifted by mug_bottom_thickness to create the solid bottom
// Slightly increased height to avoid Z-fighting artifacts on the top surface
translate([0, 0, mug_bottom_thickness])
cylinder(h = mug_height - mug_bottom_thickness + handle_overlap_epsilon, r = mug_inner_radius);
}
}
module mug_handle() {
// Calculate dimensions for the D-shape handle
// Total height of the handle from top edge to bottom edge
handle_total_height = handle_inner_height + 2 * handle_thickness;
// Outer radius of the D-arc (half of total height)
outer_d_arc_radius = handle_total_height / 2;
// Inner radius of the D-arc (half of inner height)
inner_d_arc_radius = handle_inner_height / 2;
// Position the handle:
// Translate its "attachment point" (the X-coordinate where it meets the mug)
// to mug_outer_radius. We subtract handle_overlap_epsilon to embed it slightly.
// Its Y-center is 0 (aligned with mug's Y axis).
// Its Z-center is mug_height / 2 (aligned with mug's height center).
translate([
mug_outer_radius - handle_overlap_epsilon, // X: start slightly inside mug
0, // Y: centered
mug_height / 2 // Z: centered
]) {
// Build the handle using difference between its outer solid shape and its inner cut-out shape.
difference() {
// 1. Outer solid handle shape
union() {
// Rectangular part of the outer handle (from mug to the start of the arc)
// In its local coordinate system:
// X starts at -handle_overlap_epsilon (to embed into the mug)
// X ends at handle_thickness + handle_inner_width (where the arc begins)
cube([
handle_thickness + handle_inner_width + handle_overlap_epsilon, // X-dimension
handle_thickness, // Y-thickness
handle_total_height // Z-height
], center = [
(handle_thickness + handle_inner_width + handle_overlap_epsilon) / 2 - handle_overlap_epsilon, // X-center to align start at -overlap_epsilon
0, // Y-center
0 // Z-center
]);
// Outer arc part (semi-cylinder)
// The arc's straight edge is at X = handle_thickness + handle_inner_width.
// We translate to this point for the cylinder's local origin.
translate([
handle_thickness + handle_inner_width, // X: where the arc's straight edge is
0, // Y
0 // Z
])
rotate([90, 0, 0]) { // Rotate cylinder (default along Z) so its axis is along Y, profile in XZ.
difference() {
cylinder(r = outer_d_arc_radius, h = handle_thickness, center = true);
// Cut off the "left" half of the cylinder to form the D-shape arc.
// The cube starts outside the cylinder's negative X range to ensure a full cut.
translate([-outer_d_arc_radius - handle_overlap_epsilon * 2, 0, 0])
cube([outer_d_arc_radius * 2 + handle_overlap_epsilon * 4, handle_thickness * 1.1, outer_d_arc_radius * 2 + handle_overlap_epsilon * 4], center=true);
}
}
}
// 2. Inner cut-out shape (finger hole)
// This starts after the mug-connecting material, at X = handle_thickness.
translate([
handle_thickness, // X: Start of finger hole relative to mug's outer surface
0, // Y: centered
0 // Z: centered
]) {
union() {
// Straight part of the finger hole cut-out
cube([
handle_inner_width + handle_overlap_epsilon, // X: Inner width + slight overlap into arc for clean cut
handle_thickness * 1.1, // Y: Slightly larger than handle_thickness for clean cut
handle_inner_height // Z: Inner height
], center=[
(handle_inner_width + handle_overlap_epsilon) / 2, // X-center
0, // Y-center
0 // Z-center
]);
// Inner arc part of the finger hole cut-out
// The inner arc's straight edge is at X = handle_inner_width (relative to its own translate).
translate([
handle_inner_width, // X: where the inner arc's straight edge is
0,
0
])
rotate([90, 0, 0]) { // Same rotation as outer arc
difference() {
cylinder(r = inner_d_arc_radius, h = handle_thickness * 1.1, center = true); // Slightly larger height for clean cut
// Cut off the "left" half of the inner cylinder.
translate([-inner_d_arc_radius - handle_overlap_epsilon * 2, 0, 0])
cube([inner_d_arc_radius * 2 + handle_overlap_epsilon * 4, handle_thickness * 1.2, inner_d_arc_radius * 2 + handle_overlap_epsilon * 4], center=true);
}
}
}
}
} // End of difference for the handle
} // End of translate for the handle position
} // End of mug_handle module
// Assemble the complete mug by combining the body and the handle
union() {
mug_body();
mug_handle();
} パラメータ (6) —
スライダを動かすと openscad-wasm で再レンダリング
iteration chain
各 iteration step は独立した benchmark run です。parentRunId で前段にリンクします。
← parent
iter-png-2/gemini-2.5-flash success prompt
OpenSCAD で、向きが指定されたマグカップを作ってください。 本体: - 外径 80mm、内径 70mm(肉厚 5mm)、高さ 90mm の円筒形マグ - 底面の厚みは 6mm - 内側は飲み物を入れられるよう中空 取手(handle): - マグの **+X 軸方向の側面のみ** に付ける(他の方向には付けない) - 取手は D 字形状(外側が半円、本体側が直線)で、本体外周にしっかり接続する - 取手の内側の空間は高さ 30mm × 幅 25mm(指 3 本ぐらい入る) - 取手はマグの高さ方向の中央付近に付ける - 本体と取手は確実に union され、マニフォールド(隙間や宙吊りなし)を保つ 完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。