AutoCAD LISP 選取表格(Table)某點判斷選取哪個欄列的數值或其值
備註:輸出的欄列值起始為0
;;;點選某格的表格中得到欄列
(defun c:tt (/ table outRow outCol)
(setq table (entsel "\n選取表格:"))
(vla-HitTest
(vlax-ename->vla-object (car table))
(vlax-3d-point (cadr table))
(vlax-3d-point (trans (getvar 'ViewDir) 1 0))
'outRow
'outCol
)
(setq val (vlax-variant-value
(vla-GetCellValue
(vlax-ename->vla-object (car table))
outRow
outCol
)))
(prompt (strcat "\nRow:" (itoa outRow)))
(prompt (strcat "\nCol:" (itoa outCol)))
(prompt (strcat "\n文字:"
(cond
((eq 'STR (type val))
val)
((eq 'INT (type val))
(itoa val))
((eq 'REAL (type val))
(rtos val))
(T
"")
);_cond
)
)
(princ)
) ;_end
留言
張貼留言