xref_attach
Attach or overlay a DWG/DXF external reference into the active AutoCAD drawing with WCS placement, scaling, rotation, and optional layer control.
Instructions
Attach or overlay one allowed DWG/DXF external reference with a bounded WCS transform and optional layer; source paths are canonicalized before AutoCAD side effects.
Side-effects: Attaches external drawing file to active document. Disambiguation: Use to reference external drawings; use block_insert for internal blocks.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Insertion point X in WCS (default: 0.0) | |
| y | No | Insertion point Y in WCS (default: 0.0) | |
| z | No | Insertion point Z in WCS (default: 0.0) | |
| name | No | Block name for the XREF. Defaults to filename stem if omitted | |
| path | Yes | Filesystem path to the external DWG/DXF reference file | |
| layer | No | Target layer name for XREF reference | |
| overlay | No | True for Overlay reference (not nested), False for Attach reference (default: True) | |
| scale_x | No | X scale factor (default: 1.0) | |
| scale_y | No | Y scale factor (default: 1.0) | |
| scale_z | No | Z scale factor (default: 1.0) | |
| rotation | No | Rotation angle in degrees (default: 0.0) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||