本帖最后由 夏生生 于 2012-12-21 08:37 编辑
flytoday 发表于 2012-12-21 07:12
沉滴好快顶起哈………
试试- (defun c:test1 ( / oldos pt1 pt2 ptx ang bg1 bg2 bgx dist disx)
- (setq oldos (getvar "osmode"))
- (setvar "osmode" 513)
- (setq pt1 (getpoint "\n选择起点:")
- bg1 (getreal "\n输入起点标高:")
- pt2 (getpoint "\n选择终点:")
- bg2 (getreal "\n输入终点标高:")
- dist (distance pt1 pt2)
- ang (+ (/ pi 2) (angle pt1 pt2))
- )
- (entmake (list '(0 . "line")
- (cons 10 pt1)
- (cons 11 (polar pt1 ang (* bg1 1000)))
- )
- )
- (entmake (list '(0 . "text")
- '(10 0 0 0)
- (cons 11 (polar pt1 ang (* bg1 1000)))
- (cons 1 (rtos bg1 2 3))
- '(40 . 250)
- '(41 . 0.75)
- (cons 50 (- ang (/ pi 2)))
- '(7 . "standard")
- '(72 . 1)
- '(73 . 0)
- )
- )
- (entmake (list '(0 . "line")
- (cons 10 pt2)
- (cons 11 (polar pt2 ang (* bg2 1000)))
- )
- )
- (entmake (list '(0 . "text")
- '(10 0 0 0)
- (cons 11 (polar pt2 ang (* bg2 1000)))
- (cons 1 (rtos bg2 2 3))
- '(40 . 250)
- '(41 . 0.75)
- (cons 50 (- ang (/ pi 2)))
- '(7 . "standard")
- '(72 . 1)
- '(73 . 0)
- )
- )
- (while (setq ptx (getpoint "\n选择插入点:"))
- (setq disx (distance pt1 ptx)
- bgx (+ bg1 (/ (* disx (- bg2 bg1)) dist))
- )
- (entmake (list '(0 . "line")
- (cons 10 ptx)
- (cons 11 (polar ptx ang (* bgx 1000)))
- )
- )
- (entmake (list '(0 . "text")
- '(10 0 0 0)
- (cons 11 (polar ptx ang (* bgx 1000)))
- (cons 1 (rtos bgx 2 3))
- '(40 . 250)
- '(41 . 0.75)
- (cons 50 (- ang (/ pi 2)))
- '(7 . "standard")
- '(72 . 1)
- '(73 . 0)
- )
- )
- )
- (setvar "osmode" oldos)
- (princ)
- )
|