Skip to main content

AutoCAD

RevitDevTool supports AutoCAD-family hosts through the same execution, testing, MCP, and logging features used across the product. Use the host-specific Autodesk API for the document, database, editor, and transaction work.

AutoCAD-family routing​

All AutoCAD-family products use this page. Select the matching values when configuring pytest or Microsoft Testing Platform tests:

ProductProduct IDpytest host_name.NET test HostName
AutoCAD01autocadAutoCad
Civil 3D00civil3dCivil3D
Map 3D02acadmap3dAcadMap3D
Architecture04acadarchAcadArch
Mechanical05acadmechAcadMech
MEP06acadmepAcadMep
Electrical07acadelecAcadElec
Plant 3D17plant3dPlant3D

Use autocad / AutoCad for plain AutoCAD and the family-specific value when the host is a vertical product.

Supported Versions​

AutoCAD-family hosts use the same target-framework mapping as Revit:

AutoCAD-family versionTarget framework
2022-2024net48
2025-2026net8.0-windows
2027net10.0-windows

API starting point​

from Autodesk.AutoCAD.ApplicationServices.Core import Application

doc = Application.DocumentManager.MdiActiveDocument
db = doc.Database
editor = doc.Editor

For database changes, use the normal AutoCAD transaction pattern:

from Autodesk.AutoCAD.DatabaseServices import OpenMode

tr = db.TransactionManager.StartTransaction()
try:
block_table = tr.GetObject(db.BlockTableId, OpenMode.ForRead)
# Work with database objects here.
tr.Commit()
except Exception:
tr.Abort()
raise
finally:
tr.Dispose()

Python execution​

Use the AutoCAD document and database APIs from a Python script. Third-party packages follow the normal Python Dependencies workflow.

from Autodesk.AutoCAD.ApplicationServices.Core import Application

doc = Application.DocumentManager.MdiActiveDocument
editor = doc.Editor
editor.WriteMessage("RevitDevTool is connected to AutoCAD")

Testing​

For pytest, select the AutoCAD host in the test configuration:

[tool.pytest.ini_options]
host_name = "autocad"
host_version = "2026"

Run the test suite with uv run pytest -v. .NET tests use NUnit, TUnit, or MSTest under Microsoft Testing Platform.

MCP and logging​

Register an MCP .NET or MCP Python toolset for AutoCAD actions. Use Log Level and Log Output for diagnostics; Revit geometry visualization is not part of the AutoCAD host workflow.