Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

alan_rackham
en respuesta a: ChicagoLooper

Hi

 

I am now thinking if I can get the table into a lisp list I can access this with field codes.  I found this:-

 

;:Ranjit Singh
;;8/3/17
(defun c:somefunc  (/ c ctr dat etdata ind lst prefix r tab tblent tblobj val varname)
 (setq etdata (entget (setq tblent (car (entsel "\nSelect table object: "))))
       ind    (cdr (assoc 91 etdata))
       tab    (cdr (assoc 92 etdata))
       r      0
       c      0
       ctr    1
       prefix "var"
       tblobj (vlax-ename->vla-object tblent))
 (while (< c tab)
  (while (< r ind)
   (set (setq varname (read (strcat prefix (itoa ctr))))
        (progn (setq val (vlax-invoke tblobj 'getcellvalue r c)
                     val (if (= 'str (type val))
                          (substr val (- (1+ (strlen val)) (vl-position (ascii ";") (reverse (vl-string->list val)))))
                          val))))
   (setq lst (cons (setq dat (cons varname val)) lst))
   (setq ctr (if (listp (cdr dat))
              ctr
              (1+ ctr))
         r   (1+ r)))
  (setq r 0
        c (1+ c)))
 (vl-remove-if '(lambda (x) (listp (cdr x))) (reverse lst)))

This helps however I want to modify this lisp to just give me the values and change the "VAL1" to "A1" etc. Can anyone help?