36 lines
1.6 KiB
VB.net
36 lines
1.6 KiB
VB.net
' 探针 4: ExpressionCollection 创建/编辑方法签名
|
|
Option Strict Off
|
|
Imports System
|
|
Imports System.IO
|
|
Imports System.Text
|
|
Imports NXOpen
|
|
Imports NXOpen.UF
|
|
|
|
Module ProbeApi4
|
|
Sub Main()
|
|
Dim sb As New StringBuilder()
|
|
Dim outPath As String = Path.Combine(Directory.GetCurrentDirectory(), "KC_master.prt")
|
|
Dim partLoadStatus1 As NXOpen.PartLoadStatus = Nothing
|
|
Session.GetSession().Parts.OpenBaseDisplay(outPath, partLoadStatus1)
|
|
Dim w As Part = Session.GetSession().Parts.Work
|
|
sb.AppendLine("Work=" & (If(w Is Nothing, "NULL", w.FullPath)))
|
|
If w IsNot Nothing Then
|
|
Dim ec As System.Type = w.Expressions.GetType()
|
|
sb.AppendLine("ExpressionCollection type: " & ec.FullName)
|
|
For Each mi As System.Reflection.MethodInfo In ec.GetMethods()
|
|
If mi.Name.IndexOf("Create", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
|
|
mi.Name.IndexOf("Edit", StringComparison.OrdinalIgnoreCase) >= 0 Then
|
|
sb.AppendLine("EC: " & mi.ToString())
|
|
End If
|
|
Next
|
|
Dim uc As System.Type = w.UnitCollection.GetType()
|
|
For Each mi As System.Reflection.MethodInfo In uc.GetMethods()
|
|
If mi.Name.IndexOf("Find", StringComparison.OrdinalIgnoreCase) >= 0 Then
|
|
sb.AppendLine("UC: " & mi.ToString())
|
|
End If
|
|
Next
|
|
End If
|
|
File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), "probe4.txt"), sb.ToString(), Encoding.UTF8)
|
|
End Sub
|
|
End Module
|