Coordinate Sytem - Orentation with Line selection

Hi All,

I am trying to findout a way to Create / Modified Cooridinate system Orentation with Line slection. Can anyone has any idea on this.

I tried (get from API help) to use as below but i am not able to succeed.

' Assume a vertex was selected for the origin

Set so(0) = swSelMgr.GetSelectedObject6(1, -1)

' Assume one entity (point, line/edge, plane/face) was selected for the x axis

Set sx(0) = swSelMgr.GetSelectedObject6(2, -1)

' Assume two entities (point, line/edge, plane/face) were selected for the y axis

Set sy(0) = swSelMgr.GetSelectedObject6(3, -1)

Set sy(1) = swSelMgr.GetSelectedObject6(4, -1)

' Try getting additional selected entities for the z axis

Set sz(0) = swSelMgr.GetSelectedObject6(5, -1)

Set sz(1) = swSelMgr.GetSelectedObject6(6, -1)

vo = so

vx = sx

vy = sy

vz = sz

swModel.ClearSelection2 True

' Create coordinate system

Set swFeat = swFeatMgr.CreateCoordinateSystem(so(0), (vx), (vy), (vz))

SolidworksApi macros