CADWORKER Posted September 20, 2023 Posted September 20, 2023 Hi, I am looking for a lisp to move the arrowhead of the leader to the nearest point. There are multiple points and leaders which has to be adjusted. Thanks.Arrow and Points.dwg Quote
Tsuky Posted September 21, 2023 Posted September 21, 2023 Hi, A start with your drawing (defun c:FOO ( / ss n dxf_ent pt ss_c i nw_pt a d) (setq ss (ssget "_X" '((0 . "LEADER")))) (cond (ss (repeat (setq n (sslength ss)) (setq dxf_ent (entget (ssname ss (setq n (1- n)))) pt (cdr (assoc 10 dxf_ent)) ) (cond ((setq ss_c (ssget "_C" (mapcar '- pt '(0.5 0.5 0.0)) (mapcar '+ pt '(0.5 0.5 0.0)) '((0 . "INSERT,POINT")))) (repeat (setq i (sslength ss_c)) (setq nw_pt (cdr (assoc 10 (entget (ssname ss_c (setq i (1- i))))))) (cond ((> (cadr nw_pt) (cadr pt)) (setq a (angle pt nw_pt) d (distance pt nw_pt) ) (foreach e dxf_ent (if (eq (car e) 10) (setq dxf_ent (subst (cons 10 (polar (cdr e) a d)) e dxf_ent)) ) ) (entmod dxf_ent) ) ) ) ) ) ) ) ) (prin1) ) Quote
CADWORKER Posted September 21, 2023 Author Posted September 21, 2023 Tsuky Thanks you, This is excellent. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.