看看行不行:
 - (defun c:Draw2( / pt
- pt2
- i
- j
- n
- Le ;剩余长度
- Long ;每段长度
- Ang ;每段角度
- Ang_W ;分割线角度
- pt_W
- pt_Ws
- pt_O
- pt_N
- pt_WE
- os
- )
- (setvar "cmdecho" 0)
- (setq pt (getpoint "\n输入起点:"))
- (setq pt_N pt)
- (setq pt_O pt)
- (setq Le 0)
- (command "_.pline" pt_O)
- (while (setq pt_N (getpoint pt_N "\n输入下一点:"))
- (command pt_N)
- (setq Long (+ Le (distance pt_N pt_O)))
- (setq Ang (angle pt_O pt_N))
- (setq Ang_W (- Ang (/ pi 2)))
- (setq n (fix (/ Long 10)))
- (setq pt_W (polar pt_O Ang (- 10 Le)))
- (setq pt_WE (polar pt_W Ang_W 0.5))
- (setq pt_Ws (append pt_Ws (list (list pt_W pt_WE))))
- (setq Le (- Long (* n 10)))
- (setq j 1)
- (while (< j n)
- (setq pt_W (polar pt_W Ang 10))
- (setq pt_WE (polar pt_W Ang_W 0.5))
- ;(command "_.pline" pt_W pt_WE "")
- (setq pt_Ws (append pt_Ws (list (list pt_W pt_WE))))
- (setq j (1+ j))
- )
- (setq pt_O pt_N)
- )
- (command "")
- (setq os (getvar "osmode"))
- (setvar "osmode" 0)
- (setq ent (entlast))
- (command "_.offset" 0.5 ent pt_WE "")
- (mapcar '(lambda(lst) (command "_.pline" (car lst) (cadr lst) "")) pt_Ws)
- (setvar "osmode" os)
- (princ)
- )
-
|