设计加速器的部件无法更名

来源:互联网 发布:dnf强制交易软件2016 编辑:程序博客网 时间:2024/04/30 21:38

原文链接:

http://adndevblog.typepad.com/manufacturing/2015/01/component-occurrence-cannot-be-renamed.html


通常,我们可以对装配部件进行更名,甚至替换。但如果是设计加速器的部件环境,当你尝试更名,会得到如下的错误:

“Request Rename Component cannot be run on document Synchronous Belts”

中文意思就是无法在此环境进行更名。

Changename


从API的角度,调试看,设计加速器将Document.DisabledCommandTypes设置为33,即kNonShapeEditCmdType + kShapeEditCmdType 两个值的组合。也就是它阻止了更名的操作。

以下是一个列表,显示哪些枚举值是允许部件或文档的更名。

Public Sub SetDisabledCommandTypes()' Type / Can you rename occurrences? / Can you rename document?' kEditMaskCmdType = 57 (&H39) / No / No' - kNonShapeEditCmdType (32)' - kUpdateWithReferencesCmdType (16)' - kFilePropertyEditCmdType (8)' - kShapeEditCmdType (1)' kFileOperationsCmdType = 4 / Yes / Yes' kFilePropertyEditCmdType = 8 / Yes / Yes' kNonShapeEditCmdType = 32 (&H20) / No / No' kQueryOnlyCmdType = 2 / Yes / Yes' kReferencesChangeCmdType = 64 (&H40) / Yes / Yes' kSchemaChangeCmdType = 128 (&H80) / Yes / Yes' kShapeEditCmdType = 1 / Yes / Yes' kUpdateWithReferencesCmdType = 16 (&H10) / Yes / Yes  ' You can test the effect of the various enum values here  ThisApplication.ActiveDocument.DisabledCommandTypes = _    kNonShapeEditCmdTypeEnd Sub

所以,理论上,你可以设置Document.DisabledCommandTypes=0, 这样就能修改部件名了。最后再还原回其原值。但我们并不建议这样做,这是干扰了设计加速器本身的流程。除非以后提供了特别的API,或者设计加速器考虑到这一问题,主动允许修改。所以在目前的设计状态下,你得自己评估修改后的风险。本文只是让你了解当遇到文章开头的那种错误,背后的原因。


论坛推荐阅读:

如何修改iFeature的输入参数?

http://forums.autodesk.com/t5/inventor-customization/how-to-edit-ifeature-parameters-via-vba/m-p/4817511/highlight/true#M48522

0 0
原创粉丝点击