Skip to main content
1-Visitor
July 3, 2019
Solved

Checking repeat region filter with toolkit

  • July 3, 2019
  • 2 replies
  • 1732 views

Hi,

so I already have a toolkit that iterate trough a drawing tables and check for table with repeat region.

What I would like to do is that while going through the tables, find the one that has a certain filter.

When in CREO I go to the Repeat Region Menu then select Filter and Show, I can see this as my filter: &mdl.param.name == docid

image.png 

The table is always a single cell table containing my document number and would like to get it.

 

Anyone knows how to achieve this?

I tried with this method:

				p_CurrTbl = &MyTablesCollection[i];
				ProWstring **FilterText;
				error = ProDwgtableCelltextGet(p_CurrTbl, 1, 1, ProParamMode(2), FilterText);
				if (error == PRO_TK_NO_ERROR) {

					//Convert the ProWstring text to char
					char* MyTmpChar = NULL;
					char NewTmpTxt[50];
					MyTmpChar = (char*)calloc(sizeof(char), wcslen(**FilterText) * 3);
					char* tmp_chr = ProWstringToString(MyTmpChar, **FilterText);
					if (sizeof(NewTmpTxt) < strlen(tmp_chr) + 1) {
						goto _END;
					}
					strncpy(NewTmpTxt, tmp_chr, sizeof(NewTmpTxt));
					ShowMessage(" NewTmpTxt : %s", NewTmpTxt);

But this only returns this:

image.png

Thanks

Best answer by AlexCote

I finally ask PTC about this, and they have confirm me that this is not supported by the Toolkit API.

2 replies

AlexCote1-VisitorAuthorAnswer
1-Visitor
July 12, 2019

I finally ask PTC about this, and they have confirm me that this is not supported by the Toolkit API.

July 23, 2019

This is not an answer to the question but rather a warning for people who may copy/paste the code below.

ProDwgtableCelltextGet call has wrong arguments (in bold) ...

 

p_CurrTbl = &MyTablesCollection[i];
ProWstring **FilterText;
error = ProDwgtableCelltextGet(p_CurrTbl, 1, 1, ProParamMode(2), FilterText);
				if (error == PRO_TK_NO_ERROR) {...}

 The correct call is:

p_CurrTbl = &MyTablesCollection[i];
ProWstring *wstr_arr = NULL;
ProParamMode pmode = PRODWGTABLE_FULL; // or PRODWGTABLE_NORMAL
error = ProDwgtableCelltextGet(p_CurrTbl, 1, 1, pmode, &wstr_arr);
if (error != PRO_TK_NO_ERROR) {
return PRO_TK_GENERAL_ERROR;
}

{
// do something with text ...
} ProWstringproarrayFree(wstr_arr);