这里数你最急,有精力在这里催促,何不动脑筋自己好毫安好想想?- (defun DrawLine(pt1 pt2 / ang)
- (setq ang (angle pt1 pt2))
- (command "_.line" pt1 (polar pt1 ang 6.0) "")
- (command "_.line" (polar pt2 (- ang pi) 6.0) pt2 "")
- )
- (defun c:PQ( / i pt1 pts pt3 ang1 ang2 ang3 ang)
- (setq i 1)
- (setvar "cmdecho" 0)
- (while (or (< i 3) pt1)
- (if (> i 1)
- (progn
- (setq pt1 (getpoint pt1 (strcat "\n请输入第" (itoa i)"点:")))
- (command pt1)
- )
- (progn
- (setq pt1 (getpoint (strcat "\n请输入第" (itoa i)"点:")))
- (command "_.pline" pt1 "w" 0 0)
- )
- )
- (if pt1
- (setq pts (append pts (list pt1)))
- )
- (setq i (1+ i))
- )
- (setq pt3 (getpoint "\n请确定箭头方向:"))
- (entdel (entlast))
- (setq ang1 (angle (car pts) pt3))
- (setq ang2 (angle (car pts) (cadr pts)))
- (setq ang (- ang1 ang2))
- (if (> ang pi) (setq ang (- ang (* 2 pi))))
- (if (< ang (- pi)) (setq ang (+ ang (* 2 pi))))
- (if (> ang 0)
- (setq ang (+ ang2 (* 0.5 pi)))
- (setq ang (- ang2 (* 0.5 pi)))
- )
- (setq pts (reverse pts))
- (setq ang1 (angle (car pts) pt3))
- (setq ang2 (angle (car pts) (cadr pts)))
- (setq ang1 (- ang1 ang2))
- (if (> ang1 pi) (setq ang1 (- ang1 (* 2 pi))))
- (if (< ang1 (- pi)) (setq ang1 (+ ang1 (* 2 pi))))
- (if (> ang1 0)
- (setq ang2 (+ ang2 (* 0.5 pi)))
- (setq ang2 (- ang2 (* 0.5 pi)))
- )
- (setvar "osmode" 0)
- (command "layer" "s" "dim" "")
- (mapcar 'DrawLine (reverse (cdr pts)) (cdr (reverse pts)))
- (command "_.pline" (polar (car pts) ang2 2.5) "w" "1.2" "0" (polar (car pts) ang2 6) "")
- (command "_.pline" (polar (car (reverse pts)) ang 2.5) "w" "1.2" "0" (polar (car (reverse pts)) ang 6) "")
- (command "layer" "s" "thick-solid" "")
- (command "_.line" (car pts) (polar (car pts) ang2 2.5) "")
- (command "_.line" (car (reverse pts)) (polar (car (reverse pts)) ang 2.5) "")
- (setvar "osmode" 33)
- (princ "\n END.")
- (setvar "cmdecho" 1)
- )
|