If you want polyline (lweight), why don't you try to connect all with numbers starting from smallest one, then when connection with second, you do search to closest one (greedy algorithm) if it don't have number, make connection, all until it finds numerable block and all until end... Why do you need "U" - undo... I'd code to make lwpoly no matter what input could be, if it "needs" input which IMHO is not helpful and necessity...
Hi ribarm . Thanks you for your time but is not what I am searching for. The code in post 1 works fine , the only problem is that the code confused when when some points (not the selected) don't have numbers. Is any way this code work and connect with line points with numbers ,and give the option to convert this lines (if I want to polylines) ,but not confused if some point didn't have numbers. Look the 2 dwg file I upload in post1
Thanks
; error: bad function: #<SUBR @000001a11f39dca0 -lambda->
(vl-cmdf "mspace" "zoom" 20 pv)