vibe-openscad

tier-2-hex-bolt / gpt-5-nano-2025-08-07

7 run / 累計 385.6s / 累計 $0.0207

openai gpt 5 nano 2025-08-07 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-hex-bolt
loading STL…
success 61.5s · 200/7180t · $0.0029
SCAD (34 lines)
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank

// Across-flats of hex head
D = 13; // mm

// Regular hexagon circumradius from across-flats: R = D / sqrt(3)
R = D / sqrt(3);

// 2D hexagon points (circumradius R), oriented generically
points_hex = [
    for (i = [0 : 5])
        [
            R * cos(i * 60 * PI / 180),
            R * sin(i * 60 * PI / 180)
        ]
];

// Head: hexagonal prism, thickness 5.3 mm, bottom on z = 0
module head() {
    linear_extrude(height = 5.3, center = false)
        polygon(points = points_hex);
}

// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm
module shank() {
    cylinder(h = 30, r = 4, center = false);
}

// Assemble: head on top (z 0 to 5.3), shank extending to z < 0 (z -30 to 0)
union() {
    head(); // z = 0 .. 5.3
    translate([0, 0, -30])
        shank(); // z = -30 .. 0
}
パラメータ (1)
スライダを動かすと openscad-wasm で再レンダリング

prompt

OpenSCAD で、規格に準じた M8 サイズの六角ボルトを作ってください。
ねじ山自体は省略してよく、円柱のシャンクで構いません。

寸法は以下に従ってください:
- 頭部は六角柱で、対辺距離(across-flats)13mm、高さ 5.3mm
- シャンク(軸部)は直径 8mm、長さ 30mm の円柱
- ボルト全体の中心軸は +Z 軸方向
- 頭部の底面が原点(z=0)に来るように配置し、シャンクは z<0 側へ伸ばす

完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。

variant: effort

low success
low
14.3s · 200/1692t · $0.0007
SCAD (35 lines)
// M8規格準拠の六角ボルト(頭部 hex 5.3mm high, シャンク 直径8mm 長さ30mm, 中心軸 = +Z, 頭部底面 z=0)

// 定数
R = 13 / sqrt(3); // hex の circumradius( across-flats = 13mm を満たす)
head_height = 5.3;
shank_d = 8;
shank_r = shank_d / 2;
shank_h = 30;

// 六角形の頂点(中心を原点、正のX軸方向に頂点を置くよう配置)
points = [
  [ R, 0 ],
  [ R/2, R*sqrt(3)/2 ],
  [ -R/2, R*sqrt(3)/2 ],
  [ -R, 0 ],
  [ -R/2, -R*sqrt(3)/2 ],
  [ R/2, -R*sqrt(3)/2 ]
];

// ヘッド部(底面を z=0 に配置、+Z方向に伸長)
module head() {
  linear_extrude(height = head_height) polygon(points);
}

// シャンク部(底辺を z=0 から -30 まで、中心軸は +Z)
module shank() {
  translate([0, 0, -shank_h])
    cylinder(h = shank_h, r = shank_r, center = false, $fn = 64);
}

// 組み立て
union() {
  head();          // z = 0 〜 head_height
  shank();         // z = -30 〜 0
}
medium (default) success
medium
61.5s · 200/7180t · $0.0029
SCAD (34 lines)
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank

// Across-flats of hex head
D = 13; // mm

// Regular hexagon circumradius from across-flats: R = D / sqrt(3)
R = D / sqrt(3);

// 2D hexagon points (circumradius R), oriented generically
points_hex = [
    for (i = [0 : 5])
        [
            R * cos(i * 60 * PI / 180),
            R * sin(i * 60 * PI / 180)
        ]
];

// Head: hexagonal prism, thickness 5.3 mm, bottom on z = 0
module head() {
    linear_extrude(height = 5.3, center = false)
        polygon(points = points_hex);
}

// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm
module shank() {
    cylinder(h = 30, r = 4, center = false);
}

// Assemble: head on top (z 0 to 5.3), shank extending to z < 0 (z -30 to 0)
union() {
    head(); // z = 0 .. 5.3
    translate([0, 0, -30])
        shank(); // z = -30 .. 0
}
high success
high
121.2s · 200/17515t · $0.0070
SCAD (31 lines)
// M8規格準拠の六角ボルト(ねじ山は省略、シャンクは円柱)
af = 13;            // across flats (mm)
head_h = 5.3;        // head height (mm)
shank_len = 30;      // shank length (mm)
shank_r = 4;         // shank radius (mm) -> Ø8 mm

R = af / sqrt(3);    // hex head circumradius

head_pts = [
  [ R, 0 ],
  [ R/2, R*sqrt(3)/2 ],
  [ -R/2, R*sqrt(3)/2 ],
  [ -R, 0 ],
  [ -R/2, -R*sqrt(3)/2 ],
  [ R/2, -R*sqrt(3)/2 ]
];

module hex_head() {
  linear_extrude(height = head_h)
    polygon(points = head_pts);
}

module shank() {
  translate([0, 0, -shank_len])
    cylinder(h = shank_len, r = shank_r, $fn = 64);
}

