Erik Kostson
Ansys Employee

Distributed mass option (it uses surf154 or surf155/156 in the background) can not be offset.

One way which I have never used and that might be OK, is to use mpc184 with offset mass21 elements.

Here is how it would like:
We can not advice on how to script this, but other users might be able to help here.

The psevdo commands(APDL) snippet would be something like this:

Define mass21 and mpc184 elements
Define density for mpc184
Select all nodes for beams
Loop through beam nodes
Generate offset nodes (green dots shown above)
Attach/add mass21 to these new offset nodes (mass21 can be as mentioned with mass only in one direction)
Create mpc184 rigid links between beam nodes (red dots), and the new offset nodes (green dots).

All the best