在A(yíng)utoCAD中畫(huà)緩和曲線(xiàn)比較困難,目前常用的畫(huà)法有AutoLISP程序法(需要已知曲線(xiàn)要素)、坐標(biāo)腳本法(需事先計(jì)算好各特征點(diǎn)及其他點(diǎn)為的坐標(biāo))、曲線(xiàn)命令法(需事先準(zhǔn)備各特征點(diǎn)坐標(biāo)),現(xiàn)分別介紹如下:

畫(huà)法一:緩和曲線(xiàn)AutoLISP 應(yīng)用程序

一、制作緩和曲線(xiàn)AutoLISP 應(yīng)用程序

復(fù)制AutoLISP程序源代碼,打開(kāi)“記事本”,粘貼進(jìn)去后,另存為文件名“緩和曲線(xiàn).LSP”,保存類(lèi)型為“所有文件”AutoLISP程序源代碼見(jiàn)附件

二、加載緩和曲線(xiàn)AutoLISP應(yīng)用程序

 

 

畫(huà)法二:坐標(biāo)腳本法

 

1.現(xiàn)做一個(gè)CAD腳本,會(huì)的人跳過(guò)(用Windows 文本 另存為“.scr”文件)
2.腳本編輯輸入“SPLINE+空格鍵+Y坐標(biāo)+,+X坐標(biāo)+空格鍵+Y坐標(biāo)+,+X坐標(biāo)……” 以此類(lèi)推!點(diǎn)輸?shù)脑矫,線(xiàn)條越平滑。也可以用EXCEL算出各個(gè)點(diǎn)的坐標(biāo)后粘貼進(jìn)去,然后按照“SPLINE+空格鍵+Y坐標(biāo)+,+X坐標(biāo)+空格鍵+Y坐標(biāo)+,+X坐標(biāo)……”格式編輯。
3.進(jìn)入CAD,運(yùn)行腳本,就行了!
注意:你可能輸入了100個(gè)點(diǎn),而出現(xiàn)的確只有幾個(gè)點(diǎn),這個(gè)很正常,你把圖像刪除了,多運(yùn)行幾次就行,一般不超過(guò)4次。

 

畫(huà)法三:使用真樣條曲線(xiàn)命令

 

 

 

舉例如下:

輸入導(dǎo)線(xiàn):pline命令繪制1、2、3各點(diǎn),其對(duì)應(yīng)坐標(biāo)如下
x1=213.7748 y1=92.1117
x2=313.7748 y2=92.1117
x3=399.6787 y3=143.3026
繪制通過(guò)ZH、HZ、QZ、HY和YH各點(diǎn)的與路線(xiàn)導(dǎo)線(xiàn)相切的含緩和曲線(xiàn)的平曲線(xiàn)。
通過(guò)計(jì)算,五個(gè)點(diǎn)的直角坐標(biāo)為:
ZH:X=232.9548 Y=92.1117
HY:X=285.3608 Y=94.4667
QZ:X=311.8101 Y=99.2371
YH:X=336.9780 Y=108.6801
HZ:X=383.6319 Y=133.7401
使用真樣條曲線(xiàn)命令繪制含緩和曲線(xiàn)的平曲線(xiàn)的基本操作步驟如下:
Command(命令): Spline(啟動(dòng)真樣條曲線(xiàn)命令)
object/<Enter first point>(指定起點(diǎn)):232.9548,92.1117(通過(guò)ZH)
Enter point :285.3608,94.4667
Close/Fit Tolerance/<Enter point>(指定下一個(gè)點(diǎn)):311.8101,99.2371<通過(guò)QZ>
Close/Fit Tolerance/<Enter point>指定下一個(gè)點(diǎn):336.9708,108.6801<通過(guò)YH>
Close/Fit Tolerance/<Enter point>指定下一個(gè)點(diǎn):383.6319,133.7401<通過(guò)HZ>
Close/Fit Tolerance/<Enter point>指定下一個(gè)點(diǎn):<加如回車(chē)>(選擇輸入切點(diǎn)的模式)
Enter star tangent(指定起點(diǎn)切向):232.9548,92.1117 (輸入起點(diǎn)切點(diǎn))
Enter star tangent(指定端點(diǎn)切向):383.6319,133.7401 (輸入終點(diǎn)的切點(diǎn))

