用法
评论
建议
取 消
确 定
(defun table:make (pt title headers mat-data / unit-h unit-w list-dxf i% rows columns) "创建表格,参数: \npt:位置点,\ntitle:标题 , \nheaders:表头表\nmat-data: 单元数据矩阵,目前仅支持文字型表格" "表格图元" "(table:make (getpoint) \"我的表格\" '(\"列1\" \"列2\" \"列3\")'((5 3 3)(2 3 3)))" (setq rows (+ 2 (length mat-data)) columns (apply (quote max) (mapcar (quote length) mat-data))) (if (null headers) (progn (setq i% 0) (while (< i% columns) (setq headers (cons (strcat "C" (itoa (- columns i%))) headers)) (setq i% (1+ i%))))) (setq unit-h (@:scale 3.5) unit-w (@:scale 10.0)) (setq rows (+ 2 (length mat-data)) columns (apply (quote max) (mapcar (quote length) mat-data))) (setq list-dxf (list (quote (0 . "ACAD_TABLE")) (quote (100 . "AcDbEntity")) (quote (67 . 0)) (quote (100 . "AcDbBlockReference")) (cons 10 pt) (quote (41 . 1.0)) (quote (42 . 1.0)) (quote (43 . 1.0)) (quote (50 . 0.0)) (quote (70 . 0)) (quote (71 . 0)) (quote (44 . 0.0)) (quote (45 . 0.0)) (quote (210 0.0 0.0 1.0)) (quote (100 . "AcDbTable")) (quote (280 . 0)) (quote (11 1.0 0.0 0.0)) (quote (90 . 22)) (cons 91 rows) (cons 92 columns) (quote (93 . 0)) (quote (94 . 0)) (quote (95 . 0)) (quote (96 . 0)))) (setq list-dxf (append list-dxf (list (cons 141 (* 1.2 unit-h))))) (setq i% 0) (while (< i% (1- rows)) (setq list-dxf (append list-dxf (list (cons 141 unit-h)))) (setq i% (1+ i%))) (setq i% 0) (while (< i% columns) (setq unit-w (* (@:scale 5.0) (apply (quote max) (mapcar (quote (lambda (x) (strlen (@:to-string (if (nth i% x) (nth i% x) ""))))) (cons headers mat-data))))) (setq list-dxf (append list-dxf (list (cons 142 unit-w)))) (setq i% (1+ i%))) (setq list-dxf (append list-dxf (list (quote (171 . 1)) (quote (172 . 0)) (quote (173 . 0)) (quote (174 . 0)) (cons 175 columns) (quote (176 . 1)) (quote (91 . 262144)) (quote (178 . 0)) (quote (145 . 0.0)) (quote (92 . 0)) (quote (301 . "CELL_VALUE")) (quote (93 . 6)) (quote (90 . 4)) (cons 1 title) (quote (94 . 0)) (cons 300 "") (cons 302 title) (quote (304 . "ACVALUE_END"))))) (setq i% 0) (while (< i% (1- columns)) (setq list-dxf (append list-dxf (list (quote (171 . 1)) (quote (172 . 0)) (quote (173 . 1)) (quote (174 . 0)) (quote (175 . 1)) (quote (176 . 1)) (quote (91 . 0)) (quote (178 . 0)) (quote (145 . 0.0)) (quote (92 . 0)) (quote (301 . "CELL_VALUE")) (quote (93 . 6)) (quote (90 . 0)) (quote (94 . 0)) (cons 300 "") (cons 302 "") (quote (304 . "ACVALUE_END"))))) (setq i% (1+ i%))) (if headers (progn (foreach header% headers (setq list-dxf (append list-dxf (list (quote (171 . 1)) (quote (172 . 0)) (quote (173 . 0)) (quote (174 . 0)) (quote (175 . 1)) (quote (176 . 1)) (quote (91 . 262144)) (quote (178 . 0)) (quote (145 . 0.0)) (quote (92 . 0)) (quote (301 . "CELL_VALUE")) (quote (93 . 6)) (quote (90 . 4)) (cons 1 (@:to-string header%)) (quote (94 . 0)) (cons 300 "") (cons 302 (@:to-string header%)) (quote (304 . "ACVALUE_END")))))) (if (< (length headers) columns) (setq i% 0) (while (< i% (- columns (length headers))) (setq list-dxf (append list-dxf (list (quote (171 . 1)) (quote (172 . 0)) (quote (173 . 0)) (quote (174 . 0)) (quote (175 . 1)) (quote (176 . 1)) (quote (91 . 262144)) (quote (178 . 0)) (quote (145 . 0.0)) (quote (92 . 0)) (quote (301 . "CELL_VALUE")) (quote (93 . 6)) (quote (90 . 4)) (cons 1 "") (quote (94 . 0)) (cons 300 "") (cons 302 "") (quote (304 . "ACVALUE_END"))))) (setq i% (1+ i%)))))) (foreach row% mat-data (foreach column% row% (setq list-dxf (append list-dxf (list (quote (171 . 1)) (quote (172 . 0)) (quote (173 . 0)) (quote (174 . 0)) (quote (175 . 1)) (quote (176 . 1)) (quote (91 . 262144)) (quote (178 . 0)) (quote (145 . 0.0)) (quote (92 . 0)) (quote (301 . "CELL_VALUE")) (quote (93 . 6)) (quote (90 . 4)) (cons 1 (@:to-string column%)) (quote (94 . 0)) (cons 300 "") (cons 302 (@:to-string column%)) (quote (304 . "ACVALUE_END")))))) (if (< (length row%) columns) (progn (setq i% 0) (while (< i% (- columns (length row%))) (setq list-dxf (append list-dxf (list (quote (171 . 1)) (quote (172 . 0)) (quote (173 . 0)) (quote (174 . 0)) (quote (175 . 1)) (quote (176 . 1)) (quote (91 . 262144)) (quote (178 . 0)) (quote (145 . 0.0)) (quote (92 . 0)) (quote (301 . "CELL_VALUE")) (quote (93 . 6)) (quote (90 . 4)) (cons 1 "") (quote (94 . 0)) (cons 300 "") (cons 302 "") (quote (304 . "ACVALUE_END"))))) (setq i% (1+ i%)))))) (entmakex list-dxf))
函数库使用说明
应用包
技术支持
统计信息
函数库规模: 733 个
函数库类别: 51 种
上传记录
刷新