You need to use Component2::SetSuppression2 API or AssemblyDoc::CompConfigProperties5 methods
Thanks for the reply, but I'm really struggling with this one.
Please correct me if I'm wrong, but I believe Component2::SetSuppression2 does not allow you to suppress the component in a non-active configuration, right?
I've played around with AssemblyDoc::CompConfigProperties5, and it appears you have to select the component first. I'm trying to avoid pre-selecting as that seems slow. Also, I don't see how CompConfigProperties5 lets you set the configuration of the assembly in which you want to suppress the component.
Again, I'm trying to suppress a component in a non-active configuration, without selecting it in the graphics window (for speed).
I apologize as I misled you. You are right, none of those method would work for you. I mixed it up with IFeature::SetSuppression2 method which allows to specify the configuration options. It is actually possible to get IFeature from IComponent2 but that method fails to suppress the components.
Your idea with parameters is indeed right way to go. You can look at this example which shows how to suppress all components in all inactive configurations: Modify Configuration Parameters For Multiple Components
This example works correctly for me. I think you need to change you array to array of strings instead of array of objects and that should fix the issue.
Thanks again for your continued help!
I tried out that script without modification, and it worked! The only peculiar thing is this: the script indeed suppresses everything as expected (and really fast I might add!). If you then try to unsupress one of the components, you get this message:
If you save the doc, close it, and reopen, then you don't get this message. Really odd! Any ideas how to clear that in Solidworks's memory?
I also went through the example code (which works) and compared it to my original code (which didn't), and there was only one difference. When declaring vConfParam and vConfValue, I was declaring them as arrays of Objects. When I changed that to arrays of strings, it worked as expected, arg!!
Further intel: before the SetConfigurationParams call, HasDesignTable returns False. After the SetConfigurationParams call, HasDesignTable returns true. After calling DeleteDesignTable, HasDesignTable still returns true?!