电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

试验AutoLISP语言

试验AutoLISP语言_第1页
1/8
试验AutoLISP语言_第2页
2/8
试验AutoLISP语言_第3页
3/8
《材料成型CAD/CAE/CAM》实验报告开课学院及实验室:重庆大学模具实验室年月日学院机械工程年级、专业、班03 级材控3 班姓名徐俊杰学号20031878 课程名称材料成型 CAD/CAE/CAM 实 验 项 目名称AutoLISP语言编程及参数化绘图指导老师何乃军教师评语一、实验目的及要求熟悉 AutoLISP 语言的内容,掌握常用的一些函数的功能和用法,用自定义的函数进行参数化绘图,熟悉 AutoLISP 语言程序的编制和调试方法。二、实验内容及原理编写简单的 AutoLISP 程序,并调试运行。三、实验步骤1、编写一个绘制六角螺母的AutoLISP 程序2、测试程序,如果出现错误进行修改后再上机运行,直至程序正确为止,绘制的六角螺母如图所示四、实验过程原始记录详细程序为:(defun drw() (setq d 10.0)(setq l 50) (cond((= d 3)(setq gs 1)) ((= d 4.0)(setq gs 2)) ((= d 0)(setq gs 3)) ((= d 6)(setq gs 4)) ((= d 8)(setq gs 5)) ((= d 10)(setq gs 6)) ((= d 12)(setq gs 7)) ((= d 14)(setq gs 8)) ((= d 16)(setq gs 9)) ((= d 20)(setq gs 10)) );cond2 (setq f (open"./wb/data/data1.text" "r")) (repeat gs (setq p (read(read-line f))) );repeat (setq s (nth 0 p)) (setq k (nth 1 p)) (setq e (nth 2 p)) (setq p01(getpoint"\n 请输入插入点:") p02(polar p01 0 5)) p03(polar p01 pi(+ k 5)) el(/ e 2)c1 (sin(* 60(/pi 180.0))) c(/(/s 2)c1)c2(/(- e c)4) c3(+(/c 2)c2)c4(* c2(/1.732 3)) k1(/ k 4)l1(/l 3.0)d1(/d 7.0) p1(polar p01 (- (/ pi 2.0))e1) p2(polar p01 (/ pi 2.0)e1) p3(polar p2 (- pi)(- k c4)) p6(polar p01 (- pi)k) p4(polar p6 (/ pi 2.0)c3) p8(polar p6 (- (/ pi 2.0))c3) p5(polar p3 (- (/ pi 2.0))(* c2 2.0)) p20(polar p2 (- (/ pi 2.0))(* c2 2.0)) p9(polar p1 (- pi)(- k c4)) p7(polar p9 (/ pi 2)(* c2 2.0)) p21(polar p1 (/ pi 2)(* c2 2.0)) p18(polar p01 (/ pi 2.0)(-(/ d 2.0)k1)) p19(polar p01 (-(/ pi 2.0))(-(/ d 2.0)k1)) p10(polar p18 0 11) p17(polar p19 0 11) p13(polar p18 0 1) p14(polar p19 0 1) p12(polar p13 (/ pi 2.0)d1) p15(polar p14 (-(/ pi 2.0))d1) p11(list(+ (car p10)k1)(+ (cadr p10)k1)) p16(list(+ (car p17)k1)(- (cadr p17)k1)) );end setq (nlayer) (command "layer" "s" 3 "") (command "line" p03 p02 "") (command "layer" "s" 1"") (command "line" p3 p2 p1 p9 "") (command "line" p4 p8 "") (command "line" p5 p20 "") (command "line" p7 p21 "") (command "arc" p3 p4 p5) (command "arc" p5 p6 p7) (command "arc" p7 p8 p9) (command "rotate" s"" p01 "") );the end (defun nlayer() (command "layer" "n" 1 "c" 1 1 "l" "continuous" 1 "") (command "layer" "n" 2 "c" 2 2 "l" "continuous" 2 "") (command "layer" "n" 3 "c" 3 3 "l" "continuous" 3 "") (command "layer" "n" 4 "c" 4 4 "l" "continuous" 4 "") ) 六、实验结果及分析

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

试验AutoLISP语言

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部