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

delete blockelements

1 REPLY 1
Reply
Message 1 of 2
Anonymous
106 Views, 1 Reply

delete blockelements

I need a lisp-example. (not refedit)
I want to delete blockelements with layer "DIM" and "TEXT",
from a block. The block should be a block.
I believe I have to use entmake, to create the block new, without
the elements on layer "DIM" and "TEXT". But how ?

mfg
Armin
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Here's an example. This finds a block named "test" and deletes all objects
in that block on layer "dim" and "text". It's important to note that this
code will NOT erase attributes in block references, or inserts, of this
block. You will need to create code that handles that on an insert by
insert basis. Any inserts added to the drawing after this code has run will
not have attributes that previously resided on either of those layers. You
may need to do a regen to see the effects on screen.

(vl-load-com)
(setq blkObj (vla-item (vla-get-blocks (vla-get-activedocument
(vlax-get-acad-object))) "test"))

(vlax-for obj blkObj
(if (or
(equal (vla-get-layer obj) "dim")
(equal (vla-get-layer obj) "text")
)
(vla-delete obj)
)
)
--
Bobby C. Jones
Dots are our friends...
DCL Bites...

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

Post to forums  

Autodesk Design & Make Report

”Boost