Here is the code using the rhinocommon library. I find with my experiments that offset curves are not always created correctly for any cutting plane given a mesh

```
void GenerateOffsetCurves(Rhino::Geometry::Mesh^ mesh,
Rhino::Geometry::Plane cuttingPlane,
System::Double offsetDistance,
cli::array<Rhino::Geometry::Curve^>^% offsetCurves)
{
cli::array<Rhino::Geometry::Curve^>^ contourCurves = nullptr;
contourCurves = Rhino::Geometry::Mesh::CreateContourCurves(mesh, cuttingPlane);
if (contourCurves->Length > 0)
{
for(System::Int32 ccIndex = 0; ccIndex < contourCurves->Length; ++ccIndex)
{
Rhino::Geometry::Curve^ contourCurve = contourCurves[ccIndex];
if (contourCurve->IsClosed)
{
Rhino::Geometry::CurveOrientation ccOrientation = contourCurve->ClosedCurveOrientation ( cuttingPlane );
if (ccOrientation == Rhino::Geometry::CurveOrientation::Clockwise)
{
offsetCurves = contourCurve->Offset ( cuttingPlane, offsetDistance, 1.0e-4, Rhino::Geometry::CurveOffsetCornerStyle::Round );
}
else if (ccOrientation == Rhino::Geometry::CurveOrientation::CounterClockwise)
{
offsetCurves = contourCurve->Offset ( cuttingPlane, -toolRadius, 1.0e-4, Rhino::Geometry::CurveOffsetCornerStyle::Round );
}
}
}
}
return ;
}
```

The array of `contourCurves`

usually has length 1 and generally the curve is closed. However, the offsetting does not work all the time. It would be great if you could tell me a way to solve this problem.

Thanks

Sunayana