[GCode::Object] Refactored measurement function to simplify it.