[Sidefx-houdini-list] Row of books, procedurally

Ammon Riley ammon at rhythm.com
Wed Feb 8 16:13:38 EST 2006


Peter Bowmar wrote:
> I want to create a row of books, with random widths, but they are all
> "touching" each other. [...]

It's a combination of a translate in the copy sop, and using the same
values in the box sop. Hscript attached.

Cheers,
Ammon

-- 
Ammon Riley
Senior Pipeline Programmer
Rhythm & Hues
310.448.7908
-------------- next part --------------
# Automatically generated script: Wednesday February 08, 13:12
\set noalias = 1
set saved_path = `execute("oppwf")`
opcf /obj

# Node books
opadd -n geo books
oplocate -x 0.982353 -y 1.39412 books
opset -S on books
opparm books use_dcolor ( off )
chautoscope books +tx +ty +tz +rx +ry +rz +sx +sy +sz +px +py +pz +scale
opset -d on -r off -h off -f off -y off -t off -l off -s off -u off -c off -C on -p on -e on -b off -x off books
opcf books

# Node box1
opadd -n box box1
oplocate -x -1.65735 -y 0.539706 box1
chblockbegin
chadd -t 0 0 box1 sizex
chkey -t 0 -v 1 -m 0 -A 0 -F '1+rand(stamp("../copy1", "book", 1))' box1/sizex
chadd -t 0 0 box1 sizey
chkey -t 0 -v 5.4 -m 0 -A 0 -F '5+rand(stamp("../copy1", "book", 1)*5)' box1/sizey
chadd -t 0 0 box1 sizez
chkey -t 0 -v 4 -m 0 -A 0 -F '4+rand(stamp("../copy1", "book", 1)*5)' box1/sizez
chadd -t 0 0 box1 tx
chkey -t 0 -v 0 -m 0 -A 0 -F 'ch("./sizex")/2' box1/tx
chadd -t 0 0 box1 ty
chkey -t 0 -v 0 -m 0 -A 0 -F 'ch("./sizey")/2' box1/ty
chadd -t 0 0 box1 tz
chkey -t 0 -v 0 -m 0 -A 0 -F '-ch("./sizez")/2+rand(stamp("../copy1", "book", 1)*2)' box1/tz
chblockend
opparm box1 size ( sizex sizey sizez ) t ( tx ty tz )
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -c off -C on -p on -e on -b off box1

# Node copy1
opadd -n copy copy1
oplocate -x -1.42206 -y -0.695588 copy1
chblockbegin
chadd -t 0 0 copy1 val1
chkey -t 0 -v 0 -m 0 -A 0 -F '$CY' copy1/val1
chadd -t 0 0 copy1 tx
chkey -t 0 -v 0 -m 0 -A 0 -F '1+rand($CY-1)' copy1/tx
chblockend
opparm copy1 ncy ( 11 ) t ( tx 0 0 ) stamp ( on ) param1 ( book ) val1 ( val1 )
opset -d on -r on -h off -f off -y off -t off -l off -s off -u off -c off -C off -p off -e on -b off copy1
oporder -e box1 copy1 
opcf ..

opcf /obj
opcf books
opwire -n box1 -0 copy1
opcf ..
opcf $saved_path


More information about the Sidefx-houdini-list mailing list