|
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 |
|