vibe-openscad

tier-2-hex-bolt / gemini-3.1-flash-lite-preview

6 run / 累計 14.7s / 累計 $0.0011

gemini flash-lite 3.1 preview bare

bare (provider default effort)

run detail →
render
bare render of tier-2-hex-bolt
loading STL…
success 2.2s · 173/206t · <$0.0001
SCAD (20 lines)
// M8 Hex Bolt (simplified)

// Dimensions
head_af = 13;      // Across-flats
head_height = 5.3;
shank_dia = 8;
shank_len = 30;

// Calculate radius of circumscribed circle for hexagon
// r = (across-flats / 2) / cos(30°) = (across-flats / 2) / (sqrt(3)/2) = across-flats / sqrt(3)
hex_radius = head_af / sqrt(3);

union() {
    // Hexagonal head
    cylinder(r = hex_radius, h = head_height, $fn = 6);
    
    // Shank
    translate([0, 0, -shank_len])
        cylinder(d = shank_dia, h = shank_len, $fn = 50);
}
パラメータ (4)
スライダを動かすと openscad-wasm で再レンダリング

prompt

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

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

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

variant: thinking

off success
off
2.5s · 173/154t · <$0.0001
SCAD (13 lines)
// M8 六角ボルト (ねじ山省略モデル)

$fn = 64;

// 頭部 (六角柱)
// 対辺距離(across-flats) 13mm
// 外接円半径 = 13 / sqrt(3)
cylinder(r = 13 / sqrt(3), h = 5.3, $fn = 6);

// シャンク (円柱)
// 直径 8mm (半径 4mm)、長さ 30mm、Z<0側へ配置
translate([0, 0, -30])
    cylinder(r = 4, h = 30);
adaptivenot run
dynamic (default) success
dynamic
2.2s · 173/206t · <$0.0001
SCAD (20 lines)
// M8 Hex Bolt (simplified)

// Dimensions
head_af = 13;      // Across-flats
head_height = 5.3;
shank_dia = 8;
shank_len = 30;

// Calculate radius of circumscribed circle for hexagon
// r = (across-flats / 2) / cos(30°) = (across-flats / 2) / (sqrt(3)/2) = across-flats / sqrt(3)
hex_radius = head_af / sqrt(3);

union() {
    // Hexagonal head
    cylinder(r = hex_radius, h = head_height, $fn = 6);
    
    // Shank
    translate([0, 0, -shank_len])
        cylinder(d = shank_dia, h = shank_len, $fn = 50);
}

iteration: iter-png

i1 success
iter 1
3.0s · 1511/229t · $0.0002
diff vs bare: +6/-6
- // M8 Hex Bolt (simplified)
+ // M8 Hex Bolt (corrected)
  
  // Dimensions
- head_af = 13;      // Across-flats
+ head_af = 13;      // Across-flats (二面幅)
  head_height = 5.3;
  shank_dia = 8;
  shank_len = 30;
  
- // Calculate radius of circumscribed circle for hexagon
- // r = (across-flats / 2) / cos(30°) = (across-flats / 2) / (sqrt(3)/2) = across-flats / sqrt(3)
+ // cylinder(..., $fn=6) を使用する場合、radius は「外接円の半径」を指定する必要があります。
+ // 対辺距離(head_af)の六角形において、外接円の半径 r は head_af / sqrt(3) です。
  hex_radius = head_af / sqrt(3);
  
  union() {
-     // Hexagonal head
+     // 頭部の底面を z=0 に配置
      cylinder(r = hex_radius, h = head_height, $fn = 6);
      
-     // Shank
+     // シャンクを z<0 側に配置
      translate([0, 0, -shank_len])
          cylinder(d = shank_dia, h = shank_len, $fn = 50);
  }
SCAD (20 lines)
// M8 Hex Bolt (corrected)

// Dimensions
head_af = 13;      // Across-flats (二面幅)
head_height = 5.3;
shank_dia = 8;
shank_len = 30;

// cylinder(..., $fn=6) を使用する場合、radius は「外接円の半径」を指定する必要があります。
// 対辺距離(head_af)の六角形において、外接円の半径 r は head_af / sqrt(3) です。
hex_radius = head_af / sqrt(3);

union() {
    // 頭部の底面を z=0 に配置
    cylinder(r = hex_radius, h = head_height, $fn = 6);
    
