AnsweredAssumed Answered

How do you change the configuration of a library feature within a part?

Question asked by Dylan Zingle on Oct 22, 2019
Latest reply on Oct 23, 2019 by Dylan Zingle

I have a multi body sheet metal part [Drawer] that is equation driven and GUI controlled. 

The GUI allows users to enter in any Length, Width and Height and it updates the Global Variables and all the dimensions in the part change.

The problem I am having is that depending on the drawer depth, different slides will be used. The bolt pattern for the slides are all saved as different configurations within a library feature. 

 

 

I have looked high and low for a way to change the library configuration through VBA. 

 

Public swApp As SldWorks.SldWorks
Public Part As SldWorks.ModelDoc2

Dim Feature As SldWorks.Feature

Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc

Set Feature = Part.FirstFeature

 

Part.ShowConfiguration2 (NewConfigName)

 

^^This works to change the configuration of the Part but I am needing some block of code that will allow me to change the Library feature configuration.

 

 

 

Feature.ShowConfiguration (NewConfigName)

 

^^I need something like this???????

 

I am able to 'Read' the Library Feature through:

 

Dim LibraryFeatureData As LibraryFeatureData

Set LibraryFeatureData = Feature.GetDefinition

ConfigurationName = LibraryFeatureData.ConfigurationName

 

How do I write to this value????

 

(Note the library feature is already inserted into the model, I want to switch between configurations only of the library feature, I don't want to change the part configuration)

Outcomes