Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/13/2018 in all areas

  1. On first glance, this - (defun vector (p1 p2) (mapcar '(lambda (%1 %2) (- %2 %1) ) p1 p2 ) ) Could be written - (defun vector (p1 p2) (mapcar '- p2 p1) ) But at that point, you may as well just write the mapcar function inline. Also this - (if lst (setq lst (cons c lst)) (setq lst (list c)) ) Can be replaced with - (setq lst (cons c lst)) Since (cons c lst) == (list c) when lst is nil.
    1 point
  2. Give this a try for closing the doors that consist of a line and an arc on layer "A_DOOR_FULL" .. looking at that drawing I'd recommend some consistency first (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) )
    1 point
×
×
  • Create New...