The FreeCAD Agent is an AI-powered automation tool for FreeCAD that enables natural language CAD operations, intelligent batch processing, and seamless integration with engineering analysis workflows.
The FreeCAD Agent is an AI-powered automation tool for FreeCAD that enables natural language CAD operations, intelligent batch processing, and seamless integration with engineering analysis workflows.
# Clone the repository
git clone https://github.com/your-org/digitalmodel.git
cd digitalmodel/agents/freecad
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Basic usage
python run_freecad_agent.py --help
# Show agent capabilities
python run_freecad_agent.py --show-capabilities
# Process single file
python run_freecad_agent.py --file model.FCStd --operation "add fillet radius 5mm"
# Batch processing
python run_freecad_agent.py --pattern "*.FCStd" --input-directory ./models --parallel 4
# Natural language command
python run_freecad_agent.py --prompt "Create a hull with 150m length and 25m beam"
from freecad_agent import FreeCADAgent
# Initialize agent
agent = FreeCADAgent()
# Natural language operation
result = agent.execute_prompt("Create a box 100x50x25mm with chamfered edges")
# Batch processing
results = agent.batch_process(
pattern="*.FCStd",
input_directory="./models",
operation="export_step",
parallel_workers=4
)
# Script generation
script = agent.generate_script("Create parametric gear with 20 teeth")
Configuration is managed through agent_config.json:
{
"name": "FreeCAD Agent",
"version": "1.0.0",
"capabilities": [
"cad_automation",
"batch_processing",
"parametric_design",
"assembly_management",
"fem_preprocessing",
"drawing_generation"
],
"settings": {
"parallel_workers": 4,
"cache_enabled": true,
"auto_save": true,
"validation_level": "strict"
}
}
freecad_agent/
├── src/
│ ├── core/
│ │ ├── agent.py # Base agent implementation
│ │ ├── capabilities.py # Capability registry
│ │ └── config.py # Configuration management
│ ├── api/
│ │ ├── wrapper.py # FreeCAD API wrapper
│ │ ├── document.py # Document management
│ │ └── geometry.py # Geometry operations
│ ├── nlp/
│ │ ├── parser.py # Natural language parser
│ │ ├── generator.py # Script generator
│ │ └── templates.py # Operation templates
│ ├── batch/
│ │ ├── processor.py # Batch processing engine
│ │ ├── discovery.py # File discovery
│ │ └── parallel.py # Parallel execution
│ └── marine/
│ ├── hull.py # Hull design tools
│ ├── stability.py # Stability calculations
│ └── mooring.py # Mooring systems
├── tests/
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── fixtures/ # Test fixtures
├── config/
│ ├── agent_config.json # Agent configuration
│ └── workflows.yml # Workflow definitions
└── docs/
├── user_guide.md # User documentation
├── api_reference.md # API documentation
└── examples/ # Example scripts
# Run all tests
pytest
# Run specific test module
pytest tests/unit/test_api_wrapper.py
# Run with coverage
pytest --cov=src --cov-report=html
FreeCAD Import Error
sys.path.append('/path/to/FreeCAD/lib')License Error
Memory Issues
docs/ directoryThis project is licensed under the MIT License - see the LICENSE file for details.
For detailed technical documentation, see the specification