I found the solution:
first, you should go to Tools/Options/Infrastructure/PartInfrastructure, in Tab General, in the first block "external reference", select the first checkbox.
Code:
CATIPrtPart_var spPart(spSpecOnPart); // you get a part
CATListValCATISpecObject_var spBodies = spPart->GetImportedBodies();
int size = spBodies.Size();
CATUnicodeString extRefs;
for(int i=1; i<=size; i++)
{
CATIMechanicalImport_var spImport(spBodies);
CATISpecObject_var spOrig = spImport->GetSelectedFeatureInSourceProduct();
CATIAlias_var spAlias(spOrig);
CATUnicodeString strAlias = spAlias->GetAlias();
extRefs += strAlias + ", ";
}
With CATIPrtPart::GetImportedBodies() you get the body refernces in the same part, and with CATIMechanicalImport::GetSelectedFeatureInSourceProduct() you get the original ones.
Does anybody know, how I can get the mapping of a feature and the external reference, which this feature is using (in the same part)? I mean, I have many features and many external references in a part, how can I find out, which feature uses which external reference? Any idea?
Thank you! |