马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
秋枫大哥好,小弟我自已嫌每次输入@矩形的尺寸太麻烦,而我自己画的衣柜,台面之类的尺寸又是固定的,所以就做了个微不足道的这个lisp。
但是我觉得不好的是占用了两个命令,而且实用过程中还是容易搞混?如何做成一个命令,并且在命令行设置选项呢?输入那个选项值的话就是画1500x600的矩形
如输入rr就是画600x1500的矩形,在命令行输入提示选项A,就是画1500x600的矩形?
谢谢!
- [FONT=courier new]
- (defun po_err (s)
- (setvar "cmdecho" cm)
- (setvar "osmode" os)
- (command "_.undo" "_e")
- )
- ;利用rectang命令绘制矩形,矩形的尺寸为1500x600
- (defun c:r1 ()
- (princ "\n* 插入 |X*Y=1500*600| 横式矩形 *")
- (setq cm (getvar "cmdecho"))
- (setq os (getvar "osmode"))
- (setq *error* po_err)
- (setvar "cmdecho" 0)
- (setvar "osmode" 4151)
- (princ "\n指定矩形的插入点 <退出>:")
- (setq p1 (getpoint))
- (setvar "osmode" 0)
- (if p1 (progn
- (command "rectang" "c" "0" "0" "e" "0" "f" "0" "t" "0" "w" "0" p1 "d" "1500" "600")
- (while (/= 0 (getvar "cmdactive"))(command pause))
- (command "draworder" "last" "" "b")
- )
- )
- (setvar "cmdecho" cm)
- (setvar "osmode" os)
- (princ)
- )
- ;利用rectang命令绘制矩形,矩形的尺寸为600x1500
- (defun c:r2 ()
- (princ "\n* 插入 |X*Y=600*1500| 立式矩形 *")
- (setq cm (getvar "cmdecho"))
- (setq os (getvar "osmode"))
- (setq *error* po_err)
- (setvar "cmdecho" 0)
- (setvar "osmode" 4151)
- (princ "\n指定矩形的插入点 <退出>:")
- (setq p1 (getpoint))
- (setvar "osmode" 0)
- (if p1 (progn
- (command "rectang" "c" "0" "0" "e" "0" "f" "0" "t" "0" "w" "0" p1 "d" "600" "1500")
- (while (/= 0 (getvar "cmdactive"))(command pause))
- (command "draworder" "last" "" "b")
- )
- )
- (setvar "cmdecho" cm)
- (setvar "osmode" os)
- (princ)
- )
- [/FONT]
|