vibe-openscad

tier-2-hex-bolt / gpt-5.4-nano-2026-03-17

7 run / 累計 20.5s / 累計 $0.0014

openai gpt 5.4 nano 2026-03-17 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-hex-bolt
loading STL…
success 3.1s · 200/316t · $0.0002
SCAD (34 lines)
// M8 hex bolt (thread omitted)

$fn = 180;

// Parameters
af = 13;      // across-flats of hex head [mm]
h  = 5.3;     // head height [mm]
d  = 8;       // shank diameter [mm]
L  = 30;      // shank length [mm]

// Hex head: build centered cylinder with flat-to-flat = af
// For a regular hexagon: across-flats = 2 * apothem = 2 * (R * cos(30)) = R * sqrt(3)
// => circumradius R = af / sqrt(3)
R = af / sqrt(3);

module hex_prism(flat_to_flat, height) {
  $fn = 6;
  // circumradius derived from across-flats
  cylinder(h=height, r=flat_to_flat / sqrt(3), center=false);
}

// Placement: head bottom at z=0, shank extends into z<0
union() {
  // Head
  translate([0, 0, 0])
    hex_prism(af, h);

  // Shank
  translate([0, 0, 0])
    cylinder(h=L, d=d, center=false); // extends from z=0 to z=L
  // Move shank to extend into z<0
  translate([0, 0, -L])
    cylinder(h=L, d=d, center=false);
}
パラメータ (4)
スライダを動かすと openscad-wasm で再レンダリング

prompt

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

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

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

variant: effort

low success
low
4.8s · 200/317t · $0.0002
SCAD (26 lines)
// M8 hex bolt (simplified thread omitted)

$fn = 180;

// Parameters
af = 13;      // across-flats for hex head (mm)
h  = 5.3;     // head height (mm)
d_shank = 8;  // shank diameter (mm)
l_shank = 30; // shank length (mm)

// Derived
r_hex = af / 2;  // circumscribed radius for a regular hex: across-flats = 2*R*cos(30)=R*sqrt(3) -> wait: use apothem
// For a regular hexagon created by polygon/cylinder with flat-to-flat = af,
// easiest: use cylinder with $fn=6; then use radius based on flat-to-flat.
// For regular hex: flat-to-flat = 2 * apothem = 2 * r*cos(30) = r*sqrt(3)
r_hex = af / sqrt(3);

union() {
    // Hex head: bottom face at z=0, center axis along +Z
    translate([0, 0, h/2])
        cylinder(h = h, r = r_hex, center = true, $fn = 6);

    // Shank: extends into z<0 side
    translate([0, 0, -l_shank/2])
        cylinder(h = l_shank, d = d_shank, center = true, $fn = 180);
}
medium (default) success
medium
3.1s · 200/316t · $0.0002
SCAD (34 lines)
// M8 hex bolt (thread omitted)

$fn = 180;

// Parameters
af = 13;      // across-flats of hex head [mm]
h  = 5.3;     // head height [mm]
d  = 8;       // shank diameter [mm]
L  = 30;      // shank length [mm]

// Hex head: build centered cylinder with flat-to-flat = af
// For a regular hexagon: across-flats = 2 * apothem = 2 * (R * cos(30)) = R * sqrt(3)
// => circumradius R = af / sqrt(3)
R = af / sqrt(3);

module hex_prism(flat_to_flat, height) {
  $fn = 6;
  // circumradius derived from across-flats
  cylinder(h=height, r=flat_to_flat / sqrt(3), center=false);
}

// Placement: head bottom at z=0, shank extends into z<0
union() {
  // Head
  translate([0, 0, 0])
    hex_prism(af, h);

  // Shank
  translate([0, 0, 0])
    cylinder(h=L, d=d, center=false); // extends from z=0 to z=L
  // Move shank to extend into z<0
  translate([0, 0, -L])
    cylinder(h=L, d=d, center=false);
}
high success
high
3.0s · 200/273t · $0.0002
SCAD (29 lines)
// M8 hex bolt (thread omitted)

$fn = 180;

// Parameters
af = 13;      // across-flats of hex head [mm]
h  = 5.3;     // height of hex head [mm]
d  = 8;       // shank diameter [mm]
L  = 30;      // shank length [mm]

// Derived
r = af / (2 * cos(30)); // circumscribed radius from across-flats

module hex_prism(across_flats, height) {
  // Flat-to-flat = across_flats
  // Hexagon in XY plane centered at origin
  cylinder(h=height, r=across_flats / (2 * cos(30)), $fn=6, center=false);
}

// Head bottom at z=0, axis along +Z; shank extends into z<0
union() {
  // Hex head: bottom at z=0, top at z=h
  translate([0, 0, 0])
    cylinder(h=h, r=r, $fn=6);

  // Shank: from z=0 down to z=-L
  translate([0, 0, -L])
    cylinder(h=L, d=d, center=false);
}
maxnot run
xhighnot run

iteration: iter-png

i1 success
iter 1
2.0s · 1181/208t · $0.0002
diff vs bare: +7/-17
  // M8 hex bolt (thread omitted)
  
  $fn = 180;
  
  // Parameters
  af = 13;      // across-flats of hex head [mm]
  h  = 5.3;     // head height [mm]
  d  = 8;       // shank diameter [mm]
  L  = 30;      // shank length [mm]
  
