An intelligent, reasoning-capable AI assistant integrated directly into AutoCAD (2025/2026+) using the .NET 8.0 API and OpenAI-compatible LLM providers (Groq, OpenRouter, NVIDIA, or custom endpoints). This agent doesn't just chat; it has "Eyes" to see your design and "Hands" to modify it.
This plugin provides a WPF-based palette within AutoCAD that connects to a high-performance LLM. The agent is designed to be a Proactive Scout, meaning it automatically analyzes your drawing summary and current viewport as soon as you open it, allowing it to understand the context of your design immediately.
- AutoCAD 2025 or 2026 (or any version supporting .NET 8.0).
- .NET 8.0 SDK installed on your machine.
- At least one LLM API key:
- Groq (
GROQ_API_KEY) - OpenRouter (
OPENROUTER_API_KEY) - NVIDIA (
NVIDIA_API_KEYorNGC_API_KEY)
- Groq (
-
Clone the Repository:
git clone <your-repo-url> cd AutoCAD-AI-Agent
-
Set Environment Variables: The plugin now supports multiple providers. Set these in Windows Environment Variables.
Option A: NVIDIA (recommended if you already have an nvapi key)
AI_PROVIDER=nvidiaNVIDIA_API_KEY=your_nvidia_keyAI_MODEL=your_model_id(example:minimaxai/minimax-m1-80kif available for your account)
Option B: OpenRouter
AI_PROVIDER=openrouterOPENROUTER_API_KEY=your_openrouter_keyAI_MODEL=your_model_id(example:minimax/minimax-m1)- Optional:
OPENROUTER_SITE_URL=https://your-site - Optional:
OPENROUTER_APP_NAME=AutoCAD AI Agent
Option C: Groq
AI_PROVIDER=groqGROQ_API_KEY=your_groq_key- Optional:
AI_MODEL=meta-llama/llama-4-scout-17b-16e-instruct
Option D: Any OpenAI-compatible endpoint
AI_PROVIDER=customAI_API_KEY=your_keyAI_API_BASE_URL=https://your-endpoint/v1/chat/completionsAI_MODEL=your_model_id
Notes:
AI_MODELoverrides provider defaults.- If
AI_PROVIDERis omitted, provider auto-detection runs based on available keys.
-
Build the Project:
dotnet build MyBonusPlugin/MyBonusPlugin.csproj
-
Load into AutoCAD:
- Open AutoCAD.
- Type
NETLOADin the command line. - Navigate to
MyBonusPlugin/bin/x64/Debug/net8.0-windows/MyBonusPlugin.dlland select it.
-
Launch the Agent:
- Type
AIAGENTin the command line to open the chat panel.
- Type
The agent uses the Llama-4-Scout model, which generates internal reasoning before providing an answer.
- Implementation: The plugin features a custom streaming parser that detects
<think>and</think>tags in the API response. - UI: Reasoning is displayed in a collapsible "Reasoning..." dropdown (WPF Expander) to keep the chat clean while providing transparency.
The agent interacts with AutoCAD through a structured Tool Calling architecture. Instead of the AI writing code, it outputs JSON requests for specific tools.
- Extraction Tools (Eyes):
GetDrawingSummary,GetCurrentViewContext, andIdentifyBlocksserialize AutoCAD database objects into JSON context for the LLM. - Modification Tools (Hands):
TransformEntityandUpdateEntityPropertiesallow the agent to move, rotate, scale, or change layers of objects based on theirHandle.
AutoCAD's API is strictly single-threaded. LLM requests happen on background threads, which would normally crash AutoCAD.
- The Fix: We use
Application.DocumentManager.ExecuteInCommandContextAsyncin theAIAgentOrchestratorto marshal requests back to the AutoCAD main thread safely before any database transaction begins.
The agent is capable of multi-step reasoning.
- User asks: "Fix the alignment."
- LLM thinks and calls a tool to get coordinates.
- Plugin executes tool and feeds results back to LLM.
- LLM re-evaluates and calls a modification tool.
- Loop repeats until the task is complete (max 3 cycles).
- Language: C# 12 / .NET 8.0
- UI Framework: WPF (hosted via
ElementHostin a WinFormsPaletteSet). - LLM Provider: OpenAI-compatible chat completion API (Groq/OpenRouter/NVIDIA/custom).
- AutoCAD API:
Autodesk.AutoCAD.DatabaseServices,Geometry, andEditorInput.
The agent is currently a powerful prototype, but the following features are yet to be implemented to make it fully autonomous:
- [ ] Advanced Drawing Tools: Add
DrawLine,DrawCircle, andCreateBlocktools so the agent can generate new designs from scratch. - [ ] 2D Parametric Tools: Implement
SmartTrimExtendandParametricOffsetfor complex architectural editing. - [ ] Design Validation Engine: A dedicated tool for the agent to compare the drawing against a provided "Rulebook" (e.g., "Check if all fire exits have 1.2m clearance").
- [ ] 3D Support: Currently, the agent focuses on 2D coordinates. We need to implement 3D geometric reasoning for assembly designs.
- [ ] Multi-modal Vision: Integration of screenshots (Vision LLM) to help the agent understand aesthetic layouts and crowded areas.
This project is for educational and development purposes within the AutoCAD Agent Development course.