Reversing of wire points


I am using OpenCASCADE to export data in STEP format.  In my software, TexGen, a series of points around a yarn are stored, shown in the StepExport file (it's using a low resolution for debugging purposes).

The yarn is converted as shown in the code snippets below. The points in the SectionPoints vector are exactly the same as in the original model, all start at the same point in the cross-section and are all in the same direction. When the shape is created the direction of the points in the wires seem to have been reversed as shown in the screen shot of the saved brep data (YarnShape.png).  Is there any way of preventing this and/or have I done something wrong?

The brep file for the shape is also attached.

Many thanks,


	TopTools_HSequenceOfShape YarnShapes;

	TGLOG("Converting Yarn to Open CASCADE format");

	vector<CSlaveNode>::const_iterator itSlaveNode;
	const vector<CSlaveNode> &SlaveNodes = Yarn.GetSlaveNodes(CYarn::SURFACE);

	BRepOffsetAPI_ThruSections SectionsSolid(true, m_bFaceted);
	for (itSlaveNode = SlaveNodes.begin(); itSlaveNode != SlaveNodes.end(); ++itSlaveNode)
	TopoDS_Shape Shape = SectionsSolid.Shape();

	BRepTools::Write(Shape, "ConvertedShape.brep");

TopoDS_Wire CExporter::ConvertSection(const vector<XYZ> &SectionPoints)
	if (m_bFaceted)
		BRepBuilderAPI_MakePolygon PolygonalWire;
		vector<XYZ>::const_iterator itSectionPoint;
		for (itSectionPoint = SectionPoints.begin(); itSectionPoint != SectionPoints.end(); ++itSectionPoint)
			gp_Pnt Point(itSectionPoint->x, itSectionPoint->y, itSectionPoint->z);
		ShapeAnalysis_Wire AnalyseWire;
		Standard_Boolean order = AnalyseWire.CheckOrder();
		return PolygonalWire.Wire();