David Gary Posted January 14, 2004 Share Posted January 14, 2004 Hi! Is there an easy ( or less easy) wayto get the number of groups in a specified SOP? ( in either expression language, hscript or VEX). Thanks for help or tips! Quote Link to comment Share on other sites More sharing options...
thekenny Posted January 14, 2004 Share Posted January 14, 2004 the textport is your friend exhelp primgrouplist. -k Quote Link to comment Share on other sites More sharing options...
David Gary Posted January 14, 2004 Author Share Posted January 14, 2004 Didn't find primgrouplist! Aren't you thinking of primlist? But primlist requires the name of one specific group... Quote Link to comment Share on other sites More sharing options...
michael Posted January 15, 2004 Share Posted January 15, 2004 I don't think there is.. you could echo opinfo and read it..but that doesn't get you very far... Quote Link to comment Share on other sites More sharing options...
old school Posted January 15, 2004 Share Posted January 15, 2004 You could use the opinfo -v operator_name command to print out the info for that node. From there, you should see the group listed in amongst the other data, consistently formatted. You can then strip out just the group names in to a string variable then run argc($group_list) to count the number of groups. -jeff Quote Link to comment Share on other sites More sharing options...
David Gary Posted January 15, 2004 Author Share Posted January 15, 2004 Thanks very much, old school! Quote Link to comment Share on other sites More sharing options...
edward Posted January 16, 2004 Share Posted January 16, 2004 primgrouplist() and pointgrouplist() expression functions were added after 6.1 got released. Quote Link to comment Share on other sites More sharing options...
thekenny Posted January 17, 2004 Share Posted January 17, 2004 oops. forget i mentioned it. do that stuff old school said. [banff!] -k Quote Link to comment Share on other sites More sharing options...
Dries Posted January 29, 2004 Share Posted January 29, 2004 I've often thought about string handling bits and blobs in houdini but I usually give up quickly because I'm not sure on how to do it. So how exactly would you extract "the 2nd word of the 3rd line" for example? Say that you want to include something simple in a callback script. Or do you use external unix scripts for this? Quote Link to comment Share on other sites More sharing options...
old school Posted February 3, 2004 Share Posted February 3, 2004 For single line processing, hscript is not too bad. To grab the second word out of a line, you can use the ever so handy arg( string value, float offset) expression where the string is your text and offset is the number of words starting from 0 left to right: / -> set myvar = "Long live Arctor the great!" / -> echo `arg( $myvar, 1)` live / -> echo `strcat( arg( $myvar, 1), arg( $myvar, 4)` live great As you can see, strcat() concatenates two strings together. strcat() is pretty bullet-proof but a bit limiting. You can use a "c-like" string addition as follows: / -> echo `arg($myvar, 1) + arg($myvar, 4) + " Arctor"` live great Arctor You can go as long as you need. I needed the double quotes around " Arctor" to keep the space. Now to process line information inside hscript, you can use a foreach() loop and treat every element separately, line by line extracting and running what you need. If you need to process opscript dumps from operators on disk, then learn a tool like awk and sed, perl, python or any scriptable text formattor editor and use hscript unix commands to execute them. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.