I GOT the following error on a lisp that will check if a plot device is assigned to the layout --- what i doing wrong, please help...
it get me only the first layout and get canceled.....
===============================
(vl-load-com)
;; Get the current drawing
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq lstLayouts nil
arSize 0)
;; CustomPageSetup ==================
(vlax-for *layout* (vla-get-layouts doc)
;; Check to see if a plot device is assigned to the layout, if not it will not be plotted
(if (and (/= (strcase (vla-get-ConfigName *layout*)) "NONE")
(= (vla-get-ModelType *layout*) :vlax-false)
)
(progn
(if (= lstLayouts nil)
(setq lstLayouts (list (vla-get-Name *layout*)))
(setq lstLayouts (append lstLayouts (vla-get-Name *layout*))) ; <== ERROR... i got only the first layout and canceled....
))))
Solved! Go to Solution.
Solved by hcanas. Go to Solution.
Change
(if (= lstLayouts nil)
(setq lstLayouts (list (vla-get-Name *layout*)))
(setq lstLayouts (append lstLayouts (vla-get-Name *layout*)))
to
(setq lstLayouts (cons (vla-get-Name *layout*)lstLayouts))
HTH
Henrique
@hcanas wrote:I GOT the following error on a lisp that will check if a plot device is assigned to the layout --- what i doing wrong, please help...
it get me only the first layout and get canceled.....
===============================
(vl-load-com)
;; Get the current drawing
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))(setq lstLayouts nil
arSize 0)
;; CustomPageSetup ==================
(vlax-for *layout* (vla-get-layouts doc)
;; Check to see if a plot device is assigned to the layout, if not it will not be plotted
(if (and (/= (strcase (vla-get-ConfigName *layout*)) "NONE")
(= (vla-get-ModelType *layout*) :vlax-false)
)
(progn
(if (= lstLayouts nil)
(setq lstLayouts (list (vla-get-Name *layout*)))
(setq lstLayouts (append lstLayouts (vla-get-Name *layout*))) ; <== ERROR... i got only the first layout and canceled....
))))
While Henrique is pointing you to another solution here is where your original attempt tripped on itself:
(if (= lstLayouts nil)
(setq lstLayouts (list (vla-get-Name *layout*)))
(setq lstLayouts (append lstLayouts (vla-get-Name *layout*))) ; <== ERROR... i got only the first layout and canceled....
)
you didn't convert the second (and any following) layout name to a list for the append function to work with (it requires multiple lists):
(if (= lstLayouts nil)
(setq lstLayouts (list (vla-get-Name *layout*)))
(setq lstLayouts (append lstLayouts (list (vla-get-Name *layout*)))) ; <== ERROR... i got only the first layout and canceled....
)
-Gary