Same attribute for 4 different classes
<p>I have a problem for a script in a 3D GIS software (Infraworks).
I need to say to a 3D model to have the same random value for 4 different attributes, x,y and z scale and z movement.
Someone knows how to do it?</p>

<p>At the moment I wrote this script, but cause I'm not a proper programmer I don't know if it's the right way.</p>

<p><strong>[TREES.MODEL_SCALE_X, TREES.MODEL_SCALE_Y, TREES.MODEL_SCALE_Z, TREES.MODEL_TRANSLATE_Z] = Math.random()*3+1</strong></p>

<p>Assuming I understand you correctly, you'll want to first create the value, then store the same one into all four places:</p>

<pre><code>random_value = Math.random()*3+1

TREES.MODEL_SCALE_X = random_value
TREES.MODEL_SCALE_Y = random_value
TREES.MODEL_SCALE_Z = random_value
TREES.MODEL_TRANSLATE_Z = random_value
</code></pre>

<p>Also, in Python it's actually the <code>random</code> module which you'd want, not "Math". So the following would actually be what you want in Python:</p>

<pre><code>import random
random_value = random.random()*3+1

TREES.MODEL_SCALE_X = random_value
TREES.MODEL_SCALE_Y = random_value
TREES.MODEL_SCALE_Z = random_value
TREES.MODEL_TRANSLATE_Z = random_value
</code></pre>

python 3d gis autodesk