几何尺寸与公差论坛

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

【转帖】cant get insertderivedpattern to work

[复制链接]
发表于 2009-4-13 09:34:17 | 显示全部楼层 |阅读模式
can't get insertderivedpattern to work
i'd like to automate the creation of feature driven component patterns. based on the api help it seems relatively simple, but nothing happens when i run the code below. everything seems to work as expected until the insertderivedpattern command is called. no pattern feature is created. the swfeat variable remains nothing.
sub main()
dim swapp as sldworks.sldworks
dim swdoc as sldworks.modeldoc2
dim swfm as sldworks.featuremanager
dim swselmgr as sldworks.selectionmgr
dim swfeat as sldworks.feature
dim inumsel as integer
dim i as integer
dim bool as boolean
set swapp = application.sldworks
set swdoc = swapp.activedoc
if swdoc.gettype <> swdocassembly then exit sub 'exit if no assembly open
set swfm = swdoc.featuremanager
set swselmgr = swdoc.selectionmanager
inumsel = swselmgr.getselectedobjectcount
if inumsel > 1 then
for i = 1 to inumsel
if i = inumsel then
bool = swselmgr.setselectedobjectmark(i, 2, swselectionmarkset)
else
bool = swselmgr.setselectedobjectmark(i, 1, swselectionmarkset)
end if
next i
set swfeat = swfm.insertderivedpattern
end if
set swapp = nothing
set swdoc = nothing
set swfm = nothing
set swselmgr = nothing
end sub
mahir abrahim, cswp/core. cswp/smtl
mechanical design engineer
sw 2009 sp2.1
proe wf3/4
answer ok, never mind. turns out the selections must consist of components for seeds and a pattern or hole wizard for the driving feature. you can't just use selected faces with the insertderivedpattern command.
mahir abrahim, cswp/core. cswp/smtl
mechanical design engineer
sw 2009 sp2.1
proe wf3/4
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-24 11:00 , Processed in 0.036608 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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