I built a magic 8 ball using iLogic, utilising the random number generator to create a random answer. You are probably wondering why… Well the answer is, why not! I got the idea while stuck in traffic, and it was really quick and easy to knock together, so I thought I would share it here.

The animated GIF below shows the magic 8 ball in action:

The iLogic code works by generating a random number between 0 and 19, which is mapped to one of the potential answers. This answer is then written to a user parameter called “answer”. The user parameter is used in a sketch, which is extruded to form the answer on the model.

I put this together in Inventor 2020, and have shared the model below.

Here is the iLogic code:

```'iLogic code by @ClintBrown3D, originally posted at https://clintbrown.co.uk/magic-8-ball-in-inventor-with-ilogic
'It's not pretty, but it works 🙂

'Generate a Random Number 0-19 and assign an answer to each value
RANDOMISER = Round(Rnd * 19)
If RANDOMISER = 0 Then
RANDOMISER = "Reply hazy, Try again"
Else If RANDOMISER = 1 Then
RANDOMISER = "It Is certain"
Else If RANDOMISER = 2 Then
RANDOMISER = "It Is decidedly so"
Else If RANDOMISER = 3 Then
RANDOMISER = "Without a doubt"
Else If RANDOMISER = 4 Then
RANDOMISER = "Yes - definitely"
Else If RANDOMISER = 5 Then
RANDOMISER = "You may rely On it"
Else If RANDOMISER = 6 Then
RANDOMISER = "As I see it, yes"
Else If RANDOMISER = 7 Then
RANDOMISER = "Most likely"
Else If RANDOMISER = 8 Then
RANDOMISER = "Outlook good"
Else If RANDOMISER = 9 Then
RANDOMISER = "Yes"
Else If RANDOMISER = 10 Then
RANDOMISER = "Signs Point To yes"
Else If RANDOMISER = 11 Then
RANDOMISER = "Reply hazy, Try again"
Else If RANDOMISER = 12 Then
Else If RANDOMISER = 13 Then
RANDOMISER = "Cannot predict Now"
Else If RANDOMISER = 14 Then
RANDOMISER = "Concentrate And ask again"
Else If RANDOMISER = 15 Then
RANDOMISER = "Don't count on it"
Else If RANDOMISER = 16 Then
RANDOMISER = "My reply Is no"
Else If RANDOMISER = 17 Then
RANDOMISER = "My sources say no"
Else If RANDOMISER = 18 Then
RANDOMISER= "Outlook Not so good"
Else If RANDOMISER = 19 Then
RANDOMISER = "Very doubtful"
End If

'Change the Camera View, set the answer
'update the model and move the camera to reveal the answer
InventorVb.SetViewCamera(ViewCameraOption.FitExtents, New Double() {12.630962504963469, 12.255962504963456, 12.255962504963469}, New Double() {0.375, 0, 0}, New Double() {-0.40824829046386291, 0.81649658092772626, -0.40824829046386318}, New Double() {10.965266851243031, 12.967785754450382})