Curve parameters

I need to export following face to SVG (see attachment). The face consists of one closed outer bspline and several inner circles. Because SVG does not support bspline, I work with sample points. The problem I have is the direction of the sample points (clockwise vs counterclockwise) in closed edges.

To get the sample points I use following code (I'm using the python wrapper PythonOCC):

curve, firstParam, lastParam = BRep_Tool_Curve(curEdge)

I loop through some points using
curve.Value(firstParam)
curve.Value(firstParam + dP) (dP representing incrementing values from firstParam to lastParam)
cuvre.Value(lastParam)

Sometimes the sample points of the outer and inner edges (contour and holes/bspline and circles in this case) are all in the same direction, sometimes (when examining other faces) I get the correct direction.

Are the first and last parameters of a curve always according to direction? In this example I get firstParam=0, lastParam=1 so I get the sample points by going from 0 to 1 (instead going from 1 to 0 gives the correct direction of the points). If not, how to get the sample points of a curve in the right order/direction? Or does there exist an easy way to export faces to SVG?

Thanks in advance

Attachments: 
Mikhail Sazonov's picture

You need to consider the edge orientation. If it is FORWARD you get points from first to last, and if it is REVERSED you should get them in opposite way.

Thieme Vandeput's picture

Thanks a lot!! That does the job