Rename Layout Tabs

  • Thread starter Thread starter bellenoit
  • Start date Start date
B

bellenoit

Is there a quick and dirty way to rename layout tabs? I want to take our multiple tabs (Layout2-Plot C, Layout3-Plot C, etc.) and remove the "Layout" and keep the 2-plot, 3-plot, etc? This is for when we have multiple layouts on one drawing...

can I do it with the VLA commands?

(defun DelTabs ()
(vl-load-com)
(vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (= "Layout*" (vla-get-name x)) *** then what??????

not very familiar with the whole VLA stuff a little help would be appreciated?

Thanks!

noit
 
Have a look at the SUBSTR function.

--
Autodesk Discussion Group Facilitator


bellenoit said:
Is there a quick and dirty way to rename layout tabs? I want to take our
multiple tabs (Layout2-Plot C, Layout3-Plot C, etc.) and remove the "Layout"
and keep the 2-plot, 3-plot, etc? This is for when we have multiple layouts
on one drawing...
 
Hi Noit

This can be what you are looking for (not tested):

(defun RenameLayouts ( / AcdDoc TmpNme)
(vl-load-com)
(setq AcdDoc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for Obj (vla-get-layouts AcdDoc)
(if (wcmatch (setq TmpNme (vla-get-name Obj)) "Layout*")
(vla-put-name Obj (substr TmpNme 7))
)
)
(princ)
)

Cheers
 
Thanks Juerg!!!! That is exactly what I wanted!!!

That's the second time you came through for me on my Programming!!!!

noit
 
Back
Top