Is there a way of passing a list of layout tabs to a lisp variable?
Hi again Peeps,
Apologies for sounding like a bit of a noob here, again.
I'm going over some of my old AutoCAD lisp routines (which I should have done some time ago anyway since AutoCAD has changed so much since I created them).
One particular line goes (setq llist (LAYOUTLIST)), where LAYOUTLIST was an ACAD variable that returned a complete list of all the current layout tabs.
LAYOUTLIST does not exist in BCAD, it seems, and I have listed all of the BCAD variables to see it there is still a list of layout tabs in there, but there isn't.
In BCAD you can get a list by using the LAYOUT ? command but it is not possible to pass that list to a lisp variable.
Any ideas?
cheers
andy
0
Comments
-
This a Lisp function not a variable. The same function exists in BricsCAD,0
-
This a Lisp function not a variable. The same function exists in BricsCAD,Ah, right, thanks.It's been a long time since I did any proper lisp and it's not going too well haha!When I typed (setq llist (LAYOUTLIST)) on the command line this morning I got an error for some reason. Must have been me, because I've just tried it again now and it worked.I'm going to have to have a look for my lisp manual..........Apologiesandy0
-
This function, from CadTutor forum, puts a list of layout tabs in a variable called lst:
[code]; create and display a list of layout tabs (in proper order)
(defun c:lol (/ lst)
(vlax-map-collection
(vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
'(lambda (x) (setq lst (cons x lst))))
;; sort in tab order
(setq lst (vl-sort lst '(lambda (x y)
(< (vla-get-taborder x) (vla-get-taborder y)))))
;; make list of names into strings remove Model space
(setq lst (vl-remove "Model" (mapcar '(lambda (x)(vla-get-name x))lst)))
(princ lst) (princ)
)[/code]0 -
Andy,
You can try this also...
[code](defun c:layoutlst ( / acadobject activedocument layouttable layoutlist item)
(vl-load-com)
(setq acadobject(vlax-get-acad-object))
(setq activedocument(vla-get-activedocument acadobject))
(setq layouttable(vla-get-layouts activedocument))
(vlax-for item layouttable (setq layoutlist (cons (vlax-get-property item "name") layoutlist)))
(print layoutlist)
(princ)
)[/code]
Regards,
Kevin0 -
Hi Anthony and Kevin,Thanks for your input. I will have a look at the code you have provided.cheersandy0
This discussion has been closed.