直线的比例不是很清楚,按照1:1000写的,您试试看,有什么问题再改- (defun c:test1 ( / oldos pt1 pd ptx bg1 bgx disx pt2)
- (setq oldos (getvar "osmode"))
- (setvar "osmode" 513)
- (setq pt1 (getpoint "\n选择起点:")
- bg1 (getreal "\n输入起点标高:")
- pd (getreal "\n输入终坡度:")
- )
- (entmake (list '(0 . "SOLID")
- '(8 . "DIM_ELEV");默认有该图层
- (cons 10 pt1)
- (cons 11 (mapcar '+ '(300 300 0) pt1))
- (cons 12 (mapcar '+ '(-300 300 0) pt1))
- (cons 13 (mapcar '+ '(-300 300 0) pt1))
- )
- )
- (entmake (list '(0 . "text")
- '(8 . "PUB_TEXT");默认有该图层
- '(10 0 0 0)
- (cons 11 (mapcar '+ '(0 400 0) pt1))
- (cons 1 (rtos bg1 2 3))
- '(40 . 300)
- '(41 . 0.75)
- (cons 50 0)
- '(7 . "_TCH_DIM");默认有该样式
- '(72 . 1)
- '(73 . 0)
- )
- )
- (while (setq ptx (getpoint "\n选择插入点:"))
- (setq disx (/(distance pt1 ptx)1000)
- bgx (+ bg1 (* disx pd))
- pt2 (mapcar '+ (list 0 (- bgx bg1) 0) ptx)
- )
- (entmake (list '(0 . "SOLID")
- '(8 . "DIM_ELEV");默认有该图层
- (cons 10 pt2)
- (cons 11 (mapcar '+ '(300 300 0) pt2))
- (cons 12 (mapcar '+ '(-300 300 0) pt2))
- (cons 13 (mapcar '+ '(-300 300 0) pt2))
- )
- )
- (entmake (list '(0 . "line")
- (cons 10 ptx)
- (cons 11 pt2)
- )
- )
- (entmake (list '(0 . "text")
- '(8 . "PUB_TEXT");默认有该图层
- '(10 0 0 0)
- (cons 11 (mapcar '+ '(0 400 0) pt2))
- (cons 1 (rtos bgx 2 3))
- '(40 . 300)
- '(41 . 0.75)
- (cons 50 0)
- '(7 . "_TCH_DIM");默认有该样式
- '(72 . 1)
- '(73 . 0)
- )
- )
- )
- (setvar "osmode" oldos)
- (princ)
- )
|