Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

create a leader/tag that will automatically pick up the layer name

sagnewYUXLR
Advocate

create a leader/tag that will automatically pick up the layer name

sagnewYUXLR
Advocate
Advocate

hi there

 

i was wondering if there is anyway to create a tag/leader/label  (similar to revit) that will automatically pick up the layer name of the object i am selecting?

 

i'd like to create a floor plan and label all the items i have without having to use "dumb text" so to speak 

 

sagnewYUXLR_0-1704920498120.png

 

many thanks 

 

0 Likes
Reply
Accepted solutions (1)
558 Views
10 Replies
Replies (10)

Kent1Cooper
Consultant
Consultant

@sagnewYUXLR wrote:

... pick up the layer name of the object i am selecting?

.... without having to use "dumb text" ....


That sounds like you want Mtext with a FIELD for content.  That will update [upon REGEN] if you change the Layer of the object the Field is tied to.  Do you know how to go about that?

Kent Cooper, AIA

sagnewYUXLR
Advocate
Advocate

hi kent 

 

no i dont but i am looking at a youtube video just now thanks 

0 Likes

sagnewYUXLR
Advocate
Advocate

sagnewYUXLR_0-1704921731920.png

unfortunately layer isn't an option when going to insert field 😞 

0 Likes

Kent1Cooper
Consultant
Consultant
Accepted solution

If you pick Object [instead lf All] in the Field category: list, does it not then offer Layer as a choice?

Kent Cooper, AIA
0 Likes

sagnewYUXLR
Advocate
Advocate

sagnewYUXLR_0-1704922703387.png

unfortunately not 😞 

 

thanks for your help tho much appreicated 

 

 

0 Likes

sagnewYUXLR
Advocate
Advocate

got it my friend thanks 

 

sagnewYUXLR_0-1704922804843.png

 

0 Likes

cadffm
Consultant
Consultant

no, "Layer" is not a field type.

 

[ALL] or [OBJECT]

and then

OBJECT  -> <select object> -> Property: LAYER

 

 

@sagnewYUXLR 

Hi,

 

in this list is NO property listed. Take "OBJECT" from this list,

and you can select an object then.

NOW, the dialog offers near to all properties of this object - and one general property of each object is LAYER.

 

> Learn to use field and explore the huge offer of possibilities

https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-742C92C3-1284-4722-B650-C46F9191C701

 

For a better worflow, use tools for less steps.

Very basic codes or very smart 3rd party programs, the core part is all the same - how to create the FieldCode

IF you want to use field for it.

 

 

; Show object layer by Mleader
; Very simple sample for mleaderstyle with max.2 Leader Points
(defun c:FieldObjectLayer-MLEADER (/ seldata #object FieldCode)
(if (and
(setq seldata (entsel))
(setq #object (vlax-ename->vla-object (car seldata)))
(setq FieldCode (strcat "%<\\AcObjProp Object(%<\\_ObjId "
(itoa(vla-get-ObjectID #object))
">%).Layer"
">%"
) )
)
(command "_.MLEADER" "_h" "_nea" (last seldata) pause FieldCode "")
(princ "\nSomething went wrong")
)
(princ)
)

; Show object layer by Text
; Very simple sample for Styles with height=0
(defun c:FieldObjectLayer-TEXT (/ seldata #object FieldCode)
(if (and
(setq seldata (entsel))
(setq #object (vlax-ename->vla-object (car seldata)))
(setq FieldCode (strcat "%<\\AcObjProp Object(%<\\_ObjId "
(itoa(vla-get-ObjectID #object))
">%).Layer"
">%"
) )
)
(command "_.TEXT" pause pause pause FieldCode "")
(princ "\nSomething went wrong")
)
(princ)
)

(princ "\ncommand FieldObjectLayer-MLEADER loaded")
(princ "\ncommand FieldObjectLayer-TEXT loaded")
(princ)

 

 If you use dimensions/leader/mleader: Turn AnnoMonitor ON to see which ones are no longer associated[!]

 

Sebastian

0 Likes

AVCPlugins
Advisor
Advisor

There are easier ways to label any drawing objects. If you need multi-leaders, then use the AVC Smart Leader plugin and configure it to display a layer (%layer% substitution). If you need to place simple texts above objects, then use the AVC Mark plugin in Label mode. Both plugins can be configured so that "fields" appear in the mLeader or mText, and not just the name of the layer.

Video: https://www.youtube.com/watch?v=1I-FU8iBfVk


Plugins for AutoCAD
A>V>C>
AppStore | Facebook | Twitter | YouTube | Blog
0 Likes

Kent1Cooper
Consultant
Consultant

Yes, I should have said pick Object in the Field category: list, and pick an object [pick on the little icon to the right of the Object type: slot] to see Layer as an available property.

Kent Cooper, AIA

sagnewYUXLR
Advocate
Advocate

all good thanks for your help it's exactly what i was after 

0 Likes