Private Sub Command1_Click()
'生成铣削凹圆台程序
Dim G_program As String
粗加工软件编程代码:
D_program = G_program & "变量说明:" & vbCrLf
D_program = G_program & "#1=A//圆台深度" & vbCrLf
D_program = G_program & "#2=B//大端半径" & vbCrLf
D_program = G_program & "#3=C//小端半径" & vbCrLf
D_program = G_program & "#4=D//总铣削层数" & vbCrLf
D_program = G_program & "#5=E//Z层步距" & vbCrLf
D_program = G_program & "#6=F//相邻半径增量" & vbCrLf
D_program = G_program & "#7=G/Z轴深度" & vbCrLf
D_program = G_program & "#8=H/刀具半径" & vbCrLf
D_program = G_program & vbCrLf
D_program = G_program & "粗加工程序:" & vbCrLf
D_program = G_program & "O0001" & vbCrLf
D_program = G_program & " G15 G17 G21 G40 G49 G54 G80 G90 M03 S" & Text5.Text & vbCrLf
D_program = G_program & " G90 G54 G00 X0 Y0 Z0" & vbCrLf
D_program = G_program & " A" & Text1.Text & vbCrLf
D_program = G_program & " B" & Text2.Text & vbCrLf
D_program = G_program & " C" & Text3.Text & vbCrLf
D_program = G_program & " D" & Text6.Text & vbCrLf
D_program = G_program & " E" & Text7.Text
& vbCrLf
D_program = G_program & " F" & Text8.Text & vbCrLf
D_program = G_program & " G" & Text9.Text & vbCrLf
D_program = G_program & " H" & Text4.Text & vbCrLf
D_program = G_program & " N10 G01 Z[#9]F1000 " & vbCrLf
D_program = G_program & "#110=FIX[[#100-10]/1]" & vbCrLf
D_program = G_program & "G00 X[#100-#110*1-#8] Y0" & vbCrLf
D_program = G_program & "WHILE[#110GE0] DO 1" & vbCrLf
D_program = G_program & "G01 X[#2-#110*1]-#8 Y0 F800" & vbCrLf
D_program = G_program & "G02 I-[#2-#110*1-#8] F1200" & vbCrLf
D_program = G_program & "#110=#110-2" & vbCrLf
D_program = G_program & "END 1" & vbCrLf
D_program = G_program & "#2=#2-#7" & vbCrLf
D_program = G_program & "M05" & vbCrLf
D_program = G_program & "M09" & vbCrLf
D_program = G_program & "M30" & vbCrLf
Text16.Text = G_program
End Sub
生成.exe文件的效果图就是下面这样子