logix1390 Posted October 29, 2020 Share Posted October 29, 2020 hello. I am trying to set color to the points in the array that the nearpoints function found. I am trying to set it in a foreach loop. However, it is not working for some strange reason. I'm sure im going wrong somewhere. Here it is: i[]@ptarray = nearpoints(1, v@P, chf("maxDist"), 133); foreach(int pt; @ptarray){ setpointattrib(0, "Cd", pt, {1,0,0}); } foreachloop_setpointattrib.hipnc Quote Link to comment Share on other sites More sharing options...
bunker Posted October 29, 2020 Share Posted October 29, 2020 The logic doesn't work: nearpoints() will give you point numbers from the second input, they have nothing to do with the first input point numbers. Here are 2 simple ways of doing what you want, just testing if you get at least one point within a search radius. // 1) nearpoint int pt = nearpoint(1,@P,chf("maxDist")); if(pt!=-1)@Cd={1,0,0}; // 2) pointcloud if(pcnumfound(pcopen(1,"P",@P,chf("maxDist"),1))>0)@Cd={1,0,0}; Quote Link to comment Share on other sites More sharing options...
logix1390 Posted October 30, 2020 Author Share Posted October 30, 2020 @bunker Thank you for the examples Bunker. Makes sense now 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.