香蕉久久网站,99久久久国产精品免费播放器,欧美三级网站在线观看,国产在线精品一区二区夜色,久久狠狠丁香婷婷综合,日本一道高清不卡免费,在线观看免费黄网站

減速機(jī)行業(yè)最權(quán)威的減速機(jī)網(wǎng)站! 減速機(jī)網(wǎng)
免費(fèi)注冊(cè) | 會(huì)員登錄會(huì)員中心 設(shè)為首頁(yè)加入收藏聯(lián)系我們
減速機(jī)網(wǎng)
 當(dāng)前位置:減速機(jī)首頁(yè) >> 技術(shù)講座 >>技術(shù)講座>>齒輪輪齒漸開線、螺栓、彈簧的autolsp源程序
   我要成為會(huì)員
減速機(jī)網(wǎng) 齒輪輪齒漸開線、螺栓、彈簧的autolsp源程序 減速機(jī)網(wǎng)
來(lái)源:減速機(jī)信息網(wǎng)    時(shí)間:2008-5-16 9:31:56  責(zé)任編輯:lihongwei  
一、齒輪輪齒漸開漸開線

(defun c:gear(/)
(
setq
p0 (getpoint"輸入齒輪中心p0: ")
m (getreal"輸入齒輪模數(shù)M: ")
z (getint"輸入齒輪齒數(shù)Z: ")
ha 1
c 0.25
a (/ pi 9)
ra(/ (* (+ z (+ ha ha)) m) 2)
rf(/ (* (- z (+ (+ ha ha) c)) m) 2)
r(/ ( * m z) 2)
rb ( * r (cos a))
ri rb
ang 0
g (polar p0 ang rb)
)
(command "circle" p0 ra)
(command "circle" p0 rf)
(command "circle" p0 r)
(command "line" g)

(while (< ri ra)
(setq
ang ( + ang(/ pi 360))
ri ( / rb (cos ang))
cta ( - (/ (sin ang) (cos ang)) ang)
g(polar p0 cta ri)
)

(command g)
)
(command )
)


二、螺旋源程序

(defun errMsg (s)
(if (/= s "function cancelled") (princ (strcat "\nError: " s)))
; 當(dāng)命令執(zhí)行時(shí)出現(xiàn)錯(cuò)誤
(setvar "cmdecho" ocmdold) ; 例如用戶按下了CTRL + C
(setvar "osmode" osmold)
(setq *error* olderr) ; 恢復(fù)舊的錯(cuò)誤處理
(princ)
)

