STEP and bsplines

Hi,... I'm a student and work on a bspline-based tracking project.

Currently I try to read a STEP file and filter bsplines out of it.

STEPControl_Reader reader;
IFSelect_ReturnStatus status = reader.ReadFile("someFile.step");
Handle(TColStd_HSequenceOfTransient) list = reader.GiveList("step-type(b_spline_curve)");
// ??? what strings need to go into "GiveList (String first, String second)" ???
Standard_Integer nbtrans = reader.TransferList(list);

Furthermore, how do I proceed to convert those entities into Geom_BSplineCurve?

I'd appreciate it, if someone could point me into a direction...
Thanks in advance,

Pawel's picture

Hi Tobi,

conversion of edges into 2d curve would look something like this:

if(curveShape.ShapeType() == TopAbs_EDGE)
TopoDS_Edge edge = TopoDS::Edge(curveShape);
double firstPar, lastPar;

Handle (Geom_Curve) curveHandle =

Handle_Geom2d_Curve curve2dHandle = Handle_Geom2d_Curve::DownCast(curveHandle);
if (!curve2dHandle.IsNull())
//do something with your 2d curves

So if you change it accordingly to Geom_BSplineCurve it should work.


camanhere's picture

thanks for your reply!
I did try something in this direction.

Let me first explain you a bit more detailed what I need to do:
I have a CAD model, rendered under some variation in light and cameraposition.
I sort the most robust edges in meanings of these variations, and represent them as bsplines. Those bsplines are saved into a STEP file.

Thats already done.
My part is to do a tracking system. That means i need to get those bsplines, compare them with my 2D-(Real-Object)-Image and do a distance measurement, needed for feedback, how good the camera pose estimation is!

So... openCascade already has the needed functionality.
I only should need to modify the visualisation-part.
that should be:
But instead of rendering to window i need to get the (x,y) points that should go into the image.
I'm working on that.
As OpenCascade is very complex (no offence :-)) this is not as trivial as I first thought. Your way, I think is to complicated.
Anybody got an hint for me?

Thanks in advance