Add an occurrence of a part to an assembly does not seem to work...

Top  Previous  Next

When you add an .ipt part to an .iam assembly you need to pass the correct sort of parameter to the Add function. For example this will not work:

 

CComPtr<ComponentOccurrence> pCyl2Occ = nullptr;

hRes = pOccurrencesList->Add (L"C:\\TEST\\Cyl2.ipt",pPosMatrix,&pCyl2Occ) ;

 

...but this will...

 

CComPtr<ComponentOccurrence> pCyl2Occ = nullptr;

hRes = pOccurrencesList->Add (CComBSTR(L"C:\\TEST\\Cyl2.ipt"),pPosMatrix,&pCyl2Occ) ;

 

The difference is that the first call does not cast to CComBSTR, the second, working version, does.

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)