几何尺寸与公差论坛

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

【转帖】cant get macro to replace componen

[复制链接]
发表于 2009-4-12 17:44:05 | 显示全部楼层 |阅读模式
can't get macro to replace component.
i'm new to api and usually use record macros to get pieces of code. i recorded one to get the code for replacing components, but can't get it run. any help.
dim swapp as object
dim part as object
dim boolstatus as boolean
dim longstatus as long, longwarnings as long
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
boolstatus = part.extension.selectbyid2("5-5123-1235-005-2@assem1", "component", 0, 0, 0, false, 0, nothing, 0)
part.clearselection2 true
part.clearselection2 true
boolstatus = part.extension.selectbyid2("5-5123-1235-005-2@assem1", "component", 0, 0, 0, false, 0, nothing, 0)
boolstatus = part.replacecomponents("c:\documents and settings\adrianv\desktop\5-12345-123-005.sldasm", "", false, 0, true)
end sub
adrian velazquez
cswp
cswp-smtl
solidworks x64 2009 sp3.0
nvidia quadro fx 570
hi,
there is one extra argument. eliminate the '0'.
part.replacecomponents filename as string, configname as string, replaceallinstances as boolean, reattachmates as boolean
scott
thanks a lot scott.
adrian velazquez
cswp
cswp-smtl
solidworks x64 2009 sp3.0
nvidia quadro fx 570
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-22 19:07 , Processed in 0.035213 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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