vibe-openscad

pdf-page/gpt-5.6-terra / tier-4-gp2y0a21yk

success tier 4

pdf-page (gpt 5.6 terra)

render
bare render of tier-4-gp2y0a21yk
loading STL…
success 22.2s · 2680/2339t · $0.0334
SCAD (228 lines)
/*
  Sharp GP2Y0A21YK0F 距離センサ
  単位: mm

  座標系:
    X : 左右
    Y : 前後(レンズ面が +Y)
    Z : 上下(PWB / コネクタ側が -Z)
    原点 : 本体ケース中心付近
*/

$fn = 48;


//--------------------------------------------------
// Parameters
//--------------------------------------------------
body_w          = 29.5;
body_d          = 13.5;
body_h          = 13.0;

overall_w       = 37.0;

ear_center_x    = 16.0;
ear_center_z    = 0.0;
ear_d           = 9.0;
mount_hole_d    = 3.2;

lens_center_x   = 10.0;
lens_center_z   = 0.0;
lens_d          = 8.0;
lens_recess_d   = 7.0;

front_y         = body_d / 2;
rear_y          = -body_d / 2;

connector_w     = 10.1;
connector_d     = 3.3;
connector_h     = 5.4;

pcb_w           = 14.75;
pcb_d           = 1.2;
pcb_h           = 7.0;


//--------------------------------------------------
// Utility modules
//--------------------------------------------------
module rounded_box(size=[10,10,10], r=0.5, center=true)
{
    sx = size[0];
    sy = size[1];
    sz = size[2];

    if (center)
        translate([-sx/2, -sy/2, -sz/2])
            minkowski() {
                cube([sx-2*r, sy-2*r, sz-2*r]);
                sphere(r=r);
            }
    else
        minkowski() {
            cube([sx-2*r, sy-2*r, sz-2*r]);
            sphere(r=r);
        }
}

module y_cylinder(d=1, h=1, center=true)
{
    rotate([90,0,0])
        cylinder(d=d, h=h, center=center);
}


//--------------------------------------------------
// Main case including mounting ears
//--------------------------------------------------
module case_shell()
{
    difference() {
        union() {

            // Main rectangular sensor case
            rounded_box([body_w, body_d, body_h], 0.55);

            // Mounting ears / flanges
            for (sx = [-1, 1]) {
                hull() {
                    translate([sx*(body_w/2 - 1.5), 0, ear_center_z])
                        y_cylinder(d=ear_d, h=body_d-1.0);

                    translate([sx*ear_center_x, 0, ear_center_z])
                        y_cylinder(d=ear_d, h=body_d-1.0);
                }
            }

            // Slight top rear step visible in outline drawing
            translate([0, rear_y + 1.0, body_h/2 - 0.8])
                cube([body_w-2.0, 2.0, 1.6], center=true);

            // Front lens bezel area
            translate([0, front_y + 0.20, 0])
                rounded_box([25.0, 0.8, 8.8], 0.25);
        }

        // Mounting holes
        for (sx = [-1, 1])
            translate([sx*ear_center_x, 0, ear_center_z])
                y_cylinder(d=mount_hole_d, h=body_d + 4);

        // Lens recesses
        for (sx = [-1, 1])
            translate([sx*lens_center_x, front_y + 0.15, lens_center_z])
                y_cylinder(d=lens_recess_d, h=1.3);

        // Center front separator / rectangular recess
        translate([0, front_y + 0.18, 0])
            cube([7.5, 1.2, 5.9], center=true);
    }
}


//--------------------------------------------------
// Lens assemblies
//--------------------------------------------------
module lens_assembly(xpos=0, emitter=false)
{
    // Black internal lens barrel
    color([0.06,0.06,0.06])
        translate([xpos, front_y + 0.32, 0])
            y_cylinder(d=lens_d, h=0.8);

    // Dark recessed optical face
    color([0.12,0.12,0.12])
        translate([xpos, front_y + 0.76, 0])
            y_cylinder(d=lens_d-1.0, h=0.12);

    // Lens optical surface
    if (emitter)
        color([0.22,0.16,0.10])
            translate([xpos, front_y + 0.84, 0])
                y_cylinder(d=lens_d-2.0, h=0.15);
    else
        color([0.08,0.10,0.12])
            translate([xpos, front_y + 0.84, 0])
                y_cylinder(d=lens_d-2.0, h=0.15);

    // Small circular retaining ring
    color([0.20,0.20,0.20])
        difference() {
            translate([xpos, front_y + 0.88, 0])
                y_cylinder(d=lens_d-0.15, h=0.10);

            translate([xpos, front_y + 0.88, 0])
                y_cylinder(d=lens_d-1.0, h=0.20);
        }
}


//--------------------------------------------------
// Connector and PWB-side details
//--------------------------------------------------
module connector()
{
    // PWB tongue / terminal support
    color([0.18,0.18,0.18])
        translate([0, rear_y + 1.8, -body_h/2 - pcb_h/2 + 0.3])
            cube([pcb_w, pcb_d, pcb_h], center=true);

    // Connector body
    color([0.12,0.12,0.12])
        translate([0, rear_y + 1.0, -body_h/2 - connector_h/2 + 0.45])
            rounded_box([connector_w, connector_d, connector_h], 0.25);

    // Three visible signal terminals
    for (x = [-3.0, 0, 3.0])
        color([0.72,0.72,0.62])
            translate([x, rear_y - 0.05, -body_h/2 - 2.5])
                cube([0.75, 0.5, 3.6], center=true);

    // Connector latch / raised central feature
    color([0.16,0.16,0.16])
        translate([0, rear_y + 0.35, -body_h/2 - 0.9])
            cube([6.2, 1.2, 1.8], center=true);
}


//--------------------------------------------------
// Cosmetic front markings
//--------------------------------------------------
module front_features()
{
    // Divider between transmitter and receiver
    color([0.10,0.10,0.10])
        translate([0, front_y + 0.63, 0])
            cube([1.2, 0.25, 7.0], center=true);

    // Lower front lip
    color([0.12,0.12,0.12])
        translate([0, front_y + 0.35, -4.8])
            cube([24.5, 0.7, 1.0], center=true);

    // Small top front ridge
    color([0.16,0.16,0.16])
        translate([0, front_y + 0.35, 4.8])
            cube([24.5, 0.7, 0.7], center=true);
}


//--------------------------------------------------
// Complete model
//--------------------------------------------------
module GP2Y0A21YK0F()
{
    color([0.10,0.10,0.10])
        case_shell();

    // Left side: light emitter
    lens_assembly(-lens_center_x, true);

    // Right side: light detector
    lens_assembly( lens_center_x, false);

    front_features();
    connector();
}

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

meta

runIdpdf-page_gpt-5.6-terra-b4c457e15796-2026-09-05T14-38-06-197Z
matrixIdpdf-page/gpt-5.6-terra
signatureb4c457e1579677d6…
provideropenai
modelgpt-5.6-terra
harnesspdf-page
statussuccess
duration22.16s (wallclock: load + prompt eval + generation + network)
tokens2680 in / 2339 out
wallclock tok/s105.6 tok/s (end-to-end)
cost$0.0334
createdAt2026-09-05T14:38:06.197Z
gitCommit7ec961914ad4
openscadOpenSCAD version 2026.04.27

prompt

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

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

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