我是通过点的方式来实现绘图,很基础的,献丑了
废话不说了,下面是代码- (defun ok_qq()
- (setq unht (getreal "层高")
- sty (getreal "层数")
- elevspc (getreal "间距")
- downwin (getreal "窗台高度")
- winht (getreal "窗高")
- winjj (getreal "窗径宽度")
- nvht (getreal "女儿墙高度")
- ))
- (defun draw_qq()
- (setq p1 (getpoint "\n 取一个点: "))
- (setq w1 (getdist "\n 墙面的宽度: "))
- (while w1
- (setq x1 (car p1)
- y1 (cadr p1)
- p4 (polar p1 (/ pi 2) unht)
- )
- (setvar "OSMODE" 0)
- (command "-layer" "s" "1" "")
- (command "_.rectang" p1 (strcat "@" (rtos w1 2) "," (rtos (+ (* unht sty) nvht) 2)))
- (repeat (fix sty)
- (command "-layer" "s" "2" "")
- (command "line" p4 (strcat "@" (rtos w1 2) "<" "0" ) "")
- (setq p4 (polar p4 (/ pi 2) unht))
- )
- (setvar "OSMODE" oldos)
- ;绘制窗户
- (setq c1 (getdist "\n 窗户的宽度: "))
- (while c1
- (setq wp1 (getdist "\n 窗户到左边的距离: "))
- (setq p2 (list (+ x1 wp1) (+ y1 downwin)))
- (setvar "OSMODE" 0)
- (repeat (fix sty)
- (command "-layer" "s" "7" "")
- (command "_.rectang" p2 (strcat "@" (rtos c1 2) "," (rtos winht 2)))
- (setq x2 (car p2)
- y2 (cadr p2)
- x3 (+ x2 winjj)
- y3 (+ y2 winjj)
- nn (- winht (* winjj 2))
- n (/ (- c1 (* winjj 2)) 2)
- x5 (+ x3 n)
- p3 (list x3 y3)
- p5 (list x5 y3)
- )
- (command "-layer" "s" "6" "")
- (command "_.rectang" p3 (strcat "@" (rtos (- c1 (* winjj 2)) 2) "," (rtos nn 2)))
- (command "line" p5 (strcat "@" (rtos nn 2) "<" "90" ) "")
- (setq p2 (polar p2 (/ pi 2) unht))
- (setq p3 (polar p3 (/ pi 2) unht))
- (setq p5 (polar p5 (/ pi 2) unht))
- )
- (setvar "OSMODE" oldos)
- (setq c1 (getdist "\n 窗户的宽度: "))
- )
- ;新的墙面起点
- (setq p1 (list (+ x1 w1 elevspc) y1))
- (setq w1 (getdist "\n 墙面的宽度: "))
- (Setvar "CMDECHO" 1)
- (princ)))
- (defun c:qq()
- (setvar "CMDECHO" 0)
- (Setq oldos (getvar "osmode"))
- (ok_qq)
- (draw_qq)
- (Setvar "osmode" oldos)
- (Setvar "CMDECHO" 1)
- (princ)
- )
|