In old game called machinarium there is puzzle vaguely similar to your description, its called magnet puzzle. But your idea sounds pretty interesting too.
Thanks Limo :)