|
traverse assembly - add custom property
i am trying to write what i thought would be an easy api script. all i want it to do is to traverse all parts in an assembly and add some custom properties to them. i have managed to get it done with one method, but that way flashes each part across teh screen. i would prefer if it did not do that. i have written this, and it traverses the assembly and can debug print, each child. but i cannot get it to add the property.
what am i missing. thank you in advance for you help and time.
__________
sub main()
dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim refmodel as sldworks.modeldoc2
dim custpm as sldworks.custompropertymanager
dim nerrors as long
dim nwarnings as long
dim childname as string
dim addprop as string
dim vchild as variant
dim vparent as variant
set swapp = application.sldworks
set swmodel = swapp.activedoc
vparent = swmodel.getpathname
debug.print vparent
vchild = swapp.getdocumentdependencies2(vparent, true, false, false)
for i = 1 to (ubound(vchild)) step 2
debug.print vchild(i)
set refmodel = swapp.opendoc6(vchild(i), swdocpart, swopendocoptions_silent, "", nerrors, nwarnings)
set custpm = refmodel.extension.custompropertymanager("")
addprop = custpm.add2("my test", swcustominfotext, "blah")
next i
end sub
check out our whitepaper library.
nevermind...i went and had lunch and when i came back. the code seems to work just fine. |
|