API - how to get ShowChildComponentsInBOM

Discussion in 'SolidWorks' started by John, Oct 7, 2003.

  1. John

    John Guest

    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
     
    John, Oct 7, 2003
    #1
  2. use Configuration::ShowChildComponentsInBOM
    you must first obtain the configuration object through a call to
    ModelDoc2::GetConfigurationByName
    clear enough ?
     
    Philippe Guglielmetti, Oct 7, 2003
    #2
  3. John

    John Guest

    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
     
    John, Oct 7, 2003
    #3
  4. 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.
     
    Philippe Guglielmetti, Oct 8, 2003
    #4
  5. John

    rocheey Guest

    if you want to do some serious API development : spend a few
    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.
     
    rocheey, Oct 8, 2003
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.