Geom_BSplineCurve incorrect poles

Hello,

I am trying to read a small step file containing a very simple shape with a bspline curve (full closed ellipse).
After I have read the file, I use this code to obtain the poles:

	Standard_Real firstParam, lastParam;
	Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, firstParam, lastParam);
	Handle(Geom_BSplineCurve) bsplineCurve = Handle(Geom_BSplineCurve)::DownCast(curve);
	TColgp_Array1OfPnt controlPoints(1, bsplineCurve->NbPoles());
	bsplineCurve->Poles(controlPoints);
	for (Standard_Integer i = 1; i <= controlPoints.Length(); ++i) {
		gp_Pnt pt = controlPoints(i);
		std::cout << "P" << i << ": ("
			<< pt.X() << ", "
			<< pt.Y() << ", "
			<< pt.Z() << ")" << std::endl;
	}

It gives me the following array of poles:

P1: (55.00040, 6.00000, -93.93142)
P2: (55.00042, 6.00000, -94.23820)
P3: (55.05453, 6.00000, -94.54542)
P4: (55.20495, 6.00000, -94.97344)
P5: (55.26664, 6.00000, -95.11060)
P6: (55.41108, 6.00000, -95.36812)
P7: (55.49391, 6.00000, -95.48836)
P8: (55.77095, 6.00000, -95.81507)
P9: (55.99385, 6.00000, -95.98740)
P10: (56.47796, 6.00000, -96.22346)
P11: (56.73914, 6.00000, -96.28719)
P12: (57.26148, 6.00000, -96.28699)
P13: (57.52264, 6.00000, -96.22305)
P14: (58.00670, 6.00000, -95.98691)
P15: (58.22958, 6.00000, -95.81469)
P16: (58.50658, 6.00000, -95.48864)
P17: (58.58941, 6.00000, -95.36870)
P18: (58.73383, 6.00000, -95.11175)
P19: (58.79551, 6.00000, -94.97485)
P20: (58.94591, 6.00000, -94.54724)
P21: (59.05398, 6.00000, -93.93133)
P22: (58.94612, 6.00000, -93.31586)
P23: (58.74581, 6.00000, -92.74604)
P24: (58.59930, 6.00000, -92.48347)
P25: (58.32171, 6.00000, -92.15645)
P26: (58.21971, 6.00000, -92.05873)
P27: (58.00139, 6.00000, -91.88856)
P28: (57.88513, 6.00000, -91.81594)
P29: (57.52207, 6.00000, -91.63900)
P30: (57.26104, 6.00000, -91.57550)
P31: (56.73884, 6.00000, -91.57595)
P32: (56.47767, 6.00000, -91.63989)
P33: (55.99355, 6.00000, -91.87614)
P34: (55.77063, 6.00000, -92.04848)
P35: (55.49362, 6.00000, -92.37509)
P36: (55.41080, 6.00000, -92.49527)
P37: (55.26640, 6.00000, -92.75266)
P38: (55.20474, 6.00000, -92.88976)
P39: (55.05441, 6.00000, -93.31757)
P40: (55.00037, 6.00000, -93.62467)

Notice how the first and the last pole are not the same, meaning it does not form a full closed ellipse.

If open the .step file with a text editor, I see that there are 41 poles, but bsplineCurve->NbPoles() returns 40.

The first and the last pole inside the step file are connected:

#97 = CARTESIAN_POINT('',(55.000395262373,6.,-93.93141642907));
#98 = CARTESIAN_POINT('',(55.000419580329,6.,-94.23819823706));
#99 = CARTESIAN_POINT('',(55.054529281496,6.,-94.54542156539));
#100 = CARTESIAN_POINT('',(55.204948301653,6.,-94.97344138097));
#101 = CARTESIAN_POINT('',(55.266637957059,6.,-95.11060472584));
#102 = CARTESIAN_POINT('',(55.411078177228,6.,-95.36812191752));
#103 = CARTESIAN_POINT('',(55.493911487128,6.,-95.48835902002));
#104 = CARTESIAN_POINT('',(55.770945490287,6.,-95.81507416448));
#105 = CARTESIAN_POINT('',(55.993848383421,6.,-95.98740185196));
#106 = CARTESIAN_POINT('',(56.477961034738,6.,-96.22345722768));
#107 = CARTESIAN_POINT('',(56.739140352711,6.,-96.28719089725));
#108 = CARTESIAN_POINT('',(57.261476686829,6.,-96.28699051122));
#109 = CARTESIAN_POINT('',(57.522637224196,6.,-96.22305319909));
#110 = CARTESIAN_POINT('',(58.006702823815,6.,-95.98690545164));
#111 = CARTESIAN_POINT('',(58.229577778555,6.,-95.8146926414));
#112 = CARTESIAN_POINT('',(58.506582810716,6.,-95.48864119278));
#113 = CARTESIAN_POINT('',(58.589407693645,6.,-95.36870306638));
#114 = CARTESIAN_POINT('',(58.73383158302,6.,-95.11175389791));
#115 = CARTESIAN_POINT('',(58.795513406039,6.,-94.97485270671));
#116 = CARTESIAN_POINT('',(58.945907943002,6.,-94.54724381823));
#117 = CARTESIAN_POINT('',(59.053984848563,6.,-93.93132615598));
#118 = CARTESIAN_POINT('',(58.946122344554,6.,-93.31585960474));
#119 = CARTESIAN_POINT('',(58.745808481468,6.,-92.74603983701));
#120 = CARTESIAN_POINT('',(58.599302544771,6.,-92.48347288369));
#121 = CARTESIAN_POINT('',(58.321712744073,6.,-92.15644552168));
#122 = CARTESIAN_POINT('',(58.219706233593,6.,-92.05873013051));
#123 = CARTESIAN_POINT('',(58.001385932587,6.,-91.8885561695));
#124 = CARTESIAN_POINT('',(57.885125795032,6.,-91.81594435036));
#125 = CARTESIAN_POINT('',(57.522074980805,6.,-91.63900428052));
#126 = CARTESIAN_POINT('',(57.261038395602,6.,-91.57550330801));
#127 = CARTESIAN_POINT('',(56.738836307415,6.,-91.57594857278));
#128 = CARTESIAN_POINT('',(56.477667584964,6.,-91.63988564133));
#129 = CARTESIAN_POINT('',(55.993549379568,6.,-91.87614480246));
#130 = CARTESIAN_POINT('',(55.770630097128,6.,-92.04847780647));
#131 = CARTESIAN_POINT('',(55.493617023732,6.,-92.37508644343));
#132 = CARTESIAN_POINT('',(55.410799297016,6.,-92.495269973));
#133 = CARTESIAN_POINT('',(55.266403180323,6.,-92.7526637929));
#134 = CARTESIAN_POINT('',(55.204741190249,6.,-92.88975750848));
#135 = CARTESIAN_POINT('',(55.054411969549,6.,-93.31757439996));
#136 = CARTESIAN_POINT('',(55.000370943808,6.,-93.62467049078));
#137 = CARTESIAN_POINT('',(55.000395262373,6.,-93.93141642907));

I have attached the step file as a .txt file.

Am I doing something in my conversion from edge to Geom_BSplineCurve? Or is this a bug in opencascade maybe?

Martijn

Attachments: