-1

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?

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.

[TREES.MODEL_SCALE_X, TREES.MODEL_SCALE_Y, TREES.MODEL_SCALE_Z, TREES.MODEL_TRANSLATE_Z] = Math.random()*3+1

  • 1
    What language is this? It doesn't look like python. The easiest way would be to set a variable equal to your random number, and then just assign each value one by one. – jaypb Oct 10 '16 at 20:12

1 Answers1

0

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

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

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

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
B. Eckles
  • 1,626
  • 2
  • 15
  • 27