TJ1台阶绘制1.LSP
资源名称:cadlisp1.rar [点击查看]
上传用户:sd555111
上传日期:2014-05-17
资源大小:31k
文件大小:2k
源码类别:
CAD
开发平台:
MathCAD
- ; =========================================
- ; | 台阶软件1 |
- ; | Ver: 1.0 作者: 迟俊岭 |
- ; =========================================
- (defun *error*(st)
- (if (and (/= st "Function cancelled")
- (/= st "quit / exit abort")
- )
- (princ (strcat "错误: " st))
- )
- (setq *error* old_err)
- (princ)
- )
- (defun C:tj1( / old_err lay loop pt ptt chang kuan ge kuan1 ss
- pt1 pt2 pt3 s a ptm)
- (setq old_err *error*)
- (setvar "CMDECHO" 0)
- (setq lay (getvar "clayer"))
- (command "layer" "m" "tj" "c" "y" "tj" "")
- (command "osnap" "nea")
- (setq loop T)
- (while loop
- (initget 1 "R")
- (setq pt (getpoint "nR参照点/<外墙线上任意一点(nea方式)>: "))
- (cond
- ((eq pt "R") (progn
- (command "osnap" "int")
- (setq pt (getpoint "n参照点(int方式): "))
- (setq pt (getpoint pt "n相对坐标(格式:@X,Y或@长度<角度): "))
- (setq loop nil)
- ))
- (t (setq loop nil))
- )
- )
- (command "osnap" "non")
- (setq ptt pt)
- (setq chang (getdist pt "n台阶长度(最上面的)<3000>: "))
- (if (null chang) (setq chang 3000))
- (setq kuan (getdist "n台阶宽度(最上面的)<1200>: "))
- (if (null kuan) (setq kuan 1200))
- (setq ge (getint "n台阶阶数<3>: "))
- (if (null ge) (setq ge 3))
- (setq kuan1 (getdist "n台阶阶宽<300>: "))
- (if (null kuan1) (setq kuan1 300))
- (progn
- (setq ss (ssadd))
- (setq pt1 (polar pt (* pi 1.5) kuan))
- (setq pt2 (polar pt1 0 chang))
- (setq pt3 (polar pt2 (* pi 0.5) kuan))
- (command "pline" pt "w" "0" "0" pt1 pt2 pt3 "")
- (setq ss (ssadd (entlast) ss))
- )
- (setq s 1)
- (repeat (1- ge)
- (setq pt (polar pt (* pi 1.0) kuan1))
- (setq pt1 (polar pt (* pi 1.5) (+ kuan (* kuan1 s))))
- (setq pt2 (polar pt1 0 (+ chang (* kuan1 s 2))))
- (setq pt3 (polar pt2 (* pi 0.5) (+ kuan (* kuan1 s))))
- (command "pline" pt "w" "0" "0" pt1 pt2 pt3 "")
- (setq ss (ssadd (entlast) ss))
- (setq s (1+ s))
- )
- (setq a (getstring "nY旋转/<N>: "))
- (if (/= a "")
- (progn
- (setq ang (getreal "n旋转角度<90>: "))
- (if (null ang) (setq ang 90))
- (command "rotate" ss "" ptt ang)
- )
- )
- (setq a (getstring "nY移动/<N>: "))
- (if (/= a "")
- (progn
- (setq ptm (getpoint ptt "n另一点: "))
- (command "move" ss "" ptt ptm)
- )
- )
- (command "layer" "s" lay "")
- (redraw)(princ)
- )