How to realize the available function?

How to realize the function in above picture through API if I have a group of points at hand? thanks. Could anyone paste some code?

SolidworksApi macros