Dim d1 As Integer
Dim d2 As Integer
Dim h As Integer
Dim c As Single
Dim c1 As Single
Dim c2 As Single
Form1.Hide '隐藏界面
d1 = Text1.Text '对参数赋值
d2 = Text2.Text
h = Text3.Text
c = Text4.Text
c1 = Text5.Text
c2 = Text6.Text
strfilename = CurrentDir + "\" + "衬套.SLDPRT"
Set swApp = CreateObject("SldWorks.Application") '创建SldWorks对象
swApp.Visible = True '设置显示SolidWorks程序界面
Set 
art = swApp.opendoc6(strfilename, 1, 0, "", longstatus, longstatus) '打开作为模板的零件
Set 
art = swApp.ActiveDoc '激活文件
strfilename = "衬套.SLDPRT"
longstatus = 
art.Parameter("d1@草图1@strfilename").SetSystemValue3(d1 / 1000, 1, "默认")
longstatus = 
art.Parameter("d2@草图1@strfilename").SetSystemValue3(d2 / 1000, 1, "默认")
longstatus = 
art.Parameter("d1@拉伸1@strfilename").SetSystemValue3(h / 1000, 1, "默认")
longstatus = 
art.Parameter("d1@倒角1@strfilename").SetSystemValue3(c / 1000, 1, "默认")
longstatus = 
art.Parameter("d1@倒角2@strfilename").SetSystemValue3(c1 / 1000, 1, "默认")
longstatus = 
art.Parameter("d1@倒角3@strfilename").SetSystemValue3(c2 / 1000, 1, "默认") '将参数值赋予零件,生成所需模型
Select Case d2
Case 11 To 18
longstatus = 
art.Parameter("d1@倒角4@strfilename").SetSystemValue3(0.8 / 1000, 1, "默认")
Case 19 To 30
longstatus = 
art.Parameter("d1@倒角4@strfilename").SetSystemValue3(1 / 1000, 1, "默认")
Case 31 To 50
longstatus = 
art.Parameter("d1@倒角4@strfilename").SetSystemValue3(1.6 / 1000, 1, "默认")
Case 51 To 80
longstatus = 
art.Parameter("d1@倒角4@strfilename").SetSystemValue3(2 / 1000, 1, "默认")
Case 81 To 120
longstatus = 
art.Parameter("d1@倒角4@strfilename").SetSystemValue3(2.5 / 1000, 1, "默认")
Case 121 To 180
longstatus = 
art.Parameter("d1@倒角4@strfilename").SetSystemValue3(3 / 1000, 1, "默认")
End Select '根据未注倒角规定确定倒角值
boolstatus = 
art.EditRebuild3() '重建模型
Part.ShowNamedView2 "*等轴测", 7 '等轴测显示模型
Part.ViewZoomtofit2 '自动缩放整屏显示全图
Form1.Show '显示界面
End Sub