PDA

View Full Version : Field with layout name



paulof
2008-09-18, 11:20 AM
Hi,
Is there any possible to make a field with the name of a specific layout?
Thanks,

lpseifert
2008-09-18, 11:56 AM
Field > Field name > System variable > Ctab

irneb
2008-09-22, 05:30 AM
Or paste this into any text (including DText, MText, Attrib):
%<\AcVar ctab>%Does exactly the same as lpseifert's post.

LJones.215633
2009-12-30, 06:10 PM
Is there a way to designate something other than the current tab? Like if I have 4 layouts, 3 of which reference the 1st, can I fill in a %<\acvar xxxx>% to list the name of Layout1?

irneb
2009-12-31, 12:39 PM
No in that case it's a bit more complex than that. You need to obtain the Layout's ObjectID from its COM/ActiveX interface (VBA/VLisp). Then use an Object field with that ID (which you're going to hack by placing the ID value since you can't select the Layout object itself). Then get its Name property.

To get the Layout's Object ID, here's example VLisp:
(vl-load-com)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq lcol (vla-get-Layouts doc))
(setq L (vla-Item lcol "Layout1"))
(vla-get-ObjectID L)Just type them at command prompt, the last line should return the ObjectID on the command Prompt. Change the red Layout1 to the current name of the layout you want. Then copy the returned number into the following field-code's ID value (marked in red). Use a text editor like Notepad to modify it:
%<\AcObjProp Object(%<\_ObjId 2130382616>%).Name>%Then select & copy it & paste into any text object. To test, rename that layout & do a regen to update fields.