附件:緩和曲線(xiàn)AutoLISP 程序源代碼

;;多義線(xiàn)摹擬緩和曲線(xiàn)。
;;輸入起止直線(xiàn)、半徑、緩和曲線(xiàn)長(zhǎng)或設(shè)計(jì)車(chē)速。
;;命令:HH
(defun com_p()
(setq l 0)
(command "ucs" "o" (list (- 0 x1) 0 0))
(command "pline" (list 0 0 0) "w" "0" ""
(repeat 1000
(setq l (+ l (/ Ls 1000))
x (+ (- l (/ (* l l l l l) 40 C C)) (/ (* l l l l l l l l l) 3456 C C C C))
y (* id__ (+ (- (/ (* l l l) 6 C) (/ (* l l l l l l l) 336 C C C)) (/ (* l l l l l l l l l l l) 42240 C C C C C)))
);setq
(command (list x y 0))
);repaet
);command
(setq pt5 (trans (list x y 0) 1 0))
);com_p

(defun ll_v()
(setq V (getreal "\nGive Velocity:")
Ls1 (* V 0.85)
Ls2 (/ (* 0.0357 V V V) R)
Ls (max Ls1 Ls2 (/ R 9))
Ls (* (fix (/ Ls 10)) 10.0)
);setq
(if (> Ls R) (setq Ls R))
(ll_d)
);ll_v

(defun ll_d()
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setq C (* Ls R)
q (- (+ (- (/ Ls 2) (/ (* Ls Ls Ls) 240 R R)) (/ (* Ls Ls Ls Ls Ls) 34560 R R R R)) (/ (* Ls Ls Ls Ls Ls Ls Ls) 8386560 R R R R R R))
pt1 (cdr (assoc 10 (entget (car p1))))
pt2 (cdr (assoc 11 (entget (car p1))))
pt10(polar pt1 (angle pt1 pt2) (/ (distance pt1 pt2) 2))
pt3 (cdr (assoc 10 (entget (car p2))))
pt4 (cdr (assoc 11 (entget (car p2))))
pt20(polar pt3 (angle pt3 pt4) (/ (distance pt3 pt4) 2))
p (+ (- (/ (* Ls Ls) 24 R) (/ (* Ls Ls Ls Ls) 2688 R R R)) (/ (* Ls Ls Ls Ls Ls Ls) 506880 R R R R R))
jd (inters pt1 pt2 pt3 pt4 nil)
alf1(angle pt10 jd)
alf2(angle pt20 jd)
alf (- (angle jd pt20) alf1)
);setq
(if (or (> alf pi) (and (< alf 0) (> alf (- 0 pi))))
(progn
(setq id__ -1)
(if (> alf pi) (setq alf (- (+ pi pi) alf)) (setq alf (abs alf)))
);progn
(progn
(setq id__ 1)
(if (<= alf (- 0 pi)) (setq alf (+ pi pi alf)))
);progn
);if
(setq x0 (/ (* (+ p R) (sin(/ alf 2.0))) (cos(/ alf 2.0)))
x1 (+ x0 q)
Cl (+ (* alf R) Ls)
E (- (/ (+ R p) (cos(/ alf 2))) R)
);setq
(command "ucs" "o" jd)
(command "ucs" "z" (/ (* 180 alf1) pi))
(com_p) (setq pt6 pt5)
(setq ppt1 (list x1 0 0))
(command "ucs" "")
(command "ucs" "o" jd)
(command "ucs" "z" (/ (* 180 alf2) pi))
(setq id__ (- 0 id__)) (com_p)
(setq ppt2 (list x1 0 0))
(command "ucs" "")
(if (> (abs(distance jd pt1)) (abs(distance jd pt2)))
(setq ptt1 pt1)
(setq ptt1 pt2)
);if
(setq ptt2 (polar jd alf1 (- 0 x1)))
(thh p1 ptt1 10)
(thh p1 ptt2 11)
(if (> (abs(distance jd pt3)) (abs(distance jd pt4)))
(setq ptt3 pt3)
(setq ptt3 pt4)
);if
(setq ptt4 (polar jd alf2 (- 0 x1)))
(thh p2 ptt3 10)
(thh p2 ptt4 11)
(if (= id__ 1) (command "arc" pt5 "e" pt6 "r" R) (command "arc" pt6 "e" pt5 "r" R))
(setq alfd (angf alf))
(setvar "osmode" os)
(command "cmdecho" "1")
(command "text" pause pause "" (strcat "偏   角=" alfd))
(command "cmdecho" "0")
(command "text" "" (strcat "半   徑=" (rtos R 2 2)))
(command "text" "" (strcat "切 線(xiàn) 長(zhǎng)=" (rtos x1 2 2)))
(command "text" "" (strcat "曲 線(xiàn) 長(zhǎng)=" (rtos Cl 2 2)))
(command "text" "" (strcat "外   距=" (rtos E 2 2)))
(command "text" "" (strcat "緩和曲線(xiàn)長(zhǎng)=" (rtos Ls 2 2)))
);ll_d


