Jump to content
Justin K

Remove Prim by Attribute Value (Resolved)

Recommended Posts

Hello all, 

I am trying to remove prims by an attribute value, here prim attr area. 

I understand you can do this with a blast, a delete, or a primitive wrangle.  I have tried all the methods, decided on the primitive wrangle, and for some reason I cannot delete by the attribute @area  (calculated in a measure sop), unless the condition is @area == 0, which is not what I want.  

Code is really simple, Im just confused as hell as to why it wont actually work.  

I have a primitive @area attribute then run the following

if(@area < .1)
removeprim(geoself(), @primnum, 1);

 

What gives?  

Please check scene file if you can!

I have used this setup in the past successfully, it doesnt seem to be working here.  

Many thanks!

Modeling_03_Projection_upl.hipnc

Edited by JKeil

Share this post


Link to post
Share on other sites

I did not dig deep into it, but it seems to work, if you set the condition to suit just some of the primitives. See also the picture and Geometry Spreadsheet.

if(@area < 7.65361e-05)
removeprim(geoself(), @primnum, 1);

 

area.PNG

Share this post


Link to post
Share on other sites
5 minutes ago, ikoon said:

I did not dig deep into it, but it seems to work, if you set the condition to suit just some of the primitives. See also the picture and Geometry Spreadsheet.


if(@area < 7.65361e-05)
removeprim(geoself(), @primnum, 1);

 

area.PNG

Thanks ikoon--  reinforces the idea of being able to at least delete prim values set to 0. 

I just dont understand why I cant delete by a range of values more arbitrarily-- why would I have to specify a value that already exists within the attribute? This value might change depending on parameters :huh:  

Share this post


Link to post
Share on other sites

I am not sure if I understand. You were doing it right, 0.1 was just too big number. If you want a procedural number to delete by ... for example average between the minimal (nonzero) area and the maximal area, you may do this. Btw I am used to brace { } the the multiline if statement.

Edit: I had it running on points in the original reply.

 

 

Modeling_03_Projection_upl-2.hipnc

less then average area.PNG

Edited by ikoon

Share this post


Link to post
Share on other sites
59 minutes ago, ikoon said:

I am not sure if I understand. You were doing it right, 0.1 was just too big number. If you want a procedural number to delete by ... for example average between the minimal (nonzero) area and the maximal area, you may do this. Btw I am used to brace { } the the multiline if statement.

Edit: I had it running on points in the original reply.

 

 

Modeling_03_Projection_upl-2.hipnc

less then average area.PNG

  As you just said, I now realize that the problem wasnt as much the approach as the values.   The number value I needed was very specific.  After the zero value faces were deleted, I needed a number slightly less then the maximum as a filter: too far below the value and I would have no result simply because the areas of the  primitives were all fairly close value wise to the maximum).   Slightly above the maximum and I would obviously have no primitives left at all!     I added a channel to replace the /2.  In the future, I will utilize the min or max field set up you have here--and include braces B).  

Many thanks for your help!

 

Ive attached the result and a pic--  I used this setup to then apply a geo setup along the uvs of another geo--inspired by the entagma fabric tutorial 

 

 

Screen Shot 2018-02-02 at 11.57.06 AM.png

Modeling_03_Projection_pul.hipnc

Edited by JKeil
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×