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

How to get Segment ID of a table?

SOLVED
Highlighted
Regular Member

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
Highlighted

Re: How to get Segment ID of a table?

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
Highlighted

Re: How to get Segment ID of a table?

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

Highlighted

Re: How to get Segment ID of a table?

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

Highlighted

Re: How to get Segment ID of a table?

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

 

 

Regards,
Pratik

Highlighted

Re: How to get Segment ID of a table?

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);

Highlighted

Re: How to get Segment ID of a table?

Thanks Alexandrite, it worked with 0 value.
👍

 

Regards,
Pratik

Announcements