新手学着lisp画表格,如果画不规则的表格怎么弄?
如图
如果往表格里面自动写内容,是不是要计算每个单独格的中心坐标点,有不有更简单的方法,,求教··
- (defun c:hbg ()
- (setvar "cmdecho" 0);_关闭命令提示
- (princ "\n框选表格位置")
- (command "rectang" pause pause)
- (setq name1 (entlast))
- (setq pt1 (cdr(nth 14 (entget name1))));表格起点
- (setq pt2 (cdr(nth 18 (entget name1))))
- (setq pt3 (cdr(nth 22 (entget name1))))
- (setq pt4 (cdr(nth 26 (entget name1))))
- (SETQ L (distance pt1 pt2))
- (SETQ b (distance pt1 pt4))
- (setq pt1a (cdr(nth 14 (entget name1))))
- (setq pt2a (cdr(nth 18 (entget name1))))
- (setq m (getint "\n输入列数量"))
- (setq n (getint "\n输入行数量"))
- (setq osmode_bak (getvar "osmode"));_记录捕捉
- (setvar "osmode" 0);_关闭捕捉
-
- ;======================画列===============================
- (setq i1 2)
- (while (<= i1 m)
- (setq pt2 (polar pt2 pi (/ L m)))
- (setq pt3 (polar pt3 pi (/ L m)))
- (command "line" pt2 pt3 "")
- (setq i1 (1+ i1))
- )
- ;=========================画行=============================
- (setq i2 2)
- (while (<= i2 n)
- (setq pt1a (polar pt1a (/ pi -2.0) (/ b n)))
- (setq pt2a (polar pt2a (/ pi -2.0) (/ b n)))
- (command "line" pt1a pt2a "")
- (setq i2 (1+ i2))
- )
- ;=========================================================
- (setvar "cmdecho" 1);_打开命令提示
- (setvar "osmode" osmode_bak);_还原捕捉
- (princ)
- )
该贴已经同步到 取个长点勒名字的微博 |