vibe-openscad

pdf-page/claude-fable-5 / tier-4-gp2y0a21yk

success tier 4

pdf-page (claude fable 5)

render
bare render of tier-4-gp2y0a21yk
loading STL…
success 111.1s · 3521/9027t · $0.4866
SCAD (128 lines)
// ============================================================
// Sharp GP2Y0A21YK0F  IR 測距センサ (10-80cm, アナログ出力)
// データシート p.2 "Outline Dimensions" による外形モデル
// 単位: mm / 原点: 本体ケース中心 / +Z: 上(レンズ側) / +Y: 前方
// ============================================================
$fn = 64;

// ---------------- データシート寸法 ----------------
body_l       = 29.5;            // 本体ケース長さ (X)
body_w       = 13.0;            // 本体ケース奥行 (Y)
total_h      = 13.5;            // レンズ突起込み全高 (Z)
turret_h     = 2.7;             // レンズ突起の飛び出し量
case_h       = total_h - turret_h;

hole_pitch   = 37.0;            // 取付穴ピッチ
hole_d       = 3.2;             // φ3.2 hole
tab_r        = 3.75;            // R3.75 取付タブ
tab_t        = 3.0;             // タブ厚 (Y方向, 近似)

em_turret_w  = 7.5;             // 発光側レンズ突起の幅
turret_gap   = 4.15;            // 突起間ギャップ
det_turret_w = 16.3;            // 受光側レンズ突起の幅
turret_d     = 6.3;             // 突起の奥行 (Y)
turret_setb  = 2.0;             // 前面からのセットバック

em_cx  = -body_l/2 + 4.5;       // * 発光レンズ中心 (左端から4.5)
det_cx = em_cx + 20.0;          // * レンズ中心間 20±0.1

bar_w     = 14.75;              // 連結バー幅
bar_x0    = -body_l/2 + 3.75;   // バー左端 (ケース左端から3.75)
overall_h = 18.9;               // ( ) バー込み参考全高
bar_h     = overall_h - total_h;// = 5.4
bar_d     = 6.0;                // バー奥行 (近似)
pwb_t     = 1.2;                // PWB 厚
conn_w    = 10.1;               // コネクタ部幅
conn_d    = 3.3;                // ( ) コネクタ部奥行

cable_d   = 3.2;                // ケーブル簡易表現
cable_l   = 18;

// -------- 派生 Z レベル --------
z_top      =  total_h/2;        //  +6.75 (レンズ頂面)
z_case_top =  z_top - turret_h; //  +4.05 (ケース上面)
z_bot      = -total_h/2;        //  -6.75 (ケース底面)
z_bar_bot  =  z_bot - bar_h;    // -12.15 (バー底面)

turret_yc  = body_w/2 - turret_setb - turret_d/2;  // 突起のY中心
conn_cx    = bar_x0 + bar_w/2;                     // ケーブル取出しX

// ---------------- 部品モジュール ----------------

// 取付タブ (本体側面から張り出す耳 / φ3.2 穴)
module mount_tab(s) {
    hull() {
        translate([s*hole_pitch/2, 0, 0])
            rotate([90, 0, 0])
                cylinder(r = tab_r, h = tab_t, center = true);
        translate([s*(body_l/2 - 0.5), 0, 0])
            cube([1, tab_t, 2*tab_r], center = true);
    }
}

// レンズ突起 (上面ターレット)
module lens_turret(x0, w) {
    translate([x0, turret_yc - turret_d/2, z_bot])
        cube([w, turret_d, total_h]);
}

// ---------------- 本体組立 ----------------
module gp2y0a21yk0f() {
    union() {
        difference() {
            union() {
                // --- 本体ケース ---
                translate([0, 0, (z_case_top + z_bot)/2])
                    cube([body_l, body_w, case_h], center = true);

                // --- レンズ突起 (発光側 / 受光側) ---
                lens_turret(-body_l/2, em_turret_w);
                lens_turret(-body_l/2 + em_turret_w + turret_gap,
                            det_turret_w);

                // --- 取付タブ x2 ---
                for (s = [-1, 1]) mount_tab(s);

                // --- 連結バー (下方向の延長部) ---
                translate([bar_x0, -bar_d/2, z_bar_bot])
                    cube([bar_w, bar_d, bar_h + 1]);

                // --- PWB (薄板, 参考表現) ---
                translate([bar_x0 + 0.5, -pwb_t/2, z_bar_bot + 0.5])
                    cube([bar_w - 1, pwb_t, bar_h]);

                // --- コネクタ部の張り出し ---
                translate([conn_cx, 0, z_bar_bot + 1.5])
                    cube([conn_w, conn_d + pwb_t, 3], center = true);
            }

            // --- 取付穴 φ3.2 x2 (Y方向貫通) ---
            for (s = [-1, 1])
                translate([s*hole_pitch/2, 0, 0])
                    rotate([90, 0, 0])
                        cylinder(d = hole_d, h = body_w + 10, center = true);

            // --- ケーブル取り出しの切欠き (バー底の U 溝) ---
            translate([conn_cx, 0, z_bar_bot + 1])
                cube([cable_d + 1, bar_d + conn_d + 4, 2.2], center = true);
        }

        // --- 発光側レンズ (円形窓) ---
        translate([em_cx, turret_yc, z_top])
            cylinder(d = 5.5, h = 0.6);
        translate([em_cx, turret_yc, z_top + 0.6])
            scale([1, 1, 0.35]) sphere(d = 5.5);

        // --- 受光側レンズ (矩形窓 + 内側円形レンズ) ---
        translate([det_cx, turret_yc, z_top + 0.25])
            cube([8.0, 5.2, 0.5], center = true);
        translate([det_cx, turret_yc, z_top + 0.5])
            scale([1, 1, 0.35]) sphere(d = 4.5);

        // --- ケーブル (JST PHR-3 への引き出し / 丸棒で簡易表現) ---
        translate([conn_cx, 0, z_bar_bot - cable_l + 1])
            cylinder(d = cable_d, h = cable_l);
    }
}

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

meta

runIdpdf-page_claude-fable-5-14fe54ac86a1-2026-06-09T18-48-50-838Z
matrixIdpdf-page/claude-fable-5
signature14fe54ac86a11718…
provideranthropic
modelclaude-fable-5
harnesspdf-page
statussuccess
duration111.08s (wallclock: load + prompt eval + generation + network)
tokens3521 in / 9027 out
wallclock tok/s81.3 tok/s (end-to-end)
cost$0.4866
createdAt2026-06-09T18:48:50.838Z
gitCommit2b674f55c19d
openscadOpenSCAD version 2026.04.27

prompt

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

※ 同じ Sharp の GP2Y0D413K0F とは別モデルです:
- レンジ: 10〜80cm(アナログ電圧出力)
- パッケージ:
  - 本体は横長(乗っているレンズ部 + 連結バー部分の2塊で構成)
  - 連結部にケーブル取り出し穴 + 取付穴2個
  - 受光・発光のレンズが本体上部から飛び出している
- コネクタはケーブル(JST PHR-3)で出る、本体下部に直付けではない

含めるべき部位:
- レンズ部本体ケース(直方体に近い、上部にレンズ突起)
- 発光側レンズと受光側レンズ(上面に並ぶ円形 / 矩形の窓)
- 連結バー(レンズ部の下方向に伸びる薄い板状の延長部)
- 連結バーにある取付穴 2 つ + ケーブル取り出しの切欠き
- ケーブル(PCB / コネクタの代わりに丸棒で簡易表現で可)

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

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

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