71 lines
3.1 KiB
VB.net
71 lines
3.1 KiB
VB.net
' NX 2506 API 反射探针 3: StepCreator / IgesCreator / Part.CreateUpdate 成员
|
|
Option Strict Off
|
|
Imports System
|
|
Imports System.IO
|
|
Imports System.Text
|
|
Imports NXOpen
|
|
Imports NXOpen.UF
|
|
|
|
Module ProbeApi3
|
|
|
|
Function FindType(n As String) As System.Type
|
|
Dim t As System.Type = GetType(Session).Assembly.GetType(n, False)
|
|
If t IsNot Nothing Then Return t
|
|
For Each a As System.Reflection.Assembly In AppDomain.CurrentDomain.GetAssemblies()
|
|
t = a.GetType(n, False)
|
|
If t IsNot Nothing Then Return t
|
|
Next
|
|
Return Nothing
|
|
End Function
|
|
|
|
Sub Dump(out As StringBuilder, prefix As String, typeName As String)
|
|
Dim t As System.Type = FindType(typeName)
|
|
If t Is Nothing Then
|
|
out.AppendLine(prefix & " [类型未找到: " & typeName & "]")
|
|
Return
|
|
End If
|
|
out.AppendLine("=== " & typeName & " ===")
|
|
For Each mi As System.Reflection.MemberInfo In t.GetMembers()
|
|
If mi.MemberType = System.Reflection.MemberTypes.Method OrElse
|
|
mi.MemberType = System.Reflection.MemberTypes.Property Then
|
|
out.AppendLine(prefix & ": " & mi.Name)
|
|
End If
|
|
Next
|
|
For Each nt As System.Type In t.GetNestedTypes()
|
|
out.AppendLine(prefix & " NESTED: " & nt.Name)
|
|
For Each f As System.Reflection.FieldInfo In nt.GetFields()
|
|
If f.IsStatic Then out.AppendLine(prefix & " = " & f.Name)
|
|
Next
|
|
Next
|
|
End Sub
|
|
|
|
Sub Main()
|
|
Dim out As New StringBuilder()
|
|
Dump(out, "SC", "NXOpen.StepCreator")
|
|
Dump(out, "IC", "NXOpen.IgesCreator")
|
|
Dump(out, "EX", "NXOpen.UpdateSession")
|
|
out.AppendLine("=== Part 成员 (Update/Create) ===")
|
|
For Each mi As System.Reflection.MemberInfo In GetType(Part).GetMembers()
|
|
If mi.Name.IndexOf("Update", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
|
|
mi.Name.IndexOf("Create", StringComparison.OrdinalIgnoreCase) >= 0 Then
|
|
out.AppendLine("PT: " & mi.MemberType & " " & mi.Name)
|
|
End If
|
|
Next
|
|
out.AppendLine("=== PartCollection 成员 (Update/Create/New) ===")
|
|
For Each mi As System.Reflection.MemberInfo In GetType(PartCollection).GetMembers()
|
|
If mi.Name.IndexOf("Update", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
|
|
mi.Name.IndexOf("New", StringComparison.OrdinalIgnoreCase) >= 0 Then
|
|
out.AppendLine("PC: " & mi.MemberType & " " & mi.Name)
|
|
End If
|
|
Next
|
|
out.AppendLine("=== UFModl 成员 (Update/Cyl) ===")
|
|
For Each mi As System.Reflection.MemberInfo In GetType(UFModl).GetMembers()
|
|
If mi.Name.IndexOf("Update", StringComparison.OrdinalIgnoreCase) >= 0 OrElse
|
|
mi.Name.IndexOf("Cyl", StringComparison.OrdinalIgnoreCase) >= 0 Then
|
|
out.AppendLine("UF: " & mi.MemberType & " " & mi.Name)
|
|
End If
|
|
Next
|
|
File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), "probe3.txt"), out.ToString(), Encoding.UTF8)
|
|
End Sub
|
|
End Module
|