Hi, I am trying to get all the components (parts and assemblies) from the root assembly. I wan't the components to be in the order as they appear in the FeatureManager tree.
Using the API quide a wrote macro posted bellow. Problem is, that call to entity.GetComponent allways returns Nothing. Can please anyone help me with this?
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.Feature
Dim entity As entity
Dim component As Component2
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swFeat = swModel.FirstFeature
While Not swFeat Is Nothing
Set entity = swFeat
If entity.GetType = swSelectType_e.swSelCOMPONENTS Then
Set component = entity.GetComponent
MsgBox "Name: " & component.Name2
Set swFeat = swFeat.GetNextFeature