另一个,对于LWDOLYLINE和POLYLINE:
- ;; Retrieve Polyline Vertices - Lee Mac
- ;; ent - [ent] Entity name of LWPolyline or Polyline
- (defun polyverts ( ent / _lwpolyverts _polyverts )
-
- (defun _lwpolyverts ( enx / itm )
- (if (setq itm (assoc 10 enx))
- (cons (cdr itm) (_lwpolyverts (cdr (member itm enx))))
- )
- )
- (defun _polyverts ( ent / enx )
- (if (= "VERTEX" (cdr (assoc 0 (setq enx (entget ent)))))
- (cons (cdr (assoc 10 enx)) (_polyverts (entnext ent)))
- )
- )
- (if (= "LWPOLYLINE" (cdr (assoc 0 (entget ent))))
- (_lwpolyverts (entget ent))
- (_polyverts (entnext ent))
- )
- )
使用多段线名称调用,例如:
- (if (setq s (ssget "_+.:E:S" '((0 . "*POLYLINE"))))
- (polyverts (ssname s 0))
- )
|