API - how to get ShowChildComponentsInBOM

I have made a VBA program that lists properties for SW-files. I would also like to show the value of the check-box "don't show child component in BOM when used as a sub-assembly"

I use the following code Dim swApp As SldWorks.SldWorks Dim Model As ModelDoc2 Dim numConfigs As Long Dim Names As Variant

Set swApp = CreateObject("sldWorks.application") Set Model = swApp.OpenDoc6(path & filename, swDocASSEMBLY, swOpenDocOptions_Silent, "", lngErrors, lngWarnings)

numConfigs = Model.GetConfigurationCount() Names = Model.GetConfigurationNames() For i = 0 To (numConfigs - 1) MsgBox ("Config #" + Str(i) + " is: " + Names(i)) Next

This lists the names of the different configurations - but I cant figure out how to access the field "ShowChildComponentsInBOM" I looked at API help - but it doesn't really help me on this one - so a specific example would be nice.

Any help?

John

Reply to
John
Loading thread data ...

use Configuration::ShowChildComponentsInBOM you must first obtain the configuration object through a call to ModelDoc2::GetConfigurationByName clear enough ?

Reply to
Philippe Guglielmetti

Got it - it works. Thanks.

Can I address the different configurations without using the name? Can I just step through them with like GetNextConfiguration...?

John

Reply to
John

as you can see, the APIs to access the properties require the config names. There is a Configuration::Name method to obtain the name of a config. If you want to go trhough all configs, then ModelDoc2::GetConfigurationNames is the one. My 2 cents if you want to do some serious API development : spend a few hours reading ALL the apihelp. You can't memorize everything, but you'll remember what's in and what's not.

Reply to
Philippe Guglielmetti

Ive also found, if you're using early binding, that doing a search thru the object browser will turn up 'partial' hits for commands better than the search in the help.

Reply to
rocheey

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.