Attributes are stored as separate entities following the insert. If
you want to change the layer of the attributes as well, you need to
process them individually.
It's not necessary to pass an entire entity association list to (entmod
..), and using the (subst ...) function is a waste of time (in this
case).
Something like (untested):
(while (/= countfurn exfurn_number)
(setq InsertName (ssname exfurn countfurn)
EntityList (entget EntityName)
)
;; Change the block insert's layer
(entmod (list (cons -1 InsertName) layerfurn))
;; If the insert has attributes ...
(if (= 1 (cdr (assoc 66 EntityList)))
;; Loop over all attributes ...
(while (/= "SEQEND"
(cdr
(assoc 0
(setq EntityList
(entget (entnext (cdr (assoc -1 EntityList))))
)
)
)
;; Change the attribute's layer
(entmod (list (assoc -1 EntityList) layerfurn))
)
)
;; Change the layer of the SEQEND entity
(entmod (list (assoc -1 EntityList) layerfurn))
;; Update the block on screen
(entupd InsertName)
(setq countfurn (+ 1 countfurn))
jrf
Member of the Autodesk Discussion Forum Moderator Program
In article , Tracihabergham wrote:
> I am writing an autolisp programme to enable users to change the
> layers (& colour) of a block by clicking on it. This works on simple
> blocks that have no attributes but the ones with attribute don't
> work! They change layers but not their colours as required.
> Can
> anybody help. I am using the entmod command and substituting the
> layer (8 . "whatever") to (8 . "0").
> Thank you
>
>
> [Attachment
> decoded to FILE://\VA\attachments\exfurniture.lsp]
>