I have a couple of lisp routines using 'nentsel' (rather than 'entsel') so I
can select entities embedded in blocks.
The routine may then, for example, go on to change the layer (assoc 8) of
the selected embedded entity by using the 'cons', 'subst' and 'entmod' lisp
functions.
The problem is that whilst 'entmod' will update the selected embedded
entity, it does not update the parent block itself and so the changes are
not effective until the drawing has been regenerated.
I would like to identify if a particular entity selected using 'nentsel' is,
in fact, within a block and, if it is, extract the entity name of that block
insertion and then update that particular insertion of the block.
Can this be done easily?
TIA
--
Mike
Please remove 'SAFETYCATCH' from E-mail address before firing off your reply
Try with (entupd <insertion entity name>), it will regenerate the parent entity
>
> I would like to identify if a particular entity selected using 'nentsel' is,
> in fact, within a block and, if it is, extract the entity name of that block
> insertion and then update that particular insertion of the block.
>
> Can this be done easily?
Not easily, nor hardly. It can't be done. One entity in a block is stored once
on the drawing (that's what it was till v.14).
HTH
Juergen
mlv wrote:
>
> Hi
>
> I have a couple of lisp routines using 'nentsel' (rather than 'entsel') so I
> can select entities embedded in blocks.
>
> The routine may then, for example, go on to change the layer (assoc 8) of
> the selected embedded entity by using the 'cons', 'subst' and 'entmod' lisp
> functions.
>
> The problem is that whilst 'entmod' will update the selected embedded
> entity, it does not update the parent block itself and so the changes are
> not effective until the drawing has been regenerated.
>
> I would like to identify if a particular entity selected using 'nentsel' is,
> in fact, within a block and, if it is, extract the entity name of that block
> insertion and then update that particular insertion of the block.
>
> Can this be done easily?
>
(setq elist (nentsel)
blk (caar (reverse elist))
)
Now when you're done updating the subentity, feed the blk symbol to entupd
to regenerate only the one block:
(entupd blk)
--
Get free software and more at http://www2.stonemedia.com/franko
"mlv" <mike.v...@jetSAFETYCATCH.uk> wrote in message
news:8bg7fi$90t$1...@soap.pipex.net...
Thanks for the info.
My lisp routine (AutoCAD 14.01) is used to modify block attributes (e.g.
colour, layer, etc.). Typical lists returned by picking embedded block
entities with (setq ent (nentsel)) are:
Picking Text returns: (<Entity name: 3701f78> (784.888 382.749 0.0) ((1.0
0.0 0.0)
(0.0 1.0 0.0) (0.0 0.0 1.0) (516.0 400.0 0.0)) (<Entity name: 3701120>))
Picking a Line returns: (<Entity name: 3701d58> (815.856 428.612 0.0) ((1.0
0.0 0.0)
(0.0 1.0 0.0) (0.0 0.0 1.0) (516.0 400.0 0.0)) (<Entity name: 3701120>))
Picking an Attribute returns: (<Entity name: 3701130> (737.861 380.073
0.0))
For Text and Line, the last list item (<Entity name: 3701120>) is the parent
block insertion which I can extract and use with 'entupd'. Unfortunately
this parent block information does not seem to be returned when an Attribute
is selected.
How is it possible to get the parent block information when picking an
Attribute?
(setq nen (nentsel))
(ssname (ssget (cadr nen)) 0) ; this is your block
(car nen) ; this is your attribute
--
Adi
mlv <mike.v...@jetSAFETYCATCH.uk> wrote in message
news:8bnj90$fp0$1...@soap.pipex.net...
[snip]
I've been experimenting and the following seems to update the parent block
when an attribute has been modified and despite the fact that the parent
block entity name is not available from the attribute list returned by
'nentsel'.
atec = attribute entity codes
atss = attribute selection set
ln = layer name
nln = new layer name
(setq atec (entget (ssname atss index))
index (1+ index)
ln (assoc 8 atec)
)
(entmod (subst (cons (car ln) nln) ln atec))
(entupd (cdr (assoc -1 atec)))
The routine seems to update the parent block by reference to the attribute
sub-entity name.
Any comments anyone?
--
Adi
mlv <mike.v...@jetSAFETYCATCH.uk> wrote in message
news:8bqg2v$igg$1...@soap.pipex.net...
[snip]