看看先:- (defun c:test(/ PTA VK VD pti m ents)
- (SETQ PTA (GETPOINT "\nFirst Point:")
- VK (GETDIST "\nParameter K=")
- VD (GETINT "\nDivide of the line:"))
- (setq ent nil)
- (command "_.pline")
- (repeat (1+ vd) (command '(0 0)))
- (command "")
- (setq ents (entget (entlast)))
- (while (/= (car (setq pti (grread t 15 0))) 3)
- (if (= (car pti) 5)
- (progn
- (setq pti (cadr pti))
- (setq ents (drawxlx PTA pti VK VD ents))
- )
- )
- )
- )
- (defun drawxlx(pta ptb vk vd ents / m x i xi y)
- (setq m (distance pta ptb))
- (setq x (- (car ptb) (car pta)))
- (setq x (/ x vd))
- (setq i 0)
- (repeat (1+ vd)
- (setq xi (+ (car pta) (* x i)))
- (setq y (* 4 vk xi (- m xi)))
- (setq ents (subilst (list 10 xi y) i 10 ents))
- (setq i (1+ i))
- )
- (entmod ents)
- )
- ;引用无痕帖子中程序改编
- (defun subilst (a ilst key lst / n)
- (setq n -1)
- (mapcar '(lambda(x)
- (if (= (car x) key)
- (progn
- (setq n (1+ n))
- (if (= ilst n) a x))
- x
- )
-
- ) lst)
- )
|