(defun c:3Dthread (/ radouter threadpitch threadlength threadangle
ptStart innerdiafactor radmid radinner ocmdold osmold 4H 5H 6H h6 g6)
;-------------------------------------------------------------------
; 獲取公制外徑大小、螺距總長(zhǎng)
; 然后計(jì)算一系列幾何點(diǎn)
; 并且關(guān)閉對(duì)象捕捉、命令回顯
;-------------------------------------------------------------------
(setq 4H (list 0.0015 0.002 0.002 0.0025 0.003 0.0035 0.004 0.005 0.006 0.007 0.008 0.009 0.010))
(setq 5H (list 0.002 0.0025 0.003 0.004 0.0045 0.0055 0.0065 0.0075 0.009 0.010 0.0115 0.0125 0.0135))
(setq 6H (list 0.003 0.004 0.0045 0.0055 0.0065 0.008 0.0095 0.011 0.0125 0.0145 0.016 0.018 0.020))
(setq h6 (list -0.003 -0.004 -0.0045 -0.0055 -0.0065 -0.008 -0.0095 -0.011 -0.0125 -0.0145 -0.016 -0.018 -0.020))
(setq g6 (list -0.005 -0.008 -0.0095 -0.0115 -0.0135 -0.017 -0.0195 -0.023 -0.0265 -0.0295 -0.033 -0.036 -0.0515))

(setq osmold (getvar "osmode")) ; 保存調(diào)用前的osmode系統(tǒng)變量值
(setq ocmdold (getvar "cmdecho")) ; 保存調(diào)用前的cmdecho系統(tǒng)變量值
(setvar "osmode" 0) ; 關(guān)閉對(duì)象捕捉
(setvar "cmdecho" 0) ; 關(guān)閉命令的回顯

(setq innerdiafactor 1.5) ; 設(shè)置內(nèi)徑系數(shù)
(initget 7) ; radmid 必須非零、非空、非負(fù)
(setq radmid (getdist "\n公制外徑: "))
(initget 7) ; threadpitch 必須非零、非空、非負(fù)
(setq threadpitch (getreal "\n螺距: "))
(initget 1) ; ptStart 必須非空
(setq ptStart (getpoint "\n起始點(diǎn): "))
(initget 3) ; threadlength 必須非零、非空、非負(fù)
(setq threadlength (getdist "\n螺紋總長(zhǎng)(Y方向): "))

; 對(duì)公制外徑添加公差
(if (<= radmid 3) (setq order 0) ; 根據(jù)公制外徑確定公差帶中位置
(if (<= radmid 6) (setq order 1)
(if (<= radmid 10) (setq order 2)
(if (<= radmid 18) (setq order 3)
(if (<= radmid 30) (setq order 4)
(if (<= radmid 50) (setq order 5)
(if (<= radmid 80) (setq order 6)
(if (<= radmid 120) (setq order 7)
(if (<= radmid 180) (setq order 8)
(if (<= radmid 250) (setq order 9)
(if (<= radmid 315) (setq order 10)
(if (<= radmid 400) (setq order 11)
(if (<= radmid 500) (setq order 12)
)))))))))))))

(if (< threadpitch 0.25) (setq radmid (+ radmid (nth order 4H))) ; 根據(jù)螺距確定公差帶
(if (< threadpitch 0.35) (setq radmid (+ radmid (nth order 5H)))
(if (>= threadpitch 0.35) (setq radmid (+ radmid (nth order 6H)))
)))

(setq h (* 0.866025 threadpitch)) ; 計(jì)算齒高
(setq radouter (+ radmid (/ h 4))) ; 計(jì)算外徑
(setq radinner (- radouter (* h innerdiafactor))) ; 計(jì)算內(nèi)徑
(setq threadangle (+ 30 0)) ; 計(jì)算齒頂角

(auxithread radouter radmid radinner threadpitch threadlength threadangle ptStart) ; 調(diào)用繪制三維螺紋的子函數(shù)

(princ "\n三維螺紋創(chuàng)建完成")
(setvar "osmode" osmold) ; 恢復(fù)調(diào)用前的osmode系統(tǒng)變量值
(setvar "cmdecho" ocmdold) ; 恢復(fù)調(diào)用前的cmdecho系統(tǒng)變量值
(princ)
)

