neblina Posted November 22, 2017 Share Posted November 22, 2017 Hello everyone, here's the issue I'm encountering: From a set of points I'd like to delete all but one of them, and with a slider on the upper level be able to select which. I managed to to that, but if the slider has a value bigger than the total number of points I have a problem. So I thought about maybe clamping the slider value between 0 and the total number of points. I don't know if that is possible, but here's what I tried so far: Attribute Create node (posAttr) with a detail attribute (posAttr) with the following value: clamp(ch("../posParm"), 0, $NPT) After that a Delete node, Delete by Expression, Filter: $PT == detail("../posAttr", "posAttr", 0) I expected this would evaluate the value coming from the ch in the upper level and always clamp it between 0 and the number of points, but instead it does nothing. If the value goes past the number of points it still 'crashes'. If this is a completely wrong approach, how else could I accomplish this? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Parboil Posted November 22, 2017 Share Posted November 22, 2017 Hope this helps. I used a detail wrangle. int pt = chi("center_pt"); int upper = clamp(pt + chi("upper"), 0, npoints(0)); int lower = clamp(pt - chi("lower") -1, 0, npoints(0)); for (int i = lower; i< upper; i++){ removepoint(0, i); } Quote Link to comment Share on other sites More sharing options...
Noobini Posted November 22, 2017 Share Posted November 22, 2017 try this ? clamp.hipnc Quote Link to comment Share on other sites More sharing options...
neblina Posted November 23, 2017 Author Share Posted November 23, 2017 Yes, thank you. Somehow I figured this out yesterday, subtracting 1 from the $NPT does the trick. clamp(ch("../posParm"), 0, $NPT - 1) Just like your example, @Noobini. 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.