AUTOLISP上機作業(yè)[優(yōu)質(zhì)內(nèi)容]_第1頁
AUTOLISP上機作業(yè)[優(yōu)質(zhì)內(nèi)容]_第2頁
AUTOLISP上機作業(yè)[優(yōu)質(zhì)內(nèi)容]_第3頁
AUTOLISP上機作業(yè)[優(yōu)質(zhì)內(nèi)容]_第4頁
已閱讀5頁,還剩6頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、 過程裝備與控制工程專業(yè)過程裝備CAD技術(shù)上機作業(yè)班級: 姓名: 學號: 年 月第三題(1);變量說明;p0是圓臉中心,p1、p2是眼睛中心,p3是鼻子中心,p4、p5是嘴的兩端點;R-圓臉半徑,r1-眼睛半徑,r2-鼻子半徑(initget 1)(setq p0 (getpoint 輸入圓臉中心點:)(initget(+ 1 2 4)(setq R(getreal 輸入圓臉半徑值:)(command circle p0 R)(setq r1 (/ R 4.0 )(setq r2 (/ R 9.0 )(setq p1 (polar p0 (/ pi 6.0) (/ R 2.0 )(comman

2、d circle p1 r1)(setq p2 (polar p0 (/ (* pi 5.0) 6.0) (/ R 2.0 )(command circle p2 r1)(setq p3 (polar p0(-(/ pi 2.0) (/ R 4.0)(command circle p3 r2)(setq a (/ (* R 2.0) 3.0)(setq p4 (polar p0 (-(/ (* pi 3.0) 4.0) a)(setq p5 (polar p0 (-(/ pi 4.0) a)(command arc cp0 p4 p5)(setq p6 (polar p0 (/ pi 6.0)

3、 (/ R 4.0 )(setq p7 (polar p0 (/ (* pi 5.0) 6.0) (/ R 4.0 )(command hatch solid p6 )(command hatch solid p7 )第三題(2);變量說明;plw-線寬(initget 1)(setq p0 (getpoint 輸入左下角點:)(setq plw 1.0)(setq a 100)(setq b 150)(setq c (/ pi 2.0)(setq d (- (/ pi 2.0)(setq p1 (polar po c a)(setq p2 (polar p1 0 b)(setq p3 (po

4、lar p2 c a)(setq p4 (polar p3 0 b)(setq p5 (polar p4 d a)(setq p6 (polar p5 0 b)(setq p7 (polar p6 d a)(command pline p0 w plew p1 p2 p3 w 0 p4 p5 p6 p7 c)第三題(3)(initget 1)(setq p0 (getpoint 輸入起點位置:)(initget 1)(setq bb (getreal 輸入圓心連線與水平線夾角=)(setq aa (/ (* bb pi) 180.0)(initget(+ 1 2 4)(setq n (geti

5、nt 圓的個數(shù)=)(initget(+ 1 2 4)(setq r (getreal 圓的半徑=)(setq d (* r 2.0)(repeat n (command circle p0 r );end of command (setq p0 (polar p0 aa d) );end of repeat第五題(setq p0 (100 100)(setq r 200)(setq p1 (400 100)(command circle p0 r)(setq e1 (ssget L)(command offset 30 e1 p1 )第六題;變量說明:p0為圖形中心,R為正五邊形外接圓半徑,R

6、1為中心圓半徑,a為正五邊形邊長。(initget 1)(setq p0 (getpoint 指定p0點:)(initget (+ 1 2 4)(setq R (getreal 輸入正五邊形外接圓半徑:)(setq R1 (/ R 2.0)(command circle p0 R1 )(setq s1 (entlast)(setq d (- (* pi (/ 126.0 180)(setq p1 (polar p0 d R)(setq b (* pi (/ 36.0 180)(setq a (* 2.0 R (sin b)(setq p2 (polar p1 0 a)(setq p5 (pol

7、ar p1 (* (/ 108.0 180) pi) a)(setq p3 (polar p2 (* (/ 72.0 180) pi) a)(setq p4 (polar p0 (/ pi 2.0) R)(command pline p1 p2 p3 p4 p5 c)(setq s2 (entlast)(setq p6 (list(car p1) (- (cadr p1) 50.0)(setq p7 (list(car p2) (- (cadr p2) 50.0)(command mirror s1 s2 p6 p7 )第七、九題(1)DCL文件:lx1:dialog label=練習; sp

8、acer; children_fixed_width=true; :popup_list /*popup_list*/ label=彈出式列表; key=plist1; width=18; /*end of popup_list*/ spacer_1; :edit_box /*edbox_1*/ label=編 輯 框 ; key=edbox; width=18; /*end of edbox_1*/ spacer_1; ok_cancel; /*end of dialog*/(2)驅(qū)動程序:(defun mainprogram();主程序 (setq plist_1 (list 200 30

9、0 400);彈出式列邊框中的內(nèi)容 (setq plist_2 (list 200 300 400);編輯框中的內(nèi)容 (setq shuzhi 200) (liebiao);調(diào)用列表函數(shù) );end of defun mainprogram (defun liebiao() (if ( (setq dlg_id1 (load_dialog c:usersAdministratordesktopdialog_column1.dcl) 0);加載對話框文件 (progn ;progn1 (if (new_dialog lx1 dlg_id1);顯示對話框 (progn ;progn2 以下初始化對

10、話框和描述控件活動 (start_list plist1);初始化彈出式列表框 (mapcar add_list plist_1) (end_list) (set_tile edbox 200);初始化編輯框 (action_tile plist1 (plistaction);列表框有動作時調(diào)用函數(shù)plistaction (start_dialog);激活對話框 );end of progn2 (alertUnable to display dialog box) );end of new_dialog (unload_dialog dlg_id1);卸載對話框 );end of progn1

11、 (alert Unable to load dialog box) );end of load_dialog );end of defun liebiao(defun plistaction(/ a) (setq a (get_tile plist1);得到列表的索引值 (setq a (atoi a) (setq shuzhi (nth a plist_2) (setq shuzhi (rtos shuzhi 2 0);將相應的數(shù)值轉(zhuǎn)換成字符串 (set_tile edbox shuzhi);在編輯框中顯示數(shù)值);end of defun plistaction第十題(1) DCL文件:i

12、d0:dialog label=算屬相; spacer; children_fixed_width=true; :edit_box label=出生年份:; key=edbox1; width=28; :text label=(如1956); :row/row1 :text label=屬 相:; :column/column1 :text width=20; key=txt1; /end of column1 /end of low1 spacer; ok_only; spacer; /end of dialog(2) 驅(qū)動程序:(defun id0() (if ( (setq dlg_id

13、(load_dialogC:UsersAdministratorDesktopdialog_id0.dcl) 0);加載對話框文件 (progn;progn1 (if (new_dialog id0 dlg_id) (progn ;progn2 ;以下初始化對話框和描述控件活動 (action_tile edbox1 (edbox1action) ;以上初始化對話框和描述控件活動 (start_dialog);激活對話框 );end of progn2(alert Unable to display dialog box);end of new dialog (unload_dialog dl

14、g_id);卸載對話框 );end of progn2 (alert Unable to load dialog box) );end of load dialog );end of defun(defun edbox1action() (setq idnum (get_tile edbox1) (setq idnum (atoi idnum) (setq idnum (rem idnum 12) (set_tile txt1 (cond(= idnum 0) 猴) (= idnum 1) 雞) (= idnum 2) 狗) (= idnum 3) 豬) (= idnum 4) 鼠) (= idnum 5) 牛) (= idnum 6) 虎) (= idnum 7) 兔) (= idnum 8) 龍) (= idnum 9) 蛇) (= idnum 10) 馬) (= idnu

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論