iLogic 代码错误:未定义类型“Inventor.Project”解决方案
iLogic 代码错误:未定义类型“Inventor.Project”解决方案
在 Autodesk Inventor 的 iLogic 代码中,如果遇到“未定义类型‘Inventor.Project’”,可能是因为没有正确引用 Inventor 的命名空间。
错误信息:
零件1 中的 项目名称 中存在规则编译错误
行 2 上存在错误: 未定义类型“Inventor.Project”。
解决方案:
在 iLogic 代码的开头添加以下代码,引用 Inventor 命名空间:
Imports Inventor
修改后的代码示例:
Imports Inventor
Sub GetProjectName()
Dim doc As Document = ThisApplication.ActiveDocument
Dim proj As Inventor.Project = doc.ReferenceProject
Dim projFileName As String = proj.FullFileName
MessageBox.Show('当前激活的项目文件所属项目的名称是:' & projFileName, '项目文件所属项目名称')
End Sub
注意:
在使用 iLogic 时,请确保已经正确引用 Inventor 的命名空间。
原文地址: https://www.cveoy.top/t/topic/qo4j 著作权归作者所有。请勿转载和采集!