rich_lord Posted June 18, 2016 Share Posted June 18, 2016 Im creating and destroying alot of points in point wrangles. Because I need to be able to uniquely identify them, I want to create an id attribute on each one. I thought about creating a global number that counts up as new points are created. I tried a detail attribute that I could increment every time I needed, and then read in when I needed a new id. That doesn't work though as I'm running in a point wrangle. I cant read and write the detail attribute within my loops, across multiple points. Are there any good tips for creating unique ids on points? Quote Link to comment Share on other sites More sharing options...
rich_lord Posted June 20, 2016 Author Share Posted June 20, 2016 Im going to assume that, due to the way the point wrangle works, removing and adding points, while giving them unique id's, isnt a good idea. I rewrote my code to work in a detail wrangle, so that I can accurately count the number of loops I'm creating, and the number of points I'm adding and removing. In that way I can use a detail attribute that counts up to ensure unique ids. Quote Link to comment Share on other sites More sharing options...
djiki Posted June 20, 2016 Share Posted June 20, 2016 You didn't precisely describe the task you want to accomplish. But be aware of the following (and that is by Houdini limitation) deleting points inside Point VOP (or Point wrangle) node will be done as the last task of that point VOP (or wrangle) node doesn't matter the line with delete command in wrangle code is. Same apply for adding points. So you can not access (write to or read) attribute on just created points inside same wrangle node. Think on that like this way: DeletePoint will just mark points for deletion and real deletion will happen after whole code from wrangle node is processed. About creating unique ID. Yes, you can create a detail attribute where you will keep track of last ID (maximal) value you achieved. And every time you create new points just pick that value in some local value of wrangle node, do iterate and increment that local value with every point created and at the end of wrangle node update detail attribute. That will work but it is not preferable way. It forces serialization and doesn't fit well in parallel, multi threaded execution. Do you aware of this: Delete Point with let say ID==100 and CreatePoint with lat say ID=123 at coordinate {5,6,7} is the same as Change ID of Point with ID==100 to 123 and set it at position {5,6,7} No delete and no create operations Quote Link to comment Share on other sites More sharing options...
rich_lord Posted June 21, 2016 Author Share Posted June 21, 2016 That's a good point about changing ids rather than deleting/removing points. Thanks for the insights! 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.