hasObject does search recursive only in groups, but a body is not a group. Hence for sketches within a body this will always return false. Annother logic must be used to detect sketches in bodies.