Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
sagnewYUXLR
458 Views, 10 Replies

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

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 

 

Tags (1)
10 REPLIES 10
Message 2 of 11
Kent1Cooper
in reply to: sagnewYUXLR


@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
Message 3 of 11
sagnewYUXLR
in reply to: Kent1Cooper

hi kent 

 

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

Message 4 of 11
sagnewYUXLR
in reply to: sagnewYUXLR

sagnewYUXLR_0-1704921731920.png

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

Message 5 of 11
Kent1Cooper
in reply to: sagnewYUXLR

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

Kent Cooper, AIA
Message 6 of 11
sagnewYUXLR
in reply to: Kent1Cooper

sagnewYUXLR_0-1704922703387.png

unfortunately not 😞 

 

thanks for your help tho much appreicated 

 

 

Message 7 of 11
sagnewYUXLR
in reply to: sagnewYUXLR

got it my friend thanks 

 

sagnewYUXLR_0-1704922804843.png

 

Message 8 of 11
cadffm
in reply to: Kent1Cooper

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

Message 9 of 11
AVCPlugins
in reply to: sagnewYUXLR

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
Message 10 of 11
Kent1Cooper
in reply to: sagnewYUXLR

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
Message 11 of 11
sagnewYUXLR
in reply to: Kent1Cooper

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report