|
為了給公司CMM兄弟們計(jì)算方便,想下載個(gè)塞規(guī)計(jì)算表格,到處下載資料也沒有發(fā)現(xiàn)共享代碼的。都是加密的。
于是下載個(gè)類似的又做了下,很多不完善的地方。
此算法計(jì)算T,Z值時(shí)候沒有用到差值,利用了靠近近似。
希望有做過類似的大俠們給點(diǎn)意見。
下一步想做個(gè)mathcad 驅(qū)動(dòng)proe生成模型的,希望做過類似的大俠給點(diǎn)資料啥的供參考,謝謝!
塞規(guī)計(jì)算VBA.rar
(15.2 KB, 下載次數(shù): 0)
2014-10-3 21:38 上傳
點(diǎn)擊文件名下載附件
下載積分: 威望 -10 點(diǎn)
Sub p()
Dim j As Integer
j = 0
End Sub
Function dia2()
Dim d As Single
Dim i As Single
d = Sheet2.[c2].Value
Select Case True
Case d >= 0 And d < 3
i = 6
Case d >= 3 And d < 6
i = 7
Case d >= 6 And d < 10
i = 8
Case d >= 10 And d < 18
i = 9
Case d >= 18 And d < 30
i = 10
Case d >= 30 And d < 50
i = 11
Case d >= 50 And d < 80
i = 12
Case Else
MsgBox "直徑超80,不計(jì)算"
End Select
j = i
''''''''''''''''''''''''''''''''''''''''''
Dim it(1 To 7)
Dim itt(1 To 7) '減去公差值的數(shù)組
Dim k As Integer
Dim kk As Integer '下標(biāo)
Dim m As Integer
Dim c As Single
Dim t As Single
Dim z As Single
m = 2
For k = 1 To 7
it(k) = Sheet1.Cells(j, k + m).Value
itt(k) = Abs(it(k) - 1000 * Sheet2.[g2].Value)
m = m + 2
Next k
c = Application.Min(itt)
kk = Application.Match(c, itt, 0)
t = Sheet1.Cells(i, 3 * kk + 1)
z = Sheet1.Cells(i, 3 * kk + 2)
''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sheet2.Cells(4, 3) = Round(t, 3)
Sheet2.Cells(5, 3) = Round(z, 3)
End Function
Private Sub CommandButton1_Click()
dia2
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Private Sub UserForm_Click()
End Sub
|
|