    // シャンクを z<0 側に配置
    translate([0, 0, -shank_len])
        cylinder(d = shank_dia, h = shank_len, $fn = 50);
}
i2 success
iter 2
2.3s · 1534/274t · $0.0003
diff vs i1: +8/-7
- // M8 Hex Bolt (corrected)
+ // M8 Hex Bolt
+ // 寸法:二面幅13mm、頭部高さ5.3mm、シャンク径8mm、長さ30mm
+ // 配置:頭部底面が z=0、シャンクが z<0 方向
  
- // Dimensions
- head_af = 13;      // Across-flats (二面幅)
+ head_af = 13;
  head_height = 5.3;
  shank_dia = 8;
  shank_len = 30;
  
- // cylinder(..., $fn=6) を使用する場合、radius は「外接円の半径」を指定する必要があります。
- // 対辺距離(head_af)の六角形において、外接円の半径 r は head_af / sqrt(3) です。
+ // cylinder(..., $fn=6) を使用する場合の半径 r = (二面幅 / 2) / cos(180/6)
+ // つまり r = (head_af / 2) / (sqrt(3)/2) = head_af / sqrt(3)
  hex_radius = head_af / sqrt(3);
  
  union() {
-     // 頭部の底面を z=0 に配置
+     // 頭部: z=0 から z=5.3 まで
      cylinder(r = hex_radius, h = head_height, $fn = 6);
      
-     // シャンクを z<0 側に配置
+     // シャンク: z=0 から z=-30 まで
      translate([0, 0, -shank_len])
          cylinder(d = shank_dia, h = shank_len, $fn = 50);
  }
SCAD (21 lines)
// M8 Hex Bolt
// 寸法:二面幅13mm、頭部高さ5.3mm、シャンク径8mm、長さ30mm
// 配置:頭部底面が z=0、シャンクが z<0 方向

head_af = 13;
head_height = 5.3;
shank_dia = 8;
shank_len = 30;

// cylinder(..., $fn=6) を使用する場合の半径 r = (二面幅 / 2) / cos(180/6)
// つまり r = (head_af / 2) / (sqrt(3)/2) = head_af / sqrt(3)
hex_radius = head_af / sqrt(3);

union() {
    // 頭部: z=0 から z=5.3 まで
    cylinder(r = hex_radius, h = head_height, $fn = 6);
    
    // シャンク: z=0 から z=-30 まで
    translate([0, 0, -shank_len])
        cylinder(d = shank_dia, h = shank_len, $fn = 50);
}
i3 success
iter 3
2.6s · 1579/308t · $0.0003
diff vs i2: +3/-1
  // M8 Hex Bolt
  // 寸法:二面幅13mm、頭部高さ5.3mm、シャンク径8mm、長さ30mm
  // 配置:頭部底面が z=0、シャンクが z<0 方向
  
  head_af = 13;
  head_height = 5.3;
  shank_dia = 8;
  shank_len = 30;
  
  // cylinder(..., $fn=6) を使用する場合の半径 r = (二面幅 / 2) / cos(180/6)
  // つまり r = (head_af / 2) / (sqrt(3)/2) = head_af / sqrt(3)
  hex_radius = head_af / sqrt(3);
  
  union() {
      // 頭部: z=0 から z=5.3 まで
+     // hex_radius の面が正しく向き合うよう、必要に応じて rotate を加える
+     rotate([0, 0, 30])
      cylinder(r = hex_radius, h = head_height, $fn = 6);
      
      // シャンク: z=0 から z=-30 まで
      translate([0, 0, -shank_len])
-         cylinder(d = shank_dia, h = shank_len, $fn = 50);
+         cylinder(d = shank_dia, h = shank_len, $fn = 60);
  }
SCAD (23 lines)
// M8 Hex Bolt
// 寸法:二面幅13mm、頭部高さ5.3mm、シャンク径8mm、長さ30mm
// 配置:頭部底面が z=0、シャンクが z<0 方向

head_af = 13;
head_height = 5.3;
shank_dia = 8;
shank_len = 30;

// cylinder(..., $fn=6) を使用する場合の半径 r = (二面幅 / 2) / cos(180/6)
// つまり r = (head_af / 2) / (sqrt(3)/2) = head_af / sqrt(3)
hex_radius = head_af / sqrt(3);

union() {
    // 頭部: z=0 から z=5.3 まで
    // hex_radius の面が正しく向き合うよう、必要に応じて rotate を加える
    rotate([0, 0, 30])
    cylinder(r = hex_radius, h = head_height, $fn = 6);
    
    // シャンク: z=0 から z=-30 まで
    translate([0, 0, -shank_len])
        cylinder(d = shank_dia, h = shank_len, $fn = 60);
}