像这样的
- (defun c:test ( / SS i ent lst x SelN n Nlst Tlst )
- (if
- (and
- (princ "\nSelect the closed(white) plines: ")
- (setq SS (ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))))
- );and
- (progn
- (repeat (setq i (sslength SS)) ; repeat for each closed polyline
- (setq ent (ssname SS (setq i (1- i))))
- (setq lst (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) (entget ent))))
-
- (if
- (and
- (setq SelN (ssget "_WP" lst))
- (or (not (ssmemb ent SelN)) (ssdel ent SelN))
- (< 0 (sslength SelN))
- )
- (progn
- (repeat (setq n (sslength SelN)) ; repeat for each entity inside the polyline
- (setq Nlst (cons (ssname SelN (setq n (1- n))) Nlst)) ; create list for the SS
- )
- (setq Tlst (cons (reverse Nlst) Tlst)) ; store the SS list into the global list
- (setq Nlst nil) ; reset the SS list
- )
- ); if
- ); repeat
- (princ "\n") (print Tlst) ; print the global list
- );progn
- ); if/while
- (princ)
- )
这是经过大量修改的代码,原始代码来自Lee Mac(MatchCenInsPoly)-根据我的旧请求。 |