Exchange Forum > AutoLISP and Visual LISP
How do you get the tab names?
How do you get the tab names?

#1

Franzjuve
Join Date:
07-27-2007
I'm trying to figure out how to get the names of the tabs in a drawing. I tried a few things but they're not working.
i.e. (tblnext "layouts" t) (tblnext "layout" t) (tblnext "tabs" t) (tblnext "tab" t)
It seems like one of these should work. Is there another name I should be using instead, like "ctab" or something?
How do you get the tab names?

#2

Addison
Join Date:
07-25-2007
Have you looked into (layoutlist)? Try this on the command line:
(setq MyTabs (layoutlist))
How do you get the tab names?

#3

Franzjuve
Join Date:
07-27-2007
I don't understand this! Why is it that in some of my drawings (layoutlist) shows me my tabs in the correct order and in other drawings they're all scrambled up?
How do you get the tab names?

#4

Space Cadet
Join Date:
07-27-2007
Here's a function that will show your tabs in the correct order.
Code:
(defun GetLayoutList (/ Layouts)
  (vlax-map-collection (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
    '(lambda (x) (setq Layouts (cons x Layouts)))
  )
  (setq Layouts (vl-sort Layouts '(lambda (x y) (< (vla-get-taborder x) (vla-get-taborder y)))))
  (vl-remove "Model" (mapcar '(lambda (x) (vla-get-name x)) Layouts))
)
How do you get the tab names?

#5

Franzjuve
Join Date:
07-27-2007
Now that works! You're not a space cadet after all...
Thanks