CAD上機作業(yè).doc
《CAD上機作業(yè).doc》由會員分享,可在線閱讀,更多相關(guān)《CAD上機作業(yè).doc(13頁珍藏版)》請在裝配圖網(wǎng)上搜索。
過程裝備與控制工程專業(yè) 過程裝備CAD技術(shù) 上機作業(yè) 班級: 過程裝備與控制工程12-3 姓名: 黃凌瑞 學(xué)號: 2012216538 2015年4月 3(1)源程序: (command "circle" "0,0" 36) (command "circle" "15,12" 9) (command "circle" "-15,12" 9) (command "circle" "0,-8" 4) (command "donut" 0 18 "15,12" "-15,12" "") (command "arc" "-18,-15" "0,-25" "18,-15") 3(2)源程序: (setq plw 5);;指定線寬 (command "pline" "0,0" "w" plw "" "0,100" "150,100" "150,200" "w" 0 "" "300,200" "300,100" "450,100" "450,0" "c") 3(3)源程序: (initget 1) (setq p0 (getpoint "直線起點:"));;輸入直線起點 (initget 1) (setq cta (getreal "圓心線與水平線夾角:"));;指定圓心線與水平線夾角 (initget(+ 1 2 4)) (setq r (getreal "圓半徑:"));;輸入圓半徑 (initget(+ 1 2 4)) (setq n (getint "圓的個數(shù):"));;輸入圓的個數(shù) (setq cta (/(* pi cta)180.0)) (repeat n (command "circle" p0 r) (setq p0(polar p0 cta (* r 2))) ) 4、源程序: (setq a (getreal "a=")) (setq b (getreal "b=")) (setq r (getreal "r=")) (setq x1 (/ a 2)) (setq x2 (expt r 2)) (setq x3 (/(expt a 2) 4)) (setq x4 (- x2 x3)) (setq x5 (+(expt x4 0.5) r)) (setq x6 (+ x5 b)) (setq p0 (list a b)) (setq p1 (list x1 x6)) (setq p2 (list 0 b)) (setq p3 (list 0 0)) (setq p4 (list a 0)) (command "arc" p0 p1 p2) (command "pline" p2 p3 p4 p0 "") 5、源程序: (command "circle" "100,100" 200) (setq s1(ssget “L”)) (command "offset" "30" s1 "500,500") 6、源程序: (command "polygon" 5 "0,0" "i" 100 "") (setq e1(entnext)) (command "circle" "0,0" 60) (setq s1(ssget “L”)) (ssadd e1 s1) (command "mirror" s1 "" "-100,-200" "100,-200" "") 7:對話框文件: column1:dialog{ label="價格查詢"; spacer; :popup_list{ label="書籍名稱"; key="plist1"; fixed_width=true; width=30; } :edit_box{ label="單 價(元)"; key="edbox1"; width=30; } spacer; ok_only; } 驅(qū)動程序: (defun mainprogram() (setq plist_1(list "高等數(shù)學(xué)" "大學(xué)物理" "大學(xué)英語")) (setq plist_2(list "26.00" "30.50" "28.00")) (setq jiage "26.00") (liebiao) ) (defun liebiao() (if(> (setq dlg_id1(load_dialog "e:\\2012216538\\7.dcl")) 0) (progn (if(new_dialog "column1" dlg_id1) (progn (start_list "plist1") (mapcar add_list plist_1) (end_list) (set_tile "edbox1" "26.00") (action_tile "plist1" "(plistaction)") (setq flag(start_dialog)) ) (alert "Unable to display dialog box" ) ) (unload_dialog dlg_id1) ) (alert "Unable to load dialog box") ) ) (defun plistaction(/ idnum) (setq idnum(get_tile "plist1")) (setq idnum(atoi idnum)) (setq jiage(nth idnum plist_2)) (set_tile "edbox1" jiage) ) 運行結(jié)果: 8對話框文件 id0:dialog{ label="算屬相"; spacer; :edit_box{ label="出生年份:"; key="edbox1"; width=20; } spacer; :row{ :text{ label="屬 相:"; } :text{ width=20; key="txt1"; } } spacer; spacer; :row{ spacer; ok_only; spacer; } } 驅(qū)動程序:(defun ex9() (if(>(setq dlg_id1(load_dialog "e:\\2012216538\\8.dcl")) 0) (progn (if(new_dialog "id0" dlg_id1) (progn (set_tile "edbox1" "0000") (mode_tile "edbox1" 2) (action_tile "edbox1" "(edbox1action)") (setq flg00(start_dialog)) ) (alert "unable to display dialog box") ) (unload_dialog dlg_id1) ) (alert "unable to load dialog box") ) ) (defun edbox1action() (setq flg1 0) (setq idnum(get_tile "edbox1")) (if(= flg00 1) (progn (setq a idnum) (setq idnum(atoi idnum)) (setq b(itoa idnum)) (if (= a b) (progn (setq idnum(rem idnum 12)) (setq shuxiang(nth idnum plist_1)) (set_tile "txt1" shuxiang) ) (alert "請輸入正確年份") ) ) ) ) (defun mainprogram() (setq plist_1(list "猴" "雞" "狗" "豬" "鼠" "牛" "虎" "兔" "龍" "蛇" "馬" "羊")) (ex9) ) 9:對話框程序: huatu:dialog{ label="圖形繪制"; spacer; :row{ :column{ :image{ key="image"; width=20; aspect_ratio=0.5; color=-2; } :column{ label=""; :popup_list{ label="所開槽數(shù):"; key="pp1"; list="1\n2\n3\n4\n5"; width=20; } :popup_list{ label="角度(cta):"; key="pp2"; list="15\n20\n30"; width=20; } } } :column{ :column{ label="起點坐標p0(單位:mm)"; :edit_box{ label="X坐標:"; key="edbox1"; value="0.0"; } :edit_box{ label="Y坐標:"; key="edbox2"; value="0.0"; } } spacer; :column{ label="幾何尺寸(單位:mm)"; :edit_box{ label="總體高度(H)"; key="edbox3"; value="0.0"; } :edit_box{ label="頂邊寬度(a)"; key="edbox4"; value="0.0"; } :edit_box{ label="斜邊長度(b)"; key="edbox5"; value="0.0"; } :edit_box{ label="槽底寬度(c)"; key="edbox6"; value="0.0"; } } } } ok_cancel; } 驅(qū)動程序:(defun mainprogram() (setq flag 0) (dialog1) (if (= flag 1) ;(progn (huagc) ;) );;IF );;DEFUN mainprogram (defun dialog1() (if (> (setq dlg_id1 (load_dialog "E:\\2012216538\\9.dcl")) 0);加載對話框文件 (progn;progn1 (if (new_dialog"huatu" dlg_id1);顯示對話框 (progn;progn2 ;以下初始對話框和描述文件控件 (start_image "image") (setq max_x (dimx_tile "image")) (setq max_y (dimx_tile "image")) (slide_image 0 -50 max_x max_y "D:\\2012216538\\GS.SLD") (end_image) (action_tile "pp1" "(plistaction1)") (action_tile "pp2" "(plistaction2)") (action_tile "edbox1" "(edbox1action)") (action_tile "edbox2" "(edbox2action)") (action_tile "edbox3" "(edbox3action)") (action_tile "edbox4" "(edbox4action)") (action_tile "edbox5" "(edbox5action)") (action_tile "edbox6" "(edbox6action)") ;(huagc) (setq flag (start_dialog));激活對話框 );end of progn2 (alert"unable to display dialog box") );end if new dialog (unload_dialog dlg_id1);卸載對話框 );end of progn1 (alert"unable to load dialog box") );end if load dialog );end of defun (defun plistaction1() (setq caosu (1 2 3 4 5)) (setq csid (get_tile "pp1")) (setq csid (atoi csid)) (setq cs (nth csid caosu)) ) (defun plistaction2() (setq jiaodu (15 20 30)) (setq ctaid (get_tile "pp2")) (setq ctaid (atoi ctaid)) (setq cta (nth ctaid jiaodu)) ) (defun edbox1action() (setq x (get_tile "edbox1")) (setq x (atoi x)) ) (defun edbox2action() (setq y (get_tile "edbox2")) (setq y (atoi y)) ) (defun edbox3action() (setq H (get_tile "edbox3")) (setq H (atoi H)) ) (defun edbox4action() (setq a (get_tile "edbox4")) (setq a (atoi a)) ) (defun edbox5action() (setq b (get_tile "edbox5")) (setq b (atoi b)) ) (defun edbox6action() (setq c (get_tile "edbox6")) (setq c (atoi c)) ) (defun huagc() (setq cta (/ (* pi cta) 180.0)) (setq p0 (list x y)) (setq pt (polar p0 (* 0.5 pi) H)) (command "pline" p0 pt) (repeat cs (command (setq pt (polar pt 0 a)) (setq pt (polar pt (- cta (* 0.5 pi)) b)) (setq pt (polar pt 0 c)) (setq pt (polar pt (- (* 0.5 pi) cta) b)) ) ) (command (setq pt (polar pt 0 a )) (setq pt (polar pt (* pi 1.5) H)) "c") (command "hatch" "ansi31" "" "" p0 "") ) 運行結(jié)果: 10:源程序: ***pop1 [上機作業(yè)] [第7題...]^c^c(load "E:/2012216538/7.LSP")(mainprogram) [第8題...]^c^c(load "E:/2012216538/8.LSP")(mainprogram) [第9題...]^c^c(load "e:/2012216538/9.LSP")(mainprogram) ;[第10題...]^c^c(load "e:/2012216538/10") 運行結(jié)果:- 1.請仔細閱讀文檔,確保文檔完整性,對于不預(yù)覽、不比對內(nèi)容而直接下載帶來的問題本站不予受理。
- 2.下載的文檔,不會出現(xiàn)我們的網(wǎng)址水印。
- 3、該文檔所得收入(下載+內(nèi)容+預(yù)覽)歸上傳者、原創(chuàng)作者;如果您是本文檔原作者,請點此認領(lǐng)!既往收益都歸您。
下載文檔到電腦,查找使用更方便
5 積分
下載 |
- 配套講稿:
如PPT文件的首頁顯示word圖標,表示該PPT已包含配套word講稿。雙擊word圖標可打開word文檔。
- 特殊限制:
部分文檔作品中含有的國旗、國徽等圖片,僅作為作品整體效果示例展示,禁止商用。設(shè)計者僅對作品中獨創(chuàng)性部分享有著作權(quán)。
- 關(guān) 鍵 詞:
- CAD 上機 作業(yè)
鏈接地址:http://zhongcaozhi.com.cn/p-12766618.html