Inventor iLogic 代码报错 '未声明 'Parameters'': 解决方案
以下代码存储在 'c:\代码.txt' 文件中,并被添加到 Inventor iLogic 的 '外部规则' 列表中,设置为保存前触发。该代码旨在弹出一个输入框,并显示当前文档中参数 'd4' 的数值。然而,运行时出现错误:'代码中存在规则编译错误,行 2 上存在错误: 未声明 'Parameters'。它可能因其保护级别而不可访问'。
在 iLogic 中,要访问文档中的参数,需要使用 ThisDoc.Document.Parameters 而不是 Parameters。所以,要修改代码如下:
Dim fileName As String
fileName = ThisDoc.Document.Parameters.Item("d4").Expression
Dim inputResult As String
inputResult = InputBox("无需操作,直接确定即可", "iproperty填写用文件名", fileName)
将以上修改后的代码存储在 'c:\代码.txt' 文件中,然后将该文件添加到 Inventor iLogic 的 '外部规则' 列表中,并将其设置为保存前触发该代码即可。
原文地址: https://www.cveoy.top/t/topic/qhRT 著作权归作者所有。请勿转载和采集!