Material take-off density

Hello
I’m trying to get the total weight of an element, i has come up with this script for it. (Picture)
Some ideas on how to make it simpler? I especiale don’t like the group “Searching for density” and don’t believe it to be the smartest way off dying it.
Any ideas to make it simpler?? :slightly_smiling_face:
Udklip

Thanks
Nichlas