我建议使用“massoc”函数,例如:
- ;; MAssoc - Lee Mac
- ;; Returns all associations of a key in an association list
- (defun LM:MAssoc ( key lst / item )
- (if (setq item (assoc key lst))
- (cons (cdr item) (LM:MAssoc key (cdr (member item lst))))
- )
- )
现在
- (defun c:test ( / s )
- (if (setq s (ssget "_+.:E:S" '((0 . "LWPOLYLINE"))))
- (mapcar 'print (LM:MAssoc 10 (entget (ssname s 0))))
- )
- (princ)
- )
|