Author Topic: lisp and autocad localization problem  (Read 623 times)

0 Members and 1 Guest are viewing this topic.

gp.triple

  • Mosquito
  • Posts: 14
lisp and autocad localization problem
« 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?

Code: [Select]
;;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)
 )

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: lisp and autocad localization problem
« Reply #1 on: February 27, 2023, 09:55:22 AM »
I believe you are supposed to use "_." before your commands. Like this:
(command "_.layout" ...)
(command "_.export" ...)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MatGrebe

  • Mosquito
  • Posts: 16
Re: lisp and autocad localization problem
« Reply #2 on: February 27, 2023, 10:48:38 AM »
Abd there is "-purge" "z"

VMichl

  • Mosquito
  • Posts: 8
Re: lisp and autocad localization problem
« Reply #3 on: February 27, 2023, 11:50:11 AM »
You will need to underscore also all the command options, they are also localized - e.g. "_ZOOM" "_E", "_PURGE" "_All", etc.

gp.triple

  • Mosquito
  • Posts: 14
Re: lisp and autocad localization problem
« Reply #4 on: February 28, 2023, 07:54:57 AM »
thanks all, fixed!

Code: [Select]
;;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)
 )