TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: gp.triple on February 27, 2023, 09:40:10 AM
-
hi,
i prepared this lisp that permit to do:
- export all layout in pdf and save in the same folder of the dwg
- zoom extension
- purge
- save
- close file
but the export command works only if autocad is setting in english doesn't care of the "_"
someone can help/explain what i'm missing?
;;zoom extension, purge, save all layout in pdf, save file, close
(Defun C:zpq+ ()
(setvar "cmddia" 0)
(setvar "filedia" 0)
;;salva pdf di tutti i layout nella cartella dove è salvato il dwg
;;save all layout in pdf
(setq namedwg (getvar "dwgname"))
(setq len (strlen namedwg))
(setq pdfname (substr namedwg 1 (- len 4)))
(setq dwgpath (findfile namedwg))
(setq pdfpath (strcat (vl-filename-directory dwgpath)"\\" pdfname ".pdf"))
(command "_-layout" "S" "")
(command "_-export" "P" "A" pdfpath )
;;pulisce il disegno
;;purge all
(command "_-purge" "a" "*" "n" "-purge" "z" "-_+purge" "r" "*" "n" "audit" "y" "-_purge" "a" "*" "n")
;;zoom estensioni
;;zoom extension
(command "_zoom" "e")
; ;salva
;;save
(command "_qsave")
(setvar "cmddia" 1)
(setvar "filedia" 1)
;;chiude il file
;;close
(command "_close")
(princ)
)
-
I believe you are supposed to use "_." before your commands. Like this:
(command "_.layout" ...)
(command "_.export" ...)
-
Abd there is "-purge" "z"
-
You will need to underscore also all the command options, they are also localized - e.g. "_ZOOM" "_E", "_PURGE" "_All", etc.
-
thanks all, fixed!
;;zoom extension, purge, save all layout in pdf, save file, close
(Defun C:zpq+ ()
(setvar "cmddia" 0)
(setvar "filedia" 0)
;;salva pdf di tutti i layout nella cartella dove è salvato il dwg
;;save all layout in pdf
(setq namedwg (getvar "dwgname"))
(setq len (strlen namedwg))
(setq pdfname (substr namedwg 1 (- len 4)))
(setq dwgpath (findfile namedwg))
(setq pdfpath (strcat (vl-filename-directory dwgpath)"\\" pdfname ".pdf"))
(command "_.layout" "_Set" "")
(command "_.-export" "_Pdf" "_A" pdfpath )
;;pulisce il disegno
;;purge all
(command "_.purge" "_a" "*" "_n" "_.purge" "_z" "_.purge" "_r" "*" "_n" "_.audit" "_y" "_.purge" "_a" "*" "_n")
;;zoom estensioni
;;zoom extension
(command "_.zoom" "_e")
; ;salva
;;save
(command "_qsave")
(setvar "cmddia" 1)
(setvar "filedia" 1)
;;chiude il file
;;close
(command "_close")
(princ)
)