(defun auxithread (radouter radmid radinner threadpitch threadlength threadangle ptStart / ttal pt1z ang pt1a
pt1az pt3a pt1b pt1bz pt3b pttmp1 pttmp2 pttmp3 pttmp4 pttmp5 pttmp6 pttmp7 pttmp8 pttmp9 pttmp10 pttmp11 pttmp12 tstmp startcone endcone)

;(command "undo" "begin") ; 開始undo步驟

(setq ttal (+ (fix (/ (abs threadlength) threadpitch)) 3)
pttmp1 (list (- (car ptStart) (/ radouter 2.0)) (cadr ptStart) (caddr ptStart))
pt1z (list (- (car ptStart) (/ radouter 2.0)) (cadr ptStart) (+ (caddr pttmp1) 1.0))
pttmp2 (polar pttmp1 (/ (* threadangle pi) 180.0) 1)
pttmp3 (list (+ (car pttmp1) radouter) (+ (cadr pttmp1) (/ threadpitch 2.0)) (caddr ptStart))
ang (angle pttmp1 pttmp3)
pt1a (polar pttmp1 (+ ang (/ pi 2.0)) threadpitch)
pt1az (list (car pt1a) (cadr pt1a) (+ (caddr pt1a) 1.0))
pt3a (polar pt1a ang radouter)
pt1b (polar pttmp1 (- ang (/ pi 2.0)) threadpitch)
pt1bz (list (car pt1b) (cadr pt1b) (+ (caddr pt1b) 1.0))
pt3b (polar pt1b ang radouter)
pttmp4 (polar pttmp3 (/ (* (- 180 threadangle) pi) 180.0) 1)
pttmp5 (inters pttmp1 pttmp2 pttmp3 pttmp4 nil)
pttmp6 (list (car pttmp5) (cadr ptStart) (caddr ptStart))
pttmp7 (polar pttmp1 (/ (* (- 360 threadangle) pi) 180.0) 1)
pttmp8 (polar pttmp3 (/ (* (+ 180 threadangle) pi) 180.0) 1)
pttmp9 (inters pttmp1 pttmp7 pttmp3 pttmp8 nil)
pttmp10 (list (car pttmp9) (cadr pttmp3) (caddr pttmp3))
pttmp11 (polar ptStart (/ pi 2.0) threadpitch)
pttmp12 (polar pttmp11 (/ pi 2.0) (abs threadlength))
)

;-------------------------------------------------------------------
; 繪制兩個(gè)倒置的并偏移1/2螺距的圓錐
; 這兩個(gè)圓錐都以中剖面剖分
; 進(jìn)行并集運(yùn)算
;-------------------------------------------------------------------

(SETQ startcone "order")
(SETQ endcone "Y")
(command "zoom" "w" (list (car pt1a) (+ (cadr pt1a) (abs threadlength)) (caddr pt1a)) pt3b)

(princ "\n正在繪制三維螺紋,請(qǐng)等待")
(command "pline" pttmp1 pttmp5 pttmp6 "c")
(command "revolve" "l" "" pttmp5 pttmp6 "")
(command "slice" "l" "" pttmp1 pttmp3 pt1z pttmp5)
(command "slice" "l" "" pt1a pt3a pt1az pttmp3)
(setq tstmp (ssadd (entlast)))
(command "pline" pttmp3 pttmp9 pttmp10 "c")
(command "revolve" "l" "" pttmp9 pttmp10 "")
(command "slice" "l" "" pttmp1 pttmp3 pt1z pttmp9)
(command "slice" "l" "" pt1b pt3b pt1bz pttmp3)
(setq tstmp (ssadd (entlast) tstmp))
(command "union" tstmp "")

;-------------------------------------------------------------------
; 上面的實(shí)體被剖切成兩份,然后進(jìn)行鏡像以獲得螺旋線的螺旋
; 單線的高度實(shí)際上等于兩倍螺距,但是超出或者是在內(nèi)部或者是
; 在最后一步被切除
;-------------------------------------------------------------------

(command "slice" tstmp "" "xy" ptStart "b")
(setq tstmp (ssadd (entlast) tstmp))
(command "mirror" "l" "" pttmp1 "@10<0" "y")
(command "union" tstmp "")

;-------------------------------------------------------------------
; 螺旋進(jìn)行陣列操作,然后再作并集(可能會(huì)耗費(fèi)一定時(shí)間)
; 得到的實(shí)體再切除到指定的螺旋高度
;-------------------------------------------------------------------

(setq e (entlast))
(command "array" tstmp "" "r" ttal 1 threadpitch)
(repeat (1- ttal)
(setq e (entnext e)
tstmp (ssadd e tstmp)
)
)
(command "union" tstmp "")

; 若開始創(chuàng)建45度的圓錐
(if (/= startcone "order")
(progn (setq e (entlast))
(command "cone" (list (car ptStart) (+ (cadr ptStart) threadpitch) (caddr ptStart)) "d" radmid "a" (list (car ptStart) (+ (+ (cadr ptStart) (/ radmid 2)) threadpitch) (caddr ptStart)))
(command "union" "l" e "")
)
)

(command "slice" "l" "" "zx" pttmp11 pttmp12)
(command "slice" "l" "" "zx" pttmp12 pttmp11)
(command "move" "l" "" ptStart (list (car ptStart) (- (cadr ptStart) threadpitch) (caddr ptStart)))

; 創(chuàng)建最小直徑的圓柱體,然后與螺旋作交集
(setq e (entlast))
(command "cylinder" ptStart "d" radinner "c" (list (car ptStart) (+ (cadr ptStart) (abs threadlength)) (caddr ptStart)))
(command "union" "l" e "")
(setq tstmp (entlast))

; 創(chuàng)建中空的圓柱體
(command "cylinder" ptStart "d" radmid "c" (list (car ptStart) (+ (cadr ptStart) (abs threadlength)) (caddr ptStart))) ; minor dia
(setq e (entlast))

; 若最后創(chuàng)建45度的圓錐
(if (/= endcone "order")
(progn (command "move" "l" "" ptStart (list (car ptStart) (- (cadr ptStart) (/ (- radmid radinner) 2)) (caddr ptStart)))
(command "cone" ptStart "d" radmid "a" (list (car ptStart) (+ (cadr ptStart) (/ radmid 2)) (caddr ptStart)))
(command "move" "l" "" ptStart (list (car ptStart) (- (+ (cadr ptStart) (abs threadlength)) (/ (- radmid radinner) 2)) (caddr ptStart)))
(command "union" "l" e "")
(setq e (entlast))
)
)

; 從大圓柱中減去小直徑圓柱
(command "cylinder" ptStart "d" (* radmid 1.5) "c" (list (car ptStart) (+ (cadr ptStart) (abs threadlength)) (caddr ptStart)))
(command "subtract" "l" "" e "")
(setq e (entlast))

; 從螺旋中減去圓柱
(command "subtract" tstmp "" e "")

; 如果螺旋長(zhǎng)度為負(fù)然后鏡像
(setq e (entlast))
(if (< threadlength 0) (mirror3d e "zx" ptStart "y"))

(command "zoom" "p")
; (command "undo" "end") ; 結(jié)束undo步驟
)

