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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to get Segment ID of a table?

pratik_chougule
7-Bedrock

How to get Segment ID of a table?

Hello all,

I have a situation where I want to save table in CSV format.
I am using 'ProDwgtableSave' API for the same.

ProError ProDwgtableSave(ProDwgtable* table, ProPath path, ProDwgtableFormattype table_format, int segment_id );

 

The API extern 'ProDwgtableSave' requires 'segment id' as an argument.

 

I am using 'ProDwgtableSegCount' API to get segment count.

 

ProError ProDwgtableSegCount (ProDwgtable *p_table,
int *n_segs);

 

But I am not finding a way to get 'segment id' from the number of segments.

Therefore I am not able to save CSV file as it is not getting specific table data.
Though I am able to save TXT file as it does not require 'segment id' as argument.

 

Thanks in advance.

 

Regards,
Pratik Chougule

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Pratik

 

int segments;

if (ProDwgtableSegCount(table, &segments) == PRO_TK_NO_ERROR) {
if (ProDwgtableSegSheetGet(table, 0, &segsheet) != PRO_TK_NO_ERROR) {
ProDwgtableSegSheetGet(table, -1, &segsheet);
segments = -1;
}
else {
segments = 0;
}

}

 

If you have a multisegment table 0 is the first segment. If you have a single segment table -1 could also be the segment. So sometimes you need the 0 sometimes the -1. Just make a encapsulated call and try both.

 

Br,

Eike

 

 

View solution in original post

5 REPLIES 5

Hello,

Maybe it is ordinal number of a segment?

If you have several segments in table, then try to put 0, 1, ... in function as segment id

Hi Pratik

 

int segments;

if (ProDwgtableSegCount(table, &segments) == PRO_TK_NO_ERROR) {
if (ProDwgtableSegSheetGet(table, 0, &segsheet) != PRO_TK_NO_ERROR) {
ProDwgtableSegSheetGet(table, -1, &segsheet);
segments = -1;
}
else {
segments = 0;
}

}

 

If you have a multisegment table 0 is the first segment. If you have a single segment table -1 could also be the segment. So sometimes you need the 0 sometimes the -1. Just make a encapsulated call and try both.

 

Br,

Eike

 

 

Yes, Eike Hauptmann, it worked with 0 value.
👍

 

 

Regards,
Pratik

It is not sometimesヤ 😁
/*

p_table - The table in question.
segment - The segment ID you want to check (or -1 for a one seg. table).

You have the count !

*/


tk_status = ProDwgtableSegSheetGet( (ProModelitem*) &p_table,segment,&segsheet);

Thanks Alexandrite, it worked with 0 value.
👍

 

Regards,
Pratik

Top Tags