04Cad-Manager
Usenet Archive
- Joined
- Aug 14, 2003
- Messages
- 1
- Reaction score
- 0
I am working on a lisp to perform several functions on multiple open drawings (one at a time) then save the drawing, close it and move along to the next drawing. I have figured out the functions, but my code only works on the current drawing, modifying, saving, and closing it. (This is a MDI mode routine only) I am still learning visual lisp, I apologize in advance. I have attached the starting of the code any help is appreciated!
3-problems I can see (thus far):
1) The code is not stepping into the 2nd drawing as it should
2) closing default "drawing1" etc always asks for a "saveas" , DWGPREFIX, DWGTITLED, SAVENAME, DBMOD all have values so how can I filter the default drawing out unless I start the lisp w/ it closed?
3) Not sure how to handle the last drawing open..
Any help to get me to the next step would be helpful. Thanks in advance.
Thanks,
Curtis
(vlax-for dwg (vla-get-documents (vlax-get-acad-object)) (if (/= 0 (vlax-variant-value (vla-getvariable dwg "DBMOD"))) ;True only if the dwg has been modified... (PROGN (setq currentdwg (vla-get-activedocument (vlax-get-acad-object))) ;set current dwg to be modified (if (/= nil previousname) ;Was there a previous drawing (progn (command "close" previousname) ;(vla-close previousname (vlax-make-variant :vlax-false)) ;Close previous drawing <PROBLEMS?> ) (progn (setq titled (= 1 (vlax-variant-value (vla-getvariable dwg "DWGTITLED"))) name (if titled ; Name idrawing name as follows:
(vlax-get dwg "fullname")
; True=> get full name/path"
(vlax-variant-value (vla-getvariable dwg
"DWGNAME")) ; False=> get name only
)
)
(saveDwg dwg) ; goto "saveDwg" function
taking dwg variable
(setq previousname name) ; set previousname to curent open drawing and goto next for:
)
)
)
)
(acet-error-restore)
(princ)
)
3-problems I can see (thus far):
1) The code is not stepping into the 2nd drawing as it should
2) closing default "drawing1" etc always asks for a "saveas" , DWGPREFIX, DWGTITLED, SAVENAME, DBMOD all have values so how can I filter the default drawing out unless I start the lisp w/ it closed?
3) Not sure how to handle the last drawing open..
Any help to get me to the next step would be helpful. Thanks in advance.
Thanks,
Curtis
(vlax-for dwg (vla-get-documents (vlax-get-acad-object)) (if (/= 0 (vlax-variant-value (vla-getvariable dwg "DBMOD"))) ;True only if the dwg has been modified... (PROGN (setq currentdwg (vla-get-activedocument (vlax-get-acad-object))) ;set current dwg to be modified (if (/= nil previousname) ;Was there a previous drawing (progn (command "close" previousname) ;(vla-close previousname (vlax-make-variant :vlax-false)) ;Close previous drawing <PROBLEMS?> ) (progn (setq titled (= 1 (vlax-variant-value (vla-getvariable dwg "DWGTITLED"))) name (if titled ; Name idrawing name as follows:
(vlax-get dwg "fullname")
; True=> get full name/path"
(vlax-variant-value (vla-getvariable dwg
"DWGNAME")) ; False=> get name only
)
)
(saveDwg dwg) ; goto "saveDwg" function
taking dwg variable
(setq previousname name) ; set previousname to curent open drawing and goto next for:
)
)
)
)
(acet-error-restore)
(princ)
)