vibe-openscad

tier-4-gp2y0d413k / gpt-5.4-2026-03-05

1 run / 累計 16.7s / 累計 $0.0230

openai gpt 5.4 2026-03-05 pdf-page

bare (provider default effort)

run detail →
render
bare render of tier-4-gp2y0d413k
loading STL…
success 16.7s · 2966/1067t · $0.0230
SCAD (130 lines)
$fn = 64;

// GP2Y0D413K0F simplified exterior model
// Coordinate system:
// origin = center of main body case
// +Z = up
// +Y = front (lens side)
// units = mm

// -------------------- Main dimensions from datasheet --------------------
body_w = 29.45;      // X
body_d = 7.1;        // Y
body_h = 13.5;       // Z

lenscase_w = 29.45;  // front view suggests full width face piece
lenscase_d = 2.0;    // side view
lenscase_h = 8.4;    // side view front protrusion height envelope

// Lens center reference dimensions (* in datasheet)
emit_cx_from_left = 4.5;
recv_cx_from_left = 19.7;

// Front lower reference
front_lower_step_z = 3.75;   // from bottom to lower front ledge

// Receiver window approximate dimensions read from drawing
recv_win_w = 12.4;
recv_win_h = 5.6;

// Emitter lens approximate visible diameter from drawing
emit_lens_d = 5.0;

// PCB / connector
pwb_t = 1.2;
pwb_w = 10.1;
pwb_d = 3.3;

conn_w = 10.1;
conn_d = 6.2;
conn_h = 7.0;

pin_w = 0.6;
pin_d = 0.6;
pin_h = 3.0;
pin_pitch = 2.54;

// -------------------- Derived positions --------------------
body_xmin = -body_w/2;
body_xmax =  body_w/2;
body_ymin = -body_d/2;
body_ymax =  body_d/2;
body_zmin = -body_h/2;
body_zmax =  body_h/2;

front_face_y = body_ymax;
lenscase_center_y = front_face_y + lenscase_d/2;

emit_cx = body_xmin + emit_cx_from_left;
recv_cx = body_xmin + recv_cx_from_left;

// Lens centers taken approximately at mid-height of front optical section
lens_cz = 0;

// -------------------- Modules --------------------
module main_case() {
    color([0.12,0.12,0.12])
    cube([body_w, body_d, body_h], center=true);
}

module front_lens_case() {
    color([0.18,0.18,0.18])
    translate([0, lenscase_center_y, lens_cz])
        cube([lenscase_w, lenscase_d, lenscase_h], center=true);
}

module front_windows() {
    // subtract shallow recesses to indicate the two front optical windows
    difference() {
        union() {
            // left emitter bezel block
            translate([emit_cx, front_face_y + lenscase_d/2 + 0.01, lens_cz])
                cube([7.6, lenscase_d + 0.02, 6.2], center=true);

            // right receiver bezel block
            translate([recv_cx, front_face_y + lenscase_d/2 + 0.01, lens_cz])
                cube([14.0, lenscase_d + 0.02, 6.2], center=true);
        }

        // circular emitter lens recess
        translate([emit_cx, front_face_y + lenscase_d/2, lens_cz])
            rotate([90,0,0])
                cylinder(h=lenscase_d + 0.2, d=emit_lens_d, center=true);

        // receiver rectangular window recess
        translate([recv_cx, front_face_y + lenscase_d/2, lens_cz])
            cube([recv_win_w, lenscase_d + 0.2, recv_win_h], center=true);
    }
}

module pwb() {
    color([0.82,0.72,0.45])
    translate([0, 0, body_zmin - pwb_t/2])
        cube([pwb_w, pwb_d, pwb_t], center=true);
}

module connector_body() {
    color([0.92,0.92,0.92])
    translate([0, 0, body_zmin - pwb_t - conn_h/2])
        cube([conn_w, conn_d, conn_h], center=true);
}

module connector_pins() {
    color([0.75,0.75,0.75])
    for (x = [-pin_pitch, 0, pin_pitch])
        translate([x, 0, body_zmin - pwb_t - conn_h - pin_h/2])
            cube([pin_w, pin_d, pin_h], center=true);
}

module sensor_model() {
    union() {
        main_case();
        front_lens_case();
        front_windows();
        pwb();
        connector_body();
        connector_pins();
    }
}

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

prompt

添付の Sharp 製距離センサ GP2Y0D413K0F のデータシート 2 ページ目には、
本体の外形寸法図(Outline Dimensions)が描かれています。図を読み取り、
OpenSCAD でセンサの外形をモデリングしてください。

含めるべき部位:
- 本体ケース(Carbonic ABS、概形は直方体)
- 前面に飛び出すレンズケース(2 つの窓を持つ突起)
- 発光部レンズ(円形の窓、左側)と受光部レンズ(矩形の窓、右側)
- 下部に取り付けられる PWB(プリント基板、薄板)
- 底面の 3 ピンコネクタ(JCTC 12001W90-3P-HF、簡易表現で可)

寸法:
- 図中のミリメートル数値に従ってください
- "*" 印が付いた寸法はレンズ中心位置を示す参照寸法です
- 括弧 `( )` で囲まれた値は参考寸法
- "Unspecified tolerances shall be ± 0.3 mm" に従ってよい

座標系:
- 本体の中心が原点。+Z は上方向(コネクタが下、レンズが前面 +Y)
- 単位は mm

内部の IC や回路素子はモデリング不要、外形だけで十分です。
完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。
コードのみで、追加の説明は不要です。