Jump to content
ejr32123

Deleting points by ID [solved]

Recommended Posts

Hello!

Would someone mind telling me what I am doing wrong? I wanted to delete some points from a flip sim by id. I went to a frame where I could see all the points I wanted to delete, then dropped a timeshift and froze to that one frame. I grouped all the points I wanted to delete and then blasted not group. That gives me a static frame of all the points I want to delete. I created a point wrangle will all the flip points going into my 1st input and then the points I want to delete going into my 2nd input. In the wrangle I typed:

if (@id == point(@OpInput2,"id",@ptnum)){
    removepoint(0,@ptnum);
}

For some reason that is not working. If I change the first line from @ptnum to an actual point number like "23", then it works perfectly. Since I want to compare all the points I am putting @ptnum. What am I doing wrong? I also tried just adding a blast node with this as the group to delete:

@id=`point("../blast1/",@ptnum,"id",0)`

 

Thanks

id.png

delete_by_id.hip

Edited by ejr32123

Share this post


Link to post
Share on other sites

Well, I am not sure why the method above doesn't work but I found an solution:

@stray = idtopoint(@OpInput2,@id);

if (@stray != -1){
    removepoint(0,@ptnum);
}

All the extra point from intput 1 receive a -1 because they don't exist in the second input. I can use that information to delete the strays.

Share this post


Link to post
Share on other sites

The first method is not working because you are importing the attribute "id" using ptnum.

For sure the first input of the wrangle has not the same number of points of the second input, so the id will not match and the points are not going to get deleted. 

When you need to compare two inputs based on an attribute like @id,@name, a very useful function is findattribval. This will return the point number of the point with the same id/name in the second input. If it can't find it, it will return -1.

  • Like 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

×