
2d_3d
通过分析物体的三个正交视图,使用Claude AI生成STL格式的3D模型。
Repository Info
About This Server
通过分析物体的三个正交视图,使用Claude AI生成STL格式的3D模型。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
2D to 3D Model Generator
This project uses Claude AI to analyze three orthographic views of an object and generate a 3D model in STL format using OpenSCAD.
Test Example
Input Images
The project includes three test images in sample_images/ showing different views of a mechanical part:
-
Front/Side View (
side1.jpg, 13KB):- Height: 75 units
- Width: 50 units
- Features a rounded corner (R35) on the top right
- Contains horizontal section markers
-
Top/Bottom View (
side2.jpg, 11KB):- Width: 50 units
- Height: 35 units (partial)
- Shows vertical dividing line
- Contains corresponding section markers
-
Side View with Hole (
side3.jpg, 17KB):- Height: 75 units
- Width: 60 units
- Features a circular hole (Ø25 units)
- Shows section markers
Generated 3D Model
The system generates three output files in the output/ directory:
-
OpenSCAD Source (
model.scad, 645B):- Contains the parametric 3D model definition
- Uses CSG operations for the main shape
- Implements the rounded corner and cylindrical hole
-
STL Model (
output.stl, 21KB):- Final 3D model ready for viewing or 3D printing
- Represents a block with dimensions: 60x50x75 units
- Features:
- Rounded corner (R35) on one edge
- Cylindrical hole (Ø25) through part of the body
-
Dimensions File (
output.brep):- Contains the extracted dimensions in text format
- Records width: 60, height: 75, depth: 50
Setup and Usage
- Install dependencies:
pip install -r requirements.txt
-
Install OpenSCAD from https://openscad.org/downloads.html
-
Set up your environment variables:
ANTHROPIC_API_KEY=your_api_key_here
- Run the test script:
python test_generation.py
The script will:
- Load the three sample images
- Send them to Claude for analysis
- Generate OpenSCAD code based on the analysis
- Create an STL file using OpenSCAD
Project Structure
.
├── sample_images/ # Input test images
│ ├── side1.jpg # Front/Side view
│ ├── side2.jpg # Top/Bottom view
│ └── side3.jpg # Side view with hole
├── output/ # Generated files
│ ├── model.scad # OpenSCAD source
│ ├── output.stl # 3D model
│ └── output.brep # Dimensions
├── claude_mcp_builder.py # Main implementation
├── test_generation.py # Test script
└── requirements.txt # Python dependencies
Dependencies
- FastAPI
- Uvicorn
- Python-multipart
- Python-dotenv
- Anthropic
- OpenSCAD (external software)
Viewing the 3D Model
You can view the generated STL file using:
- OpenSCAD itself
- Online viewers like ViewSTL
- 3D printing slicers like Cura or PrusaSlicer
- CAD software like FreeCAD or Fusion 360
Quick Start
Clone the repository
git clone https://github.com/skylersaucedo/2d_3dInstall dependencies
cd 2d_3d
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.