This is a remix of ShaneTalksTech Clamp on Desk Cup Holder. His didn't fix my desk due to a support bar and my desktop being only 5/8 inches ~15mm thick. I deepened the the mouth of the clamp and moved thread out so it could clear the bar which is about 34 mm from the edge of my desk. I also lengthened the end of the bolt shank (no thread) so it would make solid contact with the bottom of my desk. Because there is no thread on the end of the bolt it may not work with thicker desks, but it's the same thread as his bolt so you could just use that.
After my print I thought the opening for the cup handle felt a little week, though that could be due to the amount of infill I used. So I included an additional holder that doesn't have that opening if you like me have a tumbler without a handle. I haven't printed that so it's untested.
Printer Settings
I also added a piece of adhesive backed rubber to the top underside of the clamp for a little more friction.
The author remixed this model.
My desk has a bar along the bottom that the bolt didn't entirely clear, so I made the clamp deeper. The outside edge of the bolt sits roughly 34 mm from the edge of the desk.
The bolt was also too short to make contact with the bottom of my desk which is about 5/8 inches ~15 mm. I lengthened the bolt so it makes good contact. I didn't have the Blender experience to continue the thread over the extended length. I just extended the end of the shaft, so it may have trouble with thicker desks.
I also included a second cup holder model that does away with the opening for handles.