 - (defun c:tt ()
- (if (and (setq pt1 (getpoint "\n选择第一点: "))
- (setq pt2 (getpoint pt1 "\n选择第二点: "))
- )
- (progn
- (setq x1 (car pt1) ; 计算所选点的 X 和 Y 坐标
- y1 (cadr pt1)
- x2 (car pt2)
- y2 (cadr pt2)
- kw (getstring "\n选择方向 (H:水平, V:垂直): ") ; 询问用户选择水平还是垂直
- sc (getreal "\n输入比例参数: ") ; 输入比例参数
- sc1 (* 7 sc)
- )
- (cond ((= (strcase kw) "H") ; 水平分割线
- (setq mdpy (max y1 y2)
- sp (- (min x1 x2) sc1)
- ep (+ (max x1 x2) sc1)
- p1 (list sp mdpy)
- p2 (list ep mdpy)
- )
- (command "line" "non" p1 "non" p2 "")
- )
- ((= (strcase kw) "V") ; 垂直分割线
- (setq mdpx (max x1 x2)
- mdpy (/ (+ y1 y2) 2)
- sp (- (min y1 y2) sc1)
- ep (+ (max y1 y2) sc1)
- p1 (list mdpx sp)
- p2 (list mdpx ep)
- )
- (command "line" "non" p1 "non" p2 "")
- )
- )
- )
- )
- (princ)
- )
|