AUTOLISP上机作业

上传人:s9****2 文档编号:489882693 上传时间:2024-01-29 格式:DOC 页数:11 大小:287.01KB
返回 下载 相关 举报
AUTOLISP上机作业_第1页
第1页 / 共11页
AUTOLISP上机作业_第2页
第2页 / 共11页
AUTOLISP上机作业_第3页
第3页 / 共11页
AUTOLISP上机作业_第4页
第4页 / 共11页
AUTOLISP上机作业_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《AUTOLISP上机作业》由会员分享,可在线阅读,更多相关《AUTOLISP上机作业(11页珍藏版)》请在金锄头文库上搜索。

1、 过程装备与控制工程专业过程装备CAD技术上机作业班级: 姓名: 学号: 年 月第三题(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 圆的个数=)(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)驱动程序:(defun mainprogram();主程序 (setq plist_1 (list 200 30

9、0 400);弹出式列边框中的内容 (setq plist_2 (list 200 300 400);编辑框中的内容 (setq shuzhi 200) (liebiao);调用列表函数 );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);列表框有动作时调用函数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);将相应的数值转换成字符串 (set_tile edbox shuzhi);在编辑框中显示数值);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) 驱动程序:(defun id0() (if ( (setq dlg_id(load_dialogC:UsersAdministratorDesktopdialog_id0.dcl) 0);加载对话框文件 (progn;progn1 (if (new_dialog id0 dlg_id) (progn ;progn2 ;以下初始化对话框和描述控件活动 (action_tile edbox1 (edbox1action)

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 医学/心理学 > 基础医学

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号