Going crazy over this ... ProDwgTable going from Exist to not !!!
Hi All,
got a problem here that I can't figure out ... and I suspect my lack of knowledge in C language.
So I have this part of code:
for (TableIdx = 0; TableIdx <= NbrOfTbl - 1; TableIdx++) {
//Get the number of columns
CurrTbl = MyTablesCollection[TableIdx]; //ProDwgtable(MyTablesCollection[c1]);
NbrOfCols = GetTheColumnCount(&CurrTbl); // This here works
NbrOfRows = GetTheRowCount(&CurrTbl); // This here works
ShowMessage(" (Loop with Repeat Region) Return of functions, NbrOfCols = %d ... NbrOfRows = %d", NbrOfCols, NbrOfRows);
if (NbrOfCols == 9 || NbrOfCols == 10) {
ShowMessage(" Check before 'ProDwgtableCellRefmodelGet' ... NbrOfCols = %d", NbrOfCols);
error = ProDwgtableCellRefmodelGet(&CurrTbl, 4, 1, ProAssemblyRepeatRg, ProMdlRepeatRg);
if (error != PRO_TK_NO_ERROR) {
//We want the loop to go on if the error is PRO_TK_E_NOT_FOUND
if (error == PRO_TK_BAD_INPUTS) {
ShowMessage(" Problem with ProDwgtableCellRefmodelGet. Error = %s", GetProErrorDesc(error));
goto _END;
}
}
else
{
if (ProAssemblyRepeatRg != NULL) {
TableFound = TableFound + 1;
ShowMessage(" TableFound = %d", TableFound);
int NbrOfColsInf = GetTheColumnCount(&CurrTbl); // This here DO NOT works
int NbrOfRowsInf = GetTheRowCount(&CurrTbl); // This here DO NOT works
ShowMessage(" Col: %d ... Row: %d", NbrOfColsInf, NbrOfRowsInf);
goto _ExitCheckLoop;
}
}
}
ShowMessage(" TableFound (with Repeat Region) = %d", TableFound);
_ExitCheckLoop:
if (TableIdx != 0) {
CurrTbl = MyTablesCollection[TableIdx];
ShowMessage(" Index of Table: %d", TableIdx);
int NbrOfCols2 = GetTheColumnCount(&CurrTbl);
int NbrOfRows2 = GetTheRowCount(&CurrTbl);
ShowMessage(" Col: %d ... Row: %d", NbrOfCols2, NbrOfRows2);
}
Both sub functions:
int GetTheColumnCount(ProDwgtable *TheTable) {
//ShowMessage(" Debut sous fonction, GetTheColumnCount. %d", 1);
int ColNumber = 0;
ProError error;
error = ProDwgtableColumnsCount(TheTable, &ColNumber);
if (error != PRO_TK_NO_ERROR) {
ShowMessage(" Error, in GetTheColumnCount, with ProDwgtableColumnsCount = %s", GetProErrorDesc(error));
return 0;
}
return ColNumber;
}
int GetTheRowCount(ProDwgtable *TheTable) {
int RowNumber = 0;
ProError error;
error = ProDwgtableRowsCount(TheTable, &RowNumber);
if (error != PRO_TK_NO_ERROR) {
ShowMessage(" Error, in GetTheRowCount, with ProDwgtableRowsCount = %s", GetProErrorDesc(error));
return 0;
}
return RowNumber;
}
So all this gives the below results, for a reason I can't find the variable 'CurrTbl' is becoming empty or something even tough I don't reassign anything to it. Of course later on in the code I try to work with the table and since it does not EXIST for CREO, it crashes.

Any idea of what's wrong?

