Open the scene spheres.scn from this issues CD. Press [Alt] +  to open the Script Editor and from the File menu choose Preferences... Change the Scripting Language to JScript and check the Log Commands checkbox. Close the PPG. Now, let’s have a quick look at the ingredients that you’ll be using in the script. Select an object, press [Ctrl] + [D] to create a duplicate, from the MCP > Transform menu choose Match All Transforms and pick any object. Then press [Del] to delete it. The script editor has just logged all the commands you need. The next step is to add which objects to replace, which objects that will be used to replace them and a random function that will choose one of these objects. The final script will look like this.
Change the Duplicate command to Clone (or Instantiate if you’re using models) to create clones of the replacing objects instead of duplicates.
Read the full post>>