# bim-acad — AutoCAD driver for bim-cli bim-acad drives the headless AutoCAD Core Console (accoreconsole.exe) that ships with every AutoCAD 2025/2026 install. No GUI, no add-in DLL. Invoke as `bim acad [flags]`. Output is JSON on stdout; NDJSON for streaming verbs. Discover the full schema with `bim describe --json`. ## Requirements - A local AutoCAD 2025 or 2026 install. `accoreconsole.exe` is auto-discovered (highest year first); override with `--console ` or `$BIM_ACAD_CONSOLE`. - Run `bim acad doctor` first to confirm the Core Console is found. ## Constraints (read before scripting exec) - The Core Console is CORE-ONLY: AutoLISP and .NET (NETLOAD) work, but COM / ActiveX `vla-*` functions do NOT ("no function definition"). - In a `.scr`, a SPACE is an ENTER. Multi-word command answers split across prompts — pass wildcard patterns or accept defaults with a blank line. - Use forward slashes in AutoLISP path literals (backslash is an escape char). ## Reading verbs (read-only; safe to batch) - `bim acad info ` — layers, layouts, blocks, model-space entity counts by type, and drawing extents. JSON. - `bim acad extract [--layer L] [--types LINE,CIRCLE] [--limit N]` — model-space entities as NDJSON: `{type, layer, handle, point, radius, text, name}`. `name` is the block name for INSERTs — group by it to count blocks. - `bim acad blocks ` — block-definition inventory as NDJSON: `{name, instances, has_attributes, anonymous, xref, xref_path}`. - `bim acad attributes [--block PATTERN] [--layout SPACE] [--limit N]` — block-reference attributes as NDJSON: `{name, handle, space, insert, attributes:{TAG:VALUE}}`. Each `.attributes` map is a field payload for `bim pdf form.fill`. - `bim acad xref list ` — external references: `{name, path, type, status}`. ## Output verbs - `bim acad convert --to dxf|dwg|pdf [--out P] [--version 2000..2018] [--layout L] [--paper "ISO A3 (420.00 x 297.00 MM)"] [--orientation Landscape|Portrait] [--dry-run] [--yes]` — DWG<->DXF (version-targeted) or print to PDF via the built-in `DWG To PDF.pc3` plotter (Extents/Fit; blank paper = device default, so any drawing prints). Destructive → supports `--dry-run`/`--yes`. - `bim acad elements ` — emit a PDF·BIM package-v1 `elements.json` (`schemaVersion`, `generator`, `source`, `units`, `sheets`, `elements`) built from the drawing's blocks + attributes + layouts. This is the metadata for `bim pdf package`. ## Maintenance verbs (mutate the drawing; open read-write, save in place or --out) - `bim acad purge [--out P] [--yes] [--dry-run]` — `-PURGE All` + save; reports `bytes_before`/`bytes_after`. - `bim acad audit [--out P] [--yes] [--dry-run]` — `AUDIT` fix + save; reports `errors_found`/`errors_fixed`. - `bim acad xref detach --name PATTERN | --all [--out P] [--yes]` — detach external references. `--name` is a WILDCARD pattern (xref names with spaces split), `--all` uses `*`. - `bim acad xref bind --name PATTERN | --all [--out P] [--yes]` — bind references into the drawing. Requires the referenced files to be resolvable (alongside the drawing); errors clearly if they are unresolved. ## Escape hatch - `bim acad exec [--scr FILE] [--lisp FILE] | -` — run an arbitrary `.scr`/AutoLISP script against the drawing (script may be piped on stdin). Core-only: no COM/`vla-*`. ## DWG → PDF·BIM pipeline ``` bim acad convert sheet.dwg --to pdf --out sheet.pdf bim acad elements sheet.dwg > elements.json bim pdf package --file sheet.pdf --metadata elements.json --out sheet.pkg.pdf bim pdf bim.validate --file sheet.pkg.pdf ``` The block instances become elements (handle = `id`, block name = `category`, attributes = `parameters`), layouts become sheets, and INSUNITS becomes units.