- (defun c:tt (/ B H I J LIS M MM N P0 P1 P2 PT ZG)
- (setq lis (cons '(1.0 0.0 0.0) lis))
- (setq lis (cons '(1.0 0.0 0.0) lis))
- (setq lis (cons '(1.0 0.0 0.0 1) lis))
- (setq zg 1;字高
- b 2 ;表格宽度
- h 3);表格高
- (setq n (length lis));表格行数n
- (foreach e lis
- (setq mm (length e))
- (if (> mm m) (setq m mm)));表格列数m
- (setq pt (getpoint "选取表格左上角位置:"))
- (setq i 0)
- (repeat (1+ m);绘制竖线
- (setq p1 (polar pt (* 0.0 Pi) (* i b))
- p2 (polar p1 (* -0.5 Pi) (* n h))
- i (1+ i))
-
- (command "pline" p1 p2 "")
- )
- (setq i 0)
- (repeat (1+ n) ;绘制横线
- (setq p1 (polar pt (* -0.5 Pi) (* i h))
- p2 (polar p1 (* 0.0 Pi) (* m b))
- i (1+ i))
-
- (command "pline" p1 p2 "")
- )
- (setq i 0
- j 0
- p0 (list (+ (car pt) (* 0.5 b)) (- (cadr pt) (* 0.7 h))));定义文字原点
- (foreach e lis ;填入表内容
- (foreach f e
- (setq p1 (list (+ (car p0) (* j b)) (- (cadr p0) (* i h)))
- j (1+ j))
- (command "text" p1 zg 0 (rtos f 2 2))
- )
- (setq i (1+ i)
- j 0)
- )
- )
自己写的,没有判断每个格子内容长短 |