UG NX 10.0 GRIP 二次开发

给大家分享一段2020铝型材的截面编写代码,希望对大家有帮助
entity/cr(10),ln(100),pt(100)
entity/grp1,grp2,grp3,grp4,grp5,grp6,grp7,grp8,grp9
number/x(3),y(3),z(3)
number/mat(12)

x(1)=0
y(1)=0
	
pt(1)=POINT/x(1),y(1)
pt(2)=POINT/x(1)+10,y(1)+10					$$画点坐标{10,10,0}
pt(3)=POINT/x(1)+10,y(1)-10
pt(4)=POINT/x(1)-10,y(1)+10
pt(5)=POINT/x(1)+3.9,y(1)+3.9					
pt(6)=POINT/x(1)+3.9,y(1)-3.9
pt(7)=POINT/x(1)+8.2,y(1)+4.5
pt(8)=POINT/x(1)+5.2,y(1)+4.5
pt(9)=POINT/x(1)+8.2,y(1)+2.1
pt(10)=POINT/x(1)+9.5,y(1)+2.1
pt(11)=POINT/x(1)+9.5,y(1)+2.6
pt(12)=POINT/x(1)+10,y(1)+2.6

cr(1)=CIRCLE/CENTER,pt(1),RADIUS,2.5		$$画圆{0,0,0}半径2.5mm

ln(1)=LINE/pt(1),pt(2)						$$过{0,0,0}和{10,10,0}画线
ln(2)=OFFCRV/ln(1),0.75,pt(3)				$$偏置曲线ln(1)
ln(3)=OFFCRV/ln(1),0.75,pt(4)

ln(4)=LINE/pt(5),pt(6)
mat=MATRIX/XYROT,90							$$以z轴正方向建立90度旋转变量
ln(5)=TRANSF/mat,ln(4)
ln(6)=TRANSF/mat,ln(5)
ln(7)=TRANSF/mat,ln(6)	
grp1=GROUP/ln(4),ln(5),ln(6),ln(7)			$$对象成组

ln(8)=LINE/pt(7),pt(8)
ln(9)=LINE/pt(7),pt(9)
ln(10)=LINE/pt(9),pt(10)
ln(11)=LINE/pt(10),pt(11)
ln(12)=LINE/pt(11),pt(12)
ln(13)=LINE/pt(12),pt(2)
pt(13)=POINT/pt(5),INTOF,ln(2),ln(4)
pt(14)=POINT/pt(7),INTOF,ln(2),ln(8)
ln(14)=LINE/pt(13),pt(14)
ln(15)=LINE/pt(7),pt(14)
grp2=GROUP/ln(9),ln(10),ln(11),ln(12),ln(14),ln(15)
mat = MATRIX/MIRROR,ln(1)					$$对GROUP2所含内容设置镜像方式
grp3=TRANSF/mat,grp2
pt(16)=POINT/pt(7),INTOF,ln(5),ln(3)
mat=MATRIX/XYROT,270
pt(17)=TRANSF/mat,pt(16)
ln(16)=LINE/pt(17),pt(13)
pt(18)=POINT/x(1)+2.6,y(1)+10
ln(17)=LINE/pt(2),pt(18)
pt(19)=POINT/x(1)+9.5,y(1)+9.5
cr(2)=FILLET/ln(13),ln(17),CENTER,pt(19),RADIUS,1.5
grp4=GROUP/ln(16),grp2,grp3,cr(2),ln(13),ln(17)

grp5=GROUP/pt,ln(1),ln(2),ln(3),ln(8)
BLANK/grp1,grp5								$$隐藏所选对象
$$UNBLNK/pt(17)此为隐藏显示

mat=MATRIX/XYROT,90
grp6=TRANSF/mat,grp4
grp7=TRANSF/mat,grp6
grp8=TRANSF/mat,grp7
grp9=GROUP/grp4,grp6,grp7,grp8,cr(1)

HALT

你可能感兴趣的:(UG NX 10.0 GRIP 二次开发)