这是我被告知访问Inventor的“替换组件”命令的正确方法:
Component.Replace(OldNamePath, NewNamePath, False)
但是我遇到语法错误。正确的语法是什么?我没有在Inventor VBA库中看到它...
OldNamePath和NewNamePath来自创建完整路径名的不同模块。
我收到的错误是“预期的=“错误...
“我相信这就是iLogic的语法。
每个编程帮助文件都有一个ComponentOccurence.Replace。
它还包含添加新事件并处理现有事件的示例。”
从Autodesk Inventor定制论坛中。
另外...“您是通过iLogic还是VBA宏执行此操作。如果您是从iLogic执行此操作,则命令为Component.Replace,但参数为:
Component.Replace(componentName, newPath, False) with componentName being the name of the component in the assembly.
如果从VBA宏执行此操作,则需要设置要更改的组件的ComponentOccurrance对象。
Dim occ as ComponentOccurrance
Set occ = (the component occurrance object you want to replace)
//To replace
occ.Replace(newPath, False)"
第三个回应:
”
Public Sub CReplace()
Dim oOccurrence As ComponentOccurrence
Set oOccurrence = ThisApplication.ActiveDocument.ComponentDefinition.Occurrences.Item(1)
oOccurrence.Replace "<filename>", True
End Sub
”
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句