A minimal implementation of an AI-powered truss analysis tool that demonstrates how to combine LLMs with engineering calculations. This project shows how to create a simple agent that can interpret truss drawings and perform structural analysis.
This implementation uses Claude 3.7 to:
- Extract truss geometry from images
- Perform structural analysis using FEM
- Provide interactive analysis through a chat interface
Simply specify the path to your truss image in simple_truss_agent.py
:
if __name__ == "__main__":
# Specify the image path here - users can easily change this line
image_path = "./images/book_truss.png"
truss_chat(image_path)
Run your code. The agent analyzes the image and extracts the truss geometry, including:
- Node locations
- Element connections
- Applied forces
- Support conditions
- Area (A)
- Young's modulus (E)
Chat with the agent to:
- Run structural analysis
- Modify the truss geometry
- Get detailed results
- Ask engineering questions
-
Install dependencies:
pip install -r requirements.txt
-
Configure your Anthropic API key in
config.py
:ANTHROPIC_API_KEY = "your-api-key-here"
-
Run the application:
python simple_truss_agent.py
The agent can:
- Analyze truss images and extract geometry
- Calculate displacements and stresses
- Answer questions about the analysis results
Example commands:
> Run analysis with E=200e9 Pa and A=0.001 m²
> Increase the height of the truss by 2 meters
> Find the smallest IPE profile we can use, while keeping the stress under 200 MPa
simple_truss_agent.py
: Main application with chat interfacetools.py
: Core functionality for truss analysisconfig.py
: Configuration settingsimages/
: Example truss structure images
- Clear truss image
MIT License - see LICENSE file for details.