My goal is to make a macro that will essentially replicate "Configure Component" but for setting a subassembly flexible - I want to be able to choose a subset of configurations and set the subassembly flexible in only those configs.
I found a method on CodeStack here that looks like it should be easily modified to take a configuration name and then change the solving option in that config: https://www.codestack.net/solidworks-api/document/assembly/components/set-solving/
However, no matter how I change the parameters of CompConfigProperties5, my subassy only turns flexible in the currently active configuration with the target configuration unchanged.
In the code below, I've modified the sub to be specific to a named config.. or at least that's what I think the docs mean by the RefConfigName parameter. But this only produces the effect above.. Is the only way to do what I want to activate the target config? That would likely be very slow..
And am I doing something wrong, or is this a bug in the API where it's not doing what the docs say it should?
Sub SetSolvingFlag(swAssy As SldWorks.AssemblyDoc, comp As SldWorks.Component2, solveOpts As swComponentSolvingOption_e, configName As String)
comp.Select4 False, Nothing, False
Dim suppOpts As Long
Dim isVisible As Boolean
Dim exlFromBom As Boolean
Dim isEnv As Boolean
Dim useNamedConf As Boolean
Dim refConfName As String
suppOpts = comp.GetSuppression()
isVisible = comp.Visible
exlFromBom = comp.ExcludeFromBOM
isEnv = comp.IsEnvelope
useNamedConf = True
refConfName = configName
swAssy.CompConfigProperties5 suppOpts, solveOpts, isVisible, useNamedConf, refConfName, exlFromBom, isEnv
End Sub