Jump to content

Change Layer of multiple attribute texts in a block at once


lonelysn

Recommended Posts

Dear all,

Need some help.

I have more than 200 Blocks contains Attributes, basically its a legend sheet,

all the blocks have attribute texts but in different several layers, i need to bring it to one layer.

say 

i have one light fitting with an attribute text called A1,

the block and the attribute text colour are in different layer- both are bylayer.

out side block has layer-1

inside block the light fittings has layer-0 (this is bcoz all the lights have same colour)

the attribute text has layer-2 (this is because the colour is white so kept it another layer)

 

i have another light fitting with an attribute text called A2,

the block and the attribute text colour are in different layer- both are bylayer.

out side block has layer-1

inside block the light fittings has layer-0 (this is bcoz all the lights have same colour)

the attribute text has layer-3 (this is because the colour is white so kept it another layer)

 

now i want to change both the attribute text layer to layer-4 at once

like this i have more than 200 blocks.

 

hoping a glad response/help/advice/solution from all the Gurus here.

 

Thanks

lonelysn 

CAD Tutor.PNG

Link to comment
Share on other sites

Try this a bit rough needs a check for the attsync so does not do non attributed blocks.

 


(defun AH:ATTS ( / block atts att)
(if (not (tblsearch "layer" "layer-4"))
(command "-layer" "m" "layer-4" "C" 7 "layer-4" "")
)
(vlax-for block (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
(if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*"))
(progn 
(vlax-for i block ; Foreach item in block
(if (eq (vla-get-objectname i) "AcDbAttributeDefinition");If item is an attribute
(vla-put-layer i "layer-4")
)
)
(command "attsync" "name" (vla-get-name block))
)
)
)
)
(AH:atts)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...