Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I can't figure out what is wrong, the lisp runs if I hit the enter key the same number of times that there are tables selected.
The lisp goes through a selection of tables and sets each cell to unlocked. It will be part of a bigger lisp eventually.
(defun C:Unlock_Table_Cells (/)
(vl-load-com)
(princ
"\n*** Select Table's to Unlock ***"
) ;_ end of princ
(vl-load-com)
(princ
"\n*** Select Table's to Unlock ***"
) ;_ end of princ
(if
(setq ss (ssget
(list '(0 . "ACAD_TABLE")
) ;_ end of list
) ;_ end of ssget
) ;_ end of setq
;THEN do this
(SETQ LEN (SSLENGTH SS)
COUNT 0
) ;_ end of SETQ
;ELSE do this
) ;_ end of if
(setq ss (ssget
(list '(0 . "ACAD_TABLE")
) ;_ end of list
) ;_ end of ssget
) ;_ end of setq
;THEN do this
(SETQ LEN (SSLENGTH SS)
COUNT 0
) ;_ end of SETQ
;ELSE do this
) ;_ end of if
(WHILE (< COUNT (- LEN 1))
;;(WHILE (< COUNT LEN)
;(PRINC COUNT)
(SETQ TblEntityName
(ssname SS COUNT)
TblObj
(vlax-ename->vla-object TblEntityName)
) ;_ end of SETQ
;;(WHILE (< COUNT LEN)
;(PRINC COUNT)
(SETQ TblEntityName
(ssname SS COUNT)
TblObj
(vlax-ename->vla-object TblEntityName)
) ;_ end of SETQ
; (progn
(setq nRows (- (vla-get-rows TblObj) 1))
(setq nCols (- (vla-get-columns TblObj) 1))
(setq row 1)
(setq cell 0)
(grread)
(vla-put-RegenerateTableSuppressed TblObj :vlax-true)
(while (<= row nRows)
(while (<= cell nCols)
(vla-setcellstate TblObj row Cell 0)
(setq cell (1+ cell))
;(princ (strcat "\nRow : " (itoa row) " , cell " (itoa cell))
😉 ;_ end of princ
) ;_ end of while
(setq row (1+ row))
(setq cell 0)
) ;_ end of while
(setq nRows (- (vla-get-rows TblObj) 1))
(setq nCols (- (vla-get-columns TblObj) 1))
(setq row 1)
(setq cell 0)
(grread)
(vla-put-RegenerateTableSuppressed TblObj :vlax-true)
(while (<= row nRows)
(while (<= cell nCols)
(vla-setcellstate TblObj row Cell 0)
(setq cell (1+ cell))
;(princ (strcat "\nRow : " (itoa row) " , cell " (itoa cell))
😉 ;_ end of princ
) ;_ end of while
(setq row (1+ row))
(setq cell 0)
) ;_ end of while
(vla-put-RegenerateTableSuppressed TblObj :vlax-false)
(SETQ COUNT (+ 1 COUNT))
; ) ;_ end of progn
) ;_ end of WHILE
) ;_ end of defun
(princ)
; ) ;_ end of progn
) ;_ end of WHILE
) ;_ end of defun
(princ)
Solved! Go to Solution.