Jump to content

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
Link to comment
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.

Link to comment
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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...