Hello
In order to retrieve the list of components of an assembly, you must use the GetDocumentDependencies2 function.
More info here: http://help.solidworks.com/2015/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.isldworks~getdocumentdependencies2.html
For example, in an app in VB.net, I do the following
Statements:
Dim Application_SW As SldWorks.SldWorks
Dim Model_SW As SldWorks.ModelDoc2
Dim Component_SW As SldWorks.Component2
Dim Nom_fichier_SW As String
Dim Liste_dependances As Object
Function Code:
Function Acquisition_dependences(ByRef Chemin_assemblage_SW as string) as object
Dim Type_fichier_SW As Integer = 2
Application_SW. OpenDoc6(Chemin_assemblage_SW, Type_fichier_SW, 0, "", longstatus, longwarnings)
Model_SW = Application_SW. ActiveDoc
Nom_fichier_SW = Model_SW. GetPathName
Return Application_SW. GetDocumentDependencies2(Nom_fichier_SW, True, True, False)
End Function
Then you use the following code to execute the function:
Liste_dependances = Acquisition_dependences(Chemin_de_ton_fichier_ASM)
This returns an array of strings in the following form:
"If you use this method with an assembly that contains two documents, Part1 and SubAssem1, an example of what might be returned is:
[ "Part1", "C:\temp\Part1.SLDPRT", "SubAssem1", "c:\temp\SubAssem1.SLDASM" ]
Hoping to have helped you