Author Topic: Help me to fix a code : Connect attribiute points with line by point number  (Read 1821 times)

0 Members and 1 Guest are viewing this topic.

mhy3sx

  • Newt
  • Posts: 115
Hi, I use this code to connect attribiute block points by point name. The code works fine if all points in the drawing have numbers (in POINT tag).
The problem is if in the drawing exist one point without number , the code at the end didn't create a polyline but create a line from the last point to one point without number.

Can anyone help me to fix this problem. I want to have the option to convert to polyline every time.
The most of the time I have points without number in my drawing and this code drive me crasy !!

I attach two drawings. In the working.dwg  the code works fine. In not working.dwg I have some points without number and when hit Ender to sto the code and convert to polyline .... you will see the problem.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:lineat (/ data AllPointnumber stop pts data i p pv pts_)
  2. (setq ped (getvar 'peditaccept))
  3. (setvar 'peditaccept 1)
  4. (if (setq AllPointnumber nil stop nil pts nil
  5.            data (ssget "_X" (list '(0 . "INSERT")'(66 . 1)'(2 . "Point,KORYFES,station,trigonom,KOKAEK,KOROT,Ktir")(cons 410 (getvar 'Ctab)))))
  6.         (progn
  7.           (repeat (setq i (sslength data))
  8.             (if (setq
  9.                   p (vl-some '(lambda (x)
  10.                                 (if (eq (vla-get-tagstring x) "POINT")
  11.                                   (list (vla-get-textstring x)
  12.                                         (vlax-get e 'Insertionpoint)
  13.                                   )
  14.                                 )
  15.                               )
  16.                              (vlax-invoke
  17.                                (setq e (vlax-ename->vla-object
  18.                                          (ssname data (setq i (1- i)))
  19.                                        )
  20.                                )
  21.                                'GetAttributes
  22.                              )
  23.                     )
  24.                 )
  25.               (setq AllPointnumber (cons p AllPointnumber))
  26.             )
  27.           )
  28.         (setq 2bjoin (ssadd))
  29.           (while (null Stop)
  30.                 (setq pv   (getstring "\nGive point number  <Space to continue or Enter to finish and convert to polyline &#933;/&#925;> :"))
  31.                 (cond
  32.                       ((setq a (assoc (strcase pv) AllPointnumber))
  33.                        (setq pts (cons (cadr a) pts) pts_ (cons (cadr a) pts_))
  34.                        (if (= (length pts) 2)
  35.                            (progn
  36.                                 (entmakex (list (cons 0 "LINE")
  37.                                 (cons 10 (car pts))
  38.                                 (cons 11 (cadr pts))))
  39.                                 (setq  pts (list (car pts)))(ssadd (entlast) 2bjoin)
  40.                                 )
  41.                            )
  42.                        )
  43.                       ((eq pv "") (setq stop "Done"))
  44.                       ((eq (strcase pv) "U")
  45.                        (entdel (setq del (ssname 2bjoin (1- (sslength 2bjoin)))))(ssdel  del 2bjoin)
  46.                        (setq pts_ (cdr pts_) pts  (list (car pts_)) ))
  47.                       ((null a) (princ "\n<<Point value not found>>"))  
  48.                       ))
  49.           (initget "Yes No")
  50.           (setq convert (cond ((getkword "\nConvert to polylines? [Yes/No] <N>: ")) ( "No" )))
  51.           (if (eq "Yes" convert)
  52.               (command "_.pedit" "_M" 2bjoin  "" "_J" "" ""))
  53.           )
  54.     )
  55.     (setvar 'peditaccept ped)
  56.       (princ)
  57.       )
  58.  
  59.  

Thanks

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
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...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

mhy3sx

  • Newt
  • Posts: 115
It is topographic drawing. The numbers of points are random. I want to have the option to convert the lines to polyline. The problem is when the attribute point didn't have number. Can any one fix this?

Thanks

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
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...

Not sure will it work, but something like this I thought :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:connptslwpoly ( / car-sort ss i blks blksattpt )
  2.  
  3.  
  4.   (defun car-sort ( lst cmp / rtn )
  5.     (setq rtn (car lst))
  6.     (foreach itm (cdr lst)
  7.       (if (apply cmp (list itm rtn))
  8.         (setq rtn itm)
  9.       )
  10.     )
  11.     rtn
  12.   )
  13.  
  14.   (if (setq ss (ssget (list (cons 0 "INSERT") (cons 66 1) (cons 2 "Point,KORYFES,station,trigonom,KOKAEK,KOROT,Ktir"))))
  15.     (progn
  16.       (repeat (setq i (sslength ss))
  17.         (setq blks (cons (ssname ss (setq i (1- i))) blks))
  18.       )
  19.       (setq blksattpt
  20.         (mapcar
  21.           (function (lambda ( x )
  22.             (list
  23.               x
  24.               (mapcar
  25.                 (function (lambda ( y )
  26.                   (list
  27.                     (vla-get-tagstring y)
  28.                     (vla-get-textstring y)
  29.                   )
  30.                 ))
  31.                 (vlax-invoke
  32.                   (vlax-ename->vla-object x)
  33.                   (quote getattributes)
  34.                 )
  35.               )
  36.               (safearray-value (variant-value (vla-get-insertionpoint (vlax-ename->vla-object x))))
  37.             )
  38.           ))
  39.           blks
  40.         )
  41.       )
  42.       (setq blksattpt
  43.         (vl-sort
  44.           blksattpt
  45.             (function (lambda ( a b )
  46.               (if
  47.                 (and
  48.                   (= (strcase (caaadr a)) "POINT")
  49.                   (= (strcase (caaadr b)) "POINT")
  50.                   (/= (cadr (car (cadr a))) "")
  51.                   (/= (cadr (car (cadr b))) "")
  52.                 )
  53.                 (< (atof (cadr (car (cadr a)))) (atof (cadr (car (cadr b)))))
  54.                 (< (distance
  55.                      (caddr a)
  56.                      (caddr
  57.                        (car-sort
  58.                          (vl-remove-if-not
  59.                            (function (lambda ( x )
  60.                               (or
  61.                                 (not (= (strcase (caaadr x)) "POINT"))
  62.                                 (= "" (cadr (car (cadr x))))
  63.                               )
  64.                            ))
  65.                            blksattpt
  66.                          )
  67.                          (function (lambda ( p q )
  68.                            (< (distance (caddr a) (caddr p)) (distance (caddr a) (caddr q)))
  69.                          ))
  70.                        )
  71.                      )
  72.                    )
  73.                    (distance
  74.                      (caddr b)
  75.                      (caddr
  76.                        (car-sort
  77.                          (vl-remove-if-not
  78.                            (function (lambda ( x )
  79.                               (or
  80.                                 (not (= (strcase (caaadr x)) "POINT"))
  81.                                 (= "" (cadr (car (cadr x))))
  82.                               )
  83.                            ))
  84.                            blksattpt
  85.                          )
  86.                          (function (lambda ( p q )
  87.                            (< (distance (caddr b) (caddr p)) (distance (caddr b) (caddr q)))
  88.                          ))
  89.                        )
  90.                      )
  91.                    )
  92.                 )
  93.               )
  94.             ))
  95.         )
  96.       )
  97.       (vl-cmdf "_.PLINE")
  98.       (foreach blk blksattpt
  99.         (if (= (strcase (caaadr blk)) "POINT")
  100.           (vl-cmdf "_non" (caddr blk))
  101.         )
  102.       )
  103.       (initget "Yes No")
  104.       (if
  105.         (= "Yes"
  106.           (cond
  107.             ( (getkword "\nDo you want closed LWPOLYLINE [Yes / No] <Yes> : ") )
  108.             ("Yes")
  109.           )
  110.         )
  111.         (vl-cmdf "_C")
  112.         (vl-cmdf "")
  113.       )
  114.     )
  115.     (prompt "\nNothing selected...")
  116.   )
  117.   (princ)
  118. )
  119.  
