andmotion Posted August 30, 2019 Share Posted August 30, 2019 Hi there!!!!! It must not be that much complicated but I dont know how to sort it out atm:( I have a grid which I scattered with bunch of points and then add the color to them (1,0,0). Then I put detail wrangler and wrote this in it: int nbrs[] = nearpoints(0,@P,chf("radius"),10); //i[]@a = nbrs; foreach(int nb;nbrs){ //v@c = point(0,"Cd",nb); } How can I get access to the Cd inside the loop so I can change the Cd just for the nb points? Thanks for any clues:) Quote Link to comment Share on other sites More sharing options...
anim Posted August 30, 2019 Share Posted August 30, 2019 why Detail Wrangle? there is no @P in Detail Wrangle, so you are just searching points around 0,0,0 v@c would assign the value to detail attribute c so you probably ant to use setpointattrib() but it seems that what you are doing would be more efficient in Point Wrangle, can you describe what are you actually trying to do? Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted August 31, 2019 Share Posted August 31, 2019 Actualy there is a @P in the detail wrangle, its the centroid of your geometry. Can be useful in a foreach sop for example. But i dont think it allways have been like that. so as Anim says, use setpointattrib. vector color = point(0,"Cd",nb); vector new_color = ??; setpointattrib(0,"Cd",nb,new_color,"set"); Quote Link to comment Share on other sites More sharing options...
andmotion Posted August 31, 2019 Author Share Posted August 31, 2019 16 hours ago, anim said: why Detail Wrangle? there is no @P in Detail Wrangle, so you are just searching points around 0,0,0 v@c would assign the value to detail attribute c so you probably ant to use setpointattrib() but it seems that what you are doing would be more efficient in Point Wrangle, can you describe what are you actually trying to do? Hey Anim, You are absolutely right that I could run something like this in Point wrangle and I would get the result : int sample = nearpoint(1,@P); vector pos = point(1,"P",sample); float dist = distance(@P,pos); if(dist<chf("treshold")){ @Cd = set(0,1,0); } In this example I added single point in to 1 wrangle input and scattered grid into input 0. Thanks Quote Link to comment Share on other sites More sharing options...
andmotion Posted August 31, 2019 Author Share Posted August 31, 2019 14 hours ago, ThomasPara said: Actualy there is a @P in the detail wrangle, its the centroid of your geometry. Can be useful in a foreach sop for example. But i dont think it allways have been like that. so as Anim says, use setpointattrib. vector color = point(0,"Cd",nb); vector new_color = ??; setpointattrib(0,"Cd",nb,new_color,"set"); Hey, Having this code : int nbrs[] = nearpoints(0,@P,chf("radius"),200); i[]@a = nbrs; int w = @a[1]; //printf("%g",w); foreach(int nb;nbrs){ vector color = point(0,"Cd",nb); vector new_col = set(0,1,0); setpointattrib(0,"Cd",nb,new_col,"set"); } It's doing what I was aiming for. The only concern I have now about pointattributes[Cd] and pointattributes[P] in detail wrangle..... You know when we set the groups before going into wrnagle we can access these group arrays in detail wrangle by having detailintrinsic and expandprimgroup. How can we get access to the pointattribute[Cd] or pointattribute[P] ? They seems to me (I am most likely wrong:)) as a arrays keeping the numbers but I could not find the way how to access them and modify.... Thanks Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted September 2, 2019 Share Posted September 2, 2019 in the nearpoints function you can set a group to search through. nearpoints(0,"group",@P,maxdist,maxpoints); And as of now you make a vector "color" and dont use it, so its redundant, you can remove that line. Quote Link to comment Share on other sites More sharing options...
andmotion Posted September 2, 2019 Author Share Posted September 2, 2019 1 hour ago, ThomasPara said: in the nearpoints function you can set a group to search through. nearpoints(0,"group",@P,maxdist,maxpoints); And as of now you make a vector "color" and dont use it, so its redundant, you can remove that line. Hey Thomas:) Thanks for you advice. I thought but might be wrong obviously that I will need to get the Cd v first from the points in [] and then set new @ on them? I cant really see the reason why to use "group" in my scenario. My main concern is How to get access to the pointattribute[Cd] or pointattribute[P] in the detail wrangler??? Thanks Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted September 2, 2019 Share Posted September 2, 2019 point() is what gives you the current value, and setpointattrib() is what you can use to set a new value. Quote Link to comment Share on other sites More sharing options...
andmotion Posted September 2, 2019 Author Share Posted September 2, 2019 I uploaded hip file along with screen shot to explain better what I am after. My wondering is / Is it a way to open these intrinsic arrays in Detail Wrangle ? Thanks Growth .hipnc 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.