;;;---------------------------------------------------------------------------------------------------------------------;
(arxload "geom3d" nil)
(princ "\n3DThread 已加載。 ")
(princ)

三、彈簧源程序

(defun errMsg (s) ; 當(dāng)命令執(zhí)行時(shí)出現(xiàn)錯(cuò)誤
; 例如用戶按下了CTRL + C
(if (/= s "Function cancelled")
(princ (strcat "\nError: " s))
)
(setvar "cmdecho" cmdch) ; 恢復(fù)調(diào)用前的cmdecho系統(tǒng)變量值
(setvar "blipmode" blpmd) ; 恢復(fù)調(diào)用前的blipmode系統(tǒng)變量值
(setq *error* olderror) ; 恢復(fù)舊的錯(cuò)誤處理
(princ)
)

(defun spring (nRepeat cntPoint bhfac lr strad bvfac
/ angle distnc tp aGrw dhGrw dvGrw Pi2 dv)

(setvar "blipmode" 0) ; 關(guān)閉 blipmode
(setvar "cmdecho" 0) ; 關(guān)閉 cmdecho
(setq Pi2 (* 3.14159265 2))
(setq aGrw (/ Pi2 lr))
(setq dhGrw (/ bhfac lr))
(if bvfac (setq dvGrw (/ bvfac lr)))
(setq angle 0.0)
(if bvfac
(setq distnc strad dv 0.0)
(setq distnc 0.0)
)
(if bvfac
(command "3dpoly") ; 開始繪制彈簧
(command "pline" cntPoint) ; 從基點(diǎn)開始繪制彈簧
)
(repeat nRepeat
(repeat lr
(setq tp (polar cntPoint (setq angle (+ angle aGrw))
(setq distnc (+ distnc dhGrw))
)
)
(if bvfac
(setq tp (list (car tp) (cadr tp) (+ dv (caddr tp)))
dv (+ dv dvGrw)
)
)
(command tp) ; 繼續(xù)輸入下一點(diǎn)
)
)
(command "") ; 輸入結(jié)束
(princ)
)

;;;
;;; 生成三維彈簧函數(shù)調(diào)用接口
;;;

