Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

layout selection... error

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
hcanas
497 Views, 5 Replies

layout selection... error

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....
))))

 

DC
5 REPLIES 5
Message 2 of 6
hmsilva
in reply to: hcanas

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

 

EESignature

Message 3 of 6
Gary_J_Orr
in reply to: hcanas


@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

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 4 of 6
hcanas
in reply to: hmsilva

thank  

DC
Message 5 of 6
hcanas
in reply to: Gary_J_Orr

thank you for the clarification Gary.... now i got it..

DC
Message 6 of 6
hmsilva
in reply to: hcanas


@hcanas wrote:

thank  @hmsilva


You're welcome, hcanas!

 

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost