CinnamonMetal Posted October 17, 2017 Share Posted October 17, 2017 Hi, I would like to know what I'm doing wrong. foreach(@primnum == @Cd.g ){ removeprim(0,@ptnum,1); } I want to loop over all primitives and those primitives which are a color of red, simply remove them ? Quote Link to comment Share on other sites More sharing options...
Sean-R Posted October 17, 2017 Share Posted October 17, 2017 (edited) Wrangles run over points/primitives in parallel, so you don't need to do a foreach. An if statement should do the job, something like: if(@Cd == {1,0,0}){ removeprim(0, @primnum, 1); } Edited October 17, 2017 by Sean-R Fixed bracket type on vector Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted October 17, 2017 Author Share Posted October 17, 2017 (edited) Thanks Although if there are shades of red, how do you force those shades to be red for VEX; without effecting the shading of the primitives ? I don't know whether that question is dumb but I'll put it out there anyhow Edited October 17, 2017 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
Sean-R Posted October 18, 2017 Share Posted October 18, 2017 What colour are the non-red primitives, if they are black then you would put this into the if statement: @Cd.x>0 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted October 18, 2017 Author Share Posted October 18, 2017 (edited) The color of the primitives are purplish pink so to speak. i@slider = ch("rmprimitives"); if(@Cd.x > 0){ removeprim(0,@slider,1); } When I adjust the @slider which is a ch() only one primitive is deleted ? Edited October 18, 2017 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
Sean-R Posted October 18, 2017 Share Posted October 18, 2017 Ok, if you only want to select the red prims and not the purple/pink ones then try this: @Cd.x>0 && @Cd.y+@Cd.z == 0 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted October 18, 2017 Author Share Posted October 18, 2017 1 minute ago, Sean-R said: Ok, if you only want to select the red prims and not the purple/pink ones then try this: What about vise versa; the purple/pink over the reds ? Quote Link to comment Share on other sites More sharing options...
Sean-R Posted October 18, 2017 Share Posted October 18, 2017 Quote i@slider = ch("rmprimitives"); if(@Cd.x > 0){ removeprim(0,@slider,1); } When I adjust the @slider which is a ch() only one primitive is deleted ? Have a read of the removeprim() help, you are currently manually selecting which prim to delete with that slider attribute. @primnum calls the current primitive that is being run through the code, it will then delete that primitive if it matches the if statement. Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted October 18, 2017 Author Share Posted October 18, 2017 5 minutes ago, Sean-R said: Have a read of the removeprim() help, you are currently manually selecting which prim to delete with that slider attribute. @primnum calls the current primitive that is being run through the code, it will then delete that primitive if it matches the if statement. @slider is a ch() function which is what I wanted. Although I want to select the purplish / pink primitives; it appears tough as the colors are not typical solid plain colors ? Quote Link to comment Share on other sites More sharing options...
Sean-R Posted October 18, 2017 Share Posted October 18, 2017 Then you want to compare the @Cd attribute with a vector, either with a hardcoded vector like in my original code or a channel like you set up with the slider attribute. So: v@minCd = chv("minCd") @Cd > @minCd What are you setting your slider attribute to? If you set the rmprimitives channel to something like "1" it ill only delete primitive 1. Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted October 19, 2017 Author Share Posted October 19, 2017 The slider attribute goes from 0-1 and as you mentioned it only deletes one primitive ? v@slder = chv("rmprimitives"); if(@Cd > @slder){ removeprim(0,@slider,1); } I'm trying to figure a way in Python to which I can select primitives with a range of a hue then export those as an attribute then I can use a ch() or chv() to control how many of those primitives get deleted. Quote Link to comment Share on other sites More sharing options...
Sean-R Posted October 19, 2017 Share Posted October 19, 2017 Ah, I'm not too savvy with Python so can't help you there. If you want to do it in vex you would probably want to do this in two nodes. The first one would be the same as you have there but instead of using the removeprim() you can either create a group or set and attribute. Something like this: if(@Cd > chv("Color")){ @group_deleteMe = 1; } ; You would then do the deleting in a second node, either by using a Delete node set to "Delete By Range", or by another if statement in a wrangle: if(@group_deleteMe && rand(@primnum) < chf("threshold")){ removeprim(0, @primnum, 1); } ; Hopefully someone can help with the Python side of things! 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.