尝试关闭由“a\u DOOR\u FULL”层上的直线和圆弧组成的门。。看那张图,我首先推荐一些一致性
- (defun c:foo (/ _get b c d s)
- ;; RJP » 2018-10-12
- ;; Closes doors on a common layer that consist of an arc and a line
- (defun _get (e) (list (vlax-curve-getstartpoint e) (vlax-curve-getendpoint e)))
- (cond
- ;; Layer filter below '(8 . "A_DOOR_FULL")'
- ((setq s (ssget "_x" '((0 . "line,arc") (8 . "A_DOOR_FULL"))))
- (foreach a (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
- (if (= "LINE" (cdr (assoc 0 (entget a))))
- (setq b (cons (_get a) b))
- (setq c (cons (_get a) c))
- )
- )
- (foreach p b
- (cond
- ((setq d (vl-some '(lambda (x)
- (if (or (equal (setq e (car p)) (car x) 1e-8)
- (equal (setq e (car p)) (cadr x) 1e-8)
- (equal (setq e (cadr p)) (car x) 1e-8)
- (equal (setq e (cadr p)) (cadr x) 1e-8)
- )
- x
- )
- )
- c
- )
- )
- (setq d (vl-remove-if '(lambda (x) (equal e x 1e-8)) (append d p)))
- (entmakex (list '(0 . "LINE") (cons 10 (car d)) (cons 11 (cadr d)) '(8 . "DoorClosed")))
- )
- )
- )
- )
- )
- (princ)
- )
|