首次提交: OnebotCatalog 项目代码与文档(含 NX 按需生成服务二期、后台、一键启动)

This commit is contained in:
wangruiguo
2026-09-03 17:55:45 +08:00
commit fafa86d3a6
241 changed files with 78656 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
' 检查母模: 特征数 / 实体数 / 表达式值
Option Strict Off
Imports System
Imports System.IO
Imports System.Text
Imports NXOpen
Imports NXOpen.UF
Module CheckMaster
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
If w Is Nothing Then
sb.AppendLine("Work=NULL")
Else
Dim featCount As Integer = 0
Try
For Each f As NXOpen.Features.Feature In w.Features.GetFeatures()
featCount += 1
Next
Catch
End Try
sb.AppendLine("特征数=" & featCount)
Dim bodyCount As Integer = 0
Try
For Each b As NXOpen.Body In w.Bodies
bodyCount += 1
Next
Catch
End Try
sb.AppendLine("实体数=" & bodyCount)
Dim bi As Integer = 0
Try
For Each b As NXOpen.Body In w.Bodies
Dim fc As Integer = 0
Try
For Each f As NXOpen.Face In b.GetFaces()
fc += 1
Next
Catch
End Try
bi += 1
Try
For Each f As NXOpen.Face In b.GetFaces()
fc += 1
Next
Catch
End Try
sb.AppendLine("实体" & bi & " 面数=" & fc)
Next
Catch ex As Exception
sb.AppendLine("实体检查异常: " & ex.Message)
End Try
For Each nm As String In New String() {"bore", "stroke", "magOn", "mountIdx"}
Try
Dim e As NXOpen.Expression = w.Expressions.FindObject(nm)
sb.AppendLine("表达式 " & nm & "=" & (If(e Is Nothing, "(未找到)", e.Value)))
Catch ex As Exception
sb.AppendLine("表达式 " & nm & " 异常: " & ex.Message)
End Try
Next
sb.AppendLine("IsModified=" & w.IsModified)
End If
File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), "check-master.txt"), sb.ToString(), Encoding.UTF8)
End Sub
End Module