Created points are not in proper order

   912   4   0
User Avatar
Member
5 posts
Joined: Feb. 2024
Offline
I'm making a little Digital Asset that adds a variable number of windows to a primitive. I do this by adding segments to the primitive, creating central points for each segment and using copy to points to place my windows. This works great.

I recently added a parameter to add empty segments on either side and I used an attribute wrangle to simply remove the extra points. It works, except when I want the rightmost space empty (centerOffset = 1), because when I create a central point for each wall segment, the rightmost one isn't the last one as one would expect.

I could cheat it, but I would rather find an elegant solution to this problem, so I'm open to suggestions.

Attachments:
Screenshot 2025-08-08 09.01.43.png (637.9 KB)
Screenshot 2025-08-08 09.03.48.png (664.6 KB)
Screenshot 2025-08-08 09.06.36.png (646.5 KB)

User Avatar
Member
2152 posts
Joined: Sept. 2015
Offline
If you posted a hip file, a number of people are likely to return a hip with different solutions you can choose from that you feel suits your overall purpose the best.

Having said that, in most cases doing more 'prework' before your operations like assigning windows or deleting center points can help much.

In this case you can assign an attribute id number like i@Center_Id = @ptnum; before any operation or some other number other than @ptnum based on your own routine like say position in relation to your planned model space or whatever. Then create a second attribute like i@Gets_Window = -1;

After, you can use something like a multiparm to assign windows to specific i@Center_Id, i.e. choose a i@Center_Id number and reassign it's value to something other than it's existing -1 value.

After, any point which still has a -1 value automatically gets deleted and any remaining points that don't have -1 get a window copied too.

This example is more complicated than needs to be, but should give you an idea of how pre-work set up can help you down the line for other operations. And again, post a hip and I'm sure someone will be able to offer a simpler solution other than my suggestion or what you currently have after being able to look through what you have done in more detail than a screen shot.
User Avatar
Member
5 posts
Joined: Feb. 2024
Offline
Thank you BabaJ for your answer. I removed all the irrelevant stuff from my file, so I hope my files can be useful, as you suggested. For simplification's sake, I am simply adding a box in lieu of the window, and some parameters for my asset have been removed.
To see my issue, swap between -1 (correct) and 1 (incorrect) for Central Offset on the AddWindows node. Values of more than 2 are also correct.
Edited by CynthiaDesgagne - Aug. 12, 2025 08:04:44

Attachments:
demo_simplified.hip (106.2 KB)
sop_addwindows.1.0.hda (7.1 KB)

User Avatar
Member
5047 posts
Joined: Feb. 2012
Offline
Hi,

The culprit is the Edge Divide SOP. So you can just sort the primitives to get them to be ordered properly:

Attachments:
sort.png (593.9 KB)

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
5 posts
Joined: Feb. 2024
Offline
Thank you animatrix_, the Sort Node makes a lot of sense. Looking at the documentation, I'll use sort "by attribute" with the distance between the point and the first point. It should now always be perfect.
  • Quick Links