what does escape @ with a backslash mean in VEX?

   1944   2   1
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
I've run into a problem.
I'm using a primitive wrangle with a minpos(geo, group, position) function, where I'd like to limit the Geometry used in the minpos function to the current primitive being evaluated in the primitive wrangle.
The documentation ways, `ad hoc` group creation inside this function should be possible with @, but “the @ may need to be escaped with a backslash in a Wrangle snippet”.

What I tried is: “\@primnum”, but that didn't work.

If anyone knows how this code should look, so it works, I'd really appreciate an example of how escaping with a backslash should work or how to limit the Geometry in the minpos function to just the single primitive, that's being evaluated right now.

Thanks.
Cheers,
Ivan
User Avatar
Member
9379 posts
Joined: July 2007
Offline
it didnt work because primnum is not an attribute, you simply need to put a string that would be valid in a group parameter
and @primnum is not, not even @primnum=1, but you can directly type 1 or 1-10

so to get the same you can just use itoa(@primnum) so that it inserts string version of your current prim like “1” and use that as a group for example

of course you can use adhoc groups if you want to group by some existing attribute also and I think nowadays you don't even have to escape the @
Edited by tamte - Aug. 5, 2020 13:03:40
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Thanks for the quick reply Tomas, it seems pretty obvious, now that you've explained it, but I probably wouldn't have gotten there on my own. itoa(@primnum) does exactly what I was hoping to accomplish.

Cheers,
Ivan
  • Quick Links