josh wrote: ↑Wed Sep 27, 2023 9:39 am
Don't use SelectByID2. SelectByID is what the macro recorder uses, but it's almost always the wrong thing to use when you're actually writing a macro. In this case, you already have a pointer to the Feature object, which has a Select2 method.
But, in fact, since you already have a pointer to the Feature object, just use the SetSuppression method of the feature. Selecting it is a waste of time because SW will take the time to update the graphics etc to show the selection.
In fact, if you use SetSuppression2 method, you can unsuppress in all configurations at once without having to cycle through.
Thanks, Josh. That works. When I find a feature of the right type, I use
BoolStatus = swFeat.SetSuppression2(swUnSuppressFeature, swAllConfiguration, Nothing)
to unsuppress it in every config all at once.
Now my problem is that this only works for preexisting COM and COMRP features. If I try to do it immediately after creating a COM or COMRP, using
Set COM = swModel.FeatureManager.InsertCenterOfMass
or
COMRP = swModel.FeatureManager.InsertCenterOfMassReferencePoint
they remain suppressed in every other configuration, even after unsuppressing them like you suggested.
I even tried rebuilding after inserting the features, but before unsuppressing them with no luck using:
BoolStatus = swModelDocExt.Rebuild(swRebuildOptions_e.swRebuildAll)