AutoCAD .NET Development Skill
You have access to a comprehensive AutoCAD .NET API knowledge base with two tiers:
Tier 1: Patterns (How To)
Human-curated guides with production-tested code examples. Check these FIRST when the developer asks "how do I...":
| Pattern File | Covers |
|---|---|
patterns/transactions.md | Transaction lifecycle, StartTransaction vs StartOpenCloseTransaction, nesting, disposal |
patterns/document-database-editor.md | Document/Database/Editor trio, document locking, active vs background docs |
patterns/entity-creation.md | Adding entities to ModelSpace/PaperSpace, ObjectId lifecycle, bulk creation |
patterns/entity-modification.md | Opening for write, modifying properties, batch modifications, Overrule |
patterns/block-references.md | BlockTable/BlockTableRecord/BlockReference, attributes, nested blocks, cloning |
patterns/selection-sets.md | Selection filters, TypedValue arrays, DXF codes, implied selection |
patterns/layers-and-properties.md | LayerTable, creating layers, linetypes, ByLayer vs ByBlock |
patterns/xdata.md | ResultBuffer, RegApp, DXF group codes, read/write roundtrip, size limits |
patterns/commands.md | [CommandMethod], CommandFlags, [LispFunction], async commands |
patterns/events.md | Database/Document/Editor events, Idle processing, undo/redo gotcha |
patterns/geometry.md | Point3d, Vector3d, Matrix3d, transforms, coordinate systems, Tolerance |
patterns/palettes.md | PaletteSet, WPF hosting, WinForms hosting, docking, state persistence |
patterns/cui-customization.md | Ribbon API, tabs, panels, buttons, toolbars, command groups |
patterns/plotting.md | PlotEngine workflow, PlotSettings, batch plotting, PDF output |
patterns/external-references.md | Xref attach/detach/reload/bind, XrefGraph, nested xrefs |
patterns/file-io.md | ReadDwgFile, SaveAs, WblockClone, side database pattern |
patterns/jig-and-drawjig.md | EntityJig, DrawJig, Sampler/Update/WorldDraw, placement preview |
patterns/tables.md | Symbol tables (TextStyle, DimStyle, Linetype, RegApp, Block, Layer, etc.) |
patterns/error-handling.md | What throws vs silent fails, ErrorStatus, eLocked recovery |
patterns/performance.md | Large drawing strategies, regen control, progress meters, bulk operations |
patterns/migration-2025-to-2026.md | TFM changes, NuGet versions, breaking API changes between versions |
Tier 2: API Index (Exact Signatures)
Auto-generated from official Autodesk NuGet SDK documentation. Use when you need exact method signatures, property types, or to discover available members on a class.
api/2025/_index.md— Master class listing for AutoCAD 2025 (1,704 types, 12,651 members)api/2026/_index.md— Master class listing for AutoCAD 2026 (1,727 types, 12,957 members)
Key API Files:
api/{ver}/DatabaseServices.md— Entities, Database, Transaction (600+ types)api/{ver}/DatabaseServices.Database.md— Database class deep-dive (441+ members)api/{ver}/DatabaseServices.Entity.md— Entity base class (71+ members)api/{ver}/EditorInput.Editor.md— Editor class (114+ members)api/{ver}/Geometry.md— Point3d, Vector3d, Matrix3d, curvesapi/{ver}/Customization.md— CUI/Ribbon (157 types)
Tier 3: Gotchas (What Docs Don't Tell You)
Hard-won knowledge from production plugin development:
| Gotcha File | Covers |
|---|---|
gotchas/common-crashes.md | Things that crash AutoCAD with zero error message |
gotchas/thread-safety.md | What MUST run on the UI thread, async pitfalls |
gotchas/document-locking.md | The #1 source of mysterious failures |
gotchas/disposal-leaks.md | ObjectId vs DBObject lifetime, transaction scope leaks |
gotchas/version-quirks.md | Per-version behavior differences |
How To Use This Skill
Step 1: Detect Version
Check the developer's .csproj for AutoCAD version:
<PackageReference Include="AutoCAD.NET" Version="25.x" />→ AutoCAD 2025 (net8.0)<PackageReference Include="AutoCAD.NET" Version="25.1.x" />→ AutoCAD 2026 (net8.0)- Both 2025 and 2026 use TFM
net8.0-windows
Step 2: Route the Question
"How do I [task]?" → Read the relevant pattern file first. It has tested code examples.
"What methods does [class] have?" → Check api/{version}/_index.md to find the class, then read its namespace file or split file for full member listing.
"Why is my plugin crashing/failing?" → Check gotchas first (especially common-crashes.md and document-locking.md), then the relevant pattern file's "Common Mistakes" section.
"How do I migrate from 2025 to 2026?" → Read patterns/migration-2025-to-2026.md.
Step 3: Write Correct Code
When generating AutoCAD .NET code, ALWAYS:
- Use transactions for all database operations
- Call
AddNewlyCreatedDBObject(entity, true)afterAppendEntity() - Commit transactions before dispose
- Lock documents when modifying from external contexts
- Use
OpenMode.ForWriteonly when actually modifying - Dispose ResultBuffers and other unmanaged resources
- Never compare Point3d/Vector3d with
==— useIsEqualTo()withTolerance
Critical Rules
- Never use
Application.DocumentManager.MdiActiveDocumentdirectly — always use a null-safe wrapper - Never access entities outside their transaction scope
- Never modify entities opened with
OpenMode.ForRead - Always wrap transactions in
usingstatements - Always register RegApp before writing XData