AnsweredAssumed Answered

Set:  Change properties in "All configurations" in the Component Properties

Question asked by Daniel Grau on Apr 21, 2020

Hello,

 

i would like to add a component Reference for all configurations of an assembly of a selected component via SWX VBA API.

Adding the Component Reference in one assembly via macro already works:

 

Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("5448-0202 USB2.0 J TypeA THT 90-H 1500 high retention-1@08SC34-xx_R00_EL", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.CompConfigProperties6(2, 0, True, True, "Standard", False, False, 0)

' Component Properties (Reference Name)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("5448-0202 USB2.0 J TypeA THT 90-H 1500 high retention-1@08SC34-xx_R00_EL", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
Dim swComp As Component2
Set swComp = Part.SelectionManager.GetSelectedObjectsComponent4(1, -1)
swComp.ComponentReference = "J6"
boolstatus = Part.EditRebuild3()
End Sub

 

How do I set "All configutations" via API (see yellow marking in the picture)?

 

Thank you!


Daniel Grau

Outcomes