BG表格自动生成.LSP
资源名称:cadlisp1.rar [点击查看]
上传用户:sd555111
上传日期:2014-05-17
资源大小:31k
文件大小:3k
源码类别:
CAD
开发平台:
MathCAD
- ; =============================================
- ; | 表格自动生成软件 |
- ; | 板本: V1.1 作者: 尉迟俊岭 |
- ; =============================================
- (defun C:bg(/ rows colu rows1 rows2 ly lx i ii propt colu1 co coo
- dx dy dxx dyy str with ptp1 ptp2 ptp3 ptp4 os)
- (setvar "CMDECHO" 0)
- (setq lay (getvar "clayer"))
- (setq os (getvar "OSMODE"))
- (setvar "OSMODE" 0)
- (command "color" "bylayer")
- (command "layer" "m" "bg" "c" "y" "bg" "")
- (initget 7)
- (setq rows (getint "n表格总行数: "))
- (initget 7)
- (setq colu (getint "n表格总列数: "))
- (initget 7)
- (setq rows1 (getreal "n表格第一行行距: "))
- (initget 7)
- (setq rows2 (getreal "n表格其它行行距: "))
- (setq ly (+ rows1 (* rows2 (1- rows))))
- (setq lx 0)
- (setq i 1)
- (repeat colu
- (initget 7)
- (setq ii (itoa i))
- (setq propt (strcat "表格第" ii "列列距: "))
- (setq colu1 (getreal propt))
- (setq lx (+ lx colu1))
- (if (= 1 i) (setq co (list colu1))
- (progn
- (setq coo (list colu1))
- (setq co (append co coo))
- )
- )
- (setq i (1+ i))
- )
- (setq pt1 (getpoint "n表格左上角点: "))
- (setq ptp1 pt1)
- (setq dy (cadr pt1))
- (setq dx (car pt1))
- (setq dxx (+ dx lx))
- (setq pt2 (list dxx dy))
- (command "line" pt1 pt2 "")
- (setq dy (- dy rows1))
- (setq pt1 (list dx dy))
- (setq pt2 (list dxx dy))
- (command "line" pt1 pt2 "")
- (repeat (1- rows)
- (setq dy (- dy rows2))
- (setq pt1 (list dx dy))
- (setq pt2 (list dxx dy))
- (command "line" pt1 pt2 "")
- )
- (setq dyy (+ dy ly))
- (setq pt2 (list dx dyy))
- (command "line" pt1 pt2 "")
- (setq i 0)
- (repeat colu
- (setq c (nth i co))
- (setq dx (+ dx c))
- (setq pt1 (list dx dy))
- (setq pt2 (list dx dyy))
- (command "line" pt1 pt2 "")
- (setq i (1+ i))
- )
- (initget "Yes No")
- (setq str (getkword "n表格边框是否加粗: 不加粗:No / <加粗:Yes> "))
- (if (or (= str nil) (= (strcase str) "YES"))
- (progn
- (initget 6)
- (setq with (getreal "n表格边框线宽<0.6>: "))
- (if (= with nil) (setq with 0.6))
- (setq dy (cadr ptp1))
- (setq dx (car ptp1))
- (setq dxx (+ dx lx))
- (setq ptp2 (list dxx dy))
- (setq dyy (- dy ly))
- (setq ptp3 (list dxx dyy))
- (setq ptp4 (list dx dyy))
- (command "PLINE" ptp1 "w" with with ptp2 ptp3 ptp4 "c")
- )
- )
- (setvar "OSMODE" os)
- (command "layer" "s" lay "")
- (princ)(princ)
- )