首次提交: OnebotCatalog 项目代码与文档(含 NX 按需生成服务二期、后台、一键启动)
This commit is contained in:
35
sample-data/tools/probe-api4.vb
Normal file
35
sample-data/tools/probe-api4.vb
Normal file
@@ -0,0 +1,35 @@
|
||||
' 探针 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
|
||||
Reference in New Issue
Block a user