VEX Syntax issues

   Views 3839   Replies 4   Subscribers 1
User Avatar
Member
2 posts
Joined: 7月 2017
Offline
I'm trying to group primitives with length more than specified value. For that i used Attribute Wrangle with this VEXpression:

`f@group_t = length({@XMAX-@XMIN,@YMAX-@YMIN,@ZMAX-@ZMIN})<0.5;`

But i'm getting this error message

Warning: Errors or warnings encountered during VEX compile:
/obj/subnet1/frames/attribwrangle1/attribvop1/snippet1: Syntax error, unexpected identifier. (1,28)..

But at this position(1,28) is only middle of the @XMIN attribute and nothing else. And i can't get what's wrong with this.
User Avatar
Member
1743 posts
Joined: 3月 2012
Offline
The syntax error is because the {0,0,0}syntax only works for numeric literal values. You can use the set(0,0,0)syntax instead.

However, that will probably only give the results you're looking for if you have those 6 attributes on your input geometry. If you're looking for the size of the diagonal of the bounding box of a primitive, you can try:

f@group_t = length(getbbox_size(0,itoa(@primnum)))<0.5;

Hopefully that helps.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
2 posts
Joined: 7月 2017
Offline
Thanks, this is exactly what i needed.
User Avatar
Member
1 posts
Joined: 12月 2019
Offline
-I all I have a problem qith this formula on attrib wrangler:

int pcloud = pcopen(0, "P", @P, 2.1, 10);

if (pcnumfound(pcloud) < 5);
}
removepoint(0, @ptnum);
{

-the report error is :
Invalid source /obj/origin_box/attribwrangle1/attribvop1.
(Error: Syntax error, unexpected '(', expecting identifier or '['. (5,16)).
any help will be apprecited. Thank you.

Emmanuel
User Avatar
Member
4832 posts
Joined: 2月 2012
Offline
Hi,

You have to remove ; after pcnumfound:

int pcloud = pcopen(0, "P", @P, 2.1, 10);

if (pcnumfound(pcloud) < 5) {
    removepoint(0, @ptnum);
}
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
  • Quick Links