Casey,
This demo copies a named page setup from the active file to all other open files. It
could be modified to process files in a folder.
Joe Burke
;; JB 9/5/2004
;; copy a plot configuration (named page setup)
;; from the active file to other open files
;; if name exists in target file, it's skipped
(defun c:CopyPlotConfigs (/ *acad* documents doc cfgs name cnt
srccfg modtype doccfgs newcfg)
(and
(setq *acad* (vlax-get-acad-object))
(setq documents (vla-get-documents *acad*))
(setq doc (vla-get-ActiveDocument *acad*))
(setq cfgs (vla-get-PlotConfigurations doc))
(setq cnt 0)
(setq name (getstring T "\nEnter page setup name to copy: "))
(or
(setq srccfg (ValidItem cfgs name))
(prompt "\nPage setup name does not exist in the active file. ")
)
(setq modtype (vlax-get srccfg 'ModelType))
(vlax-for x documents
(setq doccfgs (vla-get-PlotConfigurations x))
(if (not (ValidItem doccfgs name))
(progn
(if (= -1 modtype)
(setq newcfg (vla-Add doccfgs name T)) ;model cfg
(setq newcfg (vla-Add doccfgs name)) ;layout cfg
)
(vlax-invoke newcfg 'CopyFrom srccfg)
(setq cnt (1+ cnt))
)
T
)
) ;for
(princ (strcat "\nNumber of files modified: " (itoa cnt)))
) ;and
(princ)
) ;end
;; check for item in collection
(defun ValidItem (collection item / res)
(vl-catch-all-apply
'(lambda ()
(setq res (vla-item collection item))))
res
) ;end
Post by Casey RobertsIs there a way to run a script that will import a named page into multiple
drawings (using script pro)....
I can get a command line version of psetupin by changing filedia to 0
however, it still brings up a dialog box to select the page setup.
Any suggestions? or easier methods?
setting cmddia to 0 does not suppress the page setup dialog box either...
dangit.
Thanks,
Casey