tier-4-gp2y0a21yk / claude-opus-4-7
1 run / 累計 29.7s / 累計 $0.0585
claude opus 4.7 pdf-page
bare (provider default effort)
run detail → render
// Sharp GP2Y0A21YK0F distance sensor - external dimensions model
// Origin at body center. +Z up (lens on top), +Y forward.
// Units: mm
$fn = 64;
// --- Main dimensions (from datasheet) ---
body_len = 29.5; // main lens-case body length (X)
body_depth = 13.0; // body depth in Y (front-back, 13 from side view)
body_height = 13.5 - 1.2 - 3.3; // case height above bar... use side view: total ~18.9 incl lens, case ~13.5 - PWB
// Use simpler decomposition based on side view:
case_h = 13.5; // case height (back/side view shows 13.5)
lens_proj_h = 18.9 - 13.5; // lens protrusion above case top (~5.4)
// horizontal extents
total_len = 37.0; // tip-to-tip including mounting tabs
bar_thick = 2.0; // connecting bar (mounting tab) thickness in Z
bar_y = 8.4; // bar depth in Y at mounting region (approx)
mount_hole_d = 3.2;
mount_pitch = 37.0 - 2*3.75; // distance between hole centers approx? Actually holes are at outer ends.
// From figure: R3.75 ends, total 37, so hole centers near each end.
hole_center_offset = (total_len/2) - 3.75; // 14.75 from center
// Lens centers (from datasheet): *4.5 from one side edge of body, *20±0.1 between centers
// Body length 29.5, so lens centers symmetric around center: ±10
lens_spacing = 20.0;
emitter_x = -lens_spacing/2;
detector_x = lens_spacing/2;
// Lens window sizes (approx from drawing)
emitter_lens_d = 7.0; // round emitter lens
detector_lens_w = 10.0; // detector window width
detector_lens_h = 7.0; // detector window depth (Y)
// Cable
cable_d = 2.5;
cable_len = 40;
// --- Build ---
module main_body() {
// Main rectangular case (lens housing)
translate([-body_len/2, -body_depth/2, -case_h/2])
cube([body_len, body_depth, case_h]);
}
module mounting_bar() {
// Thin bar extending sideways with mounting tabs (rounded ends)
// The bar sits roughly at middle height of body; thickness ~2mm
bar_z_center = -case_h/2 + bar_thick/2 + 4; // approx vertical position
translate([0, 0, bar_z_center])
linear_extrude(height = bar_thick, center = true) {
hull() {
translate([-hole_center_offset, 0]) circle(r = 3.75);
translate([ hole_center_offset, 0]) circle(r = 3.75);
}
}
}
module mounting_holes() {
bar_z_center = -case_h/2 + bar_thick/2 + 4;
for (sx = [-1, 1]) {
translate([sx * hole_center_offset, 0, bar_z_center])
cylinder(d = mount_hole_d, h = bar_thick + 2, center = true);
}
}
module cable_notch() {
// Cable exit on the back (-Y) side, near bottom
translate([0, -body_depth/2 - 2, -case_h/2 + 3])
cube([6.3, 4, 4], center = true);
}
module emitter_lens() {
// Round lens protruding from top
translate([emitter_x, 0, case_h/2])
cylinder(d = emitter_lens_d, h = lens_proj_h);
// small dome
translate([emitter_x, 0, case_h/2 + lens_proj_h])
sphere(d = emitter_lens_d * 0.9);
}
module detector_lens() {
// Rectangular window protruding from top
translate([detector_x, 0, case_h/2])
translate([-detector_lens_w/2, -detector_lens_h/2, 0])
cube([detector_lens_w, detector_lens_h, lens_proj_h]);
}
module cable() {
// Simple cylindrical cable coming out the back
translate([0, -body_depth/2 - cable_len/2 - 1, -case_h/2 + 3])
rotate([90, 0, 0])
cylinder(d = cable_d, h = cable_len, center = true);
}
module sensor() {
difference() {
union() {
main_body();
mounting_bar();
emitter_lens();
detector_lens();
}
mounting_holes();
cable_notch();
}
cable();
}
sensor(); パラメータ (13) —
スライダを動かすと openscad-wasm で再レンダリング
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 ... ``` のフェンスで囲んで出力してください。 コードのみで、追加の説明は不要です。