Triplett Posted June 9, 2021 Share Posted June 9, 2021 I am certain that this is a simple question, but I am still struggling with it. I have a vector attribute called "centroid" on a bunch of primitives, and I want to create a point cloud whose P values match the centroid positions. I could use any of David Kahl's methods here https://www.youtube.com/watch?v=iyZ8dIqJ47U if I wanted a point at the centroid of every prim, but instead I have several prims with the same "centroid" vector because I obtained it by running "extract centroid" over prim pieces via a for-each loop. My instinct is that this is a super simple VEX expression like: @P = @centroid; But that is obviously wrong. I also tried the set expression, but that didn't seem to work either. Is this like "promoting" an custom attribute into an intrinsic one like "P?" Quote Link to comment Share on other sites More sharing options...
Noobini Posted June 9, 2021 Share Posted June 9, 2021 too long to read, just upload your file. Quote Link to comment Share on other sites More sharing options...
Fenolis Posted June 10, 2021 Share Posted June 10, 2021 Would this method not be viable? convert_prims_to_pc.hiplc Quote Link to comment Share on other sites More sharing options...
Triplett Posted June 10, 2021 Author Share Posted June 10, 2021 Fenolis: Thanks, that works great if you want a point at each prim. What you shared looks like one of David Kahl's methods above. The issue I have is the centroid attribute is the same for different sets of prims. In pseudocode what I want is v@P = v@Centroid, so all of the prims or points could be moved to their corresponding centroid positions. Unfortunately I can't get that syntax right. Noobini: I'd like to share the file, but it uses a big json file and a bunch of other dependent files in order to create the attributes. It is too big to upload and download all that. Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted June 10, 2021 Share Posted June 10, 2021 (edited) Hi, you can use addpoint() function on each prim to add the vector attribute as point. You can remove the prims after this and you can also apply fuse to remove duplicates. You can also apply the add function on subsets (groups) if needed. prim_vector_attribute_add.hipnc Edited June 10, 2021 by Aizatulin Quote Link to comment Share on other sites More sharing options...
Triplett Posted June 11, 2021 Author Share Posted June 11, 2021 @Aizatulin - That was it! addpoint() is exactly what I needed. Thank you. 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.