Very perfect , Lee , Thank you very much!
You're most welcome chlh_jd, thank you for your compliments
1. In Vlisp help file , "[WARNING] you can use entmod to modify entity which defined in the block , thus affecting all inserted blocks. In this way may create a kind of self-referential blocks, please do not do this, because it might make AutoCAD crashes." (--translate by google)
Do you encountered such a situation?
I should imagine such a self-referencing block would arise if you attempted to
entmod/entmake an
INSERT entity within its own block definition.
2. How to understand this statement :
(entmod (list (cons -1 e) '(-3 ("PE_URL"))))
A hyperlink is stored using xdata attached to an entity using the
PE_URL Appication ID, for example:
(-3
(
"PE_URL"
(1000 . "http://www.google.com")
(1002 . "{")
(1000 . "Google")
(1002 . "{")
(1071 . 0)
(1002 . "}")
(1002 . "}")
)
)
The expression in question is removing all xdata associated with the
PE_URL Application ID from the entity, which consequently removes the
PE_URL entry from the entity xdata (since the Application ID no longer holds data).
When removing xdata from an entity, you only need to supply the
entmod function with DXF Group -1 (i.e. the entity name) of the entity that is to be modified. This logic also applies when modifying xdata and modifying entities in general, but only with specific entity types, some of which I have listed below:
TYPE MODIFIED USING ONLY ENAME?
=====================================
ARC YES
ATTRIB (SINGLE) YES
ATTRIB (MULTI) NO
CIRCLE YES
ELLIPSE NO
HATCH NO
INSERT YES
LINE YES
LWPOLYLINE NO
MTEXT NO
POINT YES
POLYLINE YES
SPLINE NO
TEXT YES
XLINE NO
For example, you can change the colour of a
LINE entity using simply:
(if (setq sel (ssget "_+.:E:S:L" '((0 . "LINE"))))
(entmod (list (cons -1 (ssname sel 0)) '(62 . 1)))
)
Whereas, performing the same operation on, say, an
MTEXT entity requires the complete DXF data list (or at least, the DXF groups required to create the
MTEXT object in the first place).