Erik Kostson
Ansys Employee

I can not comment on the large script you have provided.

(perhaps other forum members can give some feedback here)

We can give some guidelines as I did before on what you can do to model this and check that it is working.

First on how to set up a connect between a tubular shell and a beam element (just like I proposed before) use this:

Again, as mentioned, keep the cerig away from the area of interest (so away from the area where you want to evaluate stresses).

The final model/'sanity' check is to put a load on the top of the beam and make sure the model behaves OK, and that all of the applied force, is reacted at the base fixed nodes (so applied force should be equal to reaction at base/fixed nodes). 

Hope this helps.