« Last Edit: March 08, 2023, 08:04:15 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

mhy3sx

  • Newt
  • Posts: 115
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

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
It sounds like your looking for stringing this is a every day thing for CIVIL works, where a field survey is brought in from a points file or a survey instrument, the stringing is controlled by having a description as part of the point eg pt,X,Y,Z,Desc   The points can be mixed up only criteria is that the points are processed in file order.

You just use CIV3D or other programs like "Stringer"

200,338725.774,6008196.374,101.284,01RTK2
201,338725.319,6008193.161,101.292,01RTK2
202,338725.331,6008192.495,101.289,01RTK2
203,338725.528,6008182.497,101.248,01RTK2
204,338725.725,6008172.498,101.206,01RTK2
205,338725.922,6008162.5,101.164,01RTK2
206,338726.118,6008152.502,101.122,01RTK2
207,338726.319,6008142.31,101.08,01RTK2
208,338726.554,6008140.324,101.064,01RTK2
209,338728.274,6008132.541,100.997,02RTK2
210,338728.948,6008102.548,100.892,02RTK2
211,338727.461,6008094.296,100.931,03RTK
212,338727.3,6008092.514,100.939,03RTK
213,338727.302,6008092.289,100.939,03RTK
214,338727.494,6008082.516,100.948,03RTK
215,338727.691,6008072.518,100.975,03RTK
216,338727.887,6008062.52,101.007,03RTK
217,338728.084,6008052.522,101.039,03RTK
218,338728.281,6008042.524,101.096,03RTK
219,338728.477,6008032.526,101.178,03RTK
220,338728.598,6008026.377,101.228,03RTK
221,338728.835,6008024.296,101.228,03RTK
222,338729.227,6008022.538,101.241,03RTK
A man who never made a mistake never made anything

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
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

