How to use solidworks api to complete the cross-line in the sketch automatic trim entities?

Hello,

       Everyone !   

       I created some  centerlines  in solidowrks sketch,and Offset them in another sketch to get some cross-line,

       then I want to use the API to write an algorithm for automatic  trim entities to make the sketch  is a closed profile.

       I do not know whether it is feasible , who can do me a favor?


    

SolidworksApi macros