當前位置:編程學習大全網 - 編程軟體 - 用autolisp開發技術繪制下面2個圖形

用autolisp開發技術繪制下面2個圖形

畫矩形代碼如下:

(defun C:JX()

(setq chang (getdist "長度 :"))

(setq kuan (getdist "寬度 :"))

(setq P0 (getpoint "the base point :"))

(setq P1 (polar P0 pi (/ chang 2)))

(setq P2 (polar P1 (- 0 (/ pi 2)) kuan))

(setq p3 (polar P2 0.0 chang))

(setq P4 (polar P1 0.0 chang))

(command "line" P1 P2 P3 P4 "c")

)

畫沈孔代碼如下:

(defun C:CENKONG ()

(setq d1 (getdist "input the diameter of the big hole:"))

(setq d2 (getdist "input the diameter of the small hole:"))

(setq l1 (getdist "input the length of the big hole:"))

(setq l2 (getdist "input the length of the small hole:"))

(setq P0 (getpoint "input the base of the cenkong:"))

(setq P1 (polar P0 pi (/ d1 2)))

(setq P2 (polar P1 (- (* 0.5 pi)) l1))

(setq P3 (polar P2 0.0 (/ (- d1 d2) 2)))

(setq P4 (polar P3 (- (* 0.5 pi)) l2))

(setq P5 (polar P4 0.0 d2))

(setq P6 (polar P3 0.0 d2))

(setq P7 (polar P2 0.0 d1))

(setq P8 (polar p1 0.0 d1))

(command "line" P1 P2 P3 P4 "")

(command "line" P5 P6 P7 P8 "")

)

  • 上一篇:C語言編程,運行之後輸入數字,總是無法計算成功
  • 下一篇:該如何找到壹個程序員男朋友?
  • copyright 2024編程學習大全網