Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello again guys, I've been trying to solve this problem for a few hours.
My goal is to NUMBER THE BLOCKS BY PROXIMITY.
I found in this >>link<< an example that the alto draws a polyline interconnecting the nearest blocks, my goal is to look like it, changing only that
I want to increment the attributes of the blocks (1,2,3,4 ....).
If someone can help me I will be very grateful, I thank you in advance.
(defun c:nbp ( )
(defun :closer (a b c)(< (distance a b)(distance a c)))
(if (and (setq sel (ssget '((0 . "INSERT")))) (setq pnt (car (entsel "\nSelect the starting point: "))))
(progn
(foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex sel)))
(setq obj (vlax-ename->vla-object ent))
(setq lst (cons (setq pnt (vlax-get obj 'insertionpoint)) lst))
);for
(setq rte (list pnt))
(while lst
(setq pnt (car (vl-sort lst '(lambda (x y)(:closer pnt x y)))))
(setq lst (vl-remove pnt lst))
(setq rte (cons pnt rte)) ;;t
);;While
; (vl-cmdf "_.pline")
; (mapcar 'vl-cmdf (reverse rte))
; (vl-cmdf "")
);progn
);if
)
Solved! Go to Solution.