2018年10月1日 星期一

LISP 練習 5TEST4

==================================================
(defun c:5test4()
  (setvar "menuecho" 3)
  (setq baspt (getpoint "請輸入基本點(baspt):"))
  (setq W1 (getreal "請輸入左水平線長度(W1):"))
  (setq W2 (getreal "請輸入右水平線長度(W2):"))
  (setq A1 (getreal "請輸入水平角度(度度量)(A1):"))
  (setq D (getreal "請輸入左垂平線長度(D):"))
  (setq B (getreal "請輸入右垂平線長度(B):"))
  (setq A (* A1 (/ pi 180)))
  (princ "\nPI=")(princ PI)
  (princ "\nA1=")(princ A1)
  (princ "\nA=")(princ A)
  (setq pt1 (polar baspt (* -1 (/ pi 2)) (/ b 2)))
  (princ "\nline pt1")
  ;(command "line" baspt pt1 "")
  (setq pt2 (polar pt1 0 w2))
  (princ "\nline pt1 pt2 \n")
  ;(command "line" baspt pt1 pt2 "")
  (setq pt3 (polar pt2 (/ pi 2) B))
  (princ "line pt1 pt2 pt3 \n")
  ;(command "line" baspt pt1 pt2 pt3 "")
  (setq pt4 (polar pt3 pi w2))
  ;(princ "line pt1 pt2 pt3 pt4 \n")
  ;(command "line" baspt pt1 pt2 pt3 pt4 "")
  ;(prin1 "cos=  open start-------------------------------")
  ;(setq csa (sin(/ a 1)))
  ;(princ "\ncos=")(princ csa)
  (setq kk (/ w1 (cos (/ A 1))))
  ;(princ "\nkk=")(princ kk)
  (setq h1 (* kk (sin (/ A 1))))
  ;(princ "\nh1=")(princ h1)
  (setq h2 (/ (- (+ d (* 2 h1)) b) 2))
  ;(princ "\nh2=")(princ h2)
  (setq pt5 (polar pt4 (/ pi 2) h2))
  ;(command "line" baspt pt1 pt2 pt3 pt4 pt5 "")
  (setq pt6 (polar pt5 (+ pi A) kk))
  ;(command "line" baspt pt1 pt2 pt3 pt4 pt5 pt6 "") 
  (setq pt7 (polar pt6 (+ pi (/ pi 2)) D))
  ;(command "line" baspt pt1 pt2 pt3 pt4 pt5 pt6 pt7 "") 
  (setq pt8 (polar pt1 (+ pi (/ pi 2)) h2))
  ;(command "line" pt1 pt8 "")
  (command "pline" pt1 pt2 pt3 pt4 pt5 pt6 pt7 pt8 "c")
  (prin1)
)
  (prompt "<< OK 20181001-05:04>>")
  (prin1)

沒有留言:

張貼留言