#!/usr/bin/env python
# Save this script in your current Maya project directory.
#
# M.Kesson
# Jan 18 2020
import prman
import sys
import string
ri = prman.Ri()
while True:
try:
line = raw_input().strip()
except EOFError:
break
else:
detail, data = line.split(' ', 1);
# Exampel:
# rad num_coords coords....
# 0.1 12 x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3
inputs = data.split()
rad = float(inputs[0])
num_coords = int(inputs[1])
coords = []
for n in range(num_coords):
coords.append( float(inputs[n + 2]))
# Open a rib stream
ri.Begin("-")
# Generate the geometry...
for n in range(0,len(coords),3):
x = coords[n]
y = coords[n+1]
z = coords[n+2]
ri.TransformBegin()
ri.Translate(x,y,z)
ri.Sphere(rad, -rad, rad, 360)
ri.TransformEnd()
# The "/377" escape sequence tells prman we have finished.
ri.ArchiveRecord(ri.COMMENT, "\n\377")
sys.stdout.flush
# Close the rib stream
ri.End()