Sprunkle Posted June 6, 2024 Posted June 6, 2024 I am trying to write an AutoLISP routine that exports a pdf from an open CAD file. It is stuck at the end and i can't get it to take "" (enter) which should trigger the export button in the dialog box to finish it out. Here is what I have: (defun c:expdf () (setq dwgName (getvar "DWGNAME")) (setq dwgNameNoExt (vl-filename-base dwgName)) (setq prefix (getvar "DWGPREFIX")) (setq outputPath (strcat prefix "Design\\Work Prints\\" dwgNameNoExt ".pdf")) (command "_EXPORTPDF" outputPath "") ) Quote
Sprunkle Posted June 6, 2024 Author Posted June 6, 2024 Quote maybe try -EXPORTPDF (- instead of _) I'm afraid that does not help with my issue, but thanks for the try! Quote
rlx Posted June 6, 2024 Posted June 6, 2024 try : .... (setvar 'filedia 0) (command "-EXPORTPDF" outputPath "") Quote
rlx Posted June 6, 2024 Posted June 6, 2024 ah , you're right, not working (didn't do any testing) , try it now (defun c:expdf ( / dwgName dwgNameNoExt prefix outputPath) (setq dwgName (getvar "DWGNAME")) (setq dwgNameNoExt (vl-filename-base dwgName)) (setq prefix (getvar "DWGPREFIX")) (setq outputPath (strcat prefix "Design\\Work Prints\\" dwgNameNoExt ".pdf")) (setvar 'filedia 0) (command "_.-export" "Pdf" "_E" "_NO" outputPath) (while (> (getvar 'cmdactive) 0) (command "")) (princ) ) you can also try plot command in combination with DwgToPdf , should be plenty routines around https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/export-to-pdf-lisp-routine/td-p/5704455 Quote
lido Posted June 6, 2024 Posted June 6, 2024 Until AutoCAD 2023, I don't think you can directly EXPORT dwg to pdf. See: https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-A72DB257-3410-4792-B548-6B9FC1DED72B As rtx says, you may use the PLOT command. Quote
BIGAL Posted June 7, 2024 Posted June 7, 2024 Here is one for you plots multiple layouts, you need to edit the sheet size etc. Just search here there are so many examples.plotA3Pdfrange2.lsp Multi GETVALS.lsp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.