union() {
  hex_head();
  shank();
}
maxnot run
xhighnot run

iteration: iter-png

i1 success
iter 1
47.0s · 1306/6785t · $0.0028
diff vs bare: +11/-15
  // OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
+ // Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
  
- // Across-flats of hex head
- D = 13; // mm
+ D = 13; // across-flats of hex head (mm)
+ R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
  
- // Regular hexagon circumradius from across-flats: R = D / sqrt(3)
- R = D / sqrt(3);
- 
- // 2D hexagon points (circumradius R), oriented generically
  points_hex = [
      for (i = [0 : 5])
-         [
-             R * cos(i * 60 * PI / 180),
-             R * sin(i * 60 * PI / 180)
-         ]
+         [ R * cos(i * 60 * PI / 180),
+           R * sin(i * 60 * PI / 180) ]
  ];
  
- // Head: hexagonal prism, thickness 5.3 mm, bottom on z = 0
+ // Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
  module head() {
-     linear_extrude(height = 5.3, center = false)
-         polygon(points = points_hex);
+     rotate([0, 0, 30])
+         linear_extrude(height = 5.3, center = false)
+             polygon(points = points_hex);
  }
  
- // Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm
+ // Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
  module shank() {
      cylinder(h = 30, r = 4, center = false);
  }
  
- // Assemble: head on top (z 0 to 5.3), shank extending to z < 0 (z -30 to 0)
+ // Assemble: head on top (z 0..5.3), shank from z -30 .. 0
  union() {
      head(); // z = 0 .. 5.3
      translate([0, 0, -30])
          shank(); // z = -30 .. 0
  }
SCAD (30 lines)
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
// Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)

D = 13; // across-flats of hex head (mm)
R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats

points_hex = [
    for (i = [0 : 5])
        [ R * cos(i * 60 * PI / 180),
          R * sin(i * 60 * PI / 180) ]
];

// Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
    rotate([0, 0, 30])
        linear_extrude(height = 5.3, center = false)
            polygon(points = points_hex);
}

// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
    cylinder(h = 30, r = 4, center = false);
}

// Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
    head(); // z = 0 .. 5.3
    translate([0, 0, -30])
        shank(); // z = -30 .. 0
}
i2 success
iter 2
27.8s · 1320/3955t · $0.0016
diff vs i1: +0/-0
  // OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
  // Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
  
  D = 13; // across-flats of hex head (mm)
  R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
  
  points_hex = [
      for (i = [0 : 5])
          [ R * cos(i * 60 * PI / 180),
            R * sin(i * 60 * PI / 180) ]
  ];
  
  // Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
  module head() {
      rotate([0, 0, 30])
          linear_extrude(height = 5.3, center = false)
              polygon(points = points_hex);
  }
  
  // Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
  module shank() {
      cylinder(h = 30, r = 4, center = false);
  }
  
  // Assemble: head on top (z 0..5.3), shank from z -30 .. 0
  union() {
      head(); // z = 0 .. 5.3
      translate([0, 0, -30])
          shank(); // z = -30 .. 0
  }
SCAD (30 lines)
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
// Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)

D = 13; // across-flats of hex head (mm)
R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats

points_hex = [
    for (i = [0 : 5])
        [ R * cos(i * 60 * PI / 180),
          R * sin(i * 60 * PI / 180) ]
];

// Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
    rotate([0, 0, 30])
        linear_extrude(height = 5.3, center = false)
            polygon(points = points_hex);
}

// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
    cylinder(h = 30, r = 4, center = false);
}

// Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
    head(); // z = 0 .. 5.3
    translate([0, 0, -30])
        shank(); // z = -30 .. 0
}
i3 success
iter 3
52.3s · 1320/6832t · $0.0028
diff vs i2: +0/-0
  // OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
  // Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
  
  D = 13; // across-flats of hex head (mm)
  R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
  
  points_hex = [
      for (i = [0 : 5])
          [ R * cos(i * 60 * PI / 180),
            R * sin(i * 60 * PI / 180) ]
  ];
  
  // Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
  module head() {
      rotate([0, 0, 30])
          linear_extrude(height = 5.3, center = false)
              polygon(points = points_hex);
  }
  
  // Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
  module shank() {
      cylinder(h = 30, r = 4, center = false);
  }
  
  // Assemble: head on top (z 0..5.3), shank from z -30 .. 0
  union() {
      head(); // z = 0 .. 5.3
      translate([0, 0, -30])
          shank(); // z = -30 .. 0
  }
SCAD (30 lines)
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
// Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)

D = 13; // across-flats of hex head (mm)
R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats

points_hex = [
    for (i = [0 : 5])
        [ R * cos(i * 60 * PI / 180),
          R * sin(i * 60 * PI / 180) ]
];

// Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
    rotate([0, 0, 30])
        linear_extrude(height = 5.3, center = false)
            polygon(points = points_hex);
}

// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
    cylinder(h = 30, r = 4, center = false);
}

// Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
    head(); // z = 0 .. 5.3
    translate([0, 0, -30])
        shank(); // z = -30 .. 0
}