几何尺寸与公差论坛

 找回密码
 注册
查看: 620|回复: 0

【转帖】api .name2 just changes in feature tree

[复制链接]
发表于 2009-4-13 08:55:31 | 显示全部楼层 |阅读模式
api: .name2 just changes in feature tree
i have the following code that i wrote to rename the components in an assembly.  when run the code the names change on the feature tree. it appears that the names are not really changing because you can rebuild and they revert back to old names. any ideas what i am doing wrong?
set swapp = createobject("sldworks.application")
swmodel.custominfo2("", "panelnumber") = panelid
boldsetting = swapp.getuserpreferencetoggle_(swextrefupdatecompnames)
'debug.print boldsetting
swapp.setuserpreferencetoggle swextrefupdatecompnames, false
vchildcomparr = swcomp.getchildren
for i = 0 to ubound(vchildcomparr)
    set swchildcomp = vchildcomparr(i)
    curname = swchildcomp.name2
    newname = buildnewname(curname, panelid)
    'debug.print newname
    bret = swchildcomp.select(false)
    'debug.print bret
    swchildcomp.name2 = newname
    'debug.print swchildcomp.name2
    swmodel.custominfo2("", "panelnumber") = panelid
next i
swapp.setuserpreferencetoggle swextrefupdatecompnames,_ boldsetting
     
posting in the eng-tips forums is a member-only feature.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 23:11 , Processed in 0.034946 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表