又到了借我放時間了
(defun C:spring1 (/ ip r1 len nc e1 e2 ss)
(graphscr)
(command "osnap" "none")
(if (and (setq ip (getpoint "\nInsertion poiny:"))
(setq r1 (getdist ip "\nInput the Radius:"))
(setq len (getdist ip "\nInput Length:"))
)
(progn
(setq nc (getint "\nNO. of Coil <10> :")
nc (if nc nc 10)
e1 (entlast)
)
(drawspring ip r1 len nc)
(setq e2 (entlast)
ss (sset e1 e2)
spset (list ip ss)
)
(command "rotate" ss "" ip pause)
)
)
(princ)
)
(defun drawspring (ip r1 len nc / pe p p1 p2 p3 n)
(setq pe (polar ip 0.0 len)
p (/ Len (float nc))
p1 (polar ip (- (/ pi 2.0)) r1)
p2 (polar ip (/ pi 2.0) r1)
)
(command "line" p2 p1 "")
(setq p2 (polar p2 0.0 (/ p 2.0)))
(command "line" p1 p2 "")
(setq n (- nc 1))
(repeat n
(setq p3 (polar p1 0.0 p))
(command "line" p2 p3 "")
(setq p2 (polar p2 0.0 p))
(setq p1 p3)
(command "line" p1 p2 "")
)
(setq p3 (polar p1 0.0 p))
(command "line" p2 p3 "")
(setq p2 (polar p2 0.0 (/ p 2.0))
)
(command "line" p3 p2 "")
)
(defun sset (e1 e2 / ss)
(setq e1 (if e1 (entnext e1) (entnext))
ss (ssadd e1)
)
(while (not (equal e1 e2))
(setq e1 (entnext e1)
ss (ssadd e1 ss)
)
)
)
(defun C:rs (/ ip ss dth key ang dth)
(graphscr)
(command "regen")
(if (null spset) (princ "\n***No sprint set!***")
)
(setq ip (car spset)
ss (cadr spset)
dth 2)
(while (and (setq key (cadr (grread)))
(/= key 13)
)
(if (= key 8) (setq ang (- dth)) (setq ang dth)
)
(command "rotate" ss "" ip ang)
)
(princ)
)
--
彈簧加旋轉
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.46.19