(defun C:3DSPRING (/ olderror cmdch blpmd cntPt RottCnt horiGrw vertGrw bgnRdtn ptCntPerCircle)
(setq cmdch (getvar "cmdecho")) ; 獲取cmdecho值,以便調(diào)用結(jié)束后恢復(fù)
(setq blpmd (getvar "blipmode")) ; 獲取blipmode值,以便調(diào)用結(jié)束后恢復(fù)
(setvar "cmdecho" 0) ; 關(guān)閉 cmdecho
(initget 1) ; cntPt 必須非空
(setq cntPt (getpoint "\n請(qǐng)輸入底部中心點(diǎn): "))
(initget 7) ; RottCnt 必須非零、非空,不可忽略
(setq RottCnt (getint "\n旋轉(zhuǎn)的圈數(shù): "))
(initget 7) ; bgnRdtn 必須非零、非空,不可忽略
(setq bgnRdtn (getdist cntPt "\n起始半徑: "))
(initget 1) ; cf 必須非零、非空
(setq horiGrw (getdist "\n每一圈的水平增長(zhǎng)距離: "))
(initget 3) ; cf 必須非零、非空
(setq vertGrw (getdist "\n每一圈的垂直增長(zhǎng)距離: "))
(initget 6) ; ptCntPerCircle 必須非零、不可忽略
(setq ptCntPerCircle (getint "\n每一圈的插值點(diǎn)數(shù)<35>: "))
(cond ((null ptCntPerCircle) (setq ptCntPerCircle 35)))
(spring RottCnt cntPt horiGrw ptCntPerCircle bgnRdtn vertGrw)
(setvar "cmdecho" cmdch) ; 恢復(fù)調(diào)用前的cmdecho系統(tǒng)變量值
(setvar "blipmode" blpmd) ; 恢復(fù)調(diào)用前的blipmode系統(tǒng)變量值
(setq *error* olderror) ; Restore old *error* handler
(princ)

查看評(píng)論 】【關(guān)閉窗口
減速機(jī)網(wǎng)   精品推薦 減速機(jī)網(wǎng)   減速機(jī)網(wǎng)   相關(guān)信息 減速機(jī)網(wǎng)
減速機(jī)網(wǎng) 網(wǎng)友留言 減速機(jī)網(wǎng)
減速機(jī)網(wǎng) 發(fā)表評(píng)論:  標(biāo)題:    聯(lián)系方式
  
 減速機(jī)網(wǎng)
*必須遵守《全國(guó)人大常委會(huì)關(guān)于維護(hù)互聯(lián)網(wǎng)安全的決定》及中華人民共和國(guó)其他有關(guān)法律法規(guī)。
*不得制作、復(fù)制、發(fā)布、傳播含有下列內(nèi)容的信息:
   (一)反對(duì)憲法所確定的基本原則的;
   (二)危害國(guó)家安全,泄露國(guó)家秘密,顛覆國(guó)家政權(quán),破壞國(guó)家統(tǒng)一的;
   (三)損害國(guó)家榮譽(yù)和利益的;
   (四)煽動(dòng)民族仇恨、民族歧視,破壞民族團(tuán)結(jié)的;
   (五)破壞國(guó)家宗教政策,宣揚(yáng)邪教和封建迷信的;
   (六)散布謠言,擾亂社會(huì)秩序,破壞社會(huì)穩(wěn)定的;
   (七)散布淫穢、色情、賭博、暴力、兇殺、恐怖或者教唆犯罪的;
   (八)侮辱或者誹謗他人,侵害他人合法權(quán)益的;
   (九)含有法律、行政法規(guī)禁止的其他內(nèi)容的。
* 您發(fā)表的文章僅代表個(gè)人觀點(diǎn),與減速機(jī)信息網(wǎng)無(wú)關(guān)。
* 承擔(dān)一切因您的行為而直接或間接導(dǎo)致的民事或刑事法律責(zé)任。
* 本站評(píng)論管理人員有權(quán)保留或刪除其管轄評(píng)論中的任意內(nèi)容。
* 您在本站評(píng)論板發(fā)表的作品,本站有權(quán)在網(wǎng)站內(nèi)轉(zhuǎn)載或引用。
* 參與本評(píng)論即表明您已經(jīng)閱讀并接受上述條款。
關(guān)于我們 - 聯(lián)系方式 - 版權(quán)聲明 - 本站宗旨 - 網(wǎng)站地圖 - 廣告服務(wù) - 幫助中心 - 設(shè)為首頁(yè) - 加入收藏
全國(guó)服務(wù)熱線:010-51179040 E-mail:jiansuji001@163.com
Copyright © 2008-2018 By 減速機(jī)信息網(wǎng) All Rights Reserved.