
This is admittedly a bit of a random idea! This blog post shows how to flip a coin using iLogic in Inventor.
UPDATE: There is a new version that uses a 3D Coin in an Inventor .IPT; available here.
The idea came from my previous blog post, looking at generating random numbers to create colours. Initially I thought it would be interesting to create a form and to use an enabling parameter to swap out an image, but I decided that it would be better to fire up a website containing the image, it also made this simpler to share, as it is only a few short lines of code.
Below is an animated GIF showing the code in action:

Here is the iLogic code:
'iLogic code by @ClintBrown3D, originally posted at https://clintbrown.co.uk/heads-or-tails 'Generate a random number (In this case 1 or 0) HEADSorTAILS = Round(Rnd * 1) 'If the result is 0 then the answer is Heads, if the result is 1 , then the answer is tails If HEADSorTAILS = 0 Then : GoTo HEADS: Else : GoTo TAILS: End If HEADS:'HEADS System.Diagnostics.Process.Start("https://clintbrownblog.files.wordpress.com/2019/05/quarter-heads-min.jpg?resize=300%2C300") Return TAILS:'TAILS System.Diagnostics.Process.Start("https://clintbrownblog.files.wordpress.com/2019/05/quarter-tails-min.jpg?resize=300%2C300")
You must be logged in to post a comment.