How to delete using vertical coordinate

   4771   4   1
User Avatar
Member
2 posts
Joined: Aug. 2013
Offline
What I want to do is really simple. I have a bunch of primitives at varying heights (z is up in my Houdini, so the prims are at varying P values) that I copied downwards and I want to delete the prims that are below the origin/ground level. How do I do this?

Thanks in advance!
User Avatar
Member
9298 posts
Joined: July 2007
Online
- use Delete SOP set to Primitives, Delete By Expression: $TY<0

- or Attrib Wrangle set to Primitives (Primitive Wrangle) with code like: if (@P.y<0) removeprim(0, @primnum, 1);

- or you can use Blast SOP with group set like: @P.y<0
but that would work only on points (you'd need to set Group Type to Points as well )
if you want to use that for primitives you'd have to have primitive attrib representing position like primP, then @primP.y<0 would work
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
2 posts
Joined: Aug. 2013
Offline
Great, thanks!
User Avatar
Member
1 posts
Joined: March 2022
Offline
I have a similar issue, extruded a bunch of planes within a for each loop and now im trying to delete some by height, I used this, "vector bbmax = getbbox_max(0, "");
vector bbmin = getbbox_min(0, "");

f@height = @bbmax_y - @bbmin_y;

if(@height < 400) {
removeprim(0, @primnum, 1);
}"
but its getting rid of all the extruded geo. Please help me solve this, thank you ....I have no idea what I'm doing πŸ˜‚
User Avatar
Member
9298 posts
Joined: July 2007
Online
f@height = @bbmax_y - @bbmin_y;
is using attributes @bbmax_y and @bbmin_y that you didn't define so they are likely 0
you likely wanted to write
vector bbmax = getbbox_max(0);
vector bbmin = getbbox_min(0);
float height = bbmax.y - bbmin.y;
if( height < 400) {
    removeprim(0, @primnum, 1);
}
which you can also simplify to:
float height = getbbox_size(0).y;
if( height < 400) {
    removeprim(0, @primnum, 1);
}

which will delete the whole geometry if it's bbox y dimension is smaller than 400, is that what you are trying to do?
do you have a hip file?
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links