Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Lisp Command (Nentsel ) Question

80 views
Skip to first unread message

mlv

unread,
Mar 24, 2000, 3:00:00 AM3/24/00
to
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?

TIA
--
Mike
Please remove 'SAFETYCATCH' from E-mail address before firing off your reply

Guillem Gonzàlez

unread,
Mar 24, 2000, 3:00:00 AM3/24/00
to
>
> 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.

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).


guillem.gonzalez.vcf

J.Palme

unread,
Mar 24, 2000, 3:00:00 AM3/24/00
to
If "el" is the embedded entity and "e2" is the (parent) block entity you
must (entmod e1) and then (entupd e2)

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?
>

Frank Oquendo

unread,
Mar 24, 2000, 3:00:00 AM3/24/00
to
You can use ENTUPD on the parent insert to effect the change (changes to
subentities don't show until their parents are updated). The parent insert
is part of the list you retrieved (it's the last list). Here's an example on
how to retrieve the block's entity name:

(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...

mlv

unread,
Mar 27, 2000, 3:00:00 AM3/27/00
to
Frank Oquendo wrote:
>
>You can use ENTUPD on the parent insert to effect the change (changes to
>subentities don't show until their parents are updated). The parent insert
>is part of the list you retrieved (it's the last list). Here's an example
on
>how to retrieve the block's entity name:
>
>(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)
>


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?

Adi Buturovic

unread,
Mar 27, 2000, 3:00:00 AM3/27/00
to
This may be not very pretty:

(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]

mlv

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to
Adi Buturovic wrote in message ...

>
>This may be not very pretty:
>
>(setq nen (nentsel))
>
>(ssname (ssget (cadr nen)) 0) ; this is your block
>(car nen) ; this is your attribute
>


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 Buturovic

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to
That is exactly what Manual sais.

--
Adi

mlv <mike.v...@jetSAFETYCATCH.uk> wrote in message

news:8bqg2v$igg$1...@soap.pipex.net...
[snip]

0 new messages