使用 iLogic 将文件名赋值给零件代号 iProperty

以下 iLogic 代码示例可以将 Autodesk Inventor 文件名赋值给零件代号 iProperty。

' 获取文件名
Dim fileName As String = ThisDoc.Document.FullFileName

' 提取文件名中的零件代号
Dim partNumber As String = System.IO.Path.GetFileNameWithoutExtension(fileName)

' 更新 iProperty 的'零件代号'
ThisDoc.Document.PropertySets.Item('Inventor Summary Information').Item('Part Number').Value = partNumber

使用步骤:

  1. 将上述代码复制粘贴到 Autodesk Inventor 的 iLogic 窗口中。
  2. 保存 iLogic 代码。

每次打开包含该代码的文件时,iLogic 将自动更新'零件代号'属性为当前文件名。


原文地址: http://www.cveoy.top/t/topic/phcV 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录