Replace Template and delete the tables in the drawing


ProError UserReplaceTemplate()
{
    ProMdl curMdl;
    proErr = ProMdlCurrentGet(&curMdl);  //The drawing model
 
    ProMdl format;
    proErr = ProMdlLoad(L"J:\\workdir\\12791530\\new\\a3_asm_xmy.frm.2", PRO_MDL_UNUSED, PRO_B_FALSE, &format);
 
    ProDwgtable *tables = NULL;
    proErr = ProDrawingTablesCollect(static_cast(curMdl), &tables);
    int tableQty = 0;
    proErr = ProArraySizeGet(tables, &tableQty);
 
    ProBoolean isFromFormat = PRO_B_FALSE;
    for (int i = 0; i < tableQty; ++i)
    {
        proErr = ProDwgtableIsFromFormat(&tables[i], &isFromFormat);
        if (PRO_B_TRUE == isFromFormat)
        {
            proErr = ProDwgtableDelete(&tables[i], 0);
        }
    }
 
    proErr = ProDrawingFormatAdd(static_cast(curMdl), 0, NULL, format, 0);
 
    proErr = ProWindowRepaint(PRO_VALUE_UNUSED);
 
    proErr = ProArrayFree(reinterpret_cast(&tables));
    
    return proErr;
}





你可能感兴趣的:(CREO2.0)