CAM Pocket operation - BRepOffsetAPI_MakeOffset

I am trying to make pocketing operation of CAM systems. (See the attached picture)

So I need to make offset curves. First i tried to use BRepOffsetAPI_MakeOffset but it fails sometimes.

Also i think it is an expensive solution.

Actually this operation is 2d, i need to project all wires/edges to bottom plane and i need to work on 2d.

But there is no solution like BRepOffsetAPI_MakeOffset for 2d. BRepOffsetAPI_MakeOffset automatically trims the wires after offset.

I am thinking to use Geom2d_OffsetCurve but i need to make offset for all single edges after i have to trim all 2d curves.

 

Any ideas?

 

Also what is the best way to project TopoDS_Edge/TopoDS_Wire to a plane and get Geom2d_Curve?

BRep_Tool::CurveOnSurface / GeomAPI::To2d / GeomProjLib or other?

Attachments: