—
tier-2-l-bracket / gemini-2.5-pro
5 run / 累計 335.9s / 累計 $0.0463
gemini pro 2.5 bare
bare (provider default effort)
run detail → render
// ===============================================
// Parameters
// ===============================================
// --- Bracket Dimensions ---
width = 50; // Width on X-axis
depth = 40; // Horizontal flange depth on Y-axis
height = 40; // Vertical flange height on Z-axis
thickness = 3; // Thickness of the flanges
// --- M4 Countersunk Hole Dimensions ---
hole_dia = 4.5; // Through-hole diameter
cs_dia = 8; // Countersink top diameter
cs_depth = 2; // Countersink depth
// --- Hole Positioning ---
// X-coordinates for the two holes on each flange
hole_pos_x_list = [10, width - 10];
// Y-coordinate for holes on the horizontal flange (centerline)
hole_pos_y = depth / 2;
// Z-coordinate for holes on the vertical flange (centerline)
hole_pos_z = height / 2;
// --- Rendering Quality ---
$fn = 64;
// ===============================================
// Model
// ===============================================
difference() {
// 1. Create the main body of the L-bracket
// The inner corner is at the origin [0, 0, 0]
union() {
// Horizontal flange, extending in +Y direction
cube([width, depth, thickness]);
// Vertical flange, extending in +Z direction
cube([width, thickness, height]);
}
// 2. Create and subtract the countersunk holes
// --- Holes on the horizontal flange ---
// The countersinks face downwards (towards -Z)
for (x_pos = hole_pos_x_list) {
// Position the cutter at the top surface (z=thickness) and rotate it to face down
translate([x_pos, hole_pos_y, thickness])
rotate(a=[180, 0, 0]) {
// A small epsilon for clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole
cylinder(h = thickness + eps, d = hole_dia);
}
}
// --- Holes on the vertical flange ---
// The countersinks face forwards (towards -Y)
for (x_pos = hole_pos_x_list) {
// Position the cutter at the front surface (y=thickness) and rotate it to face forward
translate([x_pos, thickness, hole_pos_z])
rotate(a=[90, 0, 0]) {
// A small epsilon for clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole
cylinder(h = thickness + eps, d = hole_dia);
}
}
} パラメータ (7) —
スライダを動かすと openscad-wasm で再レンダリング
prompt
OpenSCAD で、L 字に折れた金具(L-bracket)を作ってください。 形状: - 水平面と垂直面の 2 つのフランジが直角に繋がっている - 水平面は 50mm × 40mm(幅 × 奥行き) - 垂直面は 50mm × 40mm(幅 × 高さ) - 板厚はどちらも 3mm - 内側コーナーが原点になるように配置(水平面は +Y 方向、垂直面は +Z 方向に伸びる) 皿穴(countersunk holes): - 各面に 2 個ずつ、合計 4 個 - M4 ねじ用(貫通穴 Φ4.5mm + 皿座面 Φ8mm × 深さ 2mm) - 各面の中心線上で、面の縁から 10mm 内側、左右対称に 2 個並べる - 皿座面は外側(ボルト頭が当たる側)に向ける 完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。
variant: thinking
—
SCAD (74 lines)
// ===============================================
// Parameters
// ===============================================
// --- Bracket Dimensions ---
width = 50; // Width on X-axis
depth = 40; // Horizontal flange depth on Y-axis
height = 40; // Vertical flange height on Z-axis
thickness = 3; // Thickness of the flanges
// --- M4 Countersunk Hole Dimensions ---
hole_dia = 4.5; // Through-hole diameter
cs_dia = 8; // Countersink top diameter
cs_depth = 2; // Countersink depth
// --- Hole Positioning ---
// X-coordinates for the two holes on each flange
hole_pos_x_list = [10, width - 10];
// Y-coordinate for holes on the horizontal flange (centerline)
hole_pos_y = depth / 2;
// Z-coordinate for holes on the vertical flange (centerline)
hole_pos_z = height / 2;
// --- Rendering Quality ---
$fn = 64;
// ===============================================
// Model
// ===============================================
difference() {
// 1. Create the main body of the L-bracket
// The inner corner is at the origin [0, 0, 0]
union() {
// Horizontal flange, extending in +Y direction
cube([width, depth, thickness]);
// Vertical flange, extending in +Z direction
cube([width, thickness, height]);
}
// 2. Create and subtract the countersunk holes
// --- Holes on the horizontal flange ---
// The countersinks face downwards (towards -Z)
for (x_pos = hole_pos_x_list) {
// Position the cutter at the top surface (z=thickness) and rotate it to face down
translate([x_pos, hole_pos_y, thickness])
rotate(a=[180, 0, 0]) {
// A small epsilon for clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole
cylinder(h = thickness + eps, d = hole_dia);
}
}
// --- Holes on the vertical flange ---
// The countersinks face forwards (towards -Y)
for (x_pos = hole_pos_x_list) {
// Position the cutter at the front surface (y=thickness) and rotate it to face forward
translate([x_pos, thickness, hole_pos_z])
rotate(a=[90, 0, 0]) {
// A small epsilon for clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole
cylinder(h = thickness + eps, d = hole_dia);
}
}
} iteration: iter-png
diff vs bare: +8/-6
// ===============================================
// Parameters
// ===============================================
// --- Bracket Dimensions ---
width = 50; // Width on X-axis
depth = 40; // Horizontal flange depth on Y-axis
height = 40; // Vertical flange height on Z-axis
thickness = 3; // Thickness of the flanges
// --- M4 Countersunk Hole Dimensions ---
hole_dia = 4.5; // Through-hole diameter
cs_dia = 8; // Countersink top diameter
cs_depth = 2; // Countersink depth
// --- Hole Positioning ---
// X-coordinates for the two holes on each flange
hole_pos_x_list = [10, width - 10];
// Y-coordinate for holes on the horizontal flange (centerline)
hole_pos_y = depth / 2;
// Z-coordinate for holes on the vertical flange (centerline)
hole_pos_z = height / 2;
// --- Rendering Quality ---
$fn = 64;
// ===============================================
// Model
// ===============================================
difference() {
// 1. Create the main body of the L-bracket
// The inner corner is at the origin [0, 0, 0]
union() {
// Horizontal flange, extending in +Y direction
cube([width, depth, thickness]);
// Vertical flange, extending in +Z direction
cube([width, thickness, height]);
}
// 2. Create and subtract the countersunk holes
// --- Holes on the horizontal flange ---
- // The countersinks face downwards (towards -Z)
+ // The countersinks are on the top surface (z=thickness), facing downwards.
for (x_pos = hole_pos_x_list) {
- // Position the cutter at the top surface (z=thickness) and rotate it to face down
+ // Position the cutter at the top surface (z=thickness) and rotate it to point inwards (-Z)
translate([x_pos, hole_pos_y, thickness])
rotate(a=[180, 0, 0]) {
// A small epsilon for clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole
cylinder(h = thickness + eps, d = hole_dia);
}
}
// --- Holes on the vertical flange ---
- // The countersinks face forwards (towards -Y)
+ // The countersinks are on the outer surface (y=0), facing inwards.
for (x_pos = hole_pos_x_list) {
- // Position the cutter at the front surface (y=thickness) and rotate it to face forward
- translate([x_pos, thickness, hole_pos_z])
- rotate(a=[90, 0, 0]) {
+ // [FIX] Position the cutter at the outer surface (y=0) and rotate it to point inwards (+Y).
+ // The original code placed it at the inner surface (y=thickness) and pointed it the wrong way,
+ // resulting in the countersink being on the inside corner as seen in the image.
+ translate([x_pos, 0, hole_pos_z])
+ rotate(a=[-90, 0, 0]) { // Rotate cutter's Z-axis to align with world's +Y axis
// A small epsilon for clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole
cylinder(h = thickness + eps, d = hole_dia);
}
}
}
SCAD (76 lines)
// ===============================================
// Parameters
// ===============================================
// --- Bracket Dimensions ---
width = 50; // Width on X-axis
depth = 40; // Horizontal flange depth on Y-axis
height = 40; // Vertical flange height on Z-axis
thickness = 3; // Thickness of the flanges
// --- M4 Countersunk Hole Dimensions ---
hole_dia = 4.5; // Through-hole diameter
cs_dia = 8; // Countersink top diameter
cs_depth = 2; // Countersink depth
// --- Hole Positioning ---
// X-coordinates for the two holes on each flange
hole_pos_x_list = [10, width - 10];
// Y-coordinate for holes on the horizontal flange (centerline)
hole_pos_y = depth / 2;
// Z-coordinate for holes on the vertical flange (centerline)
hole_pos_z = height / 2;
// --- Rendering Quality ---
$fn = 64;
// ===============================================
// Model
// ===============================================
difference() {
// 1. Create the main body of the L-bracket
// The inner corner is at the origin [0, 0, 0]
union() {
// Horizontal flange, extending in +Y direction
cube([width, depth, thickness]);
// Vertical flange, extending in +Z direction
cube([width, thickness, height]);
}
// 2. Create and subtract the countersunk holes
// --- Holes on the horizontal flange ---
// The countersinks are on the top surface (z=thickness), facing downwards.
for (x_pos = hole_pos_x_list) {
// Position the cutter at the top surface (z=thickness) and rotate it to point inwards (-Z)
translate([x_pos, hole_pos_y, thickness])
rotate(a=[180, 0, 0]) {
// A small epsilon for clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole
cylinder(h = thickness + eps, d = hole_dia);
}
}
// --- Holes on the vertical flange ---
// The countersinks are on the outer surface (y=0), facing inwards.
for (x_pos = hole_pos_x_list) {
// [FIX] Position the cutter at the outer surface (y=0) and rotate it to point inwards (+Y).
// The original code placed it at the inner surface (y=thickness) and pointed it the wrong way,
// resulting in the countersink being on the inside corner as seen in the image.
translate([x_pos, 0, hole_pos_z])
rotate(a=[-90, 0, 0]) { // Rotate cutter's Z-axis to align with world's +Y axis
// A small epsilon for clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole
cylinder(h = thickness + eps, d = hole_dia);
}
}
}
diff vs i1: +35/-23
// ===============================================
// Parameters
// ===============================================
// --- Bracket Dimensions ---
width = 50; // Width on X-axis
depth = 40; // Horizontal flange depth on Y-axis
height = 40; // Vertical flange height on Z-axis
thickness = 3; // Thickness of the flanges
// --- M4 Countersunk Hole Dimensions ---
hole_dia = 4.5; // Through-hole diameter
cs_dia = 8; // Countersink top diameter
cs_depth = 2; // Countersink depth
// --- Hole Positioning ---
// X-coordinates for the two holes on each flange
hole_pos_x_list = [10, width - 10];
// Y-coordinate for holes on the horizontal flange (centerline)
hole_pos_y = depth / 2;
// Z-coordinate for holes on the vertical flange (centerline)
hole_pos_z = height / 2;
// --- Rendering Quality ---
$fn = 64;
// ===============================================
+ // Cutter Module Definition
+ // ===============================================
+
+ // Module to create a reusable countersink cutter shape.
+ // The cutter is created along the Z-axis.
+ module countersink_cutter(length) {
+ // A small epsilon to ensure clean subtraction
+ eps = 0.1;
+
+ // Countersink cone (frustum)
+ cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
+
+ // Through-hole body
+ // This cylinder starts at the same base as the cone (z=0)
+ // to ensure they form a single solid for subtraction.
+ cylinder(h = length + eps, d = hole_dia);
+ }
+
+
+ // ===============================================
// Model
// ===============================================
+
difference() {
// 1. Create the main body of the L-bracket
- // The inner corner is at the origin [0, 0, 0]
+ // The inner corner is at the origin [0, 0, 0].
union() {
- // Horizontal flange, extending in +Y direction
+ // Horizontal flange: Extends from origin in +Y direction.
+ // Occupies space: x=[0,width], y=[0,depth], z=[0,thickness]
cube([width, depth, thickness]);
- // Vertical flange, extending in +Z direction
+ // Vertical flange: Extends from origin in +Z direction.
+ // Occupies space: x=[0,width], y=[0,thickness], z=[0,height]
cube([width, thickness, height]);
}
// 2. Create and subtract the countersunk holes
// --- Holes on the horizontal flange ---
- // The countersinks are on the top surface (z=thickness), facing downwards.
+ // Countersinks are on the outer (top) face, which is the plane z=thickness.
for (x_pos = hole_pos_x_list) {
- // Position the cutter at the top surface (z=thickness) and rotate it to point inwards (-Z)
+ // Move the cutter to the top surface and rotate it to point down (-Z).
translate([x_pos, hole_pos_y, thickness])
rotate(a=[180, 0, 0]) {
- // A small epsilon for clean subtraction
- eps = 0.1;
- // Countersink cone (frustum)
- cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
- // Through-hole
- cylinder(h = thickness + eps, d = hole_dia);
+ countersink_cutter(length = thickness);
}
}
- // --- Holes on the vertical flange ---
- // The countersinks are on the outer surface (y=0), facing inwards.
+ // --- Holes on the vertical flange (FIXED) ---
+ // Correction: The original model had the countersink on the inner face.
+ // The countersink must be on the outer face (the plane at y=0).
for (x_pos = hole_pos_x_list) {
- // [FIX] Position the cutter at the outer surface (y=0) and rotate it to point inwards (+Y).
- // The original code placed it at the inner surface (y=thickness) and pointed it the wrong way,
- // resulting in the countersink being on the inside corner as seen in the image.
+ // Move the cutter to the outer face (y=0) and rotate it to point inwards (+Y).
translate([x_pos, 0, hole_pos_z])
- rotate(a=[-90, 0, 0]) { // Rotate cutter's Z-axis to align with world's +Y axis
- // A small epsilon for clean subtraction
- eps = 0.1;
- // Countersink cone (frustum)
- cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
- // Through-hole
- cylinder(h = thickness + eps, d = hole_dia);
+ rotate(a=[-90, 0, 0]) {
+ countersink_cutter(length = thickness);
}
}
}
SCAD (88 lines)
// ===============================================
// Parameters
// ===============================================
// --- Bracket Dimensions ---
width = 50; // Width on X-axis
depth = 40; // Horizontal flange depth on Y-axis
height = 40; // Vertical flange height on Z-axis
thickness = 3; // Thickness of the flanges
// --- M4 Countersunk Hole Dimensions ---
hole_dia = 4.5; // Through-hole diameter
cs_dia = 8; // Countersink top diameter
cs_depth = 2; // Countersink depth
// --- Hole Positioning ---
// X-coordinates for the two holes on each flange
hole_pos_x_list = [10, width - 10];
// Y-coordinate for holes on the horizontal flange (centerline)
hole_pos_y = depth / 2;
// Z-coordinate for holes on the vertical flange (centerline)
hole_pos_z = height / 2;
// --- Rendering Quality ---
$fn = 64;
// ===============================================
// Cutter Module Definition
// ===============================================
// Module to create a reusable countersink cutter shape.
// The cutter is created along the Z-axis.
module countersink_cutter(length) {
// A small epsilon to ensure clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole body
// This cylinder starts at the same base as the cone (z=0)
// to ensure they form a single solid for subtraction.
cylinder(h = length + eps, d = hole_dia);
}
// ===============================================
// Model
// ===============================================
difference() {
// 1. Create the main body of the L-bracket
// The inner corner is at the origin [0, 0, 0].
union() {
// Horizontal flange: Extends from origin in +Y direction.
// Occupies space: x=[0,width], y=[0,depth], z=[0,thickness]
cube([width, depth, thickness]);
// Vertical flange: Extends from origin in +Z direction.
// Occupies space: x=[0,width], y=[0,thickness], z=[0,height]
cube([width, thickness, height]);
}
// 2. Create and subtract the countersunk holes
// --- Holes on the horizontal flange ---
// Countersinks are on the outer (top) face, which is the plane z=thickness.
for (x_pos = hole_pos_x_list) {
// Move the cutter to the top surface and rotate it to point down (-Z).
translate([x_pos, hole_pos_y, thickness])
rotate(a=[180, 0, 0]) {
countersink_cutter(length = thickness);
}
}
// --- Holes on the vertical flange (FIXED) ---
// Correction: The original model had the countersink on the inner face.
// The countersink must be on the outer face (the plane at y=0).
for (x_pos = hole_pos_x_list) {
// Move the cutter to the outer face (y=0) and rotate it to point inwards (+Y).
translate([x_pos, 0, hole_pos_z])
rotate(a=[-90, 0, 0]) {
countersink_cutter(length = thickness);
}
}
}
diff vs i2: +9/-12
// ===============================================
// Parameters
// ===============================================
// --- Bracket Dimensions ---
width = 50; // Width on X-axis
depth = 40; // Horizontal flange depth on Y-axis
height = 40; // Vertical flange height on Z-axis
thickness = 3; // Thickness of the flanges
// --- M4 Countersunk Hole Dimensions ---
hole_dia = 4.5; // Through-hole diameter
cs_dia = 8; // Countersink top diameter
cs_depth = 2; // Countersink depth
// --- Hole Positioning ---
// X-coordinates for the two holes on each flange
hole_pos_x_list = [10, width - 10];
// Y-coordinate for holes on the horizontal flange (centerline)
hole_pos_y = depth / 2;
// Z-coordinate for holes on the vertical flange (centerline)
hole_pos_z = height / 2;
// --- Rendering Quality ---
$fn = 64;
// ===============================================
// Cutter Module Definition
// ===============================================
// Module to create a reusable countersink cutter shape.
- // The cutter is created along the Z-axis.
+ // The cutter is created pointing along the +Z axis.
module countersink_cutter(length) {
// A small epsilon to ensure clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole body
// This cylinder starts at the same base as the cone (z=0)
- // to ensure they form a single solid for subtraction.
+ // to form a single solid shape for subtraction.
cylinder(h = length + eps, d = hole_dia);
}
// ===============================================
// Model
// ===============================================
difference() {
// 1. Create the main body of the L-bracket
- // The inner corner is at the origin [0, 0, 0].
+ // The inner corner is placed at the origin [0, 0, 0].
union() {
// Horizontal flange: Extends from origin in +Y direction.
- // Occupies space: x=[0,width], y=[0,depth], z=[0,thickness]
cube([width, depth, thickness]);
// Vertical flange: Extends from origin in +Z direction.
- // Occupies space: x=[0,width], y=[0,thickness], z=[0,height]
cube([width, thickness, height]);
}
// 2. Create and subtract the countersunk holes
- // --- Holes on the horizontal flange ---
- // Countersinks are on the outer (top) face, which is the plane z=thickness.
+ // Holes on the horizontal flange.
+ // The outer face is the top surface (z = thickness).
for (x_pos = hole_pos_x_list) {
- // Move the cutter to the top surface and rotate it to point down (-Z).
+ // Move cutter to the top surface and rotate to point down (-Z direction).
translate([x_pos, hole_pos_y, thickness])
rotate(a=[180, 0, 0]) {
countersink_cutter(length = thickness);
}
}
- // --- Holes on the vertical flange (FIXED) ---
- // Correction: The original model had the countersink on the inner face.
- // The countersink must be on the outer face (the plane at y=0).
+ // Holes on the vertical flange.
+ // The outer face is the front surface (y = 0).
for (x_pos = hole_pos_x_list) {
- // Move the cutter to the outer face (y=0) and rotate it to point inwards (+Y).
+ // Move cutter to the front surface and rotate to point inwards (+Y direction).
translate([x_pos, 0, hole_pos_z])
rotate(a=[-90, 0, 0]) {
countersink_cutter(length = thickness);
}
}
}
SCAD (85 lines)
// ===============================================
// Parameters
// ===============================================
// --- Bracket Dimensions ---
width = 50; // Width on X-axis
depth = 40; // Horizontal flange depth on Y-axis
height = 40; // Vertical flange height on Z-axis
thickness = 3; // Thickness of the flanges
// --- M4 Countersunk Hole Dimensions ---
hole_dia = 4.5; // Through-hole diameter
cs_dia = 8; // Countersink top diameter
cs_depth = 2; // Countersink depth
// --- Hole Positioning ---
// X-coordinates for the two holes on each flange
hole_pos_x_list = [10, width - 10];
// Y-coordinate for holes on the horizontal flange (centerline)
hole_pos_y = depth / 2;
// Z-coordinate for holes on the vertical flange (centerline)
hole_pos_z = height / 2;
// --- Rendering Quality ---
$fn = 64;
// ===============================================
// Cutter Module Definition
// ===============================================
// Module to create a reusable countersink cutter shape.
// The cutter is created pointing along the +Z axis.
module countersink_cutter(length) {
// A small epsilon to ensure clean subtraction
eps = 0.1;
// Countersink cone (frustum)
cylinder(h = cs_depth, d1 = cs_dia, d2 = hole_dia);
// Through-hole body
// This cylinder starts at the same base as the cone (z=0)
// to form a single solid shape for subtraction.
cylinder(h = length + eps, d = hole_dia);
}
// ===============================================
// Model
// ===============================================
difference() {
// 1. Create the main body of the L-bracket
// The inner corner is placed at the origin [0, 0, 0].
union() {
// Horizontal flange: Extends from origin in +Y direction.
cube([width, depth, thickness]);
// Vertical flange: Extends from origin in +Z direction.
cube([width, thickness, height]);
}
// 2. Create and subtract the countersunk holes
// Holes on the horizontal flange.
// The outer face is the top surface (z = thickness).
for (x_pos = hole_pos_x_list) {
// Move cutter to the top surface and rotate to point down (-Z direction).
translate([x_pos, hole_pos_y, thickness])
rotate(a=[180, 0, 0]) {
countersink_cutter(length = thickness);
}
}
// Holes on the vertical flange.
// The outer face is the front surface (y = 0).
for (x_pos = hole_pos_x_list) {
// Move cutter to the front surface and rotate to point inwards (+Y direction).
translate([x_pos, 0, hole_pos_z])
rotate(a=[-90, 0, 0]) {
countersink_cutter(length = thickness);
}
}
}