社区活动 技术论坛 二次开发,有看得懂的帮我优化一下
二次开发,有看得懂的帮我优化一下
2011-05-30 17:04 60 0 11
Sub main() 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 Object Dim theoTZ As Double Dim arr(10000) As Single Dim i As Integer i = 1 For Each cmd In cmds If cmd.IsMeasuredFeature Or cmd.IsDCCFeature Then theoTZ = cmd.GetText(THEO_Z, 0) arr(i) = theoTZ End If i = i + 1 Next cmd Set cmd = cmds.Add(ASSIGNMENT, True) abc = cmd.PutText("MAXTZ1", DEST_EXPR, 0) abc = cmd.PutText(max(arr), SRC_EXPR, 0) End Sub Function max(a() As Single) As Single Dim bb As Integer, pp As Single pp = a(1) For bb = 2 To UBound(a) If pp < a(bb) Then pp = a(bb) Next bb max = pp End Function -------------------------------------------------------------- 以上代码中,有谁能帮我把数组长度改为变量,也就是说改为当前程序下手动和自动特征个数的总和,谢谢!
我要回复

登陆后才能评论

登录
所有回贴(0)
在线咨询
关注我们

海克斯康制造智能

电话咨询
400-6580-400

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

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

海克斯康制造智能