Innanzitutto chiedo scusa se ho usato un termine in inglese ma mi sembrava molto più appropriato essendo un gergo tecnico appartenente al linguaggio. Non sono molto convinto di poter trovare un esperto di Lisp qui sul forum ma nella speranza posto un codice che, come da titolo, servirebbe a manipolare le cosiddette "lightweight polylines".. il problema è che mi da un errore in output, dice che c'è un problema nelle variabili numeriche e nella fase di printing sui circuiti ma sinceramente non lo vedo sto problema (non sono ferratissimo in Lisp eh ). Vabbè, vi posto il codice:

codice:
(defun LWPOLY_SHOW (EL)
  (while (setq EL (member (assoc 10 EL) EL))
     (print (cdr (assoc 10 EL)))
     (setq EL (cdr EL))
  )
)

(defun LWPOLY_NTH (N EL)
  (setq EL (member (assoc 10 EL) EL))
  (while (and EL (> N 0))
    (setq EL (member (assoc 10 (cdr EL)) EL)
          N (1- N)
    )
  )
  (if (and EL (zerop N))
    (list
      (assoc 10 EL)
      (assoc 40 EL)
      (assoc 41 EL)
      (assoc 42 EL)
    )
  )
)
(defun LWPOLY_CHANGE (
     EL  
     N   
     PT  
     NW1 NW2 
     NB 
     / 
     EL2
     )

  (while (and EL (> N -1))
    (if (= (caar EL) 10) (setq N (1- N)))
    (setq EL2 (cons (car EL) EL2) ;;save in buffer list
	     EL (cdr EL)))  ;;reduce entity list and loop
  (setq EL (cons (cons 10 PT)    
		 (cons (cons 40 NW1) 
		  (cons (cons 41 NW2) 
		   (cons (cons 42 NB) 
		     (cdddr EL)))))) 
  (append (reverse (cdr EL2)) EL)
  )
(defun LWPOLY_2_POLY (
     EL  
     / 
     ZV  
     ZT  
     LYR  
     CLR  
     LTY  
    )
  (if (= (type EL) 'ENAME) 
     (setq EL (entget EL)) 
     (if (= (type (car EL)) 'ENAME) 
       (setq EL (entget (car EL))))) 
  (if (= (cdr (assoc 0 EL)) "LWPOLYLINE") 
   (progn
      (setq ZV (assoc 38 EL)
            ZT (assoc 39 EL) 
            CLR (assoc 62 EL) 
            LTY (assoc 6 EL) 
      )
 
      (if (null ZV) (setq ZV 0.0)) 
      (if (null ZT) (setq ZT 0.0))
      (setq EN (list  
         '(0 . "POLYLINE")
         (setq LYR (assoc 8 EL))
         (assoc 210 EL) 
         ZT
         (list 10 0.0 0.0 (cdr ZV))
         (assoc 70 EL)
      ))
      (if CLR (setq EN (append EN (list CLR))))
      (if LTY (setq EN (append EN (list LTY))))
      (entmake EN)
      (setq EN (list 
         '(0 . "VERTEX")
         LYR
         '(10 0 0 0)  
         '(40 . 0.0)  
         '(41 . 0.0)  
         '(42 . 0.0)
         ZT
      ))
      (if CLR (setq EN (append EN (list CLR))))
      (if LTY (setq EN (append EN (list LTY))))
      (while (setq EL (member (assoc 10 EL) EL))
        (setq EN (subst
                   (append
                     (assoc 10 EL)
                     (list (cdr ZV)))
                   (assoc 10 EN)
                   EN)
             EN (subst
                   (assoc 42 EL)
                   (assoc 42 EN)
                   EN)
             EN (subst
                   (assoc 40 EL)
                   (assoc 40 EN)
                   EN)
             EN (subst
                   (assoc 41 EL)
                   (assoc 43 EN)
                   EN)
        )
        (entmake EN)
        (setq EL (cdr EL))
      )
      (entmake (list '(0 . "SEQTURN") LYR))
      (entlast)
    )
  ) ;;else return nil.
)
very denghiu