pelos Posted January 7, 2019 Share Posted January 7, 2019 i am creating a point in between 2 points and i want to transfer all the attributes to this new point, is there a way to find all the attributes that are in a point? like a list/array ["Cd", "P", "N"...] thanks =) Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted January 7, 2019 Share Posted January 7, 2019 string pointattribs[] = detailintrinsic(0,"pointattributes"); this gives you a list of pointattribs that allready exist, the problem is to create the attributes on your new point. The problem is that you dont know the attribtype (float,string,vector). You can somehow use attribsize combined with pointattribtype to check what it is. It becomes alot of if statements if you want it to be rock solid. Personaly i have ignored some types to make it simpler. void transferPoint(int input;int fromPoint ;int toPoint){ string pointattribs[] = detailintrinsic(input,"pointattributes"); foreach(string name;pointattribs){ int found = 0; int size = attribsize(input,"point",name); int type = pointattribtype(input,name); if(type == 0){ int attrib = pointattrib(input,name,fromPoint,found); setpointattrib(0,name,toPoint,attrib,"set"); } if(type == 1 && size == 1){ float attrib = pointattrib(input,name,fromPoint,found); setpointattrib(0,name,toPoint,attrib,"set"); } if(type == 2){ string attrib = pointattrib(input,name,fromPoint,found); setpointattrib(0,name,toPoint,attrib,"set"); } if(type == 1 && size >= 2){ if(size == 4){ vector4 attrib = pointattrib(input,name,fromPoint,found); setpointattrib(0,name,toPoint,attrib,"set"); } else{ vector attrib = pointattrib(input,name,fromPoint,found); setpointattrib(0,name,toPoint,attrib,"set"); } } } } 1 Quote Link to comment Share on other sites More sharing options...
pelos Posted January 7, 2019 Author Share Posted January 7, 2019 mmm sometimes i think the vex datatypes are very limited, i was expecting to get a list of classes such [ pointclass1, pointclass2, ] that later on with .notation i could get properties like the size, type, name etc.. (something i like a to work with python more than vex) thanks for sharing the snippet, i appreciate it =) Quote Link to comment Share on other sites More sharing options...
anim Posted January 7, 2019 Share Posted January 7, 2019 (edited) If you want to transfer just from 1 point you can provide that point as a reference for addpoint() function To get interpolated attributes between 2 or more points you can also just use Attribute Interpolate SOP after your wrangle to do the job based on arrays of point numbers and weights that you provide Edited January 7, 2019 by anim Quote Link to comment Share on other sites More sharing options...
pelos Posted January 8, 2019 Author Share Posted January 8, 2019 (edited) interesting how the groups as are also consider an attribute, was expecting an especial function for getting all the groups that a points is in. Edited January 8, 2019 by pelos 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.