IDisplayData::GetLineAtIndex3 problem after Break

Dear Everyone,

I have a utility that creates horizontal dimension and places the dimension text in the middle of the 2 extension lines.

To determine the middle of the extension lines, I used IDisplayData::GetLineAtIndex3 to get the data needed then perform the computation as shown below:

IDisplayData disData = (IDisplayData)tempDim.GetDisplayData();

double[] lineData1 = (double[])disData.GetLineAtIndex3(0);
double[] lineData2 = (double[])disData.GetLineAtIndex3(1);

// Calculate center;
double center = lineData1[4] + ((lineData2[4] - lineData1[4]) / 2.0);

The utility works fine until I had to insert a break(View:: InsertBreak) in one of the drawing views that I`m working on,

the dimension text position is being placed in the wrong position.

Upon investigation, I found out that the value of lineData1 and lineData2 interchanged so the formula was affected.

I tried deleting the break line then re-create dimensions, and then the text was placed in the right position.

Based on this behaviour, I concluded that the break line is causing the problem, but I may be wrong.

Question:

Is there a way to prevent IDisplayData::GetLineAtIndex3 from interchanging the lineData1 and lineData2?

If none, what alternative function can I use to position the dimension text in the middle?

Thanks is advance.

Best regards,

Joecel

SolidworksApi macros