AutoLISP Tip - ENTDEL Function
You want to delete an entity in the AutoCAD drawing. And you want to do it over AutoLISP. You can use the ERASE command or the ENTDEL function.
This is how using the ERASE command is used: (command "erase" et "")
Now only the entity ET is deleted. To delete more entities their names are specified where ET is specified and before the RETURN.
But there's another way. It's a shorter way and it's a more comfortable way. You can also delete an entity over the ENTDEL function.
Let's delete ET again. But now we use the ENTDEL function. This is how it looks:
One thing. You can only delete one entity. So if you want to delete more entities you must use the ENTDEL function again.
That's so nice about the ENTDEL function. After using it again the deleted entities is recovered. It's put back into the drawing.
Putting it back could also be done over the UNDO command. But that's a long way. See for yourself. This is how it looks:
(command "undo" 1)
This only works before issuing another command. Using the ENTDEL function you can recover a deleted entity whenever you want.
Jos van Doorn.is an AutoCAD specialist, AutoLISP programmer and editor of the ACAD newsletter. To subscribe to the FREE newsletter send e-mail to: mailto:email@example.com
He has written six AutoCAD books. Interested in the books. Let him know. Send an e-mail to: firstname.lastname@example.org
Click here to find the best price on AutoCAD
Related sites: AEC Newsroom Digital CAD