(defun c:m2l ( / l_ss b_ss b_cnt b_ent i_pt min_dist m_pt l_cnt l_ent c_pt md m_ang)
(prompt "\nSelect Lines : ")
(setq l_ss (ssget "_X" '((0 . "ARC,CIRCLE,ELLIPSE,LINE,LWPOLYLINE,POLYLINE,SPLINE"))))
(prompt "\nSelect Blocks : ")
(setq b_ss (ssget '((0 . "INSERT") (2 . "552-2,551-1,552-0-CO"))))
(repeat (setq b_cnt (sslength b_ss))
(setq b_ent (ssname b_ss (setq b_cnt (1- b_cnt)))
i_pt (cdr (assoc 10 (entget b_ent)))
min_dist 1000000
m_pt nil
)
(repeat (setq l_cnt (sslength l_ss))
(setq l_ent (ssname l_ss (setq l_cnt (1- l_cnt)))
c_pt (vlax-curve-getclosestpointto l_ent i_pt)
)
(cond ( (< (setq md (distance i_pt c_pt)) min_dist)
(setq min_dist md
m_pt c_pt
)
)
)
)
(setq m_ang (angle i_pt m_pt)
m_pt (polar i_pt m_ang (- min_dist 5.0));;5.0 = radius of circle in block
)
(vla-move (vlax-ename->vla-object b_ent) (vlax-3d-point i_pt) (vlax-3d-point m_pt))
)
(princ)
)
The above will only allow the selection of blocks named 552-2, 551-1, and 552-0-CO
Sorry but I'm a bit brain dead at the moment. Move what to the specific line layer "SPPC-E-EL", the lines or the blocks?
I am not one of the robots you're looking for