vibe-openscad

pdf-page/gemini-3.7-flash / tier-4-gp2y0a21yk

success tier 4

pdf-page (gemini 3.7 flash)

render
bare render of tier-4-gp2y0a21yk
loading STL…
success 10.2s · 1528/1386t · $0.0063
SCAD (106 lines)
// Sharp Distance Measuring Sensor GP2Y0A21YK0F
// Coordinates: Origin at body center, +Z = Top (Lens direction), +Y = Front

$fn = 40;

// Dimensions (mm)
body_w = 29.5;      // Body width (X)
body_d = 13.0;      // Body depth (Y)
body_h = 11.5;      // Body height without lens (Z)
flange_t = 1.5;     // Mounting flange thickness (Z)
hole_pitch = 37.0;  // Mounting hole pitch (X)
hole_d = 3.2;       // Mounting hole diameter
flange_r = 3.75;    // Flange outer radius

lens_h = 2.0;       // Lens protrusion height (Z)
emitter_w = 7.5;    // Emitter lens width (X)
detector_w = 16.3;  // Detector lens width (X)
lens_d = 7.5;       // Lens depth (Y)
lens_center_pitch = 20.0; // Distance between lens centers

conn_w = 10.1;      // Connector housing width (X)
conn_d = 6.3;       // Connector housing depth (Y)
conn_h = 7.0;       // Connector protrusion below body

module sensor_gp2y0a21yk0f() {
    color([0.2, 0.2, 0.2]) {
        difference() {
            union() {
                // Main Lens Case Body
                translate([-body_w/2, -body_d/2, -body_h/2])
                    cube([body_w, body_d, body_h]);

                // Mounting Flanges (Left & Right ears)
                hull() {
                    translate([-body_w/2, -body_d/2, -body_h/2])
                        cube([0.1, body_d, flange_t]);
                    translate([-hole_pitch/2, 0, -body_h/2])
                        cylinder(r=flange_r, h=flange_t);
                }
                hull() {
                    translate([body_w/2 - 0.1, -body_d/2, -body_h/2])
                        cube([0.1, body_d, flange_t]);
                    translate([hole_pitch/2, 0, -body_h/2])
                        cylinder(r=flange_r, h=flange_t);
                }

                // Connector Housing on bottom-rear
                translate([-conn_w/2, -body_d/2, -body_h/2 - conn_h + 3.0])
                    cube([conn_w, conn_d, conn_h]);
            }

            // Mounting Holes
            translate([-hole_pitch/2, 0, -body_h/2 - 1])
                cylinder(d=hole_d, h=flange_t + 2);
            translate([hole_pitch/2, 0, -body_h/2 - 1])
                cylinder(d=hole_d, h=flange_t + 2);

            // Connector opening slot
            translate([-(conn_w - 2)/2, -body_d/2 - 0.1, -body_h/2 - conn_h + 2.0])
                cube([conn_w - 2, conn_d - 1, conn_h]);
        }
    }

    // Lenses (Acrylic visible-light cut-off resin)
    color([0.1, 0.1, 0.15, 0.9]) {
        // Emitter Lens (Round / Dome)
        translate([-lens_center_pitch/2, 0, body_h/2]) {
            hull() {
                cylinder(d=emitter_w, h=lens_h - 0.5);
                translate([0, 0, lens_h - 0.5])
                    scale([1, 1, 0.5])
                        sphere(d=emitter_w - 1);
            }
        }

        // Detector Lens (Oblong / Dual-curved)
        translate([lens_center_pitch/2, 0, body_h/2]) {
            hull() {
                translate([-(detector_w - lens_d)/2, 0, 0])
                    cylinder(d=lens_d, h=lens_h - 0.5);
                translate([(detector_w - lens_d)/2, 0, 0])
                    cylinder(d=lens_d, h=lens_h - 0.5);

                translate([-(detector_w - lens_d)/2, 0, lens_h - 0.5])
                    scale([1, 1, 0.5])
                        sphere(d=lens_d - 1);
                translate([(detector_w - lens_d)/2, 0, lens_h - 0.5])
                    scale([1, 1, 0.5])
                        sphere(d=lens_d - 1);
            }
        }
    }

    // 3-Pin Cable Wires (JST PH style: Vo, GND, Vcc)
    wire_colors = ["red", "black", "yellow"];
    for (i = [0:2]) {
        color(wire_colors[i]) {
            translate([-2.0 + i * 2.0, -body_d/2 + 2.0, -body_h/2 - conn_h + 2.5]) {
                rotate([90, 0, 0])
                    cylinder(d=1.0, h=12.0);
            }
        }
    }
}

sensor_gp2y0a21yk0f();
パラメータ (15) —
スライダを動かすと openscad-wasm で再レンダリング

meta

runIdpdf-page_gemini-3.7-flash-d1a790051589-2026-09-05T10-26-07-479Z
matrixIdpdf-page/gemini-3.7-flash
signatured1a7900515890181…
providergoogle
modelgemini-3.7-flash
harnesspdf-page
statussuccess
duration10.22s (wallclock: load + prompt eval + generation + network)
tokens1528 in / 1386 out
wallclock tok/s135.6 tok/s (end-to-end)
cost$0.0063
createdAt2026-09-05T10:26:07.479Z
gitCommitc3c9301f89b1
openscadOpenSCAD version 2026.04.27

prompt

添付画像は Sharp 製測距センサ GP2Y0A21YK0F のデータシートのページです。
OpenSCAD でモデリングしてください。

座標系: 単位 mm、本体の中心を原点とし、取付面(PWB / コネクタ側)を -Z に向ける。

完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。