Tool to select three points to create a 3D cube

I am trying to develop a tool that will allow the user to select three points.
Something similar to this

.
I am referencing the custom tool from tutorials. Since I don’t get a Z coordinate for the 3rd point I am not sure how I would achieve this. Can this be done? If so how will I figure out the height of the cube?
So far I have been able to do this

Note I am just assuming the height here.

Any code sample will help, thank you.

1 Like

Thank you @dezmo.