Development of algorithm for automatic selection of clamping surfaces