Mcronin Posted June 14, 2004 Share Posted June 14, 2004 OK, I've got a piece of geometry with a point attribute I've painted called "mass". I bring this geometry into CHOPS with a geometry CHOP. I import this attribute as well with the attribute scope in the Geometry CHOP and rename the scoped attribute to "mymass". I guess this places the attribute into a channel. Since it's a point attribute, I end up with hundreds of channels; mymass1, mymass2, etc; one for each point, and I can see them all in the CHOPs channel display. The problem is I cannot seem to do anything with these channels in an expression. I'm trying to use this per point attribute inside an expression in a spring CHOP. I finally went to the textport and tried to echo the value of some of these channels and I kept getting "0" (I am in the spring CHOP in the textport). Then I decided to give chexist() a try on a channel I can see in my channel viewer in CHOPS. It returned 0. I really don't understand this at all... Can anyone tell me how to use these attributes within an expression in CHOPs? Quote Link to comment Share on other sites More sharing options...
Mcronin Posted June 14, 2004 Author Share Posted June 14, 2004 ...spoke too soon. Quote Link to comment Share on other sites More sharing options...
Mcronin Posted June 14, 2004 Author Share Posted June 14, 2004 Well I stayed up very late playing with this and this is what I surmised, but I still need help.... If I use chop() it gets the value from the specified channel, and I guess I can use $C after the channel name to get the proper index. The problem is, if I understand the CHOPs documentation correctly, there are actually two versions of the channel in each CHOP (incoming and outgoing). The chop() function evaulates correctly when echoed in the textport, but gives me a infinite recursion error when I try to use it in a CHOP that's being directed back into SOPland via a Channel SOP. Anone got any ideas at all? Quote Link to comment Share on other sites More sharing options...
Mcronin Posted June 14, 2004 Author Share Posted June 14, 2004 Wolfwood says "No I don't think so." He's smart, he's probably right. Perhaps a second opinion from someone smartier for confirmation? Here's a file to look at mass_per_point_in_CHOPs.hip Quote Link to comment Share on other sites More sharing options...
stevenong Posted June 14, 2004 Share Posted June 14, 2004 Hey Mike, I'll take a look at it later tonight at home. Cheers! steven Quote Link to comment Share on other sites More sharing options...
Mcronin Posted June 14, 2004 Author Share Posted June 14, 2004 Whoopsie, the spring CHOP that's trying to get the per point mass is looking for the wrong channel in the file I posted. I renamed the scope it should be "mymass$C" not "mass$C". A typo, just FYI. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted June 15, 2004 Share Posted June 15, 2004 Hey Mike, Here's a fix (i think ) Few notes (although I'm sure you'll see all this right away): *) I just import t[xyz] since I didn't see you use any of the other channels (this is just for my own sanity ). Anyway, this gives us 3 channels per point, but organized like this: all of tx, then all of ty, and finally all of tz -- i.e: three packed segments of $NPT length each. So if we needed to use the channel index ($C) as an index into point numbers, we'd need to use $C%($NC/3) -- where $NC is the num of chans in the chop ( = num_of_points_represented * 3). *) I mention the indexing mapping because I chose to look up the mass from the geometry itself instead of chops. So this solution (and something tells me there are others, as usual ) reads the mass through a point() function (instead of a chop() function). *) I added a bit of a floor to the mass (+0.2) just so it doesn't diverge ( I think it uses a simple Euler solver, so it can blow up reeeeal good in no time! ) I think that's all... Anyway; I don't know if this is the "best" solution, but it's the first one I tried (didn't want to spend time trying to figure out why it was recursing...), and it kind'a works, so I left it there. Hope it helps, Cheers! MikeChops1.zip 1 Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted June 15, 2004 Share Posted June 15, 2004 Jeezuhs! I'm working in /tmp and I keep overwriting the good one with the bad one... don't ask... <sigh> OK, here it goes again... (me fix it: jason) MikeChops2.zip Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted June 15, 2004 Share Posted June 15, 2004 (me fix it: jason) Hahaha! Great! Thanks Jason That was starting to get embarrassing... I hate computers! Quote Link to comment Share on other sites More sharing options...
Mcronin Posted June 15, 2004 Author Share Posted June 15, 2004 Brilliant! Where's there's a Marengo, there's a way. Now let's see if it's quick with heavier geometry. If I ever run into you in a bar, drinks are on me. Quote Link to comment Share on other sites More sharing options...
stevenong Posted June 15, 2004 Share Posted June 15, 2004 Mario beat me to it but not that I would have solved it. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted June 15, 2004 Share Posted June 15, 2004 Mario beat me to it but not that I would have solved it. Oh, yes you would have. Of that I have no doubt. There is one thing I *really* hate about my solution: it calls the point() function 3X as much as necessary -- that is a staggering amount of wasted computation. It means this puppy could run at least three times faster! Please go ahead and see if you can remove that eyesore. It would be nice to have a more elegant solution, as I think this little trick could have quite a few applications. Cheers! 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.