AutoCAD DWG PDF Output
Use this skill when the user needs a DWG turned into PDFs on the local machine. The effective pattern is: find the CAD engine, inspect layouts, export by layout, then verify the generated PDFs exist and are plausible.
Discovery Workflow
Confirm the DWG path.
- Use
Test-PathandGet-Itemto confirm existence, size, and timestamp. - Preserve the original DWG. Write outputs to a separate
pdf_outputor user-specified folder.
- Use
Locate CAD software.
- Search common install folders for
acad.exe,accoreconsole.exe,gcad.exe,zwcad.exe. - Check uninstall registry and Start Menu shortcuts for AutoCAD, Tianzheng, GstarCAD, ZWCAD, or similar.
- Check
.dwgfile association when executable discovery is unclear.
- Search common install folders for
Prefer noninteractive export first.
- Use AutoCAD COM or
accoreconsole.exeif available. - If COM works, open the DWG read-only for layout discovery, then reopen for plotting if needed.
- If command-line export fails, switch to desktop automation only after confirming the GUI app can open the file.
- Use AutoCAD COM or
Layout Export Pattern
Enumerate layouts.
- Read
doc.Layouts. - Usually export paper-space layouts first, not
Model, unless the user asks for model-space output. - Record layout names exactly, including Chinese names.
- Read
Plot each layout.
- Set
BACKGROUNDPLOTto0so export finishes before verification. - Use existing layout plot settings when possible.
- Fall back to common PDF plotter settings only when the DWG lacks usable settings.
- Name output PDFs by DWG base name plus layout name.
- Set
Verify output.
- List PDFs with full path, size, and timestamp.
- Check that each expected layout produced one PDF.
- If possible, render or inspect the first page visually for blank pages, crop errors, or missing content.
Common Failure Modes
- CAD executable is installed in a nonstandard folder outside the default Autodesk path.
- Layouts are named in Chinese and scripts fail from encoding assumptions.
- Only
Modelexports while actual drawings are in paper-space layouts. - Background plotting returns before PDFs are fully written.
- Missing SHX fonts/proxy objects affect display but do not always block export.
Final Response Shape
Return:
- CAD executable found.
- DWG file confirmed.
- Layouts detected.
- PDF output paths and sizes.
- Any layout skipped and why.
- Whether visual/page-level verification was performed.