前阵子看到坛子上一高手写的用VBA提取测量结果到excel的函数,请教如果我只想要特定的一点,如点38的X值,该如何操作
Private Sub CommandButton1_Click()
On Error GoTo abc:
Dim app As Object
Set app = CreateObject("pcdlrn.application")
Dim part As Object
Set part = app.ActivePartProgram
Dim cmds As Object
Set cmds = part.Commands
Dim cmd As PCDLRN.Command
Dim featName As String
Dim measX, measY, measZ, measT As String
Dim theoX, theoY, theoZ As String
Dim ii As Integer
ii = 2
For Each cmd In cmds
If cmd.IsMeasuredFeature Or cmd.IsDCCFeature Then
featName = cmd.ID
measX = cmd.GetText(MEAS_X, 0)
measY = cmd.GetText(MEAS_Y, 0)
measZ = cmd.GetText(MEAS_Z, 0)
theoX = cmd.GetText(THEO_X, 0)
theoY = cmd.GetText(THEO_Y, 0)
theoZ = cmd.GetText(THEO_Z, 0)
Cells(ii, 1) = featName
Cells(ii, 2) = theoX
Cells(ii, 3) = theoY
Cells(ii, 4) = theoZ
Cells(ii, 5) = measX
Cells(ii, 6) = measY
Cells(ii, 7) = measZ
ii = ii + 1
End If
Next
Exit Sub
abc:
MsgBox "pcdmis没有打开"
End Sub