(defun angf (alf)
(setq alff (angtos alf 1 4)
n 1
kk (strlen alff))
(repeat kk
(setq alfn (substr alff n 1))
(if (= alfn "d")
(setq nn n));if
(setq n (+ n 1))
);repeat
(strcat (substr alff 1 (- nn 1)) "%%" (substr alff nn))
);angf

(defun c:hh(/ p1 p2 pt1 pt2 pt3 pt4 pt5 pt6 pt10 pt20 id__ R V Ls E p3
r1 x y l x0 x1 C jd alf alf1 alf2 q p Cl Ls1 Ls2)
(command "ucs" "")
(setq p1 nil p2 nil)
(while (= p1 nil) (setq p1 (entsel "\n拾取第一條直線(xiàn):")))
(redraw (car p1) 3)
(while (= p2 nil) (setq p2 (entsel "\n拾取第二條直線(xiàn):")))
(redraw (car p2) 3)
(initget 1)
(setq R (getdist "\n請(qǐng)輸入彎道半徑 R: "))
(initget 1 "Ls V")
(setq p3 (getdist "\n輸入緩和曲線(xiàn)長(zhǎng)度(Ls)或[設(shè)計(jì)速度(V)]: "))
(if (= p3 "V") (ll_v) (progn (setq ls p3) (ll_d)))
(princ)
);eline

(defun thh(len pt h)
(setq en_data (entget (car len))
old_data (assoc h en_data)
new_data (cons h pt)
en (subst new_data old_data en_data));setq
(entmod en)
);thh

 

 

在命令行輸入“appload”打開(kāi)自動(dòng)加載對(duì)話(huà)框。在對(duì)話(huà)框的“查找范圍”里找到“緩和曲線(xiàn).LSP”的那個(gè)程序,選中后,點(diǎn)擊【加載】,顯示“已成功加載緩和曲線(xiàn).LSP”后,關(guān)閉對(duì)話(huà)框,ok你那個(gè)程序自動(dòng)啟動(dòng)加載了。

三、在CAD中畫(huà)出切線(xiàn)長(zhǎng)

四、運(yùn)行程序在命令行中輸入hh回車(chē)

五、選擇兩條切線(xiàn),然后輸入曲線(xiàn)半徑 如:2204.5回車(chē)

六、輸入緩和曲線(xiàn)長(zhǎng),270,繪圖完成!