AddCustomiPartMember details and tips |
Top Previous Next |
Look at this call:
pOccs->AddCustomiPartMember(strFactoryFile, // This is the source file of the object to create pMatrix, // This is where to place the created custom iPart strFullFileName, // This is the resulting file of the created object varEmpty, // Usually unused with custom iParts, hence varEmpty. oleSafeArray, // Parameters, in column order &pCyl1Occ) ;
varEmpty will be something like this:
CComVariant varEmpty ;
The creation of oleSafeArray is explained here. However remember that the values must be in column order, for example:
BSTR strParams[] = { CString("35 mm").AllocSysString(), // Diameter CString("1.5 mm").AllocSysString(), // Thickness CString("350 mm").AllocSysString(), // Length CString("10").AllocSysString(), // R1Angle CString("20").AllocSysString(), // R2Angle }; const int ikNumParams = sizeof(strParams)/sizeof(strParams[0]) ;
COleSafeArray oleSafeArray; oleSafeArray.CreateOneDim(VT_BSTR, ikNumParams, strParams);
The call may fail for one of these reasons:
The two filenames can be created like this:
CComBSTR strFactoryFile(L"C:\\CHS_LHS_COLL\\Tube-Custom.ipt") ; CComBSTR strFullFileName(L"C:\\CHS_LHS_COLL\\Tube_999.ipt") ;
|
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)