control component suppression and configuration depending on assembly's configuration

Programming and macros
Kjara
Posts: 21
Joined: Mon Jul 19, 2021 2:49 am
Answers: 0
x 1

control component suppression and configuration depending on assembly's configuration

Unread post by Kjara »

Much data is configuration-dependent and has corresponding API methods that allow the programmer to choose which configurations should be affected.

Examples:
Dimension value – IDimension.SetValue3
Feature suppression – IFeature.SetSuppression2
Component Bom Exclusion – IComponent2.SetExcludeFromBom2

I am looking for analog methods to control suppression state and active configuration of components, but I only found
- IComponent2.SetSuppression2 and IComponent2.ReferencedConfiguration which both just affect the active configuration of the owning assembly,
- IConfigurationManager.SetConfigurationParams (use "$state@componentName" for suppression and "$configuration@componentName" for configuration) which has some nasty side-effects: it creates a design table if none was present before; it changes design table settings if a design table was present before (it sets IDesignTable.AutoAddNewConfigs to False, IDesignTable.AutoAddNewParams to False, IDesignTable.EnableCellDropdownLists to True, IDesignTable.Updatable to False).

Are there any others? Which ones?
My program needs to be fast, so activating configurations just to set some data there is a no-go.
Kjara
Posts: 21
Joined: Mon Jul 19, 2021 2:49 am
Answers: 0
x 1

Re: control component suppression and configuration depending on assembly's configuration

Unread post by Kjara »

For component suppression one could use IFeature.SetSuppression2 on the component feature (use IAssemblyDoc.FeatureByName on the component name to get the component feature). But it only works if the component feature is selected prior to calling IFeature.SetSuppression2, and it does not work for pattern components.
Post Reply