Creating a Model Truss Bridge with AI: Difference between revisions

From BITPlan Wiki
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 7: Line 7:


We will use the [https://github.com/WolfgangFahl/nicescad nicescad] webinterface to OpenScad for our design and
We will use the [https://github.com/WolfgangFahl/nicescad nicescad] webinterface to OpenScad for our design and
[https://claude.ai/chat Claude AI] as the AI chat tool.
* [https://chatgpt.com ChatGPT]
* [https://claude.ai/chat Claude AI]  
* [https://chat.deepseek.com/ DeepSeek]
* [https://chat.mistral.ai/chat Mistral]
as the AI chat tools.


First we need a list of prompts that will lead to a proper scad module.
First we need a list of prompts that will lead to a proper scad module.
Note how there area ready made models available at https://www.yeggi.com/q/n+scale+truss+bridge/ and still the AIs behave like stochastical parrots and have no clue what they are doing - see Talk page.
Given the notorious incapability of AI Tools for this kind of task as of 2025-06 we need to be very careful in what
to expect from the AI and what to do our selves.
= Steps =
= Steps =
== Step 1: Create beamAt Module ==
== Step 1: Create polygonAt and beamAt Modules ==
'''Prompt''': Create an OpenSCAD module named beamAt that places a cube beam at a specified 3D position, applies a 3D rotation, and uses given dimensions. Add an example usage rotating the beam 45 degrees around the Z-axis. Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date
'''Prompt''': Create an OpenSCAD module named beamAt that places a cube beam at a specified 3D position x,y,z, applies a 3D rotation rx,ry,rz, and uses given dimensions sx,sy,sz. Add an example usage creating a horizontal and vertical beam. Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date


<source lang="openscad">
<source lang="openscad">
// nicescad truss bridge example
// Prompt:
// see https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI
// Create an OpenSCAD module named `polygonAt` that places a polygon-based beam at a 3D position `x,y,z`,
// Copyright Wolfgang Fahl 2025-06-14
// applies 3D rotation `rx,ry,rz`, and extrudes the polygon with `linear_extrude(height=length)`.
// Prompt: "Create an OpenSCAD module named beamAt that places a cube beam at a specified 3D position, applies a 3D rotation, and uses given dimensions. Add an example usage rotating the beam 45 degrees around the Z-axis. Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date"
// The polygon is defined via `points` and should be extruded symmetrically around its local origin.
module beamAt(position, rotation, dimensions) {
// Define a second module `beamAt(x, y, z, rx, ry, rz, sx, sy, sz)` that creates a centered rectangular beam
  translate(position)
// cross-section of width `sy`, height `sz` and extrudes it along its axis with length `sx`.
    rotate(rotation)
// Add example usage for a horizontal beam (extruded along X) and vertical beam (extruded along Z).
      cube(dimensions);
// Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI
// and // Copyright Wolfgang Fahl with current iso date
 
// https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI
// Copyright Wolfgang Fahl 2025-06-15
 
// place and extrude a 2D polygon at given 3D position and rotation
module polygonAt(x, y, z, rx, ry, rz, length, points) {
    translate([x, y, z])
        rotate([rx, ry, rz])
            translate([0, 0, -length/2])  // center extrusion symmetrically
                linear_extrude(height=length)
                    polygon(points);
}
 
// place a rectangular beam at 3D position with given rotation and dimensions
module beamAt(x, y, z, rx, ry, rz, sx, sy, sz) {
    polygonAt(x, y, z, rx, ry, rz, sx, [
        [-sy/2, -sz/2],
        [ sy/2, -sz/2],
        [ sy/2,  sz/2],
        [-sy/2,  sz/2]
    ]);
}
}


// example usage
l=10; // length
beamAt([10, 5, 0], [0, 0, 45], [40, 3, 3]); // beam at position, rotated 45° on Z-axis
h=1; // height
w=1; // width
// Example usage
// Horizontal beam along X → rotate Z→X
ry=90;
beamAt(
    0, 0, 0,
    0, ry, 0,
    l, w, h
);


// Vertical beam
beamAt(
    -l/2+w/2, 0, l/2,
    0, 0, 0,
    l, w, h 
);
</source>
</source>
[https://nicescad.bitplan.com/design/jv2wuczx Example answer] by [https://chat.deepseek.com Deepseek]
* [https://nicescad.bitplan.com/design/gndcm86s Example answer] by [https://chatgpt.com ChatGPT]
Note that this answer was never created by ChatGPT - there was a loop of a dozen hallucinations and the variables and calculations for the example have been introduced manually after giving up.
 
== Step 2: right triangle ==
'''Prompt''': Based on module <pre>beamAt(x, y, z, rx, ry, rz, sx, sy, sz) {
    translate([x, y, z])
        rotate([rx, ry, rz])
            cube([sx, sy, sz]);
}
 
// Example usage
// horizontal beam
beamAt( 
  0, 0, 0,
  0, 0, 0,
  10, 1, 1); 
// vertical beam
beamAt(
    0, 0, 0,
    0, 270, 0,
  10, 1, 1); </pre>
 
create a rightTriangle function consisting of three beams and allow a positioned/rotated version rightTriangleAt. Add an example usage creating a warren truss pattern. Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date
 


== Step 2: Crude Bridge ==
[https://nicescad.bitplan.com/design/7ecaz67e Example]
'''Prompt''': For a european single track railway bridge - Length: 19.1m - Width: 3.3m - Height: 4.5m - Top beam: 16.2m - we want the Model scale: H0 (1:87) - open scad design. Use the existing beamAt creating the necessary frame spanning the whole way - in reality this could be a valid construction step to allow transport of material, tools and workers.


Use loops to position 6 pairs of 2 beams each with the beamAt function:
== Step 3: Warren Truss pattern ==
- Pair 1: 2 beams spanning the whole bridge horizontally (bottom chords)
'''Prompt''':  For a european single track railway bridge - Length: 19.1m - Width: 3.3m - Height: 4.5m - Top beam: 16.2m - we want the Model scale: H0 (1:87) - open scad design. Use the existing beamAt to create a WarrenTruss
- Pair 2: 2 beams vertically parallel over the first pair at bridge height but shorter (top chords)  
pattern function. The base of the pattern are pairs of right angled triangles which in turn form isosceles triangles with a support beam in the middle.
- Pair 3: 2 beams connecting the lower pair horizontally at bridge ends
- Pair 4: 2 beams connecting the upper pair horizontally at bridge ends
- Pair 5: 2 angular beams connecting left ends of top and bottom chords
- Pair 6: 2 angular beams connecting right ends of top and bottom chords


Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date
Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date

Latest revision as of 07:06, 15 June 2025

We would like to get 3D printer design for a modelTrussBridge Trussbridge1.pngTrussbridge2.pngTrussbridge3.png


We want a design combining a Warren truss pattern on the side with an X Pattern on the top and bottom of the bridge.

We will use the nicescad webinterface to OpenScad for our design and

as the AI chat tools.

First we need a list of prompts that will lead to a proper scad module. Note how there area ready made models available at https://www.yeggi.com/q/n+scale+truss+bridge/ and still the AIs behave like stochastical parrots and have no clue what they are doing - see Talk page.

Given the notorious incapability of AI Tools for this kind of task as of 2025-06 we need to be very careful in what to expect from the AI and what to do our selves.

Steps

Step 1: Create polygonAt and beamAt Modules

Prompt: Create an OpenSCAD module named beamAt that places a cube beam at a specified 3D position x,y,z, applies a 3D rotation rx,ry,rz, and uses given dimensions sx,sy,sz. Add an example usage creating a horizontal and vertical beam. Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date

// Prompt:
// Create an OpenSCAD module named `polygonAt` that places a polygon-based beam at a 3D position `x,y,z`,
// applies 3D rotation `rx,ry,rz`, and extrudes the polygon with `linear_extrude(height=length)`.
// The polygon is defined via `points` and should be extruded symmetrically around its local origin.
// Define a second module `beamAt(x, y, z, rx, ry, rz, sx, sy, sz)` that creates a centered rectangular beam 
// cross-section of width `sy`, height `sz` and extrudes it along its axis with length `sx`.
// Add example usage for a horizontal beam (extruded along X) and vertical beam (extruded along Z).
// Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI
// and // Copyright Wolfgang Fahl with current iso date

// https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI
// Copyright Wolfgang Fahl 2025-06-15

// place and extrude a 2D polygon at given 3D position and rotation
module polygonAt(x, y, z, rx, ry, rz, length, points) {
    translate([x, y, z])
        rotate([rx, ry, rz])
            translate([0, 0, -length/2])  // center extrusion symmetrically
                linear_extrude(height=length)
                    polygon(points);
}

// place a rectangular beam at 3D position with given rotation and dimensions
module beamAt(x, y, z, rx, ry, rz, sx, sy, sz) {
    polygonAt(x, y, z, rx, ry, rz, sx, [
        [-sy/2, -sz/2],
        [ sy/2, -sz/2],
        [ sy/2,  sz/2],
        [-sy/2,  sz/2]
    ]);
}

l=10; // length
h=1; // height
w=1; // width
// Example usage
// Horizontal beam along X → rotate Z→X
ry=90; 
beamAt(
    0, 0, 0,
    0, ry, 0,
    l, w, h
);

// Vertical beam 
beamAt(
    -l/2+w/2, 0, l/2,
    0, 0, 0,
    l, w, h   
);

Note that this answer was never created by ChatGPT - there was a loop of a dozen hallucinations and the variables and calculations for the example have been introduced manually after giving up.

Step 2: right triangle

Prompt: Based on module

beamAt(x, y, z, rx, ry, rz, sx, sy, sz) {
    translate([x, y, z])
        rotate([rx, ry, rz])
            cube([sx, sy, sz]);
}

// Example usage
// horizontal beam
beamAt(  
   0, 0, 0, 
   0, 0, 0, 
  10, 1, 1);   
// vertical beam 
beamAt(
    0, 0, 0,
    0, 270, 0, 
   10, 1, 1); 

create a rightTriangle function consisting of three beams and allow a positioned/rotated version rightTriangleAt. Add an example usage creating a warren truss pattern. Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date


Example

Step 3: Warren Truss pattern

Prompt: For a european single track railway bridge - Length: 19.1m - Width: 3.3m - Height: 4.5m - Top beam: 16.2m - we want the Model scale: H0 (1:87) - open scad design. Use the existing beamAt to create a WarrenTruss pattern function. The base of the pattern are pairs of right angled triangles which in turn form isosceles triangles with a support beam in the middle.

Add a header comment with a link to https://wiki.bitplan.com/index.php/Creating_a_Model_Truss_Bridget_with_AI and // Copyright Wolfgang Fahl with current iso date

References

HAER-Truss-Poster

see HISTORIC AMERICAN EINGINEERIING RECORD