;;; Leader Zero Rotation

(defun C:LZR ; Kent Cooper Rotate Leader(s) about first Bend, 2nd leg Horizontal
(/ ss ldr pts23 base refang)
(if (setq ss (ssget "_:L" '((0 . "LEADER"))))
(repeat (setq n (sslength ss))
(setq
ldr (ssname ss (setq n (1- n))); Leader entity
pts23 ; defining points 2 & 3
(cdr ; remove first one [arrow point]
(mapcar 'cdr ; remove 10's [leave coordinates only]
(vl-remove-if
'(lambda (x) (/= (car x) 10))
(entget ldr)
); ...remove...
); mapcar
); cdr & pts23
); setq
(command "_.rotate" ldr ""
(setq base (trans (car pts23) 0 1)); (trans)lated from WCS to current UCS
"_reference" (angtos (setq refang (angle base (trans (cadr pts23) 0 1))) 2 8)
(angtos (* (fix (+ (/ refang pi) 0.5)) pi) 2 8); nearer horizontal direction
); command
); repeat
); if
(princ)
); defun
(c:lzr)

Advertisements