LOPs - instancer reading external prototypes

from random import random, randint
import hou
from hou import hmath
from pxr import UsdGeom, Gf

node = hou.pwd()
stage = node.editableStage()

numinstances = 20

prim = stage.DefinePrim("/pointinstancer", 'PointInstancer')
pi = UsdGeom.PointInstancer(prim)
rel = pi.GetPrototypesRel()
rel.AddTarget("/cube1")
rel.AddTarget("/sphere1")
rel.AddTarget("/torus1")

protoindices = pi.GetProtoIndicesAttr()
protoindices.Set([randint(0,2) for x in range(numinstances)])

pos = pi.GetPositionsAttr()
pos.Set([[float(x * 5), 3.0, 0.0] for x in range(numinstances)])

rot = pi.GetOrientationsAttr()
rot.Set([Gf.Quath(*list(hou.Quaternion(hmath.buildRotate(random()*180, random()*360, random()*270)))) for x in range(numinstances)])

scl = pi.GetScalesAttr()
scl.Set([[random()*2+0.2]*3 for x in range(numinstances)])