How to get coordinate system by selected edge in PartDoc using API ?

I met a trouble.  I need to transfer the user selected the workpiece of  all edges to output path by point.

then  feed into Robot Control System. But the robort's coordinate System with Solidworks coordinate System is not match.

So I how to get Solidworks coordinate System?

SolidworksApi macros