VEX sentence of Wrangle.
Global Varialbles that frequently used
//SOP @Cd //Point Color @P //Point Position @v //Point Velocity @ptnum //Processing Point Number @pscale //Particle Scale @numpt //Total Point Number @N //Normal //Time @Frame; //Frame @Time; //Time
Attribute read and write
//By Type
f@Float = 1.0; //float
i@ID = @ptnum;  //int
v@Vec = {0,1,2};//vector
u@UV = {4,5};   //vector2
s@Text = "name";//string
//Individual access (Position)
@P.x = @P.x + rand(@ptnum);
@P.y = anoise(@P.y);
@P.z = fit01(@P.z,0,5);
//Individual access (Color)
@Cd = {1,0,0};
@Cd.g = @Cd.g+1;
Add Point
vector pos = {0,0,0};
addpoint(geoself(), pos); 
Add Primitive(Line)
int prim = addprim(geoself(), "polyline"); addvertex(geoself(), prim, 0); addvertex(geoself(), prim, 1);
Add Primitive(Face)
int nPoly = 3;
if(@ptnum%3 == 0){
    int prim = addprim(0, "poly");
    for(int i=0; i<nPoly; i++){
        addvertex(0, prim, @ptnum+i);
    }
}
(Create the Face everty ptnum order three poins from the input point)
Remove Point
if (@ptnum%5==0){
    removepoint(geoself(),@ptnum);
}
(remove the point that ptnum is multiple of 5 )
Remove Primitive
if (@primnum%2==1){
    removeprim(geoself(), @primnum, 1);
}
Create Group
if(@ptnum &amp;amp;amp;lt; chi('threshold')){
    i@group_mygroup=1;
}
if(@ptnum == 10){
    i@group_mygroup=0;
}
Set and see the group in the form of [@group_*].
Any of  group name to *.
this group is int type.
Check if they belong to a group・・・ [@group_*==1].
Add to group・・・[i@group_*=1]
Remove from the group・・・[i@group_*=0]
Create Group (other method)
string gpName = &amp;amp;amp;quot;testGroup&amp;amp;amp;quot;;
for(int i=0; i&amp;amp;amp;lt;@numpt; i++){
  if(@P&amp;amp;amp;gt;0){
        setpointgroup(geoself(), gpName, @ptnum, 1 ,&amp;amp;amp;quot;set&amp;amp;amp;quot;);
    }
}
When making groups of primitive “setprimgroup”.
Create Parameters from the description

Samplefile
WrangleSample_01.hiplc
Version:Houdini 14
Wrangle method of description must be careful because there is a case to be changed depending on the version.







Comment