Dim ss As String
Dim boolstatus As Boolean
ss=App.Path &“\图形库\三维\”
Set swApp=CreateObject("SldWorks.Application")
swApp.Visible = True
'调用SolidWorks程序
Set Part = swApp.OpenDoc6(ss & “\反挤压\6\凸模.SLDPRT”, 1, 0,“”, longstatus, longwarnings)
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID(“注解”, “DCABINET”, 0,0, 0, False, 0, Nothing)
'打开对应的模型文件
Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection
'定义ADO对象变量
ss = App.Path & "\database\"
Set conn = New ADODB.Connection conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & “Persist Security Info=False;” & “Mode=read;”& “Data Source=” & ss & “模具零件库.mdb;”
conn.Open
‘建立ADO连接,打开数据库
newTableName = Str(2011)
Adodc1.RecordSource =newTableName
Adodc1.Refresh
SetDataGrid1.DataSource=Adodc1
‘打开记录集,读取模具零件型号
DataGrid1.Row = 0
For i = 1 To DataGrid1.Columns.Count 1
D(i) = DataGrid1.Columns(i).Value
Next
DataGrid1.Row = 1
For i = 1 To DataGrid1.Columns.Count 1
tolMax(i) = DataGrid1.Columns(i).Value
Next
DataGrid1.Row = 2
For i = 1 To DataGrid1.Columns.Count 1
tolMin(i) = DataGrid1.Columns(i).Value
Next