当然,试试这个:
- (defun c:wtags ( / *error* la pt ss vl vr wl )
- (defun *error* ( msg )
- (mapcar 'setvar vr vl)
- (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
- (princ (strcat "\nError: " msg))
- )
- (princ)
- )
- (setq vr '(clayer osmode cmdecho)
- vl (mapcar 'getvar vr)
- )
- (setvar 'osmode 531)
- (setvar 'cmdecho 0)
- (if (setq pt (getpoint "\nSelect Wire to Tag: "))
- (if (setq ss (ssget pt))
- (if (wcmatch (setq wl (strcase (cdr (assoc 8 (entget (ssname ss 0)))))) "F-ALRM-WIRE*")
- (progn
- (setq wl (substr wl 12)
- la (strcat "F-ANNO-TAGS" wl)
- )
- (if (tblsearch "LAYER" la)
- (command "_.-layer" "_U" la "_T" la "_ON" la "_S" la "")
- (command "_.-layer" "_M" la "")
- )
- (command "_.mleader" "_non" pt "\")
- (cond
- ( (= wl "-SPKR") (command "S"))
- ( (= wl "-INDC") (command "V"))
- ( (= wl "-DTCT") (command "M"))
- ( (= wl "-PWR") (command "P"))
- ( (command "" "_.ddedit" (entlast) ""))
- )
- )
- (princ "\nObject not on "F-ALRM-WIRE*" layer.")
- )
- (princ "\nNo Object found at selected point.")
- )
- )
- (*error* nil)
- (princ)
- )
|