vibe-openscad

tier-2-offset-handle-mug / gpt-6.1-sol

6 run / 累計 402.4s / 累計 $0.1616

openai gpt 6.1 sol bare

bare (provider default effort)

run detail →
render
bare render of tier-2-offset-handle-mug
loading STL…
success 35.5s · 273/1192t · $0.0125
SCAD (64 lines)
$fn = 160;

// 単位: mm
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;

handle_opening_height = 30;
handle_opening_width = 25;
handle_depth = 10;

handle_outer_radius = 32;
handle_back_x = outer_diameter / 2 - 2;  // 本体へ2mm食い込ませる
handle_inner_offset = 4;
handle_center_z = mug_height / 2;

epsilon = 0.1;

// +X側を向く半円。直線部分は x=0。
module half_circle_2d(radius) {
    intersection() {
        circle(r = radius);
        translate([0, -radius])
            square([radius, 2 * radius]);
    }
}

// 外側は半円、内側の開口は幅25mm・高さ30mmのD字形。
module handle_profile_2d() {
    difference() {
        half_circle_2d(handle_outer_radius);

        translate([handle_inner_offset, 0])
            scale([
                handle_opening_width,
                handle_opening_height / 2
            ])
                half_circle_2d(1);
    }
}

// XZ平面に配置し、Y方向に厚みを付ける。
module handle() {
    translate([handle_back_x, 0, handle_center_z])
        rotate([90, 0, 0])
            linear_extrude(height = handle_depth, center = true)
                handle_profile_2d();
}

render(convexity = 10)
difference() {
    union() {
        cylinder(d = outer_diameter, h = mug_height);
        handle();
    }

    // 上面まで貫通する空洞。底は6mm残す。
    translate([0, 0, bottom_thickness])
        cylinder(
            d = inner_diameter,
            h = mug_height - bottom_thickness + epsilon
        );
}
パラメータ (10) —
スライダを動かすと openscad-wasm で再レンダリング

prompt

OpenSCAD で、向きが指定されたマグカップを作ってください。

本体:
- 外径 80mm、内径 70mm(肉厚 5mm)、高さ 90mm の円筒形マグ
- 底面の厚みは 6mm
- 内側は飲み物を入れられるよう中空

取手(handle):
- マグの **+X 軸方向の側面のみ** に付ける(他の方向には付けない)
- 取手は D 字形状(外側が半円、本体側が直線)で、本体外周にしっかり接続する
- 取手の内側の空間は高さ 30mm × 幅 25mm(指 3 本ぐらい入る)
- 取手はマグの高さ方向の中央付近に付ける
- 本体と取手は確実に union され、マニフォールド(隙間や宙吊りなし)を保つ

完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。

variant: effort

low success →
low
22.4s · 273/810t · $0.0086
SCAD (74 lines)
$fn = 160;

outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;

handle_opening_width = 25;
handle_opening_height = 30;
handle_wall = 8;
handle_depth = 10;

handle_center_z = mug_height / 2;
handle_body_edge_x = outer_diameter / 2 - 2;
handle_opening_edge_x = handle_body_edge_x + handle_wall;

// +X 側へ張り出す半楕円。直線側は x = 0。
module half_ellipse(rx, rz) {
    intersection() {
        scale([rx, rz])
            circle(r = 1);

        translate([0, -rz - 1])
            square([rx + 1, 2 * rz + 2]);
    }
}

module handle_profile() {
    difference() {
        union() {
            translate([handle_opening_edge_x, 0])
                half_ellipse(
                    handle_opening_width + handle_wall,
                    handle_opening_height / 2 + handle_wall
                );

            translate([
                handle_body_edge_x,
                -handle_opening_height / 2 - handle_wall
            ])
                square([
                    handle_wall,
                    handle_opening_height + 2 * handle_wall
                ]);
        }

        translate([handle_opening_edge_x, 0])
            half_ellipse(
                handle_opening_width,
                handle_opening_height / 2
            );
    }
}

module handle() {
    translate([0, 0, handle_center_z])
        rotate([90, 0, 0])
            linear_extrude(height = handle_depth, center = true)
                handle_profile();
}

render()
difference() {
    union() {
        cylinder(d = outer_diameter, h = mug_height);
        handle();
    }

    translate([0, 0, bottom_thickness])
        cylinder(
            d = inner_diameter,
            h = mug_height - bottom_thickness + 1
        );
}
medium (default) success →
medium
35.5s · 273/1192t · $0.0125
SCAD (64 lines)
$fn = 160;

// 単位: mm
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;

handle_opening_height = 30;
handle_opening_width = 25;
handle_depth = 10;

handle_outer_radius = 32;
handle_back_x = outer_diameter / 2 - 2;  // 本体へ2mm食い込ませる
handle_inner_offset = 4;
handle_center_z = mug_height / 2;

epsilon = 0.1;

// +X側を向く半円。直線部分は x=0。
module half_circle_2d(radius) {
    intersection() {
        circle(r = radius);
        translate([0, -radius])
            square([radius, 2 * radius]);
    }
}

// 外側は半円、内側の開口は幅25mm・高さ30mmのD字形。
module handle_profile_2d() {
    difference() {
        half_circle_2d(handle_outer_radius);

        translate([handle_inner_offset, 0])
            scale([
                handle_opening_width,
                handle_opening_height / 2
            ])
                half_circle_2d(1);
    }
}

// XZ平面に配置し、Y方向に厚みを付ける。
module handle() {
    translate([handle_back_x, 0, handle_center_z])
        rotate([90, 0, 0])
            linear_extrude(height = handle_depth, center = true)
                handle_profile_2d();
}

