You would have to visit the surfaces and then the edges for each surface within the part and then tie them together by subtracting the overlapping edges... and then scanning for the extrementy.
We have some function examples in CREOSON as a reference for the type of data you should be looking for. Look for: