Files
OnebotCatalog/sample-data/tools/probe-api5.vb

52 lines
2.4 KiB
VB.net

' 探针 5: ReferenceSet 相关类型/成员
Option Strict Off
Imports System
Imports System.IO
Imports System.Text
Imports NXOpen
Imports NXOpen.UF
Module ProbeApi5
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 Main()
Dim sb As New StringBuilder()
Dim asm As System.Reflection.Assembly = GetType(Session).Assembly
sb.AppendLine("=== 含 ReferenceSet 的类型 ===")
For Each t As System.Type In asm.GetTypes()
If t.FullName.IndexOf("ReferenceSet", StringComparison.OrdinalIgnoreCase) >= 0 Then sb.AppendLine("T: " & t.FullName)
Next
sb.AppendLine("=== Part 成员 (Reference) ===")
For Each mi As System.Reflection.MemberInfo In GetType(Part).GetMembers()
If mi.Name.IndexOf("Reference", StringComparison.OrdinalIgnoreCase) >= 0 Then sb.AppendLine("P: " & mi.MemberType & " " & mi.Name)
Next
sb.AppendLine("=== BasePart 成员 (Reference) ===")
For Each mi As System.Reflection.MemberInfo In GetType(BasePart).GetMembers()
If mi.Name.IndexOf("Reference", StringComparison.OrdinalIgnoreCase) >= 0 Then sb.AppendLine("B: " & mi.MemberType & " " & mi.Name)
Next
Dim rsT As System.Type = FindType("NXOpen.ReferenceSet")
If rsT IsNot Nothing Then
sb.AppendLine("=== NXOpen.ReferenceSet 方法 ===")
For Each mi As System.Reflection.MethodInfo In rsT.GetMethods()
If mi.DeclaringType Is rsT Then sb.AppendLine("RS: " & mi.Name)
Next
End If
Dim rscT As System.Type = FindType("NXOpen.Assemblies.ReferenceSetCollection")
If rscT IsNot Nothing Then
sb.AppendLine("=== Assemblies.ReferenceSetCollection 方法 ===")
For Each mi As System.Reflection.MethodInfo In rscT.GetMethods()
If mi.DeclaringType Is rscT Then sb.AppendLine("RSC: " & mi.Name)
Next
End If
File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), "probe5.txt"), sb.ToString(), Encoding.UTF8)
End Sub
End Module