Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone, I hope you are all well. Currently, I'm trying to store the text closest to my block in a variable. However, I'm facing an issue with an infinite loop that is preventing the code from functioning correctly. Could someone please help me identify why this loop is occurring? I appreciate any assistance in advance.
(defun c:cobrinha ( )
(defun nmp:maisproximo (a b c) (< (distance a b) (distance a c)))
(defun nmp:pegueaoponto ( o ) (cdr (assoc 10 (entget o))))
(setq x_selp (ssget (list (cons 0 "INSERT")(cons 8 "ED_POLE"))))
(setq x_sel (ssget "_X" (list (cons 0 "TEXT")(cons 8 "ED_POLE"))))
(setq x_lst nil)
(foreach x_ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex x_sel)))
(setq x_lst (cons (list (nmp:pegueaoponto x_ent) x_ent) x_lst))
)
(foreach x_pts (vl-remove-if 'listp (mapcar 'cadr (ssnamex x_selp)))
(setq coo (nmp:pegueaoponto (car (vl-remove-if 'listp (mapcar 'cadr (ssnamex x_selp))))))
(while x_lst
(setq pnt (car (vl-sort x_lst '(lambda (x y) (nmp:maisproximo coo (car x) (car y))))))
(setq valor (cdr (assoc 1 (entget (cadr pnt) ))))
)
)
)
Solved! Go to Solution.