vibe-openscad

tier-2-hex-bolt / qwen/qwen3.5-9b

4 run / 累計 130.5s / 累計 $0

qwen/qwen3.5-9b bare

bare (provider default effort)

run detail →
render
bare render of tier-2-hex-bolt
loading STL…
success 62.7s · 179/7155t
SCAD (27 lines)
module bolt() {
  // Hexagon Head
  // M8 Across flats = 13mm -> Inradius = 6.5mm
  // Head height = 5.3mm
  // Head bottom at z=0
  
  $r = 6.5;
  $pts = [];
  for (i = [0 : 5]) {
    $pts = concat($pts, [[ $r * cos(i * 60 * pi / 180), $r * sin(i * 60 * pi / 180) ]]);
  }

  translate([0, 0, 0])
  linear_extrude(height = 5.3) {
    polygon(points = $pts);
  }

  // Shank
  // Diameter = 8mm
  // Length = 30mm
  // Top at z=0, Bottom at z=-30
  
  translate([0, 0, -30])
  cylinder(d = 8, h = 30, center = false);
}

bolt();

prompt

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

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

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

iteration: iter-png

i1 success →
iter 1
17.0s · 976/1717t
diff vs bare: +34/-10
  module bolt() {
-   // Hexagon Head
-   // M8 Across flats = 13mm -> Inradius = 6.5mm
+   // Hexagonal Head
+   // Across flats = 13mm -> Circumradius = 13 / (2 * cos(30deg))
    // Head height = 5.3mm
    // Head bottom at z=0
    
-   $r = 6.5;
-   $pts = [];
+   R = 13 / (2 * cos(pi / 6)); // Circumradius
+   
+   // Define vertices for hexagonal prism
+   // Bottom face (z=0)
+   points_bottom = [];
    for (i = [0 : 5]) {
-     $pts = concat($pts, [[ $r * cos(i * 60 * pi / 180), $r * sin(i * 60 * pi / 180) ]]);
+     points_bottom = concat(points_bottom, [[R * cos(i * pi / 3), R * sin(i * pi / 3), 0]]);
    }
- 
-   translate([0, 0, 0])
-   linear_extrude(height = 5.3) {
-     polygon(points = $pts);
+   // Top face (z=5.3)
+   points_top = [];
+   for (i = [0 : 5]) {
+     points_top = concat(points_top, [[R * cos(i * pi / 3), R * sin(i * pi / 3), 5.3]]);
    }
- 
+   
+   // Combine points
+   all_points = concat(points_bottom, points_top);
+   
+   // Define faces for polyhedron
+   // Indices: 0-5 are bottom, 6-11 are top
+   faces = [];
+   
+   // Bottom face
+   faces = concat(faces, [[0, 1, 2, 3, 4, 5]]);
+   // Top face
+   faces = concat(faces, [[6, 7, 8, 9, 10, 11]]);
+   // Side faces
+   for (i = [0 : 5]) {
+     // Connect vertex i (bottom) to i (top) and i+1 (top) and i+1 (bottom)
+     faces = concat(faces, [[i, i + 1, i + 1 + 6, i + 6]]);
+   }
+   
+   // Draw hexagonal head
+   translate([0, 0, 0])
+   polyhedron(points = all_points, faces = faces);
+   
    // Shank
    // Diameter = 8mm
    // Length = 30mm
    // Top at z=0, Bottom at z=-30
    
    translate([0, 0, -30])
    cylinder(d = 8, h = 30, center = false);
  }
  
  bolt();
SCAD (51 lines)
module bolt() {
  // Hexagonal Head
  // Across flats = 13mm -> Circumradius = 13 / (2 * cos(30deg))
  // Head height = 5.3mm
  // Head bottom at z=0
  
  R = 13 / (2 * cos(pi / 6)); // Circumradius
  
  // Define vertices for hexagonal prism
  // Bottom face (z=0)
  points_bottom = [];
  for (i = [0 : 5]) {
    points_bottom = concat(points_bottom, [[R * cos(i * pi / 3), R * sin(i * pi / 3), 0]]);
  }
  // Top face (z=5.3)
  points_top = [];
  for (i = [0 : 5]) {
    points_top = concat(points_top, [[R * cos(i * pi / 3), R * sin(i * pi / 3), 5.3]]);
  }
  
  // Combine points
  all_points = concat(points_bottom, points_top);
  
  // Define faces for polyhedron
  // Indices: 0-5 are bottom, 6-11 are top
  faces = [];
  
  // Bottom face
  faces = concat(faces, [[0, 1, 2, 3, 4, 5]]);
  // Top face
  faces = concat(faces, [[6, 7, 8, 9, 10, 11]]);
  // Side faces
  for (i = [0 : 5]) {
    // Connect vertex i (bottom) to i (top) and i+1 (top) and i+1 (bottom)
    faces = concat(faces, [[i, i + 1, i + 1 + 6, i + 6]]);
  }
  
  // Draw hexagonal head
  translate([0, 0, 0])
  polyhedron(points = all_points, faces = faces);
  
  // Shank
  // Diameter = 8mm
  // Length = 30mm
  // Top at z=0, Bottom at z=-30
  
  translate([0, 0, -30])
  cylinder(d = 8, h = 30, center = false);
}

bolt();
i2 render_error render →
render_error
27.5s · 1267/3037t
openscad stl render failed (exit 1): ERROR: Parser error: syntax error in file ../../../../../tmp/render-SHdhmn/input.scad, line 6
Can't parse file '/tmp/render-SHdhmn/input.scad'!

diff vs i1: +28/-50
- module bolt() {
-   // Hexagonal Head
-   // Across flats = 13mm -> Circumradius = 13 / (2 * cos(30deg))
-   // Head height = 5.3mm
-   // Head bottom at z=0
-   
-   R = 13 / (2 * cos(pi / 6)); // Circumradius
-   
-   // Define vertices for hexagonal prism
-   // Bottom face (z=0)
-   points_bottom = [];
-   for (i = [0 : 5]) {
-     points_bottom = concat(points_bottom, [[R * cos(i * pi / 3), R * sin(i * pi / 3), 0]]);
-   }
-   // Top face (z=5.3)
-   points_top = [];
-   for (i = [0 : 5]) {
-     points_top = concat(points_top, [[R * cos(i * pi / 3), R * sin(i * pi / 3), 5.3]]);
-   }
-   
-   // Combine points
-   all_points = concat(points_bottom, points_top);
-   
-   // Define faces for polyhedron
-   // Indices: 0-5 are bottom, 6-11 are top
-   faces = [];
-   
-   // Bottom face
-   faces = concat(faces, [[0, 1, 2, 3, 4, 5]]);
-   // Top face
-   faces = concat(faces, [[6, 7, 8, 9, 10, 11]]);
-   // Side faces
-   for (i = [0 : 5]) {
-     // Connect vertex i (bottom) to i (top) and i+1 (top) and i+1 (bottom)
-     faces = concat(faces, [[i, i + 1, i + 1 + 6, i + 6]]);
-   }
-   
-   // Draw hexagonal head
-   translate([0, 0, 0])
-   polyhedron(points = all_points, faces = faces);
-   
-   // Shank
-   // Diameter = 8mm
-   // Length = 30mm
-   // Top at z=0, Bottom at z=-30
-   
-   translate([0, 0, -30])
-   cylinder(d = 8, h = 30, center = false);
- }
+ // Hexagonal Head
+ // Across flats = 13mm -> Circumradius = 13 / (2 * cos(30deg))
+ // Head height = 5.3mm
+ // Head bottom at z=0
  
- bolt();
+ R = 13 / (2 * cos(30 deg));
+ 
+ // Define vertices for hexagonal prism
+ points = [
+     [R, 0],
+     [R * cos(60 deg), R * sin(60 deg)],
+     [R * cos(120 deg), R * sin(120 deg)],
+     [R * cos(180 deg), R * sin(180 deg)],
+     [R * cos(240 deg), R * sin(240 deg)],
+     [R * cos(300 deg), R * sin(300 deg)]
+ ];
+ 
+ // Extrude to height 5.3mm
+ // This ensures the hexagonal prism shape is correct
+ translate([0, 0, 0])
+ linear_extrude(height = 5.3)
+ polygon(points);
+ 
+ // Shank
+ // Diameter = 8mm
+ // Length = 30mm
+ // Top at z=0, Bottom at z=-30
+ translate([0, 0, -30])
+ cylinder(d = 8, h = 30, center = false);
SCAD (29 lines)
// Hexagonal Head
// Across flats = 13mm -> Circumradius = 13 / (2 * cos(30deg))
// Head height = 5.3mm
// Head bottom at z=0

R = 13 / (2 * cos(30 deg));

// Define vertices for hexagonal prism
points = [
    [R, 0],
    [R * cos(60 deg), R * sin(60 deg)],
    [R * cos(120 deg), R * sin(120 deg)],
    [R * cos(180 deg), R * sin(180 deg)],
    [R * cos(240 deg), R * sin(240 deg)],
    [R * cos(300 deg), R * sin(300 deg)]
];

// Extrude to height 5.3mm
// This ensures the hexagonal prism shape is correct
translate([0, 0, 0])
linear_extrude(height = 5.3)
polygon(points);

// Shank
// Diameter = 8mm
// Length = 30mm
// Top at z=0, Bottom at z=-30
translate([0, 0, -30])
cylinder(d = 8, h = 30, center = false);
i3 render_error render →
render_error
23.2s · 584/2607t
openscad stl render failed (exit 1): ERROR: Parser error: syntax error in file ../../../../../tmp/render-ze0SQN/input.scad, line 2
Can't parse file '/tmp/render-ze0SQN/input.scad'!

diff vs i2: +5/-16
  // Hexagonal Head
- // Across flats = 13mm -> Circumradius = 13 / (2 * cos(30deg))
- // Head height = 5.3mm
- // Head bottom at z=0
- 
  R = 13 / (2 * cos(30 deg));
+ H = 5.3;
  
- // Define vertices for hexagonal prism
- points = [
+ translate([0, 0, 0])
+ linear_extrude(height = H)
+ polygon([
      [R, 0],
      [R * cos(60 deg), R * sin(60 deg)],
      [R * cos(120 deg), R * sin(120 deg)],
      [R * cos(180 deg), R * sin(180 deg)],
      [R * cos(240 deg), R * sin(240 deg)],
      [R * cos(300 deg), R * sin(300 deg)]
- ];
+ ]);
  
- // Extrude to height 5.3mm
- // This ensures the hexagonal prism shape is correct
- translate([0, 0, 0])
- linear_extrude(height = 5.3)
- polygon(points);
- 
  // Shank
- // Diameter = 8mm
- // Length = 30mm
- // Top at z=0, Bottom at z=-30
  translate([0, 0, -30])
  cylinder(d = 8, h = 30, center = false);
SCAD (18 lines)
// Hexagonal Head
R = 13 / (2 * cos(30 deg));
H = 5.3;

translate([0, 0, 0])
linear_extrude(height = H)
polygon([
    [R, 0],
    [R * cos(60 deg), R * sin(60 deg)],
    [R * cos(120 deg), R * sin(120 deg)],
    [R * cos(180 deg), R * sin(180 deg)],
    [R * cos(240 deg), R * sin(240 deg)],
    [R * cos(300 deg), R * sin(300 deg)]
]);

// Shank
translate([0, 0, -30])
cylinder(d = 8, h = 30, center = false);