Select Assembly Components by Size Example (VBA)
This example shows how to select components by percent of assembly size.
'----------------------------------------------------------------------------
' Preconditions: Open an assembly.
'
' Postconditions: Components that are 30% of the size of the
' assembly or smaller are selected.
' ---------------------------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim assem As SldWorks.AssemblyDoc
Dim bool As Boolean
Option Explicit
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set assem = Part
bool = assem.SelectComponentsBySize(30#)
End Sub