- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Autodesk Community,
I'm working with an AutoLISP script intended to batch plot DWG files to PDF and then compile all the output into a single PDF document. Despite several attempts to correct the script, I keep encountering issues, particularly with the PDF output settings. Below is the essential part of the script:
```
(defun c:BatchPlotDWGtoPDF ()
(setq dwg-path "D:\\#.Secure Work Folder\\BIG\\Project\\23~24Y\\240129 CAD Reading Automation\\DWG\\out\\240419 print\\") ; DWG files location
(setq pdf-path "D:\\#.Secure Work Folder\\BIG\\Project\\23~24Y\\240129 CAD Reading Automation\\PDF\\out\\") ; PDF output location
;; Retrieve DWG file list
(setq files (vl-directory-files dwg-path "*.dwg" 1))
;; Process each file
(foreach file files
(setq full-path (strcat "\"" dwg-path file "\"")) ; Full file path, enclosed in quotes
;; Open DWG file
(command "_.OPEN" full-path)
;; PDF output settings
(command "_.-PLOT" "Yes" "" "DWG to PDF.pc3" "ISO_full_bleed_A3_(420.00_x_297.00_MM)" "Inches" "Landscape" "No" "Extents" "Fit" "Center" "Yes" (strcat "\"" pdf-path file ".pdf\"" ) "No" "Yes")
;; Close file
(command "_.CLOSE" "No")
)
(princ)
)
```
When running this script, I encounter an "Unknown command" error specifically when attempting to plot to PDF. I have double-checked the file paths and syntax but cannot seem to resolve the issue.
Additionally, I aim to compile all the plotted PDFs into a single PDF document located at the specified pdf-path. Could anyone provide insights on how to improve this script to not only batch plot but also compile the outputs into one PDF? Any help on why the _.-PLOT command might not be recognized would also be greatly appreciated.
Thank you in advance for your support!
Solved! Go to Solution.