- // Hex head: build centered cylinder with flat-to-flat = af
- // For a regular hexagon: across-flats = 2 * apothem = 2 * (R * cos(30)) = R * sqrt(3)
- // => circumradius R = af / sqrt(3)
- R = af / sqrt(3);
- 
+ // Regular hexagon: across-flats = af, so circumradius R = af / sqrt(3)
  module hex_prism(flat_to_flat, height) {
-   $fn = 6;
-   // circumradius derived from across-flats
-   cylinder(h=height, r=flat_to_flat / sqrt(3), center=false);
+   r = flat_to_flat / sqrt(3);
+   cylinder(h=height, r=r, center=false, $fn=6);
  }
  
- // Placement: head bottom at z=0, shank extends into z<0
  union() {
-   // Head
-   translate([0, 0, 0])
-     hex_prism(af, h);
+   // Head: bottom face at z=0
+   hex_prism(af, h);
  
-   // Shank
-   translate([0, 0, 0])
-     cylinder(h=L, d=d, center=false); // extends from z=0 to z=L
-   // Move shank to extend into z<0
+   // Shank: extend into z<0
    translate([0, 0, -L])
-     cylinder(h=L, d=d, center=false);
+     cylinder(h=L, d=d, center=false, $fn=$fn);
  }
SCAD (24 lines)
// M8 hex bolt (thread omitted)

$fn = 180;

// Parameters
af = 13;      // across-flats of hex head [mm]
h  = 5.3;     // head height [mm]
d  = 8;       // shank diameter [mm]
L  = 30;      // shank length [mm]

// Regular hexagon: across-flats = af, so circumradius R = af / sqrt(3)
module hex_prism(flat_to_flat, height) {
  r = flat_to_flat / sqrt(3);
  cylinder(h=height, r=r, center=false, $fn=6);
}

union() {
  // Head: bottom face at z=0
  hex_prism(af, h);

  // Shank: extend into z<0
  translate([0, 0, -L])
    cylinder(h=L, d=d, center=false, $fn=$fn);
}
i2 success
iter 2
2.3s · 1073/206t · $0.0002
diff vs i1: +2/-2
  // M8 hex bolt (thread omitted)
  
  $fn = 180;
  
  // Parameters
  af = 13;      // across-flats of hex head [mm]
  h  = 5.3;     // head height [mm]
  d  = 8;       // shank diameter [mm]
  L  = 30;      // shank length [mm]
  
- // Regular hexagon: across-flats = af, so circumradius R = af / sqrt(3)
+ // Regular hexagon prism where across-flats = af
  module hex_prism(flat_to_flat, height) {
-   r = flat_to_flat / sqrt(3);
+   r = flat_to_flat / sqrt(3); // circumradius from across-flats
    cylinder(h=height, r=r, center=false, $fn=6);
  }
  
  union() {
    // Head: bottom face at z=0
    hex_prism(af, h);
  
    // Shank: extend into z<0
    translate([0, 0, -L])
      cylinder(h=L, d=d, center=false, $fn=$fn);
  }
SCAD (24 lines)
// M8 hex bolt (thread omitted)

$fn = 180;

// Parameters
af = 13;      // across-flats of hex head [mm]
h  = 5.3;     // head height [mm]
d  = 8;       // shank diameter [mm]
L  = 30;      // shank length [mm]

// Regular hexagon prism where across-flats = af
module hex_prism(flat_to_flat, height) {
  r = flat_to_flat / sqrt(3); // circumradius from across-flats
  cylinder(h=height, r=r, center=false, $fn=6);
}

union() {
  // Head: bottom face at z=0
  hex_prism(af, h);

  // Shank: extend into z<0
  translate([0, 0, -L])
    cylinder(h=L, d=d, center=false, $fn=$fn);
}
i3 success
iter 3
2.2s · 1071/206t · $0.0002
diff vs i2: +0/-0
  // M8 hex bolt (thread omitted)
  
  $fn = 180;
  
  // Parameters
  af = 13;      // across-flats of hex head [mm]
  h  = 5.3;     // head height [mm]
  d  = 8;       // shank diameter [mm]
  L  = 30;      // shank length [mm]
  
  // Regular hexagon prism where across-flats = af
  module hex_prism(flat_to_flat, height) {
    r = flat_to_flat / sqrt(3); // circumradius from across-flats
    cylinder(h=height, r=r, center=false, $fn=6);
  }
  
  union() {
    // Head: bottom face at z=0
    hex_prism(af, h);
  
    // Shank: extend into z<0
    translate([0, 0, -L])
      cylinder(h=L, d=d, center=false, $fn=$fn);
  }
SCAD (24 lines)
// M8 hex bolt (thread omitted)

$fn = 180;

// Parameters
af = 13;      // across-flats of hex head [mm]
h  = 5.3;     // head height [mm]
d  = 8;       // shank diameter [mm]
L  = 30;      // shank length [mm]

// Regular hexagon prism where across-flats = af
module hex_prism(flat_to_flat, height) {
  r = flat_to_flat / sqrt(3); // circumradius from across-flats
  cylinder(h=height, r=r, center=false, $fn=6);
}

union() {
  // Head: bottom face at z=0
  hex_prism(af, h);

  // Shank: extend into z<0
  translate([0, 0, -L])
    cylinder(h=L, d=d, center=false, $fn=$fn);
}