You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何判断代码运行于Inventor Desktop还是Inventor Server环境?

在iLogic规则中区分Inventor Desktop与Inventor Server环境的方法

在iLogic规则开发中,我们常需要区分代码运行环境——比如IDA/APS(基于Inventor Server)环境不允许使用消息框,而Inventor Desktop环境则可正常调用。我们希望实现这样的逻辑:

如果是Inventor Desktop环境,显示消息框;如果是Inventor Server环境,则执行替代逻辑,不调用消息框

可行方案:检查活动进程名称

Inventor Desktop对应的进程是Inventor.exe,而Inventor Server对应的进程是InventorCoreConsole.exe,通过判断当前运行的进程名即可区分环境。

代码示例

' 获取当前进程名称
Dim currentProcessName As String = System.Diagnostics.Process.GetCurrentProcess().ProcessName

' 判断环境并执行对应逻辑
If currentProcessName = "Inventor" Then
    MessageBox.Show("This is Inventor Desktop")
Else
    ' Inventor Server环境下的替代逻辑
    ' 例如写入日志、执行后台操作等
End If

内容的提问来源于stack exchange,提问作者Ryan Small

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 04:54:50