cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

get drawing table cell text to a string / text file using toolkit

AlexCote
7-Bedrock

get drawing table cell text to a string / text file using toolkit

Hi,

I am trying to extract the text from a drawing table and save it to a text file.

I am able to get a hold of the table that I want to extract text from, but struggle to get the text.

Here's what I have so far:

image.png

If I leave the "MyTextChar" line I get a fatal error in CREO.

The parameter "&CurrTbl" is a table I select earlier in the code base on a criteria (this part works).

My goal is to replicate the export to CSV, but with a different delimiter and also control better the output filename.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
FV
17-Peridot
17-Peridot
(To:AlexCote)


@AlexCote wrote:

Hi,

I am trying to extract the text from a drawing table and save it to a text file.

I am able to get a hold of the table that I want to extract text from, but struggle to get the text.

Here's what I have so far:

image.png

If I leave the "MyTextChar" line I get a fatal error in CREO.

The parameter "&CurrTbl" is a table I select earlier in the code base on a criteria (this part works).

My goal is to replicate the export to CSV, but with a different delimiter and also control better the output filename.

 

Thanks


hi all,

Take a look at the code comments for  ProWstringToString(...) declaration, read the comments about the size of the resulting string buffer...

the code in question should look somewhat like this:

{
	char* my_text_char = NULL;
	my_text_char = (char*) calloc(sizeof(char), wcslen(CellText[0]) * 3);
assert( NULL != my_text_char); char* p_chr = ProWstringToString( my_text_char, CellText[0]); assert( NULL != p_chr); }

 

View solution in original post

2 REPLIES 2
FV
17-Peridot
17-Peridot
(To:AlexCote)


@AlexCote wrote:

Hi,

I am trying to extract the text from a drawing table and save it to a text file.

I am able to get a hold of the table that I want to extract text from, but struggle to get the text.

Here's what I have so far:

image.png

If I leave the "MyTextChar" line I get a fatal error in CREO.

The parameter "&CurrTbl" is a table I select earlier in the code base on a criteria (this part works).

My goal is to replicate the export to CSV, but with a different delimiter and also control better the output filename.

 

Thanks


hi all,

Take a look at the code comments for  ProWstringToString(...) declaration, read the comments about the size of the resulting string buffer...

the code in question should look somewhat like this:

{
	char* my_text_char = NULL;
	my_text_char = (char*) calloc(sizeof(char), wcslen(CellText[0]) * 3);
assert( NULL != my_text_char); char* p_chr = ProWstringToString( my_text_char, CellText[0]); assert( NULL != p_chr); }

 

AlexCote
7-Bedrock
(To:FV)

WOW , thanks ... that worked out fine.

 

I forgot to mention that I am a complete newbie to C and C++, so let just say it's a pain.

I have experience programming with VB.NET and starting to play with C#, but these C and C++ are a big monster to me 🙂

Been working with ProE for 20 years now, and been thinking for a while to learn this C language to use toolkit.

Top Tags