Set Cell Style via Lisp

Set Cell Style via Lisp

Jonathan3891
Advisor Advisor
1,009 Views
1 Reply
Message 1 of 2

Set Cell Style via Lisp

Jonathan3891
Advisor
Advisor

How do make a lisp go through all cells (rows, columns) and set the cell style?

 

I have "(vla-setcellstyle 0 1 "data")" working, but I dont want to have to program over 100 cells individually.


Jonathan Norton
Blog | Linkedin
0 Likes
1,010 Views
1 Reply
Reply (1)
Message 2 of 2

Ranjit_Singh
Advisor
Advisor

@Anonymous_dude wrote:

How do make a lisp go through all cells (rows, columns) and set the cell style?

 

I have "(vla-setcellstyle 0 1 "data")" working, but I dont want to have to program over 100 cells individually.


You will have to loop through all cells. Something like this for example.

;;Ranjit Singh
;;7/11/17
(defun somefunc  (x tblent / c etdata ind r tab tblobj)
 (setq etdata (entget tblent)
       ind    (cdr (assoc 91 etdata))
       tab    (cdr (assoc 92 etdata))
       r      0
       c      0
       tblobj (vlax-ename->vla-object tblent))
 (while (< r ind)
  (while (< c tab)
   (vl-catch-all-apply 'vla-setcellstyle (list tblobj r c x))
   (setq c (1+ c)))
  (setq c 0
        r (1+ r)))
 (princ))

Call it in your overall routine like this

(somefunc "data" tblent)
0 Likes