社区活动 技术论坛 excel 宏程序转尺寸
excel 宏程序转尺寸
2017-10-28 15:25 152 0 9
我有在网上找到汇出excel 可转出来都是 特征的 请问如何变成是尺寸@@ 一直搞不懂0..0 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
我要回复

登陆后才能评论

登录
所有回贴(9)
我有在网上找到汇出excel 可转出来都是 特征的 请问如何变成是尺寸@@ 一直搞不懂0..0 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
2017-10-28 15:25
回复
取消
提交
是这样 cmd.IsMeasuredFeature Or cmd.IsDCCFeature这两个都表达的特征类型,你要尺寸就要找到对应的尺寸类型,编一个完整的程,导出BASIC格式慢慢研究吧!!
2017-10-29 00:46
回复
取消
提交
我刚接触VB 是否可以示范一下@@ 拜托...
2017-10-29 13:27
回复
取消
提交
我有改了一下 但是怎么 如果是几何公差的 他就不会显示出来@@ axis 的轴也没有出来 有办法向统计分析出来这样吗@@ 下面是统计分析出来的   A- 基准平面度 M 0.008361 0.000000 0.000000 0.030000 50 -B- 基准圆度(参 M 0.005985 0.000000 0.000000 0.050000 50 MOT 462.0 X 0.000000 0.000000 0.100000 0.100000 50 MOT 462.0 Y 0.000000 0.000004 0.100000 0.100000 50 MOT 462.0 D 462.201900 462.000000 0.100000 0.100000 50 球号5 平行度 M 0.013640 0.000000 0.000000 0.030000 50 球号7 X 0.008246 -0.000000 0.100000 0.100000 50 球号7 Y 0.023567 -0.000000 0.100000 0.100000 50 球号7 D 231.974538 232.000000 0.100000 0.100000 50 球号59 径向偏摆度 M 0.049993 0.000000 0.000000 0.050000 50
2017-10-30 11:52
回复
取消
提交
改過的語法 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 NOName As String Dim Nominal_1, DIM_MEASURED_1, TOL, measT, TOU, D2_1 As String Dim theoX, theoY, theoZ As String Dim ii As Integer ii = 2 For Each cmd In cmds If cmd.IsDimension Or cmd.IsDimension Or cmd.IsDCCFeature Or cmd.IsMeasuredFeature Then NOName = cmd.GetText(DESCRIPTION2, 0) ' featName = cmd.GetText(ID, 0) Nominal_1 = cmd.GetText(Nominal, 0) DIM_MEASURED_1 = cmd.GetText(DIM_MEASURED, 0) TOU = cmd.GetText(F_PLUS_TOL, 0) TOL = cmd.GetText(F_MINUS_TOL, 0) D2_1 = cmd.GetText(LINE1_TBLHDR, 1) ' 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) = Nominal_1 Cells(ii, 3) = DIM_MEASURED_1 Cells(ii, 4) = TOU Cells(ii, 5) = TOL Cells(ii, 6) = NOName ' 'Cells(ii, 5) = theoY ' Cells(ii, 6) = theoZ ' Cells(ii, 7) = measZ ii = ii + 1 End If Next Exit Sub abc: MsgBox "pcdmis" End Sub
2017-10-30 11:53
回复
取消
提交
If cmd.IsDimension Then
2017-11-01 22:35
回复
取消
提交
问题在这里 If cmd.IsMeasuredFeature Or cmd.IsDCCFeature Then 你在cmd后面,输入.is后会有提示,你看看跟dimension相关的类型有哪些,可以逐步摸索。
2017-11-06 09:41
回复
取消
提交
我有探索过 但是 如果像是 真圆或是平行度那些 几何公差都显示不出来@@ 连GET AXIS 也是 都没有我要的.00
2017-11-10 08:07
回复
取消
提交
请问 那如果像是 导出 一般 汇出TXT档 有办法设定吗 导出的时候 只要显示打名称就好 固定汇出尺寸
2017-11-10 08:09
回复
取消
提交
在线咨询
关注我们

海克斯康制造智能

电话咨询
400-6580-400

热线电话(工作时间8:30-17:30)

关注我们 电话咨询 在线咨询

海克斯康制造智能