lisp繪製直齒圓柱齒輪 autolisp齒輪畫法

2021-10-13 15:00:29 字數 3035 閱讀 9037

q c 0.25)

( progn (setq ha 1)

(setq c 0.35)

);progn

(progn (if (= xsh 2) (setq ha 0.8 c 0.3)))

;***************====draw*****====

(defun chilun0()

(command "-layer" "c" cc "" "")

(setq p0 (list x0 y0 ))

;(command "_circle" p0 "d" 158);基圓直徑rb

(command "_circle" p0 "d" d );分度圓r 200=d

(setq c2 (entlast));分度圓賦給c2

(command "_circle" p0 "d" da );齒頂圓ra 210 =da

(setq c3 (entlast));齒頂圓

(command "_circle" p0 "d" (setq df (/ (* 33 d) 35)) );輔助圓直徑rf 189=df=33d/35

(setq c1 (entlast));輔助圓

(setq ag1 (atan (/ p 3) (sqrt (- (expt (/ d 2) 2) (expt (/ p 4) 2)))));3.925=p/2/2 5.5為修正後結果 5.5=p/4 100=d/2 3.925=p/4

(setq ag2 (atan (/ d 10) (sqrt (- (expt (/ df 2) 2) (expt (/ d 10) 2)))));20=d/10 94.5=df/2

(setq ag3 (- (/ pi 2) (- (* 2 ag2) ag1)))

(setq p1 (polar p0 (+ ag1 (* 0.5 pi)) (/ d 2)));分度圓齒廓上的點 100

(setq p2 (polar p0 ag3 (/ df 2)));輔助圓上的點 94.5

(command "_circle" p2 "d" (/ (* 2 d) 5)); 80=齒廓圓d

(setq c4 (entlast));齒廓圓

(setq p3 (polar p2 (/ pi 2) (/ d 5)));齒廓圓上的修剪點 40

(setq p4 (polar p2 (- (/ pi 2)) (/ d 5)));齒廓圓上的修剪點 40

(setq p5 (polar p0 0 (/ df 2)));輔助圓上的修剪點 94.5

(setq p6 (polar p0 0 (/ da 2)));齒頂圓上的修剪點 105

(setq p7 (polar p0 (+ ag2 ag3) (/ da 2)));齒頂圓上的點,第二次修剪用 105

(setq p8 (polar p0 (+ ag2 ag3) (/ df 2)));輔助圓上的點,第二次修剪用 94.5

(command "_erase" c2 "");刪掉分度圓

(command "_trim" c1 c3 c4 "" p3 p4 p5 p6 "");修剪

(command "_mirror" p1 "" (polar p0 0 0) (polar p0 (/ pi 2) (/ d 2)) "n"); 100

(command "_trim" "all" "" p7 p8 "");第二次修剪

(command "_region" "all" "" );面域

(setq f1 (entlast))

(setq p9 (list (car p1) (cadr p1) h)); 100

(command "line" p1 p9 "");拉伸路徑

(setq l1 (entlast))

(command "_circle" p0 "d" df);齒根圓 189

(setq f2 (entlast))

(command "_extrude" f1 "" "p" l1 );將單齒面和圓拉伸

(setq b1 (entlast));單個齒

(command "-array" b1 "" "p" p0 z 360 "y" );陣列輪齒;;;;;;;;;;;;;;;;

(command "_extrude" f2 "" "p" l1 )

(command "_union" "all" "" )

(setq b0 (entlast))

;====huizhikong**********

(command "_circle" p0 "d" (* 0.3 d));0.3*d

(command "_region" (entlast) "" )

(setq f3 (entlast))

(command "_circle" p0 "d" (* 0.79 d));0.79*d

(command "_region" (entlast) "" )

(setq f4 (entlast))

(command "_subtract" f4 "" f3 "" )

(setq f5 (entlast))

(command "_extrude" f5 "" (* 0.375 h) "" );;;;;;;;;;;;;;;

(setq b1 (entlast))

(command "_circle" (list (car p0) (cadr p0) h) "d" (* 0.3 d));0.3*d

(command "_region" (entlast) "" )

(setq f33 (entlast))

(command "_circle" (list (car p0) (cadr p0) h) "d" (* 0.79 d));0.79*d

(command "_region" (entlast) "" )

(setq f44 (entlast))

(command "_subtract" f44 "" f33 "" )

(setq f55 (entlast))

(command "_extrude" f55 "" (- (* 0.375 h)) "" );;;;;;;;;;;;;;;;

lisp程式繪製大樹 LISP 樹

可以從cons單元構建樹的資料結構,如清單列表。為了實現樹形結構,則必須設計功能,將遍歷cons 單元,在特定的順序,例如,前序,順序和後序的二進位制樹。樹列表的列表 讓我們考慮由cons單元的樹狀結構,形成列出的清單如下 1 2 3 4 5 6 它可以表示為 lisp樹的功能 雖然多數時候仍需要根...

openGL 中點Bresenham繪製直線演算法

macos xcode編譯器 include include include include include using namespace std float wid 400 設定視窗的大小,約定視窗必須為正方形 float height wid 設定視窗的大小 int numbers 20 設定...

中點圓的繪製演算法

注 我的文章都是用word寫的,從word直接複製到部落格,會出現很多格式問題,本人偷懶就直接從word截圖貼上到部落格,閱讀體驗會降低,請諒解 setpixel y xc,x yc 點 x,y 關於y x對稱 setpixel x xc,y yc 點 x,y 關於x軸對稱y setpixel x ...