Ok. Now we have got the BOM Table's name of the selected view. But the problem is: how do we get the content of the BOM table through the table's name? For example: a drawing file has 2 sheets, sheet-1 and sheet-2, and sheet-1 has 3 views, view-1, view-2, view-3, and each view has a BOM table, BOM Table-1, BOM Table-2, BOM Table-3. Now we select view-2 of sheet-1, the BOM table of this view is BOM Table-2, and as you said, we can get the BOM Name of the view. But we don't know how to get the content of the BOM table through the table's name. We get the content with the following code: CComPtr iSheet; DrawingDoc->IGetCurrentSheet(&iSheet); CComPtr iView1, iView2; DrawingDoc->IGetFirstView(&iView1); CComPtr iTableAnt; iView1->GetFirstTableAnnotation(&iTableAnt); while(iTableAnt != NULL) {// this loop can get all the BOM Table of this sheet. but we can get selected view's BOM Table. That's the problem! CComBSTR strTableTitle; iTableAnt->get_Title(&strTableTitle); //this title we get is "BOM Table", but not "BOM-1", "BOM-2", or "BOM-3"; long lTableType; iTableAnt->get_Type(&lTableType); if (lTableType == swTableAnnotation_BillOfMaterials) { ......//we can get the content. } else { CComPtr iTableAnt2; iTableAnt->GetNext(&iTableAnt2); iTableAnt = iTableAnt2; if(iTableAnt2 != NULL) iTableAnt2.Release(); } if (iTableAnt != NULL) iTableAnt.Release();
iView1->IGetNextView(&iView2); iView2->GetFirstTableAnnotation(&iTableAnt);
Now iTableAnt == NULL, does it mean that we cannot get the BOM table of the view2? But actually, we have already get it for view1. Am i right, or I use the incorrect method?.
This while loop can get all the BOM Table of this sheet. but we can get selected view's BOM Table. That's the problem! So what i want to know is that how i get the content of view2's BOM table?