I've modified quirks with debugging, so my code is only + for you to test... I've coded how I think is better - with not too much trouble by choosing next/undo things...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

mhy3sx

  • Newt
  • Posts: 115
I think something else so the first code will work

The code below select all blocks with POINT tag  empty.

The second code select all blocks with POINT tag  *

So when lineat command start

1) select all blocks with POINT tag  empty
2) Fill the emply tag with *
3) Thecode works fine
4) After do or not polyline
5) select all blocks with POINT tag  *  and make this tag empty again

The idea is to find and replace the empty POINT tag (if exist) with * (temporary) and when the lisp finish (and create or not polyline then) replace the POINT tag with * to empty.

Is it possible to be done ?

Code - Auto/Visual Lisp: [Select]
  1. (defun c:SelBlk (/ SB_FindAtt SB_FindVal SB_Selection SB_FoundSel SB_Count SB_BlkEnt)
  2.    (setq SB_FindAtt "POINT")
  3.    (setq SB_FindVal "")
  4.    (if
  5.       (setq SB_Selection (ssget "_X" '((0 . "INSERT")(66 . 1))))
  6.       (progn
  7.          (setq SB_FoundSel (ssadd))
  8.          (setq SB_Count 0)
  9.          (repeat (sslength SB_Selection)
  10.             (setq SB_BlkEnt (ssname SB_Selection SB_Count))
  11.             (if
  12.                (FindAtt (vlax-ename->vla-object SB_BlkEnt) SB_FindAtt SB_FindVal)
  13.                (ssadd SB_BlkEnt SB_FoundSel)
  14.             )
  15.             (setq SB_Count (1+ SB_Count))
  16.          )
  17.          (if
  18.             (> (sslength SB_FoundSel) 0)
  19.             (sssetfirst nil SB_FoundSel)
  20.          )
  21.       )
  22.    )
  23.    (princ)
  24. )
  25.  
  26. (defun c:SelBlk2 (/ SB_FindAtt SB_FindVal SB_Selection SB_FoundSel SB_Count SB_BlkEnt)
  27.    (setq SB_FindAtt "POINT")
  28.    (setq SB_FindVal "*")
  29.    (if
  30.       (setq SB_Selection (ssget "_X" '((0 . "INSERT")(66 . 1))))
  31.       (progn
  32.          (setq SB_FoundSel (ssadd))
  33.          (setq SB_Count 0)
  34.          (repeat (sslength SB_Selection)
  35.             (setq SB_BlkEnt (ssname SB_Selection SB_Count))
  36.             (if
  37.                (FindAtt (vlax-ename->vla-object SB_BlkEnt) SB_FindAtt SB_FindVal)
  38.                (ssadd SB_BlkEnt SB_FoundSel)
  39.             )
  40.             (setq SB_Count (1+ SB_Count))
  41.          )
  42.          (if
  43.             (> (sslength SB_FoundSel) 0)
  44.             (sssetfirst nil SB_FoundSel)
  45.          )
  46.       )
  47.    )
  48.    (princ)
  49. )
  50.  
  51. (defun FindAtt (FA_BlkObject FA_AttTag FA_AttVal / FA_Attributes FA_Return)
  52.    (if
  53.       (and
  54.          (= (type FA_BlkObject) 'VLA-OBJECT)
  55.          (= (vla-get-ObjectName FA_BlkObject) "AcDbBlockReference")
  56.          (= (vla-get-HasAttributes FA_BlkObject) :vlax-true)
  57.          (= (type FA_AttTag) 'STR)
  58.          (= (type FA_AttVal) 'STR)        
  59.       )
  60.       (progn        
  61.          (setq FA_Attributes (vlax-safearray->list (vlax-variant-value (vla-GetAttributes FA_BlkObject))))
  62.          (foreach FA_Item FA_Attributes
  63.             (if
  64.                (and
  65.                   (= (strcase (vla-get-TagString  FA_Item)) (strcase FA_AttTag))
  66.                   (= (strcase (vla-get-TextString FA_Item)) (strcase FA_AttVal))
  67.                )
  68.                (setq FA_Return T)
  69.             )
  70.          )
  71.       )
  72.    )
  73.    FA_Return
  74. )  
  75.  
  76.  

Code - Auto/Visual Lisp: [Select]
  1.     (defun c:lineat (/ data AllPointnumber stop pts data i p pv pts_)
  2.     (vl-load-com)
  3.     (setq ped (getvar 'peditaccept))
  4.     (setvar 'peditaccept 1)
  5.     (if (setq AllPointnumber nil stop nil pts nil
  6.                data (ssget "_X" (list '(0 . "INSERT")'(66 . 1)'(2 . "Point,KORYFES,station,trigonom,KOKAEK,KOROT,Ktir")(cons 410 (getvar 'Ctab)))))
  7.             (progn
  8.               (repeat (setq i (sslength data))
  9.                 (if (setq
  10.                       p (vl-some '(lambda (x)
  11.                                     (if (eq (vla-get-tagstring x) "POINT")
  12.                                       (list (vla-get-textstring x)
  13.                                             (vlax-get e 'Insertionpoint)
  14.                                       )
  15.                                     )
  16.                                   )
  17.                                  (vlax-invoke
  18.                                    (setq e (vlax-ename->vla-object
  19.                                              (ssname data (setq i (1- i)))
  20.                                            )
  21.                                    )
  22.                                    'GetAttributes
  23.                                  )
  24.                         )
  25.                     )
  26.                   (setq AllPointnumber (cons p AllPointnumber))
  27.                 )
  28.               )
  29.             (setq 2bjoin (ssadd))
  30.               (while (null Stop)
  31.                     (setq pv   (getstring "\nGive point number  <Space to continue or Enter to finish and convert to polyline &#38;#38;#933;/&#38;#38;#925;> :"))
  32.                     (cond
  33.                           ((setq a (assoc (strcase pv) AllPointnumber))
  34.                            (setq pts (cons (cadr a) pts) pts_ (cons (cadr a) pts_))
  35.                            (if (= (length pts) 2)
  36.                                (progn
  37.                                     (entmakex (list (cons 0 "LINE")
  38.                                     (cons 10 (car pts))
  39.                                     (cons 11 (cadr pts))))
  40.                                     (setq  pts (list (car pts)))(ssadd (entlast) 2bjoin)
  41.                                     )
  42.                                )
  43.                            )
  44.                           ((eq pv "") (setq stop "Done"))
  45.                           ((eq (strcase pv) "U")
  46.                            (entdel (setq del (ssname 2bjoin (1- (sslength 2bjoin)))))(ssdel  del 2bjoin)
  47.                            (setq pts_ (cdr pts_) pts  (list (car pts_)) ))
  48.                           ((null a) (princ "\n<<Point value not found>>"))  
  49.                           ))
  50.               (initget "Yes No")
  51.               (setq convert (cond ((getkword "\nConvert to polylines? [Yes/No] <N>: ")) ( "No" )))
  52.               (if (eq "Yes" convert)
  53.                   (command "_.pedit" "_M" 2bjoin  "" "_J" "" ""))
  54.               )
  55.         )
  56.         (setvar 'peditaccept ped)
  57.           (princ)
  58.           )
  59.      
  60.      
  61.  

Thanks
« Last Edit: March 08, 2023, 01:58:17 AM by mhy3sx »

kasmo

  • Newt
  • Posts: 28
Try this:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:lineat (/ data AllPointnumber stop pts data i p pv pts_)
  2. (setq ped (getvar 'peditaccept))
  3. (setvar 'peditaccept 1)
  4. (if (setq AllPointnumber nil stop nil pts nil
  5.            data (ssget "_X" (list '(0 . "INSERT")'(66 . 1)'(2 . "Point,KORYFES,station,trigonom,KOKAEK,KOROT,Ktir")(cons 410 (getvar 'Ctab)))))
  6.         (progn
  7.           (repeat (setq i (sslength data))
  8.             (if (setq
  9.                   p (vl-some '(lambda (x)
  10.                                 (if (eq (vla-get-tagstring x) "POINT")
  11.                                   (list (vla-get-textstring x)
  12.                                         (vlax-get e 'Insertionpoint)
  13.                                   )
  14.                                 )
  15.                               )
  16.                              (vlax-invoke
  17.                                (setq e (vlax-ename->vla-object
  18.                                          (ssname data (setq i (1- i)))
  19.                                        )
  20.                                )
  21.                                'GetAttributes
  22.                              )
  23.                     )
  24.                 )
  25.               (setq AllPointnumber (cons p AllPointnumber))
  26.             )
  27.           )
  28.         (setq allpointnumber (vl-remove-if (lambda (x) (eq (car x) "")) allpointnumber))
  29.         (setq 2bjoin (ssadd))
  30.           (while (null Stop)
  31.                 (setq pv   (getstring "\nGive point number  <Space to continue or Enter to finish and convert to polyline &#38;#38;#38;#933;/&#38;#38;#38;#925;> :"))
  32.                 (cond
  33.                       ((setq a (assoc (strcase pv) AllPointnumber))
  34.                        (setq pts (cons (cadr a) pts) pts_ (cons (cadr a) pts_))
  35.                        (if (= (length pts) 2)
  36.                            (progn
  37.                                 (entmakex (list (cons 0 "LINE")
  38.                                 (cons 10 (car pts))
  39.                                 (cons 11 (cadr pts))))
  40.                                 (setq  pts (list (car pts)))(ssadd (entlast) 2bjoin)
  41.                                 )
  42.                            )
  43.                        )
  44.                       ((eq pv "") (setq stop "Done"))
  45.                       ((eq (strcase pv) "U")
  46.                        (entdel (setq del (ssname 2bjoin (1- (sslength 2bjoin)))))(ssdel  del 2bjoin)
  47.                        (setq pts_ (cdr pts_) pts  (list (car pts_)) ))
  48.                       ((null a) (princ "\n<<Point value not found>>"))  
  49.                       ))
  50.           (initget "Yes No")
  51.           (setq convert (cond ((getkword "\nConvert to polylines? [Yes/No] <N>: ")) ( "No" )))
  52.           (if (eq "Yes" convert)
  53.               (command "_.pedit" "_M" 2bjoin  "" "_J" "" ""))
  54.           )
  55.     )
  56.     (setvar 'peditaccept ped)
  57.       (princ)
  58.       )

mhy3sx

  • Newt
  • Posts: 115
Hi kasmo. I run your code but gives me this error

Code: [Select]
; error: bad function: #<SUBR @000001a11f39dca0 -lambda->

Thanks

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
This :
(setq allpointnumber (vl-remove-if (lambda (x) (eq (car x) "")) allpointnumber))

Should be either :
(setq allpointnumber (vl-remove-if '(lambda (x) (eq (car x) "")) allpointnumber))

or :
(setq allpointnumber (vl-remove-if (function (lambda (x) (eq (car x) ""))) allpointnumber))
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

kasmo

  • Newt
  • Posts: 28
Thanks Marko, was just about to suggest that.

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
If I may say so :
with (getstring) function, upon pressing either SPACE or ENTER, return is always empty string "", and not nil... So prompting is badly written, and I suppose there are more rabbit holes in the code OP provided... Why just don't test my version (I've change it a little meanwhile)...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

mhy3sx

  • Newt
  • Posts: 115
Hi ribarm . Your code didn't give me the option to give point number and draw the line. If I need to pick one - one the points I can do it with polyline or line command.

Thanks

mhy3sx

  • Newt
  • Posts: 115
I think this work


Code - Auto/Visual Lisp: [Select]
  1.  
  2.     (defun c:lineat2 (/ data AllPointnumber stop pts data i p pv pts_)
  3.     (vl-load-com)
  4.     (setq ped (getvar 'peditaccept))
  5.     (setvar 'peditaccept 1)
  6.     (if (setq AllPointnumber nil stop nil pts nil
  7.                data (ssget "_X" (list '(0 . "INSERT")'(66 . 1)'(2 . "Point,KORYFES,station,trigonom,KOKAEK,KOROT,Ktir")(cons 410 (getvar 'Ctab)))))
  8.             (progn
  9.               (repeat (setq i (sslength data))
  10.                 (if (setq
  11.                       p (vl-some '(lambda (x)
  12.                                     (if (eq (vla-get-tagstring x) "POINT")
  13.                                       (list (vla-get-textstring x)
  14.                                             (vlax-get e 'Insertionpoint)
  15.                                       )
  16.                                     )
  17.                                   )
  18.                                  (vlax-invoke
  19.                                    (setq e (vlax-ename->vla-object
  20.                                              (ssname data (setq i (1- i)))
  21.                                            )
  22.                                    )
  23.                                    'GetAttributes
  24.                                  )
  25.                         )
  26.                     )
  27.                   (setq AllPointnumber (cons p AllPointnumber))
  28.                 )
  29.               )
  30.             (setq allpointnumber (vl-remove-if (function (lambda (x) (eq (car x) ""))) allpointnumber))
  31.             (setq 2bjoin (ssadd))
  32.               (while (null Stop)
  33.                     (setq pv   (getstring "\nGive point number  <Space to continue or Enter to finish and convert to polyline> :"))
  34.                     (cond
  35.                           ((setq a (assoc (strcase pv) AllPointnumber))
  36.                            (setq pts (cons (cadr a) pts) pts_ (cons (cadr a) pts_))
  37.                            (if (= (length pts) 2)
  38.                                (progn
  39.                                     (entmakex (list (cons 0 "LINE")
  40.                                     (cons 10 (car pts))
  41.                                     (cons 11 (cadr pts))))
  42.                                     (setq  pts (list (car pts)))(ssadd (entlast) 2bjoin)
  43.                                     )
  44.                                )
  45.                            )
  46.                           ((eq pv "") (setq stop "Done"))
  47.                           ((eq (strcase pv) "U")
  48.                            (entdel (setq del (ssname 2bjoin (1- (sslength 2bjoin)))))(ssdel  del 2bjoin)
  49.                            (setq pts_ (cdr pts_) pts  (list (car pts_)) ))
  50.                           ((null a) (princ "\n<<Point value not found>>"))  
  51.                           ))
  52.               (initget "Yes No")
  53.               (setq convert (cond ((getkword "\nConvert to polylines? [Yes/No] <N>: ")) ( "No" )))
  54.               (if (eq "Yes" convert)
  55.                   (command "_.pedit" "_M" 2bjoin  "" "_J" "" ""))
  56.               )
  57.         )
  58.         (setvar 'peditaccept ped)
  59.           (princ)
  60.           )
  61.  
  62.