Curtis Kostecki
Usenet Archive
- Joined
- Jul 14, 2003
- Messages
- 6
- Reaction score
- 0
Since Migration assistance to Autocad 2004 does not provide me with this type of help I am hoping that I can get it on the newsgroups..
I have created a whole series of cleanup and utility routines Auditing, purging, removing old plot styles, unused layout tabs, layer filters etc.. I want to modify the saveall.lsp provided with express tools. For Simplicity, I will focus on "purge" subroutine alone in this context. Since I do not know visual lisp or whatever this saveall.lsp code is, I am hoping autolisp will suffice for modifications?
I want to open multiple drawings and perform a purge on each one before resaving to autocad 2004. I am starting with Autodesks "saveall.lsp" After I figure out if it is possible to perform I can move to complete integration of all subroutines if it is possible..
Here is the code that runs:
PROBLEM: I must not have the purge running at the correct location, it does nothing?? I have tried so many other locations.. Is this possible?
Help?
Curtis
;;
(defun C:UA (/ dwg saveDwg)
;; save drawing
(defun saveDwg (dwg / titled writeable name)
(setq titled (= 1 (vlax-variant-value (vla-getvariable dwg "DWGTITLED"))) writeable (= 1 (vlax-variant-value (vla-getvariable dwg "WRITESTAT"))) name (if titled (vlax-get dwg "fullname") (vlax-variant-value (vla-getvariable dwg "DWGNAME")) ) ) (cond ;; REFEDIT active ?? ((/= "" (vlax-variant-value (vla-getvariable dwg "REFEDITNAME"))) (acet-ui-message (acet-str-format "%1\nCannot Save while REFEDIT active." name) "AutoCAD - SAVEALL"
Acet:ICONSTOP )
)
;; simple save if titled and writeable
((and titled writeable)
;;;;; I have begun adding the commands here
(progn
(command "purge" "a" "" "n")
(vla-save dwg)
)
;;;;; I have ended adding the commands here
)
;; otherwise ask for name first
(T
(if (setq name (ACET-FILE-WRITEDIALOG "Save Drawing As" name "dwg"
1))
(vla-saveas dwg (vlax-make-variant name)) )
)
)
)
;; quietly
(acet-error-init '(("CMDECHO" 0)))
;; for each drawing
(vlax-for dwg (vla-get-documents (vlax-get-acad-object)) ;; save if modified (if (/= 0 (vlax-variant-value (vla-getvariable dwg "DBMOD"))) ;;;;; I have begun adding the commands here (progn (command "purge" "a" "" "n") (saveDwg dwg) ) ;;;;; I have ended adding the commands here
)
)
(acet-error-restore)
(princ)
)
(princ)
I have created a whole series of cleanup and utility routines Auditing, purging, removing old plot styles, unused layout tabs, layer filters etc.. I want to modify the saveall.lsp provided with express tools. For Simplicity, I will focus on "purge" subroutine alone in this context. Since I do not know visual lisp or whatever this saveall.lsp code is, I am hoping autolisp will suffice for modifications?
I want to open multiple drawings and perform a purge on each one before resaving to autocad 2004. I am starting with Autodesks "saveall.lsp" After I figure out if it is possible to perform I can move to complete integration of all subroutines if it is possible..
Here is the code that runs:
PROBLEM: I must not have the purge running at the correct location, it does nothing?? I have tried so many other locations.. Is this possible?
Help?
Curtis
;; save all open drawings:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::;CODE:::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::
;;
(defun C:UA (/ dwg saveDwg)
;; save drawing
(defun saveDwg (dwg / titled writeable name)
(setq titled (= 1 (vlax-variant-value (vla-getvariable dwg "DWGTITLED"))) writeable (= 1 (vlax-variant-value (vla-getvariable dwg "WRITESTAT"))) name (if titled (vlax-get dwg "fullname") (vlax-variant-value (vla-getvariable dwg "DWGNAME")) ) ) (cond ;; REFEDIT active ?? ((/= "" (vlax-variant-value (vla-getvariable dwg "REFEDITNAME"))) (acet-ui-message (acet-str-format "%1\nCannot Save while REFEDIT active." name) "AutoCAD - SAVEALL"
Acet:ICONSTOP )
)
;; simple save if titled and writeable
((and titled writeable)
;;;;; I have begun adding the commands here
(progn
(command "purge" "a" "" "n")
(vla-save dwg)
)
;;;;; I have ended adding the commands here
)
;; otherwise ask for name first
(T
(if (setq name (ACET-FILE-WRITEDIALOG "Save Drawing As" name "dwg"
1))
(vla-saveas dwg (vlax-make-variant name)) )
)
)
)
;; quietly
(acet-error-init '(("CMDECHO" 0)))
;; for each drawing
(vlax-for dwg (vla-get-documents (vlax-get-acad-object)) ;; save if modified (if (/= 0 (vlax-variant-value (vla-getvariable dwg "DBMOD"))) ;;;;; I have begun adding the commands here (progn (command "purge" "a" "" "n") (saveDwg dwg) ) ;;;;; I have ended adding the commands here
)
)
(acet-error-restore)
(princ)
)
(princ)