资源描述:
《UG_OPEN_GRIP编程练习题》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、UGOPENGRIP编程练习题1、阅读并分析以下GRIP源程序,若点构造器确定点为(2,4,0),参数输入时依次输入10,8,2,1,请画出本程序的运行结果。ENTITY/pt(6),ln(6),fltl10:GPOS/'Defineapoint:',x,y,z,respjump/l10:,hal:,,,,respl20:PARAM/'Enterparameters','ylength',Ly,$'xlength',Lx,'width',W,'filletradius',R,respjump/l20:,h
2、al:,,resppt(2)=POINT/x,(y+Ly)pt(3)=POINT/(x+Lx),ypt(4)=POINT/(x+W),(y+Ly)pt(5)=POINT/(x+Lx),(y+W)pt(6)=POINT/(x+W),(y+W)ln(1)=LINE/(pt(1)=POINT/x,y),pt(2)ln(2)=LINE/pt(2),pt(4)ln(3)=LINE/pt(4),pt(6)ln(4)=LINE/pt(6),pt(5)ln(5)=LINE/pt(5),pt(3)ln(6)=LINE/pt
3、(3),pt(1)l30:flt=FILLET/XLARGE,ln(3),YLARGE,ln(4),radius,Rflt=FILLET/XLARGE,ln(1),YLARGE,ln(6),radius,RDELETE/pt(1..6)hal:HALT2、仔细阅读下面的GRIP源程序,指出并更正错误。要求:不得删行!ENTITY/ln(4),pt(4),txt1,suf1NUMBER/x,y,zpt(1)=POINT/0,0pt(2)=POINT/3,0pt(3)=POINT/3,2pt(4)=POINT
4、/0,2ln(1)=LINE/pt(1),pt(2)ln(2)=LINE/pt(2),pt(3)ln(3)=LINE/pt(3),pt(4)ln(4)=LINE/pt(4),pt(1)suf1=RLDSRF/ln(2),pt(2),ln(4),pt(1)l10PARAM/'X',x,'Y',y,'Z',z,rsp$$在屏幕上指定一点JUMP/l10,hal:,,,,rsppt1=POINT/x,y,zCRTWRT/'Congratulations!',x,y,z,TXT1=NOTE/2,-2,'VIEWA
5、'MASK/26$$只有尺寸实体可选DELETE/pt1,pt(1..4)HALT3、仔细阅读下面的GRIP源程序,改正程序中的错误。要求:在题中程序中直接改正,不得删除任何一行程序。(10分)1ENTITY/cr(8),pt(2),pt12NUMBER/ptv(3),mat(5,12)3DATA/d,84l10*Errorno.1inlineno.4:Syntaxerror.5POS/'Defineapoint',ptv(1),ptv(2),ptv(3),resp6JUMP/l10:,hal:,,,,r
6、esp7pt1=POINT/ptv(1),ptv(2),ptv(3)8l20:9PARAM/'请输入参数','外圆直径',d10JUMP/l20:,hal:,,rsp11IFTHEN/d<812MESSG/'直径不能太小'13JUMP/l20:14cr(1)=CIRCLE/CENTER,pt1,RADIUS,d/215cr(2)=CIRCLE/CENTER,(pt(1)=POINT/2,0),RADIUS,0.2516mat(1,1..12)=MATRIX/TRANSL,-1,0,017mat(2,1..
7、12)=MATRIX/XYROT,4518mat(3,1..12)=MATRIX/mat(1,1..12),mat(2,1..12)19cr(3)=TRANSF/mat(3,1..12),cr(2)20cr(4)=GROUP/cr(2..3)21mat(4,1..12)=MATRIX/XYROT,9022cr(5)=TRANSF/mat(4,1..12),cr(4)23cr(6)=TRANSF/mat(4,1..12),cr(5)24cr(7)=TRANSF/mat(4,1..12),cr(6)25mat
8、(5)=MATRIX/TRANSL,ptv(1),ptv(2),ptv(3)26cr(8)=TRANSF/mat(5),cr(4..7)27delete/cr(2..7)28hal:29HALTErrorno.70PARAMinlineno.9:Invalidfield.Errorno.82inlineno.25:Toofewsubscriptsinarrayreference.Errorno.82inlineno.26:To