Hello Everybody,
I need some help with SolidWorks APIs.
I have an 'Derive Component Part' created from an Assembly Document.
This Assembly Document has two confgurations viz. '0001' and '0002'.
When this Assmebly Document was saved in the SolidWorks; configuration '0001' was active.
And while creating the 'Derive Component Part'; I created it from '0002' configuration.
I have 'Derived Componenet Part' opened in the SolidSworks.
Here I want to know which configuration of the assembly is used to create the part ? I am using SolidWorks 2009 SP 5.1
I have done the following coding:
// swModel is the ModelDoc2 of the 'Derived Componenet Part"
swModel.Extension.ListExternalFileReferences vModelPathName, vComponentPathName, vFeature, vDataType, vStatus, vRefEntity, vFeatComp, swExternalFileReferencesNamedConfig, sConfigName
If swModel.Extension.ListExternalFileReferencesCount() > 0 Then
For i = 0 To swModel.Extension.ListExternalFileReferencesCount() - 1
If CStr(vDataType(i)) = "Body" Then
sFeatName = CStr(vFeature(i))
If sFeatName <> "" Then
lPos = InStrRev(sFeatName, "@")
sFeatName = Right(sFeatName, (Len(sFeatName) - lPos))
sFeatName = sFeatName + ".SldAsm"
Set swAsmModel = OpenSWXDoc(sFeatName, 2) // Opening the Asm document to collect the ModelDoc2
End If
End If
Next i
End If
The Above code does gives me the ModelDoc2 of the assembly document but does not gives me the 'Referred Configuration'
Here I can get 'ActiveConfigguration' of the Assembly but in a case when Active configuration is not the Referred onfiguration then the code failes.
Please help me with this.
Thanks,
Sumedh
SolidworksApi macros