render(convexity = 10)
difference() {
    union() {
        cylinder(d = outer_diameter, h = mug_height);
        handle();
    }

    // 上面まで貫通する空洞。底は6mm残す。
    translate([0, 0, bottom_thickness])
        cylinder(
            d = inner_diameter,
            h = mug_height - bottom_thickness + epsilon
        );
}
high success →
high
51.0s · 273/2092t · $0.0215
SCAD (86 lines)
$fn = 180;

outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;

handle_inner_width = 25;
handle_inner_height = 30;
handle_depth = 10;
handle_outer_thickness = 6;
handle_overlap = 3;

eps = 0.05;

body_radius = outer_diameter / 2;
handle_center_z = mug_height / 2;
handle_root_x = body_radius - handle_overlap;

// 外側を半円にし、開口部の幅25mm・高さ30mmを確保する。
handle_outer_radius =
    handle_inner_width + handle_outer_thickness + handle_overlap;

module mug_body() {
    difference() {
        cylinder(d = outer_diameter, h = mug_height);

        translate([0, 0, bottom_thickness])
            cylinder(
                d = inner_diameter,
                h = mug_height - bottom_thickness + eps
            );
    }
}

module handle_profile() {
    difference() {
        // 本体側が直線、+X側が半円の外形。
        intersection() {
            translate([handle_root_x, handle_center_z])
                circle(r = handle_outer_radius);

            translate([
                handle_root_x,
                handle_center_z - handle_outer_radius - eps
            ])
                square([
                    handle_outer_radius + eps,
                    2 * handle_outer_radius + 2 * eps
                ]);
        }

        // 内側のD字開口:幅25mm、高さ30mm。
        intersection() {
            translate([body_radius, handle_center_z])
                scale([
                    handle_inner_width,
                    handle_inner_height / 2
                ])
                    circle(r = 1);

            translate([
                body_radius,
                handle_center_z - handle_inner_height / 2 - eps
            ])
                square([
                    handle_inner_width + eps,
                    handle_inner_height + 2 * eps
                ]);
        }
    }
}

module mug_handle() {
    // 2DのXY平面をXZ平面へ回し、Y方向に厚みを付ける。
    // 直線側を本体外周に3mm埋め込み、確実に接続する。
    rotate([90, 0, 0])
        linear_extrude(height = handle_depth, center = true, convexity = 10)
            handle_profile();
}

render(convexity = 10)
    union() {
        mug_body();
        mug_handle();
    }
max success →
max
163.6s · 273/6641t · $0.0670
SCAD (76 lines)
$fn = 160;

outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;

handle_open_width = 25;
handle_open_height = 30;
handle_wall = 5;
handle_depth = 10;
handle_overlap = 3;

handle_root_x = outer_diameter / 2 - handle_overlap;
handle_center_z = mug_height / 2;

epsilon = 0.1;

// 本体側が直線、外側の円弧が半円の D 字断面。
module d_profile(width, height) {
    radius = height / 2;
    straight_length = width - radius;

    intersection() {
        union() {
            translate([0, -radius])
                square([straight_length, height]);

            translate([straight_length, 0])
                circle(r = radius);
        }

        translate([0, -radius])
            square([width, height]);
    }
}

module mug_body() {
    difference() {
        cylinder(d = outer_diameter, h = mug_height);

        translate([0, 0, bottom_thickness])
            cylinder(
                d = inner_diameter,
                h = mug_height - bottom_thickness + epsilon
            );
    }
}

module mug_handle() {
    // XZ 平面に配置し、+X 側の外壁へ 3mm 食い込ませる。
    translate([handle_root_x, 0, handle_center_z])
        rotate([90, 0, 0])
            linear_extrude(
                height = handle_depth,
                center = true,
                convexity = 10
            )
                difference() {
                    d_profile(
                        handle_open_width + 2 * handle_wall,
                        handle_open_height + 2 * handle_wall
                    );

                    translate([handle_wall, 0])
                        d_profile(
                            handle_open_width,
                            handle_open_height
                        );
                }
}

union() {
    mug_body();
    mug_handle();
}
xhigh success →
xhigh
94.4s · 273/3903t · $0.0396
SCAD (81 lines)
$fn = 160;

// 本体寸法(mm)
outer_diameter = 80;
inner_diameter = 70;
cup_height = 90;
bottom_thickness = 6;

// 取手寸法(mm)
handle_inner_width = 25;
handle_inner_height = 30;
handle_depth = 8;
handle_web_thickness = 6;
handle_outer_thickness = 6;

attachment_overlap = 2;
epsilon = 0.1;

handle_base_x = outer_diameter / 2 - attachment_overlap;
handle_center_z = cup_height / 2;

// 外側を真の半円にし、指定寸法の開口と十分な肉厚を確保
handle_outer_radius =
    handle_web_thickness
    + handle_inner_width
    + handle_outer_thickness;

// +X 側の半円。直線側は x = 0。
module right_half_disk(radius) {
    intersection() {
        circle(r = radius);
        translate([0, -radius])
            square([radius, 2 * radius]);
    }
}

module mug_body() {
    difference() {
        cylinder(d = outer_diameter, h = cup_height);

        // 上面まで貫通させ、底面を6mm残す
        translate([0, 0, bottom_thickness])
            cylinder(
                d = inner_diameter,
                h = cup_height - bottom_thickness + epsilon
            );
    }
}

module handle_profile() {
    difference() {
        right_half_disk(handle_outer_radius);

        // 開口の最大寸法:幅25mm、高さ30mm
        translate([handle_web_thickness, 0])
            scale([
                handle_inner_width,
                handle_inner_height / 2
            ])
                right_half_disk(1);
    }
}

module mug_handle() {
    // 2DのX・Yを、それぞれ実空間のX・Zへ対応させる
    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();
        mug_handle();
    }